@reyaxyz/sdk 0.51.0 → 0.52.1
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/README.md +1 -1
- package/dist/abis/CoreProxy.json +5600 -0
- package/dist/abis/Periphery.json +380 -92
- package/dist/abis/socket/VaultWithPayload.json +6 -1
- package/dist/services/encode.js +2 -2
- package/dist/services/encode.js.map +1 -1
- package/dist/services/lp/bridgeAndDepositPassivePool.js +2 -2
- package/dist/services/lp/bridgeAndDepositPassivePool.js.map +1 -1
- package/dist/services/lp/encode.js +10 -6
- package/dist/services/lp/encode.js.map +1 -1
- package/dist/services/lp/transferFromMAToPool.js +1 -1
- package/dist/services/lp/transferFromMAToPool.js.map +1 -1
- package/dist/services/lp/types.js.map +1 -1
- package/dist/services/lp/withdrawPassivePoolAndBridge.js +2 -2
- package/dist/services/lp/withdrawPassivePoolAndBridge.js.map +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js +4 -9
- package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js.map +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositNewMA.js +2 -2
- package/dist/services/margin-accounts/bridgeAndDepositNewMA.js.map +1 -1
- package/dist/services/margin-accounts/encode.js +17 -12
- package/dist/services/margin-accounts/encode.js.map +1 -1
- package/dist/services/margin-accounts/withdrawMAAndBridge.js +1 -1
- package/dist/services/margin-accounts/withdrawMAAndBridge.js.map +1 -1
- package/dist/services/orders/encode.js +2 -2
- package/dist/services/orders/encode.js.map +1 -1
- package/dist/types/services/lp/bridgeAndDepositPassivePool.d.ts.map +1 -1
- package/dist/types/services/lp/encode.d.ts +3 -3
- package/dist/types/services/lp/encode.d.ts.map +1 -1
- package/dist/types/services/lp/transferFromMAToPool.d.ts.map +1 -1
- package/dist/types/services/lp/types.d.ts +1 -1
- package/dist/types/services/lp/types.d.ts.map +1 -1
- package/dist/types/services/lp/withdrawPassivePoolAndBridge.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/bridgeAndDepositExistingMA.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/bridgeAndDepositNewMA.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/encode.d.ts +3 -3
- package/dist/types/services/margin-accounts/encode.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/withdrawMAAndBridge.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/abis/CoreProxy.json +5394 -0
- package/src/abis/Periphery.json +380 -92
- package/src/abis/socket/VaultWithPayload.json +6 -1
- package/src/services/encode.ts +1 -1
- package/src/services/lp/bridgeAndDepositPassivePool.ts +2 -0
- package/src/services/lp/encode.ts +12 -3
- package/src/services/lp/transferFromMAToPool.ts +1 -0
- package/src/services/lp/types.ts +1 -1
- package/src/services/lp/withdrawPassivePoolAndBridge.ts +2 -0
- package/src/services/margin-accounts/bridgeAndDepositExistingMA.ts +2 -14
- package/src/services/margin-accounts/bridgeAndDepositNewMA.ts +2 -0
- package/src/services/margin-accounts/encode.ts +17 -9
- package/src/services/margin-accounts/withdrawMAAndBridge.ts +1 -0
- package/src/services/orders/encode.ts +1 -1
- package/dist/abis/AccountModule.json +0 -1079
- package/dist/abis/ExecutionModule.json +0 -758
- package/src/abis/AccountModule.json +0 -1079
- package/src/abis/ExecutionModule.json +0 -758
|
@@ -44,31 +44,36 @@ export const encodeTransferFromMAToPool = (
|
|
|
44
44
|
sig: EIP712Signature,
|
|
45
45
|
poolId: number,
|
|
46
46
|
minShares: bigint,
|
|
47
|
+
receiver: string,
|
|
47
48
|
): MethodParameters => {
|
|
48
49
|
const functionSignature = 'transferFromMAToPool';
|
|
49
|
-
const parameters = [{ accountId, amount, sig, poolId, minShares }];
|
|
50
|
+
const parameters = [{ accountId, amount, sig, poolId, minShares, receiver }];
|
|
50
51
|
const INTERFACE = new Interface(peripheryAbi);
|
|
51
52
|
const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
|
|
52
53
|
return { calldata: calldata, value: BigInt(0).toString(10) };
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
export const encodeWithdrawPassivePoolAndBridge = (
|
|
57
|
+
owner: string,
|
|
56
58
|
poolId: number,
|
|
57
59
|
sharesAmount: bigint,
|
|
58
60
|
minOut: bigint,
|
|
59
61
|
sig: EIP712Signature,
|
|
60
62
|
socketMsgGasLimit: bigint,
|
|
63
|
+
socketPayloadSize: bigint,
|
|
61
64
|
socketConnector: string,
|
|
62
65
|
receiver: string,
|
|
63
66
|
): MethodParameters => {
|
|
64
67
|
const functionSignature = 'withdrawPassivePool';
|
|
65
68
|
const parameters = [
|
|
66
69
|
{
|
|
70
|
+
owner,
|
|
67
71
|
poolId,
|
|
68
72
|
sharesAmount,
|
|
69
73
|
minOut,
|
|
70
74
|
sig,
|
|
71
75
|
socketMsgGasLimit,
|
|
76
|
+
socketPayloadSize,
|
|
72
77
|
socketConnector,
|
|
73
78
|
receiver,
|
|
74
79
|
},
|
|
@@ -82,6 +87,7 @@ export const encodeBridgeAndDepositPassivePool = (
|
|
|
82
87
|
receiver: string,
|
|
83
88
|
socketMsgGasLimit: bigint,
|
|
84
89
|
socketConnector: string,
|
|
90
|
+
socketBridgeOptions: string,
|
|
85
91
|
socketFees: bigint,
|
|
86
92
|
poolId: number,
|
|
87
93
|
owner: string,
|
|
@@ -89,25 +95,28 @@ export const encodeBridgeAndDepositPassivePool = (
|
|
|
89
95
|
minShares: bigint,
|
|
90
96
|
fallbackSocketMsgGasLimit: bigint,
|
|
91
97
|
fallbackSocketConnector: string,
|
|
98
|
+
fallbackSocketPayloadSize: bigint,
|
|
92
99
|
): MethodParameters => {
|
|
93
100
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
94
101
|
const inputs = { poolId, owner, amount, minShares };
|
|
95
102
|
const fallbackData = {
|
|
96
103
|
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
97
104
|
socketConnector: fallbackSocketConnector,
|
|
105
|
+
socketPayloadSize: fallbackSocketPayloadSize,
|
|
98
106
|
};
|
|
99
107
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
100
|
-
'depositPassivePool((uint128,address,uint256,uint256),(uint256,address))',
|
|
108
|
+
'depositPassivePool((uint128,address,uint256,uint256),(uint256,uint256,address))',
|
|
101
109
|
[inputs, fallbackData],
|
|
102
110
|
);
|
|
103
111
|
|
|
104
|
-
const functionSignature = '
|
|
112
|
+
const functionSignature = 'bridge';
|
|
105
113
|
const parameters = [
|
|
106
114
|
receiver,
|
|
107
115
|
amount,
|
|
108
116
|
socketMsgGasLimit,
|
|
109
117
|
socketConnector,
|
|
110
118
|
peripheryCalldata,
|
|
119
|
+
socketBridgeOptions,
|
|
111
120
|
];
|
|
112
121
|
const INTERFACE = new Interface(Socket_VaultWithPayloadAbi);
|
|
113
122
|
const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
|
package/src/services/lp/types.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type RemoveLiquidityResult = {
|
|
|
31
31
|
|
|
32
32
|
export type TransferFromMAToPoolParams = {
|
|
33
33
|
signer: Signer | JsonRpcSigner;
|
|
34
|
-
owner: Pick<OwnerMetadataEntity, 'coreSigNonce'>;
|
|
34
|
+
owner: Pick<OwnerMetadataEntity, 'coreSigNonce' | 'address'>;
|
|
35
35
|
marginAccountId: MarginAccountEntity['id'];
|
|
36
36
|
pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;
|
|
37
37
|
amount: number;
|
|
@@ -40,11 +40,13 @@ export const withdrawPassivePoolAndBridge = async (
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
const { calldata: data, value } = encodeWithdrawPassivePoolAndBridge(
|
|
43
|
+
params.owner.address,
|
|
43
44
|
params.pool.id,
|
|
44
45
|
sharesAmount,
|
|
45
46
|
BigInt(0),
|
|
46
47
|
eip712Signature,
|
|
47
48
|
BigInt('10000000'), //todo
|
|
49
|
+
BigInt(0),
|
|
48
50
|
getSocketConnectors({
|
|
49
51
|
moneyInOutChainId: params.moneyInOutChainId,
|
|
50
52
|
tokenName: 'USDC', // todo: this should not be hardcoded
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getCurrentTimestampInSeconds,
|
|
3
2
|
getSocketConnectors,
|
|
4
3
|
getSocketDepositFeesAsBigInt,
|
|
5
4
|
getSocketVault,
|
|
@@ -16,8 +15,6 @@ import {
|
|
|
16
15
|
BridgeAndDepositExistingMAParams,
|
|
17
16
|
BridgeAndDepositExistingMAResult,
|
|
18
17
|
} from './types';
|
|
19
|
-
import { signCoreCommands } from '../sign';
|
|
20
|
-
import { BRIDGE_DEADLINE_IN_SECONDS } from '../../utils/consts';
|
|
21
18
|
import { encodeSingleDeposit } from '../encode';
|
|
22
19
|
import { MultiAction } from '../../utils/action';
|
|
23
20
|
|
|
@@ -53,16 +50,6 @@ export const bridgeAndDepositExistingMA = async (
|
|
|
53
50
|
ContractType.PERIPHERY_PROXY,
|
|
54
51
|
);
|
|
55
52
|
|
|
56
|
-
const eip712Signature = await signCoreCommands(
|
|
57
|
-
params.signer,
|
|
58
|
-
reyaChainId,
|
|
59
|
-
peripheryAddress,
|
|
60
|
-
params.marginAccountId,
|
|
61
|
-
multiAction.commands,
|
|
62
|
-
params.owner.coreSigNonce + 1,
|
|
63
|
-
getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,
|
|
64
|
-
);
|
|
65
|
-
|
|
66
53
|
const socketConnectors = getSocketConnectors({
|
|
67
54
|
moneyInOutChainId: moneyInOutChainId,
|
|
68
55
|
tokenName: moneyInOutTokenInfo.name,
|
|
@@ -72,16 +59,17 @@ export const bridgeAndDepositExistingMA = async (
|
|
|
72
59
|
peripheryAddress,
|
|
73
60
|
BigInt('10000000'),
|
|
74
61
|
socketConnectors.deposit,
|
|
62
|
+
'0x',
|
|
75
63
|
getSocketDepositFeesAsBigInt({
|
|
76
64
|
moneyInOutChainId: moneyInOutChainId,
|
|
77
65
|
}),
|
|
78
66
|
params.marginAccountId,
|
|
79
67
|
reyaPeripheryTokenInfo.address,
|
|
80
68
|
scale(reyaPeripheryTokenInfo.decimals)(params.amount),
|
|
81
|
-
eip712Signature,
|
|
82
69
|
scale(moneyInOutTokenInfo.decimals)(params.amount),
|
|
83
70
|
BigInt('10000000'),
|
|
84
71
|
socketConnectors.withdraw,
|
|
72
|
+
BigInt(0),
|
|
85
73
|
);
|
|
86
74
|
|
|
87
75
|
const result = await executeTransaction(
|
|
@@ -41,6 +41,7 @@ export const bridgeAndDepositNewMA = async (
|
|
|
41
41
|
getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),
|
|
42
42
|
BigInt('10000000'),
|
|
43
43
|
socketConnectors.deposit,
|
|
44
|
+
'0x',
|
|
44
45
|
getSocketDepositFeesAsBigInt({
|
|
45
46
|
moneyInOutChainId: moneyInOutChainId,
|
|
46
47
|
}),
|
|
@@ -50,6 +51,7 @@ export const bridgeAndDepositNewMA = async (
|
|
|
50
51
|
scale(moneyInOutTokenInfo.decimals)(params.amount),
|
|
51
52
|
BigInt('10000000'),
|
|
52
53
|
socketConnectors.withdraw,
|
|
54
|
+
BigInt(0),
|
|
53
55
|
);
|
|
54
56
|
|
|
55
57
|
const result = await executeTransaction(
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
encodeSingleWithdraw,
|
|
8
8
|
} from '../encode';
|
|
9
9
|
|
|
10
|
-
import { abi } from '../../abis/
|
|
11
|
-
import { abi as coreAbi } from '../../abis/
|
|
10
|
+
import { abi } from '../../abis/CoreProxy.json';
|
|
11
|
+
import { abi as coreAbi } from '../../abis/CoreProxy.json';
|
|
12
12
|
import { abi as peripheryAbi } from '../../abis/Periphery.json';
|
|
13
13
|
import { abi as Socket_VaultWithPayloadAbi } from '../../abis/socket/VaultWithPayload.json';
|
|
14
14
|
import { EIP712Signature, signCoreCommands } from '../sign';
|
|
@@ -70,7 +70,7 @@ export const encodeTransferMargin = async (
|
|
|
70
70
|
amount: bigint,
|
|
71
71
|
): Promise<MethodParameters> => {
|
|
72
72
|
const multiAction = new MultiAction();
|
|
73
|
-
|
|
73
|
+
// todo: note can we make this more stateless?
|
|
74
74
|
encodeSingleTransferMargin(toMarginAccountId, token, amount, multiAction);
|
|
75
75
|
|
|
76
76
|
const eip712Signature = await signCoreCommands(
|
|
@@ -105,6 +105,7 @@ export const encodeWithdrawMAAndBridge = (
|
|
|
105
105
|
corePeripheryTokenAmount: bigint,
|
|
106
106
|
sig: EIP712Signature,
|
|
107
107
|
socketMsgGasLimit: bigint,
|
|
108
|
+
socketPayloadSize: bigint,
|
|
108
109
|
socketConnector: string,
|
|
109
110
|
receiver: string,
|
|
110
111
|
): MethodParameters => {
|
|
@@ -116,6 +117,7 @@ export const encodeWithdrawMAAndBridge = (
|
|
|
116
117
|
tokenAmount: corePeripheryTokenAmount,
|
|
117
118
|
sig,
|
|
118
119
|
socketMsgGasLimit,
|
|
120
|
+
socketPayloadSize,
|
|
119
121
|
socketConnector,
|
|
120
122
|
receiver,
|
|
121
123
|
},
|
|
@@ -129,6 +131,7 @@ export const encodeBridgeAndDepositNewMA = (
|
|
|
129
131
|
receiver: string,
|
|
130
132
|
socketMsgGasLimit: bigint,
|
|
131
133
|
socketConnector: string,
|
|
134
|
+
socketBridgeOptions: string,
|
|
132
135
|
socketFees: bigint,
|
|
133
136
|
accountOwner: string,
|
|
134
137
|
peripheryTokenAddress: string,
|
|
@@ -136,6 +139,7 @@ export const encodeBridgeAndDepositNewMA = (
|
|
|
136
139
|
moneyInOutTokenAmount: bigint,
|
|
137
140
|
fallbackSocketMsgGasLimit: bigint,
|
|
138
141
|
fallbackSocketConnector: string,
|
|
142
|
+
fallbackSocketPayloadSize: bigint,
|
|
139
143
|
): MethodParameters => {
|
|
140
144
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
141
145
|
const inputs = {
|
|
@@ -146,19 +150,21 @@ export const encodeBridgeAndDepositNewMA = (
|
|
|
146
150
|
const fallbackData = {
|
|
147
151
|
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
148
152
|
socketConnector: fallbackSocketConnector,
|
|
153
|
+
socketPayloadSize: fallbackSocketPayloadSize,
|
|
149
154
|
};
|
|
150
155
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
151
|
-
'depositNewMA((address,address,uint256),(uint256,address))',
|
|
156
|
+
'depositNewMA((address,address,uint256),(uint256,uint256,address))',
|
|
152
157
|
[inputs, fallbackData],
|
|
153
158
|
);
|
|
154
159
|
|
|
155
|
-
const functionSignature = '
|
|
160
|
+
const functionSignature = 'bridge';
|
|
156
161
|
const parameters = [
|
|
157
162
|
receiver,
|
|
158
163
|
moneyInOutTokenAmount,
|
|
159
164
|
socketMsgGasLimit,
|
|
160
165
|
socketConnector,
|
|
161
166
|
peripheryCalldata,
|
|
167
|
+
socketBridgeOptions,
|
|
162
168
|
];
|
|
163
169
|
const INTERFACE = new Interface(Socket_VaultWithPayloadAbi);
|
|
164
170
|
const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
|
|
@@ -169,38 +175,40 @@ export const encodeBridgeAndDepositExistingMA = (
|
|
|
169
175
|
receiver: string,
|
|
170
176
|
socketMsgGasLimit: bigint,
|
|
171
177
|
socketConnector: string,
|
|
178
|
+
socketBridgeOptions: string,
|
|
172
179
|
socketFees: bigint,
|
|
173
180
|
accountId: number,
|
|
174
181
|
peripheryTokenAddress: string,
|
|
175
182
|
peripheryTokenAmount: bigint,
|
|
176
|
-
sig: EIP712Signature,
|
|
177
183
|
moneyInOutTokenAmount: bigint,
|
|
178
184
|
fallbackSocketMsgGasLimit: bigint,
|
|
179
185
|
fallbackSocketConnector: string,
|
|
186
|
+
fallbackSocketPayloadSize: bigint,
|
|
180
187
|
): MethodParameters => {
|
|
181
188
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
182
189
|
const inputs = {
|
|
183
190
|
accountId,
|
|
184
191
|
token: peripheryTokenAddress,
|
|
185
192
|
tokenAmount: peripheryTokenAmount,
|
|
186
|
-
sig,
|
|
187
193
|
};
|
|
188
194
|
const fallbackData = {
|
|
189
195
|
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
190
196
|
socketConnector: fallbackSocketConnector,
|
|
197
|
+
socketPayloadSize: fallbackSocketPayloadSize,
|
|
191
198
|
};
|
|
192
199
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
193
|
-
'depositExistingMA((uint128,address,uint256,(
|
|
200
|
+
'depositExistingMA((uint128,address,uint256),(uint256,uint256,address))',
|
|
194
201
|
[inputs, fallbackData],
|
|
195
202
|
);
|
|
196
203
|
|
|
197
|
-
const functionSignature = '
|
|
204
|
+
const functionSignature = 'bridge';
|
|
198
205
|
const parameters = [
|
|
199
206
|
receiver,
|
|
200
207
|
moneyInOutTokenAmount,
|
|
201
208
|
socketMsgGasLimit,
|
|
202
209
|
socketConnector,
|
|
203
210
|
peripheryCalldata,
|
|
211
|
+
socketBridgeOptions,
|
|
204
212
|
];
|
|
205
213
|
const INTERFACE = new Interface(Socket_VaultWithPayloadAbi);
|
|
206
214
|
const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
|
|
@@ -4,7 +4,7 @@ import { signCoreCommands } from '../sign';
|
|
|
4
4
|
import { getCurrentTimestampInSeconds } from '@reyaxyz/common';
|
|
5
5
|
import { CORE_DEADLINE_IN_SECONDS, RELAYER_ACCOUNT } from '../../utils/consts';
|
|
6
6
|
import { Interface, Signer } from 'ethers';
|
|
7
|
-
import { abi } from '../../abis/
|
|
7
|
+
import { abi } from '../../abis/CoreProxy.json';
|
|
8
8
|
export const encodeMatchOrder = async (
|
|
9
9
|
signer: Signer,
|
|
10
10
|
chainId: number,
|