2.14.2 • Published 17 days ago

@kilnfi/sdk v2.14.2

Weekly downloads
-
License
BUSL-1.1
Repository
-
Last release
17 days ago

Description

Kiln JS SDK makes it easy to interact with the Kiln staking platform.

It provides a simple way of crafting staking transactions as well getting real time and historical data about your stakes.

Check out the full documentation.

Supported protocols

  • ADA
  • ATOM
  • DOT
  • DYDX
  • ETH
  • FET
  • INJ
  • MATIC
  • NEAR
  • NOBLE
  • OSMO
  • SOL
  • TIA
  • XTZ
  • More protocol to come, don't hesitate to contact us (support@kiln.fi)

⚠️️WARNING:

The transaction crafting and reporting are done on mainnet networks on OSMO / TIA / DYDX even in testnet mode.

Installation

You can install the JS SDK with npm:

npm install --save @kilnfi/sdk

Setup

In order to use this sdk, you will need a kiln api token. Please contact support@kiln.fi to get one.

import { Kiln } from "../src/kiln";

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

Craft 32 ETH staking transaction, sign it with fireblocks and broadcast it

import { Kiln } from "@kilnfi/sdk";
import { Integration } from "@kilnfi/sdk/lib/types/integrations";
const fs = require("fs");

const apiSecret = fs.readFileSync(__dirname + "/path_to_fireblocks_secret", "utf8");

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
};

try {
  // Craft 32 ETH staking transaction
  const tx = await k.eth.craftStakeTx("kiln_account_id", "withdrawal_address", 32);

  // Sign it with your fireblock vault
  const txSigned = await k.eth.sign(vault, tx);

  // Broadcast it
  const hash = await k.eth.broadcast(txSigned);
} catch (err) {
  // handle errors
}

Fetch ETH stakes and network stats

try {
  // Get stakes by accounts
  const stakes = await k.eth.getAccountsRewards(["kiln-account-id"]);

  // Get stakes by wallets
  const stakesByWallet = await k.eth.getWalletRewards(["wallet-address"]);

  // Get stakes by validators
  const stakesByValidator = await k.eth.getStakesRewards(["validator-address"]);

  // Get network stats
  const stats = await k.eth.getNetworkStats();
} catch (err) {
  // handle errors
}

License

This package is open-sourced software licensed under the BUSL-1.1 license.

2.14.1

17 days ago

2.14.2

17 days ago

2.14.0

17 days ago

2.13.0

29 days ago

2.12.3

30 days ago

2.12.2

30 days ago

2.12.1

1 month ago

2.12.0

2 months ago

2.11.2

2 months ago

2.11.1

3 months ago

2.11.0

3 months ago

2.10.0

3 months ago

2.9.0

5 months ago

2.5.0

9 months ago

2.7.0

5 months ago

2.5.2

8 months ago

2.6.0

6 months ago

2.5.1

8 months ago

2.5.4

7 months ago

2.8.0

5 months ago

2.5.3

8 months ago

2.5.6

6 months ago

2.5.5

7 months ago

2.5.7

6 months ago

2.3.0

12 months ago

2.4.1

11 months ago

2.4.0

11 months ago

2.3.1

12 months ago

1.4.5

1 year ago

1.4.4

1 year ago

2.2.0

1 year ago

2.0.2

1 year ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.3.2

1 year ago

1.4.0

1 year ago

1.2.3

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago