@orderly.network/hooks 0.0.61 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +39 -21
- package/dist/index.d.ts +39 -21
- package/dist/index.js +691 -218
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +694 -220
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -218,12 +218,6 @@ var useAccount = () => {
|
|
|
218
218
|
account5.off("change:status", statusChangeHandler);
|
|
219
219
|
};
|
|
220
220
|
}, []);
|
|
221
|
-
const login = React2.useCallback(
|
|
222
|
-
(address) => {
|
|
223
|
-
account5.login(address);
|
|
224
|
-
},
|
|
225
|
-
[account5]
|
|
226
|
-
);
|
|
227
221
|
const createOrderlyKey = React2.useCallback(
|
|
228
222
|
async (remember) => {
|
|
229
223
|
return account5.createOrderlyKey(remember ? 365 : 30);
|
|
@@ -247,7 +241,7 @@ var useAccount = () => {
|
|
|
247
241
|
account: account5,
|
|
248
242
|
state,
|
|
249
243
|
// info: {},
|
|
250
|
-
login,
|
|
244
|
+
// login,
|
|
251
245
|
createOrderlyKey,
|
|
252
246
|
createAccount,
|
|
253
247
|
disconnect,
|
|
@@ -287,16 +281,6 @@ var useBoolean = (initialValue = false) => {
|
|
|
287
281
|
var useTradingView = () => {
|
|
288
282
|
return {};
|
|
289
283
|
};
|
|
290
|
-
var usePrivateObserve = () => {
|
|
291
|
-
const [data, setData] = React2.useState();
|
|
292
|
-
React2.useEffect(() => {
|
|
293
|
-
return () => {
|
|
294
|
-
};
|
|
295
|
-
}, []);
|
|
296
|
-
return {
|
|
297
|
-
data
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
284
|
var useTopicObserve = (topic) => {
|
|
301
285
|
const [data, setData] = React2.useState();
|
|
302
286
|
React2.useEffect(() => {
|
|
@@ -1932,16 +1916,23 @@ var useMarginRatio = () => {
|
|
|
1932
1916
|
// src/woo/constants.ts
|
|
1933
1917
|
var woofiDexCrossChainRouterAbi = [
|
|
1934
1918
|
{
|
|
1935
|
-
inputs: [
|
|
1936
|
-
{ internalType: "address", name: "_weth", type: "address" },
|
|
1937
|
-
{ internalType: "address", name: "_nonceCounter", type: "address" },
|
|
1938
|
-
{ internalType: "address", name: "_wooRouter", type: "address" },
|
|
1939
|
-
{ internalType: "address", name: "_stargateRouter", type: "address" },
|
|
1940
|
-
{ internalType: "uint16", name: "_sgChainIdLocal", type: "uint16" }
|
|
1941
|
-
],
|
|
1919
|
+
inputs: [],
|
|
1942
1920
|
stateMutability: "nonpayable",
|
|
1943
1921
|
type: "constructor"
|
|
1944
1922
|
},
|
|
1923
|
+
{
|
|
1924
|
+
anonymous: false,
|
|
1925
|
+
inputs: [
|
|
1926
|
+
{
|
|
1927
|
+
indexed: false,
|
|
1928
|
+
internalType: "uint8",
|
|
1929
|
+
name: "version",
|
|
1930
|
+
type: "uint8"
|
|
1931
|
+
}
|
|
1932
|
+
],
|
|
1933
|
+
name: "Initialized",
|
|
1934
|
+
type: "event"
|
|
1935
|
+
},
|
|
1945
1936
|
{
|
|
1946
1937
|
anonymous: false,
|
|
1947
1938
|
inputs: [
|
|
@@ -2008,7 +1999,12 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2008
1999
|
name: "sender",
|
|
2009
2000
|
type: "address"
|
|
2010
2001
|
},
|
|
2011
|
-
{
|
|
2002
|
+
{
|
|
2003
|
+
indexed: true,
|
|
2004
|
+
internalType: "address",
|
|
2005
|
+
name: "to",
|
|
2006
|
+
type: "address"
|
|
2007
|
+
},
|
|
2012
2008
|
{
|
|
2013
2009
|
indexed: false,
|
|
2014
2010
|
internalType: "address",
|
|
@@ -2045,6 +2041,12 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2045
2041
|
name: "realToAmount",
|
|
2046
2042
|
type: "uint256"
|
|
2047
2043
|
},
|
|
2044
|
+
{
|
|
2045
|
+
indexed: false,
|
|
2046
|
+
internalType: "uint256",
|
|
2047
|
+
name: "orderlyNativeFees",
|
|
2048
|
+
type: "uint256"
|
|
2049
|
+
},
|
|
2048
2050
|
{
|
|
2049
2051
|
indexed: false,
|
|
2050
2052
|
internalType: "bytes32",
|
|
@@ -2094,7 +2096,12 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2094
2096
|
name: "sender",
|
|
2095
2097
|
type: "address"
|
|
2096
2098
|
},
|
|
2097
|
-
{
|
|
2099
|
+
{
|
|
2100
|
+
indexed: true,
|
|
2101
|
+
internalType: "address",
|
|
2102
|
+
name: "to",
|
|
2103
|
+
type: "address"
|
|
2104
|
+
},
|
|
2098
2105
|
{
|
|
2099
2106
|
indexed: false,
|
|
2100
2107
|
internalType: "address",
|
|
@@ -2132,19 +2139,37 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2132
2139
|
{
|
|
2133
2140
|
inputs: [],
|
|
2134
2141
|
name: "MAX_BRIDGE_SLIPPAGE",
|
|
2135
|
-
outputs: [
|
|
2142
|
+
outputs: [
|
|
2143
|
+
{
|
|
2144
|
+
internalType: "uint256",
|
|
2145
|
+
name: "",
|
|
2146
|
+
type: "uint256"
|
|
2147
|
+
}
|
|
2148
|
+
],
|
|
2136
2149
|
stateMutability: "view",
|
|
2137
2150
|
type: "function"
|
|
2138
2151
|
},
|
|
2139
2152
|
{
|
|
2140
2153
|
inputs: [],
|
|
2141
2154
|
name: "NATIVE_PLACEHOLDER",
|
|
2142
|
-
outputs: [
|
|
2155
|
+
outputs: [
|
|
2156
|
+
{
|
|
2157
|
+
internalType: "address",
|
|
2158
|
+
name: "",
|
|
2159
|
+
type: "address"
|
|
2160
|
+
}
|
|
2161
|
+
],
|
|
2143
2162
|
stateMutability: "view",
|
|
2144
2163
|
type: "function"
|
|
2145
2164
|
},
|
|
2146
2165
|
{
|
|
2147
|
-
inputs: [
|
|
2166
|
+
inputs: [
|
|
2167
|
+
{
|
|
2168
|
+
internalType: "address",
|
|
2169
|
+
name: "token",
|
|
2170
|
+
type: "address"
|
|
2171
|
+
}
|
|
2172
|
+
],
|
|
2148
2173
|
name: "addDirectBridgeToken",
|
|
2149
2174
|
outputs: [],
|
|
2150
2175
|
stateMutability: "nonpayable",
|
|
@@ -2153,32 +2178,66 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2153
2178
|
{
|
|
2154
2179
|
inputs: [],
|
|
2155
2180
|
name: "allDirectBridgeTokens",
|
|
2156
|
-
outputs: [
|
|
2181
|
+
outputs: [
|
|
2182
|
+
{
|
|
2183
|
+
internalType: "address[]",
|
|
2184
|
+
name: "",
|
|
2185
|
+
type: "address[]"
|
|
2186
|
+
}
|
|
2187
|
+
],
|
|
2157
2188
|
stateMutability: "view",
|
|
2158
2189
|
type: "function"
|
|
2159
2190
|
},
|
|
2160
2191
|
{
|
|
2161
2192
|
inputs: [],
|
|
2162
2193
|
name: "allDirectBridgeTokensLength",
|
|
2163
|
-
outputs: [
|
|
2194
|
+
outputs: [
|
|
2195
|
+
{
|
|
2196
|
+
internalType: "uint256",
|
|
2197
|
+
name: "",
|
|
2198
|
+
type: "uint256"
|
|
2199
|
+
}
|
|
2200
|
+
],
|
|
2164
2201
|
stateMutability: "view",
|
|
2165
2202
|
type: "function"
|
|
2166
2203
|
},
|
|
2167
2204
|
{
|
|
2168
2205
|
inputs: [],
|
|
2169
2206
|
name: "bridgeSlippage",
|
|
2170
|
-
outputs: [
|
|
2207
|
+
outputs: [
|
|
2208
|
+
{
|
|
2209
|
+
internalType: "uint256",
|
|
2210
|
+
name: "",
|
|
2211
|
+
type: "uint256"
|
|
2212
|
+
}
|
|
2213
|
+
],
|
|
2171
2214
|
stateMutability: "view",
|
|
2172
2215
|
type: "function"
|
|
2173
2216
|
},
|
|
2174
2217
|
{
|
|
2175
2218
|
inputs: [
|
|
2176
|
-
{
|
|
2219
|
+
{
|
|
2220
|
+
internalType: "address payable",
|
|
2221
|
+
name: "to",
|
|
2222
|
+
type: "address"
|
|
2223
|
+
},
|
|
2177
2224
|
{
|
|
2178
2225
|
components: [
|
|
2179
|
-
{
|
|
2180
|
-
|
|
2181
|
-
|
|
2226
|
+
{
|
|
2227
|
+
internalType: "address",
|
|
2228
|
+
name: "fromToken",
|
|
2229
|
+
type: "address"
|
|
2230
|
+
},
|
|
2231
|
+
{
|
|
2232
|
+
internalType: "uint256",
|
|
2233
|
+
name: "fromAmount",
|
|
2234
|
+
type: "uint256"
|
|
2235
|
+
},
|
|
2236
|
+
{
|
|
2237
|
+
internalType: "address",
|
|
2238
|
+
name: "bridgeToken",
|
|
2239
|
+
type: "address"
|
|
2240
|
+
},
|
|
2182
2241
|
{
|
|
2183
2242
|
internalType: "uint256",
|
|
2184
2243
|
name: "minBridgeAmount",
|
|
@@ -2191,13 +2250,29 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2191
2250
|
},
|
|
2192
2251
|
{
|
|
2193
2252
|
components: [
|
|
2194
|
-
{
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2253
|
+
{
|
|
2254
|
+
internalType: "uint16",
|
|
2255
|
+
name: "chainId",
|
|
2256
|
+
type: "uint16"
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
internalType: "address",
|
|
2260
|
+
name: "bridgedToken",
|
|
2261
|
+
type: "address"
|
|
2262
|
+
},
|
|
2263
|
+
{
|
|
2264
|
+
internalType: "address",
|
|
2265
|
+
name: "toToken",
|
|
2266
|
+
type: "address"
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
internalType: "uint256",
|
|
2270
|
+
name: "minToAmount",
|
|
2271
|
+
type: "uint256"
|
|
2272
|
+
},
|
|
2198
2273
|
{
|
|
2199
2274
|
internalType: "uint256",
|
|
2200
|
-
name: "
|
|
2275
|
+
name: "orderlyNativeFees",
|
|
2201
2276
|
type: "uint256"
|
|
2202
2277
|
}
|
|
2203
2278
|
],
|
|
@@ -2207,9 +2282,21 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2207
2282
|
},
|
|
2208
2283
|
{
|
|
2209
2284
|
components: [
|
|
2210
|
-
{
|
|
2211
|
-
|
|
2212
|
-
|
|
2285
|
+
{
|
|
2286
|
+
internalType: "bytes32",
|
|
2287
|
+
name: "accountId",
|
|
2288
|
+
type: "bytes32"
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
internalType: "bytes32",
|
|
2292
|
+
name: "brokerHash",
|
|
2293
|
+
type: "bytes32"
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
internalType: "bytes32",
|
|
2297
|
+
name: "tokenHash",
|
|
2298
|
+
type: "bytes32"
|
|
2299
|
+
}
|
|
2213
2300
|
],
|
|
2214
2301
|
internalType: "struct IWOOFiDexCrossChainRouter.DstVaultDeposit",
|
|
2215
2302
|
name: "dstVaultDeposit",
|
|
@@ -2224,29 +2311,97 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2224
2311
|
{
|
|
2225
2312
|
inputs: [],
|
|
2226
2313
|
name: "dstGasForNoSwapCall",
|
|
2227
|
-
outputs: [
|
|
2314
|
+
outputs: [
|
|
2315
|
+
{
|
|
2316
|
+
internalType: "uint256",
|
|
2317
|
+
name: "",
|
|
2318
|
+
type: "uint256"
|
|
2319
|
+
}
|
|
2320
|
+
],
|
|
2228
2321
|
stateMutability: "view",
|
|
2229
2322
|
type: "function"
|
|
2230
2323
|
},
|
|
2231
2324
|
{
|
|
2232
2325
|
inputs: [],
|
|
2233
2326
|
name: "dstGasForSwapCall",
|
|
2234
|
-
outputs: [
|
|
2327
|
+
outputs: [
|
|
2328
|
+
{
|
|
2329
|
+
internalType: "uint256",
|
|
2330
|
+
name: "",
|
|
2331
|
+
type: "uint256"
|
|
2332
|
+
}
|
|
2333
|
+
],
|
|
2235
2334
|
stateMutability: "view",
|
|
2236
2335
|
type: "function"
|
|
2237
2336
|
},
|
|
2238
2337
|
{
|
|
2239
|
-
inputs: [
|
|
2338
|
+
inputs: [
|
|
2339
|
+
{
|
|
2340
|
+
internalType: "address",
|
|
2341
|
+
name: "stuckToken",
|
|
2342
|
+
type: "address"
|
|
2343
|
+
}
|
|
2344
|
+
],
|
|
2240
2345
|
name: "inCaseTokenGotStuck",
|
|
2241
2346
|
outputs: [],
|
|
2242
2347
|
stateMutability: "nonpayable",
|
|
2243
2348
|
type: "function"
|
|
2244
2349
|
},
|
|
2350
|
+
{
|
|
2351
|
+
inputs: [
|
|
2352
|
+
{
|
|
2353
|
+
internalType: "address",
|
|
2354
|
+
name: "_weth",
|
|
2355
|
+
type: "address"
|
|
2356
|
+
},
|
|
2357
|
+
{
|
|
2358
|
+
internalType: "address",
|
|
2359
|
+
name: "_nonceCounter",
|
|
2360
|
+
type: "address"
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
internalType: "address",
|
|
2364
|
+
name: "_wooRouter",
|
|
2365
|
+
type: "address"
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
internalType: "address",
|
|
2369
|
+
name: "_sgRouter",
|
|
2370
|
+
type: "address"
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
internalType: "uint16",
|
|
2374
|
+
name: "_sgChainIdLocal",
|
|
2375
|
+
type: "uint16"
|
|
2376
|
+
}
|
|
2377
|
+
],
|
|
2378
|
+
name: "initialize",
|
|
2379
|
+
outputs: [],
|
|
2380
|
+
stateMutability: "nonpayable",
|
|
2381
|
+
type: "function"
|
|
2382
|
+
},
|
|
2245
2383
|
{
|
|
2246
2384
|
inputs: [],
|
|
2247
2385
|
name: "nonceCounter",
|
|
2248
2386
|
outputs: [
|
|
2249
|
-
{
|
|
2387
|
+
{
|
|
2388
|
+
internalType: "address",
|
|
2389
|
+
name: "",
|
|
2390
|
+
type: "address"
|
|
2391
|
+
}
|
|
2392
|
+
],
|
|
2393
|
+
stateMutability: "view",
|
|
2394
|
+
type: "function"
|
|
2395
|
+
},
|
|
2396
|
+
{
|
|
2397
|
+
inputs: [],
|
|
2398
|
+
name: "orderlyFeeToggle",
|
|
2399
|
+
outputs: [
|
|
2400
|
+
{
|
|
2401
|
+
internalType: "bool",
|
|
2402
|
+
name: "",
|
|
2403
|
+
type: "bool"
|
|
2404
|
+
}
|
|
2250
2405
|
],
|
|
2251
2406
|
stateMutability: "view",
|
|
2252
2407
|
type: "function"
|
|
@@ -2254,7 +2409,13 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2254
2409
|
{
|
|
2255
2410
|
inputs: [],
|
|
2256
2411
|
name: "owner",
|
|
2257
|
-
outputs: [
|
|
2412
|
+
outputs: [
|
|
2413
|
+
{
|
|
2414
|
+
internalType: "address",
|
|
2415
|
+
name: "",
|
|
2416
|
+
type: "address"
|
|
2417
|
+
}
|
|
2418
|
+
],
|
|
2258
2419
|
stateMutability: "view",
|
|
2259
2420
|
type: "function"
|
|
2260
2421
|
},
|
|
@@ -2268,22 +2429,48 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2268
2429
|
{
|
|
2269
2430
|
inputs: [],
|
|
2270
2431
|
name: "paused",
|
|
2271
|
-
outputs: [
|
|
2432
|
+
outputs: [
|
|
2433
|
+
{
|
|
2434
|
+
internalType: "bool",
|
|
2435
|
+
name: "",
|
|
2436
|
+
type: "bool"
|
|
2437
|
+
}
|
|
2438
|
+
],
|
|
2272
2439
|
stateMutability: "view",
|
|
2273
2440
|
type: "function"
|
|
2274
2441
|
},
|
|
2275
2442
|
{
|
|
2276
2443
|
inputs: [
|
|
2277
|
-
{
|
|
2444
|
+
{
|
|
2445
|
+
internalType: "address",
|
|
2446
|
+
name: "to",
|
|
2447
|
+
type: "address"
|
|
2448
|
+
},
|
|
2278
2449
|
{
|
|
2279
2450
|
components: [
|
|
2280
|
-
{
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2451
|
+
{
|
|
2452
|
+
internalType: "uint16",
|
|
2453
|
+
name: "chainId",
|
|
2454
|
+
type: "uint16"
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
internalType: "address",
|
|
2458
|
+
name: "bridgedToken",
|
|
2459
|
+
type: "address"
|
|
2460
|
+
},
|
|
2461
|
+
{
|
|
2462
|
+
internalType: "address",
|
|
2463
|
+
name: "toToken",
|
|
2464
|
+
type: "address"
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
internalType: "uint256",
|
|
2468
|
+
name: "minToAmount",
|
|
2469
|
+
type: "uint256"
|
|
2470
|
+
},
|
|
2284
2471
|
{
|
|
2285
2472
|
internalType: "uint256",
|
|
2286
|
-
name: "
|
|
2473
|
+
name: "orderlyNativeFees",
|
|
2287
2474
|
type: "uint256"
|
|
2288
2475
|
}
|
|
2289
2476
|
],
|
|
@@ -2293,9 +2480,21 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2293
2480
|
},
|
|
2294
2481
|
{
|
|
2295
2482
|
components: [
|
|
2296
|
-
{
|
|
2297
|
-
|
|
2298
|
-
|
|
2483
|
+
{
|
|
2484
|
+
internalType: "bytes32",
|
|
2485
|
+
name: "accountId",
|
|
2486
|
+
type: "bytes32"
|
|
2487
|
+
},
|
|
2488
|
+
{
|
|
2489
|
+
internalType: "bytes32",
|
|
2490
|
+
name: "brokerHash",
|
|
2491
|
+
type: "bytes32"
|
|
2492
|
+
},
|
|
2493
|
+
{
|
|
2494
|
+
internalType: "bytes32",
|
|
2495
|
+
name: "tokenHash",
|
|
2496
|
+
type: "bytes32"
|
|
2497
|
+
}
|
|
2299
2498
|
],
|
|
2300
2499
|
internalType: "struct IWOOFiDexCrossChainRouter.DstVaultDeposit",
|
|
2301
2500
|
name: "dstVaultDeposit",
|
|
@@ -2304,14 +2503,28 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2304
2503
|
],
|
|
2305
2504
|
name: "quoteLayerZeroFee",
|
|
2306
2505
|
outputs: [
|
|
2307
|
-
{
|
|
2308
|
-
|
|
2506
|
+
{
|
|
2507
|
+
internalType: "uint256",
|
|
2508
|
+
name: "nativeAmount",
|
|
2509
|
+
type: "uint256"
|
|
2510
|
+
},
|
|
2511
|
+
{
|
|
2512
|
+
internalType: "uint256",
|
|
2513
|
+
name: "zroAmount",
|
|
2514
|
+
type: "uint256"
|
|
2515
|
+
}
|
|
2309
2516
|
],
|
|
2310
2517
|
stateMutability: "view",
|
|
2311
2518
|
type: "function"
|
|
2312
2519
|
},
|
|
2313
2520
|
{
|
|
2314
|
-
inputs: [
|
|
2521
|
+
inputs: [
|
|
2522
|
+
{
|
|
2523
|
+
internalType: "address",
|
|
2524
|
+
name: "token",
|
|
2525
|
+
type: "address"
|
|
2526
|
+
}
|
|
2527
|
+
],
|
|
2315
2528
|
name: "removeDirectBridgeToken",
|
|
2316
2529
|
outputs: [],
|
|
2317
2530
|
stateMutability: "nonpayable",
|
|
@@ -2326,7 +2539,11 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2326
2539
|
},
|
|
2327
2540
|
{
|
|
2328
2541
|
inputs: [
|
|
2329
|
-
{
|
|
2542
|
+
{
|
|
2543
|
+
internalType: "uint256",
|
|
2544
|
+
name: "_bridgeSlippage",
|
|
2545
|
+
type: "uint256"
|
|
2546
|
+
}
|
|
2330
2547
|
],
|
|
2331
2548
|
name: "setBridgeSlippage",
|
|
2332
2549
|
outputs: [],
|
|
@@ -2361,62 +2578,132 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2361
2578
|
},
|
|
2362
2579
|
{
|
|
2363
2580
|
inputs: [
|
|
2364
|
-
{
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
type: "function"
|
|
2370
|
-
},
|
|
2371
|
-
{
|
|
2372
|
-
inputs: [
|
|
2373
|
-
{ internalType: "uint16", name: "chainId", type: "uint16" },
|
|
2374
|
-
{ internalType: "address", name: "token", type: "address" }
|
|
2581
|
+
{
|
|
2582
|
+
internalType: "address",
|
|
2583
|
+
name: "_nonceCounter",
|
|
2584
|
+
type: "address"
|
|
2585
|
+
}
|
|
2375
2586
|
],
|
|
2376
|
-
name: "
|
|
2587
|
+
name: "setNonceCounter",
|
|
2377
2588
|
outputs: [],
|
|
2378
2589
|
stateMutability: "nonpayable",
|
|
2379
2590
|
type: "function"
|
|
2380
2591
|
},
|
|
2381
2592
|
{
|
|
2382
2593
|
inputs: [
|
|
2383
|
-
{
|
|
2384
|
-
|
|
2385
|
-
|
|
2594
|
+
{
|
|
2595
|
+
internalType: "bool",
|
|
2596
|
+
name: "_orderlyFeeToggle",
|
|
2597
|
+
type: "bool"
|
|
2598
|
+
}
|
|
2386
2599
|
],
|
|
2387
|
-
name: "
|
|
2600
|
+
name: "setOrderlyFeeToggle",
|
|
2388
2601
|
outputs: [],
|
|
2389
2602
|
stateMutability: "nonpayable",
|
|
2390
2603
|
type: "function"
|
|
2391
2604
|
},
|
|
2392
2605
|
{
|
|
2393
2606
|
inputs: [
|
|
2394
|
-
{
|
|
2607
|
+
{
|
|
2608
|
+
internalType: "uint16",
|
|
2609
|
+
name: "_sgChainIdLocal",
|
|
2610
|
+
type: "uint16"
|
|
2611
|
+
}
|
|
2395
2612
|
],
|
|
2396
|
-
name: "
|
|
2613
|
+
name: "setSgChainIdLocal",
|
|
2397
2614
|
outputs: [],
|
|
2398
2615
|
stateMutability: "nonpayable",
|
|
2399
2616
|
type: "function"
|
|
2400
2617
|
},
|
|
2401
2618
|
{
|
|
2402
2619
|
inputs: [
|
|
2403
|
-
{
|
|
2620
|
+
{
|
|
2621
|
+
internalType: "uint16",
|
|
2622
|
+
name: "chainId",
|
|
2623
|
+
type: "uint16"
|
|
2624
|
+
},
|
|
2404
2625
|
{
|
|
2405
2626
|
internalType: "address",
|
|
2406
|
-
name: "
|
|
2627
|
+
name: "token",
|
|
2407
2628
|
type: "address"
|
|
2408
2629
|
}
|
|
2409
2630
|
],
|
|
2410
|
-
name: "
|
|
2631
|
+
name: "setSgETH",
|
|
2411
2632
|
outputs: [],
|
|
2412
2633
|
stateMutability: "nonpayable",
|
|
2413
2634
|
type: "function"
|
|
2414
2635
|
},
|
|
2415
2636
|
{
|
|
2416
2637
|
inputs: [
|
|
2417
|
-
{
|
|
2418
|
-
|
|
2419
|
-
|
|
2638
|
+
{
|
|
2639
|
+
internalType: "uint16",
|
|
2640
|
+
name: "chainId",
|
|
2641
|
+
type: "uint16"
|
|
2642
|
+
},
|
|
2643
|
+
{
|
|
2644
|
+
internalType: "address",
|
|
2645
|
+
name: "token",
|
|
2646
|
+
type: "address"
|
|
2647
|
+
},
|
|
2648
|
+
{
|
|
2649
|
+
internalType: "uint256",
|
|
2650
|
+
name: "poolId",
|
|
2651
|
+
type: "uint256"
|
|
2652
|
+
}
|
|
2653
|
+
],
|
|
2654
|
+
name: "setSgPoolId",
|
|
2655
|
+
outputs: [],
|
|
2656
|
+
stateMutability: "nonpayable",
|
|
2657
|
+
type: "function"
|
|
2658
|
+
},
|
|
2659
|
+
{
|
|
2660
|
+
inputs: [
|
|
2661
|
+
{
|
|
2662
|
+
internalType: "address",
|
|
2663
|
+
name: "_sgRouter",
|
|
2664
|
+
type: "address"
|
|
2665
|
+
}
|
|
2666
|
+
],
|
|
2667
|
+
name: "setSgRouter",
|
|
2668
|
+
outputs: [],
|
|
2669
|
+
stateMutability: "nonpayable",
|
|
2670
|
+
type: "function"
|
|
2671
|
+
},
|
|
2672
|
+
{
|
|
2673
|
+
inputs: [
|
|
2674
|
+
{
|
|
2675
|
+
internalType: "uint16",
|
|
2676
|
+
name: "chainId",
|
|
2677
|
+
type: "uint16"
|
|
2678
|
+
},
|
|
2679
|
+
{
|
|
2680
|
+
internalType: "address",
|
|
2681
|
+
name: "woofiDexCrossChainRouter",
|
|
2682
|
+
type: "address"
|
|
2683
|
+
}
|
|
2684
|
+
],
|
|
2685
|
+
name: "setWOOFiDexCrossChainRouter",
|
|
2686
|
+
outputs: [],
|
|
2687
|
+
stateMutability: "nonpayable",
|
|
2688
|
+
type: "function"
|
|
2689
|
+
},
|
|
2690
|
+
{
|
|
2691
|
+
inputs: [
|
|
2692
|
+
{
|
|
2693
|
+
internalType: "uint16",
|
|
2694
|
+
name: "chainId",
|
|
2695
|
+
type: "uint16"
|
|
2696
|
+
},
|
|
2697
|
+
{
|
|
2698
|
+
internalType: "address",
|
|
2699
|
+
name: "token",
|
|
2700
|
+
type: "address"
|
|
2701
|
+
},
|
|
2702
|
+
{
|
|
2703
|
+
internalType: "address",
|
|
2704
|
+
name: "woofiDexVault",
|
|
2705
|
+
type: "address"
|
|
2706
|
+
}
|
|
2420
2707
|
],
|
|
2421
2708
|
name: "setWOOFiDexVault",
|
|
2422
2709
|
outputs: [],
|
|
@@ -2424,7 +2711,13 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2424
2711
|
type: "function"
|
|
2425
2712
|
},
|
|
2426
2713
|
{
|
|
2427
|
-
inputs: [
|
|
2714
|
+
inputs: [
|
|
2715
|
+
{
|
|
2716
|
+
internalType: "address",
|
|
2717
|
+
name: "_wooRouter",
|
|
2718
|
+
type: "address"
|
|
2719
|
+
}
|
|
2720
|
+
],
|
|
2428
2721
|
name: "setWooRouter",
|
|
2429
2722
|
outputs: [],
|
|
2430
2723
|
stateMutability: "nonpayable",
|
|
@@ -2433,35 +2726,91 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2433
2726
|
{
|
|
2434
2727
|
inputs: [],
|
|
2435
2728
|
name: "sgChainIdLocal",
|
|
2436
|
-
outputs: [
|
|
2729
|
+
outputs: [
|
|
2730
|
+
{
|
|
2731
|
+
internalType: "uint16",
|
|
2732
|
+
name: "",
|
|
2733
|
+
type: "uint16"
|
|
2734
|
+
}
|
|
2735
|
+
],
|
|
2437
2736
|
stateMutability: "view",
|
|
2438
2737
|
type: "function"
|
|
2439
2738
|
},
|
|
2440
2739
|
{
|
|
2441
|
-
inputs: [
|
|
2740
|
+
inputs: [
|
|
2741
|
+
{
|
|
2742
|
+
internalType: "uint16",
|
|
2743
|
+
name: "",
|
|
2744
|
+
type: "uint16"
|
|
2745
|
+
}
|
|
2746
|
+
],
|
|
2442
2747
|
name: "sgETHs",
|
|
2443
|
-
outputs: [
|
|
2748
|
+
outputs: [
|
|
2749
|
+
{
|
|
2750
|
+
internalType: "address",
|
|
2751
|
+
name: "",
|
|
2752
|
+
type: "address"
|
|
2753
|
+
}
|
|
2754
|
+
],
|
|
2444
2755
|
stateMutability: "view",
|
|
2445
2756
|
type: "function"
|
|
2446
2757
|
},
|
|
2447
2758
|
{
|
|
2448
2759
|
inputs: [
|
|
2449
|
-
{
|
|
2450
|
-
|
|
2760
|
+
{
|
|
2761
|
+
internalType: "uint16",
|
|
2762
|
+
name: "",
|
|
2763
|
+
type: "uint16"
|
|
2764
|
+
},
|
|
2765
|
+
{
|
|
2766
|
+
internalType: "address",
|
|
2767
|
+
name: "",
|
|
2768
|
+
type: "address"
|
|
2769
|
+
}
|
|
2451
2770
|
],
|
|
2452
2771
|
name: "sgPoolIds",
|
|
2453
|
-
outputs: [
|
|
2772
|
+
outputs: [
|
|
2773
|
+
{
|
|
2774
|
+
internalType: "uint256",
|
|
2775
|
+
name: "",
|
|
2776
|
+
type: "uint256"
|
|
2777
|
+
}
|
|
2778
|
+
],
|
|
2454
2779
|
stateMutability: "view",
|
|
2455
2780
|
type: "function"
|
|
2456
2781
|
},
|
|
2457
2782
|
{
|
|
2458
2783
|
inputs: [
|
|
2459
|
-
{
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
{
|
|
2784
|
+
{
|
|
2785
|
+
internalType: "uint16",
|
|
2786
|
+
name: "srcChainId",
|
|
2787
|
+
type: "uint16"
|
|
2788
|
+
},
|
|
2789
|
+
{
|
|
2790
|
+
internalType: "bytes",
|
|
2791
|
+
name: "",
|
|
2792
|
+
type: "bytes"
|
|
2793
|
+
},
|
|
2794
|
+
{
|
|
2795
|
+
internalType: "uint256",
|
|
2796
|
+
name: "",
|
|
2797
|
+
type: "uint256"
|
|
2798
|
+
},
|
|
2799
|
+
{
|
|
2800
|
+
internalType: "address",
|
|
2801
|
+
name: "bridgedToken",
|
|
2802
|
+
type: "address"
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
internalType: "uint256",
|
|
2806
|
+
name: "bridgedAmount",
|
|
2807
|
+
type: "uint256"
|
|
2808
|
+
},
|
|
2809
|
+
{
|
|
2810
|
+
internalType: "bytes",
|
|
2811
|
+
name: "payload",
|
|
2812
|
+
type: "bytes"
|
|
2813
|
+
}
|
|
2465
2814
|
],
|
|
2466
2815
|
name: "sgReceive",
|
|
2467
2816
|
outputs: [],
|
|
@@ -2470,15 +2819,25 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2470
2819
|
},
|
|
2471
2820
|
{
|
|
2472
2821
|
inputs: [],
|
|
2473
|
-
name: "
|
|
2822
|
+
name: "sgRouter",
|
|
2474
2823
|
outputs: [
|
|
2475
|
-
{
|
|
2824
|
+
{
|
|
2825
|
+
internalType: "address",
|
|
2826
|
+
name: "",
|
|
2827
|
+
type: "address"
|
|
2828
|
+
}
|
|
2476
2829
|
],
|
|
2477
2830
|
stateMutability: "view",
|
|
2478
2831
|
type: "function"
|
|
2479
2832
|
},
|
|
2480
2833
|
{
|
|
2481
|
-
inputs: [
|
|
2834
|
+
inputs: [
|
|
2835
|
+
{
|
|
2836
|
+
internalType: "address",
|
|
2837
|
+
name: "newOwner",
|
|
2838
|
+
type: "address"
|
|
2839
|
+
}
|
|
2840
|
+
],
|
|
2482
2841
|
name: "transferOwnership",
|
|
2483
2842
|
outputs: [],
|
|
2484
2843
|
stateMutability: "nonpayable",
|
|
@@ -2494,7 +2853,13 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2494
2853
|
{
|
|
2495
2854
|
inputs: [],
|
|
2496
2855
|
name: "weth",
|
|
2497
|
-
outputs: [
|
|
2856
|
+
outputs: [
|
|
2857
|
+
{
|
|
2858
|
+
internalType: "address",
|
|
2859
|
+
name: "",
|
|
2860
|
+
type: "address"
|
|
2861
|
+
}
|
|
2862
|
+
],
|
|
2498
2863
|
stateMutability: "view",
|
|
2499
2864
|
type: "function"
|
|
2500
2865
|
},
|
|
@@ -2502,29 +2867,62 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
2502
2867
|
inputs: [],
|
|
2503
2868
|
name: "wooRouter",
|
|
2504
2869
|
outputs: [
|
|
2505
|
-
{
|
|
2870
|
+
{
|
|
2871
|
+
internalType: "address",
|
|
2872
|
+
name: "",
|
|
2873
|
+
type: "address"
|
|
2874
|
+
}
|
|
2506
2875
|
],
|
|
2507
2876
|
stateMutability: "view",
|
|
2508
2877
|
type: "function"
|
|
2509
2878
|
},
|
|
2510
2879
|
{
|
|
2511
|
-
inputs: [
|
|
2880
|
+
inputs: [
|
|
2881
|
+
{
|
|
2882
|
+
internalType: "uint16",
|
|
2883
|
+
name: "",
|
|
2884
|
+
type: "uint16"
|
|
2885
|
+
}
|
|
2886
|
+
],
|
|
2512
2887
|
name: "woofiDexCrossChainRouters",
|
|
2513
|
-
outputs: [
|
|
2888
|
+
outputs: [
|
|
2889
|
+
{
|
|
2890
|
+
internalType: "address",
|
|
2891
|
+
name: "",
|
|
2892
|
+
type: "address"
|
|
2893
|
+
}
|
|
2894
|
+
],
|
|
2514
2895
|
stateMutability: "view",
|
|
2515
2896
|
type: "function"
|
|
2516
2897
|
},
|
|
2517
2898
|
{
|
|
2518
2899
|
inputs: [
|
|
2519
|
-
{
|
|
2520
|
-
|
|
2900
|
+
{
|
|
2901
|
+
internalType: "uint16",
|
|
2902
|
+
name: "",
|
|
2903
|
+
type: "uint16"
|
|
2904
|
+
},
|
|
2905
|
+
{
|
|
2906
|
+
internalType: "address",
|
|
2907
|
+
name: "",
|
|
2908
|
+
type: "address"
|
|
2909
|
+
}
|
|
2521
2910
|
],
|
|
2522
2911
|
name: "woofiDexVaults",
|
|
2523
|
-
outputs: [
|
|
2912
|
+
outputs: [
|
|
2913
|
+
{
|
|
2914
|
+
internalType: "address",
|
|
2915
|
+
name: "",
|
|
2916
|
+
type: "address"
|
|
2917
|
+
}
|
|
2918
|
+
],
|
|
2524
2919
|
stateMutability: "view",
|
|
2525
2920
|
type: "function"
|
|
2526
2921
|
},
|
|
2527
|
-
{
|
|
2922
|
+
{
|
|
2923
|
+
stateMutability: "payable",
|
|
2924
|
+
type: "receive"
|
|
2925
|
+
}
|
|
2528
2926
|
];
|
|
2529
2927
|
var nativeTokenAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
2530
2928
|
|
|
@@ -2544,6 +2942,10 @@ var useChains = (networkId, options = {}) => {
|
|
|
2544
2942
|
revalidateIfStale: false,
|
|
2545
2943
|
revalidateOnFocus: false,
|
|
2546
2944
|
revalidateOnReconnect: false,
|
|
2945
|
+
revalidateOnMount: true,
|
|
2946
|
+
// If false, undefined data gets cached against the key.
|
|
2947
|
+
dedupingInterval: 36e5,
|
|
2948
|
+
// dont duplicate a request w/ same key for 1hr
|
|
2547
2949
|
...swrOptions
|
|
2548
2950
|
}
|
|
2549
2951
|
);
|
|
@@ -2552,7 +2954,9 @@ var useChains = (networkId, options = {}) => {
|
|
|
2552
2954
|
{
|
|
2553
2955
|
revalidateIfStale: false,
|
|
2554
2956
|
revalidateOnFocus: false,
|
|
2555
|
-
revalidateOnReconnect: false
|
|
2957
|
+
revalidateOnReconnect: false,
|
|
2958
|
+
revalidateOnMount: true,
|
|
2959
|
+
dedupingInterval: 36e5
|
|
2556
2960
|
}
|
|
2557
2961
|
);
|
|
2558
2962
|
const chains = React2.useMemo(() => {
|
|
@@ -2569,6 +2973,7 @@ var useChains = (networkId, options = {}) => {
|
|
|
2569
2973
|
name: chain.chain_name ?? "--",
|
|
2570
2974
|
// "public_rpc_url": "https://arb1.arbitrum.io/rpc",
|
|
2571
2975
|
chain_id: chainId,
|
|
2976
|
+
withdrawal_fee: chain.withdrawal_fee,
|
|
2572
2977
|
bridgeless: true
|
|
2573
2978
|
},
|
|
2574
2979
|
token_infos: [
|
|
@@ -2588,35 +2993,46 @@ var useChains = (networkId, options = {}) => {
|
|
|
2588
2993
|
});
|
|
2589
2994
|
});
|
|
2590
2995
|
if (!wooSwapEnabled) {
|
|
2591
|
-
|
|
2996
|
+
let arr = orderlyChainsArr;
|
|
2997
|
+
if (typeof options?.filter === "function") {
|
|
2998
|
+
arr = orderlyChainsArr.filter(options.filter);
|
|
2999
|
+
}
|
|
3000
|
+
if (!!field) {
|
|
3001
|
+
arr = arr.map((item) => item[field]);
|
|
3002
|
+
}
|
|
3003
|
+
return arr;
|
|
2592
3004
|
} else {
|
|
2593
3005
|
if (!data || !data.data)
|
|
2594
3006
|
return data;
|
|
2595
|
-
let testnetArr = [
|
|
3007
|
+
let testnetArr = [
|
|
3008
|
+
//@ts-ignore
|
|
3009
|
+
{
|
|
3010
|
+
network_infos: {
|
|
3011
|
+
name: "Arbitrum Goerli",
|
|
3012
|
+
public_rpc_url: "https://goerli-rollup.arbitrum.io/rpc",
|
|
3013
|
+
chain_id: 421613,
|
|
3014
|
+
currency_symbol: "ETH",
|
|
3015
|
+
bridge_enable: true,
|
|
3016
|
+
mainnet: false,
|
|
3017
|
+
explorer_base_url: "https://goerli.arbiscan.io/",
|
|
3018
|
+
est_txn_mins: null,
|
|
3019
|
+
woofi_dex_cross_chain_router: "",
|
|
3020
|
+
woofi_dex_depositor: ""
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
];
|
|
2596
3024
|
let mainnetArr = [];
|
|
2597
3025
|
Object.keys(data.data).forEach((key) => {
|
|
2598
3026
|
const chain = data.data[key];
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
token_infos: chain.token_infos
|
|
2609
|
-
};
|
|
2610
|
-
map.current.set(chain.network_infos.chain_id, mergedChain);
|
|
2611
|
-
}
|
|
2612
|
-
return item2;
|
|
2613
|
-
});
|
|
2614
|
-
return;
|
|
2615
|
-
}
|
|
2616
|
-
const item = {
|
|
2617
|
-
...chain,
|
|
2618
|
-
name: key
|
|
2619
|
-
};
|
|
3027
|
+
const item = ramda.mergeDeepRight(chain, {
|
|
3028
|
+
name: key,
|
|
3029
|
+
network_infos: {
|
|
3030
|
+
bridgeless: orderlyChainIds.has(chain.network_infos.chain_id)
|
|
3031
|
+
},
|
|
3032
|
+
token_infos: chain.token_infos.filter(
|
|
3033
|
+
(token) => !!token.swap_enable
|
|
3034
|
+
)
|
|
3035
|
+
});
|
|
2620
3036
|
if (item.token_infos?.length === 0)
|
|
2621
3037
|
return;
|
|
2622
3038
|
map.current.set(item.network_infos.chain_id, item);
|
|
@@ -2630,13 +3046,12 @@ var useChains = (networkId, options = {}) => {
|
|
|
2630
3046
|
testnetArr.push(item);
|
|
2631
3047
|
}
|
|
2632
3048
|
});
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
}
|
|
3049
|
+
mainnetArr.sort((a, b) => {
|
|
3050
|
+
return a.network_infos.bridgeless ? -1 : 1;
|
|
3051
|
+
});
|
|
3052
|
+
testnetArr.sort((a, b) => {
|
|
3053
|
+
return a.network_infos.bridgeless ? -1 : 1;
|
|
3054
|
+
});
|
|
2640
3055
|
if (!!field) {
|
|
2641
3056
|
testnetArr = testnetArr.map((item) => item[field]);
|
|
2642
3057
|
mainnetArr = mainnetArr.map((item) => item[field]);
|
|
@@ -2722,19 +3137,28 @@ var useWithdraw = () => {
|
|
|
2722
3137
|
};
|
|
2723
3138
|
var isNativeTokenChecker = (address) => address === nativeTokenAddress;
|
|
2724
3139
|
var useDeposit = (options) => {
|
|
3140
|
+
const { onlyTestnet } = React2.useContext(OrderlyContext);
|
|
2725
3141
|
const [balanceRevalidating, setBalanceRevalidating] = React2.useState(false);
|
|
2726
3142
|
const [allowanceRevalidating, setAllowanceRevalidating] = React2.useState(false);
|
|
3143
|
+
const [_, { findByChainId }] = useChains(void 0, {
|
|
3144
|
+
wooSwapEnabled: true
|
|
3145
|
+
});
|
|
2727
3146
|
const [balance, setBalance] = React2.useState("0");
|
|
2728
3147
|
const [allowance, setAllowance] = React2.useState("0");
|
|
2729
3148
|
const { account: account5, state } = useAccount();
|
|
2730
3149
|
const dst = React2.useMemo(() => {
|
|
3150
|
+
const chain = onlyTestnet ? findByChainId(types.ARBITRUM_TESTNET_CHAINID) : findByChainId(types.ARBITRUM_MAINNET_CHAINID);
|
|
3151
|
+
const USDC = chain?.token_infos.find((token) => token.symbol === "USDC");
|
|
3152
|
+
if (!chain) {
|
|
3153
|
+
throw new Error("dst chain not found");
|
|
3154
|
+
}
|
|
2731
3155
|
return {
|
|
2732
3156
|
symbol: "USDC",
|
|
2733
|
-
address:
|
|
2734
|
-
decimals:
|
|
2735
|
-
|
|
2736
|
-
network:
|
|
2737
|
-
chainId: 42161
|
|
3157
|
+
address: USDC?.address,
|
|
3158
|
+
decimals: USDC?.decimals,
|
|
3159
|
+
chainId: chain.network_infos.chain_id,
|
|
3160
|
+
network: chain.network_infos.name
|
|
3161
|
+
// chainId: 42161,
|
|
2738
3162
|
};
|
|
2739
3163
|
}, []);
|
|
2740
3164
|
const isNativeToken = React2.useMemo(
|
|
@@ -2787,8 +3211,9 @@ var useDeposit = (options) => {
|
|
|
2787
3211
|
const balances = await Promise.all(tasks);
|
|
2788
3212
|
console.log("----- get balances from tokens -----", balances);
|
|
2789
3213
|
}, []);
|
|
2790
|
-
const
|
|
2791
|
-
async (address) => {
|
|
3214
|
+
const getAllowance = React2.useCallback(
|
|
3215
|
+
async (address, vaultAddress) => {
|
|
3216
|
+
console.log("getAllowance", address, vaultAddress);
|
|
2792
3217
|
if (!address)
|
|
2793
3218
|
return;
|
|
2794
3219
|
if (address && isNativeTokenChecker(address))
|
|
@@ -2796,7 +3221,10 @@ var useDeposit = (options) => {
|
|
|
2796
3221
|
if (allowanceRevalidating)
|
|
2797
3222
|
return;
|
|
2798
3223
|
setAllowanceRevalidating(true);
|
|
2799
|
-
const allowance2 = await account5.assetsManager.getAllowance(
|
|
3224
|
+
const allowance2 = await account5.assetsManager.getAllowance(
|
|
3225
|
+
address,
|
|
3226
|
+
vaultAddress
|
|
3227
|
+
);
|
|
2800
3228
|
console.log("----- refresh allowance -----", allowance2);
|
|
2801
3229
|
setAllowance(() => allowance2);
|
|
2802
3230
|
setAllowanceRevalidating(false);
|
|
@@ -2805,25 +3233,24 @@ var useDeposit = (options) => {
|
|
|
2805
3233
|
[allowanceRevalidating]
|
|
2806
3234
|
);
|
|
2807
3235
|
React2.useEffect(() => {
|
|
2808
|
-
|
|
2809
|
-
if (state.status < types.AccountStatusEnum.EnableTrading)
|
|
3236
|
+
if (state.status < types.AccountStatusEnum.Connected)
|
|
2810
3237
|
return;
|
|
2811
3238
|
fetchBalance(options?.address);
|
|
2812
|
-
|
|
2813
|
-
}, [state.status, options?.address]);
|
|
3239
|
+
getAllowance(options?.address, options?.vaultAddress);
|
|
3240
|
+
}, [state.status, options?.address, options?.vaultAddress, account5.address]);
|
|
2814
3241
|
const approve = React2.useCallback(
|
|
2815
3242
|
(amount) => {
|
|
2816
3243
|
if (!options?.address) {
|
|
2817
3244
|
throw new Error("address is required");
|
|
2818
3245
|
}
|
|
2819
|
-
return account5.assetsManager.approve(options.address, amount).then((result) => {
|
|
3246
|
+
return account5.assetsManager.approve(options.address, amount, options?.vaultAddress).then((result) => {
|
|
2820
3247
|
if (typeof amount !== "undefined") {
|
|
2821
3248
|
setAllowance((value) => new utils.Decimal(value).add(amount).toString());
|
|
2822
3249
|
}
|
|
2823
3250
|
return result;
|
|
2824
3251
|
});
|
|
2825
3252
|
},
|
|
2826
|
-
[account5,
|
|
3253
|
+
[account5, getAllowance, options?.address, options?.vaultAddress]
|
|
2827
3254
|
);
|
|
2828
3255
|
const deposit = React2.useCallback(
|
|
2829
3256
|
(amount) => {
|
|
@@ -2833,7 +3260,7 @@ var useDeposit = (options) => {
|
|
|
2833
3260
|
return res;
|
|
2834
3261
|
});
|
|
2835
3262
|
},
|
|
2836
|
-
[account5, fetchBalance,
|
|
3263
|
+
[account5, fetchBalance, getAllowance]
|
|
2837
3264
|
);
|
|
2838
3265
|
return {
|
|
2839
3266
|
dst,
|
|
@@ -3069,12 +3496,12 @@ var useWooCrossSwapQuery = () => {
|
|
|
3069
3496
|
};
|
|
3070
3497
|
}, [account5]);
|
|
3071
3498
|
const queryDestinationFee = React2.useCallback(
|
|
3072
|
-
async (dst) => {
|
|
3499
|
+
async (crossChainRouteAddress, dst) => {
|
|
3073
3500
|
if (!account5.walletClient) {
|
|
3074
3501
|
throw new Error("walletClient is not ready");
|
|
3075
3502
|
}
|
|
3076
3503
|
const quotoLZFee = await account5.walletClient.call(
|
|
3077
|
-
|
|
3504
|
+
crossChainRouteAddress,
|
|
3078
3505
|
"quoteLayerZeroFee",
|
|
3079
3506
|
[account5.address, dst, dstValutDeposit()],
|
|
3080
3507
|
{
|
|
@@ -3120,12 +3547,12 @@ var useWooCrossSwapQuery = () => {
|
|
|
3120
3547
|
}
|
|
3121
3548
|
throw new Error(data.message);
|
|
3122
3549
|
}).then((swapInfo) => {
|
|
3123
|
-
return queryDestinationFee({
|
|
3550
|
+
return queryDestinationFee(inputs.crossChainRouteAddress, {
|
|
3124
3551
|
chainId: swapInfo.dst_infos.chain_id,
|
|
3125
3552
|
bridgedToken: swapInfo.dst_infos.bridged_token,
|
|
3126
3553
|
toToken: swapInfo.dst_infos.to_token,
|
|
3127
3554
|
minToAmount: BigInt(swapInfo.dst_infos.min_to_amount),
|
|
3128
|
-
|
|
3555
|
+
orderlyNativeFees: 0n
|
|
3129
3556
|
}).then((data) => {
|
|
3130
3557
|
console.log("res::::", data);
|
|
3131
3558
|
return {
|
|
@@ -3196,45 +3623,54 @@ var useCrossSwap = () => {
|
|
|
3196
3623
|
if (!account5.walletClient) {
|
|
3197
3624
|
throw new Error("walletClient is undefined");
|
|
3198
3625
|
}
|
|
3199
|
-
|
|
3626
|
+
if (!account5.address) {
|
|
3627
|
+
throw new Error("account.address is undefined");
|
|
3628
|
+
}
|
|
3629
|
+
if (!inputs.crossChainRouteAddress) {
|
|
3630
|
+
throw new Error("crossChainRouteAddress is undefined");
|
|
3631
|
+
}
|
|
3632
|
+
const { address, src, dst, crossChainRouteAddress } = inputs;
|
|
3200
3633
|
if (loading)
|
|
3201
3634
|
return;
|
|
3202
3635
|
start();
|
|
3203
3636
|
const quotoLZFee = await account5.walletClient.call(
|
|
3204
|
-
|
|
3637
|
+
crossChainRouteAddress,
|
|
3205
3638
|
"quoteLayerZeroFee",
|
|
3206
3639
|
[account5.address, dst, dstValutDeposit()],
|
|
3207
3640
|
{
|
|
3208
3641
|
abi: woofiDexCrossChainRouterAbi
|
|
3209
3642
|
}
|
|
3210
3643
|
);
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
account5.address,
|
|
3216
|
-
src,
|
|
3217
|
-
dst,
|
|
3218
|
-
dstValutDeposit(),
|
|
3644
|
+
try {
|
|
3645
|
+
const result = await account5.walletClient.sendTransaction(
|
|
3646
|
+
crossChainRouteAddress,
|
|
3647
|
+
"crossSwap",
|
|
3219
3648
|
{
|
|
3649
|
+
from: account5.address,
|
|
3650
|
+
to: crossChainRouteAddress,
|
|
3651
|
+
data: [account5.address, src, dst, dstValutDeposit()],
|
|
3220
3652
|
value: quotoLZFee[0]
|
|
3653
|
+
},
|
|
3654
|
+
{
|
|
3655
|
+
abi: woofiDexCrossChainRouterAbi
|
|
3221
3656
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
(
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
)
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3657
|
+
);
|
|
3658
|
+
account5.walletClient.on(
|
|
3659
|
+
{
|
|
3660
|
+
address: crossChainRouteAddress
|
|
3661
|
+
},
|
|
3662
|
+
(log, event) => {
|
|
3663
|
+
console.log("-------------", log, event);
|
|
3664
|
+
}
|
|
3665
|
+
);
|
|
3666
|
+
stop();
|
|
3667
|
+
checkLayerStatus(result.hash);
|
|
3668
|
+
return ramda.pick(["from", "to", "hash", "value"], result);
|
|
3669
|
+
} catch (e) {
|
|
3670
|
+
console.log("swap error:", e);
|
|
3671
|
+
stop();
|
|
3672
|
+
throw new Error(e.errorCode);
|
|
3673
|
+
}
|
|
3238
3674
|
};
|
|
3239
3675
|
return {
|
|
3240
3676
|
swap,
|
|
@@ -3243,15 +3679,15 @@ var useCrossSwap = () => {
|
|
|
3243
3679
|
message: bridgeMessage
|
|
3244
3680
|
};
|
|
3245
3681
|
};
|
|
3246
|
-
var woofiDexDepositor = "0xfD7ed9D3d4fD88595AF6a87f798ffDB42b4D7ccB";
|
|
3247
3682
|
var woofiDexDepositorAbi = [
|
|
3683
|
+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
3248
3684
|
{
|
|
3685
|
+
anonymous: false,
|
|
3249
3686
|
inputs: [
|
|
3250
|
-
{ internalType: "
|
|
3251
|
-
{ internalType: "address", name: "_wooRouter", type: "address" }
|
|
3687
|
+
{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }
|
|
3252
3688
|
],
|
|
3253
|
-
|
|
3254
|
-
type: "
|
|
3689
|
+
name: "Initialized",
|
|
3690
|
+
type: "event"
|
|
3255
3691
|
},
|
|
3256
3692
|
{
|
|
3257
3693
|
anonymous: false,
|
|
@@ -3338,6 +3774,12 @@ var woofiDexDepositorAbi = [
|
|
|
3338
3774
|
name: "toAmount",
|
|
3339
3775
|
type: "uint256"
|
|
3340
3776
|
},
|
|
3777
|
+
{
|
|
3778
|
+
indexed: false,
|
|
3779
|
+
internalType: "uint256",
|
|
3780
|
+
name: "orderlyNativeFees",
|
|
3781
|
+
type: "uint256"
|
|
3782
|
+
},
|
|
3341
3783
|
{
|
|
3342
3784
|
indexed: false,
|
|
3343
3785
|
internalType: "bytes32",
|
|
@@ -3380,6 +3822,20 @@ var woofiDexDepositorAbi = [
|
|
|
3380
3822
|
stateMutability: "nonpayable",
|
|
3381
3823
|
type: "function"
|
|
3382
3824
|
},
|
|
3825
|
+
{
|
|
3826
|
+
inputs: [{ internalType: "address", name: "_wooRouter", type: "address" }],
|
|
3827
|
+
name: "initialize",
|
|
3828
|
+
outputs: [],
|
|
3829
|
+
stateMutability: "nonpayable",
|
|
3830
|
+
type: "function"
|
|
3831
|
+
},
|
|
3832
|
+
{
|
|
3833
|
+
inputs: [],
|
|
3834
|
+
name: "orderlyFeeToggle",
|
|
3835
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
3836
|
+
stateMutability: "view",
|
|
3837
|
+
type: "function"
|
|
3838
|
+
},
|
|
3383
3839
|
{
|
|
3384
3840
|
inputs: [],
|
|
3385
3841
|
name: "owner",
|
|
@@ -3408,6 +3864,13 @@ var woofiDexDepositorAbi = [
|
|
|
3408
3864
|
stateMutability: "nonpayable",
|
|
3409
3865
|
type: "function"
|
|
3410
3866
|
},
|
|
3867
|
+
{
|
|
3868
|
+
inputs: [{ internalType: "bool", name: "_orderlyFeeToggle", type: "bool" }],
|
|
3869
|
+
name: "setOrderlyFeeToggle",
|
|
3870
|
+
outputs: [],
|
|
3871
|
+
stateMutability: "nonpayable",
|
|
3872
|
+
type: "function"
|
|
3873
|
+
},
|
|
3411
3874
|
{
|
|
3412
3875
|
inputs: [
|
|
3413
3876
|
{ internalType: "address", name: "token", type: "address" },
|
|
@@ -3433,9 +3896,14 @@ var woofiDexDepositorAbi = [
|
|
|
3433
3896
|
{ internalType: "address", name: "fromToken", type: "address" },
|
|
3434
3897
|
{ internalType: "uint256", name: "fromAmount", type: "uint256" },
|
|
3435
3898
|
{ internalType: "address", name: "toToken", type: "address" },
|
|
3436
|
-
{ internalType: "uint256", name: "minToAmount", type: "uint256" }
|
|
3899
|
+
{ internalType: "uint256", name: "minToAmount", type: "uint256" },
|
|
3900
|
+
{
|
|
3901
|
+
internalType: "uint256",
|
|
3902
|
+
name: "orderlyNativeFees",
|
|
3903
|
+
type: "uint256"
|
|
3904
|
+
}
|
|
3437
3905
|
],
|
|
3438
|
-
internalType: "struct
|
|
3906
|
+
internalType: "struct IWOOFiDexDepositor.Infos",
|
|
3439
3907
|
name: "infos",
|
|
3440
3908
|
type: "tuple"
|
|
3441
3909
|
},
|
|
@@ -3445,7 +3913,7 @@ var woofiDexDepositorAbi = [
|
|
|
3445
3913
|
{ internalType: "bytes32", name: "brokerHash", type: "bytes32" },
|
|
3446
3914
|
{ internalType: "bytes32", name: "tokenHash", type: "bytes32" }
|
|
3447
3915
|
],
|
|
3448
|
-
internalType: "struct
|
|
3916
|
+
internalType: "struct IWOOFiDexDepositor.VaultDeposit",
|
|
3449
3917
|
name: "vaultDeposit",
|
|
3450
3918
|
type: "tuple"
|
|
3451
3919
|
}
|
|
@@ -3469,19 +3937,10 @@ var woofiDexDepositorAbi = [
|
|
|
3469
3937
|
stateMutability: "nonpayable",
|
|
3470
3938
|
type: "function"
|
|
3471
3939
|
},
|
|
3472
|
-
{
|
|
3473
|
-
inputs: [],
|
|
3474
|
-
name: "weth",
|
|
3475
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
3476
|
-
stateMutability: "view",
|
|
3477
|
-
type: "function"
|
|
3478
|
-
},
|
|
3479
3940
|
{
|
|
3480
3941
|
inputs: [],
|
|
3481
3942
|
name: "wooRouter",
|
|
3482
|
-
outputs: [
|
|
3483
|
-
{ internalType: "contract IWooRouterV2", name: "", type: "address" }
|
|
3484
|
-
],
|
|
3943
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
3485
3944
|
stateMutability: "view",
|
|
3486
3945
|
type: "function"
|
|
3487
3946
|
},
|
|
@@ -3506,21 +3965,36 @@ var useSwap = () => {
|
|
|
3506
3965
|
};
|
|
3507
3966
|
}, [account5]);
|
|
3508
3967
|
const swap = React2.useCallback(
|
|
3509
|
-
async (inputs) => {
|
|
3968
|
+
async (woofiDexDepositorAdress, inputs) => {
|
|
3969
|
+
if (!account5.walletClient) {
|
|
3970
|
+
throw new Error("walletClient is undefined");
|
|
3971
|
+
}
|
|
3972
|
+
if (!account5.address) {
|
|
3973
|
+
throw new Error("account.address is undefined");
|
|
3974
|
+
}
|
|
3510
3975
|
if (loading)
|
|
3511
3976
|
return;
|
|
3512
3977
|
start();
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3978
|
+
console.log("---------", inputs);
|
|
3979
|
+
try {
|
|
3980
|
+
const result = await account5.walletClient.sendTransaction(
|
|
3981
|
+
woofiDexDepositorAdress,
|
|
3982
|
+
"swap",
|
|
3983
|
+
{
|
|
3984
|
+
from: account5.address,
|
|
3985
|
+
to: woofiDexDepositorAdress,
|
|
3986
|
+
data: [account5.address, inputs, dstValutDeposit()]
|
|
3987
|
+
},
|
|
3988
|
+
{
|
|
3989
|
+
abi: woofiDexDepositorAbi
|
|
3990
|
+
}
|
|
3991
|
+
);
|
|
3992
|
+
stop();
|
|
3993
|
+
return ramda.pick(["from", "to", "hash", "value"], result);
|
|
3994
|
+
} catch (e) {
|
|
3995
|
+
console.log("\u8C03\u7528\u5408\u7EA6\u62A5\u9519\uFF1A", e);
|
|
3996
|
+
throw new Error(e.errorCode);
|
|
3997
|
+
}
|
|
3524
3998
|
},
|
|
3525
3999
|
[loading, account5]
|
|
3526
4000
|
);
|
|
@@ -3580,7 +4054,6 @@ exports.useOrderbookStream = useOrderbookStream;
|
|
|
3580
4054
|
exports.usePositionStream = usePositionStream;
|
|
3581
4055
|
exports.usePreLoadData = usePreLoadData;
|
|
3582
4056
|
exports.usePrivateDataObserver = usePrivateDataObserver;
|
|
3583
|
-
exports.usePrivateObserve = usePrivateObserve;
|
|
3584
4057
|
exports.usePrivateQuery = usePrivateQuery;
|
|
3585
4058
|
exports.useQuery = useQuery;
|
|
3586
4059
|
exports.useRunOnce = useRunOnce;
|