@across-protocol/sdk 4.3.45 → 4.3.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/arch/svm/SpokeUtils.d.ts +21 -10
  2. package/dist/cjs/arch/svm/SpokeUtils.js +128 -10
  3. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/encoders.d.ts +19 -0
  5. package/dist/cjs/arch/svm/encoders.js +52 -0
  6. package/dist/cjs/arch/svm/encoders.js.map +1 -0
  7. package/dist/cjs/arch/svm/index.d.ts +1 -0
  8. package/dist/cjs/arch/svm/index.js +1 -0
  9. package/dist/cjs/arch/svm/index.js.map +1 -1
  10. package/dist/cjs/providers/solana/retryRpcFactory.js +14 -10
  11. package/dist/cjs/providers/solana/retryRpcFactory.js.map +1 -1
  12. package/dist/esm/arch/svm/SpokeUtils.d.ts +38 -10
  13. package/dist/esm/arch/svm/SpokeUtils.js +151 -10
  14. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  15. package/dist/esm/arch/svm/encoders.d.ts +19 -0
  16. package/dist/esm/arch/svm/encoders.js +43 -0
  17. package/dist/esm/arch/svm/encoders.js.map +1 -0
  18. package/dist/esm/arch/svm/index.d.ts +1 -0
  19. package/dist/esm/arch/svm/index.js +1 -0
  20. package/dist/esm/arch/svm/index.js.map +1 -1
  21. package/dist/esm/providers/solana/retryRpcFactory.js +15 -10
  22. package/dist/esm/providers/solana/retryRpcFactory.js.map +1 -1
  23. package/dist/types/arch/svm/SpokeUtils.d.ts +38 -10
  24. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  25. package/dist/types/arch/svm/encoders.d.ts +20 -0
  26. package/dist/types/arch/svm/encoders.d.ts.map +1 -0
  27. package/dist/types/arch/svm/index.d.ts +1 -0
  28. package/dist/types/arch/svm/index.d.ts.map +1 -1
  29. package/dist/types/providers/solana/retryRpcFactory.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/arch/svm/SpokeUtils.ts +187 -4
  32. package/src/arch/svm/encoders.ts +86 -0
  33. package/src/arch/svm/index.ts +1 -0
  34. package/src/providers/solana/retryRpcFactory.ts +6 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/arch/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/arch/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { __awaiter, __extends, __generator, __spreadArray } from "tslib";
2
2
  import { SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR } from "@solana/kit";
3
+ import { getThrowSolanaErrorResponseTransformer } from "@solana/rpc-transformers";
3
4
  import { SolanaClusterRpcFactory } from "./baseRpcFactories";
4
5
  import { RateLimitedSolanaRpcFactory } from "./rateLimitedRpcFactory";
5
6
  import { isSolanaError } from "../../arch/svm";
