@etherspot/archanova-migrator
    TypeScript icon, indicating that this package has built-in type declarations

    2.2.0 • Public • Published

    Etherspot archanova migrator

    NPM version

    Installation

    $ npm i ethers@^5.0.8 -S
    $ npm i @etherspot/archanova-migrator -S

    Usage

    import { Migrator } from '@etherspot/archanova-migrator';
    import { utils, Wallet } from 'ethers';
    
    let migrator = new Migrator({
      chainId: 42, // optional, default 1 - mainnet
      archanovaAccount: '0x...', 
      etherspotAccount: '0x...'
    });
    
    // put a private key that already has access to the account you want to migrate
    const privateKey = '0x...';
    const archanovaAccountDevice = new Wallet(privateKey);
    
    // each migration step is optional
    migrator = migrator
      .addAccountDevice() // adds the migrator as an archanova account owner's device, pls check first if the device wasn't already added & connected/deployed
      .transferBalance(utils.parseEther('0.05'))
      .transferERC20Tokens([
        { 
          token: '0x...', 
          amount: 1,
        },
        {
          token: '0x...',
          amount: '0x02',
        },
      ])
      .transferERC721Tokens([
        { 
          token: '0x...', 
          id: 1,
        },
        {
          token: '0x...',
          id: '0x02',
          useLegacyTransferMethod: true,
        },
      ])
      .transferENSName('example.eth')
    
    // personal sign `migrator.migrationMessage` with archanova account owner device
    const archanovaAccountDeviceSignature = await archanovaAccountDevice.signMessage(migrator.migrationMessage);
    
    // encode migration into archanova account transaction args
    migrator.encodeArchanovaAccountTransactionArgs(archanovaAccountDeviceSignature);
    // [ 
    //   '0x...', 0, '0x...', 
    //   '0x...', 0, '0x...', 
    // ]
    
    // encode migration into transaction requests
    migrator.encodeTransactionRequests(archanovaAccountDeviceSignature);
    // [
    //   { to: '0x...', data: '0x...' },
    //   { to: '0x...', data: '0x...' },
    // ]

    License

    MIT

    Keywords

    none

    Install

    npm i @etherspot/archanova-migrator

    DownloadsWeekly Downloads

    21

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    230 kB

    Total Files

    21

    Last publish

    Collaborators

    • staszek
    • jegorsidorenko