@reyaxyz/common 0.342.0 → 0.343.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/transactions/abis/OFT.json +201 -0
  3. package/dist/transactions/abis/Periphery.json +233 -0
  4. package/dist/transactions/index.js +3 -1
  5. package/dist/transactions/index.js.map +1 -1
  6. package/dist/types/transactions/index.d.ts +1 -0
  7. package/dist/types/transactions/index.d.ts.map +1 -1
  8. package/dist/types/types.d.ts +2 -1
  9. package/dist/types/types.d.ts.map +1 -1
  10. package/dist/types/utils/index.d.ts +1 -0
  11. package/dist/types/utils/index.d.ts.map +1 -1
  12. package/dist/types/utils/layerzero/index.d.ts +3 -0
  13. package/dist/types/utils/layerzero/index.d.ts.map +1 -0
  14. package/dist/types/utils/layerzero/oft-config.d.ts +4 -0
  15. package/dist/types/utils/layerzero/oft-config.d.ts.map +1 -0
  16. package/dist/types/utils/layerzero/types.d.ts +23 -0
  17. package/dist/types/utils/layerzero/types.d.ts.map +1 -0
  18. package/dist/types/utils/token/token-info.d.ts.map +1 -1
  19. package/dist/types.js.map +1 -1
  20. package/dist/utils/index.js +1 -0
  21. package/dist/utils/index.js.map +1 -1
  22. package/dist/utils/layerzero/index.js +19 -0
  23. package/dist/utils/layerzero/index.js.map +1 -0
  24. package/dist/utils/layerzero/oft-config.js +29 -0
  25. package/dist/utils/layerzero/oft-config.js.map +1 -0
  26. package/dist/utils/layerzero/types.js +3 -0
  27. package/dist/utils/layerzero/types.js.map +1 -0
  28. package/dist/utils/token/token-info.js +64 -0
  29. package/dist/utils/token/token-info.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/transactions/abis/OFT.json +201 -0
  32. package/src/transactions/abis/Periphery.json +233 -0
  33. package/src/transactions/index.ts +1 -0
  34. package/src/types.ts +3 -0
  35. package/src/utils/index.ts +1 -0
  36. package/src/utils/layerzero/index.ts +2 -0
  37. package/src/utils/layerzero/oft-config.ts +32 -0
  38. package/src/utils/layerzero/types.ts +25 -0
  39. package/src/utils/token/token-info.ts +64 -0
