npm package: @kinesis-bridge/kinesis-sdk
Description: SDK for simulating and executing bridge transactions between Kadena and Ethereum
Latest version: 1.8.0

# Kinesis Bridge SDK

A comprehensive SDK for simulating and executing bridge transactions between Kadena and Ethereum. This SDK provides seamless cross-chain token bridging capabilities with support for both mainnet and testnet environments.

## Features

- **Cross-Chain Bridging**: Bridge tokens between Kadena and Ethereum networks
- **Transaction Simulation**: Simulate bridge transactions before execution
- **Transaction Monitoring**: Wait for and monitor transaction status
- **Token Management**: Get available tokens for any supported network
- **Multi-Network Support**: Support for Ethereum mainnet, Sepolia testnet, and Kadena mainnet/testnet

## Installation

```bash
npm install @kinesis-bridge/kinesis-sdk
```

## Configuration

```typescript
import {
  createKinesisClient,
  KinesisClientConfig,
} from "@kinesis-bridge/kinesis-sdk";

const config: KinesisClientConfig = {
  kadenaRpcUrl: "<kadena-rpc-endpoint>",
  ethereumRpcUrl: "<ethereum-rpc-endpoint>",
  kadenaBridgeNamespace: "<bridge-namespace>",
  kadenaBridgeAdmin: "<bridge-admin-address>",
};

const client = createKinesisClient(config);
```

## Available Functions

### 1. Get Token List

Retrieve available tokens for a specific network and chain.

```typescript
getTokenList(params: GetTokenListParams): GetTokenListResponse;
```

### 2. Simulate Bridge Transaction

Simulate a bridge transaction to estimate fees, amounts, and timing.

```typescript
simulateBridgeTransaction(params: SimulateBridgeParams): Promise<SimulateBridgeResult>;
```

### 3. Execute Bridge Transaction

Execute a bridge transaction to transfer tokens between chains.

```typescript
executeBridgeTransaction(params: ExecuteBridgeParams): Promise<{ txnHash: string }>;
```

### 4. Wait for Transaction

Monitor the status of a bridge transaction.

```typescript
waitForTransaction(params: WaitForTransactionParams): Promise<WaitForTransactionResult>
```

## Examples

Here are comprehensive examples of how to use the Kinesis Bridge SDK:

### Example 1: Get Token List

```typescript
import { createKinesisClient } from "@kinesis-bridge/kinesis-sdk";

// Create client
const client = createKinesisClient({
  kadenaRpcUrl: "<kadena-rpc-endpoint>",
  ethereumRpcUrl: "<ethereum-rpc-endpoint>",
  kadenaBridgeNamespace: "<bridge-namespace>",
  kadenaBridgeAdmin: "<bridge-admin-address>",
});

// Get tokens for Ethereum mainnet
const ethereumTokens = client.getTokenList({
  network: "ethereum",
  chainId: 1,
});
console.log(ethereumTokens);

// Get tokens for Kadena mainnet01 chain 2
const kadenaTokens = client.getTokenList({
  network: "mainnet01",
  chainId: 2,
});
console.log(kadenaTokens);
```

### Example 2: Simulate Bridge Transaction

```typescript
import { createKinesisClient } from "@kinesis-bridge/kinesis-sdk";

// Create client
const client = createKinesisClient({
  kadenaRpcUrl: "<kadena-rpc-endpoint>",
  ethereumRpcUrl: "<ethereum-rpc-endpoint>",
  kadenaBridgeNamespace: "<bridge-namespace>",
  kadenaBridgeAdmin: "<bridge-admin-address>",
});

// Simulate Ethereum to Kadena bridge transaction
const params = {
  tokenAddressIn: "0x036901c9b0fb0f57a84a58d1bcc5de58e40d56df",
  amountIn: "0.01",
  networkIn: "sepolia",
  chainIdIn: 11155111,
  senderAddress: "0x27306D552D2885F62274DF31D0feCedB34aE53cb",
  tokenAddressOut: "n_21bfb994661266c50e743622e5372a0ccd24f67c.kb-ETH",
  slippage: "1.0",
  networkOut: "testnet04",
  chainIdOut: 2,
  receiverAddress:
    "k:4307031499abcf7c7e21c7d2b8ad20b392b367d678d94edc226e18fd54460f1d",
};

const resultEthereum = await client.simulateBridgeTransaction(params);
console.log(resultEthereum);

// Simulate Kadena to Ethereum bridge transaction
const paramsKadena = {
  tokenAddressIn: "n_21bfb994661266c50e743622e5372a0ccd24f67c.kb-ETH",
  amountIn: "0.01",
  networkIn: "testnet04",
  chainIdIn: 2,
  senderAddress:
    "k:140f4b3f68c833656622c02b1d809b65acc98137c1469575a78788f2623a0dc1",
  tokenAddressOut: "0x036901c9b0fb0f57a84a58d1bcc5de58e40d56df",
  slippage: "1.0",
  networkOut: "sepolia",
  chainIdOut: 11155111,
  receiverAddress: "0x27306D552D2885F62274DF31D0feCedB34aE53cb",
};

const resultKadena = await client.simulateBridgeTransaction(paramsKadena);
console.log(resultKadena);
```

### Example 3: Execute Bridge Transaction and Wait for Result

```typescript
import { createKinesisClient } from "@kinesis-bridge/kinesis-sdk";

// Create client
const client = createKinesisClient({
  kadenaRpcUrl: "<kadena-rpc-endpoint>",
  ethereumRpcUrl: "<ethereum-rpc-endpoint>",
  kadenaBridgeNamespace: "<bridge-namespace>",
  kadenaBridgeAdmin: "<bridge-admin-address>",
});

// Execute Ethereum to Kadena bridge transaction
const ethereumToKadenaParams = {
  tokenAddressIn: "0x036901c9b0fb0f57a84a58d1bcc5de58e40d56df",
  amountIn: "0.01",
  networkIn: "sepolia",
  chainIdIn: 11155111,
  senderAddress: "0x27306D552D2885F62274DF31D0feCedB34aE53cb",
  tokenAddressOut: "n_21bfb994661266c50e743622e5372a0ccd24f67c.kb-ETH",
  amountOut: "0.01",
  minAmountOut: "0.0099",
  networkOut: "testnet04",
  chainIdOut: 2,
  receiverAddress:
    "k:4307031499abcf7c7e21c7d2b8ad20b392b367d678d94edc226e18fd54460f1d",
};

const hash = await client.executeBridgeTransaction(ethereumToKadenaParams);

// Wait for the transaction to complete
const ethParams = {
  txnHash: hash.txnHash,
  network: "sepolia",
  chainId: 11155111,
};

const result = await client.waitForTransaction(ethParams);
console.log("Transaction status:", result.status);
console.log("Message:", result.message);
```