JS SDK upgrade guide

How to upgrade our JS SDK to new major version

# v2 changelog

Here is the high level changelog of the v2:

  • Support for XTZ transaction crafting, stakes and rewards data

  • Support for MATIC transaction crafting

  • Support for ATOM withdraw rewards transaction

  • Bug fixes

Upgrade from 1.X to 2.X

Update your dependencies:

npm i @kilnfi/sdk@latest

Update your integration and your sign functions

The sign function on all protocols now takes an integration object. You can also remove your integrations from the Kiln constructor.

1.X:

const k = new Kiln({
  testnet: true,
  apiToken: 'kiln_xxx',
  integrations: [
    {
      name: 'vault1',
      provider: 'fireblocks',
      fireblocksApiKey: 'fireblocks_api_key',
      fireblocksSecretKey: apiSecret,
      vaultAccountId: 'vault_account_id'
    }
  ],
});

...

const txSigned = await k.eth.sign('vault1', tx);

2.X:

import { Integration } from "@kilnfi/sdk/lib/types/integrations";

const k = new Kiln({
  testnet: true,
  apiToken: 'kiln_xxx',
});

const vault: Integration = {
  provider: 'fireblocks',
  fireblocksApiKey: 'YOUR_API_USER_KEY', // your fireblocks API user key
  fireblocksSecretKey: apiSecret, // your fireblocks private key (generated with your CSR file and your API user)
  vaultId: 7 // your fireblocks vault id
};

...

const txSigned = await k.eth.sign(vault, tx);

Update your staking function signatures

Depending on the protocol, we now require the validator address to be passed as parameter of staking functions when required. You will need to update these functions:

  • k.ada.craftStakeTx

  • k.atom.craftStakeTx

  • k.atom.craftWithdrawRewardsTx

  • k.atom.craftUnstakeTx

  • k.near.craftStakeTx

  • k.near.craftUnstakeTx

  • k.near.craftWithdrawTx

  • k.sol.craftStakeTx

Please check out how you can find Kiln's validator addresses.

Last updated