@@ -0,0 +1,201 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [
5
+ {
6
+ "components": [
7
+ {
8
+ "internalType": "uint32",
9
+ "name": "dstEid",
10
+ "type": "uint32"
11
+ },
12
+ {
13
+ "internalType": "bytes32",
14
+ "name": "to",
15
+ "type": "bytes32"
16
+ },
17
+ {
18
+ "internalType": "uint256",
19
+ "name": "amountLD",
20
+ "type": "uint256"
21
+ },
22
+ {
23
+ "internalType": "uint256",
24
+ "name": "minAmountLD",
25
+ "type": "uint256"
26
+ },
27
+ {
28
+ "internalType": "bytes",
29
+ "name": "extraOptions",
30
+ "type": "bytes"
31
+ },
32
+ {
33
+ "internalType": "bytes",
34
+ "name": "composeMsg",
35
+ "type": "bytes"
36
+ },
37
+ {
38
+ "internalType": "bytes",
39
+ "name": "oftCmd",
40
+ "type": "bytes"
41
+ }
42
+ ],
43
+ "internalType": "struct SendParam",
44
+ "name": "_sendParam",
45
+ "type": "tuple"
46
+ },
47
+ {
48
+ "internalType": "bool",
49
+ "name": "_payInLzToken",
50
+ "type": "bool"
51
+ }
52
+ ],
53
+ "name": "quoteSend",
54
+ "outputs": [
55
+ {
56
+ "components": [
57
+ {
58
+ "internalType": "uint256",
59
+ "name": "nativeFee",
60
+ "type": "uint256"
61
+ },
62
+ {
63
+ "internalType": "uint256",
64
+ "name": "lzTokenFee",
65
+ "type": "uint256"
66
+ }
67
+ ],
68
+ "internalType": "struct MessagingFee",
69
+ "name": "msgFee",
70
+ "type": "tuple"
71
+ }
72
+ ],
73
+ "stateMutability": "view",
74
+ "type": "function"
75
+ },
76
+ {
77
+ "inputs": [
78
+ {
79
+ "components": [
80
+ {
81
+ "internalType": "uint32",
82
+ "name": "dstEid",
83
+ "type": "uint32"
84
+ },
85
+ {
86
+ "internalType": "bytes32",
87
+ "name": "to",
88
+ "type": "bytes32"
89
+ },
90
+ {
91
+ "internalType": "uint256",
92
+ "name": "amountLD",
93
+ "type": "uint256"
94
+ },
95
+ {
96
+ "internalType": "uint256",
97
+ "name": "minAmountLD",
98
+ "type": "uint256"
99
+ },
100
+ {
101
+ "internalType": "bytes",
102
+ "name": "extraOptions",
103
+ "type": "bytes"
104
+ },
105
+ {
106
+ "internalType": "bytes",
107
+ "name": "composeMsg",
108
+ "type": "bytes"
109
+ },
110
+ {
111
+ "internalType": "bytes",
112
+ "name": "oftCmd",
113
+ "type": "bytes"
114
+ }
115
+ ],
116
+ "internalType": "struct SendParam",
117
+ "name": "_sendParam",
118
+ "type": "tuple"
119
+ },
120
+ {
121
+ "components": [
122
+ {
123
+ "internalType": "uint256",
124
+ "name": "nativeFee",
125
+ "type": "uint256"
126
+ },
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "lzTokenFee",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "internalType": "struct MessagingFee",
134
+ "name": "_fee",
135
+ "type": "tuple"
136
+ },
137
+ {
138
+ "internalType": "address",
139
+ "name": "_refundAddress",
140
+ "type": "address"
141
+ }
142
+ ],
143
+ "name": "send",
144
+ "outputs": [
145
+ {
146
+ "components": [
147
+ {
148
+ "internalType": "bytes32",
149
+ "name": "guid",
150
+ "type": "bytes32"
151
+ },
152
+ {
153
+ "internalType": "uint64",
154
+ "name": "nonce",
155
+ "type": "uint64"
156
+ },
157
+ {
158
+ "components": [
159
+ {
160
+ "internalType": "uint256",
161
+ "name": "nativeFee",
162
+ "type": "uint256"
163
+ },
164
+ {
165
+ "internalType": "uint256",
166
+ "name": "lzTokenFee",
167
+ "type": "uint256"
168
+ }
169
+ ],
170
+ "internalType": "struct MessagingFee",
171
+ "name": "fee",
172
+ "type": "tuple"
173
+ }
174
+ ],
175
+ "internalType": "struct MessagingReceipt",
176
+ "name": "msgReceipt",
177
+ "type": "tuple"
178
+ },
179
+ {
180
+ "components": [
181
+ {
182
+ "internalType": "uint256",
183
+ "name": "amountSentLD",
184
+ "type": "uint256"
185
+ },
186
+ {
187
+ "internalType": "uint256",
188
+ "name": "amountReceivedLD",
189
+ "type": "uint256"
190
+ }
191
+ ],
192
+ "internalType": "struct OFTReceipt",
193
+ "name": "oftReceipt",
194
+ "type": "tuple"
195
+ }
196
+ ],
197
+ "stateMutability": "payable",
198
+ "type": "function"
199
+ }
200
+ ]
201
+ }
@@ -1457,6 +1457,125 @@
1457
1457
  "outputs": [],
1458
1458
  "stateMutability": "nonpayable"
1459
1459
  },
