How to get_asset_outputs_for_amount and get_asset_inputs_for_amount with TS dsk

To be able to cancel predicate that I have created I need to pass inputs and outputs like in this rust sdk code here

How can I get_asset_outputs_for_amount and get_asset_inputs_for_amount with TS sdk?

1 Like

Within the TS SDK, a Predicate extends the functionality of an Account, it is within here that you will find the transactional methods: link to source code.

Here are some example usages for retrieving asset information:

const quantities: CoinQuantityLike[] = [
  {
    amount: 1_000_000,
    assetId: NativeAssetId,
  }
];

console.log('unspent resources', await predicate.getResourcesToSpend(quantities));
console.log('coins', await predicate.getCoins());
console.log('balances', await predicate.getBalances());
console.log('balance for a given asset id', await predicate.getBalance(NativeAssetId));

Does this help with your use case?