@swapkit/core 1.0.0-rc.12 → 1.0.0-rc.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7324 -0
- package/dist/index.js.map +41 -0
- package/package.json +33 -47
- package/src/__tests__/helpers.test.ts +53 -0
- package/src/aggregator/contracts/avaxGeneric.ts +50 -50
- package/src/aggregator/contracts/avaxWoofi.ts +80 -80
- package/src/aggregator/contracts/bscGeneric.ts +59 -59
- package/src/aggregator/contracts/ethGeneric.ts +50 -50
- package/src/aggregator/contracts/index.ts +30 -28
- package/src/aggregator/contracts/pancakeV2.ts +80 -80
- package/src/aggregator/contracts/pangolin.ts +65 -65
- package/src/aggregator/contracts/routers/index.ts +58 -0
- package/src/aggregator/contracts/routers/kyber.ts +402 -0
- package/src/aggregator/contracts/routers/oneinch.ts +2188 -0
- package/src/aggregator/contracts/routers/pancakeswap.ts +340 -0
- package/src/aggregator/contracts/routers/pangolin.ts +340 -0
- package/src/aggregator/contracts/routers/sushiswap.ts +340 -0
- package/src/aggregator/contracts/routers/traderJoe.ts +340 -0
- package/src/aggregator/contracts/routers/uniswapv2.ts +340 -0
- package/src/aggregator/contracts/routers/uniswapv3.ts +254 -0
- package/src/aggregator/contracts/routers/woofi.ts +171 -0
- package/src/aggregator/contracts/sushiswap.ts +65 -65
- package/src/aggregator/contracts/traderJoe.ts +65 -65
- package/src/aggregator/contracts/uniswapV2.ts +65 -65
- package/src/aggregator/contracts/uniswapV2Leg.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_100.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_10000.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_3000.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_500.ts +70 -70
- package/src/aggregator/getSwapParams.ts +12 -12
- package/src/client/index.ts +206 -646
- package/src/client/old.ts +854 -0
- package/src/helpers/explorerUrls.ts +38 -0
- package/src/index.ts +6 -4
- package/src/types.ts +149 -0
- package/LICENSE +0 -201
- package/dist/index-9e36735e.cjs +0 -1
- package/dist/index-cf1865cd.js +0 -649
- package/dist/index.cjs +0 -2
- package/dist/index.d.ts +0 -216
- package/dist/index.es.js +0 -3818
- package/src/client/__tests__/helpers.test.ts +0 -69
- package/src/client/explorerUrls.ts +0 -62
- package/src/client/thornode.ts +0 -31
- package/src/client/types.ts +0 -103
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { QuoteRoute } from
|
|
1
|
+
import type { QuoteRoute } from "@swapkit/helpers";
|
|
2
2
|
|
|
3
|
-
import type { AGG_CONTRACT_ADDRESS } from
|
|
4
|
-
import { lowercasedGenericAbiMappings } from
|
|
3
|
+
import type { AGG_CONTRACT_ADDRESS } from "./contracts/index.ts";
|
|
4
|
+
import { lowercasedGenericAbiMappings } from "./contracts/index.ts";
|
|
5
5
|
|
|
6
6
|
type SwapInParams = {
|
|
7
|
-
calldata: QuoteRoute[
|
|
7
|
+
calldata: QuoteRoute["calldata"];
|
|
8
8
|
recipient: string;
|
|
9
9
|
streamSwap?: boolean;
|
|
10
10
|
contractAddress: AGG_CONTRACT_ADDRESS;
|
|
@@ -18,8 +18,8 @@ export const getSwapInParams = ({
|
|
|
18
18
|
toChecksumAddress,
|
|
19
19
|
calldata: {
|
|
20
20
|
amount,
|
|
21
|
-
amountOutMin =
|
|
22
|
-
data =
|
|
21
|
+
amountOutMin = "",
|
|
22
|
+
data = "",
|
|
23
23
|
deadline,
|
|
24
24
|
memo,
|
|
25
25
|
router,
|
|
@@ -34,7 +34,7 @@ export const getSwapInParams = ({
|
|
|
34
34
|
const isGeneric = !!lowercasedGenericAbiMappings[contractAddress.toLowerCase()];
|
|
35
35
|
|
|
36
36
|
if (isGeneric && !router) {
|
|
37
|
-
throw new Error(
|
|
37
|
+
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -48,16 +48,16 @@ export const getSwapInParams = ({
|
|
|
48
48
|
const baseMemo = tcMemo || memo;
|
|
49
49
|
const transactionMemo = streamSwap ? memoStreamingSwap || baseMemo : baseMemo;
|
|
50
50
|
|
|
51
|
-
if (!tcVault
|
|
52
|
-
if (!tcRouter
|
|
53
|
-
if (!transactionMemo) throw new Error(
|
|
54
|
-
if (!token) throw new Error(
|
|
51
|
+
if (!(tcVault || vault)) throw new Error("TC Vault is required on calldata");
|
|
52
|
+
if (!(tcRouter || router)) throw new Error("TC Router is required on calldata");
|
|
53
|
+
if (!transactionMemo) throw new Error("TC Memo is required on calldata");
|
|
54
|
+
if (!token) throw new Error("Token is required on calldata");
|
|
55
55
|
|
|
56
56
|
const baseParams = [
|
|
57
57
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
58
58
|
toChecksumAddress((tcRouter || router) as string),
|
|
59
59
|
toChecksumAddress((tcVault || vault) as string),
|
|
60
|
-
transactionMemo.replace(
|
|
60
|
+
transactionMemo.replace("{recipientAddress}", recipient),
|
|
61
61
|
toChecksumAddress(token),
|
|
62
62
|
amount,
|
|
63
63
|
];
|