@kimafinance/kima-transaction-api
v1.5.13
Published
A wrapper around Kima's API, enabling sending and monitoring transactions (Beta version)
Downloads
274
Readme
Kima Transaction API
A wrapper around Kima's API, enabling sending and monitoring transactions. This is for beta version
Install
npm install --save @kimafinance/kima-transaction-api
yarn add @kimafinance/kima-transaction-apiUsage
import {
submitKimaTransferTransaction,
submitKimaSwapTransaction,
SupportedNetworks,
CurrencyOptions,
SubmitOptionsPayload,
} from "@kimafinance/kima-transaction-api";
const transferOptions: SubmitOptionsPayload = {
signature: "", // approval message signature
feeId: "", // fee id from fee quote
chargeFeeAtTarget: false,
transactionIdSeed: "",
transactionIdSignature: "",
permit2: {
r: "0x...",
s: "0x...",
v: 27,
deadline: 1735689600,
},
};
const txResult = await submitKimaTransferTransaction({
originAddress: "0x1234123412341234123412341234123412341234",
originChain: "ETH",
originSymbol: "USDK",
targetAddress: "0x1234123412341234123412341234123412341234",
targetChain: "POL",
targetSymbol: "USDK",
amount: "100",
fee: "0.3",
htlcCreationHash: "", // required to send empty strings for now
htlcCreationVout: "",
htlcExpirationTimestamp: "",
htlcVersion: "",
senderPubKey: "",
// Runtime wire format stays a serialized JSON string
options: JSON.stringify(transferOptions),
});
const txResult = await submitKimaSwapTransaction({
originAddress: "0x1234123412341234123412341234123412341234",
originChain: "ETH",
originSymbol: "USDK",
targetAddress: "0x1234123412341234123412341234123412341234",
targetChain: "POL",
targetSymbol: "USDK",
amountIn: "100",
amountOut: "100",
fee: "0.3",
dex: "uniswap", // required to send empty strings for now
slippage: "0.05",
options: JSON.stringify({
signature: "",
feeId: "",
permit2: {
r: "0x...",
s: "0x...",
v: 28,
deadline: 1735689600,
},
} satisfies SubmitOptionsPayload),
});Available Functions
submitKimaTransferTransaction : Submit a transaction to transfer liquidity from one change to another.
- `originAddress`: sending address
- `originChain`: sending chain
- `originSymbol`: sending token symbol
- `targetAddress`: receiving address
- `targetChain`: receiving chain
- `targetSymbol`: receiving token symbol
- `amount`: amount of token to transfer
- `fee`: amount of token that kima consumes to pay gas fee for pulling & releasing token transactionssubmitKimaSwapTransaction : Submit a transaction to swap token from one chain to another.
- `originAddress`: sending address
- `originChain`: sending chain
- `originSymbol`: sending token symbol
- `targetAddress`: receiving address
- `targetChain`: receiving chain
- `targetSymbol`: receiving token symbol
- `amountIn`: amount of token to swap
- `amountOut`: expected amount of token to receive
- `fee`: amount of token that kima consumes to pay gas fee for pulling & swapping token transactions
- `dex`: the name of the dex that user wants to interact with (optional)
- `slippage`: maximum acceptable slippage parameterEnvironment Variables
KIMA_BACKEND_MNEMONIC : Seed phrase of developer wallet. This wallet must have KIMA token to submit a transaction to kima chain.
KIMA_BACKEND_NODE_PROVIDER : Node provider for kima chain
