@across-protocol/contracts 4.0.1 → 4.0.3
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/deploy/consts.d.ts +1 -1
- package/dist/deploy/consts.js +9 -13
- package/dist/deployments/deployments.json +24 -1
- package/dist/hardhat.config.js +17 -1
- package/dist/scripts/svm/fakeFillWithRandomDistribution.js +2 -2
- package/dist/scripts/svm/queryEvents.js +1 -1
- package/dist/scripts/svm/simpleDeposit.js +3 -3
- package/dist/scripts/svm/simpleFakeRelayerRepayment.js +1 -1
- package/dist/scripts/svm/simpleFill.js +19 -6
- package/dist/src/svm/assets/idl/svm_spoke.json +388 -388
- package/dist/src/svm/assets/svm_spoke.d.ts +388 -388
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.d.ts +31 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.js +70 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.d.ts +31 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.js +67 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/index.d.ts +3 -3
- package/dist/src/svm/clients/SvmSpoke/accounts/index.js +3 -3
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.d.ts +27 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.js +66 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/deposit.d.ts +123 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{depositV3.js → deposit.js} +23 -23
- package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.d.ts +119 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{depositV3Now.js → depositNow.js} +23 -23
- package/dist/src/svm/clients/SvmSpoke/instructions/executeSlowRelayLeaf.d.ts +104 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{executeV3SlowRelayLeaf.js → executeSlowRelayLeaf.js} +26 -26
- package/dist/src/svm/clients/SvmSpoke/instructions/fillRelay.d.ts +104 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{fillV3Relay.js → fillRelay.js} +26 -26
- package/dist/src/svm/clients/SvmSpoke/instructions/index.d.ts +6 -6
- package/dist/src/svm/clients/SvmSpoke/instructions/index.js +6 -6
- package/dist/src/svm/clients/SvmSpoke/instructions/requestSlowFill.d.ts +76 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{requestV3SlowFill.js → requestSlowFill.js} +25 -25
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.d.ts +127 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{unsafeDepositV3.js → unsafeDeposit.js} +23 -23
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.d.ts +23 -23
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.js +29 -29
- package/dist/src/svm/clients/SvmSpoke/types/{filledV3Relay.d.ts → filledRelay.d.ts} +8 -8
- package/dist/src/svm/clients/SvmSpoke/types/{filledV3Relay.js → filledRelay.js} +9 -9
- package/dist/src/svm/clients/SvmSpoke/types/{v3FundsDeposited.d.ts → fundsDeposited.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{v3FundsDeposited.js → fundsDeposited.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/index.d.ts +6 -6
- package/dist/src/svm/clients/SvmSpoke/types/index.js +6 -6
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayData.d.ts → relayData.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayData.js → relayData.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayExecutionEventInfo.d.ts → relayExecutionEventInfo.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayExecutionEventInfo.js → relayExecutionEventInfo.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/{requestedV3SlowFill.d.ts → requestedSlowFill.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{requestedV3SlowFill.js → requestedSlowFill.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/{v3SlowFill.d.ts → slowFill.d.ts} +8 -8
- package/dist/src/svm/clients/SvmSpoke/types/{v3SlowFill.js → slowFill.js} +9 -9
- package/dist/src/svm/web3-v1/instructionParamsUtils.d.ts +8 -8
- package/dist/src/svm/web3-v1/instructionParamsUtils.js +16 -16
- package/dist/src/types/svm.d.ts +6 -6
- package/dist/target/types/svm_spoke.d.ts +388 -388
- package/dist/tasks/enableL1TokenAcrossEcosystem.js +14 -10
- package/dist/test/svm/SvmSpoke.Deposit.js +48 -47
- package/dist/test/svm/SvmSpoke.Fill.AcrossPlus.js +2 -2
- package/dist/test/svm/SvmSpoke.Fill.js +28 -56
- package/dist/test/svm/SvmSpoke.SlowFill.AcrossPlus.js +13 -13
- package/dist/test/svm/SvmSpoke.SlowFill.js +40 -40
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +3 -1
- package/package.json +2 -2
- package/dist/src/svm/clients/SvmSpoke/accounts/executeV3SlowRelayLeafParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/executeV3SlowRelayLeafParams.js +0 -70
- package/dist/src/svm/clients/SvmSpoke/accounts/fillV3RelayParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/fillV3RelayParams.js +0 -67
- package/dist/src/svm/clients/SvmSpoke/accounts/requestV3SlowFillParams.d.ts +0 -27
- package/dist/src/svm/clients/SvmSpoke/accounts/requestV3SlowFillParams.js +0 -66
- package/dist/src/svm/clients/SvmSpoke/instructions/depositV3.d.ts +0 -123
- package/dist/src/svm/clients/SvmSpoke/instructions/depositV3Now.d.ts +0 -119
- package/dist/src/svm/clients/SvmSpoke/instructions/executeV3SlowRelayLeaf.d.ts +0 -104
- package/dist/src/svm/clients/SvmSpoke/instructions/fillV3Relay.d.ts +0 -104
- package/dist/src/svm/clients/SvmSpoke/instructions/requestV3SlowFill.d.ts +0 -76
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDepositV3.d.ts +0 -127
|
@@ -98,17 +98,17 @@ describe("svm_spoke.slow_fill.across_plus", () => {
|
|
|
98
98
|
const createSlowFillIx = async (multicallHandlerCoder, bufferParams = false) => {
|
|
99
99
|
// Relay root bundle with slow fill leaf.
|
|
100
100
|
const { relayHash, leaf, rootBundleId, proofAsNumbers, rootBundle } = await relaySlowFillRootBundle();
|
|
101
|
-
const
|
|
101
|
+
const requestSlowFillValues = [Array.from(relayHash), leaf.relayData];
|
|
102
102
|
let loadRequestParamsInstructions = [];
|
|
103
103
|
if (bufferParams) {
|
|
104
|
-
loadRequestParamsInstructions = await (0, web3_v1_1.
|
|
104
|
+
loadRequestParamsInstructions = await (0, web3_v1_1.loadRequestSlowFillParams)(program, relayer, requestSlowFillValues[1]);
|
|
105
105
|
[requestAccounts.instructionParams] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("instruction_params"), relayer.publicKey.toBuffer()], program.programId);
|
|
106
106
|
}
|
|
107
107
|
const requestV3SlowFillParams = bufferParams
|
|
108
|
-
? [
|
|
109
|
-
:
|
|
108
|
+
? [requestSlowFillValues[0], null]
|
|
109
|
+
: requestSlowFillValues;
|
|
110
110
|
const requestIx = await program.methods
|
|
111
|
-
.
|
|
111
|
+
.requestSlowFill(...requestV3SlowFillParams)
|
|
112
112
|
.accounts(requestAccounts)
|
|
113
113
|
.instruction();
|
|
114
114
|
const executeAccounts = {
|
|
@@ -127,7 +127,7 @@ describe("svm_spoke.slow_fill.across_plus", () => {
|
|
|
127
127
|
{ pubkey: handlerProgram.programId, isSigner: false, isWritable: false },
|
|
128
128
|
...multicallHandlerCoder.compiledKeyMetas,
|
|
129
129
|
];
|
|
130
|
-
const
|
|
130
|
+
const executeSlowRelayLeafValues = [
|
|
131
131
|
Array.from(relayHash),
|
|
132
132
|
leaf,
|
|
133
133
|
rootBundleId,
|
|
@@ -135,14 +135,14 @@ describe("svm_spoke.slow_fill.across_plus", () => {
|
|
|
135
135
|
];
|
|
136
136
|
let loadExecuteParamsInstructions = [];
|
|
137
137
|
if (bufferParams) {
|
|
138
|
-
loadExecuteParamsInstructions = await (0, web3_v1_1.
|
|
138
|
+
loadExecuteParamsInstructions = await (0, web3_v1_1.loadExecuteSlowRelayLeafParams)(program, relayer, executeSlowRelayLeafValues[1], executeSlowRelayLeafValues[2], executeSlowRelayLeafValues[3]);
|
|
139
139
|
[requestAccounts.instructionParams] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("instruction_params"), relayer.publicKey.toBuffer()], program.programId);
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
? [
|
|
143
|
-
:
|
|
141
|
+
const executeSlowRelayLeafParams = bufferParams
|
|
142
|
+
? [executeSlowRelayLeafValues[0], null, null, null]
|
|
143
|
+
: executeSlowRelayLeafValues;
|
|
144
144
|
const executeIx = await program.methods
|
|
145
|
-
.
|
|
145
|
+
.executeSlowRelayLeaf(...executeSlowRelayLeafParams)
|
|
146
146
|
.accounts(executeAccounts)
|
|
147
147
|
.remainingAccounts(executeRemainingAccounts)
|
|
148
148
|
.instruction();
|
|
@@ -313,8 +313,8 @@ describe("svm_spoke.slow_fill.across_plus", () => {
|
|
|
313
313
|
// We don't close ALT here as that would require ~4 minutes between deactivation and closing, but we demonstrate
|
|
314
314
|
// being able to close the fill status PDA using only event data.
|
|
315
315
|
const events = await (0, web3_v1_1.readEventsUntilFound)(connection, txSignature, [program]);
|
|
316
|
-
const eventData = events.find((event) => event.name === "
|
|
317
|
-
assert.isNotNull(eventData, "
|
|
316
|
+
const eventData = events.find((event) => event.name === "filledRelay")?.data;
|
|
317
|
+
assert.isNotNull(eventData, "FilledRelay event should be emitted");
|
|
318
318
|
// Recover relay hash and derived fill status from event data.
|
|
319
319
|
const relayHashUint8Array = (0, web3_v1_1.calculateRelayEventHashUint8Array)(eventData, chainId);
|
|
320
320
|
const [fillStatusPDA] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("fills"), relayHashUint8Array], program.programId);
|
|
@@ -156,7 +156,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
156
156
|
// Attempt to request a slow fill before the exclusivityDeadline
|
|
157
157
|
const relayHash = Array.from((0, web3_v1_1.calculateRelayHashUint8Array)(relayData, chainId));
|
|
158
158
|
try {
|
|
159
|
-
await program.methods.
|
|
159
|
+
await program.methods.requestSlowFill(relayHash, relayData).accounts(requestAccounts).signers([relayer]).rpc();
|
|
160
160
|
assert.fail("Request should have failed due to exclusivity deadline not passed");
|
|
161
161
|
}
|
|
162
162
|
catch (err) {
|
|
@@ -165,14 +165,14 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
165
165
|
// Set the contract time to be after the exclusivityDeadline
|
|
166
166
|
await setCurrentTime(program, state, relayer, new anchor_1.BN(relayData.exclusivityDeadline + 1));
|
|
167
167
|
const tx = await program.methods
|
|
168
|
-
.
|
|
168
|
+
.requestSlowFill(relayHash, relayData)
|
|
169
169
|
.accounts(requestAccounts)
|
|
170
170
|
.signers([relayer])
|
|
171
171
|
.rpc();
|
|
172
|
-
// Fetch and verify the
|
|
172
|
+
// Fetch and verify the RequestedSlowFill event
|
|
173
173
|
const events = await (0, web3_v1_1.readEventsUntilFound)(connection, tx, [program]);
|
|
174
|
-
const event = events.find((event) => event.name === "
|
|
175
|
-
assert.isNotNull(event, "
|
|
174
|
+
const event = events.find((event) => event.name === "requestedSlowFill")?.data;
|
|
175
|
+
assert.isNotNull(event, "RequestedSlowFill event should be emitted");
|
|
176
176
|
// Verify that the event data matches the relay data.
|
|
177
177
|
Object.entries(relayData).forEach(([key, value]) => {
|
|
178
178
|
if (key === "message") {
|
|
@@ -187,14 +187,14 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
187
187
|
// Fill the relay first
|
|
188
188
|
const approveIx = await (0, spl_token_1.createApproveCheckedInstruction)(fillAccounts.relayerTokenAccount, fillAccounts.mint, fillAccounts.state, fillAccounts.signer, BigInt(relayData.outputAmount.toString()), tokenDecimals);
|
|
189
189
|
const fillIx = await program.methods
|
|
190
|
-
.
|
|
190
|
+
.fillRelay(relayHash, relayData, new anchor_1.BN(1), relayer.publicKey)
|
|
191
191
|
.accounts(fillAccounts)
|
|
192
192
|
.remainingAccounts(fillRemainingAccounts)
|
|
193
193
|
.instruction();
|
|
194
194
|
const fillTx = new web3_js_1.Transaction().add(approveIx, fillIx);
|
|
195
195
|
await (0, web3_js_1.sendAndConfirmTransaction)(connection, fillTx, [relayer]);
|
|
196
196
|
try {
|
|
197
|
-
await program.methods.
|
|
197
|
+
await program.methods.requestSlowFill(relayHash, relayData).accounts(requestAccounts).signers([relayer]).rpc();
|
|
198
198
|
assert.fail("Request should have failed due to being within exclusivity window");
|
|
199
199
|
}
|
|
200
200
|
catch (err) {
|
|
@@ -204,30 +204,30 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
204
204
|
await setCurrentTime(program, state, relayer, new anchor_1.BN(relayData.exclusivityDeadline + 1));
|
|
205
205
|
// Attempt to request a slow fill after the relay has been filled.
|
|
206
206
|
try {
|
|
207
|
-
await program.methods.
|
|
207
|
+
await program.methods.requestSlowFill(relayHash, relayData).accounts(requestAccounts).signers([relayer]).rpc();
|
|
208
208
|
assert.fail("Request should have failed due to relay already being filled");
|
|
209
209
|
}
|
|
210
210
|
catch (err) {
|
|
211
211
|
assert.include(err.toString(), "InvalidSlowFillRequest", "Expected InvalidSlowFillRequest error");
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
|
-
it("Fetches FillStatusAccount before and after
|
|
214
|
+
it("Fetches FillStatusAccount before and after requestSlowFill", async () => {
|
|
215
215
|
const relayHash = (0, web3_v1_1.calculateRelayHashUint8Array)(relayData, chainId);
|
|
216
216
|
const [fillStatusPDA] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("fills"), relayHash], program.programId);
|
|
217
|
-
// Fetch FillStatusAccount before
|
|
217
|
+
// Fetch FillStatusAccount before requestSlowFill
|
|
218
218
|
let fillStatusAccount = await program.account.fillStatusAccount.fetchNullable(fillStatusPDA);
|
|
219
|
-
assert.isNull(fillStatusAccount, "FillStatusAccount should be uninitialized before
|
|
219
|
+
assert.isNull(fillStatusAccount, "FillStatusAccount should be uninitialized before requestSlowFill");
|
|
220
220
|
// Set the contract time to be after the exclusivityDeadline
|
|
221
221
|
await setCurrentTime(program, state, relayer, new anchor_1.BN(relayData.exclusivityDeadline + 1));
|
|
222
222
|
// Request a slow fill
|
|
223
223
|
await program.methods
|
|
224
|
-
.
|
|
224
|
+
.requestSlowFill(Array.from(relayHash), relayData)
|
|
225
225
|
.accounts(requestAccounts)
|
|
226
226
|
.signers([relayer])
|
|
227
227
|
.rpc();
|
|
228
|
-
// Fetch FillStatusAccount after
|
|
228
|
+
// Fetch FillStatusAccount after requestSlowFill
|
|
229
229
|
fillStatusAccount = await program.account.fillStatusAccount.fetch(fillStatusPDA);
|
|
230
|
-
assert.isNotNull(fillStatusAccount, "FillStatusAccount should be initialized after
|
|
230
|
+
assert.isNotNull(fillStatusAccount, "FillStatusAccount should be initialized after requestSlowFill");
|
|
231
231
|
assert.equal(JSON.stringify(fillStatusAccount.status), `{\"requestedSlowFill\":{}}`, "FillStatus should be RequestedSlowFill");
|
|
232
232
|
assert.equal(fillStatusAccount.relayer.toString(), relayer.publicKey.toString(), "Caller should be set as relayer");
|
|
233
233
|
});
|
|
@@ -237,14 +237,14 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
237
237
|
await setCurrentTime(program, state, relayer, new anchor_1.BN(relayData.exclusivityDeadline + 1));
|
|
238
238
|
// Request a slow fill
|
|
239
239
|
await program.methods
|
|
240
|
-
.
|
|
240
|
+
.requestSlowFill(Array.from(relayHash), relayData)
|
|
241
241
|
.accounts(requestAccounts)
|
|
242
242
|
.signers([relayer])
|
|
243
243
|
.rpc();
|
|
244
244
|
// Attempt to request a slow fill again for the same relay
|
|
245
245
|
try {
|
|
246
246
|
await program.methods
|
|
247
|
-
.
|
|
247
|
+
.requestSlowFill(Array.from(relayHash), relayData)
|
|
248
248
|
.accounts(requestAccounts)
|
|
249
249
|
.signers([relayer])
|
|
250
250
|
.rpc();
|
|
@@ -275,7 +275,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
275
275
|
};
|
|
276
276
|
try {
|
|
277
277
|
await program.methods
|
|
278
|
-
.
|
|
278
|
+
.executeSlowRelayLeaf(Array.from(relayHash), leaf, rootBundleId, proofAsNumbers)
|
|
279
279
|
.accounts(executeSlowRelayLeafAccounts)
|
|
280
280
|
.remainingAccounts(fillRemainingAccounts)
|
|
281
281
|
.rpc();
|
|
@@ -286,13 +286,13 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
286
286
|
}
|
|
287
287
|
// Request V3 slow fill
|
|
288
288
|
await program.methods
|
|
289
|
-
.
|
|
289
|
+
.requestSlowFill(Array.from(relayHash), leaf.relayData)
|
|
290
290
|
.accounts(requestAccounts)
|
|
291
291
|
.signers([relayer])
|
|
292
292
|
.rpc();
|
|
293
293
|
// Execute V3 slow relay leaf after requesting slow fill
|
|
294
294
|
const ix = await program.methods
|
|
295
|
-
.
|
|
295
|
+
.executeSlowRelayLeaf(Array.from(relayHash), leaf, rootBundleId, proofAsNumbers)
|
|
296
296
|
.accounts(executeSlowRelayLeafAccounts)
|
|
297
297
|
.remainingAccounts(fillRemainingAccounts)
|
|
298
298
|
.instruction();
|
|
@@ -305,10 +305,10 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
305
305
|
const fRecipientBal = (await connection.getTokenAccountBalance(recipientTA)).value.amount;
|
|
306
306
|
assert.strictEqual(BigInt(iVaultBal) - BigInt(fVaultBal), BigInt(leaf.updatedOutputAmount.toNumber()), "Vault balance should be reduced by relay amount");
|
|
307
307
|
assert.strictEqual(BigInt(fRecipientBal) - BigInt(iRecipientBal), BigInt(leaf.updatedOutputAmount.toNumber()), "Recipient balance should be increased by relay amount");
|
|
308
|
-
// Fetch and verify the
|
|
308
|
+
// Fetch and verify the FilledRelay event
|
|
309
309
|
const events = await (0, web3_v1_1.readEventsUntilFound)(connection, tx, [program]);
|
|
310
|
-
const event = events.find((event) => event.name === "
|
|
311
|
-
assert.isNotNull(event, "
|
|
310
|
+
const event = events.find((event) => event.name === "filledRelay")?.data;
|
|
311
|
+
assert.isNotNull(event, "FilledRelay event should be emitted");
|
|
312
312
|
// Verify that the event data matches the relay data.
|
|
313
313
|
Object.entries(relayData).forEach(([key, value]) => {
|
|
314
314
|
if (key === "message") {
|
|
@@ -340,7 +340,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
340
340
|
try {
|
|
341
341
|
const relayHash = (0, web3_v1_1.calculateRelayHashUint8Array)(relayData, chainId);
|
|
342
342
|
await program.methods
|
|
343
|
-
.
|
|
343
|
+
.requestSlowFill(Array.from(relayHash), relayData)
|
|
344
344
|
.accounts(requestAccounts)
|
|
345
345
|
.signers([relayer])
|
|
346
346
|
.rpc();
|
|
@@ -355,7 +355,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
355
355
|
// Request V3 slow fill.
|
|
356
356
|
const { relayHash, leaf, rootBundleId, proofAsNumbers, rootBundle } = await relaySlowFillRootBundle();
|
|
357
357
|
await program.methods
|
|
358
|
-
.
|
|
358
|
+
.requestSlowFill(Array.from(relayHash), leaf.relayData)
|
|
359
359
|
.accounts(requestAccounts)
|
|
360
360
|
.signers([relayer])
|
|
361
361
|
.rpc();
|
|
@@ -376,7 +376,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
376
376
|
program: program.programId,
|
|
377
377
|
};
|
|
378
378
|
await program.methods
|
|
379
|
-
.
|
|
379
|
+
.executeSlowRelayLeaf(Array.from(relayHash), leaf, rootBundleId, proofAsNumbers)
|
|
380
380
|
.accounts(executeSlowRelayLeafAccounts)
|
|
381
381
|
.remainingAccounts(fillRemainingAccounts)
|
|
382
382
|
.rpc();
|
|
@@ -392,7 +392,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
392
392
|
const firstRecipient = web3_js_1.Keypair.generate().publicKey;
|
|
393
393
|
const { relayHash: firstRelayHash, leaf: firstLeaf, rootBundleId: firstRootBundleId, proofAsNumbers: firstProofAsNumbers, rootBundle: firstRootBundle, } = await relaySlowFillRootBundle(firstRecipient);
|
|
394
394
|
await program.methods
|
|
395
|
-
.
|
|
395
|
+
.requestSlowFill(Array.from(firstRelayHash), firstLeaf.relayData)
|
|
396
396
|
.accounts(requestAccounts)
|
|
397
397
|
.signers([relayer])
|
|
398
398
|
.rpc();
|
|
@@ -404,7 +404,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
404
404
|
const secondRecipient = web3_js_1.Keypair.generate().publicKey;
|
|
405
405
|
const { relayHash: secondRelayHash, leaf: secondLeaf } = await relaySlowFillRootBundle(secondRecipient);
|
|
406
406
|
await program.methods
|
|
407
|
-
.
|
|
407
|
+
.requestSlowFill(Array.from(secondRelayHash), secondLeaf.relayData)
|
|
408
408
|
.accounts(requestAccounts)
|
|
409
409
|
.signers([relayer])
|
|
410
410
|
.rpc();
|
|
@@ -424,7 +424,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
424
424
|
program: program.programId,
|
|
425
425
|
};
|
|
426
426
|
await program.methods
|
|
427
|
-
.
|
|
427
|
+
.executeSlowRelayLeaf(Array.from(firstRelayHash), firstLeaf, firstRootBundleId, firstProofAsNumbers)
|
|
428
428
|
.accounts(executeSlowRelayLeafAccounts)
|
|
429
429
|
.remainingAccounts(fillRemainingAccounts)
|
|
430
430
|
.rpc();
|
|
@@ -446,7 +446,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
446
446
|
program: program.programId,
|
|
447
447
|
};
|
|
448
448
|
await program.methods
|
|
449
|
-
.
|
|
449
|
+
.executeSlowRelayLeaf(Array.from(secondRelayHash), firstLeaf, firstRootBundleId, firstProofAsNumbers)
|
|
450
450
|
.accounts(executeSlowRelayLeafAccounts)
|
|
451
451
|
.remainingAccounts(fillRemainingAccounts)
|
|
452
452
|
.rpc();
|
|
@@ -461,7 +461,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
461
461
|
// Request V3 slow fill.
|
|
462
462
|
const { relayHash, leaf, rootBundleId, proofAsNumbers, rootBundle } = await relaySlowFillRootBundle();
|
|
463
463
|
await program.methods
|
|
464
|
-
.
|
|
464
|
+
.requestSlowFill(Array.from(relayHash), leaf.relayData)
|
|
465
465
|
.accounts(requestAccounts)
|
|
466
466
|
.signers([relayer])
|
|
467
467
|
.rpc();
|
|
@@ -485,7 +485,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
485
485
|
program: program.programId,
|
|
486
486
|
};
|
|
487
487
|
await program.methods
|
|
488
|
-
.
|
|
488
|
+
.executeSlowRelayLeaf(Array.from(relayHash), leaf, rootBundleId, proofAsNumbers)
|
|
489
489
|
.accounts(executeSlowRelayLeafAccounts)
|
|
490
490
|
.remainingAccounts(fillRemainingAccounts)
|
|
491
491
|
.rpc();
|
|
@@ -501,7 +501,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
501
501
|
const anotherChainId = new anchor_1.BN(Math.floor(Math.random() * 1000000));
|
|
502
502
|
const { relayHash, leaf, rootBundleId, proofAsNumbers, rootBundle } = await relaySlowFillRootBundle(undefined, anotherChainId);
|
|
503
503
|
await program.methods
|
|
504
|
-
.
|
|
504
|
+
.requestSlowFill(Array.from(relayHash), leaf.relayData)
|
|
505
505
|
.accounts(requestAccounts)
|
|
506
506
|
.signers([relayer])
|
|
507
507
|
.rpc();
|
|
@@ -521,7 +521,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
521
521
|
program: program.programId,
|
|
522
522
|
};
|
|
523
523
|
await program.methods
|
|
524
|
-
.
|
|
524
|
+
.executeSlowRelayLeaf(Array.from(relayHash), leaf, rootBundleId, proofAsNumbers)
|
|
525
525
|
.accounts(executeSlowRelayLeafAccounts)
|
|
526
526
|
.remainingAccounts(fillRemainingAccounts)
|
|
527
527
|
.rpc();
|
|
@@ -537,7 +537,7 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
537
537
|
const { relayHash, leaf, rootBundleId, proofAsNumbers, rootBundle } = await relaySlowFillRootBundle(undefined, undefined, Buffer.alloc(0));
|
|
538
538
|
// Request V3 slow fill
|
|
539
539
|
const tx1 = await program.methods
|
|
540
|
-
.
|
|
540
|
+
.requestSlowFill(Array.from(relayHash), leaf.relayData)
|
|
541
541
|
.accounts(requestAccounts)
|
|
542
542
|
.signers([relayer])
|
|
543
543
|
.rpc();
|
|
@@ -555,18 +555,18 @@ describe("svm_spoke.slow_fill", () => {
|
|
|
555
555
|
program: program.programId,
|
|
556
556
|
};
|
|
557
557
|
const tx2 = await program.methods
|
|
558
|
-
.
|
|
558
|
+
.executeSlowRelayLeaf(Array.from(relayHash), leaf, rootBundleId, proofAsNumbers)
|
|
559
559
|
.accounts(executeSlowRelayLeafAccounts)
|
|
560
560
|
.remainingAccounts(fillRemainingAccounts)
|
|
561
561
|
.rpc();
|
|
562
|
-
// Fetch and verify message hash in the
|
|
562
|
+
// Fetch and verify message hash in the RequestedSlowFill and FilledRelay events
|
|
563
563
|
const requestEvents = await (0, web3_v1_1.readEventsUntilFound)(connection, tx1, [program]);
|
|
564
|
-
const requestEvent = requestEvents.find((event) => event.name === "
|
|
565
|
-
assert.isNotNull(requestEvent, "
|
|
564
|
+
const requestEvent = requestEvents.find((event) => event.name === "requestedSlowFill")?.data;
|
|
565
|
+
assert.isNotNull(requestEvent, "RequestedSlowFill event should be emitted");
|
|
566
566
|
assertSE(requestEvent.messageHash, new Uint8Array(32), `MessageHash should be zeroed`);
|
|
567
567
|
const fillEvents = await (0, web3_v1_1.readEventsUntilFound)(connection, tx2, [program]);
|
|
568
|
-
const fillEvent = fillEvents.find((event) => event.name === "
|
|
569
|
-
assert.isNotNull(fillEvent, "
|
|
568
|
+
const fillEvent = fillEvents.find((event) => event.name === "filledRelay")?.data;
|
|
569
|
+
assert.isNotNull(fillEvent, "FilledRelay event should be emitted");
|
|
570
570
|
assertSE(fillEvent.messageHash, new Uint8Array(32), `MessageHash should be zeroed`);
|
|
571
571
|
assertSE(fillEvent.relayExecutionInfo.updatedMessageHash, new Uint8Array(32), `UpdatedMessageHash should be zeroed`);
|
|
572
572
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CHAIN_IDs, MAINNET_CHAIN_IDs, PRODUCTION_NETWORKS, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
|
|
1
|
+
export { CHAIN_IDs, MAINNET_CHAIN_IDs, PRODUCTION_NETWORKS, PUBLIC_NETWORKS, TESTNET_CHAIN_IDs, TOKEN_SYMBOLS_MAP, } from "@across-protocol/constants";
|
|
2
2
|
export declare const FillStatus: {
|
|
3
3
|
Unfilled: number;
|
|
4
4
|
RequestedSlowFill: number;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FillStatus = exports.TOKEN_SYMBOLS_MAP = exports.PRODUCTION_NETWORKS = exports.MAINNET_CHAIN_IDs = exports.CHAIN_IDs = void 0;
|
|
3
|
+
exports.FillStatus = exports.TOKEN_SYMBOLS_MAP = exports.TESTNET_CHAIN_IDs = exports.PUBLIC_NETWORKS = exports.PRODUCTION_NETWORKS = exports.MAINNET_CHAIN_IDs = exports.CHAIN_IDs = void 0;
|
|
4
4
|
var constants_1 = require("@across-protocol/constants");
|
|
5
5
|
Object.defineProperty(exports, "CHAIN_IDs", { enumerable: true, get: function () { return constants_1.CHAIN_IDs; } });
|
|
6
6
|
Object.defineProperty(exports, "MAINNET_CHAIN_IDs", { enumerable: true, get: function () { return constants_1.MAINNET_CHAIN_IDs; } });
|
|
7
7
|
Object.defineProperty(exports, "PRODUCTION_NETWORKS", { enumerable: true, get: function () { return constants_1.PRODUCTION_NETWORKS; } });
|
|
8
|
+
Object.defineProperty(exports, "PUBLIC_NETWORKS", { enumerable: true, get: function () { return constants_1.PUBLIC_NETWORKS; } });
|
|
9
|
+
Object.defineProperty(exports, "TESTNET_CHAIN_IDs", { enumerable: true, get: function () { return constants_1.TESTNET_CHAIN_IDs; } });
|
|
8
10
|
Object.defineProperty(exports, "TOKEN_SYMBOLS_MAP", { enumerable: true, get: function () { return constants_1.TOKEN_SYMBOLS_MAP; } });
|
|
9
11
|
exports.FillStatus = {
|
|
10
12
|
Unfilled: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/contracts",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"author": "UMA Team",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"pre-commit-hook": "sh scripts/preCommitHook.sh"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@across-protocol/constants": "^3.1.
|
|
45
|
+
"@across-protocol/constants": "^3.1.37",
|
|
46
46
|
"@coral-xyz/anchor": "^0.30.1",
|
|
47
47
|
"@defi-wonderland/smock": "^2.3.4",
|
|
48
48
|
"@eth-optimism/contracts": "^0.5.40",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was AUTOGENERATED using the codama library.
|
|
3
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
-
* to add features, then rerun codama to update it.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/codama-idl/codama
|
|
7
|
-
*/
|
|
8
|
-
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/web3-v2.js';
|
|
9
|
-
import { type V3SlowFill, type V3SlowFillArgs } from '../types';
|
|
10
|
-
export declare const EXECUTE_V3_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR: Uint8Array;
|
|
11
|
-
export declare function getExecuteV3SlowRelayLeafParamsDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type ExecuteV3SlowRelayLeafParams = {
|
|
13
|
-
discriminator: ReadonlyUint8Array;
|
|
14
|
-
slowFillLeaf: V3SlowFill;
|
|
15
|
-
rootBundleId: number;
|
|
16
|
-
proof: Array<ReadonlyUint8Array>;
|
|
17
|
-
};
|
|
18
|
-
export type ExecuteV3SlowRelayLeafParamsArgs = {
|
|
19
|
-
slowFillLeaf: V3SlowFillArgs;
|
|
20
|
-
rootBundleId: number;
|
|
21
|
-
proof: Array<ReadonlyUint8Array>;
|
|
22
|
-
};
|
|
23
|
-
export declare function getExecuteV3SlowRelayLeafParamsEncoder(): Encoder<ExecuteV3SlowRelayLeafParamsArgs>;
|
|
24
|
-
export declare function getExecuteV3SlowRelayLeafParamsDecoder(): Decoder<ExecuteV3SlowRelayLeafParams>;
|
|
25
|
-
export declare function getExecuteV3SlowRelayLeafParamsCodec(): Codec<ExecuteV3SlowRelayLeafParamsArgs, ExecuteV3SlowRelayLeafParams>;
|
|
26
|
-
export declare function decodeExecuteV3SlowRelayLeafParams<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<ExecuteV3SlowRelayLeafParams, TAddress>;
|
|
27
|
-
export declare function decodeExecuteV3SlowRelayLeafParams<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<ExecuteV3SlowRelayLeafParams, TAddress>;
|
|
28
|
-
export declare function fetchExecuteV3SlowRelayLeafParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<ExecuteV3SlowRelayLeafParams, TAddress>>;
|
|
29
|
-
export declare function fetchMaybeExecuteV3SlowRelayLeafParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<ExecuteV3SlowRelayLeafParams, TAddress>>;
|
|
30
|
-
export declare function fetchAllExecuteV3SlowRelayLeafParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<ExecuteV3SlowRelayLeafParams>[]>;
|
|
31
|
-
export declare function fetchAllMaybeExecuteV3SlowRelayLeafParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<ExecuteV3SlowRelayLeafParams>[]>;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This code was AUTOGENERATED using the codama library.
|
|
4
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
-
* to add features, then rerun codama to update it.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/codama-idl/codama
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.EXECUTE_V3_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR = void 0;
|
|
11
|
-
exports.getExecuteV3SlowRelayLeafParamsDiscriminatorBytes = getExecuteV3SlowRelayLeafParamsDiscriminatorBytes;
|
|
12
|
-
exports.getExecuteV3SlowRelayLeafParamsEncoder = getExecuteV3SlowRelayLeafParamsEncoder;
|
|
13
|
-
exports.getExecuteV3SlowRelayLeafParamsDecoder = getExecuteV3SlowRelayLeafParamsDecoder;
|
|
14
|
-
exports.getExecuteV3SlowRelayLeafParamsCodec = getExecuteV3SlowRelayLeafParamsCodec;
|
|
15
|
-
exports.decodeExecuteV3SlowRelayLeafParams = decodeExecuteV3SlowRelayLeafParams;
|
|
16
|
-
exports.fetchExecuteV3SlowRelayLeafParams = fetchExecuteV3SlowRelayLeafParams;
|
|
17
|
-
exports.fetchMaybeExecuteV3SlowRelayLeafParams = fetchMaybeExecuteV3SlowRelayLeafParams;
|
|
18
|
-
exports.fetchAllExecuteV3SlowRelayLeafParams = fetchAllExecuteV3SlowRelayLeafParams;
|
|
19
|
-
exports.fetchAllMaybeExecuteV3SlowRelayLeafParams = fetchAllMaybeExecuteV3SlowRelayLeafParams;
|
|
20
|
-
const web3_v2_js_1 = require("@solana/web3-v2.js");
|
|
21
|
-
const types_1 = require("../types");
|
|
22
|
-
exports.EXECUTE_V3_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
23
|
-
190, 110, 37, 249, 117, 253, 160, 111,
|
|
24
|
-
]);
|
|
25
|
-
function getExecuteV3SlowRelayLeafParamsDiscriminatorBytes() {
|
|
26
|
-
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.EXECUTE_V3_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR);
|
|
27
|
-
}
|
|
28
|
-
function getExecuteV3SlowRelayLeafParamsEncoder() {
|
|
29
|
-
return (0, web3_v2_js_1.transformEncoder)((0, web3_v2_js_1.getStructEncoder)([
|
|
30
|
-
['discriminator', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8)],
|
|
31
|
-
['slowFillLeaf', (0, types_1.getV3SlowFillEncoder)()],
|
|
32
|
-
['rootBundleId', (0, web3_v2_js_1.getU32Encoder)()],
|
|
33
|
-
['proof', (0, web3_v2_js_1.getArrayEncoder)((0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 32))],
|
|
34
|
-
]), (value) => ({
|
|
35
|
-
...value,
|
|
36
|
-
discriminator: exports.EXECUTE_V3_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR,
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
function getExecuteV3SlowRelayLeafParamsDecoder() {
|
|
40
|
-
return (0, web3_v2_js_1.getStructDecoder)([
|
|
41
|
-
['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
|
|
42
|
-
['slowFillLeaf', (0, types_1.getV3SlowFillDecoder)()],
|
|
43
|
-
['rootBundleId', (0, web3_v2_js_1.getU32Decoder)()],
|
|
44
|
-
['proof', (0, web3_v2_js_1.getArrayDecoder)((0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 32))],
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
function getExecuteV3SlowRelayLeafParamsCodec() {
|
|
48
|
-
return (0, web3_v2_js_1.combineCodec)(getExecuteV3SlowRelayLeafParamsEncoder(), getExecuteV3SlowRelayLeafParamsDecoder());
|
|
49
|
-
}
|
|
50
|
-
function decodeExecuteV3SlowRelayLeafParams(encodedAccount) {
|
|
51
|
-
return (0, web3_v2_js_1.decodeAccount)(encodedAccount, getExecuteV3SlowRelayLeafParamsDecoder());
|
|
52
|
-
}
|
|
53
|
-
async function fetchExecuteV3SlowRelayLeafParams(rpc, address, config) {
|
|
54
|
-
const maybeAccount = await fetchMaybeExecuteV3SlowRelayLeafParams(rpc, address, config);
|
|
55
|
-
(0, web3_v2_js_1.assertAccountExists)(maybeAccount);
|
|
56
|
-
return maybeAccount;
|
|
57
|
-
}
|
|
58
|
-
async function fetchMaybeExecuteV3SlowRelayLeafParams(rpc, address, config) {
|
|
59
|
-
const maybeAccount = await (0, web3_v2_js_1.fetchEncodedAccount)(rpc, address, config);
|
|
60
|
-
return decodeExecuteV3SlowRelayLeafParams(maybeAccount);
|
|
61
|
-
}
|
|
62
|
-
async function fetchAllExecuteV3SlowRelayLeafParams(rpc, addresses, config) {
|
|
63
|
-
const maybeAccounts = await fetchAllMaybeExecuteV3SlowRelayLeafParams(rpc, addresses, config);
|
|
64
|
-
(0, web3_v2_js_1.assertAccountsExist)(maybeAccounts);
|
|
65
|
-
return maybeAccounts;
|
|
66
|
-
}
|
|
67
|
-
async function fetchAllMaybeExecuteV3SlowRelayLeafParams(rpc, addresses, config) {
|
|
68
|
-
const maybeAccounts = await (0, web3_v2_js_1.fetchEncodedAccounts)(rpc, addresses, config);
|
|
69
|
-
return maybeAccounts.map((maybeAccount) => decodeExecuteV3SlowRelayLeafParams(maybeAccount));
|
|
70
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was AUTOGENERATED using the codama library.
|
|
3
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
-
* to add features, then rerun codama to update it.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/codama-idl/codama
|
|
7
|
-
*/
|
|
8
|
-
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/web3-v2.js';
|
|
9
|
-
import { type V3RelayData, type V3RelayDataArgs } from '../types';
|
|
10
|
-
export declare const FILL_V3_RELAY_PARAMS_DISCRIMINATOR: Uint8Array;
|
|
11
|
-
export declare function getFillV3RelayParamsDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type FillV3RelayParams = {
|
|
13
|
-
discriminator: ReadonlyUint8Array;
|
|
14
|
-
relayData: V3RelayData;
|
|
15
|
-
repaymentChainId: bigint;
|
|
16
|
-
repaymentAddress: Address;
|
|
17
|
-
};
|
|
18
|
-
export type FillV3RelayParamsArgs = {
|
|
19
|
-
relayData: V3RelayDataArgs;
|
|
20
|
-
repaymentChainId: number | bigint;
|
|
21
|
-
repaymentAddress: Address;
|
|
22
|
-
};
|
|
23
|
-
export declare function getFillV3RelayParamsEncoder(): Encoder<FillV3RelayParamsArgs>;
|
|
24
|
-
export declare function getFillV3RelayParamsDecoder(): Decoder<FillV3RelayParams>;
|
|
25
|
-
export declare function getFillV3RelayParamsCodec(): Codec<FillV3RelayParamsArgs, FillV3RelayParams>;
|
|
26
|
-
export declare function decodeFillV3RelayParams<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<FillV3RelayParams, TAddress>;
|
|
27
|
-
export declare function decodeFillV3RelayParams<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<FillV3RelayParams, TAddress>;
|
|
28
|
-
export declare function fetchFillV3RelayParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<FillV3RelayParams, TAddress>>;
|
|
29
|
-
export declare function fetchMaybeFillV3RelayParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<FillV3RelayParams, TAddress>>;
|
|
30
|
-
export declare function fetchAllFillV3RelayParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<FillV3RelayParams>[]>;
|
|
31
|
-
export declare function fetchAllMaybeFillV3RelayParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<FillV3RelayParams>[]>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This code was AUTOGENERATED using the codama library.
|
|
4
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
-
* to add features, then rerun codama to update it.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/codama-idl/codama
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.FILL_V3_RELAY_PARAMS_DISCRIMINATOR = void 0;
|
|
11
|
-
exports.getFillV3RelayParamsDiscriminatorBytes = getFillV3RelayParamsDiscriminatorBytes;
|
|
12
|
-
exports.getFillV3RelayParamsEncoder = getFillV3RelayParamsEncoder;
|
|
13
|
-
exports.getFillV3RelayParamsDecoder = getFillV3RelayParamsDecoder;
|
|
14
|
-
exports.getFillV3RelayParamsCodec = getFillV3RelayParamsCodec;
|
|
15
|
-
exports.decodeFillV3RelayParams = decodeFillV3RelayParams;
|
|
16
|
-
exports.fetchFillV3RelayParams = fetchFillV3RelayParams;
|
|
17
|
-
exports.fetchMaybeFillV3RelayParams = fetchMaybeFillV3RelayParams;
|
|
18
|
-
exports.fetchAllFillV3RelayParams = fetchAllFillV3RelayParams;
|
|
19
|
-
exports.fetchAllMaybeFillV3RelayParams = fetchAllMaybeFillV3RelayParams;
|
|
20
|
-
const web3_v2_js_1 = require("@solana/web3-v2.js");
|
|
21
|
-
const types_1 = require("../types");
|
|
22
|
-
exports.FILL_V3_RELAY_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
23
|
-
45, 184, 9, 102, 46, 87, 53, 8,
|
|
24
|
-
]);
|
|
25
|
-
function getFillV3RelayParamsDiscriminatorBytes() {
|
|
26
|
-
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.FILL_V3_RELAY_PARAMS_DISCRIMINATOR);
|
|
27
|
-
}
|
|
28
|
-
function getFillV3RelayParamsEncoder() {
|
|
29
|
-
return (0, web3_v2_js_1.transformEncoder)((0, web3_v2_js_1.getStructEncoder)([
|
|
30
|
-
['discriminator', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8)],
|
|
31
|
-
['relayData', (0, types_1.getV3RelayDataEncoder)()],
|
|
32
|
-
['repaymentChainId', (0, web3_v2_js_1.getU64Encoder)()],
|
|
33
|
-
['repaymentAddress', (0, web3_v2_js_1.getAddressEncoder)()],
|
|
34
|
-
]), (value) => ({ ...value, discriminator: exports.FILL_V3_RELAY_PARAMS_DISCRIMINATOR }));
|
|
35
|
-
}
|
|
36
|
-
function getFillV3RelayParamsDecoder() {
|
|
37
|
-
return (0, web3_v2_js_1.getStructDecoder)([
|
|
38
|
-
['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
|
|
39
|
-
['relayData', (0, types_1.getV3RelayDataDecoder)()],
|
|
40
|
-
['repaymentChainId', (0, web3_v2_js_1.getU64Decoder)()],
|
|
41
|
-
['repaymentAddress', (0, web3_v2_js_1.getAddressDecoder)()],
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
function getFillV3RelayParamsCodec() {
|
|
45
|
-
return (0, web3_v2_js_1.combineCodec)(getFillV3RelayParamsEncoder(), getFillV3RelayParamsDecoder());
|
|
46
|
-
}
|
|
47
|
-
function decodeFillV3RelayParams(encodedAccount) {
|
|
48
|
-
return (0, web3_v2_js_1.decodeAccount)(encodedAccount, getFillV3RelayParamsDecoder());
|
|
49
|
-
}
|
|
50
|
-
async function fetchFillV3RelayParams(rpc, address, config) {
|
|
51
|
-
const maybeAccount = await fetchMaybeFillV3RelayParams(rpc, address, config);
|
|
52
|
-
(0, web3_v2_js_1.assertAccountExists)(maybeAccount);
|
|
53
|
-
return maybeAccount;
|
|
54
|
-
}
|
|
55
|
-
async function fetchMaybeFillV3RelayParams(rpc, address, config) {
|
|
56
|
-
const maybeAccount = await (0, web3_v2_js_1.fetchEncodedAccount)(rpc, address, config);
|
|
57
|
-
return decodeFillV3RelayParams(maybeAccount);
|
|
58
|
-
}
|
|
59
|
-
async function fetchAllFillV3RelayParams(rpc, addresses, config) {
|
|
60
|
-
const maybeAccounts = await fetchAllMaybeFillV3RelayParams(rpc, addresses, config);
|
|
61
|
-
(0, web3_v2_js_1.assertAccountsExist)(maybeAccounts);
|
|
62
|
-
return maybeAccounts;
|
|
63
|
-
}
|
|
64
|
-
async function fetchAllMaybeFillV3RelayParams(rpc, addresses, config) {
|
|
65
|
-
const maybeAccounts = await (0, web3_v2_js_1.fetchEncodedAccounts)(rpc, addresses, config);
|
|
66
|
-
return maybeAccounts.map((maybeAccount) => decodeFillV3RelayParams(maybeAccount));
|
|
67
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was AUTOGENERATED using the codama library.
|
|
3
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
-
* to add features, then rerun codama to update it.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/codama-idl/codama
|
|
7
|
-
*/
|
|
8
|
-
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/web3-v2.js';
|
|
9
|
-
import { type V3RelayData, type V3RelayDataArgs } from '../types';
|
|
10
|
-
export declare const REQUEST_V3_SLOW_FILL_PARAMS_DISCRIMINATOR: Uint8Array;
|
|
11
|
-
export declare function getRequestV3SlowFillParamsDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
-
export type RequestV3SlowFillParams = {
|
|
13
|
-
discriminator: ReadonlyUint8Array;
|
|
14
|
-
relayData: V3RelayData;
|
|
15
|
-
};
|
|
16
|
-
export type RequestV3SlowFillParamsArgs = {
|
|
17
|
-
relayData: V3RelayDataArgs;
|
|
18
|
-
};
|
|
19
|
-
export declare function getRequestV3SlowFillParamsEncoder(): Encoder<RequestV3SlowFillParamsArgs>;
|
|
20
|
-
export declare function getRequestV3SlowFillParamsDecoder(): Decoder<RequestV3SlowFillParams>;
|
|
21
|
-
export declare function getRequestV3SlowFillParamsCodec(): Codec<RequestV3SlowFillParamsArgs, RequestV3SlowFillParams>;
|
|
22
|
-
export declare function decodeRequestV3SlowFillParams<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<RequestV3SlowFillParams, TAddress>;
|
|
23
|
-
export declare function decodeRequestV3SlowFillParams<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<RequestV3SlowFillParams, TAddress>;
|
|
24
|
-
export declare function fetchRequestV3SlowFillParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<RequestV3SlowFillParams, TAddress>>;
|
|
25
|
-
export declare function fetchMaybeRequestV3SlowFillParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<RequestV3SlowFillParams, TAddress>>;
|
|
26
|
-
export declare function fetchAllRequestV3SlowFillParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<RequestV3SlowFillParams>[]>;
|
|
27
|
-
export declare function fetchAllMaybeRequestV3SlowFillParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<RequestV3SlowFillParams>[]>;
|