1460
+ {
1461
+ "type": "function",
1462
+ "name": "withdrawMALZ",
1463
+ "inputs": [
1464
+ {
1465
+ "name": "inputs",
1466
+ "type": "tuple",
1467
+ "internalType": "struct WithdrawMALZInputs",
1468
+ "components": [
1469
+ {
1470
+ "name": "accountId",
1471
+ "type": "uint128",
1472
+ "internalType": "uint128"
1473
+ },
1474
+ {
1475
+ "name": "token",
1476
+ "type": "address",
1477
+ "internalType": "address"
1478
+ },
1479
+ {
1480
+ "name": "tokenAmount",
1481
+ "type": "uint256",
1482
+ "internalType": "uint256"
1483
+ },
1484
+ {
1485
+ "name": "sig",
1486
+ "type": "tuple",
1487
+ "internalType": "struct EIP712Signature",
1488
+ "components": [
1489
+ {
1490
+ "name": "v",
1491
+ "type": "uint8",
1492
+ "internalType": "uint8"
1493
+ },
1494
+ {
1495
+ "name": "r",
1496
+ "type": "bytes32",
1497
+ "internalType": "bytes32"
1498
+ },
1499
+ {
1500
+ "name": "s",
1501
+ "type": "bytes32",
1502
+ "internalType": "bytes32"
1503
+ },
1504
+ {
1505
+ "name": "deadline",
1506
+ "type": "uint256",
1507
+ "internalType": "uint256"
1508
+ }
1509
+ ]
1510
+ },
1511
+ {
1512
+ "name": "dstEid",
1513
+ "type": "uint32",
1514
+ "internalType": "uint32"
1515
+ },
1516
+ {
1517
+ "name": "receiver",
1518
+ "type": "address",
1519
+ "internalType": "address"
1520
+ }
1521
+ ]
1522
+ }
1523
+ ],
1524
+ "outputs": [
1525
+ {
1526
+ "name": "",
1527
+ "type": "tuple",
1528
+ "internalType": "struct MessagingReceipt",
1529
+ "components": [
1530
+ {
1531
+ "name": "guid",
1532
+ "type": "bytes32",
1533
+ "internalType": "bytes32"
1534
+ },
1535
+ {
1536
+ "name": "nonce",
1537
+ "type": "uint64",
1538
+ "internalType": "uint64"
1539
+ },
1540
+ {
1541
+ "name": "fee",
1542
+ "type": "tuple",
1543
+ "internalType": "struct MessagingFee",
1544
+ "components": [
1545
+ {
1546
+ "name": "nativeFee",
1547
+ "type": "uint256",
1548
+ "internalType": "uint256"
1549
+ },
1550
+ {
1551
+ "name": "lzTokenFee",
1552
+ "type": "uint256",
1553
+ "internalType": "uint256"
1554
+ }
1555
+ ]
1556
+ }
1557
+ ]
1558
+ },
1559
+ {
1560
+ "name": "",
1561
+ "type": "tuple",
1562
+ "internalType": "struct OFTReceipt",
1563
+ "components": [
1564
+ {
1565
+ "name": "amountSentLD",
1566
+ "type": "uint256",
1567
+ "internalType": "uint256"
1568
+ },
1569
+ {
1570
+ "name": "amountReceivedLD",
1571
+ "type": "uint256",
1572
+ "internalType": "uint256"
1573
+ }
1574
+ ]
1575
+ }
1576
+ ],
1577
+ "stateMutability": "nonpayable"
1578
+ },
1460
1579
  {
1461
1580
  "type": "function",
1462
1581
  "name": "withdrawPassivePool",
@@ -1869,6 +1988,120 @@
1869
1988
  ],
1870
1989
  "anonymous": false
1871
1990
  },
