@across-protocol/sdk 4.3.45 → 4.3.47
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/cjs/arch/evm/SpokeUtils.js +30 -28
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +21 -10
- package/dist/cjs/arch/svm/SpokeUtils.js +129 -11
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/encoders.d.ts +19 -0
- package/dist/cjs/arch/svm/encoders.js +52 -0
- package/dist/cjs/arch/svm/encoders.js.map +1 -0
- package/dist/cjs/arch/svm/index.d.ts +1 -0
- package/dist/cjs/arch/svm/index.js +1 -0
- package/dist/cjs/arch/svm/index.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +4 -6
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +0 -5
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +0 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +58 -58
- package/dist/cjs/clients/HubPoolClient.d.ts +9 -3
- package/dist/cjs/clients/HubPoolClient.js +81 -56
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +7 -5
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +13 -16
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +2 -2
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/constants.d.ts +3 -0
- package/dist/cjs/constants.js +10 -2
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/providers/solana/retryRpcFactory.js +14 -10
- package/dist/cjs/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.js +33 -29
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +38 -10
- package/dist/esm/arch/svm/SpokeUtils.js +152 -11
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/encoders.d.ts +19 -0
- package/dist/esm/arch/svm/encoders.js +43 -0
- package/dist/esm/arch/svm/encoders.js.map +1 -0
- package/dist/esm/arch/svm/index.d.ts +1 -0
- package/dist/esm/arch/svm/index.js +1 -0
- package/dist/esm/arch/svm/index.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +5 -7
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +1 -6
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +0 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +58 -58
- package/dist/esm/clients/HubPoolClient.d.ts +9 -3
- package/dist/esm/clients/HubPoolClient.js +87 -60
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +8 -6
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +13 -18
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +2 -2
- package/dist/esm/clients/mocks/MockHubPoolClient.js +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.js +12 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/providers/solana/retryRpcFactory.js +15 -10
- package/dist/esm/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +38 -10
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/encoders.d.ts +20 -0
- package/dist/types/arch/svm/encoders.d.ts.map +1 -0
- package/dist/types/arch/svm/index.d.ts +1 -0
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +58 -58
- package/dist/types/clients/HubPoolClient.d.ts +9 -3
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +2 -2
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/providers/solana/retryRpcFactory.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/arch/evm/SpokeUtils.ts +16 -9
- package/src/arch/svm/SpokeUtils.ts +199 -11
- package/src/arch/svm/encoders.ts +86 -0
- package/src/arch/svm/index.ts +1 -0
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +20 -14
- package/src/clients/BundleDataClient/utils/FillUtils.ts +1 -7
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +0 -2
- package/src/clients/HubPoolClient.ts +79 -50
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +22 -8
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +31 -39
- package/src/clients/mocks/MockHubPoolClient.ts +3 -3
- package/src/constants.ts +12 -0
- package/src/providers/solana/retryRpcFactory.ts +6 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { CHAIN_IDs } from "../../constants";
|
|
3
|
+
import { CHAIN_IDs, SPOKEPOOL_UPGRADE_BLOCKS } from "../../constants";
|
|
4
4
|
import { FillStatus, } from "../../interfaces";
|
|
5
5
|
import { bnUint32Max, BigNumber, toBN, bnZero, chunk, getMessageHash, getRelayDataHash, isDefined, isUnsafeDepositId, getNetworkName, paginatedEventQuery, spreadEventWithBlockNumber, toAddressType, } from "../../utils";
|
|
6
6
|
/**
|
|
@@ -251,67 +251,71 @@ export function fillStatusArray(spokePool, relayData, blockTag) {
|
|
|
251
251
|
* @returns The block number at which the relay was completed, or undefined.
|
|
252
252
|
*/
|
|
253
253
|
export function findFillBlock(spokePool, relayData, lowBlockNumber, highBlockNumber) {
|
|
254
|
+
var _a;
|
|
254
255
|
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
-
var provider,
|
|
256
|
-
return __generator(this, function (
|
|
257
|
-
switch (
|
|
256
|
+
var provider, destinationChainId, _b, _c, _d, _e, initialFillStatus, finalFillStatus, depositId, originChainId, _f, srcChain, dstChain, midBlockNumber, fillStatus;
|
|
257
|
+
return __generator(this, function (_g) {
|
|
258
|
+
switch (_g.label) {
|
|
258
259
|
case 0:
|
|
259
260
|
provider = spokePool.provider;
|
|
260
|
-
if (!(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
if (!Object.values(CHAIN_IDs).includes(relayData.originChainId)) return [3 /*break*/, 2];
|
|
262
|
+
return [4 /*yield*/, provider.getNetwork()];
|
|
263
|
+
case 1:
|
|
264
|
+
_b = (_g.sent()).chainId;
|
|
265
|
+
return [3 /*break*/, 4];
|
|
264
266
|
case 2:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
_c = Number;
|
|
268
|
+
return [4 /*yield*/, spokePool.chainId()];
|
|
267
269
|
case 3:
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (!Object.values(CHAIN_IDs).includes(relayData.originChainId)) return [3 /*break*/, 5];
|
|
271
|
-
return [4 /*yield*/, provider.getNetwork()];
|
|
270
|
+
_b = _c.apply(void 0, [_g.sent()]);
|
|
271
|
+
_g.label = 4;
|
|
272
272
|
case 4:
|
|
273
|
-
|
|
273
|
+
destinationChainId = _b;
|
|
274
|
+
assert(relayData.originChainId !== destinationChainId, "Origin & destination chain IDs must not be equal (".concat(destinationChainId, ")"));
|
|
275
|
+
// For a subset of older SpokePools, their deployment ABIs did not include the fillStatus mapping.
|
|
276
|
+
// Bound any searches by the blocks where fillStatus was added.
|
|
277
|
+
lowBlockNumber = Math.max(lowBlockNumber, (_a = SPOKEPOOL_UPGRADE_BLOCKS[destinationChainId]) !== null && _a !== void 0 ? _a : lowBlockNumber);
|
|
278
|
+
if (!(highBlockNumber !== null && highBlockNumber !== void 0)) return [3 /*break*/, 5];
|
|
279
|
+
_d = highBlockNumber;
|
|
274
280
|
return [3 /*break*/, 7];
|
|
275
|
-
case 5:
|
|
276
|
-
_c = Number;
|
|
277
|
-
return [4 /*yield*/, spokePool.chainId()];
|
|
281
|
+
case 5: return [4 /*yield*/, provider.getBlockNumber()];
|
|
278
282
|
case 6:
|
|
279
|
-
|
|
280
|
-
|
|
283
|
+
_d = (highBlockNumber = _g.sent());
|
|
284
|
+
_g.label = 7;
|
|
281
285
|
case 7:
|
|
282
|
-
|
|
283
|
-
assert(
|
|
286
|
+
_d;
|
|
287
|
+
assert(highBlockNumber > lowBlockNumber, "Block numbers out of range (".concat(lowBlockNumber, " >= ").concat(highBlockNumber, ")"));
|
|
284
288
|
return [4 /*yield*/, Promise.all([
|
|
285
289
|
relayFillStatus(spokePool, relayData, lowBlockNumber, destinationChainId),
|
|
286
290
|
relayFillStatus(spokePool, relayData, highBlockNumber, destinationChainId),
|
|
287
291
|
])];
|
|
288
292
|
case 8:
|
|
289
|
-
|
|
293
|
+
_e = (_g.sent()).map(Number), initialFillStatus = _e[0], finalFillStatus = _e[1];
|
|
290
294
|
if (finalFillStatus !== FillStatus.Filled) {
|
|
291
295
|
return [2 /*return*/, undefined]; // Wasn't filled within the specified block range.
|
|
292
296
|
}
|
|
293
297
|
// Was filled earlier than the specified lowBlock. This is an error by the caller.
|
|
294
298
|
if (initialFillStatus === FillStatus.Filled) {
|
|
295
299
|
depositId = relayData.depositId, originChainId = relayData.originChainId;
|
|
296
|
-
|
|
300
|
+
_f = [getNetworkName(originChainId), getNetworkName(destinationChainId)], srcChain = _f[0], dstChain = _f[1];
|
|
297
301
|
throw new Error("".concat(srcChain, " deposit ").concat(depositId.toString(), " filled on ").concat(dstChain, " before block ").concat(lowBlockNumber));
|
|
298
302
|
}
|
|
299
|
-
|
|
303
|
+
_g.label = 9;
|
|
300
304
|
case 9:
|
|
301
305
|
midBlockNumber = Math.floor((highBlockNumber + lowBlockNumber) / 2);
|
|
302
306
|
return [4 /*yield*/, relayFillStatus(spokePool, relayData, midBlockNumber, destinationChainId)];
|
|
303
307
|
case 10:
|
|
304
|
-
fillStatus =
|
|
308
|
+
fillStatus = _g.sent();
|
|
305
309
|
if (fillStatus === FillStatus.Filled) {
|
|
306
310
|
highBlockNumber = midBlockNumber;
|
|
307
311
|
}
|
|
308
312
|
else {
|
|
309
313
|
lowBlockNumber = midBlockNumber + 1;
|
|
310
314
|
}
|
|
311
|
-
|
|
315
|
+
_g.label = 11;
|
|
312
316
|
case 11:
|
|
313
317
|
if (lowBlockNumber < highBlockNumber) return [3 /*break*/, 9];
|
|
314
|
-
|
|
318
|
+
_g.label = 12;
|
|
315
319
|
case 12: return [2 /*return*/, lowBlockNumber];
|
|
316
320
|
}
|
|
317
321
|
});
|
|
@@ -352,7 +356,7 @@ export function findFillEvent(spokePool, relayData, lowBlockNumber, highBlockNum
|
|
|
352
356
|
case 6:
|
|
353
357
|
destinationChainId = _b;
|
|
354
358
|
fillEvent = spreadEventWithBlockNumber(event);
|
|
355
|
-
fill = __assign(__assign({}, fillEvent), { inputToken: toAddressType(fillEvent.inputToken, relayData.originChainId), outputToken: toAddressType(fillEvent.outputToken, destinationChainId), depositor: toAddressType(fillEvent.depositor, relayData.originChainId), recipient: toAddressType(fillEvent.recipient, destinationChainId), exclusiveRelayer: toAddressType(fillEvent.exclusiveRelayer, destinationChainId), relayer: toAddressType(fillEvent.relayer,
|
|
359
|
+
fill = __assign(__assign({}, fillEvent), { inputToken: toAddressType(fillEvent.inputToken, relayData.originChainId), outputToken: toAddressType(fillEvent.outputToken, destinationChainId), depositor: toAddressType(fillEvent.depositor, relayData.originChainId), recipient: toAddressType(fillEvent.recipient, destinationChainId), exclusiveRelayer: toAddressType(fillEvent.exclusiveRelayer, destinationChainId), relayer: toAddressType(fillEvent.relayer, fillEvent.repaymentChainId), relayExecutionInfo: __assign(__assign({}, fillEvent.relayExecutionInfo), { updatedRecipient: toAddressType(fillEvent.relayExecutionInfo.updatedRecipient, destinationChainId) }), destinationChainId: destinationChainId, messageHash: getMessageHash(event.args.message) });
|
|
356
360
|
return [2 /*return*/, fill];
|
|
357
361
|
}
|
|
358
362
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpokeUtils.js","sourceRoot":"","sources":["../../../../src/arch/evm/SpokeUtils.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"S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,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,kBAAkB,CAAC,EACrE,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,aAAa,CAAC,EACtE,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,kBAAkB,CAAC,EACjE,gBAAgB,EAAE,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EAC/E,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,EACrE,kBAAkB,wBACb,SAAS,CAAC,kBAAkB,KAC/B,gBAAgB,EAAE,aAAa,CAAC,SAAS,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,KAEpG,kBAAkB,oBAAA,EAClB,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAChD,CAAC;oBAEF,sBAAO,IAAI,EAAC;;;;CACb"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { MessageTransmitterClient, SvmSpokeClient } from "@across-protocol/contracts";
|
|
2
2
|
import { Mint } from "@solana-program/token";
|
|
3
|
-
import { Account, Address, FetchAccountConfig, IAccountMeta, KeyPairSigner, ReadonlyUint8Array, type TransactionSigner, type Commitment } from "@solana/kit";
|
|
3
|
+
import { Account, Address, FetchAccountConfig, IAccountMeta, IInstruction, KeyPairSigner, ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type ReadonlyAccount, type Commitment } from "@solana/kit";
|
|
4
4
|
import winston from "winston";
|
|
5
5
|
import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayDataWithMessageHash } from "../../interfaces";
|
|
6
6
|
import { BigNumber, EvmAddress, Address as SdkAddress, SvmAddress } from "../../utils";
|
|
7
|
+
import { type AcrossPlusMessage } from "./";
|
|
7
8
|
import { SvmCpiEventsClient } from "./eventsClient";
|
|
8
9
|
import { AttestedCCTPMessage, SVMProvider } from "./types";
|
|
9
10
|
/**
|
|
@@ -132,7 +133,25 @@ export declare function getFillRelayTx(spokePoolAddr: SvmAddress, solanaClient:
|
|
|
132
133
|
recipient: SvmAddress;
|
|
133
134
|
outputToken: SvmAddress;
|
|
134
135
|
}, signer: TransactionSigner, repaymentChainId: number, repaymentAddress: SdkAddress): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
135
|
-
instructions: readonly
|
|
136
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
137
|
+
version: 0;
|
|
138
|
+
}>, "feePayer">>;
|
|
139
|
+
/**
|
|
140
|
+
* Creates a fill instruction with an instruction params PDA as the relayData input.
|
|
141
|
+
* @param spokePoolAddr Address of the spoke pool we're trying to fill through
|
|
142
|
+
* @param solanaClient RPC client to interact with Solana chain
|
|
143
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
144
|
+
* @param signer signer associated with the relayer creating a Fill. Can be VoidSigner for gas estimation
|
|
145
|
+
* @param repaymentChainId Chain id where relayer repayment is desired
|
|
146
|
+
* @param repaymentAddress Address to which repayment will go to on repaymentChainId
|
|
147
|
+
* @returns FillRelay transaction
|
|
148
|
+
*/
|
|
149
|
+
export declare function getIPFillRelayTx(spokePoolAddr: SvmAddress, solanaClient: SVMProvider, relayData: Omit<RelayData, "recipient" | "outputToken"> & {
|
|
150
|
+
destinationChainId: number;
|
|
151
|
+
recipient: SvmAddress;
|
|
152
|
+
outputToken: SvmAddress;
|
|
153
|
+
}, signer: TransactionSigner, repaymentChainId: number, repaymentAddress: SdkAddress): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
154
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
136
155
|
version: 0;
|
|
137
156
|
}>, "feePayer">>;
|
|
138
157
|
/**
|
|
@@ -144,10 +163,11 @@ export declare function getFillRelayTx(spokePoolAddr: SvmAddress, solanaClient:
|
|
|
144
163
|
* @param createRecipientAtaIfNeeded - Whether to create a recipient token account.
|
|
145
164
|
* @returns The fill instruction.
|
|
146
165
|
*/
|
|
147
|
-
export declare const createFillInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, fillInput: SvmSpokeClient.FillRelayInput, tokenDecimals: number, createRecipientAtaIfNeeded?: boolean) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
148
|
-
instructions: readonly
|
|
166
|
+
export declare const createFillInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, fillInput: SvmSpokeClient.FillRelayInput, relayData: Pick<SvmSpokeClient.RelayDataArgs, "outputAmount" | "recipient">, tokenDecimals: number, createRecipientAtaIfNeeded?: boolean, remainingAccounts?: (WritableAccount | ReadonlyAccount)[]) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
167
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
149
168
|
version: 0;
|
|
150
169
|
}>, "feePayer">>;
|
|
170
|
+
export declare function deserializeMessage(_message: string): AcrossPlusMessage;
|
|
151
171
|
/**
|
|
152
172
|
* Creates a deposit instruction.
|
|
153
173
|
* @param signer - The signer of the transaction.
|
|
@@ -158,7 +178,7 @@ export declare const createFillInstruction: (signer: TransactionSigner, solanaCl
|
|
|
158
178
|
* @returns The deposit instruction.
|
|
159
179
|
*/
|
|
160
180
|
export declare const createDepositInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, depositInput: SvmSpokeClient.DepositInput, tokenDecimals: number, createVaultAtaIfNeeded?: boolean) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
161
|
-
instructions: readonly
|
|
181
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
162
182
|
version: 0;
|
|
163
183
|
}>, "feePayer">>;
|
|
164
184
|
/**
|
|
@@ -169,7 +189,7 @@ export declare const createDepositInstruction: (signer: TransactionSigner, solan
|
|
|
169
189
|
* @returns The request slow fill instruction.
|
|
170
190
|
*/
|
|
171
191
|
export declare const createRequestSlowFillInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, requestSlowFillInput: SvmSpokeClient.RequestSlowFillInput) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
172
|
-
instructions: readonly
|
|
192
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
173
193
|
version: 0;
|
|
174
194
|
}>, "feePayer">>;
|
|
175
195
|
/**
|
|
@@ -185,7 +205,7 @@ export declare function getSlowFillRequestTx(spokePoolAddr: SvmAddress, solanaCl
|
|
|
185
205
|
recipient: SvmAddress;
|
|
186
206
|
outputToken: SvmAddress;
|
|
187
207
|
}, signer: TransactionSigner): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
188
|
-
instructions: readonly
|
|
208
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
189
209
|
version: 0;
|
|
190
210
|
}>, "feePayer">>;
|
|
191
211
|
/**
|
|
@@ -196,17 +216,25 @@ export declare function getSlowFillRequestTx(spokePoolAddr: SvmAddress, solanaCl
|
|
|
196
216
|
* @returns The close fill PDA instruction.
|
|
197
217
|
*/
|
|
198
218
|
export declare const createCloseFillPdaInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, fillStatusPda: Address) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
199
|
-
instructions: readonly
|
|
219
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
200
220
|
version: 0;
|
|
201
221
|
}>, "feePayer">>;
|
|
202
222
|
export declare const createReceiveMessageInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, input: MessageTransmitterClient.ReceiveMessageInput, remainingAccounts: IAccountMeta<string>[]) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
203
|
-
instructions: readonly
|
|
223
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
204
224
|
version: 0;
|
|
205
225
|
}>, "feePayer">>;
|
|
206
226
|
export declare function getAssociatedTokenAddress(owner: SvmAddress, mint: SvmAddress, tokenProgramId?: Address<string>): Promise<Address<string>>;
|
|
207
227
|
export declare function getRelayDataHash(relayData: RelayData & {
|
|
208
228
|
messageHash: string;
|
|
209
229
|
}, destinationChainId: number): string;
|
|
230
|
+
/**
|
|
231
|
+
* Returns a set of instructions to execute to fill a relay via instruction params.
|
|
232
|
+
* @param spokePool The program ID of the Solana spoke pool.
|
|
233
|
+
* @param relayData The relay data to write to the instruction params PDA.
|
|
234
|
+
* @param signer The transaction signer and authority of the instruction params PDA.
|
|
235
|
+
* @param maxWriteSize The maximum fragment size to write to instruction params.
|
|
236
|
+
*/
|
|
237
|
+
export declare function getFillRelayViaInstructionParamsInstructions(spokePool: Address<string>, relayData: RelayData, repaymentChainId: number, repaymentAddress: SdkAddress, signer: TransactionSigner<string>, maxWriteSize?: number): Promise<IInstruction[]>;
|
|
210
238
|
/**
|
|
211
239
|
* Returns the delegate PDA for deposit.
|
|
212
240
|
*/
|
|
@@ -268,7 +296,7 @@ export declare function getAccountMetasForTokenlessMessage(solanaClient: SVMProv
|
|
|
268
296
|
* @returns The CCTP v1 receive message transaction.
|
|
269
297
|
*/
|
|
270
298
|
export declare function getCCTPV1ReceiveMessageTx(solanaClient: SVMProvider, signer: KeyPairSigner, message: AttestedCCTPMessage, hubChainId: number, recipientAta: SvmAddress): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
271
|
-
instructions: readonly
|
|
299
|
+
instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
272
300
|
version: 0;
|
|
273
301
|
}>, "feePayer">>;
|
|
274
302
|
/**
|
|
@@ -10,7 +10,7 @@ import { arrayify } from "ethers/lib/utils";
|
|
|
10
10
|
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "../../constants";
|
|
11
11
|
import { FillStatus, } from "../../interfaces";
|
|
12
12
|
import { EvmAddress, SvmAddress, bs58, chainIsProd, chainIsSvm, chunk, delay, getMessageHash, isUnsafeDepositId, keccak256, mapAsync, toAddressType, } from "../../utils";
|
|
13
|
-
import { createDefaultTransaction, getCCTPNoncePda, getEventAuthority, getFillStatusPda, getSelfAuthority, getStatePda, isDepositForBurnEvent, simulateAndDecode, toAddress, unwrapEventData, getRootBundlePda, toSvmRelayData, } from "./";
|
|
13
|
+
import { createDefaultTransaction, getCCTPNoncePda, getEventAuthority, getFillStatusPda, getSelfAuthority, getStatePda, isDepositForBurnEvent, simulateAndDecode, toAddress, unwrapEventData, getRootBundlePda, getAcrossPlusMessageDecoder, getAccountMeta, getInstructionParamsPda, toSvmRelayData, } from "./";
|
|
14
14
|
import { SVM_BLOCK_NOT_AVAILABLE, SVM_SLOT_SKIPPED, isSolanaError } from "./provider";
|
|
15
15
|
import { SVMEventNames } from "./types";
|
|
16
16
|
import { getEmergencyDeleteRootBundleRootBundleId, getNearestSlotTime, isEmergencyDeleteRootBundleMessageBody, isRelayRootBundleMessageBody, } from "./utils";
|
|
@@ -404,7 +404,7 @@ export function findFillEvent(relayData, destinationChainId, svmEventsClient, fr
|
|
|
404
404
|
rawFillEvent = fillEvents[0];
|
|
405
405
|
eventData = unwrapEventData(rawFillEvent.data, ["depositId", "inputAmount"]);
|
|
406
406
|
originChainId = eventData.originChainId;
|
|
407
|
-
parsedFillEvent = __assign(__assign({}, eventData), {
|
|
407
|
+
parsedFillEvent = __assign(__assign({}, eventData), { txnRef: rawFillEvent.signature, blockNumber: Number(rawFillEvent.slot), txnIndex: 0, logIndex: 0, destinationChainId: destinationChainId, inputToken: toAddressType(eventData.inputToken, originChainId), outputToken: toAddressType(eventData.outputToken, destinationChainId), relayer: toAddressType(eventData.relayer, eventData.repaymentChainId), exclusiveRelayer: toAddressType(eventData.exclusiveRelayer, destinationChainId), depositor: toAddressType(eventData.depositor, originChainId), recipient: toAddressType(eventData.recipient, destinationChainId), relayExecutionInfo: __assign(__assign({}, eventData.relayExecutionInfo), { updatedRecipient: eventData.relayExecutionInfo.updatedRecipient }) });
|
|
408
408
|
return [2 /*return*/, parsedFillEvent];
|
|
409
409
|
}
|
|
410
410
|
return [2 /*return*/, undefined];
|
|
@@ -483,7 +483,7 @@ export function createTokenAccountsInstruction(mint, relayer) {
|
|
|
483
483
|
*/
|
|
484
484
|
export function getFillRelayTx(spokePoolAddr, solanaClient, relayData, signer, repaymentChainId, repaymentAddress) {
|
|
485
485
|
return __awaiter(this, void 0, void 0, function () {
|
|
486
|
-
var svmRelayData, program, messageHash, _relayDataHash, relayDataHash, _a, state, delegate, mintInfo, fillStatus, eventAuthority, _b, recipientAta, relayerAta, fillInput;
|
|
486
|
+
var svmRelayData, program, messageHash, _relayDataHash, relayDataHash, _a, state, delegate, mintInfo, fillStatus, eventAuthority, _b, recipientAta, relayerAta, remainingAccounts, acrossPlusMessage_1, fillInput;
|
|
487
487
|
return __generator(this, function (_c) {
|
|
488
488
|
switch (_c.label) {
|
|
489
489
|
case 0:
|
|
@@ -508,6 +508,16 @@ export function getFillRelayTx(spokePoolAddr, solanaClient, relayData, signer, r
|
|
|
508
508
|
])];
|
|
509
509
|
case 2:
|
|
510
510
|
_b = _c.sent(), recipientAta = _b[0], relayerAta = _b[1];
|
|
511
|
+
remainingAccounts = [];
|
|
512
|
+
if (relayData.message !== "0x") {
|
|
513
|
+
acrossPlusMessage_1 = deserializeMessage(relayData.message);
|
|
514
|
+
// The first `remainingAccount` _must_ be the handler address.
|
|
515
|
+
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
|
|
516
|
+
remainingAccounts.push(getAccountMeta(acrossPlusMessage_1.handler, true));
|
|
517
|
+
remainingAccounts.push.apply(remainingAccounts, acrossPlusMessage_1.accounts.map(function (account, idx) {
|
|
518
|
+
return getAccountMeta(account, idx < acrossPlusMessage_1.accounts.length - acrossPlusMessage_1.read_only_len);
|
|
519
|
+
}));
|
|
520
|
+
}
|
|
511
521
|
fillInput = {
|
|
512
522
|
signer: signer,
|
|
513
523
|
state: state,
|
|
@@ -528,7 +538,81 @@ export function getFillRelayTx(spokePoolAddr, solanaClient, relayData, signer, r
|
|
|
528
538
|
};
|
|
529
539
|
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
530
540
|
// if it doesn't exist.
|
|
531
|
-
return [2 /*return*/, createFillInstruction(signer, solanaClient, fillInput, mintInfo.data.decimals, true)];
|
|
541
|
+
return [2 /*return*/, createFillInstruction(signer, solanaClient, fillInput, svmRelayData, mintInfo.data.decimals, true, remainingAccounts)];
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Creates a fill instruction with an instruction params PDA as the relayData input.
|
|
548
|
+
* @param spokePoolAddr Address of the spoke pool we're trying to fill through
|
|
549
|
+
* @param solanaClient RPC client to interact with Solana chain
|
|
550
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
551
|
+
* @param signer signer associated with the relayer creating a Fill. Can be VoidSigner for gas estimation
|
|
552
|
+
* @param repaymentChainId Chain id where relayer repayment is desired
|
|
553
|
+
* @param repaymentAddress Address to which repayment will go to on repaymentChainId
|
|
554
|
+
* @returns FillRelay transaction
|
|
555
|
+
*/
|
|
556
|
+
export function getIPFillRelayTx(spokePoolAddr, solanaClient, relayData, signer, repaymentChainId, repaymentAddress) {
|
|
557
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
558
|
+
var program, _relayDataHash, relayDataHash, _a, state, delegate, instructionParams, mint, mintInfo, _b, recipientAta, relayerAta, fillStatus, eventAuthority, remainingAccounts, acrossPlusMessage_2, fillInput;
|
|
559
|
+
return __generator(this, function (_c) {
|
|
560
|
+
switch (_c.label) {
|
|
561
|
+
case 0:
|
|
562
|
+
program = toAddress(spokePoolAddr);
|
|
563
|
+
_relayDataHash = getRelayDataHash(__assign(__assign({}, relayData), { messageHash: getMessageHash(relayData.message) }), relayData.destinationChainId);
|
|
564
|
+
relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
565
|
+
return [4 /*yield*/, Promise.all([
|
|
566
|
+
getStatePda(program),
|
|
567
|
+
getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
|
|
568
|
+
getInstructionParamsPda(program, signer.address),
|
|
569
|
+
])];
|
|
570
|
+
case 1:
|
|
571
|
+
_a = _c.sent(), state = _a[0], delegate = _a[1], instructionParams = _a[2];
|
|
572
|
+
mint = toAddress(relayData.outputToken);
|
|
573
|
+
return [4 /*yield*/, getMintInfo(solanaClient, mint)];
|
|
574
|
+
case 2:
|
|
575
|
+
mintInfo = _c.sent();
|
|
576
|
+
return [4 /*yield*/, Promise.all([
|
|
577
|
+
getAssociatedTokenAddress(relayData.recipient, relayData.outputToken, mintInfo.programAddress),
|
|
578
|
+
getAssociatedTokenAddress(SvmAddress.from(signer.address), relayData.outputToken, mintInfo.programAddress),
|
|
579
|
+
getFillStatusPda(program, relayData, relayData.destinationChainId),
|
|
580
|
+
getEventAuthority(program),
|
|
581
|
+
])];
|
|
582
|
+
case 3:
|
|
583
|
+
_b = _c.sent(), recipientAta = _b[0], relayerAta = _b[1], fillStatus = _b[2], eventAuthority = _b[3];
|
|
584
|
+
remainingAccounts = [];
|
|
585
|
+
if (relayData.message !== "0x") {
|
|
586
|
+
acrossPlusMessage_2 = deserializeMessage(relayData.message);
|
|
587
|
+
// The first `remainingAccount` _must_ be the handler address.
|
|
588
|
+
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
|
|
589
|
+
remainingAccounts.push(getAccountMeta(acrossPlusMessage_2.handler, true));
|
|
590
|
+
remainingAccounts.push.apply(remainingAccounts, acrossPlusMessage_2.accounts.map(function (account, idx) {
|
|
591
|
+
return getAccountMeta(account, idx < acrossPlusMessage_2.accounts.length - acrossPlusMessage_2.read_only_len);
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
fillInput = {
|
|
595
|
+
signer: signer,
|
|
596
|
+
state: state,
|
|
597
|
+
delegate: delegate,
|
|
598
|
+
mint: mint,
|
|
599
|
+
relayerTokenAccount: relayerAta,
|
|
600
|
+
recipientTokenAccount: recipientAta,
|
|
601
|
+
fillStatus: fillStatus,
|
|
602
|
+
tokenProgram: mintInfo.programAddress,
|
|
603
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
604
|
+
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
605
|
+
eventAuthority: eventAuthority,
|
|
606
|
+
program: program,
|
|
607
|
+
instructionParams: instructionParams,
|
|
608
|
+
relayHash: relayDataHash,
|
|
609
|
+
relayData: null,
|
|
610
|
+
repaymentChainId: null,
|
|
611
|
+
repaymentAddress: null,
|
|
612
|
+
};
|
|
613
|
+
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
614
|
+
// if it doesn't exist.
|
|
615
|
+
return [2 /*return*/, createFillInstruction(signer, solanaClient, fillInput, { outputAmount: relayData.outputAmount.toBigInt(), recipient: toAddress(relayData.recipient) }, mintInfo.data.decimals, true, remainingAccounts)];
|
|
532
616
|
}
|
|
533
617
|
});
|
|
534
618
|
});
|
|
@@ -542,21 +626,23 @@ export function getFillRelayTx(spokePoolAddr, solanaClient, relayData, signer, r
|
|
|
542
626
|
* @param createRecipientAtaIfNeeded - Whether to create a recipient token account.
|
|
543
627
|
* @returns The fill instruction.
|
|
544
628
|
*/
|
|
545
|
-
export var createFillInstruction = function (signer, solanaClient, fillInput, tokenDecimals, createRecipientAtaIfNeeded) {
|
|
629
|
+
export var createFillInstruction = function (signer, solanaClient, fillInput, relayData, tokenDecimals, createRecipientAtaIfNeeded, remainingAccounts) {
|
|
546
630
|
if (createRecipientAtaIfNeeded === void 0) { createRecipientAtaIfNeeded = true; }
|
|
631
|
+
if (remainingAccounts === void 0) { remainingAccounts = []; }
|
|
547
632
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
548
633
|
var mintInfo, approveIx, getCreateAssociatedTokenIdempotentIx, createFillIx, _a;
|
|
549
|
-
|
|
550
|
-
|
|
634
|
+
var _b;
|
|
635
|
+
return __generator(this, function (_c) {
|
|
636
|
+
switch (_c.label) {
|
|
551
637
|
case 0: return [4 /*yield*/, getMintInfo(solanaClient, fillInput.mint)];
|
|
552
638
|
case 1:
|
|
553
|
-
mintInfo =
|
|
639
|
+
mintInfo = _c.sent();
|
|
554
640
|
approveIx = getApproveCheckedInstruction({
|
|
555
641
|
source: fillInput.relayerTokenAccount,
|
|
556
642
|
mint: fillInput.mint,
|
|
557
643
|
delegate: fillInput.delegate,
|
|
558
644
|
owner: fillInput.signer,
|
|
559
|
-
amount:
|
|
645
|
+
amount: relayData.outputAmount,
|
|
560
646
|
decimals: tokenDecimals,
|
|
561
647
|
}, {
|
|
562
648
|
programAddress: mintInfo.programAddress,
|
|
@@ -564,7 +650,7 @@ export var createFillInstruction = function (signer, solanaClient, fillInput, to
|
|
|
564
650
|
getCreateAssociatedTokenIdempotentIx = function () {
|
|
565
651
|
return getCreateAssociatedTokenIdempotentInstruction({
|
|
566
652
|
payer: signer,
|
|
567
|
-
owner:
|
|
653
|
+
owner: relayData.recipient,
|
|
568
654
|
mint: fillInput.mint,
|
|
569
655
|
ata: fillInput.recipientTokenAccount,
|
|
570
656
|
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
@@ -572,9 +658,11 @@ export var createFillInstruction = function (signer, solanaClient, fillInput, to
|
|
|
572
658
|
});
|
|
573
659
|
};
|
|
574
660
|
createFillIx = SvmSpokeClient.getFillRelayInstruction(fillInput);
|
|
661
|
+
// Add remaining accounts.
|
|
662
|
+
(_b = createFillIx.accounts).push.apply(_b, remainingAccounts);
|
|
575
663
|
_a = pipe;
|
|
576
664
|
return [4 /*yield*/, createDefaultTransaction(solanaClient, signer)];
|
|
577
|
-
case 2: return [2 /*return*/, _a.apply(void 0, [
|
|
665
|
+
case 2: return [2 /*return*/, _a.apply(void 0, [_c.sent(), function (tx) {
|
|
578
666
|
return createRecipientAtaIfNeeded ? appendTransactionMessageInstruction(getCreateAssociatedTokenIdempotentIx(), tx) : tx;
|
|
579
667
|
},
|
|
580
668
|
function (tx) { return appendTransactionMessageInstruction(approveIx, tx); },
|
|
@@ -583,6 +671,13 @@ export var createFillInstruction = function (signer, solanaClient, fillInput, to
|
|
|
583
671
|
});
|
|
584
672
|
});
|
|
585
673
|
};
|
|
674
|
+
export function deserializeMessage(_message) {
|
|
675
|
+
var message = new Uint8Array(Buffer.from(_message.startsWith("0x") ? _message.slice(2) : _message, "hex"));
|
|
676
|
+
// Add remaining accounts if the relayData has a non-empty message.
|
|
677
|
+
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
678
|
+
var acrossPlusMessageDecoder = getAcrossPlusMessageDecoder();
|
|
679
|
+
return acrossPlusMessageDecoder.decode(message);
|
|
680
|
+
}
|
|
586
681
|
/**
|
|
587
682
|
* Creates a deposit instruction.
|
|
588
683
|
* @param signer - The signer of the transaction.
|
|
@@ -859,6 +954,52 @@ function fetchBatchFillStatusFromPdaAccounts(provider, fillStatusPdas, relayData
|
|
|
859
954
|
});
|
|
860
955
|
});
|
|
861
956
|
}
|
|
957
|
+
/**
|
|
958
|
+
* Returns a set of instructions to execute to fill a relay via instruction params.
|
|
959
|
+
* @param spokePool The program ID of the Solana spoke pool.
|
|
960
|
+
* @param relayData The relay data to write to the instruction params PDA.
|
|
961
|
+
* @param signer The transaction signer and authority of the instruction params PDA.
|
|
962
|
+
* @param maxWriteSize The maximum fragment size to write to instruction params.
|
|
963
|
+
*/
|
|
964
|
+
export function getFillRelayViaInstructionParamsInstructions(spokePool, relayData, repaymentChainId, repaymentAddress, signer, maxWriteSize) {
|
|
965
|
+
if (maxWriteSize === void 0) { maxWriteSize = 450; }
|
|
966
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
967
|
+
var instructionParams, relayDataEncoder, svmRelayData, encodedRelayData, initInstructionParamsIx, instructions, i, offset, offsetEnd, fragment, writeInstructionParamsIx;
|
|
968
|
+
return __generator(this, function (_a) {
|
|
969
|
+
switch (_a.label) {
|
|
970
|
+
case 0: return [4 /*yield*/, getInstructionParamsPda(spokePool, signer.address)];
|
|
971
|
+
case 1:
|
|
972
|
+
instructionParams = _a.sent();
|
|
973
|
+
relayDataEncoder = SvmSpokeClient.getFillRelayParamsEncoder();
|
|
974
|
+
svmRelayData = toSvmRelayData(relayData);
|
|
975
|
+
encodedRelayData = relayDataEncoder.encode({
|
|
976
|
+
relayData: svmRelayData,
|
|
977
|
+
repaymentChainId: repaymentChainId,
|
|
978
|
+
repaymentAddress: toAddress(repaymentAddress),
|
|
979
|
+
});
|
|
980
|
+
initInstructionParamsIx = SvmSpokeClient.getInitializeInstructionParamsInstruction({
|
|
981
|
+
signer: signer,
|
|
982
|
+
instructionParams: instructionParams,
|
|
983
|
+
totalSize: encodedRelayData.length,
|
|
984
|
+
});
|
|
985
|
+
instructions = [initInstructionParamsIx];
|
|
986
|
+
for (i = 0; i <= encodedRelayData.length / maxWriteSize; ++i) {
|
|
987
|
+
offset = i * maxWriteSize;
|
|
988
|
+
offsetEnd = Math.min(offset + maxWriteSize, encodedRelayData.length);
|
|
989
|
+
fragment = encodedRelayData.slice(offset, offsetEnd);
|
|
990
|
+
writeInstructionParamsIx = SvmSpokeClient.getWriteInstructionParamsFragmentInstruction({
|
|
991
|
+
signer: signer,
|
|
992
|
+
instructionParams: instructionParams,
|
|
993
|
+
offset: offset,
|
|
994
|
+
fragment: fragment,
|
|
995
|
+
});
|
|
996
|
+
instructions.push(writeInstructionParamsIx);
|
|
997
|
+
}
|
|
998
|
+
return [2 /*return*/, instructions];
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
862
1003
|
/**
|
|
863
1004
|
* Returns the delegate PDA for deposit.
|
|
864
1005
|
*/
|