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

Function randomNFT

packages/cashscript/src/utils.ts:398–408  ·  view source on GitHub ↗
(defaults?: Partial<TokenDetails>)

Source from the content-addressed store, hash-verified

396 * @returns Synthetic NFT token details.
397 */
398export const randomNFT = (defaults?: Partial<TokenDetails>): TokenDetails => ({
399 ...{
400 category: binToHex(sha256(bigIntToVmNumber(randomInt()))),
401 amount: 0n,
402 nft: {
403 commitment: binToHex(sha256(bigIntToVmNumber(randomInt()))).slice(0, 8),
404 capability: NonFungibleTokenCapability.none,
405 },
406 },
407 ...defaults,
408});
409
410// https://stackoverflow.com/questions/40929260/find-last-index-of-element-inside-array-by-certain-condition
411export function findLastIndex<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): number {

Callers 3

fixtures.tsFile · 0.85

Calls 2

sha256Function · 0.90
randomIntFunction · 0.85

Tested by

no test coverage detected