createAndFundMultisig static method
This creates the multisig account on the chain and funds it.
Implementation
static Future<MultisigResponse> createAndFundMultisig({
required KeyPair depositorKeyPair,
required int threshold,
required String recipientAddress,
required BigInt amount,
required Provider provider,
required List<String> otherSignatoriesAddressList,
int tip = 0,
int eraPeriod = 64,
}) async {
final meta = await MultiSigMeta.fromProvider(provider: provider);
/// Make Signatories
final Signatories signatories = Signatories.fromAddresses(
[depositorKeyPair.address, ...otherSignatoriesAddressList], threshold);
final Uint8List mutisigBytes = signatories.mutiSigBytes;
//
// Create and Fund the Multisig Account
{
await _createAndSubmitPayload(
meta: meta,
method: Transfers.transferKeepAlive.encode(
meta.runtimeMetadata.chainInfo,
mutisigBytes,
amount,
),
tip: tip,
eraPeriod: eraPeriod,
signer: depositorKeyPair,
provider: provider,
);
}
// Making the callData
final Uint8List callData = Transfers.transferKeepAlive.encode(
meta.runtimeMetadata.chainInfo,
Address.decode(recipientAddress).pubkey,
amount,
);
return MultisigResponse(
callData: callData.toHex(),
callHash: Hasher.blake2b256.hash(callData).toHex(),
threshold: threshold,
allSignatories: signatories.sortedSignatoriesAddresses,
);
}