MCPcopy Index your code
hub / github.com/CashScript/cashscript / randomUtxo

Function randomUtxo

packages/cashscript/src/utils.ts:367–374  ·  view source on GitHub ↗
(defaults?: Partial<Utxo>)

Source from the content-addressed store, hash-verified

365 * @returns A synthetic UTXO with random `txid`, `vout`, and `satoshis`.
366 */
367export const randomUtxo = (defaults?: Partial<Utxo>): Utxo => ({
368 ...{
369 txid: binToHex(sha256(bigIntToVmNumber(randomInt()))),
370 vout: Math.floor(Math.random() * 10),
371 satoshis: 100_000n + randomInt(),
372 },
373 ...defaults,
374});
375
376/**
377 * Generate random fungible `TokenDetails` for use in tests and examples. Fields can be overridden

Callers 15

mecenas.tsFile · 0.90
announcement.tsFile · 0.90
p2pkh.jsFile · 0.90
p2pkh.tsFile · 0.90
hodl_vault.tsFile · 0.90
example.test.tsFile · 0.90
Contract.test.tsFile · 0.85

Calls 2

sha256Function · 0.90
randomIntFunction · 0.85

Tested by

no test coverage detected