AccountMigrateTx is used to migrate the contents of an existing wallet to a new wallet. This can be done for many reasons, including security (e.g., your wallet's secret key has been exposed).

After AccountMigrateTx executes successfully, all of your assets and tokens in your former wallet will have been carried over to your new wallet. Your old wallet will be sealed, and all references to your old wallet's address will be redirected to the address of your new wallet.

Sample Code

The following shows how to use AccountMigrateTx in Protocol Buffers.

message AccountMigrateTx {
  bytes pk = 1;
  WalletType type = 2 [ deprecated = true ];
  string address = 3;

  google.protobuf.Any data = 15;
}
NameData TypeDescription
pkbytesPublic key of new wallet
typeWalletTypeDeprecated. Wallet type of new wallet
addressstringAddress of new wallet
dataGoogle.Protobuf.AnyCustom user data

Sample Usage

There are two steps involved when using AccountMigrateTx to migrate the contents of your wallet.

  1. Declare your old wallet.
old_wallet = ForgeSdk.create_wallet()
ForgeSdk.declare(ForgeAbi.DeclareTx.new(moniker: "sisyphus"), wallet: old_wallet)
  1. Migrate the contents of your old wallet to your new wallet.
new_wallet = ForgeSdk.create_wallet()
ForgeSdk.account_migrate(ForgeAbi.AccountMigrateTx.new(pk: new_wallet.pk, address: new_wallet.address), wallet: old_wallet)