Closed jinglescode closed 3 months ago
propose to have a reusable function getUtxoFromSciprt() where it fetches the UTXOs needed to redeem value of a transaction. This function should be general enough such that it can support any smart contract especially those in aiken lib.
getUtxoFromSciprt()
reference:
async function _getAssetUtxo({scriptAddress, asset, datum}) { const blockfrostProvider = new BlockfrostProvider( '<blockfrostApiKey>', ); const utxos = await blockfrostProvider.fetchAddressUTxOs( scriptAddress, asset ); const dataHash = resolveDataHash(datum); let utxo = utxos.find((utxo: any) => { return utxo.output.dataHash == dataHash; }); return utxo; };
For example for AIken Vesting contract:
propose to have a reusable function
getUtxoFromSciprt()
where it fetches the UTXOs needed to redeem value of a transaction. This function should be general enough such that it can support any smart contract especially those in aiken lib.reference:
For example for AIken Vesting contract: