@swapkit/helpers 4.0.0-beta.32 → 4.0.0-beta.34

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 (251) hide show
  1. package/dist/api/index.js +2 -2
  2. package/dist/api/index.js.map +1 -1
  3. package/dist/{chunk-ganzk321.js → chunk-hm14bfyg.js} +3 -3
  4. package/dist/{chunk-fazw0jvt.js.map → chunk-hm14bfyg.js.map} +1 -1
  5. package/dist/chunk-vb4wtm2w.js +4 -0
  6. package/dist/{chunk-ganzk321.js.map → chunk-vb4wtm2w.js.map} +1 -1
  7. package/dist/contracts.cjs +4 -0
  8. package/dist/contracts.cjs.map +10 -0
  9. package/dist/contracts.js +4 -0
  10. package/dist/contracts.js.map +10 -0
  11. package/dist/index.cjs +3 -3
  12. package/dist/index.cjs.map +11 -11
  13. package/dist/index.js +3 -3
  14. package/dist/index.js.map +11 -11
  15. package/dist/tokens.cjs +4 -0
  16. package/dist/tokens.cjs.map +10 -0
  17. package/dist/tokens.js +4 -0
  18. package/dist/tokens.js.map +10 -0
  19. package/dist/types/api/index.d.ts +238 -0
  20. package/dist/types/api/index.d.ts.map +1 -0
  21. package/dist/types/api/microgard/endpoints.d.ts +25 -0
  22. package/dist/types/api/microgard/endpoints.d.ts.map +1 -0
  23. package/dist/types/api/microgard/types.d.ts +56 -0
  24. package/dist/types/api/microgard/types.d.ts.map +1 -0
  25. package/dist/types/api/midgard/endpoints.d.ts +35 -0
  26. package/dist/types/api/midgard/endpoints.d.ts.map +1 -0
  27. package/dist/types/api/midgard/types.d.ts +102 -0
  28. package/dist/types/api/midgard/types.d.ts.map +1 -0
  29. package/dist/types/api/swapkitApi/endpoints.d.ts +194 -0
  30. package/dist/types/api/swapkitApi/endpoints.d.ts.map +1 -0
  31. package/dist/types/api/swapkitApi/types.d.ts +7238 -0
  32. package/dist/types/api/swapkitApi/types.d.ts.map +1 -0
  33. package/dist/types/api/thornode/endpoints.d.ts +31 -0
  34. package/dist/types/api/thornode/endpoints.d.ts.map +1 -0
  35. package/dist/types/api/thornode/types.d.ts +264 -0
  36. package/dist/types/api/thornode/types.d.ts.map +1 -0
  37. package/dist/types/api/thorswapStatic/endpoints.d.ts +7 -0
  38. package/dist/types/api/thorswapStatic/endpoints.d.ts.map +1 -0
  39. package/dist/types/api/thorswapStatic/types.d.ts +22 -0
  40. package/dist/types/api/thorswapStatic/types.d.ts.map +1 -0
  41. package/dist/types/contracts.d.ts +2 -0
  42. package/dist/types/contracts.d.ts.map +1 -0
  43. package/{src/index.ts → dist/types/index.d.ts} +3 -4
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/modules/assetValue.d.ts +71 -0
  46. package/dist/types/modules/assetValue.d.ts.map +1 -0
  47. package/dist/types/modules/bigIntArithmetics.d.ts +56 -0
  48. package/dist/types/modules/bigIntArithmetics.d.ts.map +1 -0
  49. package/dist/types/modules/feeMultiplier.d.ts +45 -0
  50. package/dist/types/modules/feeMultiplier.d.ts.map +1 -0
  51. package/dist/types/modules/requestClient.d.ts +22 -0
  52. package/dist/types/modules/requestClient.d.ts.map +1 -0
  53. package/dist/types/modules/swapKitConfig.d.ts +98 -0
  54. package/dist/types/modules/swapKitConfig.d.ts.map +1 -0
  55. package/dist/types/modules/swapKitError.d.ts +829 -0
  56. package/dist/types/modules/swapKitError.d.ts.map +1 -0
  57. package/dist/types/modules/swapKitNumber.d.ts +7 -0
  58. package/dist/types/modules/swapKitNumber.d.ts.map +1 -0
  59. package/dist/types/tokens.d.ts +2 -0
  60. package/dist/types/tokens.d.ts.map +1 -0
  61. package/dist/types/types/chains.d.ts +187 -0
  62. package/dist/types/types/chains.d.ts.map +1 -0
  63. package/dist/types/types/commonTypes.d.ts +37 -0
  64. package/dist/types/types/commonTypes.d.ts.map +1 -0
  65. package/dist/types/types/derivationPath.d.ts +17 -0
  66. package/dist/types/types/derivationPath.d.ts.map +1 -0
  67. package/dist/types/types/errors/apiV1.d.ts +2 -0
  68. package/dist/types/types/errors/apiV1.d.ts.map +1 -0
  69. package/{src/types/index.ts → dist/types/types/index.d.ts} +1 -1
  70. package/dist/types/types/index.d.ts.map +1 -0
  71. package/dist/types/types/quotes.d.ts +170 -0
  72. package/dist/types/types/quotes.d.ts.map +1 -0
  73. package/dist/types/types/radix.d.ts +15 -0
  74. package/dist/types/types/radix.d.ts.map +1 -0
  75. package/dist/types/types/sdk.d.ts +35 -0
  76. package/dist/types/types/sdk.d.ts.map +1 -0
  77. package/dist/types/types/wallet.d.ts +121 -0
  78. package/dist/types/types/wallet.d.ts.map +1 -0
  79. package/dist/types/utils/asset.d.ts +40 -0
  80. package/dist/types/utils/asset.d.ts.map +1 -0
  81. package/dist/types/utils/derivationPath.d.ts +19 -0
  82. package/dist/types/utils/derivationPath.d.ts.map +1 -0
  83. package/dist/types/utils/explorerUrls.d.ts +10 -0
  84. package/dist/types/utils/explorerUrls.d.ts.map +1 -0
  85. package/dist/types/utils/liquidity.d.ts +59 -0
  86. package/dist/types/utils/liquidity.d.ts.map +1 -0
  87. package/dist/types/utils/memo.d.ts +65 -0
  88. package/dist/types/utils/memo.d.ts.map +1 -0
  89. package/dist/types/utils/others.d.ts +9 -0
  90. package/dist/types/utils/others.d.ts.map +1 -0
  91. package/dist/types/utils/validators.d.ts +3 -0
  92. package/dist/types/utils/validators.d.ts.map +1 -0
  93. package/dist/types/utils/wallets.d.ts +32 -0
  94. package/dist/types/utils/wallets.d.ts.map +1 -0
  95. package/package.json +14 -15
  96. package/dist/chunk-06q78xy3.js +0 -4
  97. package/dist/chunk-06q78xy3.js.map +0 -10
  98. package/dist/chunk-0q5vvg5c.js +0 -5
  99. package/dist/chunk-0q5vvg5c.js.map +0 -10
  100. package/dist/chunk-18bxh1n7.js +0 -5
  101. package/dist/chunk-18bxh1n7.js.map +0 -10
  102. package/dist/chunk-3qya5ng9.js +0 -4
  103. package/dist/chunk-3qya5ng9.js.map +0 -10
  104. package/dist/chunk-4yqymkbp.js +0 -5
  105. package/dist/chunk-4yqymkbp.js.map +0 -10
  106. package/dist/chunk-50gpwcq9.js +0 -4
  107. package/dist/chunk-50gpwcq9.js.map +0 -10
  108. package/dist/chunk-6atq9cs7.js +0 -4
  109. package/dist/chunk-6atq9cs7.js.map +0 -10
  110. package/dist/chunk-6m0d5pv4.js +0 -5
  111. package/dist/chunk-6m0d5pv4.js.map +0 -10
  112. package/dist/chunk-8x46g3wq.js +0 -5
  113. package/dist/chunk-8x46g3wq.js.map +0 -10
  114. package/dist/chunk-92sk0g47.js +0 -5
  115. package/dist/chunk-92sk0g47.js.map +0 -10
  116. package/dist/chunk-9f2b3enk.js +0 -5
  117. package/dist/chunk-9f2b3enk.js.map +0 -10
  118. package/dist/chunk-adrafsdk.js +0 -5
  119. package/dist/chunk-adrafsdk.js.map +0 -10
  120. package/dist/chunk-b1hang9z.js +0 -5
  121. package/dist/chunk-b1hang9z.js.map +0 -10
  122. package/dist/chunk-becdmywt.js +0 -4
  123. package/dist/chunk-becdmywt.js.map +0 -10
  124. package/dist/chunk-ehz0t9d1.js +0 -4
  125. package/dist/chunk-ehz0t9d1.js.map +0 -10
  126. package/dist/chunk-fazw0jvt.js +0 -4
  127. package/dist/chunk-fm9ycn0h.js +0 -5
  128. package/dist/chunk-fm9ycn0h.js.map +0 -10
  129. package/dist/chunk-g67e2r57.js +0 -4
  130. package/dist/chunk-g67e2r57.js.map +0 -10
  131. package/dist/chunk-he3vy8gt.js +0 -4
  132. package/dist/chunk-he3vy8gt.js.map +0 -10
  133. package/dist/chunk-jjayk2y5.js +0 -4
  134. package/dist/chunk-jjayk2y5.js.map +0 -10
  135. package/dist/chunk-mmyv2vsv.js +0 -5
  136. package/dist/chunk-mmyv2vsv.js.map +0 -10
  137. package/dist/chunk-phev7aw7.js +0 -4
  138. package/dist/chunk-phev7aw7.js.map +0 -10
  139. package/dist/chunk-rhqk87p2.js +0 -5
  140. package/dist/chunk-rhqk87p2.js.map +0 -10
  141. package/dist/chunk-rnv7fdjk.js +0 -4
  142. package/dist/chunk-rnv7fdjk.js.map +0 -10
  143. package/dist/chunk-rwh98p1c.js +0 -4
  144. package/dist/chunk-rwh98p1c.js.map +0 -10
  145. package/dist/chunk-v9zj2gsj.js +0 -5
  146. package/dist/chunk-v9zj2gsj.js.map +0 -10
  147. package/dist/chunk-vv5bgsn8.js +0 -4
  148. package/dist/chunk-vv5bgsn8.js.map +0 -10
  149. package/dist/chunk-vwh9jfxn.js +0 -5
  150. package/dist/chunk-vwh9jfxn.js.map +0 -10
  151. package/dist/chunk-x0rqy75t.js +0 -4
  152. package/dist/chunk-x0rqy75t.js.map +0 -10
  153. package/dist/contracts/index.cjs +0 -4
  154. package/dist/contracts/index.cjs.map +0 -38
  155. package/dist/contracts/index.js +0 -4
  156. package/dist/contracts/index.js.map +0 -38
  157. package/dist/tokens/index.cjs +0 -4
  158. package/dist/tokens/index.cjs.map +0 -10
  159. package/dist/tokens/index.js +0 -4
  160. package/dist/tokens/index.js.map +0 -10
  161. package/src/api/index.ts +0 -19
  162. package/src/api/microgard/endpoints.ts +0 -83
  163. package/src/api/microgard/types.ts +0 -57
  164. package/src/api/midgard/endpoints.ts +0 -90
  165. package/src/api/midgard/types.ts +0 -106
  166. package/src/api/swapkitApi/endpoints.ts +0 -193
  167. package/src/api/swapkitApi/types.ts +0 -635
  168. package/src/api/thornode/endpoints.ts +0 -116
  169. package/src/api/thornode/types.ts +0 -276
  170. package/src/api/thorswapStatic/endpoints.ts +0 -46
  171. package/src/api/thorswapStatic/types.ts +0 -18
  172. package/src/contracts/abis/avaxGeneric.ts +0 -92
  173. package/src/contracts/abis/avaxWoofi.ts +0 -145
  174. package/src/contracts/abis/bscGeneric.ts +0 -106
  175. package/src/contracts/abis/chainflipGateway.ts +0 -330
  176. package/src/contracts/abis/erc20.ts +0 -99
  177. package/src/contracts/abis/ethGeneric.ts +0 -92
  178. package/src/contracts/abis/mayaEvmVaults.ts +0 -331
  179. package/src/contracts/abis/pancakeV2.ts +0 -145
  180. package/src/contracts/abis/pangolin.ts +0 -120
  181. package/src/contracts/abis/sushiswap.ts +0 -120
  182. package/src/contracts/abis/tcEthVault.ts +0 -650
  183. package/src/contracts/abis/traderJoe.ts +0 -120
  184. package/src/contracts/abis/uniswapV2.ts +0 -120
  185. package/src/contracts/abis/uniswapV2Leg.ts +0 -128
  186. package/src/contracts/abis/uniswapV3_100.ts +0 -128
  187. package/src/contracts/abis/uniswapV3_10000.ts +0 -128
  188. package/src/contracts/abis/uniswapV3_3000.ts +0 -128
  189. package/src/contracts/abis/uniswapV3_500.ts +0 -128
  190. package/src/contracts/index.ts +0 -95
  191. package/src/contracts/routers/index.ts +0 -58
  192. package/src/contracts/routers/kyber.ts +0 -402
  193. package/src/contracts/routers/oneinch.ts +0 -2188
  194. package/src/contracts/routers/pancakeswap.ts +0 -340
  195. package/src/contracts/routers/pangolin.ts +0 -340
  196. package/src/contracts/routers/sushiswap.ts +0 -340
  197. package/src/contracts/routers/traderJoe.ts +0 -340
  198. package/src/contracts/routers/uniswapv2.ts +0 -340
  199. package/src/contracts/routers/uniswapv3.ts +0 -254
  200. package/src/contracts/routers/woofi.ts +0 -171
  201. package/src/modules/__tests__/assetValue.test.ts +0 -877
  202. package/src/modules/__tests__/bigIntArithmetics.test.ts +0 -30
  203. package/src/modules/__tests__/swapKitConfig.test.ts +0 -37
  204. package/src/modules/__tests__/swapKitNumber.test.ts +0 -560
  205. package/src/modules/assetValue.ts +0 -387
  206. package/src/modules/bigIntArithmetics.ts +0 -436
  207. package/src/modules/feeMultiplier.ts +0 -87
  208. package/src/modules/requestClient.ts +0 -83
  209. package/src/modules/swapKitConfig.ts +0 -143
  210. package/src/modules/swapKitError.ts +0 -442
  211. package/src/modules/swapKitNumber.ts +0 -16
  212. package/src/tokens/index.ts +0 -15
  213. package/src/tokens/lists/camelot_v3.ts +0 -16060
  214. package/src/tokens/lists/caviar_v1.ts +0 -1704
  215. package/src/tokens/lists/chainflip.ts +0 -104
  216. package/src/tokens/lists/index.ts +0 -14
  217. package/src/tokens/lists/jupiter.ts +0 -33563
  218. package/src/tokens/lists/mayachain.ts +0 -509
  219. package/src/tokens/lists/near.ts +0 -458
  220. package/src/tokens/lists/oneinch.ts +0 -15006
  221. package/src/tokens/lists/openocean_v2.ts +0 -12434
  222. package/src/tokens/lists/pancakeswap.ts +0 -6136
  223. package/src/tokens/lists/pangolin_v1.ts +0 -75
  224. package/src/tokens/lists/sushiswap_v2.ts +0 -595
  225. package/src/tokens/lists/thorchain.ts +0 -748
  226. package/src/tokens/lists/traderjoe_v2.ts +0 -594
  227. package/src/tokens/lists/uniswap_v2.ts +0 -11484
  228. package/src/tokens/lists/uniswap_v3.ts +0 -19424
  229. package/src/types/chains.ts +0 -555
  230. package/src/types/commonTypes.ts +0 -58
  231. package/src/types/derivationPath.ts +0 -58
  232. package/src/types/errors/apiV1.ts +0 -0
  233. package/src/types/quotes.ts +0 -172
  234. package/src/types/radix.ts +0 -14
  235. package/src/types/sdk.ts +0 -42
  236. package/src/types/tokens.ts +0 -17
  237. package/src/types/wallet.ts +0 -166
  238. package/src/utils/__tests__/asset.test.ts +0 -193
  239. package/src/utils/__tests__/derivationPath.test.ts +0 -16
  240. package/src/utils/__tests__/memo.test.ts +0 -103
  241. package/src/utils/__tests__/others.test.ts +0 -88
  242. package/src/utils/__tests__/validators.test.ts +0 -24
  243. package/src/utils/asset.ts +0 -231
  244. package/src/utils/derivationPath.ts +0 -98
  245. package/src/utils/liquidity.ts +0 -179
  246. package/src/utils/memo.ts +0 -143
  247. package/src/utils/others.ts +0 -86
  248. package/src/utils/plugin.ts +0 -13
  249. package/src/utils/tokens.ts +0 -73
  250. package/src/utils/validators.ts +0 -32
  251. package/src/utils/wallets.ts +0 -276