1991
+ {
1992
+ "type": "function",
1993
+ "name": "stakeReya",
1994
+ "inputs": [
1995
+ {
1996
+ "name": "inputs",
1997
+ "type": "tuple",
1998
+ "internalType": "struct StakeReyaInputs",
1999
+ "components": [
2000
+ {
2001
+ "name": "accountId",
2002
+ "type": "uint128",
2003
+ "internalType": "uint128"
2004
+ },
2005
+ {
2006
+ "name": "assetAmount",
2007
+ "type": "uint256",
2008
+ "internalType": "uint256"
2009
+ },
2010
+ {
2011
+ "name": "minShareAmount",
2012
+ "type": "uint256",
2013
+ "internalType": "uint256"
2014
+ },
2015
+ {
2016
+ "name": "withdrawSig",
2017
+ "type": "tuple",
2018
+ "internalType": "struct EIP712Signature",
2019
+ "components": [
2020
+ {
2021
+ "name": "v",
2022
+ "type": "uint8",
2023
+ "internalType": "uint8"
2024
+ },
2025
+ {
2026
+ "name": "r",
2027
+ "type": "bytes32",
2028
+ "internalType": "bytes32"
2029
+ },
2030
+ {
2031
+ "name": "s",
2032
+ "type": "bytes32",
2033
+ "internalType": "bytes32"
2034
+ },
2035
+ {
2036
+ "name": "deadline",
2037
+ "type": "uint256",
2038
+ "internalType": "uint256"
2039
+ }
2040
+ ]
2041
+ }
2042
+ ]
2043
+ }
2044
+ ],
2045
+ "outputs": [],
2046
+ "stateMutability": "nonpayable"
2047
+ },
2048
+ {
2049
+ "type": "function",
2050
+ "name": "unstakeStakedReya",
2051
+ "inputs": [
2052
+ {
2053
+ "name": "inputs",
2054
+ "type": "tuple",
2055
+ "internalType": "struct UnstakeStakedReyaInputs",
2056
+ "components": [
2057
+ {
2058
+ "name": "accountId",
2059
+ "type": "uint128",
2060
+ "internalType": "uint128"
2061
+ },
2062
+ {
2063
+ "name": "shareAmount",
2064
+ "type": "uint256",
2065
+ "internalType": "uint256"
2066
+ },
2067
+ {
2068
+ "name": "minAssetAmount",
2069
+ "type": "uint256",
2070
+ "internalType": "uint256"
2071
+ },
2072
+ {
2073
+ "name": "withdrawSig",
2074
+ "type": "tuple",
2075
+ "internalType": "struct EIP712Signature",
2076
+ "components": [
2077
+ {
2078
+ "name": "v",
2079
+ "type": "uint8",
2080
+ "internalType": "uint8"
2081
+ },
2082
+ {
2083
+ "name": "r",
2084
+ "type": "bytes32",
2085
+ "internalType": "bytes32"
2086
+ },
2087
+ {
2088
+ "name": "s",
2089
+ "type": "bytes32",
2090
+ "internalType": "bytes32"
2091
+ },
2092
+ {
2093
+ "name": "deadline",
2094
+ "type": "uint256",
2095
+ "internalType": "uint256"
2096
+ }
2097
+ ]
2098
+ }
2099
+ ]
2100
+ }
2101
+ ],
2102
+ "outputs": [],
2103
+ "stateMutability": "nonpayable"
2104
+ },
1872
2105
  {
1873
2106
  "type": "error",
1874
2107
  "name": "ValueAlreadyInSet",
@@ -7,6 +7,7 @@ export { abi as PeripheryAbi } from './abis/Periphery.json';
7
7
  export { abi as Socket_VaultWithPayloadAbi } from './abis/socket/VaultWithPayload.json';
8
8
  export { abi as OrdersGatewayAbi } from './abis/OrdersGateway.json';
9
9
  export { abi as PassivePerpAbi } from './abis/PassivePerpProxy.json';
10
+ export { abi as OFTAbi } from './abis/OFT.json';
10
11
  export * from './contractAddresses';
11
12
  export * from './routerCommands';
12
13
  export * from './sign';
package/src/types.ts CHANGED
@@ -586,6 +586,7 @@ export type TokenInfo = {
586
586
  isElixirToken?: boolean;
587
587
  isLmToken?: boolean;
588
588
  isPoolToken?: boolean;
589
+ isOFT?: boolean;
589
590
  };
590
591
 
591
592
  export type GetReyaCheckerResult = {
@@ -1063,6 +1064,8 @@ export type AssetPair =
1063
1064
  | 'REYALM#HEDGEUSDC'
1064
1065
  | 'SRUSDRUSD_RR'
1065
1066
  | 'REYAPOOL#1'
1067
+ | 'REYARUSD'
1068
+ | 'SREYARUSD'
1066
1069
  | 'ETHUSDMARK'
1067
1070
  | 'BTCUSDMARK'
1068
1071
  | 'SOLUSDMARK'
@@ -13,3 +13,4 @@ export * from './whitelisted-wallets';
13
13
  export * from './stringify';
14
14
  export * from './delay';
15
15
  export * from './transaction-receipt';
16
+ export * from './layerzero';
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './oft-config';
@@ -0,0 +1,32 @@
1
+ import { MoneyInOutChainId, ReyaChainId, TokenName } from '../../types';
2
+ import { getTokenInfoByName } from '../token/token-info-getters';
3
+
4
+ export const getLzEndpointId = (
5
+ chainId: MoneyInOutChainId | ReyaChainId,
6
+ ): number => {
7
+ const chainToLzEid: Record<number, number> = {
8
+ [MoneyInOutChainId.ethereumMainnet]: 30101,
9
+ [MoneyInOutChainId.ethereumSepolia]: 40161,
10
+ [ReyaChainId.reyaNetwork]: 30313,
11
+ [ReyaChainId.reyaCronos]: 40319,
12
+ };
13
+
14
+ const lzEid = chainToLzEid[chainId];
15
+ if (!lzEid) {
16
+ throw new Error(`No LayerZero endpoint ID found for chain ${chainId}`);
17
+ }
18
+ return lzEid;
19
+ };
20
+
21
+ export const getOFTTokenAddress = (
22
+ tokenName: TokenName,
23
+ chainId: MoneyInOutChainId | ReyaChainId,
24
+ ): string => {
25
+ const tokenInfo = getTokenInfoByName(tokenName, chainId);
26
+ if (!tokenInfo.isOFT) {
27
+ throw new Error(
28
+ `getOFTTokenAddress: token ${tokenName} on chain ${chainId} is not an OFT token`,
29
+ );
30
+ }
31
+ return tokenInfo.address;
32
+ };
@@ -0,0 +1,25 @@
1
+ export type OFTSendParam = {
2
+ dstEid: number;
3
+ to: string;
4
+ amountLD: bigint;
5
+ minAmountLD: bigint;
6
+ extraOptions: string;
7
+ composeMsg: string;
8
+ oftCmd: string;
9
+ };
10
+
11
+ export type OFTMessagingFee = {
12
+ nativeFee: bigint;
13
+ lzTokenFee: bigint;
14
+ };
15
+
16
+ export type OFTMessagingReceipt = {
17
+ guid: string;
18
+ nonce: bigint;
19
+ fee: OFTMessagingFee;
20
+ };
21
+
22
+ export type OFTReceipt = {
23
+ amountSentLD: bigint;
24
+ amountReceivedLD: bigint;
25
+ };
@@ -126,6 +126,27 @@ export const TOKEN_INFO: Record<ReyaChainId | MoneyInOutChainId, TokenInfo[]> =
126
126
  minWithdrawAmount: 0.0001,
127
127
  minTransferAmount: 0.0001,
128
128
  },
129
+ {
130
+ name: 'REYA',
131
+ address: '0xcc8e02d7112ddaa66a63b89d73e4eda65722b111',
132
+ decimals: 18,
133
+ isRUSDUnderlying: false,
134
+ whitelistedWalletOnly: true,
135
+ isOFT: true,
136
+ minDepositAmount: 1,
137
+ minWithdrawAmount: 1,
138
+ minTransferAmount: 1,
139
+ },
140
+ {
141
+ name: 'SREYA',
142
+ address: '0xf3dd224de5f9b112690a15521b4a0c450a4a82c2',
143
+ decimals: 18,
144
+ isRUSDUnderlying: false,
145
+ whitelistedWalletOnly: true,
146
+ minDepositAmount: 1,
147
+ minWithdrawAmount: 1,
148
+ minTransferAmount: 1,
149
+ },
129
150
  ],
