MCPcopy Create free account
hub / github.com/CashScript/cashscript / createMessage

Method createMessage

examples/PriceOracle.ts:9–14  ·  view source on GitHub ↗
(blockHeight: bigint, bchUsdPrice: bigint)

Source from the content-addressed store, hash-verified

7
8 // Encode a blockHeight and bchUsdPrice into a byte sequence of 8 bytes (4 bytes per value)
9 createMessage(blockHeight: bigint, bchUsdPrice: bigint): Uint8Array {
10 const encodedBlockHeight = padMinimallyEncodedVmNumber(encodeInt(blockHeight), 4);
11 const encodedBchUsdPrice = padMinimallyEncodedVmNumber(encodeInt(bchUsdPrice), 4);
12
13 return flattenBinArray([encodedBlockHeight, encodedBchUsdPrice]);
14 }
15
16 signMessage(message: Uint8Array, signatureAlgorithm: SignatureAlgorithm = SignatureAlgorithm.SCHNORR): Uint8Array {
17 const signatureTemplate = new SignatureTemplate(this.privateKey, undefined, signatureAlgorithm);

Callers 1

hodl_vault.tsFile · 0.45

Calls 1

encodeIntFunction · 0.90

Tested by

no test coverage detected