https://github.com/Sling-Protocol/pkp-dex-sdk
SDK to make swapping ERC-20 tokens easy with Lit Actions and PKPs.
https://github.com/Sling-Protocol/pkp-dex-sdk
Last synced: 22 days ago
JSON representation
SDK to make swapping ERC-20 tokens easy with Lit Actions and PKPs.
- Host: GitHub
- URL: https://github.com/Sling-Protocol/pkp-dex-sdk
- Owner: Sling-Protocol
- License: other
- Created: 2022-08-04T21:07:37.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-12T05:43:45.000Z (over 2 years ago)
- Last Synced: 2024-11-08T06:41:32.412Z (6 months ago)
- Language: JavaScript
- Size: 863 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome - Sling Protocol
README
# pkp-dex-sdk
SDK to make swapping ERC-20 tokens easy with Lit Actions and PKPs.To make the SDK as modular as possible, there are a few different components.
- Methods to generate transaction data to interact with several DEXes.
- A simple Lit Action that uses the PKP to sign an arbitrary message.
- Methods to interact with the Lit Action to acquire a transaction signature.How to use (Uniswap example):
```
const sdk = new SDK(PKP_OWNER_PRIVATE_KEY, PKP_PUBLIC_KEY, testProvider);const approveTx = await sdk.executeApprove(
TOKEN_X_ADDRESS,
addresses.mainnet.uniswap.v3.SwapRouter02,
MaxUint256
);
await approveTx.wait();const swapTx = await sdk.executeUniswapV3SwapExactInputSingle(addresses.mainnet.uniswap.v3.SwapRouter02, { /* Swap Desc */ });
await swapTx.wait();
```## Supported DEXes
- Uniswap V3 (`SwapRouter02`)
- `exactInputSingle`
- 1inch (`AggregationRouterV4`)
- `swap`