npm package: @kimafinance/kima-transaction-api
Description: A wrapper around Kima's API, enabling sending and monitoring transactions (Beta version)
Latest version: 1.5.13

# Kima Transaction API

[![Build & Deploy](https://github.com/kima-finance/kima-transaction-api/actions/workflows/dev_auto_publish_npm.yml/badge.svg)](https://github.com/kima-finance/kima-transaction-api/actions/workflows/dev_auto_publish_npm.yml)
[![npm version](https://img.shields.io/npm/v/%40kimafinance/kima-transaction-api)](https://www.npmjs.com/package/@kimafinance/kima-transaction-api/)
[![Download NPM](https://img.shields.io/npm/dm/%40kimafinance/kima-transaction-api.svg?style=flat)](https://www.npmjs.com/package/@kimafinance/kima-transaction-api/)

A wrapper around Kima's API, enabling sending and monitoring transactions. This is for beta version

## Install

```bash
npm install --save @kimafinance/kima-transaction-api
yarn add @kimafinance/kima-transaction-api
```

## Usage

```ts
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 transactions

`submitKimaSwapTransaction` : 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 parameter

## Environment 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