@swapkit/core 1.0.0-rc.12 → 1.0.0-rc.120

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.
Files changed (45) hide show
  1. package/dist/index.js +7324 -0
  2. package/dist/index.js.map +41 -0
  3. package/package.json +33 -47
  4. package/src/__tests__/helpers.test.ts +53 -0
  5. package/src/aggregator/contracts/avaxGeneric.ts +50 -50
  6. package/src/aggregator/contracts/avaxWoofi.ts +80 -80
  7. package/src/aggregator/contracts/bscGeneric.ts +59 -59
  8. package/src/aggregator/contracts/ethGeneric.ts +50 -50
  9. package/src/aggregator/contracts/index.ts +30 -28
  10. package/src/aggregator/contracts/pancakeV2.ts +80 -80
  11. package/src/aggregator/contracts/pangolin.ts +65 -65
  12. package/src/aggregator/contracts/routers/index.ts +58 -0
  13. package/src/aggregator/contracts/routers/kyber.ts +402 -0
  14. package/src/aggregator/contracts/routers/oneinch.ts +2188 -0
  15. package/src/aggregator/contracts/routers/pancakeswap.ts +340 -0
  16. package/src/aggregator/contracts/routers/pangolin.ts +340 -0
  17. package/src/aggregator/contracts/routers/sushiswap.ts +340 -0
  18. package/src/aggregator/contracts/routers/traderJoe.ts +340 -0
  19. package/src/aggregator/contracts/routers/uniswapv2.ts +340 -0
  20. package/src/aggregator/contracts/routers/uniswapv3.ts +254 -0
  21. package/src/aggregator/contracts/routers/woofi.ts +171 -0
  22. package/src/aggregator/contracts/sushiswap.ts +65 -65
  23. package/src/aggregator/contracts/traderJoe.ts +65 -65
  24. package/src/aggregator/contracts/uniswapV2.ts +65 -65
  25. package/src/aggregator/contracts/uniswapV2Leg.ts +70 -70
  26. package/src/aggregator/contracts/uniswapV3_100.ts +70 -70
  27. package/src/aggregator/contracts/uniswapV3_10000.ts +70 -70
  28. package/src/aggregator/contracts/uniswapV3_3000.ts +70 -70
  29. package/src/aggregator/contracts/uniswapV3_500.ts +70 -70
  30. package/src/aggregator/getSwapParams.ts +12 -12
  31. package/src/client/index.ts +206 -646
  32. package/src/client/old.ts +854 -0
  33. package/src/helpers/explorerUrls.ts +38 -0
  34. package/src/index.ts +6 -4
  35. package/src/types.ts +149 -0
  36. package/LICENSE +0 -201
  37. package/dist/index-9e36735e.cjs +0 -1
  38. package/dist/index-cf1865cd.js +0 -649
  39. package/dist/index.cjs +0 -2
  40. package/dist/index.d.ts +0 -216
  41. package/dist/index.es.js +0 -3818
  42. package/src/client/__tests__/helpers.test.ts +0 -69
  43. package/src/client/explorerUrls.ts +0 -62
  44. package/src/client/thornode.ts +0 -31
  45. package/src/client/types.ts +0 -103
@@ -1,10 +1,10 @@
1
- import type { QuoteRoute } from '@swapkit/api';
1
+ import type { QuoteRoute } from "@swapkit/helpers";
2
2
 
3
- import type { AGG_CONTRACT_ADDRESS } from './contracts/index.ts';
4
- import { lowercasedGenericAbiMappings } from './contracts/index.ts';
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['calldata'];
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('Router is required on calldata for swapIn with GenericContract');
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 && !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');
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('{recipientAddress}', recipient),
60
+ transactionMemo.replace("{recipientAddress}", recipient),
61
61
  toChecksumAddress(token),
62
62
  amount,
63
63
  ];