@across-protocol/sdk 4.3.105 → 4.3.106-beta.0
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/svm/SpokeUtils.d.ts +8 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +26 -3
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/encoders.d.ts +1 -0
- package/dist/cjs/arch/svm/encoders.js +4 -0
- package/dist/cjs/arch/svm/encoders.js.map +1 -1
- package/dist/cjs/providers/solana/utils.d.ts +13 -0
- package/dist/cjs/providers/solana/utils.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +77 -27
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +27 -1
- package/dist/esm/arch/svm/SpokeUtils.js +44 -3
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/encoders.d.ts +1 -0
- package/dist/esm/arch/svm/encoders.js +3 -0
- package/dist/esm/arch/svm/encoders.js.map +1 -1
- package/dist/esm/providers/solana/utils.d.ts +13 -0
- package/dist/esm/providers/solana/utils.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +82 -31
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +27 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/encoders.d.ts +1 -0
- package/dist/types/arch/svm/encoders.d.ts.map +1 -1
- package/dist/types/providers/solana/utils.d.ts +13 -0
- package/dist/types/providers/solana/utils.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -0
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/svm/SpokeUtils.ts +50 -1
- package/src/arch/svm/encoders.ts +4 -0
- package/src/providers/solana/utils.ts +14 -0
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +80 -5
|
@@ -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,EAML,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,OAAO,EAEP,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,
|
|
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,EAML,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,OAAO,EAEP,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAclB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,4BAA4B,EAClC,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,EAYX,MAAM,aAAa,CAAC;AACrB,OAAO,EAeL,KAAK,iBAAiB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5E,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAMA;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAKlE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,MAAM,CAInF;AA2ED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,WAAW,EACzB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,UAAU;;;iBAqDzB;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,WAAW,EACzB,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,UAAU,EACxB,QAAQ,UAAQ,EAChB,UAAU,SAAI,GACb,OAAO,CAAC,MAAM,EAAE,CAAC,CA4BnB;AAED,wBAAsB,WAAW,CAC/B,YAAY,EAAE,WAAW,EACzB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAEhC"}
|
|
@@ -14,6 +14,7 @@ export type CompiledIx = {
|
|
|
14
14
|
export declare function getAcrossPlusMessageEncoder(): Encoder<AcrossPlusMessage>;
|
|
15
15
|
export declare function getAcrossPlusMessageDecoder(): Decoder<AcrossPlusMessage>;
|
|
16
16
|
export declare function getHandlerMessageEncoder(): Encoder<Array<CompiledIx>>;
|
|
17
|
+
export declare function getHandlerMessageDecoder(): Decoder<Array<CompiledIx>>;
|
|
17
18
|
export declare function getCompiledIxEncoder(): Encoder<CompiledIx>;
|
|
18
19
|
export declare function getCompiledIxDecoder(): Decoder<CompiledIx>;
|
|
19
20
|
export declare function getAccountMeta(value: Address, isWritable: boolean): WritableAccount | ReadonlyAccount;
|
|
@@ -1 +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"}
|
|
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,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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RpcTransport } from "@solana/rpc-spec";
|
|
2
|
+
import { CompilableTransactionMessage, SolanaRpcApi } from "@solana/kit";
|
|
2
3
|
/**
|
|
3
4
|
* This is the type we pass to define a Solana RPC request "task".
|
|
4
5
|
*/
|
|
@@ -7,6 +8,18 @@ export interface SolanaRateLimitTask {
|
|
|
7
8
|
resolve: (result: unknown) => void;
|
|
8
9
|
reject: (err: unknown) => void;
|
|
9
10
|
}
|
|
11
|
+
export type SolanaBundleSimulation = {
|
|
12
|
+
result: {
|
|
13
|
+
unitsConsumed: number;
|
|
14
|
+
returnData: {
|
|
15
|
+
programId: string;
|
|
16
|
+
data: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface JitoInterface extends SolanaRpcApi {
|
|
21
|
+
simulateBundle(transactions: CompilableTransactionMessage[]): SolanaBundleSimulation;
|
|
22
|
+
}
|
|
10
23
|
/**
|
|
11
24
|
* Determine whether a Solana RPC error indicates an unrecoverable error that should not be retried.
|
|
12
25
|
* @param method RPC method name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/providers/solana/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/providers/solana/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGzE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAIlC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAChC;AAGD,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACjD,CAAC;CACH,CAAC;AAGF,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,cAAc,CAAC,YAAY,EAAE,4BAA4B,EAAE,GAAG,sBAAsB,CAAC;CACtF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAe3E"}
|
|
@@ -91,5 +91,11 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
91
91
|
* @returns The number of decimals of precision for the corresponding tokenSymbol
|
|
92
92
|
*/
|
|
93
93
|
getTokenDecimals(tokenSymbol: string): number;
|
|
94
|
+
estimateComputeUnits(relayData: RelayData & {
|
|
95
|
+
destinationChainId: number;
|
|
96
|
+
recipient: SvmAddress;
|
|
97
|
+
outputToken: SvmAddress;
|
|
98
|
+
exclusiveRelayer: SvmAddress;
|
|
99
|
+
}, relayer: SvmAddress, repaymentChainId: number, repaymentAddress: SvmAddress): Promise<number>;
|
|
94
100
|
}
|
|
95
101
|
//# sourceMappingURL=svmQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAMlB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EASZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAkB,MAAM,aAAa,CAAC;AACpH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAKvC;;;GAGG;AACH,qB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,CAAC,SAAS,EAAE,WAAW,GAAG,aAAa,CAAC,GAAG;QACxD,kBAAkB,EAAE,MAAM,CAAC;QAC3B,SAAS,EAAE,UAAU,CAAC;QACtB,WAAW,EAAE,UAAU,CAAC;KACzB,EACD,MAAM,EAAE,iBAAiB,EACzB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,OAAO;;;;IAK3B;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUzD;;;;OAIG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAMvC,oBAAoB,CACxB,SAAS,EAAE,SAAS,GAAG;QACrB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,SAAS,EAAE,UAAU,CAAC;QACtB,WAAW,EAAE,UAAU,CAAC;QACxB,gBAAgB,EAAE,UAAU,CAAC;KAC9B,EACD,OAAO,EAAE,UAAU,EACnB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,UAAU,GAC3B,OAAO,CAAC,MAAM,CAAC;CA4BnB"}
|
package/package.json
CHANGED
|
@@ -32,10 +32,12 @@ import {
|
|
|
32
32
|
pipe,
|
|
33
33
|
signTransactionMessageWithSigners,
|
|
34
34
|
some,
|
|
35
|
+
compileTransaction,
|
|
35
36
|
type TransactionSigner,
|
|
36
37
|
type WritableAccount,
|
|
37
38
|
type ReadonlyAccount,
|
|
38
39
|
type Commitment,
|
|
40
|
+
type CompilableTransactionMessage,
|
|
39
41
|
} from "@solana/kit";
|
|
40
42
|
import assert from "assert";
|
|
41
43
|
import winston from "winston";
|
|
@@ -100,6 +102,8 @@ import {
|
|
|
100
102
|
*/
|
|
101
103
|
export const SLOT_DURATION_MS = 400;
|
|
102
104
|
|
|
105
|
+
export const SOLANA_TX_SIZE_LIMIT = 1232;
|
|
106
|
+
|
|
103
107
|
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
|
|
104
108
|
destinationChainId: number;
|
|
105
109
|
recipient: SvmAddress;
|
|
@@ -693,6 +697,8 @@ export async function getIPFillRelayTx(
|
|
|
693
697
|
getEventAuthority(program),
|
|
694
698
|
]);
|
|
695
699
|
|
|
700
|
+
const recipientAtaEncodedAccount = await fetchEncodedAccount(solanaClient, recipientAta);
|
|
701
|
+
|
|
696
702
|
// Add remaining accounts if the relayData has a non-empty message.
|
|
697
703
|
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
698
704
|
const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
|
|
@@ -736,7 +742,7 @@ export async function getIPFillRelayTx(
|
|
|
736
742
|
fillInput,
|
|
737
743
|
{ outputAmount: relayData.outputAmount.toBigInt(), recipient: toAddress(relayData.recipient) },
|
|
738
744
|
mintInfo.data.decimals,
|
|
739
|
-
|
|
745
|
+
!recipientAtaEncodedAccount.exists,
|
|
740
746
|
remainingAccounts
|
|
741
747
|
);
|
|
742
748
|
}
|
|
@@ -1084,6 +1090,8 @@ async function fetchBatchFillStatusFromPdaAccounts(
|
|
|
1084
1090
|
* Returns a set of instructions to execute to fill a relay via instruction params.
|
|
1085
1091
|
* @param spokePool The program ID of the Solana spoke pool.
|
|
1086
1092
|
* @param relayData The relay data to write to the instruction params PDA.
|
|
1093
|
+
* @param repaymentChainId: The chain ID to take repayment.
|
|
1094
|
+
* @param repaymentAddress: The address to receive repayment on the specified repayment chain.
|
|
1087
1095
|
* @param signer The transaction signer and authority of the instruction params PDA.
|
|
1088
1096
|
* @param maxWriteSize The maximum fragment size to write to instruction params.
|
|
1089
1097
|
*/
|
|
@@ -1413,6 +1421,47 @@ export async function getCCTPDepositAccounts(
|
|
|
1413
1421
|
};
|
|
1414
1422
|
}
|
|
1415
1423
|
|
|
1424
|
+
/**
|
|
1425
|
+
* Returns true if the input deposit's corresponding relay data would result in a transaction size
|
|
1426
|
+
* that is larger than the Solana transaction size limit.
|
|
1427
|
+
* @param fillRelayTx The compilable fill relay transaction to check.
|
|
1428
|
+
* @returns Object containing a boolean if the input deposit requires a multipart fill, false otherwise and
|
|
1429
|
+
* the number of bytes in the serialized transaction.
|
|
1430
|
+
*/
|
|
1431
|
+
export function isSVMFillTooLarge(fillRelayTx: CompilableTransactionMessage): {
|
|
1432
|
+
tooLarge: boolean;
|
|
1433
|
+
sizeBytes: number;
|
|
1434
|
+
} {
|
|
1435
|
+
const sizeBytes = calculateFillSizeBytes(fillRelayTx);
|
|
1436
|
+
return {
|
|
1437
|
+
tooLarge: sizeBytes > SOLANA_TX_SIZE_LIMIT,
|
|
1438
|
+
sizeBytes,
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* Returns the byte size of a base64 transaction.
|
|
1444
|
+
* @param base64TxString base64 serialized Solana transaction.
|
|
1445
|
+
* @returns The number of bytes in the transaction.
|
|
1446
|
+
*/
|
|
1447
|
+
export function base64StrToByteSize(base64TxString: string): number {
|
|
1448
|
+
// base64 string has 6 bits per character, so every 4 symbols represent 3 bytes
|
|
1449
|
+
// However, we also need to account for padding: https://en.wikipedia.org/wiki/Base64#Padding
|
|
1450
|
+
const paddingLen = base64TxString.endsWith("==") ? 2 : base64TxString.endsWith("=") ? 1 : 0;
|
|
1451
|
+
return (base64TxString.length * 3) / 4 - paddingLen;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Returns the size of the fill relay transaction using the input relayData.
|
|
1456
|
+
* @param fillTx The compilable fill relay transaction.
|
|
1457
|
+
* @returns The number of bytes in the serialized fillRelay transaction.
|
|
1458
|
+
*/
|
|
1459
|
+
export function calculateFillSizeBytes(fillTx: CompilableTransactionMessage): number {
|
|
1460
|
+
const signedTransaction = compileTransaction(fillTx);
|
|
1461
|
+
const serializedTx = getBase64EncodedWireTransaction(signedTransaction);
|
|
1462
|
+
return base64StrToByteSize(serializedTx);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1416
1465
|
/**
|
|
1417
1466
|
* Returns the account metas for a deposit message.
|
|
1418
1467
|
* @param message The CCTP message.
|
package/src/arch/svm/encoders.ts
CHANGED
|
@@ -62,6 +62,10 @@ export function getHandlerMessageEncoder(): Encoder<Array<CompiledIx>> {
|
|
|
62
62
|
return getArrayEncoder(getCompiledIxEncoder());
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export function getHandlerMessageDecoder(): Decoder<Array<CompiledIx>> {
|
|
66
|
+
return getArrayDecoder(getCompiledIxDecoder());
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
export function getCompiledIxEncoder(): Encoder<CompiledIx> {
|
|
66
70
|
return getStructEncoder([
|
|
67
71
|
["program_id_index", getU8Encoder()],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RpcTransport } from "@solana/rpc-spec";
|
|
2
|
+
import { CompilableTransactionMessage, SolanaRpcApi } from "@solana/kit";
|
|
2
3
|
import { isSolanaError, SVM_SLOT_SKIPPED, SVM_LONG_TERM_STORAGE_SLOT_SKIPPED } from "../../arch/svm";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -14,6 +15,19 @@ export interface SolanaRateLimitTask {
|
|
|
14
15
|
reject: (err: unknown) => void;
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
// `simulateBundle` minimal response struct.
|
|
19
|
+
export type SolanaBundleSimulation = {
|
|
20
|
+
result: {
|
|
21
|
+
unitsConsumed: number;
|
|
22
|
+
returnData: { programId: string; data: string };
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Minimal extension of a Solana RPC Api which also supports some JITO RPC endpoints.
|
|
27
|
+
export interface JitoInterface extends SolanaRpcApi {
|
|
28
|
+
simulateBundle(transactions: CompilableTransactionMessage[]): SolanaBundleSimulation;
|
|
29
|
+
}
|
|
30
|
+
|
|
17
31
|
/**
|
|
18
32
|
* Determine whether a Solana RPC error indicates an unrecoverable error that should not be retried.
|
|
19
33
|
* @param method RPC method name.
|
|
@@ -4,13 +4,27 @@ import {
|
|
|
4
4
|
TransactionSigner,
|
|
5
5
|
fetchEncodedAccount,
|
|
6
6
|
isSome,
|
|
7
|
+
Rpc,
|
|
8
|
+
pipe,
|
|
9
|
+
appendTransactionMessageInstruction,
|
|
7
10
|
} from "@solana/kit";
|
|
8
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
SVMProvider,
|
|
13
|
+
SolanaVoidSigner,
|
|
14
|
+
getFillRelayTx,
|
|
15
|
+
getIPFillRelayTx,
|
|
16
|
+
getFillRelayViaInstructionParamsInstructions,
|
|
17
|
+
toAddress,
|
|
18
|
+
createDefaultTransaction,
|
|
19
|
+
getAssociatedTokenAddress,
|
|
20
|
+
isSVMFillTooLarge,
|
|
21
|
+
} from "../../arch/svm";
|
|
22
|
+
import { JitoInterface } from "../../providers/solana";
|
|
9
23
|
import { Coingecko } from "../../coingecko";
|
|
10
24
|
import { CHAIN_IDs } from "../../constants";
|
|
11
25
|
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
12
26
|
import { RelayData } from "../../interfaces";
|
|
13
|
-
import { Address, BigNumber, BigNumberish, SvmAddress, TransactionCostEstimate, toBN } from "../../utils";
|
|
27
|
+
import { Address, BigNumber, BigNumberish, SvmAddress, TransactionCostEstimate, toBN, mapAsync } from "../../utils";
|
|
14
28
|
import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
|
|
15
29
|
import { SymbolMappingType } from "./";
|
|
16
30
|
import { TOKEN_PROGRAM_ADDRESS } from "@solana-program/token";
|
|
@@ -77,15 +91,35 @@ export class SvmQuery implements QueryInterface {
|
|
|
77
91
|
assert(relayer.isSVM());
|
|
78
92
|
|
|
79
93
|
const [repaymentChainId, repaymentAddress] = [destinationChainId, relayer]; // These are not important for gas cost simulation.
|
|
80
|
-
|
|
94
|
+
|
|
95
|
+
// For solana, we algorithmically estimate gas based on the size of the message.
|
|
96
|
+
const _fillRelayTx = await this.getFillRelayTx(
|
|
81
97
|
{ ...relayData, recipient, outputToken, exclusiveRelayer },
|
|
82
98
|
SolanaVoidSigner(relayer.toBase58()),
|
|
83
99
|
repaymentChainId,
|
|
84
100
|
repaymentAddress
|
|
85
101
|
);
|
|
86
102
|
|
|
87
|
-
const
|
|
88
|
-
|
|
103
|
+
const fillTooLarge = isSVMFillTooLarge(_fillRelayTx);
|
|
104
|
+
// If the fill is too large, we need to construct a dummy fill relay transaction which estimates the priority fee of the fillRelay instruction call. To guarantee
|
|
105
|
+
// that the transaction won't be too large, we overwrite the message with empty bytes.
|
|
106
|
+
const fillRelayTx = fillTooLarge.tooLarge
|
|
107
|
+
? await this.getFillRelayTx(
|
|
108
|
+
{ ...relayData, recipient, outputToken, exclusiveRelayer, message: "0x" },
|
|
109
|
+
SolanaVoidSigner(relayer.toBase58()),
|
|
110
|
+
repaymentChainId,
|
|
111
|
+
repaymentAddress
|
|
112
|
+
)
|
|
113
|
+
: _fillRelayTx;
|
|
114
|
+
const [_computeUnitsConsumed, gasPriceEstimate, tokenAccountInfo] = await Promise.all([
|
|
115
|
+
fillTooLarge.tooLarge
|
|
116
|
+
? this.estimateComputeUnits(
|
|
117
|
+
{ ...relayData, recipient, outputToken, exclusiveRelayer },
|
|
118
|
+
relayer,
|
|
119
|
+
repaymentChainId,
|
|
120
|
+
repaymentAddress
|
|
121
|
+
)
|
|
122
|
+
: this.computeUnitEstimator(fillRelayTx),
|
|
89
123
|
getGasPriceEstimate(this.provider, {
|
|
90
124
|
unsignedTx: fillRelayTx,
|
|
91
125
|
baseFeeMultiplier: options.baseFeeMultiplier,
|
|
@@ -93,6 +127,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
93
127
|
}),
|
|
94
128
|
this.provider.getAccountInfo(toAddress(outputToken), { encoding: "base58" }).send(),
|
|
95
129
|
]);
|
|
130
|
+
const computeUnitsConsumed = toBN(_computeUnitsConsumed);
|
|
96
131
|
|
|
97
132
|
// If the owner of the token account is not the token program, then we can assume that it is the 2022 token program address, in which
|
|
98
133
|
// case we need to determine the extensions the token has to properly calculate rent exemption.
|
|
@@ -211,4 +246,44 @@ export class SvmQuery implements QueryInterface {
|
|
|
211
246
|
if (!this.symbolMapping[tokenSymbol]) throw new Error(`${tokenSymbol} does not exist in mapping`);
|
|
212
247
|
return this.symbolMapping[tokenSymbol].decimals;
|
|
213
248
|
}
|
|
249
|
+
|
|
250
|
+
// The fill is too large; we need to simulate the transaction in a bundle.
|
|
251
|
+
async estimateComputeUnits(
|
|
252
|
+
relayData: RelayData & {
|
|
253
|
+
destinationChainId: number;
|
|
254
|
+
recipient: SvmAddress;
|
|
255
|
+
outputToken: SvmAddress;
|
|
256
|
+
exclusiveRelayer: SvmAddress;
|
|
257
|
+
},
|
|
258
|
+
relayer: SvmAddress,
|
|
259
|
+
repaymentChainId: number,
|
|
260
|
+
repaymentAddress: SvmAddress
|
|
261
|
+
): Promise<number> {
|
|
262
|
+
// @dev There is no way to tell if the RPC supports the JITO interface without querying the rpc directly.
|
|
263
|
+
// Cast the rpc type to support JITO and attempt to call `simulateBundle`. Throw and error if it fails, since
|
|
264
|
+
// the transaction message cannot be simulated otherwise.
|
|
265
|
+
const provider = this.provider as Rpc<JitoInterface>;
|
|
266
|
+
|
|
267
|
+
const spokePoolAddr = toAddress(this.spokePool);
|
|
268
|
+
const voidSigner = SolanaVoidSigner(relayer.toBase58());
|
|
269
|
+
|
|
270
|
+
const [instructionParamsIxs, fillRelayTx] = await Promise.all([
|
|
271
|
+
getFillRelayViaInstructionParamsInstructions(
|
|
272
|
+
spokePoolAddr,
|
|
273
|
+
relayData,
|
|
274
|
+
repaymentChainId,
|
|
275
|
+
repaymentAddress,
|
|
276
|
+
voidSigner
|
|
277
|
+
),
|
|
278
|
+
getIPFillRelayTx(this.spokePool, provider, relayData, voidSigner, repaymentChainId, repaymentAddress),
|
|
279
|
+
]);
|
|
280
|
+
const instructionParamsTxs = await mapAsync(instructionParamsIxs, async (ix) => {
|
|
281
|
+
return pipe(await createDefaultTransaction(provider, voidSigner), (tx) =>
|
|
282
|
+
appendTransactionMessageInstruction(ix, tx)
|
|
283
|
+
);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
const simulateBundleResponse = await provider.simulateBundle([...instructionParamsTxs, fillRelayTx]).send();
|
|
287
|
+
return simulateBundleResponse.result.unitsConsumed;
|
|
288
|
+
}
|
|
214
289
|
}
|