Kima Network Documentation
  • What is Kima?
  • Supported blockchains
  • Supported tokens
  • Supported fiat currencies and payment methods
  • Adding Kima to your wallet
  • Try Kima with the Demo App
    • The Kima Light Demo App
    • The Kima Advanced Demo App
    • Kima Faucets
    • Kima Block Explorer
  • Become a Kima validator
    • Hardware and operating system requirements
    • Installation
    • Appendix
  • Become a Kima delegator
    • Benefits
    • How does it work?
    • Preparations
    • Delegate
    • Reclaim delegation
  • Become a liquidity provider
    • Benefits
    • Supported blockchains
    • Prepare to provide liquidity
    • Deposit assets in Kima pools
    • Withdraw liquidity
  • Kima governance
    • Draft a proposal
    • On-chain proposal
    • Off-chain proposal
    • References
  • The Kima SDK
    • Kima Use Cases for Developers
    • The Kima Transaction Back End
    • The Kima Transaction Widget
      • Installation
      • React
      • NextJS
      • Payment Mode
      • Bridge Mode
      • Status Mode
      • Configuration Options
    • Upgrading
      • v1.4.x
    • Using the Kima SDK Without the Widget
      • Approval
      • Submitting the Transaction
      • Getting the Transaction Status
    • v1.4
      • Credit Card Transactions
      • Kima Use Cases for Developers
      • The Kima Transaction Back End
      • The Kima Transaction Widget
        • Installation
        • React
        • NextJS
        • Payment Mode
        • Bridge Mode
        • Status Mode
        • Configuration Options
      • Upgrading
        • v1.4.x
      • Using the Kima SDK Without the Widget
        • Transaction Data
        • Message Signing
        • Approval
        • Submitting the Transaction
        • Getting the Transaction Status
  • Further reading
  • Legal
    • Terms and conditions
    • Privacy policy
    • Disclaimer
  • FAQ
Powered by GitBook
On this page
Export as PDF
  1. The Kima SDK
  2. v1.4
  3. Using the Kima SDK Without the Widget

Transaction Data

The following information is needed to prepare for and ultimately submit a Kima transaction.

  • The fee amount and feeId

  • The user choice of whether to pay fees from the origin or target chain

  • The message containting the transaction details for the user to sign

  • The allowance amount the user should approve so Kima can move tokens on behalf of the user

  • The amounts expected when the transaction is submitted

Fortunately, all of these values are calculated by an endpoint exposed by the Kima chain.

Using this endpoint is required as it will return a feeId which must be passed to the /submit endpoint in the backend.

  • Transactions submitted to Kima without a feeId or signature will be rejected

  • Submitted amounts will be validated against the feeId and signed message. Any mismatch will result in the transaction being rejected.

These are security measures to protect the user and ensure the transaction is legitimate.

Using the Kima Backend

GET /submit/fees

Query Params (all required):

  • amount (number): the amount of tokens to transfer

  • originAddress (string): the source user address

  • originChain (string): the chain the user tokens will come from

  • originSymbol (string): the (stable coin) token the user will pay with (or bridge from)

  • targetAddress (string): the receiving address

  • targetChain (string): the destination chain

  • targetSymbol (string): the (stable coin) token being delivered

Example:

http://localhost:3001/submit/fees?amount=10&originAddress=0x742d35Cc6634C0532925a3b844Bc454e4438f44e&originChain=ARB&originSymbol=USDK&targetAddress=5FHwkrdxkjF7xoL2ncGh4AEYs1KyJzz5MeiaHGz8h8GA&targetChain=SOL&targetSymbol=USDK

Success Response:

