@mimicprotocol/sdk 0.0.1 → 0.0.2-rc.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/dist/axia/ProposalSigner.d.ts +1 -1
- package/dist/axia/ProposalSigner.d.ts.map +1 -1
- package/dist/axia/validators.d.ts +556 -293
- package/dist/axia/validators.d.ts.map +1 -1
- package/dist/axia/validators.js +8 -4
- package/dist/axia/validators.js.map +1 -1
- package/dist/client/domains/IntentsClient.d.ts +34 -27
- package/dist/client/domains/IntentsClient.d.ts.map +1 -1
- package/dist/client/domains/IntentsClient.js +35 -24
- package/dist/client/domains/IntentsClient.js.map +1 -1
- package/dist/registry/TriggerSigner.d.ts +2 -2
- package/dist/registry/TriggerSigner.d.ts.map +1 -1
- package/dist/registry/TriggerSigner.js +4 -4
- package/dist/registry/TriggerSigner.js.map +1 -1
- package/dist/registry/validators.d.ts +4 -4
- package/dist/relayer/eip712Types.d.ts +5 -1
- package/dist/relayer/eip712Types.d.ts.map +1 -1
- package/dist/relayer/validators.d.ts +1985 -1530
- package/dist/relayer/validators.d.ts.map +1 -1
- package/dist/relayer/validators.js +1 -6
- package/dist/relayer/validators.js.map +1 -1
- package/dist/runner/validators.d.ts +4 -4
- package/dist/settler/svm/Settler.d.ts +2 -2
- package/dist/settler/svm/Settler.d.ts.map +1 -1
- package/dist/settler/svm/Settler.js +13 -13
- package/dist/settler/svm/Settler.js.map +1 -1
- package/dist/settler/svm/types.d.ts +4 -4
- package/dist/settler/svm/types.d.ts.map +1 -1
- package/dist/shared/codec/chains/evm.d.ts +9 -7
- package/dist/shared/codec/chains/evm.d.ts.map +1 -1
- package/dist/shared/codec/chains/evm.js +88 -41
- package/dist/shared/codec/chains/evm.js.map +1 -1
- package/dist/shared/codec/chains/svm.d.ts +12 -11
- package/dist/shared/codec/chains/svm.d.ts.map +1 -1
- package/dist/shared/codec/chains/svm.js +68 -48
- package/dist/shared/codec/chains/svm.js.map +1 -1
- package/dist/shared/codec/decoder.d.ts +13 -7
- package/dist/shared/codec/decoder.d.ts.map +1 -1
- package/dist/shared/codec/decoder.js +42 -26
- package/dist/shared/codec/decoder.js.map +1 -1
- package/dist/shared/codec/encoder.d.ts +53 -49
- package/dist/shared/codec/encoder.d.ts.map +1 -1
- package/dist/shared/codec/encoder.js +58 -24
- package/dist/shared/codec/encoder.js.map +1 -1
- package/dist/shared/codec/index.d.ts +1 -1
- package/dist/shared/codec/index.d.ts.map +1 -1
- package/dist/shared/codec/index.js +5 -5
- package/dist/shared/codec/index.js.map +1 -1
- package/dist/shared/eip712Types/index.d.ts +12 -5
- package/dist/shared/eip712Types/index.d.ts.map +1 -1
- package/dist/shared/eip712Types/index.js +24 -16
- package/dist/shared/eip712Types/index.js.map +1 -1
- package/dist/shared/types/intents.d.ts +23 -16
- package/dist/shared/types/intents.d.ts.map +1 -1
- package/dist/shared/validators/executions.d.ts +6 -6
- package/dist/shared/validators/intents.d.ts +1453 -275
- package/dist/shared/validators/intents.d.ts.map +1 -1
- package/dist/shared/validators/intents.js +68 -28
- package/dist/shared/validators/intents.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SVM_INTENT_SCHEMA = exports.
|
|
3
|
+
exports.SVM_INTENT_SCHEMA = exports.SVM_OPERATION_SCHEMA = exports.SVM_OPERATION_EVENT_SCHEMA = exports.SVM_MAX_FEE_SCHEMA = exports.SVM_CALL_OPERATION_DATA_SCHEMA = exports.SVM_CALL_INSTRUCTION_DATA_SCHEMA = exports.SVM_ACCOUNTS_META_SCHEMA = exports.SVM_SWAP_OPERATION_DATA_SCHEMA = exports.SVM_TOKEN_OUT_SCHEMA = exports.SVM_TOKEN_IN_SCHEMA = exports.SVM_TRANSFER_OPERATION_DATA_SCHEMA = exports.SVM_TRANSFER_SCHEMA = exports.SVM_UINT8_ARRAY_SCHEMA = void 0;
|
|
4
4
|
exports.svmEncodeIntent = svmEncodeIntent;
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
5
|
+
exports.svmEncodeTransferOperation = svmEncodeTransferOperation;
|
|
6
|
+
exports.svmDecodeTransferOperation = svmDecodeTransferOperation;
|
|
7
|
+
exports.svmEncodeSwapOperation = svmEncodeSwapOperation;
|
|
8
|
+
exports.svmDecodeSwapOperation = svmDecodeSwapOperation;
|
|
9
|
+
exports.svmEncodeCallOperation = svmEncodeCallOperation;
|
|
10
|
+
exports.svmDecodeCallOperation = svmDecodeCallOperation;
|
|
11
11
|
const borsh_1 = require("borsh");
|
|
12
12
|
const ethers_1 = require("ethers");
|
|
13
13
|
const utils_1 = require("../../utils");
|
|
@@ -19,7 +19,7 @@ exports.SVM_TRANSFER_SCHEMA = {
|
|
|
19
19
|
recipient: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
exports.
|
|
22
|
+
exports.SVM_TRANSFER_OPERATION_DATA_SCHEMA = {
|
|
23
23
|
struct: {
|
|
24
24
|
chainId: 'u32',
|
|
25
25
|
transfers: {
|
|
@@ -42,7 +42,7 @@ exports.SVM_TOKEN_OUT_SCHEMA = {
|
|
|
42
42
|
minAmount: 'u64',
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
|
-
exports.
|
|
45
|
+
exports.SVM_SWAP_OPERATION_DATA_SCHEMA = {
|
|
46
46
|
struct: {
|
|
47
47
|
sourceChain: 'u32',
|
|
48
48
|
destinationChain: 'u32',
|
|
@@ -76,7 +76,7 @@ exports.SVM_CALL_INSTRUCTION_DATA_SCHEMA = {
|
|
|
76
76
|
data: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
|
-
exports.
|
|
79
|
+
exports.SVM_CALL_OPERATION_DATA_SCHEMA = {
|
|
80
80
|
struct: {
|
|
81
81
|
instructions: {
|
|
82
82
|
array: {
|
|
@@ -91,24 +91,30 @@ exports.SVM_MAX_FEE_SCHEMA = {
|
|
|
91
91
|
amount: 'u64',
|
|
92
92
|
},
|
|
93
93
|
};
|
|
94
|
-
exports.
|
|
94
|
+
exports.SVM_OPERATION_EVENT_SCHEMA = {
|
|
95
95
|
struct: {
|
|
96
96
|
topic: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
97
97
|
data: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
98
98
|
},
|
|
99
99
|
};
|
|
100
|
-
exports.
|
|
100
|
+
exports.SVM_OPERATION_SCHEMA = {
|
|
101
101
|
struct: {
|
|
102
|
-
|
|
102
|
+
opType: 'u8',
|
|
103
103
|
user: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
104
|
+
data: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
105
|
+
events: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
exports.SVM_INTENT_SCHEMA = {
|
|
109
|
+
struct: {
|
|
110
|
+
feePayer: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
104
111
|
settler: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
105
112
|
nonce: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
106
113
|
deadline: 'u64',
|
|
107
|
-
data: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
108
114
|
maxFees: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
109
|
-
|
|
110
|
-
configSig: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
115
|
+
triggerSig: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
111
116
|
minValidations: 'u64',
|
|
117
|
+
operations: exports.SVM_UINT8_ARRAY_SCHEMA,
|
|
112
118
|
},
|
|
113
119
|
};
|
|
114
120
|
function borshSerialize(schema, value) {
|
|
@@ -119,16 +125,16 @@ function borshDeserialize(schema, data) {
|
|
|
119
125
|
}
|
|
120
126
|
function svmEncodeIntent(intent) {
|
|
121
127
|
const maxFeesHash = (0, ethers_1.keccak256)(svmEncodeMaxFees(intent.maxFees));
|
|
122
|
-
const
|
|
128
|
+
const operationsHash = (0, ethers_1.keccak256)(svmEncodeOperations(intent.operations));
|
|
123
129
|
const data = {
|
|
124
|
-
|
|
125
|
-
maxFees: (0, utils_1.hexToBytes)(maxFeesHash),
|
|
126
|
-
events: (0, utils_1.hexToBytes)(eventsHash),
|
|
127
|
-
user: (0, utils_1.svmAddressToBytes)(intent.user),
|
|
130
|
+
feePayer: (0, utils_1.svmAddressToBytes)(intent.feePayer),
|
|
128
131
|
settler: (0, utils_1.svmAddressToBytes)(intent.settler),
|
|
129
132
|
nonce: (0, utils_1.hexToBytes)(intent.nonce),
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
deadline: intent.deadline,
|
|
134
|
+
maxFees: (0, utils_1.hexToBytes)(maxFeesHash),
|
|
135
|
+
triggerSig: (0, utils_1.hexToBytes)(intent.triggerSig),
|
|
136
|
+
minValidations: intent.minValidations,
|
|
137
|
+
operations: (0, utils_1.hexToBytes)(operationsHash),
|
|
132
138
|
};
|
|
133
139
|
return borshSerialize(exports.SVM_INTENT_SCHEMA, data);
|
|
134
140
|
}
|
|
@@ -140,29 +146,43 @@ function svmEncodeMaxFee(maxFee) {
|
|
|
140
146
|
const data = { ...maxFee, token: (0, utils_1.svmAddressToBytes)(maxFee.token) };
|
|
141
147
|
return borshSerialize(exports.SVM_MAX_FEE_SCHEMA, data);
|
|
142
148
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
149
|
+
function svmEncodeOperations(operations) {
|
|
150
|
+
const operationsHashes = operations.map((operation) => (0, ethers_1.keccak256)(svmEncodeOperation(operation)));
|
|
151
|
+
return '0x' + operationsHashes.map((hash) => hash.slice(2)).join('');
|
|
152
|
+
}
|
|
153
|
+
function svmEncodeOperation(operation) {
|
|
154
|
+
const eventsHash = (0, ethers_1.keccak256)(svmEncodeOperationEvents(operation.events));
|
|
155
|
+
const data = {
|
|
156
|
+
opType: operation.opType,
|
|
157
|
+
user: (0, utils_1.svmAddressToBytes)(operation.user),
|
|
158
|
+
data: (0, utils_1.hexToBytes)((0, ethers_1.keccak256)(operation.data)),
|
|
159
|
+
events: (0, utils_1.hexToBytes)(eventsHash),
|
|
160
|
+
};
|
|
161
|
+
return borshSerialize(exports.SVM_OPERATION_SCHEMA, data);
|
|
162
|
+
}
|
|
163
|
+
function svmEncodeOperationEvents(events) {
|
|
164
|
+
const eventsHashes = events.map((event) => (0, ethers_1.keccak256)(svmEncodeOperationEvent(event)));
|
|
145
165
|
return '0x' + eventsHashes.map((hash) => hash.slice(2)).join('');
|
|
146
166
|
}
|
|
147
|
-
function
|
|
167
|
+
function svmEncodeOperationEvent(event) {
|
|
148
168
|
const data = { topic: (0, utils_1.hexToBytes)(event.topic), data: (0, utils_1.hexToBytes)((0, ethers_1.keccak256)(event.data)) };
|
|
149
|
-
return borshSerialize(exports.
|
|
169
|
+
return borshSerialize(exports.SVM_OPERATION_EVENT_SCHEMA, data);
|
|
150
170
|
}
|
|
151
|
-
function
|
|
171
|
+
function svmEncodeTransferOperation(operation) {
|
|
152
172
|
const data = {
|
|
153
|
-
...
|
|
154
|
-
transfers:
|
|
173
|
+
...operation,
|
|
174
|
+
transfers: operation.transfers.map((transfer) => ({
|
|
155
175
|
...transfer,
|
|
156
176
|
token: (0, utils_1.svmAddressToBytes)(transfer.token),
|
|
157
177
|
recipient: (0, utils_1.svmAddressToBytes)(transfer.recipient),
|
|
158
178
|
})),
|
|
159
179
|
};
|
|
160
|
-
return borshSerialize(exports.
|
|
180
|
+
return borshSerialize(exports.SVM_TRANSFER_OPERATION_DATA_SCHEMA, data);
|
|
161
181
|
}
|
|
162
|
-
function
|
|
163
|
-
const { chainId, transfers } = borshDeserialize(exports.
|
|
182
|
+
function svmDecodeTransferOperation(operation) {
|
|
183
|
+
const { chainId, transfers } = borshDeserialize(exports.SVM_TRANSFER_OPERATION_DATA_SCHEMA, operation.data);
|
|
164
184
|
return {
|
|
165
|
-
...
|
|
185
|
+
...operation,
|
|
166
186
|
chainId,
|
|
167
187
|
transfers: transfers.map(({ token, amount, recipient }) => ({
|
|
168
188
|
token: (0, utils_1.bytesToSvmAddress)(token),
|
|
@@ -171,25 +191,25 @@ function svmDecodeTransferIntent(intent) {
|
|
|
171
191
|
})),
|
|
172
192
|
};
|
|
173
193
|
}
|
|
174
|
-
function
|
|
194
|
+
function svmEncodeSwapOperation(operation) {
|
|
175
195
|
const data = {
|
|
176
|
-
...
|
|
177
|
-
tokensIn:
|
|
196
|
+
...operation,
|
|
197
|
+
tokensIn: operation.tokensIn.map((tokenIn) => ({
|
|
178
198
|
...tokenIn,
|
|
179
199
|
token: (0, utils_1.svmAddressToBytes)(tokenIn.token),
|
|
180
200
|
})),
|
|
181
|
-
tokensOut:
|
|
201
|
+
tokensOut: operation.tokensOut.map((tokenOut) => ({
|
|
182
202
|
...tokenOut,
|
|
183
203
|
token: (0, utils_1.svmAddressToBytes)(tokenOut.token),
|
|
184
204
|
recipient: (0, utils_1.svmAddressToBytes)(tokenOut.recipient),
|
|
185
205
|
})),
|
|
186
206
|
};
|
|
187
|
-
return borshSerialize(exports.
|
|
207
|
+
return borshSerialize(exports.SVM_SWAP_OPERATION_DATA_SCHEMA, data);
|
|
188
208
|
}
|
|
189
|
-
function
|
|
190
|
-
const { sourceChain, destinationChain, tokensIn, tokensOut } = borshDeserialize(exports.
|
|
209
|
+
function svmDecodeSwapOperation(operation) {
|
|
210
|
+
const { sourceChain, destinationChain, tokensIn, tokensOut } = borshDeserialize(exports.SVM_SWAP_OPERATION_DATA_SCHEMA, operation.data);
|
|
191
211
|
return {
|
|
192
|
-
...
|
|
212
|
+
...operation,
|
|
193
213
|
sourceChain,
|
|
194
214
|
destinationChain,
|
|
195
215
|
tokensIn: tokensIn.map((tokenIn) => ({
|
|
@@ -203,9 +223,9 @@ function svmDecodeSwapIntent(intent) {
|
|
|
203
223
|
})),
|
|
204
224
|
};
|
|
205
225
|
}
|
|
206
|
-
function
|
|
226
|
+
function svmEncodeCallOperation(operation) {
|
|
207
227
|
const data = {
|
|
208
|
-
instructions:
|
|
228
|
+
instructions: operation.instructions.map((instruction) => ({
|
|
209
229
|
programId: (0, utils_1.svmAddressToBytes)(instruction.programId),
|
|
210
230
|
accountsMeta: instruction.accountsMeta.map((accountMeta) => ({
|
|
211
231
|
...accountMeta,
|
|
@@ -214,12 +234,12 @@ function svmEncodeCallIntent(intent) {
|
|
|
214
234
|
data: (0, utils_1.hexToBytes)(instruction.data),
|
|
215
235
|
})),
|
|
216
236
|
};
|
|
217
|
-
return borshSerialize(exports.
|
|
237
|
+
return borshSerialize(exports.SVM_CALL_OPERATION_DATA_SCHEMA, data);
|
|
218
238
|
}
|
|
219
|
-
function
|
|
220
|
-
const { instructions } = borshDeserialize(exports.
|
|
239
|
+
function svmDecodeCallOperation(operation) {
|
|
240
|
+
const { instructions } = borshDeserialize(exports.SVM_CALL_OPERATION_DATA_SCHEMA, operation.data);
|
|
221
241
|
return {
|
|
222
|
-
...
|
|
242
|
+
...operation,
|
|
223
243
|
instructions: instructions.map((instruction) => ({
|
|
224
244
|
programId: (0, utils_1.bytesToSvmAddress)(instruction.programId),
|
|
225
245
|
accountsMeta: instruction.accountsMeta.map((accountMeta) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svm.js","sourceRoot":"","sources":["../../../../src/shared/codec/chains/svm.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"svm.js","sourceRoot":"","sources":["../../../../src/shared/codec/chains/svm.ts"],"names":[],"mappings":";;;AAgJA,0CAcC;AAsCD,gEAUC;AAED,gEAeC;AAED,wDAcC;AAED,wDAoBC;AAED,wDAaC;AAED,wDAcC;AApSD,iCAAsD;AACtD,mCAAkC;AAclC,uCAA0F;AAE7E,QAAA,sBAAsB,GAAW,EAAE,KAAK,EAAE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A,yBAAiB,EAAC,WAAW,CAAC,SAAS,CAAC;YACnD,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBAC3D,GAAG,WAAW;gBACd,MAAM,EAAE,IAAA,yBAAiB,EAAC,WAAW,CAAC,MAAM,CAAC;aAC9C,CAAC,CAAC;YACH,IAAI,EAAE,IAAA,kBAAU,EAAC,WAAW,CAAC,IAAI,CAAC;SACnC,CAAC,CAAC;KACJ,CAAA;IAED,OAAO,cAAc,CAAC,sCAA8B,EAAE,IAAI,CAAC,CAAA;AAC7D,CAAC;AAED,SAAgB,sBAAsB,CAAC,SAAoB;IACzD,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB,CAAuB,sCAA8B,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAE/G,OAAO;QACL,GAAG,SAAS;QACZ,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAC/C,SAAS,EAAE,IAAA,yBAAiB,EAAC,WAAW,CAAC,SAAkC,CAAC;YAC5E,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBAC3D,GAAG,WAAW;gBACd,MAAM,EAAE,IAAA,yBAAiB,EAAC,WAAW,CAAC,MAA+B,CAAC;aACvE,CAAC,CAAC;YACH,IAAI,EAAE,IAAA,kBAAU,EAAC,WAAW,CAAC,IAA6B,CAAC;SAC5D,CAAC,CAAC;KACJ,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { CronExecutionData, EventExecutionData,
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export declare function
|
|
1
|
+
import { CronExecutionData, EventExecutionData, EvmCallOperation, EvmDynamicCallOperation, Intent, OnceExecutionData, Operation, Proposal, SvmCallOperation, SwapOperation, SwapProposal, TransferOperation } from '../types';
|
|
2
|
+
export declare const ChainSide: {
|
|
3
|
+
readonly Source: "source";
|
|
4
|
+
readonly Destination: "destination";
|
|
5
|
+
};
|
|
6
|
+
export type ChainSide = (typeof ChainSide)[keyof typeof ChainSide];
|
|
7
|
+
export declare function decodeSwapOperation(operation: Operation): SwapOperation;
|
|
8
|
+
export declare function decodeSwapProposal(proposal: Proposal, index: number): SwapProposal;
|
|
9
|
+
export declare function decodeTransferOperation(operation: Operation): TransferOperation;
|
|
10
|
+
export declare function decodeEvmCallOperation(operation: Operation): EvmCallOperation;
|
|
11
|
+
export declare function decodeEvmDynamicCallOperation(operation: Operation): EvmDynamicCallOperation;
|
|
12
|
+
export declare function decodeSvmCallOperation(operation: Operation): SvmCallOperation;
|
|
13
|
+
export declare function getChainId(intentOrOperation: Intent | Operation, side?: ChainSide): number;
|
|
8
14
|
export declare function decodeCronExecution(data: string): CronExecutionData;
|
|
9
15
|
export declare function decodeEventExecution(data: string): EventExecutionData;
|
|
10
16
|
export declare function decodeOnceExecution(data: string): OnceExecutionData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../src/shared/codec/decoder.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../src/shared/codec/decoder.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAYjB,eAAO,MAAM,SAAS;;;CAGZ,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAElE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa,CAIvE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CASlF;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,iBAAiB,CAM/E;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAE7E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,SAAS,GAAG,uBAAuB,CAE3F;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAE7E;AAED,wBAAgB,UAAU,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,GAAE,SAA4B,GAAG,MAAM,CAY5G;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAGnE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAWrE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAGnE"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ChainSide = void 0;
|
|
4
|
+
exports.decodeSwapOperation = decodeSwapOperation;
|
|
4
5
|
exports.decodeSwapProposal = decodeSwapProposal;
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
6
|
+
exports.decodeTransferOperation = decodeTransferOperation;
|
|
7
|
+
exports.decodeEvmCallOperation = decodeEvmCallOperation;
|
|
8
|
+
exports.decodeEvmDynamicCallOperation = decodeEvmDynamicCallOperation;
|
|
9
|
+
exports.decodeSvmCallOperation = decodeSvmCallOperation;
|
|
8
10
|
exports.getChainId = getChainId;
|
|
9
11
|
exports.decodeCronExecution = decodeCronExecution;
|
|
10
12
|
exports.decodeEventExecution = decodeEventExecution;
|
|
@@ -15,13 +17,17 @@ const utils_1 = require("../utils");
|
|
|
15
17
|
const validators_1 = require("../validators");
|
|
16
18
|
const evm_1 = require("./chains/evm");
|
|
17
19
|
const svm_1 = require("./chains/svm");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
exports.ChainSide = {
|
|
21
|
+
Source: 'source',
|
|
22
|
+
Destination: 'destination',
|
|
23
|
+
};
|
|
24
|
+
function decodeSwapOperation(operation) {
|
|
25
|
+
const isEvmUser = (0, ethers_1.isHexString)(operation.user);
|
|
26
|
+
const decoded = isEvmUser ? (0, evm_1.evmDecodeSwapOperation)(operation) : (0, svm_1.svmDecodeSwapOperation)(operation);
|
|
21
27
|
return decoded;
|
|
22
28
|
}
|
|
23
|
-
function decodeSwapProposal(proposal) {
|
|
24
|
-
const [decoded] = ethers_1.AbiCoder.defaultAbiCoder().decode([eip712Types_1.SWAP_PROPOSAL_ABI_TYPE], proposal.
|
|
29
|
+
function decodeSwapProposal(proposal, index) {
|
|
30
|
+
const [decoded] = ethers_1.AbiCoder.defaultAbiCoder().decode([eip712Types_1.SWAP_PROPOSAL_ABI_TYPE], proposal.datas[index]);
|
|
25
31
|
const [executor, executorData, amountsOut] = decoded;
|
|
26
32
|
return {
|
|
27
33
|
...proposal,
|
|
@@ -30,29 +36,39 @@ function decodeSwapProposal(proposal) {
|
|
|
30
36
|
amountsOut: amountsOut.map((amountOut) => amountOut.toString()),
|
|
31
37
|
};
|
|
32
38
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
const decoded =
|
|
39
|
+
function decodeTransferOperation(operation) {
|
|
40
|
+
const isEvmUser = (0, ethers_1.isHexString)(operation.user);
|
|
41
|
+
const decoded = isEvmUser ? (0, evm_1.evmDecodeTransferOperation)(operation) : (0, svm_1.svmDecodeTransferOperation)(operation);
|
|
36
42
|
if (!Object.values(utils_1.Chains).includes(decoded.chainId))
|
|
37
|
-
throw new Error(`Failed to decode
|
|
43
|
+
throw new Error(`Failed to decode operation: ${JSON.stringify(operation)}`);
|
|
38
44
|
return decoded;
|
|
39
45
|
}
|
|
40
|
-
function
|
|
41
|
-
return (0, evm_1.
|
|
46
|
+
function decodeEvmCallOperation(operation) {
|
|
47
|
+
return (0, evm_1.evmDecodeCallOperation)(operation);
|
|
42
48
|
}
|
|
43
|
-
function
|
|
44
|
-
return (0,
|
|
49
|
+
function decodeEvmDynamicCallOperation(operation) {
|
|
50
|
+
return (0, evm_1.evmDecodeDynamicCallOperation)(operation);
|
|
45
51
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
53
|
-
if (
|
|
52
|
+
function decodeSvmCallOperation(operation) {
|
|
53
|
+
return (0, svm_1.svmDecodeCallOperation)(operation);
|
|
54
|
+
}
|
|
55
|
+
function getChainId(intentOrOperation, side = exports.ChainSide.Source) {
|
|
56
|
+
const operation = 'operations' in intentOrOperation ? intentOrOperation.operations[0] : intentOrOperation;
|
|
57
|
+
if (operation.opType === validators_1.OpType.Swap)
|
|
58
|
+
return decodeSwapOperation(operation).sourceChain;
|
|
59
|
+
if (operation.opType === validators_1.OpType.Transfer)
|
|
60
|
+
return decodeTransferOperation(operation).chainId;
|
|
61
|
+
if (operation.opType === validators_1.OpType.EvmCall)
|
|
62
|
+
return decodeEvmCallOperation(operation).chainId;
|
|
63
|
+
if (operation.opType === validators_1.OpType.EvmDynamicCall)
|
|
64
|
+
return decodeEvmDynamicCallOperation(operation).chainId;
|
|
65
|
+
if (operation.opType === validators_1.OpType.SvmCall)
|
|
54
66
|
return utils_1.Chains.Solana;
|
|
55
|
-
|
|
67
|
+
if (operation.opType === validators_1.OpType.CrossChainSwap) {
|
|
68
|
+
const { sourceChain, destinationChain } = decodeSwapOperation(operation);
|
|
69
|
+
return side === exports.ChainSide.Source ? sourceChain : destinationChain;
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`Unsupported operation opType: ${operation.opType}`);
|
|
56
72
|
}
|
|
57
73
|
function decodeCronExecution(data) {
|
|
58
74
|
const [decoded] = ethers_1.AbiCoder.defaultAbiCoder().decode([eip712Types_1.CRON_EXECUTION_ABI_TYPE], data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../../src/shared/codec/decoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../../src/shared/codec/decoder.ts"],"names":[],"mappings":";;;AAuCA,kDAIC;AAED,gDASC;AAED,0DAMC;AAED,wDAEC;AAED,sEAEC;AAED,wDAEC;AAED,gCAYC;AAED,kDAGC;AAED,oDAWC;AAED,kDAGC;AA/GD,mCAA8C;AAE9C,gDAKuB;AAevB,oCAAiC;AACjC,8CAAsC;AAEtC,sCAKqB;AACrB,sCAAyG;AAE5F,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;CAClB,CAAA;AAGV,SAAgB,mBAAmB,CAAC,SAAoB;IACtD,MAAM,SAAS,GAAG,IAAA,oBAAW,EAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,IAAA,4BAAsB,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,4BAAsB,EAAC,SAAS,CAAC,CAAA;IACjG,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAgB,kBAAkB,CAAC,QAAkB,EAAE,KAAa;IAClE,MAAM,CAAC,OAAO,CAAC,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,oCAAsB,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IACpG,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,U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CAAC,EAAE,IAAI,CAAC,CAAA;IACrF,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,GAAG,OAAO,CAAA;IACvE,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC;QAC1B,SAAS;QACT,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;QAC9B,MAAM;QACN,SAAS;KACV,CAAA;AACH,CAAC;AAED,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,MAAM,CAAC,OAAO,CAAC,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,qCAAuB,CAAC,EAAE,IAAI,CAAC,CAAA;IACpF,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import { CronExecutionData, EventExecutionData,
|
|
1
|
+
import { CronExecutionData, EventExecutionData, EvmCallOperationData, EvmDynamicCallOperationData, Execution, Intent, OnceExecutionData, Proposal, RunnerIntent, RunnerOperation, SvmCallOperationData, SwapOperationData, SwapProposalData, TransferOperationData } from '../types';
|
|
2
2
|
export declare function hashIntent(intent: Intent): string;
|
|
3
3
|
export declare function encodeIntent(intent: Intent): string;
|
|
4
4
|
export declare function hashProposal(proposal: Proposal, intentOrHash: string | Intent): string;
|
|
5
5
|
export declare function encodeProposal(proposal: Proposal, intentOrHash: string | Intent): string;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function encodeSwapOperation(intent: SwapOperationData): string;
|
|
7
7
|
export declare function encodeSwapProposal(proposal: SwapProposalData): string;
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
8
|
+
export declare function encodeTransferOperation(intent: TransferOperationData): string;
|
|
9
|
+
export declare function encodeSvmCallOperation(intent: SvmCallOperationData): string;
|
|
10
|
+
export declare function encodeEvmCallOperation(intent: EvmCallOperationData): string;
|
|
11
|
+
export declare function encodeEvmDynamicCallOperation(intent: EvmDynamicCallOperationData): string;
|
|
11
12
|
export declare function hashExecution(execution: Execution): string;
|
|
12
13
|
export declare function encodeExecution(execution: Execution): string;
|
|
13
14
|
export declare function encodeCronExecution(execution: CronExecutionData): string;
|
|
14
15
|
export declare function encodeEventExecution(execution: EventExecutionData): string;
|
|
15
16
|
export declare function encodeOnceExecution(execution: OnceExecutionData): string;
|
|
16
|
-
export declare function
|
|
17
|
+
export declare function toRawOperation(output: RunnerOperation): {
|
|
17
18
|
data: string;
|
|
18
|
-
|
|
19
|
-
op: 0 | 1 | 2 | 3;
|
|
19
|
+
opType: 0 | 1 | 2 | 3 | 4 | 5;
|
|
20
20
|
user: string;
|
|
21
|
-
settler: string;
|
|
22
|
-
nonce: string;
|
|
23
|
-
deadline: string;
|
|
24
|
-
maxFees: {
|
|
25
|
-
token: string;
|
|
26
|
-
amount: string;
|
|
27
|
-
}[];
|
|
28
21
|
events: {
|
|
29
22
|
data: string;
|
|
30
23
|
topic: string;
|
|
31
24
|
}[];
|
|
32
|
-
configSig: string;
|
|
33
|
-
minValidations: number;
|
|
34
25
|
sourceChain: number;
|
|
35
26
|
destinationChain: number;
|
|
36
27
|
tokensIn: {
|
|
@@ -44,22 +35,12 @@ export declare function toRawIntent(output: Omit<SwapIntent, 'data'> | Omit<Tran
|
|
|
44
35
|
}[];
|
|
45
36
|
} | {
|
|
46
37
|
data: string;
|
|
47
|
-
|
|
48
|
-
op: 0 | 1 | 2 | 3;
|
|
38
|
+
opType: 0 | 1 | 2 | 3 | 4 | 5;
|
|
49
39
|
user: string;
|
|
50
|
-
settler: string;
|
|
51
|
-
nonce: string;
|
|
52
|
-
deadline: string;
|
|
53
|
-
maxFees: {
|
|
54
|
-
token: string;
|
|
55
|
-
amount: string;
|
|
56
|
-
}[];
|
|
57
40
|
events: {
|
|
58
41
|
data: string;
|
|
59
42
|
topic: string;
|
|
60
43
|
}[];
|
|
61
|
-
configSig: string;
|
|
62
|
-
minValidations: number;
|
|
63
44
|
chainId: number;
|
|
64
45
|
transfers: {
|
|
65
46
|
token: string;
|
|
@@ -68,22 +49,12 @@ export declare function toRawIntent(output: Omit<SwapIntent, 'data'> | Omit<Tran
|
|
|
68
49
|
}[];
|
|
69
50
|
} | {
|
|
70
51
|
data: string;
|
|
71
|
-
|
|
72
|
-
op: 0 | 1 | 2 | 3;
|
|
52
|
+
opType: 0 | 1 | 2 | 3 | 4 | 5;
|
|
73
53
|
user: string;
|
|
74
|
-
settler: string;
|
|
75
|
-
nonce: string;
|
|
76
|
-
deadline: string;
|
|
77
|
-
maxFees: {
|
|
78
|
-
token: string;
|
|
79
|
-
amount: string;
|
|
80
|
-
}[];
|
|
81
54
|
events: {
|
|
82
55
|
data: string;
|
|
83
56
|
topic: string;
|
|
84
57
|
}[];
|
|
85
|
-
configSig: string;
|
|
86
|
-
minValidations: number;
|
|
87
58
|
chainId: number;
|
|
88
59
|
calls: {
|
|
89
60
|
value: string;
|
|
@@ -92,22 +63,30 @@ export declare function toRawIntent(output: Omit<SwapIntent, 'data'> | Omit<Tran
|
|
|
92
63
|
}[];
|
|
93
64
|
} | {
|
|
94
65
|
data: string;
|
|
95
|
-
|
|
96
|
-
op: 0 | 1 | 2 | 3;
|
|
66
|
+
opType: 0 | 1 | 2 | 3 | 4 | 5;
|
|
97
67
|
user: string;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
maxFees: {
|
|
102
|
-
token: string;
|
|
103
|
-
amount: string;
|
|
68
|
+
events: {
|
|
69
|
+
data: string;
|
|
70
|
+
topic: string;
|
|
104
71
|
}[];
|
|
72
|
+
chainId: number;
|
|
73
|
+
calls: {
|
|
74
|
+
value: string;
|
|
75
|
+
target: string;
|
|
76
|
+
selector: string;
|
|
77
|
+
arguments: {
|
|
78
|
+
data: string;
|
|
79
|
+
kind: 0 | 1;
|
|
80
|
+
}[];
|
|
81
|
+
}[];
|
|
82
|
+
} | {
|
|
83
|
+
data: string;
|
|
84
|
+
opType: 0 | 1 | 2 | 3 | 4 | 5;
|
|
85
|
+
user: string;
|
|
105
86
|
events: {
|
|
106
87
|
data: string;
|
|
107
88
|
topic: string;
|
|
108
89
|
}[];
|
|
109
|
-
configSig: string;
|
|
110
|
-
minValidations: number;
|
|
111
90
|
instructions: {
|
|
112
91
|
data: string;
|
|
113
92
|
programId: string;
|
|
@@ -118,4 +97,29 @@ export declare function toRawIntent(output: Omit<SwapIntent, 'data'> | Omit<Tran
|
|
|
118
97
|
}[];
|
|
119
98
|
}[];
|
|
120
99
|
};
|
|
100
|
+
export declare function toRawIntent(intent: RunnerIntent & {
|
|
101
|
+
triggerSig: string;
|
|
102
|
+
minValidations: number;
|
|
103
|
+
}): {
|
|
104
|
+
hash: string;
|
|
105
|
+
feePayer: string;
|
|
106
|
+
settler: string;
|
|
107
|
+
nonce: string;
|
|
108
|
+
deadline: string;
|
|
109
|
+
maxFees: {
|
|
110
|
+
token: string;
|
|
111
|
+
amount: string;
|
|
112
|
+
}[];
|
|
113
|
+
triggerSig: string;
|
|
114
|
+
minValidations: number;
|
|
115
|
+
operations: {
|
|
116
|
+
opType: 0 | 1 | 2 | 3 | 4 | 5;
|
|
117
|
+
user: string;
|
|
118
|
+
data: string;
|
|
119
|
+
events: {
|
|
120
|
+
data: string;
|
|
121
|
+
topic: string;
|
|
122
|
+
}[];
|
|
123
|
+
}[];
|
|
124
|
+
};
|
|
121
125
|
//# sourceMappingURL=encoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/shared/codec/encoder.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/shared/codec/encoder.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,i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