@@ -51,22 +52,26 @@ var RetrySolanaRpcFactory = /** @class */ (function (_super) {
51
52
  */
52
53
  RetrySolanaRpcFactory.prototype._tryCall = function (transportCall, args) {
53
54
  return __awaiter(this, void 0, void 0, function () {
54
- var method, retryAttempt, error_1, retryDelaySeconds, exponentialBackoff, jitter, delayS;
55
- return __generator(this, function (_a) {
56
- switch (_a.label) {
55
+ var _a, method, params, retryAttempt, response, error_1, retryDelaySeconds, exponentialBackoff, jitter, delayS;
56
+ return __generator(this, function (_b) {
57
+ switch (_b.label) {
57
58
  case 0:
58
- method = args[0].payload.method;
59
+ _a = args[0].payload, method = _a.method, params = _a.params;
59
60
  retryAttempt = 0;
60
- _a.label = 1;
61
+ _b.label = 1;
61
62
  case 1:
62
63
  if (!true) return [3 /*break*/, 7];
63
- _a.label = 2;
64
+ _b.label = 2;
64
65
  case 2:
65
- _a.trys.push([2, 4, , 6]);
66
+ _b.trys.push([2, 4, , 6]);
66
67
  return [4 /*yield*/, transportCall()];
67
- case 3: return [2 /*return*/, _a.sent()];
68
+ case 3:
69
+ response = _b.sent();
70
+ // Make sure SolanaErrors get thrown
71
+ getThrowSolanaErrorResponseTransformer()(response, { methodName: method, params: params });
72
+ return [2 /*return*/, response];
68
73
  case 4:
69
- error_1 = _a.sent();
74
+ error_1 = _b.sent();
70
75
  if (retryAttempt++ >= this.retries || this.shouldFailImmediate(method, error_1)) {
71
76
  throw error_1;
72
77
  }
@@ -86,7 +91,7 @@ var RetrySolanaRpcFactory = /** @class */ (function (_super) {
86
91
  });
87
92
  return [4 /*yield*/, delay(delayS)];
88
93
  case 5:
89
- _a.sent();
94
+ _b.sent();
90
95
  return [3 /*break*/, 6];
91
96
  case 6: return [3 /*break*/, 1];
92
97
  case 7: return [2 /*return*/];
@@ -1 +1 @@
1
- {"version":3,"file":"retryRpcFactory.js","sourceRoot":"","sources":["../../../../src/providers/solana/retryRpcFactory.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,uCAAuC,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,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CAAC;IAED;;;;OAIG;IACK,mDAAmB,GAA3B,UAA4B,KAAc;QACxC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;YACzB,OAAO,KAAK,CAAC;SACd;QAEO,IAAQ,IAAI,GAAK,KAAK,CAAC,OAAO,OAAlB,CAAmB;QACvC,OAAO,IAAI,KAAK,uCAAuC,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,KAAK,GAAG,CAAC;IAC9F,CAAC;IACH,4BAAC;AAAD,CAAC,AArHD,CAA2C,uBAAuB,GAqHjE"}
@@ -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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
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 import("@solana/kit").IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
299
+ instructions: readonly IInstruction<string, readonly (IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
272
300
  version: 0;
273
301
  }>, "feePayer">>;
274
302
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SpokeUtils.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/SpokeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAA8B,MAAM,4BAA4B,CAAC;AAIlH,OAAO,EAEL,IAAI,EAKL,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,OAAO,EAEP,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAalB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAErB,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,SAAS,EACT,wBAAwB,EAEzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,IAAI,UAAU,EACrB,UAAU,EAWX,MAAM,aAAa,CAAC;AAerB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAiB,WAAW,EAAE,MAAM,SAAS,CAAC;AAQ1E;;;GAGG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,KAAK,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,aAAa,CAAC,GAAG;IAC9D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,UAAU,CAAC;IACtB,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,wBAAgB,OAAO,CAAC,Q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AAE,OAAO,CAAC,MAAM,CAAC,EACrB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAEhC"}
@@ -0,0 +1,20 @@
1
+ import { type Address, type Decoder, type Encoder, type ReadonlyUint8Array, type WritableAccount, type ReadonlyAccount } from "@solana/kit";
2
+ export type AcrossPlusMessage = {
3
+ handler: Address;
4
+ read_only_len: number;
5
+ value_amount: bigint;
6
+ accounts: Array<Address>;
7
+ handler_message: ReadonlyUint8Array;
8
+ };
9
+ export type CompiledIx = {
10
+ program_id_index: number;
11
+ account_key_indexes: Array<number>;
12
+ data: ReadonlyUint8Array;
13
+ };
14
+ export declare function getAcrossPlusMessageEncoder(): Encoder<AcrossPlusMessage>;
15
+ export declare function getAcrossPlusMessageDecoder(): Decoder<AcrossPlusMessage>;
16
+ export declare function getHandlerMessageEncoder(): Encoder<Array<CompiledIx>>;
17
+ export declare function getCompiledIxEncoder(): Encoder<CompiledIx>;
18
+ export declare function getCompiledIxDecoder(): Decoder<CompiledIx>;
19
+ export declare function getAccountMeta(value: Address, isWritable: boolean): WritableAccount | ReadonlyAccount;
20
+ //# sourceMappingURL=encoders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoders.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/encoders.ts"],"names":[],"mappings":"AAAA,OAAO,EAkBL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,eAAe,EAAE,kBAAkB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAQxE;AAED,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAQxE;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAErE;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,CAM1D;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,CAM1D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,eAAe,CAKrG"}
@@ -5,4 +5,5 @@ export * from "./utils";
5
5
  export * from "./constants";
6
6
  export * from "./BlockUtils";
7
7
  export * from "./provider";
8
+ export * from "./encoders";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"retryRpcFactory.d.ts","sourceRoot":"","sources":["../../../../src/providers/solana/retryRpcFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2C,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAItE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,qBAAa,qBAAsB,SAAQ,uBAAuB;IAO9D,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IANpC,SAAS,CAAC,oBAAoB,EAAE,YAAY,CAAC;IAE7C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAGd,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,EAClC,GAAG,4BAA4B,EAAE,qBAAqB,CAAC,OAAO,2BAA2B,CAAC;IAuBrF,eAAe,IAAI,YAAY;IAMtC;;;;;OAKG;YACW,QAAQ;IAuCtB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAQ5B"}
1
+ {"version":3,"file":"retryRpcFactory.d.ts","sourceRoot":"","sources":["../../../../src/providers/solana/retryRpcFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2C,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAItE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,qBAAa,qBAAsB,SAAQ,uBAAuB;IAO9D,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IANpC,SAAS,CAAC,oBAAoB,EAAE,YAAY,CAAC;IAE7C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAGd,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,EAClC,GAAG,4BAA4B,EAAE,qBAAqB,CAAC,OAAO,2BAA2B,CAAC;IAuBrF,eAAe,IAAI,YAAY;IAMtC;;;;;OAKG;YACW,QAAQ;IA0CtB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAQ5B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@across-protocol/sdk",
3
3
  "author": "UMA Team",
4
- "version": "4.3.45",
4
+ "version": "4.3.46",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://docs.across.to/reference/sdk",
7
7
  "files": [
@@ -16,6 +16,7 @@ import {
16
16
  Address,
17
17
  FetchAccountConfig,
18
18
  IAccountMeta,
19
+ IInstruction,
19
20
  KeyPairSigner,
20
21
  ReadonlyUint8Array,
21
22
  appendTransactionMessageInstruction,
@@ -31,6 +32,8 @@ import {
31
32
  signTransactionMessageWithSigners,
32
33
  some,
33
34
  type TransactionSigner,
35
+ type WritableAccount,
36
+ type ReadonlyAccount,
34
37
  type Commitment,
35
38
  } from "@solana/kit";
36
39
  import assert from "assert";
@@ -73,6 +76,10 @@ import {
73
76
  toAddress,
74
77
  unwrapEventData,
75
78
  getRootBundlePda,
79
+ getAcrossPlusMessageDecoder,
80
+ getAccountMeta,
81
+ getInstructionParamsPda,
82
+ type AcrossPlusMessage,
76
83
  toSvmRelayData,
77
84
  } from "./";
78
85
  import { SvmCpiEventsClient } from "./eventsClient";
@@ -628,6 +635,21 @@ export async function getFillRelayTx(
628
635
  getAssociatedTokenAddress(SvmAddress.from(signer.address), relayData.outputToken, mintInfo.programAddress),
629
636
  ]);
630
637
 
638
+ // Add remaining accounts if the relayData has a non-empty message.
639
+ // @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
640
+ const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
641
+ if (relayData.message !== "0x") {
642
+ const acrossPlusMessage = deserializeMessage(relayData.message);
643
+ // The first `remainingAccount` _must_ be the handler address.
644
+ // https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
645
+ remainingAccounts.push(getAccountMeta(acrossPlusMessage.handler, true));
646
+ remainingAccounts.push(
647
+ ...acrossPlusMessage.accounts.map((account, idx) =>
648
+ getAccountMeta(account, idx < acrossPlusMessage.accounts.length - acrossPlusMessage.read_only_len)
649
+ )
650
+ );
651
+ }
652
+
631
653
  const fillInput: SvmSpokeClient.FillRelayInput = {
632
654
  signer: signer,
633
655
  state,
@@ -648,7 +670,108 @@ export async function getFillRelayTx(
648
670
  };
649
671
  // Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
650
672
  // if it doesn't exist.
651
- return createFillInstruction(signer, solanaClient, fillInput, mintInfo.data.decimals, true);
673
+ return createFillInstruction(
674
+ signer,
675
+ solanaClient,
676
+ fillInput,
677
+ svmRelayData,
678
+ mintInfo.data.decimals,
679
+ true,
680
+ remainingAccounts
681
+ );
682
+ }
683
+
684
+ /**
685
+ * Creates a fill instruction with an instruction params PDA as the relayData input.
686
+ * @param spokePoolAddr Address of the spoke pool we're trying to fill through
687
+ * @param solanaClient RPC client to interact with Solana chain
688
+ * @param relayData RelayData instance, supplemented with destinationChainId
689
+ * @param signer signer associated with the relayer creating a Fill. Can be VoidSigner for gas estimation
690
+ * @param repaymentChainId Chain id where relayer repayment is desired
691
+ * @param repaymentAddress Address to which repayment will go to on repaymentChainId
692
+ * @returns FillRelay transaction
693
+ */
694
+ export async function getIPFillRelayTx(
695
+ spokePoolAddr: SvmAddress,
696
+ solanaClient: SVMProvider,
697
+ relayData: Omit<RelayData, "recipient" | "outputToken"> & {
698
+ destinationChainId: number;
699
+ recipient: SvmAddress;
700
+ outputToken: SvmAddress;
701
+ },
702
+ signer: TransactionSigner,
703
+ repaymentChainId: number,
704
+ repaymentAddress: SdkAddress
705
+ ) {
706
+ const program = toAddress(spokePoolAddr);
707
+ const _relayDataHash = getRelayDataHash(
708
+ { ...relayData, messageHash: getMessageHash(relayData.message) },
709
+ relayData.destinationChainId
710
+ );
711
+ const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
712
+
713
+ const [state, delegate, instructionParams] = await Promise.all([
714
+ getStatePda(program),
715
+ getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
716
+ getInstructionParamsPda(program, signer.address),
717
+ ]);
718
+
719
+ const mint = toAddress(relayData.outputToken);
720
+ const mintInfo = await getMintInfo(solanaClient, mint);
721
+
722
+ const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
723
+ getAssociatedTokenAddress(relayData.recipient, relayData.outputToken, mintInfo.programAddress),
724
+ getAssociatedTokenAddress(SvmAddress.from(signer.address), relayData.outputToken, mintInfo.programAddress),
725
+ getFillStatusPda(program, relayData, relayData.destinationChainId),
726
+ getEventAuthority(program),
727
+ ]);
728
+
729
+ // Add remaining accounts if the relayData has a non-empty message.
730
+ // @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
731
+ const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
732
+ if (relayData.message !== "0x") {
733
+ const acrossPlusMessage = deserializeMessage(relayData.message);
734
+ // The first `remainingAccount` _must_ be the handler address.
735
+ // https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
736
+ remainingAccounts.push(getAccountMeta(acrossPlusMessage.handler, true));
737
+ remainingAccounts.push(
738
+ ...acrossPlusMessage.accounts.map((account, idx) =>
739
+ getAccountMeta(account, idx < acrossPlusMessage.accounts.length - acrossPlusMessage.read_only_len)
740
+ )
741
+ );
742
+ }
743
+
744
+ const fillInput: SvmSpokeClient.FillRelayInput = {
745
+ signer: signer,
746
+ state,
747
+ delegate,
748
+ mint,
749
+ relayerTokenAccount: relayerAta,
750
+ recipientTokenAccount: recipientAta,
751
+ fillStatus,
752
+ tokenProgram: mintInfo.programAddress,
753
+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
754
+ systemProgram: SYSTEM_PROGRAM_ADDRESS,
755
+ eventAuthority,
756
+ program,
757
+ instructionParams,
758
+ relayHash: relayDataHash,
759
+ relayData: null,
760
+ repaymentChainId: null,
761
+ repaymentAddress: null,
762
+ };
763
+
764
+ // Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
765
+ // if it doesn't exist.
766
+ return createFillInstruction(
767
+ signer,
768
+ solanaClient,
769
+ fillInput,
770
+ { outputAmount: relayData.outputAmount.toBigInt(), recipient: toAddress(relayData.recipient) },
771
+ mintInfo.data.decimals,
772
+ true,
773
+ remainingAccounts
774
+ );
652
775
  }
653
776
 
654
777
  /**
@@ -664,8 +787,10 @@ export const createFillInstruction = async (
664
787
  signer: TransactionSigner,
665
788
  solanaClient: SVMProvider,
666
789
  fillInput: SvmSpokeClient.FillRelayInput,
790
+ relayData: Pick<SvmSpokeClient.RelayDataArgs, "outputAmount" | "recipient">,
667
791
  tokenDecimals: number,
668
- createRecipientAtaIfNeeded: boolean = true
792
+ createRecipientAtaIfNeeded: boolean = true,
793
+ remainingAccounts: (WritableAccount | ReadonlyAccount)[] = []
669
794
  ) => {
670
795
  const mintInfo = await getMintInfo(solanaClient, fillInput.mint);
671
796
  const approveIx = getApproveCheckedInstruction(
@@ -674,7 +799,7 @@ export const createFillInstruction = async (
674
799
  mint: fillInput.mint,
675
800
  delegate: fillInput.delegate,
676
801
  owner: fillInput.signer,
677
- amount: (fillInput.relayData as SvmSpokeClient.RelayDataArgs).outputAmount,
802
+ amount: relayData.outputAmount,
678
803
  decimals: tokenDecimals,
679
804
  },
680
805
  {
@@ -685,7 +810,7 @@ export const createFillInstruction = async (
685
810
  const getCreateAssociatedTokenIdempotentIx = () =>
686
811
  getCreateAssociatedTokenIdempotentInstruction({
687
812
  payer: signer,
688
- owner: (fillInput.relayData as SvmSpokeClient.RelayDataArgs).recipient,
813
+ owner: relayData.recipient,
689
814
  mint: fillInput.mint,
690
815
  ata: fillInput.recipientTokenAccount,
691
816
  systemProgram: SYSTEM_PROGRAM_ADDRESS,
@@ -694,6 +819,9 @@ export const createFillInstruction = async (
694
819
 
695
820
  const createFillIx = SvmSpokeClient.getFillRelayInstruction(fillInput);
696
821
 
822
+ // Add remaining accounts.
823
+ createFillIx.accounts.push(...remainingAccounts);
824
+
697
825
  return pipe(
698
826
  await createDefaultTransaction(solanaClient, signer),
699
827
  (tx) =>
@@ -703,6 +831,14 @@ export const createFillInstruction = async (
703
831
  );
704
832
  };
705
833
 
834
+ export function deserializeMessage(_message: string): AcrossPlusMessage {
835
+ const message = new Uint8Array(Buffer.from(_message.startsWith("0x") ? _message.slice(2) : _message, "hex"));
836
+ // Add remaining accounts if the relayData has a non-empty message.
837
+ // @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
838
+ const acrossPlusMessageDecoder = getAcrossPlusMessageDecoder();
839
+ return acrossPlusMessageDecoder.decode(message);
840
+ }
841
+
706
842
  /**
707
843
  * Creates a deposit instruction.
708
844
  * @param signer - The signer of the transaction.
@@ -972,6 +1108,53 @@ async function fetchBatchFillStatusFromPdaAccounts(
972
1108
  return fillStatuses;
973
1109
  }
974
1110
 
1111
+ /**
1112
+ * Returns a set of instructions to execute to fill a relay via instruction params.
1113
+ * @param spokePool The program ID of the Solana spoke pool.
1114
+ * @param relayData The relay data to write to the instruction params PDA.
1115
+ * @param signer The transaction signer and authority of the instruction params PDA.
1116
+ * @param maxWriteSize The maximum fragment size to write to instruction params.
1117
+ */
1118
+ export async function getFillRelayViaInstructionParamsInstructions(
1119
+ spokePool: Address<string>,
1120
+ relayData: RelayData,
1121
+ repaymentChainId: number,
1122
+ repaymentAddress: SdkAddress,
1123
+ signer: TransactionSigner<string>,
1124
+ maxWriteSize = 450
1125
+ ): Promise<IInstruction[]> {
1126
+ const instructionParams = await getInstructionParamsPda(spokePool, signer.address);
1127
+
1128
+ const relayDataEncoder = SvmSpokeClient.getFillRelayParamsEncoder();
1129
+ const svmRelayData = toSvmRelayData(relayData);
1130
+ const encodedRelayData = relayDataEncoder.encode({
1131
+ relayData: svmRelayData,
1132
+ repaymentChainId,
1133
+ repaymentAddress: toAddress(repaymentAddress),
1134
+ });
1135
+
1136
+ const initInstructionParamsIx = SvmSpokeClient.getInitializeInstructionParamsInstruction({
1137
+ signer,
1138
+ instructionParams,
1139
+ totalSize: encodedRelayData.length,
1140
+ });
1141
+ const instructions: IInstruction[] = [initInstructionParamsIx];
1142
+
1143
+ for (let i = 0; i <= encodedRelayData.length / maxWriteSize; ++i) {
1144
+ const offset = i * maxWriteSize;
1145
+ const offsetEnd = Math.min(offset + maxWriteSize, encodedRelayData.length);
1146
+ const fragment = encodedRelayData.slice(offset, offsetEnd);
1147
+ const writeInstructionParamsIx = SvmSpokeClient.getWriteInstructionParamsFragmentInstruction({
1148
+ signer,
1149
+ instructionParams,
1150
+ offset,
1151
+ fragment,
1152
+ });
1153
+ instructions.push(writeInstructionParamsIx);
1154
+ }
1155
+ return instructions;
1156
+ }
1157
+
975
1158
  /**
976
1159
  * Returns the delegate PDA for deposit.
977
1160
  */
@@ -0,0 +1,86 @@
1
+ import {
2
+ AccountRole,
3
+ addDecoderSizePrefix,
4
+ addEncoderSizePrefix,
5
+ getAddressDecoder,
6
+ getAddressEncoder,
7
+ getArrayEncoder,
8
+ getArrayDecoder,
9
+ getBytesDecoder,
10
+ getBytesEncoder,
11
+ getStructDecoder,
12
+ getStructEncoder,
13
+ getU8Decoder,
14
+ getU8Encoder,
15
+ getU32Decoder,
16
+ getU32Encoder,
17
+ getU64Decoder,
18
+ getU64Encoder,
19
+ type Address,
20
+ type Decoder,
21
+ type Encoder,
22
+ type ReadonlyUint8Array,
23
+ type WritableAccount,
24
+ type ReadonlyAccount,
25
+ } from "@solana/kit";
26
+
27
+ export type AcrossPlusMessage = {
28
+ handler: Address;
29
+ read_only_len: number;
30
+ value_amount: bigint;
31
+ accounts: Array<Address>;
32
+ handler_message: ReadonlyUint8Array;
33
+ };
34
+
35
+ export type CompiledIx = {
36
+ program_id_index: number;
37
+ account_key_indexes: Array<number>;
38
+ data: ReadonlyUint8Array;
39
+ };
40
+
41
+ export function getAcrossPlusMessageEncoder(): Encoder<AcrossPlusMessage> {
42
+ return getStructEncoder([
43
+ ["handler", getAddressEncoder()],
44
+ ["read_only_len", getU8Encoder()],
45
+ ["value_amount", getU64Encoder()],
46
+ ["accounts", getArrayEncoder(getAddressEncoder())],
47
+ ["handler_message", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
48
+ ]);
49
+ }
50
+
51
+ export function getAcrossPlusMessageDecoder(): Decoder<AcrossPlusMessage> {
52
+ return getStructDecoder([
53
+ ["handler", getAddressDecoder()],
54
+ ["read_only_len", getU8Decoder()],
55
+ ["value_amount", getU64Decoder()],
56
+ ["accounts", getArrayDecoder(getAddressDecoder())],
57
+ ["handler_message", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
58
+ ]);
59
+ }
60
+
61
+ export function getHandlerMessageEncoder(): Encoder<Array<CompiledIx>> {
62
+ return getArrayEncoder(getCompiledIxEncoder());
63
+ }
64
+
65
+ export function getCompiledIxEncoder(): Encoder<CompiledIx> {
66
+ return getStructEncoder([
67
+ ["program_id_index", getU8Encoder()],
68
+ ["account_key_indexes", getArrayEncoder(getU8Encoder())],
69
+ ["data", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
70
+ ]);
71
+ }
72
+
73
+ export function getCompiledIxDecoder(): Decoder<CompiledIx> {
74
+ return getStructDecoder([
75
+ ["program_id_index", getU8Decoder()],
76
+ ["account_key_indexes", getArrayDecoder(getU8Decoder())],
77
+ ["data", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
78
+ ]);
79
+ }
80
+
81
+ export function getAccountMeta(value: Address, isWritable: boolean): WritableAccount | ReadonlyAccount {
82
+ return Object.freeze({
83
+ address: value,
84
+ role: isWritable ? AccountRole.WRITABLE : AccountRole.READONLY,
85
+ });
86
+ }
@@ -5,3 +5,4 @@ export * from "./utils";
5
5
  export * from "./constants";
6
6
  export * from "./BlockUtils";
7
7
  export * from "./provider";
8
+ export * from "./encoders";