withdrawFunds method

TransactionResult Function(Transaction) withdrawFunds({
  1. required String wrapperId,
  2. required BigInt amount,
  3. required String coinType,
})

Withdraw amount (raw u64 units) from the account's stored balance via the PTB-callable withdraw_funds (folds settle → authorize → load → withdraw; clock and accumulator root auto-injected), returning the minted Coin<T> for the caller to transfer or compose.

Implementation

TransactionResult Function(Transaction) withdrawFunds({
  required String wrapperId,
  required BigInt amount,
  required String coinType,
}) =>
    (tx) {
      final auth = generateAuth()(tx);
      return account.withdrawFunds(
        config: _generatedConfig,
        arguments: {'wrapper': wrapperId, 'auth': auth, 'amount': amount},
        typeArguments: [coinType],
      )(tx);
    };