1.12.0 • Published 8 months ago

@sifi/sdk v1.12.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Sifi.org SDK

SDK for integrating with Sifi.org 🛸

Install

npm install @sifi/sdk

Usage

import { Sifi } from '@sifi/sdk';

// Get a quote to swap 100 USDC to WETH
const quote = await sifi.getQuote({
  fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  toToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
  fromAmount: '100000000',
});

// TODO: Approve `quote.approveAddress` to send `quote.fromAmount` of `quote.fromToken`

const swap = await sifi.getSwap({
  fromAddress: '0xyourwalletaddress',
  quote,
});

const tx = {
  from: swap.tx.from,
  to: swap.tx.to,
  value: swap.tx.value, // When swapping from ETH
  data: swap.tx.data,
  chainId: swap.tx.chainId,
  gasLimit: swap.tx.gasLimit,
};

const res = await sendTransaction(tx);

Notes

For swaps to/from ETH, use the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

License

MIT

1.12.0

8 months ago

1.11.0

11 months ago

1.10.0

12 months ago

1.9.0

12 months ago

1.8.0

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago