The Lombard's Starknet SDK package provides a set of functions that allow interacting with the Lombard protocol and its features.
Read more about Lombard's mission: https://www.lombard.finance
npm install @noble/hashes@^1.7.2 axios@^1 bignumber.js@^9
npm install @lombard.experimental/sdk-common@^3.3.0 @lombard.experimental/sdk@^3.6.0 @lombard.experimental/sdk-starknet
import {
Env, generateDepositBtcAddress, getDepositBtcAddress,
} from '@lombard.experimental/sdk';
import { signLbtcDestinationAddrStarknet } from '@lombard.experimental/sdk-starknet';
let depositAddress = await getDepositBtcAddress({
address: walletAccount.address, // connected wallet address,
chainId: StarknetChainId.SN_SEPOLIA, // the chain identifier, other available options are: StarknetChainId.SN_MAIN
env: Env.stage, // the environment, use Env.stage for StarknetChainId.SN_SEPOLIA testing,
partnerId: ENV_PARTNER_ID, // your partner id
});
if (!depositAddress) {
// Step 1: sign destination address
const sig = await signLbtcDestinationAddrStarknet({
walletAccount: walletAccount, // connected wallet account
chainId: StarknetChainId.SN_SEPOLIA, // the chain identifier, other available options are: StarknetChainId.SN_MAIN
});
// Step 2: generate address
depositAddress = await generateDepositBtcAddress({
address: walletAccount.address, // connected wallet address,
chainId: StarknetChainId.SN_SEPOLIA, // the chain identifier, other available options are: StarknetChainId.SN_MAIN
signature: sig.signatureHex, // the signature hex from step 1
pubKey: sig.pubKey, // the pubkey from step 1
env: Env.stage, // the environment, use Env.stage for StarknetChainId.SN_SEPOLIA testing,
partnerId: ENV_PARTNER_ID, // your partner id
});
}
import { getDepositsByAddress } from '@lombard.experimental/sdk';
const deposits = await getDepositsByAddress({
address: walletAccount.address, // connected wallet address,
env: Env.stage, // the environment, use Env.stage for StarknetChainId.SN_SEPOLIA testing,
});
The above results with an array of:
-
txid: string;
- The BTC transaction id, -
index?: number;
- The index of the BTC transaction, -
value: BigNumber;
- The deposit amount, -
address: Address;
- The source address, -
chainId: ChainId | SuiChain | SolanaChain | StarknetChain;
- -
isClaimed?: boolean;
- A flag determining whether the particular deposit has been claimed, -
claimedTxId?: string;
- The claimed transaction id, -
rawPayload?: string;
- The raw deposit payload, -
signature?: string;
- The deposit signature, -
notarizationWaitDur?: Seconds;
- Approx. number of seconds until notarization completed, -
payload?: string;
- The deposit payload, -
notarizationStatus: ENotarizationStatus;
- The notarization status.
import { mint, Token } from '@lombard.experimental/sdk-starknet';
const mintParams = {
amount: d.value, // The deposit amount
depositIndex: d.index, // The index of the BTC transaction
depositPayload: d.rawPayload, // The raw deposit payload
depositProofSignature: d.signature, // The deposit signature
depositTxId: d.txid, // The BTC transaction id
token: Token.LBTC, // The token identifier
walletAccount: walletAccount, // connected wallet account
};
const txHash = await mint(mintParams);
import { balanceOf, Token, StarknetChain } from '@lombard.experimental/sdk-starknet';
const tokenBalance = await balanceOf({
account: walletAccount, // an instance of the WalletAccount class
token: Token.LBTC, // the token identifier, other available tokens are: Token.ETH and Token.STRK
chainId: StarknetChainId.SN_SEPOLIA, // the chain identifier, other available options are: StarknetChainId.SN_MAIN
});
import { redeem, Token } from '@lombard.experimental/sdk-starknet';
const txHash = await redeem({
amount: amount, // amount to be redeemed, e.g. `BigNumber(0.02)`
btcAddress: btcAddress, // the BTC destination address
token: Token.LBTC, // The token identifier
walletAccount: walletAccount, // connected wallet account
});