@@ -1,172 +0,0 @@
1
- export enum ErrorCode {
2
- unknownError = "unknownError",
3
- test_error = "test_error",
4
- providerDetailsError = "providerDetailsError",
5
- blockHeaderNotFound = "blockHeaderNotFound",
6
- blockHashNotFoundAtHeight = "blockHashNotFoundAtHeight",
7
- blockHashNotFoundAtHash = "blockHashNotFoundAtHash",
8
- txHashMissing = "txHashMissing",
9
- assetValueMissingInfo = "assetValueMissingInfo",
10
- invalidAsset = "invalidAsset",
11
- blockIsRequired = "blockIsRequired",
12
- currentBlockHeaderNotFound = "currentBlockHeaderNotFound",
13
- failedToRetrieveBalance = "failedToRetrieveBalance",
14
- failedToRetrieveBlock = "failedToRetrieveBlock",
15
- failedToRetrieveFees = "failedToRetrieveFees",
16
- notImplementedBCH = "notImplementedBCH",
17
- notImplementedDoge = "notImplementedDoge",
18
- noPoolsFound = "noPoolsFound",
19
- noVaultsFound = "noVaultsFound",
20
- noTxFound = "noTxFound",
21
- noInputCoinFound = "noInputCoinFound",
22
- noBlockDataFound = "noBlockDataFound",
23
- multipleCosmosMessages = "multipleCosmosMessages",
24
- heightOrHashNotProvided = "heightOrHashNotProvided",
25
- unknownDenom = "unknownDenom",
26
- invalidBlockHeight = "invalidBlockHeight",
27
- timestampExtrinsicNoArgumentsForBlock = "timestampExtrinsicNoArgumentsForBlock",
28
- timestampExtrinsicNoTimestampForBlock = "timestampExtrinsicNoTimestampForBlock",
29
- noTimestampExtrinsicForHash = "noTimestampExtrinsicForHash",
30
- timestampExtrinsicNoArgumentsForHash = "timestampExtrinsicNoArgumentsForHash",
31
- txMemoUndefined = "txMemoUndefined",
32
- txMemoIncorrect = "txMemoIncorrect",
33
- txTypeNotFound = "txTypeNotFound",
34
- txNoMessage = "txNoMessage",
35
- txNotFound = "txNotFound",
36
- txReceiptNotFound = "txReceiptNotFound",
37
- txParsingError = "txParsingError",
38
- txLogsParsingError = "txLogsParsingError",
39
- blockNotFound = "blockNotFound",
40
- balanceNotFound = "balanceNotFound",
41
- configError = "configError",
42
- synthSwapDisallowed = "synthSwapDisallowed",
43
- providerQuoteTimeout = "providerQuoteTimeout",
44
- noQuoteResponse = "noQuoteResponse",
45
- noPoolAssetsFound = "noPoolAssetsFound",
46
- noThorchainPools = "noThorchainPools",
47
- noMayachainPools = "noMayachainPools",
48
- noThorchainNetworkInfo = "noThorchainNetworkInfo",
49
- invalidAffiliateFee = "invalidAffiliateFee",
50
- invalidBuyAssetAddress = "invalidBuyAssetAddress",
51
- invalidSellAssetAddress = "invalidSellAssetAddress",
52
- invalidSourceAddress = "invalidSourceAddress",
53
- invalidDestinationAddress = "invalidDestinationAddress",
54
- sourceAddressIsSmartContract = "sourceAddressIsSmartContract",
55
- destinationAddressIsSmartContract = "destinationAddressIsSmartContract",
56
- invalidChainId = "invalidChainId",
57
- unsupportedChainId = "unsupportedChainId",
58
- unsupportedEVMChainId = "unsupportedEVMChainId",
59
- unsupportedMethod = "unsupportedMethod",
60
- unsupportedProvider = "unsupportedProvider",
61
- invalidParamsForMethod = "invalidParamsForMethod",
62
- unsupportedAdapter = "unsupportedAdapter",
63
- noWhitelistTokens = "noWhitelistTokens",
64
- failedFetchGasPrice = "failedFetchGasPrice",
65
- failedToCreateDepositChannel = "failedToCreateDepositChannel",
66
- noProviderDetailsFound = "noProviderDetailsFound",
67
- noTokenListsFound = "noTokenListsFound",
68
- tokenNotFound = "tokenNotFound",
69
- tokenPriceNotFound = "tokenPriceNotFound",
70
- tokenPriceFailedToUpdate = "tokenPriceFailedToUpdate",
71
- swapAmountTooSmall = "swapAmountTooSmall",
72
- legsArrayIsEmpty = "legsArrayIsEmpty",
73
- failedToFetchQuoteForLeg = "failedToFetchQuoteForLeg",
74
- noBlockHeaderFound = "noBlockHeaderFound",
75
- failedToSimulateSwap = "failedToSimulateSwap",
76
- addressScreeningFailed = "addressScreeningFailed",
77
- noLiquidtyProvidersFound = "noLiquidtyProvidersFound",
78
- insufficientLiquidity = "insufficientLiquidity",
79
- noInboundDataFound = "noInbounDataFound",
80
- noInboundAddressesFound = "noInboundAddressesFound",
81
- noInboundAddressFoundForChain = "noInboundAddressFoundForChain",
82
- noLastBlocksFound = "noLastBlocksFound",
83
- noVersionFound = "noVersionFound",
84
- noConstantsFound = "noConstantsFound",
85
- noMimirsFound = "noMimirsFound",
86
- noRoutesFound = "noRoutesFound",
87
- quoteNotFound = "quoteNotFound",
88
- ledgerSignFailed = "ledgerSignFailed",
89
- ledgerWrongPayload = "ledgerWrongPayload",
90
- ledgerFetchSwapFailed = "ledgerFetchSwapFailed",
91
- failedToFetchTx = "failedToFetchTx",
92
- failedBuildTransactionDetails = "failedBuildTransactionDetails",
93
- noLegsForRoute = "noLegsForRoute",
94
- noRouterAddressFound = "noRouterAddressFound",
95
- noAggregatorAddressFound = "noAggregatorAddressFound",
96
- noContractInstanceFound = "noContractInstanceFound",
97
- noContractAddressFound = "noContractAddressFound",
98
- invalidAffiliate = "invalidAffiliate",
99
- thornameAffiliate = "thornameAffiliate",
100
- providerNotfound = "No provider found",
101
- noRecordFound = "No Record found",
102
- slippageTooLow = "Slippage too low",
103
- tradingHalted = "tradingHalted",
104
- noWrappedGasAsset = "noWrappedGasAsset",
105
- aggregatorAddressNotFound = "aggregatorAddressNotFound",
106
- routerAddressNotFound = "routerAddressNotFound",
107
- dummyAddressNotFound = "dummyAddressNotFound",
108
- trackerError = "trackerError",
109
- thorchainPoolUnavailable = "thorchainPoolUnavailable",
110
- noOhlcvDataFound = "noOhlcvDataFound",
111
- noTradingPairs = "noTradingPairs",
112
- noLendingAvailability = "noLendingAvailability",
113
- lendingRepayTooSmall = "lendingRepayTooSmall",
114
- missingState = "missingState",
115
- ledgerSwapNotFound = "ledgerSwapNotFound",
116
- ledgerSwapNotReadyForTracking = "ledgerSwapNotReadyForTracking",
117
- errorEstimatingGas = "errorEstimatingGas",
118
- apiKeyInvalid = "apiKeyInvalid",
119
- apiKeyFailedToUpdate = "apiKeyFailedToUpdate",
120
- apiKeyExpired = "apiKeyExpired",
121
- unauthorized = "unauthorized",
122
- failedToCreateMemo = "failedToCreateMemo",
123
- radixIncorrectInstructions = "radixIncorrectInstructions",
124
- radixTxMissedParam = "radixTxMissedParam",
125
- radixTxMissedAccount = "radixTxMissedAccount",
126
- radixManifestParseError = "radixManifestParseError",
127
- radixManifestBuildError = "radixManifestBuildError",
128
- invalidAddressForChain = "invalidAddressForChain",
129
- riskyAddress = "riskyAddress",
130
- noRoutesToProcess = "noRoutesToProcess",
131
- sellAssetAmountTooSmall = "sellAssetAmountTooSmall",
132
- missingPrivateKey = "missingPrivateKey",
133
- noMemoPriceProtection = "noMemoPriceProtection",
134
- }
135
-
136
- export enum WarningCodeEnum {
137
- highSlippage = "highSlippage",
138
- highPriceImpact = "highPriceImpact",
139
- }
140
-
141
- export enum ProviderName {
142
- CAVIAR_V1 = "CAVIAR_V1",
143
- CAMELOT_V3 = "CAMELOT_V3",
144
- CHAINFLIP = "CHAINFLIP",
145
- CHAINFLIP_STREAMING = "CHAINFLIP_STREAMING",
146
- JUPITER = "JUPITER",
147
- MAYACHAIN = "MAYACHAIN",
148
- MAYACHAIN_STREAMING = "MAYACHAIN_STREAMING",
149
- OCISWAP_V1 = "OCISWAP_V1",
150
- ONEINCH = "ONEINCH",
151
- OPENOCEAN_V2 = "OPENOCEAN_V2",
152
- PANCAKESWAP = "PANCAKESWAP",
153
- PANGOLIN_V1 = "PANGOLIN_V1",
154
- SUSHISWAP_V2 = "SUSHISWAP_V2",
155
- THORCHAIN = "THORCHAIN",
156
- THORCHAIN_STREAMING = "THORCHAIN_STREAMING",
157
- TRADERJOE_V2 = "TRADERJOE_V2",
158
- UNISWAP_V2 = "UNISWAP_V2",
159
- UNISWAP_V3 = "UNISWAP_V3",
160
- KADO = "KADO",
161
- NEAR = "NEAR",
162
- }
163
-
164
- export enum FeeTypeEnum {
165
- LIQUIDITY = "liquidity",
166
- NETWORK = "network",
167
- INBOUND = "inbound",
168
- OUTBOUND = "outbound",
169
- AFFILIATE = "affiliate",
170
- TAX = "tax",
171
- PRIORITY = "priority",
172
- }
@@ -1,14 +0,0 @@
1
- export type RadixCoreStateResourceDTO = {
2
- at_ledger_state?: any;
3
- manager: {
4
- resource_type: string;
5
- divisibility: {
6
- substate_type: string;
7
- is_locked: boolean;
8
- value: {
9
- divisibility: number;
10
- };
11
- };
12
- };
13
- owner_role?: any;
14
- };
package/src/types/sdk.ts DELETED
@@ -1,42 +0,0 @@
1
- import type { AssetValue } from "../modules/assetValue";
2
-
3
- export type GenericSwapParams<T = unknown> = {
4
- buyAsset?: AssetValue;
5
- sellAsset?: AssetValue;
6
- recipient?: string;
7
- feeOptionKey?: FeeOption;
8
- route: T;
9
- };
10
-
11
- export type SwapParams<PluginNames = string, R = unknown> = GenericSwapParams<R> & {
12
- pluginName?: PluginNames;
13
- };
14
-
15
- export enum FeeOption {
16
- Average = "average",
17
- Fast = "fast",
18
- Fastest = "fastest",
19
- }
20
-
21
- export enum ApproveMode {
22
- Approve = "approve",
23
- CheckOnly = "checkOnly",
24
- }
25
-
26
- export type ApproveReturnType<T extends ApproveMode> = T extends "checkOnly"
27
- ? Promise<boolean>
28
- : Promise<string>;
29
-
30
- export enum MemoType {
31
- NAME_REGISTER = "~",
32
- BOND = "BOND",
33
- DEPOSIT = "+",
34
- LEAVE = "LEAVE",
35
- UNBOND = "UNBOND",
36
- WITHDRAW = "-",
37
- RUNEPOOL_DEPOSIT = "POOL+",
38
- RUNEPOOL_WITHDRAW = "POOL-",
39
- CLAIM_TCY = "tcy",
40
- STAKE_TCY = "tcy+",
41
- UNSTAKE_TCY = "tcy-",
42
- }
@@ -1,17 +0,0 @@
1
- import type { tokenLists } from "@swapkit/helpers/tokens";
2
-
3
- export type TokenTax = { buy: number; sell: number };
4
-
5
- type ListOfTokens = Exclude<
6
- keyof typeof tokenLists,
7
- | "JupiterList"
8
- | "CamelotV3List"
9
- | "OneInchList"
10
- | "OpenOceanV2List"
11
- | "PancakeswapList"
12
- | "PangolinList"
13
- | "SushiswapList"
14
- | "TraderjoeV2List"
15
- >;
16
-
17
- export type TokenNames = (typeof tokenLists)[ListOfTokens]["tokens"][number]["identifier"];
@@ -1,166 +0,0 @@
1
- import type { CosmosWallets, ThorchainWallets } from "@swapkit/toolboxes/cosmos";
2
- import type { EVMToolboxes } from "@swapkit/toolboxes/evm";
3
- import type { NearWallet } from "@swapkit/toolboxes/near";
4
- import type { RadixWallet } from "@swapkit/toolboxes/radix";
5
- import type { RippleWallet } from "@swapkit/toolboxes/ripple";
6
- import type { SolanaWallet } from "@swapkit/toolboxes/solana";
7
- import type { SubstrateToolboxes } from "@swapkit/toolboxes/substrate";
8
- import type { TronWallet } from "@swapkit/toolboxes/tron";
9
- import type { UTXOToolboxes } from "@swapkit/toolboxes/utxo";
10
- import type { BrowserProvider } from "ethers";
11
- import type { Eip1193Provider } from "ethers";
12
-
13
- import type { AssetValue } from "../modules/assetValue";
14
- import { Chain, type ChainId } from "./chains";
15
- import type { FeeOption } from "./sdk";
16
-
17
- declare global {
18
- interface WindowEventMap {
19
- "eip6963:announceProvider": CustomEvent;
20
- }
21
- }
22
-
23
- export type EthereumWindowProvider = BrowserProvider & {
24
- __XDEFI?: boolean;
25
- isBraveWallet?: boolean;
26
- isCoinbaseWallet?: boolean;
27
- isMetaMask?: boolean;
28
- isOkxWallet?: boolean;
29
- isKeepKeyWallet?: boolean;
30
- isTrust?: boolean;
31
- isTalisman?: boolean;
32
- on: (event: string, callback?: () => void) => void;
33
- overrideIsMetaMask?: boolean;
34
- request: <T = unknown>(args: {
35
- method: string;
36
- params?: unknown[];
37
- }) => Promise<T>;
38
- selectedProvider?: EthereumWindowProvider;
39
- };
40
-
41
- export type NetworkParams = {
42
- chainId: ChainId;
43
- chainName: string;
44
- nativeCurrency: {
45
- name: string;
46
- symbol: string;
47
- decimals: number;
48
- };
49
- rpcUrls: string[];
50
- blockExplorerUrls: string[];
51
- };
52
-
53
- export enum WalletOption {
54
- BITGET = "BITGET",
55
- BRAVE = "BRAVE",
56
- COINBASE_MOBILE = "COINBASE_MOBILE",
57
- COINBASE_WEB = "COINBASE_WEB",
58
- COSMOSTATION = "COSMOSTATION",
59
- CTRL = "CTRL",
60
- EIP6963 = "EIP6963",
61
- EXODUS = "EXODUS",
62
- KEEPKEY = "KEEPKEY",
63
- KEEPKEY_BEX = "KEEPKEY_BEX",
64
- KEPLR = "KEPLR",
65
- KEYSTORE = "KEYSTORE",
66
- LEAP = "LEAP",
67
- LEDGER = "LEDGER",
68
- LEDGER_LIVE = "LEDGER_LIVE",
69
- METAMASK = "METAMASK",
70
- OKX = "OKX",
71
- OKX_MOBILE = "OKX_MOBILE",
72
- ONEKEY = "ONEKEY",
73
- PHANTOM = "PHANTOM",
74
- POLKADOT_JS = "POLKADOT_JS",
75
- RADIX_WALLET = "RADIX_WALLET",
76
- TREZOR = "TREZOR",
77
- TALISMAN = "TALISMAN",
78
- TRUSTWALLET_WEB = "TRUSTWALLET_WEB",
79
- VULTISIG = "VULTISIG",
80
- WALLETCONNECT = "WALLETCONNECT",
81
- XAMAN = "XAMAN",
82
- }
83
-
84
- export enum LedgerErrorCode {
85
- NoError = 0x9000,
86
- LockedDevice = 0x5515,
87
- TC_NotFound = 65535,
88
- }
89
-
90
- export type CryptoChain = Exclude<Chain, Chain.Fiat>;
91
-
92
- export type ChainWallet<T extends Chain> = {
93
- chain: T;
94
- address: string;
95
- balance: AssetValue[];
96
- walletType: WalletOption | string;
97
- disconnect?: () => void;
98
- signMessage?: (message: string) => Promise<string>;
99
- };
100
-
101
- export type EmptyWallet = { [key in Chain]?: unknown };
102
- export type BaseWallet<T extends EmptyWallet | Record<string, unknown>> = {
103
- [key in Chain]: ChainWallet<key> & (T extends EmptyWallet ? T[key] : never);
104
- };
105
-
106
- export type FullWallet = BaseWallet<
107
- EVMToolboxes &
108
- UTXOToolboxes &
109
- CosmosWallets &
110
- ThorchainWallets &
111
- SubstrateToolboxes & {
112
- [Chain.Radix]: RadixWallet;
113
- [Chain.Ripple]: RippleWallet;
114
- [Chain.Solana]: SolanaWallet;
115
- [Chain.Tron]: TronWallet;
116
- [Chain.Near]: NearWallet;
117
- }
118
- >;
119
-
120
- export type SwapKitPluginParams = {
121
- getWallet: <T extends CryptoChain>(chain: T) => FullWallet[T];
122
- };
123
-
124
- export type EIP6963ProviderInfo = {
125
- walletId: string;
126
- uuid: string;
127
- name: string;
128
- icon: string;
129
- };
130
-
131
- export type EIP6963ProviderDetail = {
132
- info: EIP6963ProviderInfo;
133
- provider: Eip1193Provider;
134
- };
135
-
136
- export type EIP6963Provider = {
137
- info: EIP6963ProviderInfo;
138
- provider: Eip1193Provider;
139
- };
140
-
141
- // This type represents the structure of an event dispatched by a wallet to announce its presence based on EIP-6963.
142
- export type EIP6963AnnounceProviderEvent = Event & {
143
- detail: EIP6963Provider;
144
- };
145
-
146
- export type ChainSigner<T, S> = {
147
- signTransaction: (params: T) => Promise<S>;
148
- getAddress: () => Promise<string>;
149
- sign?: (message: string) => Promise<string>;
150
- };
151
-
152
- export type GenericTransferParams = {
153
- recipient: string;
154
- assetValue: AssetValue;
155
- memo?: string;
156
- feeRate?: number;
157
- feeOptionKey?: FeeOption;
158
- };
159
-
160
- export type GenericCreateTransactionParams = Omit<
161
- GenericTransferParams,
162
- "feeOptionKey" & "feeRate"
163
- > & {
164
- sender: string;
165
- feeRate: number;
166
- };
@@ -1,193 +0,0 @@
1
- import { describe, expect, test } from "bun:test";
2
- import { BaseDecimal, Chain } from "../../types";
3
-
4
- import { assetFromString, getAssetType, getDecimal } from "../asset";
5
-
6
- const tickerMap: Record<string, string> = {
7
- [Chain.THORChain]: "RUNE",
8
- [Chain.Cosmos]: "ATOM",
9
- [Chain.BinanceSmartChain]: "BNB",
10
- [Chain.Maya]: "CACAO",
11
- [Chain.Optimism]: "ETH",
12
- [Chain.Arbitrum]: "ETH",
13
- [Chain.Base]: "ETH",
14
- };
15
-
16
- describe("getAssetType", () => {
17
- describe("when isSynth is true", () => {
18
- test('should return "Synth"', () => {
19
- const result = getAssetType({ chain: Chain.Bitcoin, symbol: "BTC/BTC" });
20
- expect(result).toBe("Synth");
21
- });
22
- });
23
-
24
- describe("when isSynth is false", () => {
25
- describe("for gas assets on given chain", () => {
26
- for (const chain of Object.values(Chain)) {
27
- test(`should return "Native" for chain ${chain} asset`, () => {
28
- const ticker = tickerMap[chain] || chain;
29
- const result = getAssetType({ chain: chain as Chain, symbol: ticker });
30
-
31
- expect(result).toBe("Native");
32
- });
33
- }
34
- });
35
-
36
- describe("for non-gas assets on given chain", () => {
37
- for (const chain of Object.values(Chain)) {
38
- test(`should return ${chain} for chain ${chain} asset`, () => {
39
- const result = getAssetType({ chain: chain as Chain, symbol: "USDT" });
40
-
41
- expect(result).toBe(chain);
42
- });
43
- }
44
- });
45
- });
46
- });
47
-
48
- describe("getDecimal", () => {
49
- /**
50
- * Test out native
51
- */
52
- const filteredChains = Object.values(Chain).filter(
53
- (c) => ![Chain.Ethereum, Chain.Avalanche].includes(c),
54
- );
55
-
56
- for (const chain of filteredChains) {
57
- describe(chain, () => {
58
- test(`returns proper decimal for native ${chain} asset`, async () => {
59
- const decimal = await getDecimal({ chain, symbol: chain });
60
- expect(decimal).toBe(BaseDecimal[chain]);
61
- });
62
- });
63
- }
64
-
65
- describe("ETH", () => {
66
- // TODO: if too many requests, this will fail due to timeout
67
- test.todo("returns proper decimal for eth and it's assets", async () => {
68
- const ethDecimal = await getDecimal({ chain: Chain.Ethereum, symbol: "ETH" });
69
- expect(ethDecimal).toBe(BaseDecimal.ETH);
70
- await Bun.sleep(500);
71
-
72
- const usdcDecimal = await getDecimal({
73
- chain: Chain.Ethereum,
74
- symbol: "USDC-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
75
- });
76
- expect(usdcDecimal).toBe(6);
77
- await Bun.sleep(500);
78
-
79
- const wbtcDecimal = await getDecimal({
80
- chain: Chain.Ethereum,
81
- symbol: "WBTC-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
82
- });
83
- expect(wbtcDecimal).toBe(8);
84
- await Bun.sleep(500);
85
-
86
- const kindDecimal = await getDecimal({
87
- chain: Chain.Ethereum,
88
- symbol: "KIND-0x4618519de4c304f3444ffa7f812dddc2971cc688",
89
- });
90
- expect(kindDecimal).toBe(8);
91
- await Bun.sleep(500);
92
-
93
- const shitcoinDecimal = await getDecimal({
94
- chain: Chain.Ethereum,
95
- symbol: "HOMI-0xCa208BfD69ae6D2667f1FCbE681BAe12767c0078",
96
- });
97
- expect(shitcoinDecimal).toBe(0);
98
- await Bun.sleep(500);
99
- });
100
- });
101
-
102
- describe("AVAX", () => {
103
- // TODO: if too many requests, this will fail due to timeout
104
- test.todo("returns proper decimal for avax and it's assets", async () => {
105
- const avaxDecimal = await getDecimal({ chain: Chain.Avalanche, symbol: "AVAX" });
106
- expect(avaxDecimal).toBe(BaseDecimal.AVAX);
107
-
108
- const wbtceDecimal = await getDecimal({
109
- chain: Chain.Avalanche,
110
- symbol: "WBTC.e-0x50b7545627a5162f82a992c33b87adc75187b218",
111
- });
112
- expect(wbtceDecimal).toBe(8);
113
-
114
- const btcbDecimal = await getDecimal({
115
- chain: Chain.Avalanche,
116
- symbol: "BTC.b-0x152b9d0FdC40C096757F570A51E494bd4b943E50",
117
- });
118
- expect(btcbDecimal).toBe(8);
119
-
120
- const timeDecimal = await getDecimal({
121
- chain: Chain.Avalanche,
122
- symbol: "TIME-0xb54f16fB19478766A268F172C9480f8da1a7c9C3",
123
- });
124
- expect(timeDecimal).toBe(9);
125
-
126
- const usdtDecimal = await getDecimal({
127
- chain: Chain.Avalanche,
128
- symbol: "USDT-0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
129
- });
130
- expect(usdtDecimal).toBe(6);
131
-
132
- const usdcDecimal = await getDecimal({
133
- chain: Chain.Avalanche,
134
- symbol: "USDC-0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
135
- });
136
- expect(usdcDecimal).toBe(6);
137
- });
138
- });
139
-
140
- describe("Radix", () => {
141
- test.todo("returns proper decimal for radix and it's assets", async () => {
142
- const radixDecimal = await getDecimal({ chain: Chain.Radix, symbol: "XRD" });
143
- expect(radixDecimal).toBe(BaseDecimal.XRD);
144
- await Bun.sleep(500);
145
-
146
- const xwBTCDecimal = await getDecimal({
147
- chain: Chain.Radix,
148
- symbol: "xwBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
149
- });
150
- expect(xwBTCDecimal).toBe(8);
151
- await Bun.sleep(500);
152
- });
153
- });
154
- });
155
-
156
- describe("assetFromString", () => {
157
- test("should return the correct object", () => {
158
- const assetString = "THOR.RUNE";
159
- const result = assetFromString(assetString);
160
-
161
- expect(result).toEqual({
162
- chain: Chain.THORChain,
163
- symbol: "RUNE",
164
- ticker: "RUNE",
165
- synth: false,
166
- });
167
- });
168
-
169
- test("should return the correct object for multiple dashes", () => {
170
- const assetString = "ETH.PENDLE-LPT-0x1234";
171
- const result = assetFromString(assetString);
172
-
173
- expect(result).toEqual({
174
- chain: Chain.Ethereum,
175
- symbol: "PENDLE-LPT-0x1234",
176
- ticker: "PENDLE-LPT",
177
- synth: false,
178
- });
179
- });
180
-
181
- test.todo("should return the correct object for Radix resource", () => {
182
- const assetString =
183
- "XRD.xwBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75";
184
- const result = assetFromString(assetString);
185
-
186
- expect(result).toEqual({
187
- chain: Chain.Radix,
188
- symbol: "xwBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
189
- ticker: "xwBTC",
190
- synth: false,
191
- });
192
- });
193
- });
@@ -1,16 +0,0 @@
1
- import { describe, expect, test } from "bun:test";
2
-
3
- import type { DerivationPathArray } from "../../types";
4
- import { derivationPathToString } from "../derivationPath";
5
-
6
- describe("derivationPathToString", () => {
7
- test("should return the correct string for a full path", () => {
8
- const path = [1, 2, 3, 4, 5] as DerivationPathArray;
9
- expect(derivationPathToString(path)).toEqual("m/1'/2'/3'/4/5");
10
- });
11
-
12
- test("should return the correct string for a short path", () => {
13
- const path = [1, 2, 3, 4] as DerivationPathArray;
14
- expect(derivationPathToString(path)).toEqual("m/1'/2'/3'/4");
15
- });
16
- });