@across-protocol/sdk 4.3.114-alpha.2 → 4.3.114
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 +24 -17
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/types.d.ts +1 -2
- package/dist/cjs/arch/svm/types.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +9 -4
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +24 -17
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/types.d.ts +1 -6
- package/dist/esm/arch/svm/types.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +9 -4
- package/dist/esm/arch/svm/utils.js +1 -1
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/solana.js +1 -1
- package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +3 -3
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +24 -17
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/types.d.ts +1 -6
- package/dist/types/arch/svm/types.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +9 -4
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/package.json +7 -17
- package/src/arch/svm/SpokeUtils.ts +26 -24
- package/src/arch/svm/types.ts +0 -11
- package/src/arch/svm/utils.ts +4 -11
- package/src/clients/BundleDataClient/BundleDataClient.ts +1 -1
- package/src/gasPriceOracle/adapters/solana.ts +3 -8
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"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"}
|
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.114
|
|
4
|
+
"version": "4.3.114",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -109,18 +109,16 @@
|
|
|
109
109
|
"dependencies": {
|
|
110
110
|
"@across-protocol/across-token": "^1.0.0",
|
|
111
111
|
"@across-protocol/constants": "^3.1.97",
|
|
112
|
-
"@across-protocol/contracts": "4.1.
|
|
112
|
+
"@across-protocol/contracts": "4.1.20",
|
|
113
113
|
"@coral-xyz/anchor": "^0.30.1",
|
|
114
114
|
"@eth-optimism/sdk": "^3.3.1",
|
|
115
115
|
"@ethersproject/bignumber": "^5.7.0",
|
|
116
116
|
"@nktkas/hyperliquid": "^0.25.9",
|
|
117
117
|
"@pinata/sdk": "^2.1.0",
|
|
118
|
-
"@solana-program/system": "^0.
|
|
119
|
-
"@solana-program/token": "^0.
|
|
120
|
-
"@solana-program/
|
|
121
|
-
"@solana
|
|
122
|
-
"@solana/kit": "^5.4.0",
|
|
123
|
-
"@solana/sysvars": "^5.4.0",
|
|
118
|
+
"@solana-program/system": "^0.7.0",
|
|
119
|
+
"@solana-program/token-2022": "^0.4.0",
|
|
120
|
+
"@solana-program/compute-budget": "^0.8.0",
|
|
121
|
+
"@solana/kit": "^2.3.0",
|
|
124
122
|
"arweave": "^1.14.4",
|
|
125
123
|
"async": "^3.2.5",
|
|
126
124
|
"axios": "^0.27.2",
|
|
@@ -170,15 +168,7 @@
|
|
|
170
168
|
"**/ethereum-cryptography/secp256k1": "4.0.4",
|
|
171
169
|
"**/arbundles/secp256k1": "4.0.4",
|
|
172
170
|
"**/ganache/secp256k1": "4.0.4",
|
|
173
|
-
"**/ethereumjs-util/secp256k1": "3.8.1"
|
|
174
|
-
"**/@solana/codecs": "5.4.0",
|
|
175
|
-
"**/@solana/codecs-core": "5.4.0",
|
|
176
|
-
"**/@solana/codecs-data-structures": "5.4.0",
|
|
177
|
-
"**/@solana/codecs-numbers": "5.4.0",
|
|
178
|
-
"**/@solana/codecs-strings": "5.4.0",
|
|
179
|
-
"**/@solana/addresses": "5.4.0",
|
|
180
|
-
"**/@solana/options": "5.4.0",
|
|
181
|
-
"**/@solana/errors": "5.4.0"
|
|
171
|
+
"**/ethereumjs-util/secp256k1": "3.8.1"
|
|
182
172
|
},
|
|
183
173
|
"overrides": {
|
|
184
174
|
"secp256k1@3.7.1": "3.8.1",
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
} from "@solana-program/token";
|
|
14
14
|
import {
|
|
15
15
|
Account,
|
|
16
|
-
AccountMeta,
|
|
17
16
|
AccountRole,
|
|
18
17
|
Address,
|
|
19
18
|
FetchAccountConfig,
|
|
20
|
-
|
|
19
|
+
IAccountMeta,
|
|
20
|
+
IInstruction,
|
|
21
21
|
KeyPairSigner,
|
|
22
22
|
ReadonlyUint8Array,
|
|
23
23
|
appendTransactionMessageInstruction,
|
|
@@ -37,6 +37,8 @@ import {
|
|
|
37
37
|
type WritableAccount,
|
|
38
38
|
type ReadonlyAccount,
|
|
39
39
|
type Commitment,
|
|
40
|
+
type CompilableTransactionMessage,
|
|
41
|
+
type TransactionMessageWithBlockhashLifetime,
|
|
40
42
|
} from "@solana/kit";
|
|
41
43
|
import assert from "assert";
|
|
42
44
|
import winston from "winston";
|
|
@@ -87,7 +89,7 @@ import {
|
|
|
87
89
|
} from "./";
|
|
88
90
|
import { SvmCpiEventsClient } from "./eventsClient";
|
|
89
91
|
import { SVM_LONG_TERM_STORAGE_SLOT_SKIPPED, SVM_SLOT_SKIPPED, isSolanaError } from "./provider";
|
|
90
|
-
import { AttestedCCTPMessage, SVMEventNames, SVMProvider, LatestBlockhash
|
|
92
|
+
import { AttestedCCTPMessage, SVMEventNames, SVMProvider, LatestBlockhash } from "./types";
|
|
91
93
|
import {
|
|
92
94
|
getEmergencyDeleteRootBundleRootBundleId,
|
|
93
95
|
getNearestSlotTime,
|
|
@@ -502,7 +504,7 @@ export async function fillRelayInstruction(
|
|
|
502
504
|
recipientTokenAccount: Address<string>,
|
|
503
505
|
repaymentAddress: EvmAddress | SvmAddress,
|
|
504
506
|
repaymentChainId: number
|
|
505
|
-
): Promise<
|
|
507
|
+
): Promise<IInstruction> {
|
|
506
508
|
const program = toAddress(spokePool);
|
|
507
509
|
assert(
|
|
508
510
|
repaymentAddress.isValidOn(repaymentChainId),
|
|
@@ -577,7 +579,7 @@ export async function getFillRelayTx(
|
|
|
577
579
|
signer: TransactionSigner,
|
|
578
580
|
repaymentChainId: number,
|
|
579
581
|
repaymentAddress: SdkAddress
|
|
580
|
-
): Promise<
|
|
582
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
|
|
581
583
|
const svmRelayData = toSvmRelayData(relayData);
|
|
582
584
|
|
|
583
585
|
assert(
|
|
@@ -672,7 +674,7 @@ export async function getIPFillRelayTx(
|
|
|
672
674
|
signer: TransactionSigner,
|
|
673
675
|
repaymentChainId: number,
|
|
674
676
|
repaymentAddress: SdkAddress
|
|
675
|
-
): Promise<
|
|
677
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
|
|
676
678
|
const program = toAddress(spokePoolAddr);
|
|
677
679
|
const _relayDataHash = getRelayDataHash(
|
|
678
680
|
{ ...relayData, messageHash: getMessageHash(relayData.message) },
|
|
@@ -763,7 +765,7 @@ export const createFillInstruction = async (
|
|
|
763
765
|
tokenDecimals: number,
|
|
764
766
|
createRecipientAta: boolean = false,
|
|
765
767
|
remainingAccounts: (WritableAccount | ReadonlyAccount)[] = []
|
|
766
|
-
): Promise<
|
|
768
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
|
|
767
769
|
const mintInfo = await getMintInfo(solanaClient, fillInput.mint);
|
|
768
770
|
const approveIx = getApproveCheckedInstruction(
|
|
769
771
|
{
|
|
@@ -831,7 +833,7 @@ export const createDepositInstruction = async (
|
|
|
831
833
|
depositInput: SvmSpokeClient.DepositInput,
|
|
832
834
|
tokenDecimals: number,
|
|
833
835
|
createVaultAtaIfNeeded: boolean = true
|
|
834
|
-
): Promise<
|
|
836
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
|
|
835
837
|
const getCreateAssociatedTokenIdempotentIx = () =>
|
|
836
838
|
getCreateAssociatedTokenIdempotentInstruction({
|
|
837
839
|
payer: signer,
|
|
@@ -876,7 +878,7 @@ export const createRequestSlowFillInstruction = async (
|
|
|
876
878
|
signer: TransactionSigner,
|
|
877
879
|
solanaClient: SVMProvider,
|
|
878
880
|
requestSlowFillInput: SvmSpokeClient.RequestSlowFillInput
|
|
879
|
-
): Promise<
|
|
881
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
|
|
880
882
|
const requestSlowFillIx = SvmSpokeClient.getRequestSlowFillInstruction(requestSlowFillInput);
|
|
881
883
|
|
|
882
884
|
return pipe(await createDefaultTransaction(solanaClient, signer), (tx) =>
|
|
@@ -901,7 +903,7 @@ export async function getSlowFillRequestTx(
|
|
|
901
903
|
outputToken: SvmAddress;
|
|
902
904
|
},
|
|
903
905
|
signer: TransactionSigner
|
|
904
|
-
): Promise<
|
|
906
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
|
|
905
907
|
const program = toAddress(spokePoolAddr);
|
|
906
908
|
const messageHash = getMessageHash(relayData.message);
|
|
907
909
|
const relayDataHash = getRelayDataHash({ ...relayData, messageHash }, relayData.destinationChainId);
|
|
@@ -938,7 +940,7 @@ export const createCloseFillPdaInstruction = async (
|
|
|
938
940
|
signer: TransactionSigner,
|
|
939
941
|
solanaClient: SVMProvider,
|
|
940
942
|
fillStatusPda: Address
|
|
941
|
-
): Promise<
|
|
943
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
|
|
942
944
|
const closeFillPdaIx = SvmSpokeClient.getCloseFillPdaInstruction({
|
|
943
945
|
signer,
|
|
944
946
|
state: await getStatePda(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
|
|
@@ -953,10 +955,10 @@ export const createReceiveMessageInstruction = async (
|
|
|
953
955
|
signer: TransactionSigner,
|
|
954
956
|
solanaClient: SVMProvider,
|
|
955
957
|
input: MessageTransmitterClient.ReceiveMessageInput,
|
|
956
|
-
remainingAccounts:
|
|
957
|
-
): Promise<
|
|
958
|
+
remainingAccounts: IAccountMeta<string>[]
|
|
959
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
|
|
958
960
|
const receiveMessageIx = MessageTransmitterClient.getReceiveMessageInstruction(input);
|
|
959
|
-
(receiveMessageIx.accounts as
|
|
961
|
+
(receiveMessageIx.accounts as IAccountMeta<string>[]).push(...remainingAccounts);
|
|
960
962
|
return pipe(await createDefaultTransaction(solanaClient, signer), (tx) =>
|
|
961
963
|
appendTransactionMessageInstruction(receiveMessageIx, tx)
|
|
962
964
|
);
|
|
@@ -1092,7 +1094,7 @@ export async function getIPForFillRelayTxs(
|
|
|
1092
1094
|
repaymentAddress: SdkAddress,
|
|
1093
1095
|
signer: TransactionSigner<string>,
|
|
1094
1096
|
provider: SVMProvider
|
|
1095
|
-
)
|
|
1097
|
+
) {
|
|
1096
1098
|
const ixs = await getFillRelayViaInstructionParamsInstructions(
|
|
1097
1099
|
toAddress(spokePool),
|
|
1098
1100
|
relayData,
|
|
@@ -1124,7 +1126,7 @@ export async function getFillRelayViaInstructionParamsInstructions(
|
|
|
1124
1126
|
signer: TransactionSigner<string>,
|
|
1125
1127
|
provider: SVMProvider,
|
|
1126
1128
|
maxWriteSize = 450
|
|
1127
|
-
): Promise<
|
|
1129
|
+
): Promise<IInstruction[]> {
|
|
1128
1130
|
const instructionParams = await getInstructionParamsPda(spokePool, signer.address);
|
|
1129
1131
|
const encodedInstructionParams = await fetchEncodedAccount(provider, instructionParams);
|
|
1130
1132
|
|
|
@@ -1141,7 +1143,7 @@ export async function getFillRelayViaInstructionParamsInstructions(
|
|
|
1141
1143
|
instructionParams,
|
|
1142
1144
|
totalSize: encodedRelayData.length,
|
|
1143
1145
|
});
|
|
1144
|
-
const instructions:
|
|
1146
|
+
const instructions: IInstruction[] = [initInstructionParamsIx];
|
|
1145
1147
|
|
|
1146
1148
|
for (let i = 0; i <= encodedRelayData.length / maxWriteSize; ++i) {
|
|
1147
1149
|
const offset = i * maxWriteSize;
|
|
@@ -1326,7 +1328,7 @@ export async function getAccountMetasForTokenlessMessage(
|
|
|
1326
1328
|
solanaClient: SVMProvider,
|
|
1327
1329
|
signer: KeyPairSigner,
|
|
1328
1330
|
messageBytes: string
|
|
1329
|
-
): Promise<
|
|
1331
|
+
): Promise<IAccountMeta<string>[]> {
|
|
1330
1332
|
const messageHex = messageBytes.slice(2);
|
|
1331
1333
|
const messageHeader = decodeMessageHeader(Buffer.from(messageHex, "hex"));
|
|
1332
1334
|
const programAddress = SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
@@ -1334,7 +1336,7 @@ export async function getAccountMetasForTokenlessMessage(
|
|
|
1334
1336
|
const selfAuthority = await getSelfAuthority();
|
|
1335
1337
|
const eventAuthority = await getEventAuthority(programAddress);
|
|
1336
1338
|
|
|
1337
|
-
const base:
|
|
1339
|
+
const base: IAccountMeta<string>[] = [
|
|
1338
1340
|
{ address: statePda, role: AccountRole.READONLY },
|
|
1339
1341
|
{ address: selfAuthority, role: AccountRole.READONLY },
|
|
1340
1342
|
{ address: programAddress, role: AccountRole.READONLY },
|
|
@@ -1453,7 +1455,7 @@ export async function getCCTPDepositAccounts(
|
|
|
1453
1455
|
* @returns Object containing a boolean if the input deposit requires a multipart fill, false otherwise and
|
|
1454
1456
|
* the number of bytes in the serialized transaction.
|
|
1455
1457
|
*/
|
|
1456
|
-
export function isSVMFillTooLarge(fillRelayTx:
|
|
1458
|
+
export function isSVMFillTooLarge(fillRelayTx: CompilableTransactionMessage): {
|
|
1457
1459
|
tooLarge: boolean;
|
|
1458
1460
|
sizeBytes: number;
|
|
1459
1461
|
} {
|
|
@@ -1481,7 +1483,7 @@ export function base64StrToByteSize(base64TxString: string): number {
|
|
|
1481
1483
|
* @param fillTx The compilable fill relay transaction.
|
|
1482
1484
|
* @returns The number of bytes in the serialized fillRelay transaction.
|
|
1483
1485
|
*/
|
|
1484
|
-
export function calculateFillSizeBytes(fillTx:
|
|
1486
|
+
export function calculateFillSizeBytes(fillTx: CompilableTransactionMessage): number {
|
|
1485
1487
|
const signedTransaction = compileTransaction(fillTx);
|
|
1486
1488
|
const serializedTx = getBase64EncodedWireTransaction(signedTransaction);
|
|
1487
1489
|
return base64StrToByteSize(serializedTx);
|
|
@@ -1500,7 +1502,7 @@ async function getAccountMetasForDepositMessage(
|
|
|
1500
1502
|
hubChainId: number,
|
|
1501
1503
|
tokenMessengerMinter: Address,
|
|
1502
1504
|
recipientAta: SvmAddress
|
|
1503
|
-
): Promise<
|
|
1505
|
+
): Promise<IAccountMeta<string>[]> {
|
|
1504
1506
|
const l1Usdc = EvmAddress.from(TOKEN_SYMBOLS_MAP.USDC.addresses[hubChainId]);
|
|
1505
1507
|
const l2Usdc = SvmAddress.from(
|
|
1506
1508
|
TOKEN_SYMBOLS_MAP.USDC.addresses[chainIsProd(hubChainId) ? CHAIN_IDs.SOLANA : CHAIN_IDs.SOLANA_DEVNET]
|
|
@@ -1575,7 +1577,7 @@ export async function getCCTPV1ReceiveMessageTx(
|
|
|
1575
1577
|
message: AttestedCCTPMessage,
|
|
1576
1578
|
hubChainId: number,
|
|
1577
1579
|
recipientAta: SvmAddress
|
|
1578
|
-
): Promise<
|
|
1580
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
|
|
1579
1581
|
const [messageTransmitterPda] = await getProgramDerivedAddress({
|
|
1580
1582
|
programAddress: MessageTransmitterClient.MESSAGE_TRANSMITTER_PROGRAM_ADDRESS,
|
|
1581
1583
|
seeds: ["message_transmitter"],
|
|
@@ -1599,7 +1601,7 @@ export async function getCCTPV1ReceiveMessageTx(
|
|
|
1599
1601
|
const usedNonces = await getCCTPNoncePda(solanaClient, signer, message.nonce, message.sourceDomain);
|
|
1600
1602
|
|
|
1601
1603
|
// Notice: for Svm tokenless messages, we currently only support very specific finalizations: Hub -> Spoke relayRootBundle calls
|
|
1602
|
-
const accountMetas:
|
|
1604
|
+
const accountMetas: IAccountMeta<string>[] = isDepositForBurnEvent(message)
|
|
1603
1605
|
? await getAccountMetasForDepositMessage(
|
|
1604
1606
|
message,
|
|
1605
1607
|
hubChainId,
|
package/src/arch/svm/types.ts
CHANGED
|
@@ -10,19 +10,8 @@ import {
|
|
|
10
10
|
SolanaRpcApiFromTransport,
|
|
11
11
|
UnixTimestamp,
|
|
12
12
|
type Blockhash,
|
|
13
|
-
type TransactionMessage,
|
|
14
|
-
type TransactionMessageWithBlockhashLifetime,
|
|
15
|
-
type TransactionMessageWithFeePayer,
|
|
16
13
|
} from "@solana/kit";
|
|
17
14
|
|
|
18
|
-
/**
|
|
19
|
-
* A Solana transaction message ready to be signed and sent.
|
|
20
|
-
* Includes fee payer and blockhash lifetime information.
|
|
21
|
-
*/
|
|
22
|
-
export type SolanaTransaction = TransactionMessage &
|
|
23
|
-
TransactionMessageWithBlockhashLifetime &
|
|
24
|
-
TransactionMessageWithFeePayer;
|
|
25
|
-
|
|
26
15
|
export type EventData =
|
|
27
16
|
| SvmSpokeClient.BridgedToHubPool
|
|
28
17
|
| SvmSpokeClient.TokensBridged
|
package/src/arch/svm/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MessageTransmitterClient, SpokePool__factory, SvmSpokeClient } from "@a
|
|
|
2
2
|
import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor";
|
|
3
3
|
import {
|
|
4
4
|
Address,
|
|
5
|
-
|
|
5
|
+
IInstruction,
|
|
6
6
|
KeyPairSigner,
|
|
7
7
|
address,
|
|
8
8
|
appendTransactionMessageInstruction,
|
|
@@ -26,14 +26,7 @@ import { ethers } from "ethers";
|
|
|
26
26
|
import { FillType, RelayData, RelayDataWithMessageHash } from "../../interfaces";
|
|
27
27
|
import { BigNumber, Address as SdkAddress, biMin, getMessageHash, isDefined, isUint8Array } from "../../utils";
|
|
28
28
|
import { getTimestampForSlot, getSlot, getRelayDataHash } from "./SpokeUtils";
|
|
29
|
-
import {
|
|
30
|
-
AttestedCCTPMessage,
|
|
31
|
-
EventName,
|
|
32
|
-
SVMEventNames,
|
|
33
|
-
SVMProvider,
|
|
34
|
-
LatestBlockhash,
|
|
35
|
-
SolanaTransaction,
|
|
36
|
-
} from "./types";
|
|
29
|
+
import { AttestedCCTPMessage, EventName, SVMEventNames, SVMProvider, LatestBlockhash } from "./types";
|
|
37
30
|
import winston from "winston";
|
|
38
31
|
/**
|
|
39
32
|
* Basic void TransactionSigner type
|
|
@@ -418,7 +411,7 @@ export const createDefaultTransaction = async (
|
|
|
418
411
|
rpcClient: SVMProvider,
|
|
419
412
|
signer: TransactionSigner,
|
|
420
413
|
latestBlockhash?: LatestBlockhash
|
|
421
|
-
)
|
|
414
|
+
) => {
|
|
422
415
|
latestBlockhash = isDefined(latestBlockhash) ? latestBlockhash : (await rpcClient.getLatestBlockhash().send()).value;
|
|
423
416
|
return pipe(
|
|
424
417
|
createTransactionMessage({ version: 0 }),
|
|
@@ -437,7 +430,7 @@ export const createDefaultTransaction = async (
|
|
|
437
430
|
*/
|
|
438
431
|
export const simulateAndDecode = async <P extends (buf: Buffer) => unknown>(
|
|
439
432
|
solanaClient: SVMProvider,
|
|
440
|
-
ix:
|
|
433
|
+
ix: IInstruction,
|
|
441
434
|
signer: KeyPairSigner,
|
|
442
435
|
parser: P,
|
|
443
436
|
latestBlockhash?: LatestBlockhash
|
|
@@ -455,7 +455,7 @@ export class BundleDataClient {
|
|
|
455
455
|
};
|
|
456
456
|
|
|
457
457
|
const _depositIsExpired = (deposit: DepositWithBlock): boolean => {
|
|
458
|
-
return deposit.fillDeadline
|
|
458
|
+
return deposit.fillDeadline <= bundleBlockTimestamps[deposit.destinationChainId][1];
|
|
459
459
|
};
|
|
460
460
|
|
|
461
461
|
const _getFillStatusForDeposit = (deposit: Deposit, queryBlock: number): Promise<FillStatus> => {
|
|
@@ -2,12 +2,7 @@ import { SVMProvider } from "../../arch/svm";
|
|
|
2
2
|
import { toBN, dedupArray } from "../../utils";
|
|
3
3
|
import { SvmGasPriceEstimate } from "../types";
|
|
4
4
|
import { GasPriceEstimateOptions } from "../oracle";
|
|
5
|
-
import {
|
|
6
|
-
TransactionMessage,
|
|
7
|
-
TransactionMessageBytesBase64,
|
|
8
|
-
TransactionMessageWithFeePayer,
|
|
9
|
-
compileTransaction,
|
|
10
|
-
} from "@solana/kit";
|
|
5
|
+
import { CompilableTransactionMessage, TransactionMessageBytesBase64, compileTransaction } from "@solana/kit";
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* @notice Returns result of getFeeForMessage and getRecentPrioritizationFees RPC calls.
|
|
@@ -16,8 +11,8 @@ import {
|
|
|
16
11
|
export async function messageFee(provider: SVMProvider, opts: GasPriceEstimateOptions): Promise<SvmGasPriceEstimate> {
|
|
17
12
|
const { unsignedTx: _unsignedTx } = opts;
|
|
18
13
|
|
|
19
|
-
// Cast the opaque unsignedTx type to a solana-kit
|
|
20
|
-
const unsignedTx = _unsignedTx as
|
|
14
|
+
// Cast the opaque unsignedTx type to a solana-kit CompilableTransactionMessage.
|
|
15
|
+
const unsignedTx = _unsignedTx as CompilableTransactionMessage;
|
|
21
16
|
const compiledTransaction = compileTransaction(unsignedTx);
|
|
22
17
|
|
|
23
18
|
// Get this base fee. This should result in LAMPORTS_PER_SIGNATURE * nSignatures.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import {
|
|
3
|
+
getComputeUnitEstimateForTransactionMessageFactory,
|
|
3
4
|
TransactionSigner,
|
|
4
5
|
fetchEncodedAccount,
|
|
5
6
|
isSome,
|
|
@@ -8,7 +9,8 @@ import {
|
|
|
8
9
|
appendTransactionMessageInstruction,
|
|
9
10
|
compileTransaction,
|
|
10
11
|
getBase64EncodedWireTransaction,
|
|
11
|
-
type
|
|
12
|
+
type CompilableTransactionMessage,
|
|
13
|
+
type TransactionMessageWithBlockhashLifetime,
|
|
12
14
|
} from "@solana/kit";
|
|
13
15
|
import {
|
|
14
16
|
SVMProvider,
|
|
@@ -20,7 +22,6 @@ import {
|
|
|
20
22
|
createDefaultTransaction,
|
|
21
23
|
getAssociatedTokenAddress,
|
|
22
24
|
isSVMFillTooLarge,
|
|
23
|
-
SolanaTransaction,
|
|
24
25
|
} from "../../arch/svm";
|
|
25
26
|
import { JitoInterface } from "../../providers/solana";
|
|
26
27
|
import { Coingecko } from "../../coingecko";
|
|
@@ -32,7 +33,7 @@ import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator
|
|
|
32
33
|
import { SymbolMappingType } from "./";
|
|
33
34
|
import { TOKEN_PROGRAM_ADDRESS } from "@solana-program/token";
|
|
34
35
|
import { TOKEN_2022_PROGRAM_ADDRESS, getTokenSize, fetchMint, Extension } from "@solana-program/token-2022";
|
|
35
|
-
import { getSetComputeUnitLimitInstruction
|
|
36
|
+
import { getSetComputeUnitLimitInstruction } from "@solana-program/compute-budget";
|
|
36
37
|
import { arch } from "../..";
|
|
37
38
|
|
|
38
39
|
/**
|
|
@@ -63,7 +64,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
63
64
|
readonly fixedGasPrice?: BigNumberish,
|
|
64
65
|
readonly coingeckoBaseCurrency: string = "eth"
|
|
65
66
|
) {
|
|
66
|
-
this.computeUnitEstimator =
|
|
67
|
+
this.computeUnitEstimator = getComputeUnitEstimateForTransactionMessageFactory({
|
|
67
68
|
rpc: provider,
|
|
68
69
|
});
|
|
69
70
|
}
|
|
@@ -223,7 +224,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
223
224
|
signer: TransactionSigner,
|
|
224
225
|
repaymentChainId: number,
|
|
225
226
|
repaymentAddress: Address
|
|
226
|
-
): Promise<
|
|
227
|
+
): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
|
|
227
228
|
return await getFillRelayTx(this.spokePool, this.provider, relayData, signer, repaymentChainId, repaymentAddress);
|
|
228
229
|
}
|
|
229
230
|
|
|
@@ -289,7 +290,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
289
290
|
const computeUnitLimitIx = getSetComputeUnitLimitInstruction({ units: 10_000_000 });
|
|
290
291
|
const fillRelayTx = pipe(_fillRelayTx, (tx) => appendTransactionMessageInstruction(computeUnitLimitIx, tx));
|
|
291
292
|
|
|
292
|
-
const instructionParamsTxs = await mapAsync(instructionParamsIxs, async (ix
|
|
293
|
+
const instructionParamsTxs = await mapAsync(instructionParamsIxs, async (ix) => {
|
|
293
294
|
return pipe(await createDefaultTransaction(provider, voidSigner), (tx) =>
|
|
294
295
|
appendTransactionMessageInstruction(ix, tx)
|
|
295
296
|
);
|