fetchMultisigStorage static method

Future<MultisigStorage?> fetchMultisigStorage(
  1. Provider provider,
  2. Duration storageKeyDelay,
  3. Uint8List callHash,
  4. Uint8List multisigBytes,
)

Fetches the multisig storage from the chain.

This will return null if first approval of typeApproveAsMulti is not yet done.

Implementation

static Future<MultisigStorage?> fetchMultisigStorage(
    Provider provider,
    Duration storageKeyDelay,
    Uint8List callHash,
    Uint8List multisigBytes) async {
  //
  // Multisig Storage creation
  MultisigStorage? decoded;
  {
    final Uint8List multisigStorageKey =
        MultisigStorage.createMultisigStorageKey(multisigBytes, callHash);

    //
    // Wait for sometime and let the storage be created on the chain.
    await Future.delayed(storageKeyDelay);

    //
    // Fetch the storage from the chain.
    final Uint8List? multisigStorage =
        await fetchStorage(provider, multisigStorageKey);

    if (multisigStorage != null) {
      decoded =
          MultisigStorage.decodeFrom(ByteInput.fromBytes(multisigStorage));
    }
  }
  return decoded;
}