@orderly.network/hooks 0.0.61 → 0.0.62
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 +690 -218
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +693 -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(() => {
|
|
@@ -2588,35 +2992,46 @@ var useChains = (networkId, options = {}) => {
|
|
|
2588
2992
|
});
|
|
2589
2993
|
});
|
|
2590
2994
|
if (!wooSwapEnabled) {
|
|
2591
|
-
|
|
2995
|
+
let arr = orderlyChainsArr;
|
|
2996
|
+
if (typeof options?.filter === "function") {
|
|
2997
|
+
arr = orderlyChainsArr.filter(options.filter);
|
|
2998
|
+
}
|
|
2999
|
+
if (!!field) {
|
|
3000
|
+
arr = arr.map((item) => item[field]);
|
|
3001
|
+
}
|
|
3002
|
+
return arr;
|
|
2592
3003
|
} else {
|
|
2593
3004
|
if (!data || !data.data)
|
|
2594
3005
|
return data;
|
|
2595
|
-
let testnetArr = [
|
|
3006
|
+
let testnetArr = [
|
|
3007
|
+
//@ts-ignore
|
|
3008
|
+
{
|
|
3009
|
+
network_infos: {
|
|
3010
|
+
name: "Arbitrum Goerli",
|
|
3011
|
+
public_rpc_url: "https://goerli-rollup.arbitrum.io/rpc",
|
|
3012
|
+
chain_id: 421613,
|
|
3013
|
+
currency_symbol: "ETH",
|
|
3014
|
+
bridge_enable: true,
|
|
3015
|
+
mainnet: false,
|
|
3016
|
+
explorer_base_url: "https://goerli.arbiscan.io/",
|
|
3017
|
+
est_txn_mins: null,
|
|
3018
|
+
woofi_dex_cross_chain_router: "",
|
|
3019
|
+
woofi_dex_depositor: ""
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
];
|
|
2596
3023
|
let mainnetArr = [];
|
|
2597
3024
|
Object.keys(data.data).forEach((key) => {
|
|
2598
3025
|
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
|
-
};
|
|
3026
|
+
const item = ramda.mergeDeepRight(chain, {
|
|
3027
|
+
name: key,
|
|
3028
|
+
network_infos: {
|
|
3029
|
+
bridgeless: orderlyChainIds.has(chain.network_infos.chain_id)
|
|
3030
|
+
},
|
|
3031
|
+
token_infos: chain.token_infos.filter(
|
|
3032
|
+
(token) => !!token.swap_enable
|
|
3033
|
+
)
|
|
3034
|
+
});
|
|
2620
3035
|
if (item.token_infos?.length === 0)
|
|
2621
3036
|
return;
|
|
2622
3037
|
map.current.set(item.network_infos.chain_id, item);
|
|
@@ -2630,13 +3045,12 @@ var useChains = (networkId, options = {}) => {
|
|
|
2630
3045
|
testnetArr.push(item);
|
|
2631
3046
|
}
|
|
2632
3047
|
});
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
}
|
|
3048
|
+
mainnetArr.sort((a, b) => {
|
|
3049
|
+
return a.network_infos.bridgeless ? -1 : 1;
|
|
3050
|
+
});
|
|
3051
|
+
testnetArr.sort((a, b) => {
|
|
3052
|
+
return a.network_infos.bridgeless ? -1 : 1;
|
|
3053
|
+
});
|
|
2640
3054
|
if (!!field) {
|
|
2641
3055
|
testnetArr = testnetArr.map((item) => item[field]);
|
|
2642
3056
|
mainnetArr = mainnetArr.map((item) => item[field]);
|
|
@@ -2722,19 +3136,28 @@ var useWithdraw = () => {
|
|
|
2722
3136
|
};
|
|
2723
3137
|
var isNativeTokenChecker = (address) => address === nativeTokenAddress;
|
|
2724
3138
|
var useDeposit = (options) => {
|
|
3139
|
+
const { onlyTestnet } = React2.useContext(OrderlyContext);
|
|
2725
3140
|
const [balanceRevalidating, setBalanceRevalidating] = React2.useState(false);
|
|
2726
3141
|
const [allowanceRevalidating, setAllowanceRevalidating] = React2.useState(false);
|
|
3142
|
+
const [_, { findByChainId }] = useChains(void 0, {
|
|
3143
|
+
wooSwapEnabled: true
|
|
3144
|
+
});
|
|
2727
3145
|
const [balance, setBalance] = React2.useState("0");
|
|
2728
3146
|
const [allowance, setAllowance] = React2.useState("0");
|
|
2729
3147
|
const { account: account5, state } = useAccount();
|
|
2730
3148
|
const dst = React2.useMemo(() => {
|
|
3149
|
+
const chain = onlyTestnet ? findByChainId(types.ARBITRUM_TESTNET_CHAINID) : findByChainId(types.ARBITRUM_MAINNET_CHAINID);
|
|
3150
|
+
const USDC = chain?.token_infos.find((token) => token.symbol === "USDC");
|
|
3151
|
+
if (!chain) {
|
|
3152
|
+
throw new Error("dst chain not found");
|
|
3153
|
+
}
|
|
2731
3154
|
return {
|
|
2732
3155
|
symbol: "USDC",
|
|
2733
|
-
address:
|
|
2734
|
-
decimals:
|
|
2735
|
-
|
|
2736
|
-
network:
|
|
2737
|
-
chainId: 42161
|
|
3156
|
+
address: USDC?.address,
|
|
3157
|
+
decimals: USDC?.decimals,
|
|
3158
|
+
chainId: chain.network_infos.chain_id,
|
|
3159
|
+
network: chain.network_infos.name
|
|
3160
|
+
// chainId: 42161,
|
|
2738
3161
|
};
|
|
2739
3162
|
}, []);
|
|
2740
3163
|
const isNativeToken = React2.useMemo(
|
|
@@ -2787,8 +3210,9 @@ var useDeposit = (options) => {
|
|
|
2787
3210
|
const balances = await Promise.all(tasks);
|
|
2788
3211
|
console.log("----- get balances from tokens -----", balances);
|
|
2789
3212
|
}, []);
|
|
2790
|
-
const
|
|
2791
|
-
async (address) => {
|
|
3213
|
+
const getAllowance = React2.useCallback(
|
|
3214
|
+
async (address, vaultAddress) => {
|
|
3215
|
+
console.log("getAllowance", address, vaultAddress);
|
|
2792
3216
|
if (!address)
|
|
2793
3217
|
return;
|
|
2794
3218
|
if (address && isNativeTokenChecker(address))
|
|
@@ -2796,7 +3220,10 @@ var useDeposit = (options) => {
|
|
|
2796
3220
|
if (allowanceRevalidating)
|
|
2797
3221
|
return;
|
|
2798
3222
|
setAllowanceRevalidating(true);
|
|
2799
|
-
const allowance2 = await account5.assetsManager.getAllowance(
|
|
3223
|
+
const allowance2 = await account5.assetsManager.getAllowance(
|
|
3224
|
+
address,
|
|
3225
|
+
vaultAddress
|
|
3226
|
+
);
|
|
2800
3227
|
console.log("----- refresh allowance -----", allowance2);
|
|
2801
3228
|
setAllowance(() => allowance2);
|
|
2802
3229
|
setAllowanceRevalidating(false);
|
|
@@ -2805,25 +3232,24 @@ var useDeposit = (options) => {
|
|
|
2805
3232
|
[allowanceRevalidating]
|
|
2806
3233
|
);
|
|
2807
3234
|
React2.useEffect(() => {
|
|
2808
|
-
|
|
2809
|
-
if (state.status < types.AccountStatusEnum.EnableTrading)
|
|
3235
|
+
if (state.status < types.AccountStatusEnum.Connected)
|
|
2810
3236
|
return;
|
|
2811
3237
|
fetchBalance(options?.address);
|
|
2812
|
-
|
|
2813
|
-
}, [state.status, options?.address]);
|
|
3238
|
+
getAllowance(options?.address, options?.vaultAddress);
|
|
3239
|
+
}, [state.status, options?.address, options?.vaultAddress, account5.address]);
|
|
2814
3240
|
const approve = React2.useCallback(
|
|
2815
3241
|
(amount) => {
|
|
2816
3242
|
if (!options?.address) {
|
|
2817
3243
|
throw new Error("address is required");
|
|
2818
3244
|
}
|
|
2819
|
-
return account5.assetsManager.approve(options.address, amount).then((result) => {
|
|
3245
|
+
return account5.assetsManager.approve(options.address, amount, options?.vaultAddress).then((result) => {
|
|
2820
3246
|
if (typeof amount !== "undefined") {
|
|
2821
3247
|
setAllowance((value) => new utils.Decimal(value).add(amount).toString());
|
|
2822
3248
|
}
|
|
2823
3249
|
return result;
|
|
2824
3250
|
});
|
|
2825
3251
|
},
|
|
2826
|
-
[account5,
|
|
3252
|
+
[account5, getAllowance, options?.address, options?.vaultAddress]
|
|
2827
3253
|
);
|
|
2828
3254
|
const deposit = React2.useCallback(
|
|
2829
3255
|
(amount) => {
|
|
@@ -2833,7 +3259,7 @@ var useDeposit = (options) => {
|
|
|
2833
3259
|
return res;
|
|
2834
3260
|
});
|
|
2835
3261
|
},
|
|
2836
|
-
[account5, fetchBalance,
|
|
3262
|
+
[account5, fetchBalance, getAllowance]
|
|
2837
3263
|
);
|
|
2838
3264
|
return {
|
|
2839
3265
|
dst,
|
|
@@ -3069,12 +3495,12 @@ var useWooCrossSwapQuery = () => {
|
|
|
3069
3495
|
};
|
|
3070
3496
|
}, [account5]);
|
|
3071
3497
|
const queryDestinationFee = React2.useCallback(
|
|
3072
|
-
async (dst) => {
|
|
3498
|
+
async (crossChainRouteAddress, dst) => {
|
|
3073
3499
|
if (!account5.walletClient) {
|
|
3074
3500
|
throw new Error("walletClient is not ready");
|
|
3075
3501
|
}
|
|
3076
3502
|
const quotoLZFee = await account5.walletClient.call(
|
|
3077
|
-
|
|
3503
|
+
crossChainRouteAddress,
|
|
3078
3504
|
"quoteLayerZeroFee",
|
|
3079
3505
|
[account5.address, dst, dstValutDeposit()],
|
|
3080
3506
|
{
|
|
@@ -3120,12 +3546,12 @@ var useWooCrossSwapQuery = () => {
|
|
|
3120
3546
|
}
|
|
3121
3547
|
throw new Error(data.message);
|
|
3122
3548
|
}).then((swapInfo) => {
|
|
3123
|
-
return queryDestinationFee({
|
|
3549
|
+
return queryDestinationFee(inputs.crossChainRouteAddress, {
|
|
3124
3550
|
chainId: swapInfo.dst_infos.chain_id,
|
|
3125
3551
|
bridgedToken: swapInfo.dst_infos.bridged_token,
|
|
3126
3552
|
toToken: swapInfo.dst_infos.to_token,
|
|
3127
3553
|
minToAmount: BigInt(swapInfo.dst_infos.min_to_amount),
|
|
3128
|
-
|
|
3554
|
+
orderlyNativeFees: 0n
|
|
3129
3555
|
}).then((data) => {
|
|
3130
3556
|
console.log("res::::", data);
|
|
3131
3557
|
return {
|
|
@@ -3196,45 +3622,54 @@ var useCrossSwap = () => {
|
|
|
3196
3622
|
if (!account5.walletClient) {
|
|
3197
3623
|
throw new Error("walletClient is undefined");
|
|
3198
3624
|
}
|
|
3199
|
-
|
|
3625
|
+
if (!account5.address) {
|
|
3626
|
+
throw new Error("account.address is undefined");
|
|
3627
|
+
}
|
|
3628
|
+
if (!inputs.crossChainRouteAddress) {
|
|
3629
|
+
throw new Error("crossChainRouteAddress is undefined");
|
|
3630
|
+
}
|
|
3631
|
+
const { address, src, dst, crossChainRouteAddress } = inputs;
|
|
3200
3632
|
if (loading)
|
|
3201
3633
|
return;
|
|
3202
3634
|
start();
|
|
3203
3635
|
const quotoLZFee = await account5.walletClient.call(
|
|
3204
|
-
|
|
3636
|
+
crossChainRouteAddress,
|
|
3205
3637
|
"quoteLayerZeroFee",
|
|
3206
3638
|
[account5.address, dst, dstValutDeposit()],
|
|
3207
3639
|
{
|
|
3208
3640
|
abi: woofiDexCrossChainRouterAbi
|
|
3209
3641
|
}
|
|
3210
3642
|
);
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
account5.address,
|
|
3216
|
-
src,
|
|
3217
|
-
dst,
|
|
3218
|
-
dstValutDeposit(),
|
|
3643
|
+
try {
|
|
3644
|
+
const result = await account5.walletClient.sendTransaction(
|
|
3645
|
+
crossChainRouteAddress,
|
|
3646
|
+
"crossSwap",
|
|
3219
3647
|
{
|
|
3648
|
+
from: account5.address,
|
|
3649
|
+
to: crossChainRouteAddress,
|
|
3650
|
+
data: [account5.address, src, dst, dstValutDeposit()],
|
|
3220
3651
|
value: quotoLZFee[0]
|
|
3652
|
+
},
|
|
3653
|
+
{
|
|
3654
|
+
abi: woofiDexCrossChainRouterAbi
|
|
3221
3655
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
(
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
)
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3656
|
+
);
|
|
3657
|
+
account5.walletClient.on(
|
|
3658
|
+
{
|
|
3659
|
+
address: crossChainRouteAddress
|
|
3660
|
+
},
|
|
3661
|
+
(log, event) => {
|
|
3662
|
+
console.log("-------------", log, event);
|
|
3663
|
+
}
|
|
3664
|
+
);
|
|
3665
|
+
stop();
|
|
3666
|
+
checkLayerStatus(result.hash);
|
|
3667
|
+
return ramda.pick(["from", "to", "hash", "value"], result);
|
|
3668
|
+
} catch (e) {
|
|
3669
|
+
console.log("swap error:", e);
|
|
3670
|
+
stop();
|
|
3671
|
+
throw new Error(e.errorCode);
|
|
3672
|
+
}
|
|
3238
3673
|
};
|
|
3239
3674
|
return {
|
|
3240
3675
|
swap,
|
|
@@ -3243,15 +3678,15 @@ var useCrossSwap = () => {
|
|
|
3243
3678
|
message: bridgeMessage
|
|
3244
3679
|
};
|
|
3245
3680
|
};
|
|
3246
|
-
var woofiDexDepositor = "0xfD7ed9D3d4fD88595AF6a87f798ffDB42b4D7ccB";
|
|
3247
3681
|
var woofiDexDepositorAbi = [
|
|
3682
|
+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
3248
3683
|
{
|
|
3684
|
+
anonymous: false,
|
|
3249
3685
|
inputs: [
|
|
3250
|
-
{ internalType: "
|
|
3251
|
-
{ internalType: "address", name: "_wooRouter", type: "address" }
|
|
3686
|
+
{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }
|
|
3252
3687
|
],
|
|
3253
|
-
|
|
3254
|
-
type: "
|
|
3688
|
+
name: "Initialized",
|
|
3689
|
+
type: "event"
|
|
3255
3690
|
},
|
|
3256
3691
|
{
|
|
3257
3692
|
anonymous: false,
|
|
@@ -3338,6 +3773,12 @@ var woofiDexDepositorAbi = [
|
|
|
3338
3773
|
name: "toAmount",
|
|
3339
3774
|
type: "uint256"
|
|
3340
3775
|
},
|
|
3776
|
+
{
|
|
3777
|
+
indexed: false,
|
|
3778
|
+
internalType: "uint256",
|
|
3779
|
+
name: "orderlyNativeFees",
|
|
3780
|
+
type: "uint256"
|
|
3781
|
+
},
|
|
3341
3782
|
{
|
|
3342
3783
|
indexed: false,
|
|
3343
3784
|
internalType: "bytes32",
|
|
@@ -3380,6 +3821,20 @@ var woofiDexDepositorAbi = [
|
|
|
3380
3821
|
stateMutability: "nonpayable",
|
|
3381
3822
|
type: "function"
|
|
3382
3823
|
},
|
|
3824
|
+
{
|
|
3825
|
+
inputs: [{ internalType: "address", name: "_wooRouter", type: "address" }],
|
|
3826
|
+
name: "initialize",
|
|
3827
|
+
outputs: [],
|
|
3828
|
+
stateMutability: "nonpayable",
|
|
3829
|
+
type: "function"
|
|
3830
|
+
},
|
|
3831
|
+
{
|
|
3832
|
+
inputs: [],
|
|
3833
|
+
name: "orderlyFeeToggle",
|
|
3834
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
3835
|
+
stateMutability: "view",
|
|
3836
|
+
type: "function"
|
|
3837
|
+
},
|
|
3383
3838
|
{
|
|
3384
3839
|
inputs: [],
|
|
3385
3840
|
name: "owner",
|
|
@@ -3408,6 +3863,13 @@ var woofiDexDepositorAbi = [
|
|
|
3408
3863
|
stateMutability: "nonpayable",
|
|
3409
3864
|
type: "function"
|
|
3410
3865
|
},
|
|
3866
|
+
{
|
|
3867
|
+
inputs: [{ internalType: "bool", name: "_orderlyFeeToggle", type: "bool" }],
|
|
3868
|
+
name: "setOrderlyFeeToggle",
|
|
3869
|
+
outputs: [],
|
|
3870
|
+
stateMutability: "nonpayable",
|
|
3871
|
+
type: "function"
|
|
3872
|
+
},
|
|
3411
3873
|
{
|
|
3412
3874
|
inputs: [
|
|
3413
3875
|
{ internalType: "address", name: "token", type: "address" },
|
|
@@ -3433,9 +3895,14 @@ var woofiDexDepositorAbi = [
|
|
|
3433
3895
|
{ internalType: "address", name: "fromToken", type: "address" },
|
|
3434
3896
|
{ internalType: "uint256", name: "fromAmount", type: "uint256" },
|
|
3435
3897
|
{ internalType: "address", name: "toToken", type: "address" },
|
|
3436
|
-
{ internalType: "uint256", name: "minToAmount", type: "uint256" }
|
|
3898
|
+
{ internalType: "uint256", name: "minToAmount", type: "uint256" },
|
|
3899
|
+
{
|
|
3900
|
+
internalType: "uint256",
|
|
3901
|
+
name: "orderlyNativeFees",
|
|
3902
|
+
type: "uint256"
|
|
3903
|
+
}
|
|
3437
3904
|
],
|
|
3438
|
-
internalType: "struct
|
|
3905
|
+
internalType: "struct IWOOFiDexDepositor.Infos",
|
|
3439
3906
|
name: "infos",
|
|
3440
3907
|
type: "tuple"
|
|
3441
3908
|
},
|
|
@@ -3445,7 +3912,7 @@ var woofiDexDepositorAbi = [
|
|
|
3445
3912
|
{ internalType: "bytes32", name: "brokerHash", type: "bytes32" },
|
|
3446
3913
|
{ internalType: "bytes32", name: "tokenHash", type: "bytes32" }
|
|
3447
3914
|
],
|
|
3448
|
-
internalType: "struct
|
|
3915
|
+
internalType: "struct IWOOFiDexDepositor.VaultDeposit",
|
|
3449
3916
|
name: "vaultDeposit",
|
|
3450
3917
|
type: "tuple"
|
|
3451
3918
|
}
|
|
@@ -3469,19 +3936,10 @@ var woofiDexDepositorAbi = [
|
|
|
3469
3936
|
stateMutability: "nonpayable",
|
|
3470
3937
|
type: "function"
|
|
3471
3938
|
},
|
|
3472
|
-
{
|
|
3473
|
-
inputs: [],
|
|
3474
|
-
name: "weth",
|
|
3475
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
3476
|
-
stateMutability: "view",
|
|
3477
|
-
type: "function"
|
|
3478
|
-
},
|
|
3479
3939
|
{
|
|
3480
3940
|
inputs: [],
|
|
3481
3941
|
name: "wooRouter",
|
|
3482
|
-
outputs: [
|
|
3483
|
-
{ internalType: "contract IWooRouterV2", name: "", type: "address" }
|
|
3484
|
-
],
|
|
3942
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
3485
3943
|
stateMutability: "view",
|
|
3486
3944
|
type: "function"
|
|
3487
3945
|
},
|
|
@@ -3506,21 +3964,36 @@ var useSwap = () => {
|
|
|
3506
3964
|
};
|
|
3507
3965
|
}, [account5]);
|
|
3508
3966
|
const swap = React2.useCallback(
|
|
3509
|
-
async (inputs) => {
|
|
3967
|
+
async (woofiDexDepositorAdress, inputs) => {
|
|
3968
|
+
if (!account5.walletClient) {
|
|
3969
|
+
throw new Error("walletClient is undefined");
|
|
3970
|
+
}
|
|
3971
|
+
if (!account5.address) {
|
|
3972
|
+
throw new Error("account.address is undefined");
|
|
3973
|
+
}
|
|
3510
3974
|
if (loading)
|
|
3511
3975
|
return;
|
|
3512
3976
|
start();
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3977
|
+
console.log("---------", inputs);
|
|
3978
|
+
try {
|
|
3979
|
+
const result = await account5.walletClient.sendTransaction(
|
|
3980
|
+
woofiDexDepositorAdress,
|
|
3981
|
+
"swap",
|
|
3982
|
+
{
|
|
3983
|
+
from: account5.address,
|
|
3984
|
+
to: woofiDexDepositorAdress,
|
|
3985
|
+
data: [account5.address, inputs, dstValutDeposit()]
|
|
3986
|
+
},
|
|
3987
|
+
{
|
|
3988
|
+
abi: woofiDexDepositorAbi
|
|
3989
|
+
}
|
|
3990
|
+
);
|
|
3991
|
+
stop();
|
|
3992
|
+
return ramda.pick(["from", "to", "hash", "value"], result);
|
|
3993
|
+
} catch (e) {
|
|
3994
|
+
console.log("\u8C03\u7528\u5408\u7EA6\u62A5\u9519\uFF1A", e);
|
|
3995
|
+
throw new Error(e.errorCode);
|
|
3996
|
+
}
|
|
3524
3997
|
},
|
|
3525
3998
|
[loading, account5]
|
|
3526
3999
|
);
|
|
@@ -3580,7 +4053,6 @@ exports.useOrderbookStream = useOrderbookStream;
|
|
|
3580
4053
|
exports.usePositionStream = usePositionStream;
|
|
3581
4054
|
exports.usePreLoadData = usePreLoadData;
|
|
3582
4055
|
exports.usePrivateDataObserver = usePrivateDataObserver;
|
|
3583
|
-
exports.usePrivateObserve = usePrivateObserve;
|
|
3584
4056
|
exports.usePrivateQuery = usePrivateQuery;
|
|
3585
4057
|
exports.useQuery = useQuery;
|
|
3586
4058
|
exports.useRunOnce = useRunOnce;
|