> For the complete documentation index, see [llms.txt](https://docs.kiln.fi/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiln.fi/v1/kiln-products/connect/sdk/upgrade-guide-from-v2-to-v3.md).

# Upgrade guide from v2 to v3

How to upgrade our JS SDK to new major version

## v3 changelog <a href="#install-the-sdk" id="install-the-sdk"></a>

Here is the high level changelog of the v3:

* The Kiln class now exposes a type safe HTTP client that exposes all Kiln Connect endpoints available. The client is generated from our OpenAPI specs. The OpenAPI typescript schema is also exposed so you can benefit from all type definitions. The schema and SDK will be updated frequently with newly added endpoints.
* The fireblocks raw signing feature is now under the fireblocks service exposed by the Kiln class. A sign method is available for all protocols we support.

## Upgrade from 2.X to 3.X <a href="#install-the-sdk" id="install-the-sdk"></a>

### Update your dependencies:

```bash
bun i @kilnfi/sdk@latest
```

### Update calls to use the http client instead of specific protocol object.

2.X:

```javascript
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 tx = await k.near.craftStakeTx(
      'account_id',
      'wallet',
      'pool_id',
      0.1,
    );
const txSigned = await k.near.sign(vault, tx);
```

3.X:

```javascript
const k = new Kiln({
  baseUrl: 'https://api.testnet.kiln.fi',
  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 tx = await k.client.POST(
      '/v1/near/transaction/stake',
      {
        body: {
          account_id: 'account_id',
          wallet: 'wallet',
          pool_id: 'pool_id',
          amount_yocto: '1000000000000000000000000',
        }
      }
    );

const signResponse = await k.fireblocks.signNearTx(vault, tx.data.data, "NEAR_TEST");

const broadcastedTx = await k.client.POST("/v1/near/transaction/broadcast", {
      body: {
        signed_tx_serialized: signResponse.signed_tx.data.signed_tx_serialized,
      }
    });
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kiln.fi/v1/kiln-products/connect/sdk/upgrade-guide-from-v2-to-v3.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
