cancelAsMulti static method
Future<bool>
cancelAsMulti({
- required MultisigResponse multisigResponse,
- required Provider provider,
- required KeyPair signer,
- Duration storageKeyDelay = const Duration(seconds: 20),
- int tip = 0,
- int eraPeriod = 64,
CancelAsMulti (Only the owner can cancel the multisig call.)
It cancels the multisig transaction.
Implementation
static Future<bool> cancelAsMulti({
required MultisigResponse multisigResponse,
required Provider provider,
required KeyPair signer,
Duration storageKeyDelay = const Duration(seconds: 20),
int tip = 0,
int eraPeriod = 64,
}) async {
final MultisigStorage? multisigStorage = await fetchMultisigStorage(
provider,
storageKeyDelay,
multisigResponse.callHash.hexToUint8List(),
multisigResponse.multisigBytes);
assertion(multisigStorage != null,
'The multisig storage does not exist on the chain.');
if (multisigStorage!
.isApprovedByAll(multisigResponse.allSignatories.length)) {
return false;
}
if (multisigStorage.isOwner(signer.publicKey.bytes.toUint8List()) ==
false) {
throw OwnerCallException('Only the owner can cancel the multisig call.');
}
final meta = await MultiSigMeta.fromProvider(provider: provider);
final signatories = Signatories.fromAddresses(
multisigResponse.allSignatories, multisigResponse.threshold);
await _createAndSubmitPayload(
meta: meta,
method: cancelAsMultiMethod(
chainInfo: meta.runtimeMetadata.chainInfo,
otherSignatories:
signatories.signatoriesExcludeBytes(signer.publicKey.bytes),
threshold: multisigResponse.threshold,
callHash: Uint8List.fromList(hex.decode(multisigResponse.callHash)),
multiSigStorage: multisigStorage,
),
tip: tip,
eraPeriod: eraPeriod,
signer: signer,
provider: provider,
);
return true;
}