deriveAccountWrapperId method

String deriveAccountWrapperId(
  1. String owner
)

The deterministic id of an owner's canonical account wrapper — no chain read needed. The wrapper is a derived object of the account registry, so its id is derive_address(registry, AccountWrapperKey(owner)).

Implementation

String deriveAccountWrapperId(String owner) {
  // `AccountWrapperKey(address)` is a one-field positional struct, so its
  // BCS is just the owner's 32-byte address.
  final key = Uint8List.fromList(
      account_registry.AccountWrapperKey.serialize([owner]).toBytes());
  return deriveObjectID(
    _config.accountRegistry,
    '${_config.accountPackageId}::account_registry::AccountWrapperKey',
    key,
  );
}