@optimex-xyz/market-maker-sdk 0.9.0-dev-896c690 → 0.9.0-dev-d2e92dd
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 +429 -7
- package/dist/index.d.ts +429 -7
- package/dist/index.js +379 -30
- package/dist/index.mjs +374 -36
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,48 +10,24 @@ var environments = {
|
|
|
10
10
|
backendUrl: "https://api-dev.bitdex.xyz",
|
|
11
11
|
rpcUrl: "https://rpc-bitfi-p00c4t1rul.t.conduit.xyz",
|
|
12
12
|
protocolFetcherProxyAddress: "0x0267Fc04eE866b31907dEe123aBdCdB67d03B297",
|
|
13
|
-
paymentAddressMap: {
|
|
14
|
-
ethereum_sepolia: "0x1d8b58438D5Ccc8Fcb4b738C89078f7b4168C9c0"
|
|
15
|
-
},
|
|
16
|
-
liquidationAddressMap: {
|
|
17
|
-
ethereum_sepolia: "0x2AEDAF2470EfFD35B295D710fB2e5FDAdE642B0A"
|
|
18
|
-
},
|
|
19
13
|
isTestnet: true
|
|
20
14
|
},
|
|
21
15
|
staging: {
|
|
22
16
|
backendUrl: "https://api-stg.bitdex.xyz",
|
|
23
17
|
rpcUrl: "https://rpc-bitfi-p00c4t1rul.t.conduit.xyz",
|
|
24
18
|
protocolFetcherProxyAddress: "0x7c07151ca4DFd93F352Ab9B132A95866697c38c2",
|
|
25
|
-
paymentAddressMap: {
|
|
26
|
-
ethereum_sepolia: "0x7387DcCfE2f1D5F80b4ECDF91eF58541517e90D2"
|
|
27
|
-
},
|
|
28
|
-
liquidationAddressMap: {
|
|
29
|
-
ethereum_sepolia: "0x1CcD45Be1508E70d760b11b32ccd5Ac288756b1a"
|
|
30
|
-
},
|
|
31
19
|
isTestnet: true
|
|
32
20
|
},
|
|
33
21
|
prelive: {
|
|
34
22
|
backendUrl: "https://pre-api.optimex.xyz",
|
|
35
23
|
rpcUrl: "https://rpc.optimex.xyz",
|
|
36
24
|
protocolFetcherProxyAddress: "0xFDEd4CEf9aE1E03D0BeF161262a266c1c157a32b",
|
|
37
|
-
paymentAddressMap: {
|
|
38
|
-
ethereum: "0x0A497AC4261E37FA4062762C23Cf3cB642C839b8"
|
|
39
|
-
},
|
|
40
|
-
liquidationAddressMap: {
|
|
41
|
-
ethereum_sepolia: "0x1CcD45Be1508E70d760b11b32ccd5Ac288756b1a"
|
|
42
|
-
},
|
|
43
25
|
isTestnet: false
|
|
44
26
|
},
|
|
45
27
|
production: {
|
|
46
28
|
backendUrl: "https://api.optimex.xyz",
|
|
47
29
|
rpcUrl: "https://rpc.optimex.xyz",
|
|
48
30
|
protocolFetcherProxyAddress: "0xFDEd4CEf9aE1E03D0BeF161262a266c1c157a32b",
|
|
49
|
-
paymentAddressMap: {
|
|
50
|
-
ethereum: "0x0A497AC4261E37FA4062762C23Cf3cB642C839b8"
|
|
51
|
-
},
|
|
52
|
-
liquidationAddressMap: {
|
|
53
|
-
ethereum_sepolia: "0x1CcD45Be1508E70d760b11b32ccd5Ac288756b1a"
|
|
54
|
-
},
|
|
55
31
|
isTestnet: false
|
|
56
32
|
}
|
|
57
33
|
};
|
|
@@ -104,12 +80,6 @@ var Config = class {
|
|
|
104
80
|
getRpcUrl() {
|
|
105
81
|
return this.config.rpcUrl;
|
|
106
82
|
}
|
|
107
|
-
getPaymentAddress(networkId) {
|
|
108
|
-
return this.config.paymentAddressMap[networkId];
|
|
109
|
-
}
|
|
110
|
-
getLiquidationAddress(networkId) {
|
|
111
|
-
return this.config.liquidationAddressMap[networkId];
|
|
112
|
-
}
|
|
113
83
|
getProtocolFetcherAddress() {
|
|
114
84
|
return this.config.protocolFetcherProxyAddress;
|
|
115
85
|
}
|
|
@@ -2406,6 +2376,27 @@ var _abi4 = [
|
|
|
2406
2376
|
stateMutability: "nonpayable",
|
|
2407
2377
|
type: "constructor"
|
|
2408
2378
|
},
|
|
2379
|
+
{
|
|
2380
|
+
inputs: [],
|
|
2381
|
+
name: "AccessControlBadConfirmation",
|
|
2382
|
+
type: "error"
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
inputs: [
|
|
2386
|
+
{
|
|
2387
|
+
internalType: "address",
|
|
2388
|
+
name: "account",
|
|
2389
|
+
type: "address"
|
|
2390
|
+
},
|
|
2391
|
+
{
|
|
2392
|
+
internalType: "bytes32",
|
|
2393
|
+
name: "neededRole",
|
|
2394
|
+
type: "bytes32"
|
|
2395
|
+
}
|
|
2396
|
+
],
|
|
2397
|
+
name: "AccessControlUnauthorizedAccount",
|
|
2398
|
+
type: "error"
|
|
2399
|
+
},
|
|
2409
2400
|
{
|
|
2410
2401
|
inputs: [],
|
|
2411
2402
|
name: "AddressZero",
|
|
@@ -2416,6 +2407,94 @@ var _abi4 = [
|
|
|
2416
2407
|
name: "Unauthorized",
|
|
2417
2408
|
type: "error"
|
|
2418
2409
|
},
|
|
2410
|
+
{
|
|
2411
|
+
anonymous: false,
|
|
2412
|
+
inputs: [
|
|
2413
|
+
{
|
|
2414
|
+
indexed: true,
|
|
2415
|
+
internalType: "bytes32",
|
|
2416
|
+
name: "role",
|
|
2417
|
+
type: "bytes32"
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
indexed: true,
|
|
2421
|
+
internalType: "bytes32",
|
|
2422
|
+
name: "previousAdminRole",
|
|
2423
|
+
type: "bytes32"
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
indexed: true,
|
|
2427
|
+
internalType: "bytes32",
|
|
2428
|
+
name: "newAdminRole",
|
|
2429
|
+
type: "bytes32"
|
|
2430
|
+
}
|
|
2431
|
+
],
|
|
2432
|
+
name: "RoleAdminChanged",
|
|
2433
|
+
type: "event"
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
anonymous: false,
|
|
2437
|
+
inputs: [
|
|
2438
|
+
{
|
|
2439
|
+
indexed: true,
|
|
2440
|
+
internalType: "bytes32",
|
|
2441
|
+
name: "role",
|
|
2442
|
+
type: "bytes32"
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
indexed: true,
|
|
2446
|
+
internalType: "address",
|
|
2447
|
+
name: "account",
|
|
2448
|
+
type: "address"
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
indexed: true,
|
|
2452
|
+
internalType: "address",
|
|
2453
|
+
name: "sender",
|
|
2454
|
+
type: "address"
|
|
2455
|
+
}
|
|
2456
|
+
],
|
|
2457
|
+
name: "RoleGranted",
|
|
2458
|
+
type: "event"
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
anonymous: false,
|
|
2462
|
+
inputs: [
|
|
2463
|
+
{
|
|
2464
|
+
indexed: true,
|
|
2465
|
+
internalType: "bytes32",
|
|
2466
|
+
name: "role",
|
|
2467
|
+
type: "bytes32"
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
indexed: true,
|
|
2471
|
+
internalType: "address",
|
|
2472
|
+
name: "account",
|
|
2473
|
+
type: "address"
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
indexed: true,
|
|
2477
|
+
internalType: "address",
|
|
2478
|
+
name: "sender",
|
|
2479
|
+
type: "address"
|
|
2480
|
+
}
|
|
2481
|
+
],
|
|
2482
|
+
name: "RoleRevoked",
|
|
2483
|
+
type: "event"
|
|
2484
|
+
},
|
|
2485
|
+
{
|
|
2486
|
+
inputs: [],
|
|
2487
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
2488
|
+
outputs: [
|
|
2489
|
+
{
|
|
2490
|
+
internalType: "bytes32",
|
|
2491
|
+
name: "",
|
|
2492
|
+
type: "bytes32"
|
|
2493
|
+
}
|
|
2494
|
+
],
|
|
2495
|
+
stateMutability: "view",
|
|
2496
|
+
type: "function"
|
|
2497
|
+
},
|
|
2419
2498
|
{
|
|
2420
2499
|
inputs: [
|
|
2421
2500
|
{
|
|
@@ -2577,6 +2656,87 @@ var _abi4 = [
|
|
|
2577
2656
|
stateMutability: "view",
|
|
2578
2657
|
type: "function"
|
|
2579
2658
|
},
|
|
2659
|
+
{
|
|
2660
|
+
inputs: [
|
|
2661
|
+
{
|
|
2662
|
+
internalType: "bytes32",
|
|
2663
|
+
name: "role",
|
|
2664
|
+
type: "bytes32"
|
|
2665
|
+
}
|
|
2666
|
+
],
|
|
2667
|
+
name: "getRoleAdmin",
|
|
2668
|
+
outputs: [
|
|
2669
|
+
{
|
|
2670
|
+
internalType: "bytes32",
|
|
2671
|
+
name: "",
|
|
2672
|
+
type: "bytes32"
|
|
2673
|
+
}
|
|
2674
|
+
],
|
|
2675
|
+
stateMutability: "view",
|
|
2676
|
+
type: "function"
|
|
2677
|
+
},
|
|
2678
|
+
{
|
|
2679
|
+
inputs: [
|
|
2680
|
+
{
|
|
2681
|
+
internalType: "bytes32",
|
|
2682
|
+
name: "role",
|
|
2683
|
+
type: "bytes32"
|
|
2684
|
+
},
|
|
2685
|
+
{
|
|
2686
|
+
internalType: "uint256",
|
|
2687
|
+
name: "index",
|
|
2688
|
+
type: "uint256"
|
|
2689
|
+
}
|
|
2690
|
+
],
|
|
2691
|
+
name: "getRoleMember",
|
|
2692
|
+
outputs: [
|
|
2693
|
+
{
|
|
2694
|
+
internalType: "address",
|
|
2695
|
+
name: "",
|
|
2696
|
+
type: "address"
|
|
2697
|
+
}
|
|
2698
|
+
],
|
|
2699
|
+
stateMutability: "view",
|
|
2700
|
+
type: "function"
|
|
2701
|
+
},
|
|
2702
|
+
{
|
|
2703
|
+
inputs: [
|
|
2704
|
+
{
|
|
2705
|
+
internalType: "bytes32",
|
|
2706
|
+
name: "role",
|
|
2707
|
+
type: "bytes32"
|
|
2708
|
+
}
|
|
2709
|
+
],
|
|
2710
|
+
name: "getRoleMemberCount",
|
|
2711
|
+
outputs: [
|
|
2712
|
+
{
|
|
2713
|
+
internalType: "uint256",
|
|
2714
|
+
name: "",
|
|
2715
|
+
type: "uint256"
|
|
2716
|
+
}
|
|
2717
|
+
],
|
|
2718
|
+
stateMutability: "view",
|
|
2719
|
+
type: "function"
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
inputs: [
|
|
2723
|
+
{
|
|
2724
|
+
internalType: "bytes32",
|
|
2725
|
+
name: "role",
|
|
2726
|
+
type: "bytes32"
|
|
2727
|
+
}
|
|
2728
|
+
],
|
|
2729
|
+
name: "getRoleMembers",
|
|
2730
|
+
outputs: [
|
|
2731
|
+
{
|
|
2732
|
+
internalType: "address[]",
|
|
2733
|
+
name: "",
|
|
2734
|
+
type: "address[]"
|
|
2735
|
+
}
|
|
2736
|
+
],
|
|
2737
|
+
stateMutability: "view",
|
|
2738
|
+
type: "function"
|
|
2739
|
+
},
|
|
2580
2740
|
{
|
|
2581
2741
|
inputs: [
|
|
2582
2742
|
{
|
|
@@ -2637,6 +2797,48 @@ var _abi4 = [
|
|
|
2637
2797
|
stateMutability: "view",
|
|
2638
2798
|
type: "function"
|
|
2639
2799
|
},
|
|
2800
|
+
{
|
|
2801
|
+
inputs: [
|
|
2802
|
+
{
|
|
2803
|
+
internalType: "bytes32",
|
|
2804
|
+
name: "role",
|
|
2805
|
+
type: "bytes32"
|
|
2806
|
+
},
|
|
2807
|
+
{
|
|
2808
|
+
internalType: "address",
|
|
2809
|
+
name: "account",
|
|
2810
|
+
type: "address"
|
|
2811
|
+
}
|
|
2812
|
+
],
|
|
2813
|
+
name: "grantRole",
|
|
2814
|
+
outputs: [],
|
|
2815
|
+
stateMutability: "nonpayable",
|
|
2816
|
+
type: "function"
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
inputs: [
|
|
2820
|
+
{
|
|
2821
|
+
internalType: "bytes32",
|
|
2822
|
+
name: "role",
|
|
2823
|
+
type: "bytes32"
|
|
2824
|
+
},
|
|
2825
|
+
{
|
|
2826
|
+
internalType: "address",
|
|
2827
|
+
name: "account",
|
|
2828
|
+
type: "address"
|
|
2829
|
+
}
|
|
2830
|
+
],
|
|
2831
|
+
name: "hasRole",
|
|
2832
|
+
outputs: [
|
|
2833
|
+
{
|
|
2834
|
+
internalType: "bool",
|
|
2835
|
+
name: "",
|
|
2836
|
+
type: "bool"
|
|
2837
|
+
}
|
|
2838
|
+
],
|
|
2839
|
+
stateMutability: "view",
|
|
2840
|
+
type: "function"
|
|
2841
|
+
},
|
|
2640
2842
|
{
|
|
2641
2843
|
inputs: [
|
|
2642
2844
|
{
|
|
@@ -2843,6 +3045,42 @@ var _abi4 = [
|
|
|
2843
3045
|
stateMutability: "view",
|
|
2844
3046
|
type: "function"
|
|
2845
3047
|
},
|
|
3048
|
+
{
|
|
3049
|
+
inputs: [
|
|
3050
|
+
{
|
|
3051
|
+
internalType: "bytes32",
|
|
3052
|
+
name: "role",
|
|
3053
|
+
type: "bytes32"
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
internalType: "address",
|
|
3057
|
+
name: "callerConfirmation",
|
|
3058
|
+
type: "address"
|
|
3059
|
+
}
|
|
3060
|
+
],
|
|
3061
|
+
name: "renounceRole",
|
|
3062
|
+
outputs: [],
|
|
3063
|
+
stateMutability: "nonpayable",
|
|
3064
|
+
type: "function"
|
|
3065
|
+
},
|
|
3066
|
+
{
|
|
3067
|
+
inputs: [
|
|
3068
|
+
{
|
|
3069
|
+
internalType: "bytes32",
|
|
3070
|
+
name: "role",
|
|
3071
|
+
type: "bytes32"
|
|
3072
|
+
},
|
|
3073
|
+
{
|
|
3074
|
+
internalType: "address",
|
|
3075
|
+
name: "account",
|
|
3076
|
+
type: "address"
|
|
3077
|
+
}
|
|
3078
|
+
],
|
|
3079
|
+
name: "revokeRole",
|
|
3080
|
+
outputs: [],
|
|
3081
|
+
stateMutability: "nonpayable",
|
|
3082
|
+
type: "function"
|
|
3083
|
+
},
|
|
2846
3084
|
{
|
|
2847
3085
|
inputs: [],
|
|
2848
3086
|
name: "router",
|
|
@@ -2920,6 +3158,25 @@ var _abi4 = [
|
|
|
2920
3158
|
],
|
|
2921
3159
|
stateMutability: "view",
|
|
2922
3160
|
type: "function"
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
inputs: [
|
|
3164
|
+
{
|
|
3165
|
+
internalType: "bytes4",
|
|
3166
|
+
name: "interfaceId",
|
|
3167
|
+
type: "bytes4"
|
|
3168
|
+
}
|
|
3169
|
+
],
|
|
3170
|
+
name: "supportsInterface",
|
|
3171
|
+
outputs: [
|
|
3172
|
+
{
|
|
3173
|
+
internalType: "bool",
|
|
3174
|
+
name: "",
|
|
3175
|
+
type: "bool"
|
|
3176
|
+
}
|
|
3177
|
+
],
|
|
3178
|
+
stateMutability: "view",
|
|
3179
|
+
type: "function"
|
|
2923
3180
|
}
|
|
2924
3181
|
];
|
|
2925
3182
|
var ProtocolFetcherProxy__factory = class {
|
|
@@ -4784,11 +5041,72 @@ var Signer__factory = class {
|
|
|
4784
5041
|
Signer__factory.abi = _abi6;
|
|
4785
5042
|
|
|
4786
5043
|
// src/services/protocol.service.ts
|
|
4787
|
-
import { ethers, JsonRpcProvider } from "ethers";
|
|
5044
|
+
import { ethers, JsonRpcProvider, keccak256, toUtf8Bytes } from "ethers";
|
|
5045
|
+
|
|
5046
|
+
// src/shared/network.ts
|
|
5047
|
+
var OptimexEvmNetwork = /* @__PURE__ */ ((OptimexEvmNetwork3) => {
|
|
5048
|
+
OptimexEvmNetwork3["EthereumSepolia"] = "ethereum_sepolia";
|
|
5049
|
+
OptimexEvmNetwork3["EthereumMainnet"] = "ethereum";
|
|
5050
|
+
OptimexEvmNetwork3["BaseTestnet"] = "base_sepolia";
|
|
5051
|
+
OptimexEvmNetwork3["BaseMainnet"] = "base";
|
|
5052
|
+
OptimexEvmNetwork3["ArbitrumSepolia"] = "arbitrum_sepolia";
|
|
5053
|
+
OptimexEvmNetwork3["Arbitrum"] = "arbitrum";
|
|
5054
|
+
OptimexEvmNetwork3["OptimismSepolia"] = "optimism_sepolia";
|
|
5055
|
+
OptimexEvmNetwork3["Optimism"] = "optimism";
|
|
5056
|
+
OptimexEvmNetwork3["BSC"] = "bsc";
|
|
5057
|
+
return OptimexEvmNetwork3;
|
|
5058
|
+
})(OptimexEvmNetwork || {});
|
|
5059
|
+
var OptimexL2Network = /* @__PURE__ */ ((OptimexL2Network2) => {
|
|
5060
|
+
OptimexL2Network2["Testnet"] = "optimex_testnet";
|
|
5061
|
+
OptimexL2Network2["Mainnet"] = "optimex";
|
|
5062
|
+
return OptimexL2Network2;
|
|
5063
|
+
})(OptimexL2Network || {});
|
|
5064
|
+
var OptimexBtcNetwork = /* @__PURE__ */ ((OptimexBtcNetwork2) => {
|
|
5065
|
+
OptimexBtcNetwork2["BitcoinTestnet"] = "bitcoin_testnet";
|
|
5066
|
+
OptimexBtcNetwork2["BitcoinMainnet"] = "bitcoin";
|
|
5067
|
+
return OptimexBtcNetwork2;
|
|
5068
|
+
})(OptimexBtcNetwork || {});
|
|
5069
|
+
var OptimexSolanaNetwork = /* @__PURE__ */ ((OptimexSolanaNetwork2) => {
|
|
5070
|
+
OptimexSolanaNetwork2["SolanaDevnet"] = "solana_devnet";
|
|
5071
|
+
OptimexSolanaNetwork2["SolanaMainnet"] = "solana";
|
|
5072
|
+
return OptimexSolanaNetwork2;
|
|
5073
|
+
})(OptimexSolanaNetwork || {});
|
|
5074
|
+
var OptimexLendingNetwork = /* @__PURE__ */ ((OptimexLendingNetwork2) => {
|
|
5075
|
+
OptimexLendingNetwork2["Morpho"] = "MORPHO";
|
|
5076
|
+
return OptimexLendingNetwork2;
|
|
5077
|
+
})(OptimexLendingNetwork || {});
|
|
5078
|
+
var isEvmNetwork = (network) => {
|
|
5079
|
+
return Object.values(OptimexEvmNetwork).includes(network);
|
|
5080
|
+
};
|
|
5081
|
+
var isBtcNetwork = (network) => {
|
|
5082
|
+
return Object.values(OptimexBtcNetwork).includes(network);
|
|
5083
|
+
};
|
|
5084
|
+
var isSolanaNetwork = (network) => {
|
|
5085
|
+
return Object.values(OptimexSolanaNetwork).includes(network);
|
|
5086
|
+
};
|
|
5087
|
+
var isL2Network = (network) => {
|
|
5088
|
+
return Object.values(OptimexL2Network).includes(network);
|
|
5089
|
+
};
|
|
5090
|
+
|
|
5091
|
+
// src/shared/role.ts
|
|
5092
|
+
var ContractRole = /* @__PURE__ */ ((ContractRole3) => {
|
|
5093
|
+
ContractRole3["AcrossTransitVault"] = "AcrossTransitVault";
|
|
5094
|
+
ContractRole3["Payment"] = "OptimexSwapPayment";
|
|
5095
|
+
return ContractRole3;
|
|
5096
|
+
})(ContractRole || {});
|
|
5097
|
+
var L2ContractRole = /* @__PURE__ */ ((L2ContractRole3) => {
|
|
5098
|
+
L2ContractRole3["MorphoAdapter"] = "MorphoAdapter";
|
|
5099
|
+
L2ContractRole3["MorphoMarketRegistry"] = "MorphoMarketRegistry";
|
|
5100
|
+
L2ContractRole3["AcrossRefund"] = "AcrossRefund";
|
|
5101
|
+
return L2ContractRole3;
|
|
5102
|
+
})(L2ContractRole || {});
|
|
5103
|
+
|
|
5104
|
+
// src/services/protocol.service.ts
|
|
4788
5105
|
var ProtocolService = class {
|
|
4789
5106
|
constructor() {
|
|
4790
5107
|
this.provider = new JsonRpcProvider(config.getRpcUrl());
|
|
4791
5108
|
this.contract = ProtocolFetcherProxy__factory.connect(config.getProtocolFetcherAddress(), this.provider);
|
|
5109
|
+
this.l2Network = config.isTestnet() ? "optimex_testnet" /* Testnet */ : "optimex" /* Mainnet */;
|
|
4792
5110
|
config.registerObserver(this);
|
|
4793
5111
|
}
|
|
4794
5112
|
/**
|
|
@@ -4798,6 +5116,7 @@ var ProtocolService = class {
|
|
|
4798
5116
|
onConfigUpdate(newConfig) {
|
|
4799
5117
|
this.provider = new JsonRpcProvider(newConfig.rpcUrl);
|
|
4800
5118
|
this.contract = ProtocolFetcherProxy__factory.connect(newConfig.protocolFetcherProxyAddress, this.provider);
|
|
5119
|
+
this.l2Network = newConfig.isTestnet ? "optimex_testnet" /* Testnet */ : "optimex" /* Mainnet */;
|
|
4801
5120
|
}
|
|
4802
5121
|
async getCurrentPubkey(network) {
|
|
4803
5122
|
return this.contract.getLatestMPCInfo(ethers.toUtf8Bytes(network));
|
|
@@ -4819,6 +5138,14 @@ var ProtocolService = class {
|
|
|
4819
5138
|
async getRouter() {
|
|
4820
5139
|
return this.contract.router();
|
|
4821
5140
|
}
|
|
5141
|
+
async getAssetChainConfig(network, role) {
|
|
5142
|
+
const hashRole = keccak256(toUtf8Bytes([network, role].join(":")));
|
|
5143
|
+
return this.contract.getRoleMembers(hashRole);
|
|
5144
|
+
}
|
|
5145
|
+
async getL2Config(role) {
|
|
5146
|
+
const hashRole = keccak256(toUtf8Bytes([this.l2Network, role].join(":")));
|
|
5147
|
+
return this.contract.getRoleMembers(hashRole);
|
|
5148
|
+
}
|
|
4822
5149
|
};
|
|
4823
5150
|
var protocolService = new ProtocolService();
|
|
4824
5151
|
|
|
@@ -5240,20 +5567,20 @@ async function defaultDomain(signerHelper, provider) {
|
|
|
5240
5567
|
}
|
|
5241
5568
|
|
|
5242
5569
|
// src/signatures/getInfoHash.ts
|
|
5243
|
-
import { AbiCoder, keccak256 } from "ethers";
|
|
5570
|
+
import { AbiCoder, keccak256 as keccak2562 } from "ethers";
|
|
5244
5571
|
var abiCoder = AbiCoder.defaultAbiCoder();
|
|
5245
5572
|
function getTradeIdsHash(tradeIds) {
|
|
5246
|
-
return
|
|
5573
|
+
return keccak2562(abiCoder.encode(["bytes32[]"], [tradeIds]));
|
|
5247
5574
|
}
|
|
5248
5575
|
function getMakePaymentHash(tradeIds, signedAt, startIdx, paymentTxId) {
|
|
5249
|
-
const bundlerHash =
|
|
5250
|
-
const infoHash =
|
|
5576
|
+
const bundlerHash = keccak2562(abiCoder.encode(["bytes32[]"], [tradeIds]));
|
|
5577
|
+
const infoHash = keccak2562(
|
|
5251
5578
|
abiCoder.encode(["uint64", "uint256", "bytes32", "bytes"], [signedAt, startIdx, bundlerHash, paymentTxId])
|
|
5252
5579
|
);
|
|
5253
5580
|
return infoHash;
|
|
5254
5581
|
}
|
|
5255
5582
|
function getCommitInfoHash(pmmId, pmmRecvAddr, toChain, toToken, amountOut, expiry) {
|
|
5256
|
-
const infoHash =
|
|
5583
|
+
const infoHash = keccak2562(
|
|
5257
5584
|
abiCoder.encode(
|
|
5258
5585
|
["bytes32", "bytes", "bytes", "bytes", "uint256", "uint64"],
|
|
5259
5586
|
[pmmId, pmmRecvAddr, toChain, toToken, amountOut, expiry]
|
|
@@ -5340,8 +5667,15 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
|
|
|
5340
5667
|
return await Signer2.signTypedData(domain ?? contractDomain, getSignatureType(type), values);
|
|
5341
5668
|
}
|
|
5342
5669
|
export {
|
|
5670
|
+
ContractRole,
|
|
5343
5671
|
ERC20__factory,
|
|
5672
|
+
L2ContractRole,
|
|
5344
5673
|
MorphoLiquidator__factory,
|
|
5674
|
+
OptimexBtcNetwork,
|
|
5675
|
+
OptimexEvmNetwork,
|
|
5676
|
+
OptimexL2Network,
|
|
5677
|
+
OptimexLendingNetwork,
|
|
5678
|
+
OptimexSolanaNetwork,
|
|
5345
5679
|
Payment__factory,
|
|
5346
5680
|
ProtocolFetcherProxy__factory,
|
|
5347
5681
|
ProtocolService,
|
|
@@ -5368,6 +5702,10 @@ export {
|
|
|
5368
5702
|
getSignature,
|
|
5369
5703
|
getSigner,
|
|
5370
5704
|
getTradeIdsHash,
|
|
5705
|
+
isBtcNetwork,
|
|
5706
|
+
isEvmNetwork,
|
|
5707
|
+
isL2Network,
|
|
5708
|
+
isSolanaNetwork,
|
|
5371
5709
|
makePaymentType,
|
|
5372
5710
|
presignType,
|
|
5373
5711
|
protocolService,
|