createAccountAndDeposit method
void Function(Transaction)
createAccountAndDeposit({
- required dynamic coin,
- required String coinType,
First-time funding in ONE PTB: create the sender's wrapper, deposit
coin through the fresh handle, then share LAST (once shared,
by-value use of the handle is over). This cannot be split into
createAccount + depositFunds: an object input can only address an
object that pre-exists the PTB, so a wrapper created inside it is
reachable only through new's result handle.
coin is a transaction argument (an input object or a prior command's
result) carrying a Coin<coinType>.
Implementation
void Function(Transaction) createAccountAndDeposit({
required dynamic coin,
required String coinType,
}) =>
(tx) {
final wrapper = account_registry.new_(config: _generatedConfig)(tx);
final auth = generateAuth()(tx);
account.depositFunds(
config: _generatedConfig,
arguments: {'wrapper': wrapper, 'auth': auth, 'coin': coin},
typeArguments: [coinType],
)(tx);
account.share(
config: _generatedConfig,
arguments: {'self': wrapper},
)(tx);
};