@velora-dex/sdk 8.0.0
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/LICENSE +7 -0
- package/README.md +494 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/examples/customFetcher.d.ts +3 -0
- package/dist/examples/customFetcher.d.ts.map +1 -0
- package/dist/examples/delta.d.ts +2 -0
- package/dist/examples/delta.d.ts.map +1 -0
- package/dist/examples/ethersV6.d.ts +2 -0
- package/dist/examples/ethersV6.d.ts.map +1 -0
- package/dist/examples/limitOrders_all.d.ts +2 -0
- package/dist/examples/limitOrders_all.d.ts.map +1 -0
- package/dist/examples/limitOrders_partial.d.ts +2 -0
- package/dist/examples/limitOrders_partial.d.ts.map +1 -0
- package/dist/examples/limitOrders_postOrder.d.ts +2 -0
- package/dist/examples/limitOrders_postOrder.d.ts.map +1 -0
- package/dist/examples/partial.d.ts +2 -0
- package/dist/examples/partial.d.ts.map +1 -0
- package/dist/examples/quote.d.ts +2 -0
- package/dist/examples/quote.d.ts.map +1 -0
- package/dist/examples/sdk.d.ts +2 -0
- package/dist/examples/sdk.d.ts.map +1 -0
- package/dist/examples/simple.d.ts +2 -0
- package/dist/examples/simple.d.ts.map +1 -0
- package/dist/examples/simpleQuote.d.ts +2 -0
- package/dist/examples/simpleQuote.d.ts.map +1 -0
- package/dist/examples/viem.d.ts +2 -0
- package/dist/examples/viem.d.ts.map +1 -0
- package/dist/examples/wagmi.d.ts +43 -0
- package/dist/examples/wagmi.d.ts.map +1 -0
- package/dist/examples/web3.d.ts +2 -0
- package/dist/examples/web3.d.ts.map +1 -0
- package/dist/gas.d.ts +8 -0
- package/dist/gas.d.ts.map +1 -0
- package/dist/helpers/approve.d.ts +8 -0
- package/dist/helpers/approve.d.ts.map +1 -0
- package/dist/helpers/fetchers/axios.d.ts +5 -0
- package/dist/helpers/fetchers/axios.d.ts.map +1 -0
- package/dist/helpers/fetchers/fetch.d.ts +5 -0
- package/dist/helpers/fetchers/fetch.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +13 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/misc.d.ts +48 -0
- package/dist/helpers/misc.d.ts.map +1 -0
- package/dist/helpers/providers/ethers.d.ts +10 -0
- package/dist/helpers/providers/ethers.d.ts.map +1 -0
- package/dist/helpers/providers/ethersV6.d.ts +8 -0
- package/dist/helpers/providers/ethersV6.d.ts.map +1 -0
- package/dist/helpers/providers/helpers.d.ts +3 -0
- package/dist/helpers/providers/helpers.d.ts.map +1 -0
- package/dist/helpers/providers/viem.d.ts +23 -0
- package/dist/helpers/providers/viem.d.ts.map +1 -0
- package/dist/helpers/providers/web3.d.ts +9 -0
- package/dist/helpers/providers/web3.d.ts.map +1 -0
- package/dist/helpers/token.d.ts +38 -0
- package/dist/helpers/token.d.ts.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/methods/common/orders/buildOrderData.d.ts +27 -0
- package/dist/methods/common/orders/buildOrderData.d.ts.map +1 -0
- package/dist/methods/common/orders/encoding.d.ts +23 -0
- package/dist/methods/common/orders/encoding.d.ts.map +1 -0
- package/dist/methods/common/orders/misc.d.ts +27 -0
- package/dist/methods/common/orders/misc.d.ts.map +1 -0
- package/dist/methods/common/orders/signature.d.ts +9 -0
- package/dist/methods/common/orders/signature.d.ts.map +1 -0
- package/dist/methods/common/orders/types.d.ts +8 -0
- package/dist/methods/common/orders/types.d.ts.map +1 -0
- package/dist/methods/delta/approveForDelta.d.ts +8 -0
- package/dist/methods/delta/approveForDelta.d.ts.map +1 -0
- package/dist/methods/delta/buildCrosschainOrderBridge.d.ts +23 -0
- package/dist/methods/delta/buildCrosschainOrderBridge.d.ts.map +1 -0
- package/dist/methods/delta/buildDeltaOrder.d.ts +49 -0
- package/dist/methods/delta/buildDeltaOrder.d.ts.map +1 -0
- package/dist/methods/delta/getBridgeInfo.d.ts +9 -0
- package/dist/methods/delta/getBridgeInfo.d.ts.map +1 -0
- package/dist/methods/delta/getDeltaContract.d.ts +9 -0
- package/dist/methods/delta/getDeltaContract.d.ts.map +1 -0
- package/dist/methods/delta/getDeltaOrders.d.ts +22 -0
- package/dist/methods/delta/getDeltaOrders.d.ts.map +1 -0
- package/dist/methods/delta/getDeltaPrice.d.ts +58 -0
- package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -0
- package/dist/methods/delta/getMulticallHandlers.d.ts +9 -0
- package/dist/methods/delta/getMulticallHandlers.d.ts.map +1 -0
- package/dist/methods/delta/getPartnerFee.d.ts +16 -0
- package/dist/methods/delta/getPartnerFee.d.ts.map +1 -0
- package/dist/methods/delta/helpers/across.d.ts +22 -0
- package/dist/methods/delta/helpers/across.d.ts.map +1 -0
- package/dist/methods/delta/helpers/buildDeltaOrderData.d.ts +35 -0
- package/dist/methods/delta/helpers/buildDeltaOrderData.d.ts.map +1 -0
- package/dist/methods/delta/helpers/composePermit.d.ts +5 -0
- package/dist/methods/delta/helpers/composePermit.d.ts.map +1 -0
- package/dist/methods/delta/helpers/misc.d.ts +3 -0
- package/dist/methods/delta/helpers/misc.d.ts.map +1 -0
- package/dist/methods/delta/helpers/types.d.ts +96 -0
- package/dist/methods/delta/helpers/types.d.ts.map +1 -0
- package/dist/methods/delta/index.d.ts +28 -0
- package/dist/methods/delta/index.d.ts.map +1 -0
- package/dist/methods/delta/isTokenSupportedInDelta.d.ts +8 -0
- package/dist/methods/delta/isTokenSupportedInDelta.d.ts.map +1 -0
- package/dist/methods/delta/postDeltaOrder.d.ts +23 -0
- package/dist/methods/delta/postDeltaOrder.d.ts.map +1 -0
- package/dist/methods/delta/signDeltaOrder.d.ts +12 -0
- package/dist/methods/delta/signDeltaOrder.d.ts.map +1 -0
- package/dist/methods/limitOrders/approveForOrder.d.ts +12 -0
- package/dist/methods/limitOrders/approveForOrder.d.ts.map +1 -0
- package/dist/methods/limitOrders/buildOrder.d.ts +11 -0
- package/dist/methods/limitOrders/buildOrder.d.ts.map +1 -0
- package/dist/methods/limitOrders/cancelOrder.d.ts +9 -0
- package/dist/methods/limitOrders/cancelOrder.d.ts.map +1 -0
- package/dist/methods/limitOrders/fillOrderDirectly.d.ts +30 -0
- package/dist/methods/limitOrders/fillOrderDirectly.d.ts.map +1 -0
- package/dist/methods/limitOrders/getOrders.d.ts +39 -0
- package/dist/methods/limitOrders/getOrders.d.ts.map +1 -0
- package/dist/methods/limitOrders/getOrdersContract.d.ts +8 -0
- package/dist/methods/limitOrders/getOrdersContract.d.ts.map +1 -0
- package/dist/methods/limitOrders/helpers/buildOrderData.d.ts +43 -0
- package/dist/methods/limitOrders/helpers/buildOrderData.d.ts.map +1 -0
- package/dist/methods/limitOrders/helpers/misc.d.ts +9 -0
- package/dist/methods/limitOrders/helpers/misc.d.ts.map +1 -0
- package/dist/methods/limitOrders/helpers/types.d.ts +49 -0
- package/dist/methods/limitOrders/helpers/types.d.ts.map +1 -0
- package/dist/methods/limitOrders/index.d.ts +30 -0
- package/dist/methods/limitOrders/index.d.ts.map +1 -0
- package/dist/methods/limitOrders/postOrder.d.ts +10 -0
- package/dist/methods/limitOrders/postOrder.d.ts.map +1 -0
- package/dist/methods/limitOrders/signOrder.d.ts +7 -0
- package/dist/methods/limitOrders/signOrder.d.ts.map +1 -0
- package/dist/methods/limitOrders/transaction.d.ts +23 -0
- package/dist/methods/limitOrders/transaction.d.ts.map +1 -0
- package/dist/methods/nftOrders/approveForOrder.d.ts +12 -0
- package/dist/methods/nftOrders/approveForOrder.d.ts.map +1 -0
- package/dist/methods/nftOrders/buildOrder.d.ts +11 -0
- package/dist/methods/nftOrders/buildOrder.d.ts.map +1 -0
- package/dist/methods/nftOrders/cancelOrder.d.ts +8 -0
- package/dist/methods/nftOrders/cancelOrder.d.ts.map +1 -0
- package/dist/methods/nftOrders/getOrders.d.ts +18 -0
- package/dist/methods/nftOrders/getOrders.d.ts.map +1 -0
- package/dist/methods/nftOrders/getOrdersContract.d.ts +8 -0
- package/dist/methods/nftOrders/getOrdersContract.d.ts.map +1 -0
- package/dist/methods/nftOrders/helpers/buildOrderData.d.ts +52 -0
- package/dist/methods/nftOrders/helpers/buildOrderData.d.ts.map +1 -0
- package/dist/methods/nftOrders/helpers/misc.d.ts +13 -0
- package/dist/methods/nftOrders/helpers/misc.d.ts.map +1 -0
- package/dist/methods/nftOrders/helpers/types.d.ts +39 -0
- package/dist/methods/nftOrders/helpers/types.d.ts.map +1 -0
- package/dist/methods/nftOrders/index.d.ts +23 -0
- package/dist/methods/nftOrders/index.d.ts.map +1 -0
- package/dist/methods/nftOrders/postOrder.d.ts +10 -0
- package/dist/methods/nftOrders/postOrder.d.ts.map +1 -0
- package/dist/methods/nftOrders/signOrder.d.ts +7 -0
- package/dist/methods/nftOrders/signOrder.d.ts.map +1 -0
- package/dist/methods/nftOrders/transaction.d.ts +23 -0
- package/dist/methods/nftOrders/transaction.d.ts.map +1 -0
- package/dist/methods/quote/getQuote.d.ts +51 -0
- package/dist/methods/quote/getQuote.d.ts.map +1 -0
- package/dist/methods/swap/adapters.d.ts +8 -0
- package/dist/methods/swap/adapters.d.ts.map +1 -0
- package/dist/methods/swap/approve.d.ts +10 -0
- package/dist/methods/swap/approve.d.ts.map +1 -0
- package/dist/methods/swap/balance.d.ts +23 -0
- package/dist/methods/swap/balance.d.ts.map +1 -0
- package/dist/methods/swap/helpers/normalizeRateOptions.d.ts +12 -0
- package/dist/methods/swap/helpers/normalizeRateOptions.d.ts.map +1 -0
- package/dist/methods/swap/index.d.ts +13 -0
- package/dist/methods/swap/index.d.ts.map +1 -0
- package/dist/methods/swap/rates.d.ts +52 -0
- package/dist/methods/swap/rates.d.ts.map +1 -0
- package/dist/methods/swap/spender.d.ts +21 -0
- package/dist/methods/swap/spender.d.ts.map +1 -0
- package/dist/methods/swap/swapTx.d.ts +158 -0
- package/dist/methods/swap/swapTx.d.ts.map +1 -0
- package/dist/methods/swap/token.d.ts +8 -0
- package/dist/methods/swap/token.d.ts.map +1 -0
- package/dist/methods/swap/transaction.d.ts +115 -0
- package/dist/methods/swap/transaction.d.ts.map +1 -0
- package/dist/sdk/full.d.ts +17 -0
- package/dist/sdk/full.d.ts.map +1 -0
- package/dist/sdk/partial.d.ts +31 -0
- package/dist/sdk/partial.d.ts.map +1 -0
- package/dist/sdk/simple.d.ts +75 -0
- package/dist/sdk/simple.d.ts.map +1 -0
- package/dist/sdk.cjs.development.js +5182 -0
- package/dist/sdk.cjs.development.js.map +1 -0
- package/dist/sdk.cjs.production.min.js +2 -0
- package/dist/sdk.cjs.production.min.js.map +1 -0
- package/dist/sdk.esm.js +5102 -0
- package/dist/sdk.esm.js.map +1 -0
- package/dist/types.d.ts +161 -0
- package/dist/types.d.ts.map +1 -0
- package/docs/DELTA.md +207 -0
- package/package.json +126 -0
- package/src/constants.ts +16 -0
- package/src/examples/customFetcher.ts +44 -0
- package/src/examples/delta.ts +127 -0
- package/src/examples/ethersV6.ts +38 -0
- package/src/examples/limitOrders_all.ts +135 -0
- package/src/examples/limitOrders_partial.ts +171 -0
- package/src/examples/limitOrders_postOrder.ts +77 -0
- package/src/examples/partial.ts +34 -0
- package/src/examples/quote.ts +205 -0
- package/src/examples/sdk.ts +39 -0
- package/src/examples/simple.ts +44 -0
- package/src/examples/simpleQuote.ts +98 -0
- package/src/examples/viem.ts +120 -0
- package/src/examples/wagmi.ts +68 -0
- package/src/examples/web3.ts +32 -0
- package/src/gas.ts +7 -0
- package/src/helpers/approve.ts +60 -0
- package/src/helpers/fetchers/axios.ts +34 -0
- package/src/helpers/fetchers/fetch.ts +67 -0
- package/src/helpers/index.ts +27 -0
- package/src/helpers/misc.ts +160 -0
- package/src/helpers/providers/ethers.ts +192 -0
- package/src/helpers/providers/ethersV6.ts +121 -0
- package/src/helpers/providers/helpers.ts +36 -0
- package/src/helpers/providers/viem.ts +205 -0
- package/src/helpers/providers/web3.ts +154 -0
- package/src/helpers/token.ts +75 -0
- package/src/index.ts +425 -0
- package/src/methods/common/orders/buildOrderData.ts +29 -0
- package/src/methods/common/orders/encoding.ts +216 -0
- package/src/methods/common/orders/misc.ts +86 -0
- package/src/methods/common/orders/signature.ts +68 -0
- package/src/methods/common/orders/types.ts +13 -0
- package/src/methods/delta/approveForDelta.ts +38 -0
- package/src/methods/delta/buildCrosschainOrderBridge.ts +84 -0
- package/src/methods/delta/buildDeltaOrder.ts +192 -0
- package/src/methods/delta/getBridgeInfo.ts +38 -0
- package/src/methods/delta/getDeltaContract.ts +29 -0
- package/src/methods/delta/getDeltaOrders.ts +102 -0
- package/src/methods/delta/getDeltaPrice.ts +122 -0
- package/src/methods/delta/getMulticallHandlers.ts +44 -0
- package/src/methods/delta/getPartnerFee.ts +58 -0
- package/src/methods/delta/helpers/across.ts +255 -0
- package/src/methods/delta/helpers/buildDeltaOrderData.ts +153 -0
- package/src/methods/delta/helpers/composePermit.ts +76 -0
- package/src/methods/delta/helpers/misc.ts +32 -0
- package/src/methods/delta/helpers/types.ts +110 -0
- package/src/methods/delta/index.ts +146 -0
- package/src/methods/delta/isTokenSupportedInDelta.ts +54 -0
- package/src/methods/delta/postDeltaOrder.ts +50 -0
- package/src/methods/delta/signDeltaOrder.ts +41 -0
- package/src/methods/limitOrders/approveForOrder.ts +36 -0
- package/src/methods/limitOrders/buildOrder.ts +56 -0
- package/src/methods/limitOrders/cancelOrder.ts +111 -0
- package/src/methods/limitOrders/fillOrderDirectly.ts +277 -0
- package/src/methods/limitOrders/getOrders.ts +151 -0
- package/src/methods/limitOrders/getOrdersContract.ts +20 -0
- package/src/methods/limitOrders/helpers/buildOrderData.ts +121 -0
- package/src/methods/limitOrders/helpers/misc.ts +64 -0
- package/src/methods/limitOrders/helpers/types.ts +70 -0
- package/src/methods/limitOrders/index.ts +154 -0
- package/src/methods/limitOrders/postOrder.ts +74 -0
- package/src/methods/limitOrders/signOrder.ts +29 -0
- package/src/methods/limitOrders/transaction.ts +231 -0
- package/src/methods/nftOrders/approveForOrder.ts +79 -0
- package/src/methods/nftOrders/buildOrder.ts +52 -0
- package/src/methods/nftOrders/cancelOrder.ts +23 -0
- package/src/methods/nftOrders/getOrders.ts +84 -0
- package/src/methods/nftOrders/getOrdersContract.ts +24 -0
- package/src/methods/nftOrders/helpers/buildOrderData.ts +131 -0
- package/src/methods/nftOrders/helpers/misc.ts +92 -0
- package/src/methods/nftOrders/helpers/types.ts +50 -0
- package/src/methods/nftOrders/index.ts +139 -0
- package/src/methods/nftOrders/postOrder.ts +71 -0
- package/src/methods/nftOrders/signOrder.ts +29 -0
- package/src/methods/nftOrders/transaction.ts +234 -0
- package/src/methods/quote/getQuote.ts +131 -0
- package/src/methods/swap/adapters.ts +49 -0
- package/src/methods/swap/approve.ts +51 -0
- package/src/methods/swap/balance.ts +147 -0
- package/src/methods/swap/helpers/normalizeRateOptions.ts +55 -0
- package/src/methods/swap/index.ts +38 -0
- package/src/methods/swap/rates.ts +276 -0
- package/src/methods/swap/spender.ts +76 -0
- package/src/methods/swap/swapTx.ts +266 -0
- package/src/methods/swap/token.ts +35 -0
- package/src/methods/swap/transaction.ts +310 -0
- package/src/sdk/full.ts +54 -0
- package/src/sdk/partial.ts +107 -0
- package/src/sdk/simple.ts +429 -0
- package/src/types.ts +240 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { constructPartialSDK, SDKConfig } from './partial';
|
|
2
|
+
import {
|
|
3
|
+
GetAdaptersFunctions,
|
|
4
|
+
constructGetAdapters,
|
|
5
|
+
} from '../methods/swap/adapters';
|
|
6
|
+
import {
|
|
7
|
+
GetBalancesFunctions,
|
|
8
|
+
constructGetBalances,
|
|
9
|
+
} from '../methods/swap/balance';
|
|
10
|
+
import { GetRateFunctions, constructGetRate } from '../methods/swap/rates';
|
|
11
|
+
import {
|
|
12
|
+
GetSpenderFunctions,
|
|
13
|
+
constructGetSpender,
|
|
14
|
+
} from '../methods/swap/spender';
|
|
15
|
+
import { GetTokensFunctions, constructGetTokens } from '../methods/swap/token';
|
|
16
|
+
import {
|
|
17
|
+
BuildTxFunctions,
|
|
18
|
+
constructBuildTx,
|
|
19
|
+
} from '../methods/swap/transaction';
|
|
20
|
+
import { constructSwapTx, GetSwapTxFunctions } from '../methods/swap/swapTx';
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
constructAxiosFetcher,
|
|
24
|
+
constructFetchFetcher,
|
|
25
|
+
constructEthersV5ContractCaller,
|
|
26
|
+
constructEthersV6ContractCaller,
|
|
27
|
+
constructWeb3ContractCaller,
|
|
28
|
+
constructViemContractCaller,
|
|
29
|
+
} from '../helpers';
|
|
30
|
+
|
|
31
|
+
import type {
|
|
32
|
+
ConstructBaseInput,
|
|
33
|
+
ConstructFetchInput,
|
|
34
|
+
ContractCallerFunctions,
|
|
35
|
+
TransactionContractCallerFn,
|
|
36
|
+
TxHash,
|
|
37
|
+
Address,
|
|
38
|
+
FetcherFunction,
|
|
39
|
+
ExtraFetchParams,
|
|
40
|
+
} from '../types';
|
|
41
|
+
|
|
42
|
+
import type { EthersProviderDeps, MinViemClient } from '../helpers';
|
|
43
|
+
import type Web3 from 'web3';
|
|
44
|
+
|
|
45
|
+
import type { SwapSDKMethods } from '../methods/swap';
|
|
46
|
+
import {
|
|
47
|
+
BuildLimitOrderFunctions,
|
|
48
|
+
constructBuildLimitOrder,
|
|
49
|
+
} from '../methods/limitOrders/buildOrder';
|
|
50
|
+
import {
|
|
51
|
+
constructPostLimitOrder,
|
|
52
|
+
PostLimitOrderFunctions,
|
|
53
|
+
} from '../methods/limitOrders/postOrder';
|
|
54
|
+
import {
|
|
55
|
+
constructGetLimitOrders,
|
|
56
|
+
GetLimitOrdersFunctions,
|
|
57
|
+
} from '../methods/limitOrders/getOrders';
|
|
58
|
+
import {
|
|
59
|
+
constructGetLimitOrdersContract,
|
|
60
|
+
GetLimitOrdersContractFunctions,
|
|
61
|
+
} from '../methods/limitOrders/getOrdersContract';
|
|
62
|
+
import {
|
|
63
|
+
constructBuildLimitOrderTx,
|
|
64
|
+
BuildLimitOrdersTxFunctions,
|
|
65
|
+
} from '../methods/limitOrders/transaction';
|
|
66
|
+
import {
|
|
67
|
+
constructAllLimitOrdersHandlers,
|
|
68
|
+
LimitOrderHandlers,
|
|
69
|
+
} from '../methods/limitOrders';
|
|
70
|
+
|
|
71
|
+
import {
|
|
72
|
+
constructGetNFTOrdersContract,
|
|
73
|
+
GetNFTOrdersContractFunctions,
|
|
74
|
+
} from '../methods/nftOrders/getOrdersContract';
|
|
75
|
+
import {
|
|
76
|
+
constructGetNFTOrders,
|
|
77
|
+
GetNFTOrdersFunctions,
|
|
78
|
+
} from '../methods/nftOrders/getOrders';
|
|
79
|
+
import {
|
|
80
|
+
BuildNFTOrderFunctions,
|
|
81
|
+
constructBuildNFTOrder,
|
|
82
|
+
} from '../methods/nftOrders/buildOrder';
|
|
83
|
+
import {
|
|
84
|
+
constructPostNFTOrder,
|
|
85
|
+
PostNFTOrderFunctions,
|
|
86
|
+
} from '../methods/nftOrders/postOrder';
|
|
87
|
+
import {
|
|
88
|
+
constructBuildNFTOrderTx,
|
|
89
|
+
BuildNFTOrdersTxFunctions,
|
|
90
|
+
} from '../methods/nftOrders/transaction';
|
|
91
|
+
import {
|
|
92
|
+
constructAllNFTOrdersHandlers,
|
|
93
|
+
NFTOrderHandlers,
|
|
94
|
+
} from '../methods/nftOrders';
|
|
95
|
+
|
|
96
|
+
import { constructSwapSDK } from '../methods/swap';
|
|
97
|
+
import type { AxiosRequirement } from '../helpers/fetchers/axios';
|
|
98
|
+
import { API_URL, DEFAULT_VERSION } from '../constants';
|
|
99
|
+
import {
|
|
100
|
+
constructAllDeltaOrdersHandlers,
|
|
101
|
+
DeltaOrderHandlers,
|
|
102
|
+
} from '../methods/delta';
|
|
103
|
+
import {
|
|
104
|
+
BuildDeltaOrderFunctions,
|
|
105
|
+
constructBuildDeltaOrder,
|
|
106
|
+
} from '../methods/delta/buildDeltaOrder';
|
|
107
|
+
import {
|
|
108
|
+
constructGetDeltaOrders,
|
|
109
|
+
GetDeltaOrdersFunctions,
|
|
110
|
+
} from '../methods/delta/getDeltaOrders';
|
|
111
|
+
import {
|
|
112
|
+
constructGetDeltaPrice,
|
|
113
|
+
GetDeltaPriceFunctions,
|
|
114
|
+
} from '../methods/delta/getDeltaPrice';
|
|
115
|
+
import {
|
|
116
|
+
constructGetDeltaContract,
|
|
117
|
+
GetDeltaContractFunctions,
|
|
118
|
+
} from '../methods/delta/getDeltaContract';
|
|
119
|
+
import {
|
|
120
|
+
constructGetPartnerFee,
|
|
121
|
+
GetPartnerFeeFunctions,
|
|
122
|
+
} from '../methods/delta/getPartnerFee';
|
|
123
|
+
import {
|
|
124
|
+
constructPostDeltaOrder,
|
|
125
|
+
PostDeltaOrderFunctions,
|
|
126
|
+
} from '../methods/delta/postDeltaOrder';
|
|
127
|
+
import {
|
|
128
|
+
constructGetQuote,
|
|
129
|
+
GetQuoteFunctions,
|
|
130
|
+
} from '../methods/quote/getQuote';
|
|
131
|
+
import {
|
|
132
|
+
constructGetBridgeInfo,
|
|
133
|
+
GetBridgeInfoFunctions,
|
|
134
|
+
} from '../methods/delta/getBridgeInfo';
|
|
135
|
+
import {
|
|
136
|
+
constructGetMulticallHandlers,
|
|
137
|
+
GetMulticallHandlersFunctions,
|
|
138
|
+
} from '../methods/delta/getMulticallHandlers';
|
|
139
|
+
import {
|
|
140
|
+
constructIsTokenSupportedInDelta,
|
|
141
|
+
IsTokenSupportedInDeltaFunctions,
|
|
142
|
+
} from '../methods/delta/isTokenSupportedInDelta';
|
|
143
|
+
import {
|
|
144
|
+
BuildCrosschainOrderBridgeFunctions,
|
|
145
|
+
constructBuildCrosschainOrderBridge,
|
|
146
|
+
} from '../methods/delta/buildCrosschainOrderBridge';
|
|
147
|
+
|
|
148
|
+
export type SwapFetchMethods = GetBalancesFunctions &
|
|
149
|
+
GetTokensFunctions &
|
|
150
|
+
GetSpenderFunctions &
|
|
151
|
+
BuildTxFunctions &
|
|
152
|
+
GetAdaptersFunctions &
|
|
153
|
+
GetRateFunctions &
|
|
154
|
+
GetSwapTxFunctions;
|
|
155
|
+
|
|
156
|
+
export type LimitOrdersFetchMethods = GetLimitOrdersContractFunctions &
|
|
157
|
+
GetLimitOrdersFunctions &
|
|
158
|
+
BuildLimitOrderFunctions &
|
|
159
|
+
PostLimitOrderFunctions &
|
|
160
|
+
BuildLimitOrdersTxFunctions;
|
|
161
|
+
|
|
162
|
+
export type NFTOrdersFetchMethods = GetNFTOrdersContractFunctions &
|
|
163
|
+
GetNFTOrdersFunctions &
|
|
164
|
+
BuildNFTOrderFunctions &
|
|
165
|
+
PostNFTOrderFunctions &
|
|
166
|
+
BuildNFTOrdersTxFunctions;
|
|
167
|
+
|
|
168
|
+
export type DeltaFetchMethods = BuildDeltaOrderFunctions &
|
|
169
|
+
BuildCrosschainOrderBridgeFunctions &
|
|
170
|
+
GetDeltaOrdersFunctions &
|
|
171
|
+
GetDeltaPriceFunctions &
|
|
172
|
+
GetDeltaContractFunctions &
|
|
173
|
+
GetPartnerFeeFunctions &
|
|
174
|
+
GetMulticallHandlersFunctions &
|
|
175
|
+
GetBridgeInfoFunctions &
|
|
176
|
+
IsTokenSupportedInDeltaFunctions &
|
|
177
|
+
PostDeltaOrderFunctions;
|
|
178
|
+
|
|
179
|
+
export type SimpleFetchSDK = {
|
|
180
|
+
swap: SwapFetchMethods;
|
|
181
|
+
limitOrders: LimitOrdersFetchMethods;
|
|
182
|
+
nftOrders: NFTOrdersFetchMethods;
|
|
183
|
+
delta: DeltaFetchMethods;
|
|
184
|
+
quote: QuoteFetchMethods;
|
|
185
|
+
} & Required<ConstructBaseInput>;
|
|
186
|
+
|
|
187
|
+
export type QuoteFetchMethods = GetQuoteFunctions;
|
|
188
|
+
|
|
189
|
+
export type SimpleSDK = {
|
|
190
|
+
swap: SwapSDKMethods<TxHash>;
|
|
191
|
+
limitOrders: LimitOrderHandlers<TxHash>;
|
|
192
|
+
nftOrders: NFTOrderHandlers<TxHash>;
|
|
193
|
+
delta: DeltaOrderHandlers<TxHash>;
|
|
194
|
+
quote: QuoteFetchMethods;
|
|
195
|
+
} & Required<ConstructBaseInput>;
|
|
196
|
+
|
|
197
|
+
export type FetcherOptions = (
|
|
198
|
+
| {
|
|
199
|
+
axios: AxiosRequirement;
|
|
200
|
+
}
|
|
201
|
+
| { fetch: typeof fetch }
|
|
202
|
+
| { fetcher: FetcherFunction }
|
|
203
|
+
) &
|
|
204
|
+
ExtraFetchParams;
|
|
205
|
+
|
|
206
|
+
type SimpleOptions = ConstructBaseInput & FetcherOptions;
|
|
207
|
+
|
|
208
|
+
export type ProviderOptions = (
|
|
209
|
+
| EthersProviderDeps
|
|
210
|
+
| { web3: Web3 }
|
|
211
|
+
| { viemClient: MinViemClient }
|
|
212
|
+
) & {
|
|
213
|
+
account: Address;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const constructFetcher = (options: FetcherOptions): FetcherFunction => {
|
|
217
|
+
if ('axios' in options) {
|
|
218
|
+
return constructAxiosFetcher(options.axios, options);
|
|
219
|
+
}
|
|
220
|
+
if ('fetch' in options) {
|
|
221
|
+
return constructFetchFetcher(options.fetch, options);
|
|
222
|
+
}
|
|
223
|
+
return (params) => {
|
|
224
|
+
// adding apiKey to headers if it's provided
|
|
225
|
+
const headers = options?.apiKey
|
|
226
|
+
? {
|
|
227
|
+
'X-API-KEY': options.apiKey,
|
|
228
|
+
...params.headers,
|
|
229
|
+
...params.requestParams?.headers,
|
|
230
|
+
}
|
|
231
|
+
: params.headers;
|
|
232
|
+
|
|
233
|
+
return options.fetcher({ ...params, headers });
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/** @description construct SDK with methods that fetch from API and optionally with blockchain provider calling methods */
|
|
238
|
+
export function constructSimpleSDK(options: SimpleOptions): SimpleFetchSDK;
|
|
239
|
+
|
|
240
|
+
export function constructSimpleSDK(
|
|
241
|
+
options: SimpleOptions,
|
|
242
|
+
providerOptions: ProviderOptions
|
|
243
|
+
): SimpleSDK;
|
|
244
|
+
export function constructSimpleSDK(
|
|
245
|
+
options: SimpleOptions,
|
|
246
|
+
providerOptions?: ProviderOptions
|
|
247
|
+
): SimpleFetchSDK | SimpleSDK {
|
|
248
|
+
const fetcher = constructFetcher(options);
|
|
249
|
+
|
|
250
|
+
if (!providerOptions) {
|
|
251
|
+
const config: ConstructFetchInput = {
|
|
252
|
+
apiURL: options.apiURL,
|
|
253
|
+
chainId: options.chainId,
|
|
254
|
+
version: options.version,
|
|
255
|
+
fetcher,
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// include all available functions that don't need `contractCaller`
|
|
259
|
+
const swap: SwapFetchMethods = constructPartialSDK(
|
|
260
|
+
config,
|
|
261
|
+
constructGetBalances,
|
|
262
|
+
constructGetTokens,
|
|
263
|
+
constructGetSpender,
|
|
264
|
+
constructBuildTx,
|
|
265
|
+
constructGetAdapters,
|
|
266
|
+
constructGetRate,
|
|
267
|
+
constructSwapTx
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
const limitOrders = constructPartialSDK(
|
|
271
|
+
config,
|
|
272
|
+
constructBuildLimitOrder,
|
|
273
|
+
constructPostLimitOrder,
|
|
274
|
+
constructGetLimitOrders,
|
|
275
|
+
constructGetLimitOrdersContract,
|
|
276
|
+
constructBuildLimitOrderTx
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
const nftOrders = constructPartialSDK(
|
|
280
|
+
config,
|
|
281
|
+
constructBuildNFTOrder,
|
|
282
|
+
constructPostNFTOrder,
|
|
283
|
+
constructGetNFTOrders,
|
|
284
|
+
constructGetNFTOrdersContract,
|
|
285
|
+
constructBuildNFTOrderTx
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const delta = constructPartialSDK(
|
|
289
|
+
config,
|
|
290
|
+
constructBuildDeltaOrder,
|
|
291
|
+
constructBuildCrosschainOrderBridge,
|
|
292
|
+
constructPostDeltaOrder,
|
|
293
|
+
constructGetDeltaOrders,
|
|
294
|
+
constructGetDeltaPrice,
|
|
295
|
+
constructGetDeltaContract,
|
|
296
|
+
constructGetPartnerFee,
|
|
297
|
+
constructGetMulticallHandlers,
|
|
298
|
+
constructGetBridgeInfo,
|
|
299
|
+
constructIsTokenSupportedInDelta
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
const quote = constructPartialSDK(config, constructGetQuote);
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
swap,
|
|
306
|
+
limitOrders,
|
|
307
|
+
nftOrders,
|
|
308
|
+
delta,
|
|
309
|
+
quote,
|
|
310
|
+
apiURL: options.apiURL ?? API_URL,
|
|
311
|
+
chainId: options.chainId,
|
|
312
|
+
version: options.version ?? DEFAULT_VERSION,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const contractCaller = constructSimpleContractCaller(providerOptions);
|
|
317
|
+
|
|
318
|
+
const config: SDKConfig<TxHash> = {
|
|
319
|
+
apiURL: options.apiURL,
|
|
320
|
+
version: options.version,
|
|
321
|
+
chainId: options.chainId,
|
|
322
|
+
fetcher,
|
|
323
|
+
contractCaller,
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const swap: SwapSDKMethods<TxHash> = constructSwapSDK(config);
|
|
327
|
+
|
|
328
|
+
const limitOrders: LimitOrderHandlers<TxHash> =
|
|
329
|
+
constructAllLimitOrdersHandlers<TxHash>(config);
|
|
330
|
+
|
|
331
|
+
const nftOrders: NFTOrderHandlers<TxHash> =
|
|
332
|
+
constructAllNFTOrdersHandlers<TxHash>(config);
|
|
333
|
+
|
|
334
|
+
const delta: DeltaOrderHandlers<TxHash> =
|
|
335
|
+
constructAllDeltaOrdersHandlers<TxHash>(config);
|
|
336
|
+
|
|
337
|
+
const quote = constructGetQuote(config);
|
|
338
|
+
|
|
339
|
+
return {
|
|
340
|
+
swap,
|
|
341
|
+
limitOrders,
|
|
342
|
+
nftOrders,
|
|
343
|
+
delta,
|
|
344
|
+
quote,
|
|
345
|
+
apiURL: options.apiURL ?? API_URL,
|
|
346
|
+
chainId: options.chainId,
|
|
347
|
+
version: options.version ?? DEFAULT_VERSION,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function constructSimpleContractCaller(
|
|
352
|
+
providerOptions: ProviderOptions
|
|
353
|
+
): ContractCallerFunctions<TxHash> {
|
|
354
|
+
if ('ethersProviderOrSigner' in providerOptions) {
|
|
355
|
+
const {
|
|
356
|
+
staticCall,
|
|
357
|
+
transactCall: _transactCall,
|
|
358
|
+
signTypedDataCall,
|
|
359
|
+
} = constructEthersV5ContractCaller(
|
|
360
|
+
providerOptions,
|
|
361
|
+
providerOptions.account
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
const transactCall: TransactionContractCallerFn<TxHash> = async (
|
|
365
|
+
params
|
|
366
|
+
) => {
|
|
367
|
+
const contractTx = await _transactCall(params);
|
|
368
|
+
|
|
369
|
+
// as soon as tx is sent
|
|
370
|
+
// returning tx hash, it's up to the user to wait for tx
|
|
371
|
+
return contractTx.hash as TxHash;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
return { staticCall, transactCall, signTypedDataCall };
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if ('ethersV6ProviderOrSigner' in providerOptions) {
|
|
378
|
+
const {
|
|
379
|
+
staticCall,
|
|
380
|
+
transactCall: _transactCall,
|
|
381
|
+
signTypedDataCall,
|
|
382
|
+
} = constructEthersV6ContractCaller(
|
|
383
|
+
providerOptions,
|
|
384
|
+
providerOptions.account
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
const transactCall: TransactionContractCallerFn<TxHash> = async (
|
|
388
|
+
params
|
|
389
|
+
) => {
|
|
390
|
+
const contractTx = await _transactCall(params);
|
|
391
|
+
|
|
392
|
+
// as soon as tx is sent
|
|
393
|
+
// returning tx hash, it's up to the user to wait for tx
|
|
394
|
+
return contractTx.hash as TxHash;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
return { staticCall, transactCall, signTypedDataCall };
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if ('viemClient' in providerOptions) {
|
|
401
|
+
const contractCaller = constructViemContractCaller(
|
|
402
|
+
providerOptions.viemClient,
|
|
403
|
+
providerOptions.account
|
|
404
|
+
);
|
|
405
|
+
return contractCaller;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
const {
|
|
409
|
+
staticCall,
|
|
410
|
+
transactCall: _transactCall,
|
|
411
|
+
signTypedDataCall,
|
|
412
|
+
} = constructWeb3ContractCaller(
|
|
413
|
+
providerOptions.web3,
|
|
414
|
+
providerOptions.account
|
|
415
|
+
);
|
|
416
|
+
|
|
417
|
+
const transactCall: TransactionContractCallerFn<TxHash> = async (params) => {
|
|
418
|
+
const unpromiEvent = await _transactCall(params);
|
|
419
|
+
|
|
420
|
+
// as soon as tx is sent
|
|
421
|
+
// returning tx hash, it's up to the user to wait for tx
|
|
422
|
+
return new Promise<TxHash>((resolve, reject) => {
|
|
423
|
+
unpromiEvent.once('transactionHash', (hash) => resolve(hash as TxHash));
|
|
424
|
+
unpromiEvent.once('error', reject);
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
return { staticCall, transactCall, signTypedDataCall };
|
|
429
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OptimalRate,
|
|
3
|
+
OptionalRate,
|
|
4
|
+
ParaSwapVersion,
|
|
5
|
+
} from '@paraswap/core';
|
|
6
|
+
import type {
|
|
7
|
+
Address,
|
|
8
|
+
AddressOrSymbol,
|
|
9
|
+
PriceString,
|
|
10
|
+
Token,
|
|
11
|
+
TxHash,
|
|
12
|
+
} from './helpers/token';
|
|
13
|
+
import type { SignableTypedData } from './methods/common/orders/buildOrderData';
|
|
14
|
+
import { TransactionParams } from './methods/swap/transaction';
|
|
15
|
+
|
|
16
|
+
export type {
|
|
17
|
+
Address,
|
|
18
|
+
AddressOrSymbol,
|
|
19
|
+
PriceString,
|
|
20
|
+
Token,
|
|
21
|
+
TxHash,
|
|
22
|
+
OptimalRate,
|
|
23
|
+
OptionalRate,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type EnumerateLiteral<T extends Record<string, any>> = {
|
|
27
|
+
[K in keyof T]: T[K] extends `${infer n}` ? n : never;
|
|
28
|
+
}[keyof T];
|
|
29
|
+
// keeping version as string allows for more flexibility
|
|
30
|
+
// `alpha`,`beta` and other non-numbers can be used
|
|
31
|
+
// allowing enum only forces users to import and pass that enum
|
|
32
|
+
|
|
33
|
+
/** @description Passed to version API endpoints as ?version: to /prices and /adapters */
|
|
34
|
+
export type APIVersion = EnumerateLiteral<typeof ParaSwapVersion>;
|
|
35
|
+
|
|
36
|
+
export interface ConstructBaseInput {
|
|
37
|
+
apiURL?: string;
|
|
38
|
+
version?: APIVersion;
|
|
39
|
+
chainId: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** @description Any params that can be passed to fetcher. E.g. Axios fetcher can accept signal and timeout, fetch can accept signal */
|
|
43
|
+
export type RequestParameters = { [K: string]: any; signal?: AbortSignal };
|
|
44
|
+
|
|
45
|
+
interface FetcherInputBase<URL extends string = string> {
|
|
46
|
+
url: URL;
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
requestParams?: RequestParameters;
|
|
49
|
+
}
|
|
50
|
+
export interface FetcherGetInput<URL extends string = string>
|
|
51
|
+
extends FetcherInputBase<URL> {
|
|
52
|
+
method: 'GET';
|
|
53
|
+
}
|
|
54
|
+
export interface FetcherPostInput<URL extends string = string>
|
|
55
|
+
extends FetcherInputBase<URL> {
|
|
56
|
+
method: 'POST';
|
|
57
|
+
data: Record<string, any>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type FetcherFunction = <T, URL extends string = string>(
|
|
61
|
+
params: FetcherGetInput<URL> | FetcherPostInput<URL>
|
|
62
|
+
) => Promise<T>;
|
|
63
|
+
|
|
64
|
+
// authentication or some other params required in `fetcher`
|
|
65
|
+
export type ExtraFetchParams = { apiKey?: string };
|
|
66
|
+
|
|
67
|
+
export interface ConstructFetchInput extends ConstructBaseInput {
|
|
68
|
+
fetcher: FetcherFunction;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface OverridesBase {
|
|
72
|
+
from?: string;
|
|
73
|
+
gasPrice?: string;
|
|
74
|
+
maxFeePerGas?: string;
|
|
75
|
+
maxPriorityFeePerGas?: string;
|
|
76
|
+
gas?: number;
|
|
77
|
+
value?: number | string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type BlockTag = string | number | 'latest' | 'pending' | 'earliest' | 'genesis';
|
|
81
|
+
|
|
82
|
+
export interface StaticCallOverrides extends OverridesBase {
|
|
83
|
+
block?: BlockTag;
|
|
84
|
+
}
|
|
85
|
+
export interface TxSendOverrides extends OverridesBase {
|
|
86
|
+
nonce?: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface ContractCallInput<T extends string> {
|
|
90
|
+
address: Address;
|
|
91
|
+
abi: ReadonlyArray<JsonFragment>;
|
|
92
|
+
contractMethod: T;
|
|
93
|
+
args: any[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ContractCallStaticInput<T extends string>
|
|
97
|
+
extends ContractCallInput<T> {
|
|
98
|
+
overrides: StaticCallOverrides;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface ContractCallTransactionInput<T extends string>
|
|
102
|
+
extends ContractCallInput<T> {
|
|
103
|
+
overrides: TxSendOverrides;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// may have to type result T differently if we ever use staticCalls in SDK
|
|
107
|
+
export type StaticContractCallerFn = <T, M extends string = string>(
|
|
108
|
+
params: ContractCallStaticInput<M>
|
|
109
|
+
) => Promise<T>;
|
|
110
|
+
export type TransactionContractCallerFn<T> = <M extends string = string>(
|
|
111
|
+
params: ContractCallTransactionInput<M>
|
|
112
|
+
) => Promise<T>;
|
|
113
|
+
export type SignTypedDataContractCallerFn = (
|
|
114
|
+
typedData: SignableTypedData
|
|
115
|
+
) => Promise<string>;
|
|
116
|
+
|
|
117
|
+
export interface ContractCallerFunctions<T> {
|
|
118
|
+
staticCall: StaticContractCallerFn;
|
|
119
|
+
transactCall: TransactionContractCallerFn<T>;
|
|
120
|
+
signTypedDataCall: SignTypedDataContractCallerFn;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ConstructProviderFetchInput<
|
|
124
|
+
T,
|
|
125
|
+
D extends keyof ContractCallerFunctions<T> = keyof ContractCallerFunctions<T>
|
|
126
|
+
> extends ConstructFetchInput {
|
|
127
|
+
contractCaller: Pick<ContractCallerFunctions<T>, D>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type TokenFromApi = Pick<
|
|
131
|
+
Token,
|
|
132
|
+
'address' | 'decimals' | 'symbol' | 'balance' | 'allowance'
|
|
133
|
+
>;
|
|
134
|
+
|
|
135
|
+
export interface TokensApiResponse {
|
|
136
|
+
tokens: TokenFromApi[];
|
|
137
|
+
}
|
|
138
|
+
export interface TokenApiResponse {
|
|
139
|
+
token?: TokenFromApi;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// if no extra keys in Checking, return Checking, otherwise never
|
|
143
|
+
export type NoExtraKeysCheck<Checking, CheckAgainst> = Exclude<
|
|
144
|
+
keyof Checking,
|
|
145
|
+
keyof CheckAgainst
|
|
146
|
+
> extends never
|
|
147
|
+
? Checking
|
|
148
|
+
: never;
|
|
149
|
+
|
|
150
|
+
export type PriceRouteApiResponse = {
|
|
151
|
+
priceRoute: OptimalRate;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type SwapApiResponse = {
|
|
155
|
+
priceRoute: OptimalRate;
|
|
156
|
+
txParams: Omit<TransactionParams, 'gas'>;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type PriceRouteApiErrorResponse =
|
|
160
|
+
| {
|
|
161
|
+
error: string;
|
|
162
|
+
}
|
|
163
|
+
| { error: string; value: string; priceRoute: OptimalRate };
|
|
164
|
+
|
|
165
|
+
export type AnyFunction = (...args: any[]) => any;
|
|
166
|
+
|
|
167
|
+
// --------- from ethers types --------------
|
|
168
|
+
export interface JsonFragmentType {
|
|
169
|
+
/**
|
|
170
|
+
* The parameter name.
|
|
171
|
+
*/
|
|
172
|
+
readonly name?: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* If the parameter is indexed.
|
|
176
|
+
*/
|
|
177
|
+
readonly indexed?: boolean;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The type of the parameter.
|
|
181
|
+
*/
|
|
182
|
+
readonly type?: string;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The internal Solidity type.
|
|
186
|
+
*/
|
|
187
|
+
readonly internalType?: string;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The components for a tuple.
|
|
191
|
+
*/
|
|
192
|
+
readonly components?: ReadonlyArray<JsonFragmentType>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface JsonFragment {
|
|
196
|
+
/**
|
|
197
|
+
* The name of the error, event, function, etc.
|
|
198
|
+
*/
|
|
199
|
+
readonly name?: string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The type of the fragment (e.g. ``event``, ``"function"``, etc.)
|
|
203
|
+
*/
|
|
204
|
+
readonly type?: string;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* If the event is anonymous.
|
|
208
|
+
*/
|
|
209
|
+
readonly anonymous?: boolean;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* If the function is payable.
|
|
213
|
+
*/
|
|
214
|
+
readonly payable?: boolean;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* If the function is constant.
|
|
218
|
+
*/
|
|
219
|
+
readonly constant?: boolean;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The mutability state of the function.
|
|
223
|
+
*/
|
|
224
|
+
readonly stateMutability?: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The input parameters.
|
|
228
|
+
*/
|
|
229
|
+
readonly inputs?: ReadonlyArray<JsonFragmentType>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The output parameters.
|
|
233
|
+
*/
|
|
234
|
+
readonly outputs?: ReadonlyArray<JsonFragmentType>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The gas limit to use when sending a transaction for this function.
|
|
238
|
+
*/
|
|
239
|
+
readonly gas?: string;
|
|
240
|
+
}
|