createWallet method

Future<TCreateWalletResponse> createWallet({
  1. required TCreateWalletBody input,
})

Create a wallet and derive addresses.

Sign the provided TCreateWalletBody with the client's stamp function and submit the request (POST /public/v1/submit/create_wallet).

See also: stampCreateWallet.

Implementation

Future<TCreateWalletResponse> createWallet({
  required TCreateWalletBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_CREATE_WALLET',
  );
  return await request<Map<String, dynamic>, TCreateWalletResponse>(
      "/public/v1/submit/create_wallet",
      body,
      (json) => TCreateWalletResponse.fromJson(
          transformActivityResponse(json, 'CreateWallet')));
}