Amounts are returned as both numbers representing the amount in whole tokens and as a string representing the integer amount in the smallest unit of the token (e.g. USDC is 6 decimals).

  • feeId (string): a unique identifier for the fee; include this in the /submit request

  • feeOrigin* the gas fee for the origin chain

  • feeKimaProcessing* The processing fee (currently 0.05%)

  • feeTarget* the gas fee for the target chain

  • feeTotal* the total fee in USD

  • transactionValues: amounts used for the allowance and submitting the transaction

    • feeFromOrigin: amounts used when the user selects to pay fees from the origin amount

      • allowanceAmount: the token amount that needs to be approved. Can be passed directly to the contract call.

      • submitAmount: the amount that needs to be passed to the /submit endpoint

    • feeFromTarget: amounts used when the user selects to pay fees from the target amount

The allowanceAmount is the one you'll need to pass to the contract call. There are 2 variants returned depending on whether the user chooses to pay fees from the origin or target amount.

  • When paying fees from the origin, use transactionValues.feeFromOrigin values.

  • When paying fees from the target, use transactionValues.feeFromTarget.

Example:

Transferring 10 USDC from ARB to SOL with 0.07371 USD in total fees.

When paying fees from the origin

  • The user pays fees on Arbitrum. The total fees are included in the allowance amount.

  • User signs the message I approve the transfer of 10.07371 USDK from ARB to <targetAddress> on SOL. (feeFromOrigin.message)

  • The user approves a transfer of 10.07371 USDC on Arbitrum (feeFromOrigin.allowanceAmount)

  • The amount sent to the /submit endpoint is amount RECEIVED on the target chain

  • Therefore the amount sent to the /submit endpoint is 10 USDC (feeFromOrigin.submitAmount)

    • Also included is the feeId and signature

  • The user receives 10 USDC on Solana

When paying fees from the target chain

  • The user does not pay fees on Arbitrum

  • User signs the message I approve the transfer of 10 USDK from ARB to <targetAddress> on SOL. (feeFromTarget.message)

  • The user approves a transfer of 10 USDC on Arbitrum (feeFromTarget.allowanceAmount)

  • The amount sent to the /submit endpoint is 9.926290 USDC (feeFromTarget.submitAmount)

  • The fees are deducted from the amount recieved on Solana so the user receives 9.926290 USDC on Solana

Save the corresponding submitAmount, message and feeId for later as they are needed to submit the transaction.

{
  "$schema": "https://fcs.sardis.kima.network/schemas/CalculateFeeResponseV2.json",
  "feeId": "5af06c68-44d6-4079-8e5b-bec1cfa154c7",
  "feeOriginGasFiat": "0.009105",
  "feeOriginGasBigInt": {
    "value": 9105204603000000,
    "decimals": 18
  },
  "feeKimaProcessingFiat": "0.05",
  "feeKimaProcessingBigInt": {
    "value": 50000,
    "decimals": 6
  },
  "feeTargetGasFiat": "0.014605",
  "feeTargetGasBigInt": {
    "value": 14605,
    "decimals": 6
  },
  "feeTotalFiat": "0.07371",
  "feeTotalBigInt": {
    "value": 73710,
    "decimals": 6
  },
  "transactionValues": {
    "feeFromOrigin": {
      "allowanceAmount": {
        "value": 10073710000000000000,
        "decimals": 18
      },
      "submitAmount": {
        "value": 10000000000000000000,
        "decimals": 18
      },
      "message": "I approve the transfer of 10.07371 USDK from ARB to 5FHwkrdxkjF7xoL2ncGh4AEYs1KyJzz5MeiaHGz8h8GA on SOL."
    },
    "feeFromTarget": {
      "allowanceAmount": {
        "value": 10000000,
        "decimals": 6
      },
      "submitAmount": {
        "value": 9926290,
        "decimals": 6
      },
      "message": "I approve the transfer of 10 USDK from ARB to 5FHwkrdxkjF7xoL2ncGh4AEYs1KyJzz5MeiaHGz8h8GA on SOL."
    }
  },
  "peggedTo": "USD",
  "expiration": "2025-05-07T00:24:24Z"
}
PreviousUsing the Kima SDK Without the WidgetNextMessage Signing

Last updated 17 days ago