130
151
  [MoneyInOutChainId.ethereumMainnet]: [
131
152
  {
@@ -200,6 +221,17 @@ export const TOKEN_INFO: Record<ReyaChainId | MoneyInOutChainId, TokenInfo[]> =
200
221
  minWithdrawAmount: 0.0001,
201
222
  minTransferAmount: 0.0001,
202
223
  },
224
+ {
225
+ name: 'REYA',
226
+ address: '0xcc8e02d7112ddaa66a63b89d73e4eda65722b111',
227
+ decimals: 18,
228
+ isRUSDUnderlying: false,
229
+ whitelistedWalletOnly: true,
230
+ isOFT: true,
231
+ minDepositAmount: 1,
232
+ minWithdrawAmount: 1,
233
+ minTransferAmount: 1,
234
+ },
203
235
  ],
204
236
  [MoneyInOutChainId.opMainnet]: [
205
237
  {
@@ -447,6 +479,27 @@ export const TOKEN_INFO: Record<ReyaChainId | MoneyInOutChainId, TokenInfo[]> =
447
479
  isPoolToken: true,
448
480
  ...defaultTokenThresholds,
449
481
  },
482
+ {
483
+ name: 'REYA',
484
+ address: '0xbd96be24f68c5e616ff22ffc32715ffa1c4b70d0',
485
+ decimals: 18,
486
+ isRUSDUnderlying: false,
487
+ whitelistedWalletOnly: true,
488
+ isOFT: true,
489
+ minDepositAmount: 1,
490
+ minWithdrawAmount: 1,
491
+ minTransferAmount: 1,
492
+ },
493
+ {
494
+ name: 'SREYA',
495
+ address: '0xecab1c86ecf1100ad3aa7a2c175aede4c87e949b',
496
+ decimals: 18,
497
+ isRUSDUnderlying: false,
498
+ whitelistedWalletOnly: true,
499
+ minDepositAmount: 1,
500
+ minWithdrawAmount: 1,
501
+ minTransferAmount: 1,
502
+ },
450
503
  ],
451
504
  [MoneyInOutChainId.arbitrumSepolia]: [
452
505
  {
@@ -585,5 +638,16 @@ export const TOKEN_INFO: Record<ReyaChainId | MoneyInOutChainId, TokenInfo[]> =
585
638
  isElixirToken: true,
586
639
  ...defaultTokenThresholds,
587
640
  },
641
+ {
642
+ name: 'REYA',
643
+ address: '0x2998f96655f6c8814bec364c8ffdd3cd7dfc4b2e',
644
+ decimals: 18,
645
+ isRUSDUnderlying: false,
646
+ whitelistedWalletOnly: true,
647
+ isOFT: true,
648
+ minDepositAmount: 1,
649
+ minWithdrawAmount: 1,
650
+ minTransferAmount: 1,
651
+ },
588
652
  ],
589
653
  };