@swapkit/helpers 2.5.0 → 3.0.0-beta.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/dist/api/index.cjs +3 -0
- package/dist/api/index.cjs.map +16 -0
- package/dist/api/index.js +3 -0
- package/dist/api/index.js.map +16 -0
- package/dist/chunk-fazw0jvt.js +3 -0
- package/dist/chunk-fazw0jvt.js.map +9 -0
- package/dist/chunk-nm00d52v.js +4 -0
- package/dist/chunk-nm00d52v.js.map +9 -0
- package/dist/contracts/index.cjs +3 -0
- package/dist/contracts/index.cjs.map +38 -0
- package/dist/contracts/index.js +3 -0
- package/dist/contracts/index.js.map +38 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +29 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +19 -20
- package/dist/tokens/index.cjs +3 -0
- package/dist/tokens/index.cjs.map +23 -0
- package/dist/tokens/index.js +3 -0
- package/dist/tokens/index.js.map +23 -0
- package/package.json +31 -15
- package/src/api/index.ts +19 -0
- package/src/api/microgard/endpoints.ts +83 -0
- package/src/api/microgard/types.ts +60 -0
- package/src/api/midgard/endpoints.ts +166 -0
- package/src/api/midgard/types.ts +155 -0
- package/src/api/swapkitApi/endpoints.ts +266 -0
- package/src/api/swapkitApi/types.ts +772 -0
- package/src/api/thornode/endpoints.ts +78 -0
- package/src/api/thornode/types.ts +241 -0
- package/src/api/thorswapStatic/endpoints.ts +30 -0
- package/src/api/thorswapStatic/types.ts +18 -0
- package/src/contracts/abis/avaxGeneric.ts +92 -0
- package/src/contracts/abis/avaxWoofi.ts +145 -0
- package/src/contracts/abis/bscGeneric.ts +106 -0
- package/src/contracts/abis/chainflipGateway.ts +330 -0
- package/src/contracts/abis/erc20.ts +99 -0
- package/src/contracts/abis/ethGeneric.ts +92 -0
- package/src/contracts/abis/mayaEvmVaults.ts +331 -0
- package/src/contracts/abis/pancakeV2.ts +145 -0
- package/src/contracts/abis/pangolin.ts +120 -0
- package/src/contracts/abis/sushiswap.ts +120 -0
- package/src/contracts/abis/tcEthVault.ts +650 -0
- package/src/contracts/abis/traderJoe.ts +120 -0
- package/src/contracts/abis/uniswapV2.ts +120 -0
- package/src/contracts/abis/uniswapV2Leg.ts +128 -0
- package/src/contracts/abis/uniswapV3_100.ts +128 -0
- package/src/contracts/abis/uniswapV3_10000.ts +128 -0
- package/src/contracts/abis/uniswapV3_3000.ts +128 -0
- package/src/contracts/abis/uniswapV3_500.ts +128 -0
- package/src/contracts/index.ts +95 -0
- package/src/contracts/routers/index.ts +58 -0
- package/src/contracts/routers/kyber.ts +402 -0
- package/src/contracts/routers/oneinch.ts +2188 -0
- package/src/contracts/routers/pancakeswap.ts +340 -0
- package/src/contracts/routers/pangolin.ts +340 -0
- package/src/contracts/routers/sushiswap.ts +340 -0
- package/src/contracts/routers/traderJoe.ts +340 -0
- package/src/contracts/routers/uniswapv2.ts +340 -0
- package/src/contracts/routers/uniswapv3.ts +254 -0
- package/src/contracts/routers/woofi.ts +171 -0
- package/src/index.ts +11 -12
- package/src/modules/__tests__/assetValue.test.ts +0 -2
- package/src/modules/__tests__/swapKitConfig.test.ts +37 -0
- package/src/modules/assetValue.ts +26 -92
- package/src/modules/bigIntArithmetics.ts +6 -2
- package/src/modules/requestClient.ts +26 -35
- package/src/modules/swapKitConfig.ts +131 -0
- package/src/modules/swapKitError.ts +6 -6
- package/src/tokens/index.ts +15 -0
- package/src/tokens/lists/camelot_v3.ts +15920 -0
- package/src/tokens/lists/caviar_v1.ts +1694 -0
- package/src/tokens/lists/chainflip.ts +104 -0
- package/src/tokens/lists/index.ts +13 -0
- package/src/tokens/lists/jupiter.ts +29606 -0
- package/src/tokens/lists/mayachain.ts +513 -0
- package/src/tokens/lists/oneinch.ts +14238 -0
- package/src/tokens/lists/openocean_v2.ts +11514 -0
- package/src/tokens/lists/pancakeswap.ts +4296 -0
- package/src/tokens/lists/pangolin_v1.ts +175 -0
- package/src/tokens/lists/sushiswap_v2.ts +965 -0
- package/src/tokens/lists/thorchain.ts +669 -0
- package/src/tokens/lists/traderjoe_v2.ts +1384 -0
- package/src/tokens/lists/uniswap_v2.ts +5596 -0
- package/src/tokens/lists/uniswap_v3.ts +5946 -0
- package/src/types/chains.ts +26 -46
- package/src/types/commonTypes.ts +3 -90
- package/src/types/index.ts +3 -4
- package/src/types/sdk.ts +0 -30
- package/src/types/tokens.ts +2 -2
- package/src/types/wallet.ts +37 -21
- package/src/{helpers → utils}/asset.ts +49 -19
- package/src/{helpers → utils}/derivationPath.ts +7 -2
- package/src/{helpers → utils}/memo.ts +0 -65
- package/src/{helpers → utils}/others.ts +12 -5
- package/src/utils/plugin.ts +13 -0
- package/src/{helpers/web3wallets.ts → utils/wallets.ts} +175 -139
- package/src/modules/walletUtils.ts +0 -30
- package/src/types/network.ts +0 -49
- /package/src/{helpers → utils}/__tests__/asset.test.ts +0 -0
- /package/src/{helpers/__tests__/derivationPath.ts → utils/__tests__/derivationPath.test.ts} +0 -0
- /package/src/{helpers → utils}/__tests__/memo.test.ts +0 -0
- /package/src/{helpers → utils}/__tests__/others.test.ts +0 -0
- /package/src/{helpers → utils}/__tests__/validators.test.ts +0 -0
- /package/src/{helpers → utils}/liquidity.ts +0 -0
- /package/src/{helpers → utils}/validators.ts +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AssetValue, Chain, RequestClient, SKConfig, StagenetChain } from "@swapkit/helpers";
|
|
2
|
+
import type {
|
|
3
|
+
InboundAddressesItem,
|
|
4
|
+
LastBlockItem,
|
|
5
|
+
MimirData,
|
|
6
|
+
NodeItem,
|
|
7
|
+
RunePoolInfo,
|
|
8
|
+
RunePoolProviderInfo,
|
|
9
|
+
THORNodeTNSDetails,
|
|
10
|
+
THORNodeType,
|
|
11
|
+
} from "./types";
|
|
12
|
+
|
|
13
|
+
function baseUrl(type?: THORNodeType) {
|
|
14
|
+
const { isStagenet } = SKConfig.get("envs");
|
|
15
|
+
const nodeUrls = SKConfig.get("nodeUrls");
|
|
16
|
+
|
|
17
|
+
switch (type) {
|
|
18
|
+
case "mayachain": {
|
|
19
|
+
const mayaNodeUrl = nodeUrls[isStagenet ? StagenetChain.Maya : Chain.Maya];
|
|
20
|
+
|
|
21
|
+
return `${mayaNodeUrl}/mayachain`;
|
|
22
|
+
}
|
|
23
|
+
default: {
|
|
24
|
+
const thorNodeUrl = nodeUrls[isStagenet ? StagenetChain.THORChain : Chain.THORChain];
|
|
25
|
+
|
|
26
|
+
return `${thorNodeUrl}/thorchain`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getNameServiceBaseUrl(type?: THORNodeType) {
|
|
32
|
+
const nsType = type === "mayachain" ? "mayaname" : "thorname";
|
|
33
|
+
|
|
34
|
+
return `${baseUrl(type)}/${nsType}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getLastBlock(type?: THORNodeType) {
|
|
38
|
+
return RequestClient.get<LastBlockItem[]>(`${baseUrl(type)}/lastblock`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function getThorchainQueue(type?: THORNodeType) {
|
|
42
|
+
return RequestClient.get(`${baseUrl(type)}/queue`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getNodes(type?: THORNodeType) {
|
|
46
|
+
return RequestClient.get<NodeItem[]>(`${baseUrl(type)}/nodes`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getMimirInfo(type?: THORNodeType) {
|
|
50
|
+
return RequestClient.get<MimirData>(`${baseUrl(type)}/mimir`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function getInboundAddresses(type?: THORNodeType) {
|
|
54
|
+
return RequestClient.get<InboundAddressesItem[]>(`${baseUrl(type)}/inbound_addresses`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getTHORNodeTNSDetails({ type, name }: { type?: THORNodeType; name: string }) {
|
|
58
|
+
return RequestClient.get<THORNodeTNSDetails>(`${getNameServiceBaseUrl(type)}/${name}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function getTNSPreferredAsset({ type, tns }: { type?: THORNodeType; tns: string }) {
|
|
62
|
+
const tnsDetails = await getTHORNodeTNSDetails({ name: tns, type });
|
|
63
|
+
|
|
64
|
+
if (!tnsDetails.preferred_asset || tnsDetails.preferred_asset === ".") return undefined;
|
|
65
|
+
|
|
66
|
+
return AssetValue.from({ asyncTokenLookup: true, asset: tnsDetails.preferred_asset });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function getRunePoolInfo(type?: THORNodeType) {
|
|
70
|
+
return RequestClient.get<RunePoolInfo>(`${baseUrl(type)}/runepool`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getRunePoolProviderInfo({
|
|
74
|
+
type,
|
|
75
|
+
thorAddress,
|
|
76
|
+
}: { type?: THORNodeType; thorAddress: string }) {
|
|
77
|
+
return RequestClient.get<RunePoolProviderInfo>(`${baseUrl(type)}/rune_provider/${thorAddress}`);
|
|
78
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
export type THORNodeType = "thorchain" | "mayachain";
|
|
2
|
+
|
|
3
|
+
export type THORNodeTNSDetails = {
|
|
4
|
+
name: string;
|
|
5
|
+
expire_block_height: number;
|
|
6
|
+
owner: string;
|
|
7
|
+
preferred_asset: string;
|
|
8
|
+
affiliate_collector_rune: string;
|
|
9
|
+
aliases: {
|
|
10
|
+
chain: string;
|
|
11
|
+
address: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type InboundAddressesItem = {
|
|
16
|
+
address: string;
|
|
17
|
+
chain: string;
|
|
18
|
+
gas_rate?: string;
|
|
19
|
+
halted: boolean;
|
|
20
|
+
pub_key: string;
|
|
21
|
+
router?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type LastBlockItem = {
|
|
25
|
+
chain: string;
|
|
26
|
+
last_observed_in: number;
|
|
27
|
+
last_signed_out: number;
|
|
28
|
+
thorchain: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type NodeItem = {
|
|
32
|
+
active_block_height: number;
|
|
33
|
+
bond_address: string;
|
|
34
|
+
current_award: string;
|
|
35
|
+
forced_to_leave: boolean;
|
|
36
|
+
ip_address: string;
|
|
37
|
+
leave_height: number;
|
|
38
|
+
node_address: string;
|
|
39
|
+
requested_to_leave: boolean;
|
|
40
|
+
signer_membership: string[];
|
|
41
|
+
slash_points: number;
|
|
42
|
+
status: string;
|
|
43
|
+
status_since: number;
|
|
44
|
+
total_bond: string;
|
|
45
|
+
validator_cons_pub_key: string;
|
|
46
|
+
version: string;
|
|
47
|
+
jail: any;
|
|
48
|
+
preflight_status: any;
|
|
49
|
+
pub_key_set: any;
|
|
50
|
+
observe_chains: {
|
|
51
|
+
chain: string;
|
|
52
|
+
height: number;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type MimirData = {
|
|
57
|
+
ADR012: number;
|
|
58
|
+
ASGARDSIZE: number;
|
|
59
|
+
BADVALIDATORREDLINE: number;
|
|
60
|
+
BURNSYNTHS: number;
|
|
61
|
+
CHURNINTERVAL: number;
|
|
62
|
+
CLOUTLIMIT: number;
|
|
63
|
+
CONFMULTIPLIERBASISPOINTS: number;
|
|
64
|
+
DEPRECATEILP: number;
|
|
65
|
+
DERIVEDDEPTHBASISPTS: number;
|
|
66
|
+
DERIVEDMINDEPTH: number;
|
|
67
|
+
DESIREDVALIDATORSET: number;
|
|
68
|
+
DYNAMICMAXANCHORTARGET: number;
|
|
69
|
+
EMISSIONCURVE: number;
|
|
70
|
+
ENABLEAVAXCHAIN: number;
|
|
71
|
+
ENABLEBSC: number;
|
|
72
|
+
ENABLESAVINGSVAULTS: number;
|
|
73
|
+
FULLIMPLOSSPROTECTIONBLOCKS: number;
|
|
74
|
+
FUNDMIGRATIONINTERVAL: number;
|
|
75
|
+
HALTAVAXCHAIN: number;
|
|
76
|
+
HALTAVAXTRADING: number;
|
|
77
|
+
HALTBCHCHAIN: number;
|
|
78
|
+
HALTBCHTRADING: number;
|
|
79
|
+
HALTBSCCHAIN: number;
|
|
80
|
+
HALTBSCTRADING: number;
|
|
81
|
+
HALTBTCCHAIN: number;
|
|
82
|
+
HALTBTCTRADING: number;
|
|
83
|
+
HALTCHAINGLOBAL: number;
|
|
84
|
+
HALTCHURNING: number;
|
|
85
|
+
HALTDOGECHAIN: number;
|
|
86
|
+
HALTDOGETRADING: number;
|
|
87
|
+
HALTETHCHAIN: number;
|
|
88
|
+
HALTETHTRADING: number;
|
|
89
|
+
HALTGAIACHAIN: number;
|
|
90
|
+
HALTGAIATRADING: number;
|
|
91
|
+
HALTLTCCHAIN: number;
|
|
92
|
+
HALTLTCTRADING: number;
|
|
93
|
+
HALTSIGNING: number;
|
|
94
|
+
HALTSIGNINGAVAX: number;
|
|
95
|
+
HALTSIGNINGBCH: number;
|
|
96
|
+
HALTSIGNINGBSC: number;
|
|
97
|
+
HALTSIGNINGBTC: number;
|
|
98
|
+
HALTSIGNINGDOGE: number;
|
|
99
|
+
HALTSIGNINGETH: number;
|
|
100
|
+
HALTSIGNINGGAIA: number;
|
|
101
|
+
HALTSIGNINGLTC: number;
|
|
102
|
+
HALTSIGNINGTERRA: number;
|
|
103
|
+
HALTTERRACHAIN: number;
|
|
104
|
+
HALTTERRATRADING: number;
|
|
105
|
+
HALTTHORCHAIN: number;
|
|
106
|
+
HALTTRADING: number;
|
|
107
|
+
ILPCUTOFF: number;
|
|
108
|
+
KEYGENRETRYINTERVAL: number;
|
|
109
|
+
KILLSWITCHSTART: number;
|
|
110
|
+
"LENDING-THOR-BTC": number;
|
|
111
|
+
"LENDING-THOR-ETH": number;
|
|
112
|
+
LENDINGLEVER: number;
|
|
113
|
+
LOANREPAYMENTMATURITY: number;
|
|
114
|
+
LOANSTREAMINGSWAPSINTERVAL: number;
|
|
115
|
+
MAXANCHORBLOCKS: number;
|
|
116
|
+
MAXANCHORSLIP: number;
|
|
117
|
+
MAXBONDPROVIDERS: number;
|
|
118
|
+
MAXCONFIRMATIONS: number;
|
|
119
|
+
MAXCR: number;
|
|
120
|
+
MAXIMUMLIQUIDITYRUNE: number;
|
|
121
|
+
MAXNODETOCHURNOUTFORLOWVERSION: number;
|
|
122
|
+
MAXOUTBOUNDATTEMPTS: number;
|
|
123
|
+
MAXOUTBOUNDFEEMULTIPLIERBASISPOINTS: number;
|
|
124
|
+
MAXRUNESUPPLY: number;
|
|
125
|
+
MAXSYNTHPERPOOLDEPTH: number;
|
|
126
|
+
MAXSYNTHSFORSAVERSYIELD: number;
|
|
127
|
+
MAXUTXOSTOSPEND: number;
|
|
128
|
+
MINCR: number;
|
|
129
|
+
MINIMUMBONDINRUNE: number;
|
|
130
|
+
MINIMUML1OUTBOUNDFEEUSD: number;
|
|
131
|
+
MINOUTBOUNDFEEMULTIPLIERBASISPOINTS: number;
|
|
132
|
+
MINRUNEPOOLDEPTH: number;
|
|
133
|
+
MINTSYNTHS: number;
|
|
134
|
+
NODEOPERATORFEE: number;
|
|
135
|
+
NODEPAUSECHAINGLOBAL: number;
|
|
136
|
+
NUMBEROFNEWNODESPERCHURN: number;
|
|
137
|
+
OBSERVATIONDELAYFLEXIBILITY: number;
|
|
138
|
+
"PAUSEASYMWITHDRAWAL-TERRA": number;
|
|
139
|
+
PAUSELOANS: number;
|
|
140
|
+
PAUSELP: number;
|
|
141
|
+
PAUSELPAVAX: number;
|
|
142
|
+
PAUSELPBCH: number;
|
|
143
|
+
PAUSELPBSC: number;
|
|
144
|
+
PAUSELPBTC: number;
|
|
145
|
+
PAUSELPDOGE: number;
|
|
146
|
+
PAUSELPETH: number;
|
|
147
|
+
PAUSELPGAIA: number;
|
|
148
|
+
PAUSELPLTC: number;
|
|
149
|
+
PAUSELPTERRA: number;
|
|
150
|
+
PAUSEUNBOND: number;
|
|
151
|
+
PENDINGLIQUIDITYAGELIMIT: number;
|
|
152
|
+
"POL-AVAX-AVAX": number;
|
|
153
|
+
"POL-AVAX-USDC-0XB97EF9EF8734C71904D8002F8B6BC66DD9C48A6E": number;
|
|
154
|
+
"POL-BCH-BCH": number;
|
|
155
|
+
"POL-BSC-USDC-0X8AC76A51CC950D9822D68B83FE1AD97B32CD580D": number;
|
|
156
|
+
"POL-BTC-BTC": number;
|
|
157
|
+
"POL-DOGE-DOGE": number;
|
|
158
|
+
"POL-ETH-DAI-0X6B175474E89094C44DA98B954EEDEAC495271D0F": number;
|
|
159
|
+
"POL-ETH-ETH": number;
|
|
160
|
+
"POL-ETH-USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48": number;
|
|
161
|
+
"POL-ETH-USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7": number;
|
|
162
|
+
"POL-GAIA-ATOM": number;
|
|
163
|
+
"POL-LTC-LTC": number;
|
|
164
|
+
POLBUFFER: number;
|
|
165
|
+
POLMAXNETWORKDEPOSIT: number;
|
|
166
|
+
POLMAXPOOLMOVEMENT: number;
|
|
167
|
+
POLTARGETSYNTHPERPOOLDEPTH: number;
|
|
168
|
+
POOLCYCLE: number;
|
|
169
|
+
POOLDEPTHFORYGGFUNDINGMIN: number;
|
|
170
|
+
PREFERREDASSETOUTBOUNDFEEMULTIPLIER: number;
|
|
171
|
+
RESCHEDULECOALESCEBLOCKS: number;
|
|
172
|
+
SAVERSSTREAMINGSWAPSINTERVAL: number;
|
|
173
|
+
SIGNERCONCURRENCY: number;
|
|
174
|
+
SLASHPENALTY: number;
|
|
175
|
+
SOLVENCYHALTAVAXCHAIN: number;
|
|
176
|
+
SOLVENCYHALTBCHCHAIN: number;
|
|
177
|
+
SOLVENCYHALTBSCCHAIN: number;
|
|
178
|
+
SOLVENCYHALTDOGECHAIN: number;
|
|
179
|
+
SOLVENCYHALTETHCHAIN: number;
|
|
180
|
+
SOLVENCYHALTGAIACHAIN: number;
|
|
181
|
+
SOLVENCYHALTTERRACHAIN: number;
|
|
182
|
+
STOPFUNDYGGDRASIL: number;
|
|
183
|
+
STOPSOLVENCYCHECK: number;
|
|
184
|
+
STOPSOLVENCYCHECKAVAX: number;
|
|
185
|
+
STOPSOLVENCYCHECKBSC: number;
|
|
186
|
+
STOPSOLVENCYCHECKDOGE: number;
|
|
187
|
+
STOPSOLVENCYCHECKETH: number;
|
|
188
|
+
STOPSOLVENCYCHECKGAIA: number;
|
|
189
|
+
STOPSOLVENCYCHECKTERRA: number;
|
|
190
|
+
STREAMINGSWAPMINBPFEE: number;
|
|
191
|
+
SYNTHYIELDBASISPOINTS: number;
|
|
192
|
+
THORNAMES: number;
|
|
193
|
+
"TORANCHOR-AVAX-USDC-0XB97EF9EF8734C71904D8002F8B6BC66DD9C48A6E": number;
|
|
194
|
+
"TORANCHOR-AVAX-USDT-0X9702230A8EA53601F5CD2DC00FDBC13D4DF4A8C7": number;
|
|
195
|
+
"TORANCHOR-BSC-USDC-0X8AC76A51CC950D9822D68B83FE1AD97B32CD580D": number;
|
|
196
|
+
"TORANCHOR-ETH-DAI-0X6B175474E89094C44DA98B954EEDEAC495271D0F": number;
|
|
197
|
+
"TORANCHOR-ETH-USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48": number;
|
|
198
|
+
"TORANCHOR-ETH-USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7": number;
|
|
199
|
+
TXOUTDELAYRATE: number;
|
|
200
|
+
VIRTUALMULTSYNTHS: number;
|
|
201
|
+
VOTEDOFM: number;
|
|
202
|
+
VOTELENDING: number;
|
|
203
|
+
VOTEMAXSYNTHSFORSAVERSYIELD: number;
|
|
204
|
+
YGGFUNDLIMIT: number;
|
|
205
|
+
YGGFUNDRETRY: number;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export type RunePoolInfo = {
|
|
209
|
+
pol: {
|
|
210
|
+
rune_deposited: string;
|
|
211
|
+
rune_withdrawn: string;
|
|
212
|
+
value: string;
|
|
213
|
+
pnl: string;
|
|
214
|
+
current_deposit: string;
|
|
215
|
+
};
|
|
216
|
+
providers: {
|
|
217
|
+
units: string;
|
|
218
|
+
pending_units: string;
|
|
219
|
+
pending_rune: string;
|
|
220
|
+
value: string;
|
|
221
|
+
pnl: string;
|
|
222
|
+
current_deposit: string;
|
|
223
|
+
};
|
|
224
|
+
reserve: {
|
|
225
|
+
units: string;
|
|
226
|
+
value: string;
|
|
227
|
+
pnl: string;
|
|
228
|
+
current_deposit: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export type RunePoolProviderInfo = {
|
|
233
|
+
rune_address: string;
|
|
234
|
+
units: string;
|
|
235
|
+
value: string;
|
|
236
|
+
pnl: string;
|
|
237
|
+
deposit_amount: string;
|
|
238
|
+
withdraw_amount: string;
|
|
239
|
+
last_deposit_height: number;
|
|
240
|
+
last_withdraw_height: number;
|
|
241
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AssetValue, type ProviderName, RequestClient, getChainIdentifier } from "@swapkit/helpers";
|
|
2
|
+
|
|
3
|
+
import { getTokenListProviders } from "../swapkitApi/endpoints";
|
|
4
|
+
import type { TokenListProvidersResponse } from "../swapkitApi/types";
|
|
5
|
+
import type { TokensResponse } from "./types";
|
|
6
|
+
|
|
7
|
+
const baseUrl = "https://static.thorswap.net";
|
|
8
|
+
|
|
9
|
+
export function getStaticTokenList(tokenListName: string) {
|
|
10
|
+
return RequestClient.get<TokensResponse>(`${baseUrl}/token-list/${tokenListName}.json`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getLogoForAsset(assetString: string) {
|
|
14
|
+
return `${baseUrl}/token-list/images/${assetString.toLowerCase()}.png`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getChainLogoForAsset(assetString: string) {
|
|
18
|
+
const { chain } = AssetValue.from({ asset: assetString });
|
|
19
|
+
const chainIdentifier = getChainIdentifier(chain).toLowerCase();
|
|
20
|
+
|
|
21
|
+
return `${baseUrl}/token-list/images/${chainIdentifier}.png`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let providerData: TokenListProvidersResponse;
|
|
25
|
+
|
|
26
|
+
export async function getProviderLogo(providerName: ProviderName | string) {
|
|
27
|
+
providerData ||= await getTokenListProviders();
|
|
28
|
+
|
|
29
|
+
return providerData.find((p) => p.name === providerName)?.url;
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Token = {
|
|
2
|
+
address?: string;
|
|
3
|
+
chain: string;
|
|
4
|
+
chainId: string;
|
|
5
|
+
decimals?: number;
|
|
6
|
+
identifier: string;
|
|
7
|
+
logoURL?: string;
|
|
8
|
+
ticker: string;
|
|
9
|
+
tokenlist: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type TokensResponse = {
|
|
13
|
+
keywords: string[];
|
|
14
|
+
name: string;
|
|
15
|
+
timestamp: string;
|
|
16
|
+
version: { major: number; minor: number; patch: number };
|
|
17
|
+
tokens: Token[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export const avaxGeneric = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
4
|
+
stateMutability: "nonpayable",
|
|
5
|
+
type: "constructor",
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
anonymous: false,
|
|
9
|
+
inputs: [
|
|
10
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
11
|
+
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
12
|
+
],
|
|
13
|
+
name: "FeeSet",
|
|
14
|
+
type: "event",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
anonymous: false,
|
|
18
|
+
inputs: [
|
|
19
|
+
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
20
|
+
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
21
|
+
],
|
|
22
|
+
name: "OwnerSet",
|
|
23
|
+
type: "event",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
inputs: [],
|
|
27
|
+
name: "fee",
|
|
28
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
29
|
+
stateMutability: "view",
|
|
30
|
+
type: "function",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
inputs: [],
|
|
34
|
+
name: "feeRecipient",
|
|
35
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
36
|
+
stateMutability: "view",
|
|
37
|
+
type: "function",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
41
|
+
name: "owners",
|
|
42
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
43
|
+
stateMutability: "view",
|
|
44
|
+
type: "function",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
inputs: [
|
|
48
|
+
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
49
|
+
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
50
|
+
],
|
|
51
|
+
name: "setFee",
|
|
52
|
+
outputs: [],
|
|
53
|
+
stateMutability: "nonpayable",
|
|
54
|
+
type: "function",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
inputs: [
|
|
58
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
59
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
60
|
+
],
|
|
61
|
+
name: "setOwner",
|
|
62
|
+
outputs: [],
|
|
63
|
+
stateMutability: "nonpayable",
|
|
64
|
+
type: "function",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
inputs: [
|
|
68
|
+
{ internalType: "address", name: "tcRouter", type: "address" },
|
|
69
|
+
{ internalType: "address", name: "tcVault", type: "address" },
|
|
70
|
+
{ internalType: "string", name: "tcMemo", type: "string" },
|
|
71
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
72
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
73
|
+
{ internalType: "address", name: "router", type: "address" },
|
|
74
|
+
{ internalType: "bytes", name: "data", type: "bytes" },
|
|
75
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
76
|
+
],
|
|
77
|
+
name: "swapIn",
|
|
78
|
+
outputs: [],
|
|
79
|
+
stateMutability: "nonpayable",
|
|
80
|
+
type: "function",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
inputs: [],
|
|
84
|
+
name: "tokenTransferProxy",
|
|
85
|
+
outputs: [
|
|
86
|
+
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
87
|
+
],
|
|
88
|
+
stateMutability: "view",
|
|
89
|
+
type: "function",
|
|
90
|
+
},
|
|
91
|
+
{ stateMutability: "payable", type: "receive" },
|
|
92
|
+
];
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export const avaxWoofi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{ internalType: "address", name: "_ttp", type: "address" },
|
|
5
|
+
{ internalType: "address", name: "_weth", type: "address" },
|
|
6
|
+
{ internalType: "address", name: "_swapRouter", type: "address" },
|
|
7
|
+
],
|
|
8
|
+
stateMutability: "nonpayable",
|
|
9
|
+
type: "constructor",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
anonymous: false,
|
|
13
|
+
inputs: [
|
|
14
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
15
|
+
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
16
|
+
],
|
|
17
|
+
name: "FeeSet",
|
|
18
|
+
type: "event",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
anonymous: false,
|
|
22
|
+
inputs: [
|
|
23
|
+
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
24
|
+
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
25
|
+
],
|
|
26
|
+
name: "OwnerSet",
|
|
27
|
+
type: "event",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
anonymous: false,
|
|
31
|
+
inputs: [
|
|
32
|
+
{ indexed: false, internalType: "address", name: "from", type: "address" },
|
|
33
|
+
{ indexed: false, internalType: "address", name: "token", type: "address" },
|
|
34
|
+
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
35
|
+
{ indexed: false, internalType: "uint256", name: "out", type: "uint256" },
|
|
36
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
37
|
+
{ indexed: false, internalType: "address", name: "vault", type: "address" },
|
|
38
|
+
{ indexed: false, internalType: "string", name: "memo", type: "string" },
|
|
39
|
+
],
|
|
40
|
+
name: "SwapIn",
|
|
41
|
+
type: "event",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
anonymous: false,
|
|
45
|
+
inputs: [
|
|
46
|
+
{ indexed: false, internalType: "address", name: "to", type: "address" },
|
|
47
|
+
{ indexed: false, internalType: "address", name: "token", type: "address" },
|
|
48
|
+
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
49
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
50
|
+
],
|
|
51
|
+
name: "SwapOut",
|
|
52
|
+
type: "event",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
inputs: [],
|
|
56
|
+
name: "fee",
|
|
57
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
58
|
+
stateMutability: "view",
|
|
59
|
+
type: "function",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
inputs: [],
|
|
63
|
+
name: "feeRecipient",
|
|
64
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
65
|
+
stateMutability: "view",
|
|
66
|
+
type: "function",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
70
|
+
name: "owners",
|
|
71
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
72
|
+
stateMutability: "view",
|
|
73
|
+
type: "function",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
inputs: [
|
|
77
|
+
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
78
|
+
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
79
|
+
],
|
|
80
|
+
name: "setFee",
|
|
81
|
+
outputs: [],
|
|
82
|
+
stateMutability: "nonpayable",
|
|
83
|
+
type: "function",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
inputs: [
|
|
87
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
88
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
89
|
+
],
|
|
90
|
+
name: "setOwner",
|
|
91
|
+
outputs: [],
|
|
92
|
+
stateMutability: "nonpayable",
|
|
93
|
+
type: "function",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
inputs: [
|
|
97
|
+
{ internalType: "address", name: "router", type: "address" },
|
|
98
|
+
{ internalType: "address", name: "vault", type: "address" },
|
|
99
|
+
{ internalType: "string", name: "memo", type: "string" },
|
|
100
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
101
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
102
|
+
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
103
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
104
|
+
],
|
|
105
|
+
name: "swapIn",
|
|
106
|
+
outputs: [],
|
|
107
|
+
stateMutability: "nonpayable",
|
|
108
|
+
type: "function",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
inputs: [
|
|
112
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
113
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
114
|
+
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
115
|
+
],
|
|
116
|
+
name: "swapOut",
|
|
117
|
+
outputs: [],
|
|
118
|
+
stateMutability: "payable",
|
|
119
|
+
type: "function",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
inputs: [],
|
|
123
|
+
name: "swapRouter",
|
|
124
|
+
outputs: [{ internalType: "contract IWoofi", name: "", type: "address" }],
|
|
125
|
+
stateMutability: "view",
|
|
126
|
+
type: "function",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
inputs: [],
|
|
130
|
+
name: "tokenTransferProxy",
|
|
131
|
+
outputs: [
|
|
132
|
+
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
133
|
+
],
|
|
134
|
+
stateMutability: "view",
|
|
135
|
+
type: "function",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
inputs: [],
|
|
139
|
+
name: "weth",
|
|
140
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
141
|
+
stateMutability: "view",
|
|
142
|
+
type: "function",
|
|
143
|
+
},
|
|
144
|
+
{ stateMutability: "payable", type: "receive" },
|
|
145
|
+
];
|