isomorphic-wallet
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

isomorphic-wallet

      import Transaction, { SigmaType, TransactionJson } from 'ergoscript';
      import ErgoWallet from 'isomorphic-wallet';


      const wallet = await new ErgoWallet().fromMnemonics('***');
      wallet.setPublicAddress('****');

      // use with ergoscript js tx builder:
      const tx = new Transaction(
        [
          {
            funds: {
              ERG: 0.001 * NANO_ERG_IN_ERG,
              tokens: [
                {
                  tokenId: '',
                  amount: 1,
                  isMint: true,
                },
              ],
            },
            toAddress: '****',
            additionalRegisters: {
              R4: { value: 'Best token ever', type: SigmaType.ByteArray },
              R5: { value: 'Best token ever description', type: SigmaType.ByteArray },
              R6: { value: 0, type: SigmaType.Int },
              R7: { value: '0e020101', type: SigmaType.Raw },
              R8: { value: 'somethings', type: SigmaType.ByteArray },
              R9: {
                value:
                  'https://ipfs.io/ipfs/bafybeidrtmn7grzijipexukinmkmlkmpuugjwv5i2hy33gdipql27myshu',
                type: SigmaType.ByteArray,
              },
            },
          },
        ],
        { wallet }
      );

      const tx = await txInstance.build();

      try {
        const signedTx = wallet.sign_tx(tx.toJSON());
        const txHash = await wallet.submit_tx(signedTx);

      } catch (e) {
        console.error(e);
      }

npm package Build Status Issues Commitizen Friendly Semantic Release

Package Sidebar

Install

npm i isomorphic-wallet

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

59.1 kB

Total Files

45

Last publish

Collaborators

  • nirvanush