@across-protocol/sdk 4.3.113 → 4.3.114-alpha.1

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 (165) hide show
  1. package/dist/cjs/arch/svm/SpokeUtils.d.ts +17 -24
  2. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  3. package/dist/cjs/arch/svm/types.d.ts +2 -1
  4. package/dist/cjs/arch/svm/types.js.map +1 -1
  5. package/dist/cjs/arch/svm/utils.d.ts +4 -9
  6. package/dist/cjs/arch/svm/utils.js.map +1 -1
  7. package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -1
  8. package/dist/cjs/index.d.ts +0 -1
  9. package/dist/cjs/index.js +1 -2
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  12. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +1 -1
  13. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  14. package/dist/esm/arch/svm/SpokeUtils.d.ts +17 -24
  15. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  16. package/dist/esm/arch/svm/types.d.ts +6 -1
  17. package/dist/esm/arch/svm/types.js.map +1 -1
  18. package/dist/esm/arch/svm/utils.d.ts +4 -9
  19. package/dist/esm/arch/svm/utils.js.map +1 -1
  20. package/dist/esm/gasPriceOracle/adapters/solana.js +1 -1
  21. package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -1
  22. package/dist/esm/index.d.ts +0 -1
  23. package/dist/esm/index.js +0 -2
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  26. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +3 -3
  27. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  28. package/dist/types/arch/svm/SpokeUtils.d.ts +17 -24
  29. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  30. package/dist/types/arch/svm/types.d.ts +6 -1
  31. package/dist/types/arch/svm/types.d.ts.map +1 -1
  32. package/dist/types/arch/svm/utils.d.ts +4 -9
  33. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  34. package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +1 -1
  35. package/dist/types/index.d.ts +0 -1
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  38. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  39. package/package.json +17 -8
  40. package/src/arch/svm/SpokeUtils.ts +24 -26
  41. package/src/arch/svm/types.ts +9 -0
  42. package/src/arch/svm/utils.ts +4 -4
  43. package/src/gasPriceOracle/adapters/solana.ts +8 -3
  44. package/src/index.ts +0 -1
  45. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +6 -7
  46. package/dist/cjs/pool/TransactionManager.d.ts +0 -12
  47. package/dist/cjs/pool/TransactionManager.js +0 -121
  48. package/dist/cjs/pool/TransactionManager.js.map +0 -1
  49. package/dist/cjs/pool/index.d.ts +0 -1
  50. package/dist/cjs/pool/index.js +0 -5
  51. package/dist/cjs/pool/index.js.map +0 -1
  52. package/dist/cjs/pool/poolClient.d.ts +0 -228
  53. package/dist/cjs/pool/poolClient.js +0 -869
  54. package/dist/cjs/pool/poolClient.js.map +0 -1
  55. package/dist/cjs/pool/uma/across/constants.d.ts +0 -2
  56. package/dist/cjs/pool/uma/across/constants.js +0 -6
  57. package/dist/cjs/pool/uma/across/constants.js.map +0 -1
  58. package/dist/cjs/pool/uma/across/index.d.ts +0 -2
  59. package/dist/cjs/pool/uma/across/index.js +0 -8
  60. package/dist/cjs/pool/uma/across/index.js.map +0 -1
  61. package/dist/cjs/pool/uma/across/transactionManager.d.ts +0 -12
  62. package/dist/cjs/pool/uma/across/transactionManager.js +0 -121
  63. package/dist/cjs/pool/uma/across/transactionManager.js.map +0 -1
  64. package/dist/cjs/pool/uma/clients/erc20/client.d.ts +0 -26
  65. package/dist/cjs/pool/uma/clients/erc20/client.js +0 -38
  66. package/dist/cjs/pool/uma/clients/erc20/client.js.map +0 -1
  67. package/dist/cjs/pool/uma/clients/erc20/index.d.ts +0 -1
  68. package/dist/cjs/pool/uma/clients/erc20/index.js +0 -5
  69. package/dist/cjs/pool/uma/clients/erc20/index.js.map +0 -1
  70. package/dist/cjs/pool/uma/clients/index.d.ts +0 -1
  71. package/dist/cjs/pool/uma/clients/index.js +0 -6
  72. package/dist/cjs/pool/uma/clients/index.js.map +0 -1
  73. package/dist/cjs/pool/uma/index.d.ts +0 -13
  74. package/dist/cjs/pool/uma/index.js +0 -9
  75. package/dist/cjs/pool/uma/index.js.map +0 -1
  76. package/dist/cjs/pool/uma/oracle/index.d.ts +0 -1
  77. package/dist/cjs/pool/uma/oracle/index.js +0 -6
  78. package/dist/cjs/pool/uma/oracle/index.js.map +0 -1
  79. package/dist/cjs/pool/uma/oracle/utils.d.ts +0 -7
  80. package/dist/cjs/pool/uma/oracle/utils.js +0 -20
  81. package/dist/cjs/pool/uma/oracle/utils.js.map +0 -1
  82. package/dist/cjs/pool/uma/utils.d.ts +0 -17
  83. package/dist/cjs/pool/uma/utils.js +0 -69
  84. package/dist/cjs/pool/uma/utils.js.map +0 -1
  85. package/dist/esm/pool/TransactionManager.d.ts +0 -12
  86. package/dist/esm/pool/TransactionManager.js +0 -122
  87. package/dist/esm/pool/TransactionManager.js.map +0 -1
  88. package/dist/esm/pool/index.d.ts +0 -1
  89. package/dist/esm/pool/index.js +0 -2
  90. package/dist/esm/pool/index.js.map +0 -1
  91. package/dist/esm/pool/poolClient.d.ts +0 -238
  92. package/dist/esm/pool/poolClient.js +0 -899
  93. package/dist/esm/pool/poolClient.js.map +0 -1
  94. package/dist/esm/pool/uma/across/constants.d.ts +0 -2
  95. package/dist/esm/pool/uma/across/constants.js +0 -3
  96. package/dist/esm/pool/uma/across/constants.js.map +0 -1
  97. package/dist/esm/pool/uma/across/index.d.ts +0 -2
  98. package/dist/esm/pool/uma/across/index.js +0 -4
  99. package/dist/esm/pool/uma/across/index.js.map +0 -1
  100. package/dist/esm/pool/uma/across/transactionManager.d.ts +0 -12
  101. package/dist/esm/pool/uma/across/transactionManager.js +0 -122
  102. package/dist/esm/pool/uma/across/transactionManager.js.map +0 -1
  103. package/dist/esm/pool/uma/clients/erc20/client.d.ts +0 -26
  104. package/dist/esm/pool/uma/clients/erc20/client.js +0 -35
  105. package/dist/esm/pool/uma/clients/erc20/client.js.map +0 -1
  106. package/dist/esm/pool/uma/clients/erc20/index.d.ts +0 -1
  107. package/dist/esm/pool/uma/clients/erc20/index.js +0 -2
  108. package/dist/esm/pool/uma/clients/erc20/index.js.map +0 -1
  109. package/dist/esm/pool/uma/clients/index.d.ts +0 -1
  110. package/dist/esm/pool/uma/clients/index.js +0 -3
  111. package/dist/esm/pool/uma/clients/index.js.map +0 -1
  112. package/dist/esm/pool/uma/index.d.ts +0 -13
  113. package/dist/esm/pool/uma/index.js +0 -9
  114. package/dist/esm/pool/uma/index.js.map +0 -1
  115. package/dist/esm/pool/uma/oracle/index.d.ts +0 -1
  116. package/dist/esm/pool/uma/oracle/index.js +0 -3
  117. package/dist/esm/pool/uma/oracle/index.js.map +0 -1
  118. package/dist/esm/pool/uma/oracle/utils.d.ts +0 -23
  119. package/dist/esm/pool/uma/oracle/utils.js +0 -33
  120. package/dist/esm/pool/uma/oracle/utils.js.map +0 -1
  121. package/dist/esm/pool/uma/utils.d.ts +0 -17
  122. package/dist/esm/pool/uma/utils.js +0 -68
  123. package/dist/esm/pool/uma/utils.js.map +0 -1
  124. package/dist/types/pool/TransactionManager.d.ts +0 -13
  125. package/dist/types/pool/TransactionManager.d.ts.map +0 -1
  126. package/dist/types/pool/index.d.ts +0 -2
  127. package/dist/types/pool/index.d.ts.map +0 -1
  128. package/dist/types/pool/poolClient.d.ts +0 -239
  129. package/dist/types/pool/poolClient.d.ts.map +0 -1
  130. package/dist/types/pool/uma/across/constants.d.ts +0 -3
  131. package/dist/types/pool/uma/across/constants.d.ts.map +0 -1
  132. package/dist/types/pool/uma/across/index.d.ts +0 -3
  133. package/dist/types/pool/uma/across/index.d.ts.map +0 -1
  134. package/dist/types/pool/uma/across/transactionManager.d.ts +0 -13
  135. package/dist/types/pool/uma/across/transactionManager.d.ts.map +0 -1
  136. package/dist/types/pool/uma/clients/erc20/client.d.ts +0 -27
  137. package/dist/types/pool/uma/clients/erc20/client.d.ts.map +0 -1
  138. package/dist/types/pool/uma/clients/erc20/index.d.ts +0 -2
  139. package/dist/types/pool/uma/clients/erc20/index.d.ts.map +0 -1
  140. package/dist/types/pool/uma/clients/index.d.ts +0 -2
  141. package/dist/types/pool/uma/clients/index.d.ts.map +0 -1
  142. package/dist/types/pool/uma/index.d.ts +0 -14
  143. package/dist/types/pool/uma/index.d.ts.map +0 -1
  144. package/dist/types/pool/uma/oracle/index.d.ts +0 -2
  145. package/dist/types/pool/uma/oracle/index.d.ts.map +0 -1
  146. package/dist/types/pool/uma/oracle/utils.d.ts +0 -24
  147. package/dist/types/pool/uma/oracle/utils.d.ts.map +0 -1
  148. package/dist/types/pool/uma/utils.d.ts +0 -18
  149. package/dist/types/pool/uma/utils.d.ts.map +0 -1
  150. package/src/pool/TransactionManager.ts +0 -73
  151. package/src/pool/index.ts +0 -1
  152. package/src/pool/poolClient.ts +0 -849
  153. package/src/pool/uma/across/constants.ts +0 -2
  154. package/src/pool/uma/across/index.ts +0 -2
  155. package/src/pool/uma/across/transactionManager.ts +0 -73
  156. package/src/pool/uma/clients/erc20/README.md +0 -29
  157. package/src/pool/uma/clients/erc20/client.e2e.ts +0 -26
  158. package/src/pool/uma/clients/erc20/client.ts +0 -67
  159. package/src/pool/uma/clients/erc20/index.ts +0 -1
  160. package/src/pool/uma/clients/index.ts +0 -1
  161. package/src/pool/uma/index.ts +0 -33
  162. package/src/pool/uma/oracle/index.ts +0 -2
  163. package/src/pool/uma/oracle/utils.ts +0 -38
  164. package/src/pool/uma/utils.test.ts +0 -24
  165. package/src/pool/uma/utils.ts +0 -53
@@ -13,11 +13,11 @@ import {
13
13
  } from "@solana-program/token";
14
14
  import {
15
15
  Account,
16
+ AccountMeta,
16
17
  AccountRole,
17
18
  Address,
18
19
  FetchAccountConfig,
19
- IAccountMeta,
20
- IInstruction,
20
+ Instruction,
21
21
  KeyPairSigner,
22
22
  ReadonlyUint8Array,
23
23
  appendTransactionMessageInstruction,
@@ -37,8 +37,6 @@ import {
37
37
  type WritableAccount,
38
38
  type ReadonlyAccount,
39
39
  type Commitment,
40
- type CompilableTransactionMessage,
41
- type TransactionMessageWithBlockhashLifetime,
42
40
  } from "@solana/kit";
43
41
  import assert from "assert";
44
42
  import winston from "winston";
@@ -89,7 +87,7 @@ import {
89
87
  } from "./";
90
88
  import { SvmCpiEventsClient } from "./eventsClient";
91
89
  import { SVM_LONG_TERM_STORAGE_SLOT_SKIPPED, SVM_SLOT_SKIPPED, isSolanaError } from "./provider";
92
- import { AttestedCCTPMessage, SVMEventNames, SVMProvider, LatestBlockhash } from "./types";
90
+ import { AttestedCCTPMessage, SVMEventNames, SVMProvider, LatestBlockhash, SolanaTransaction } from "./types";
93
91
  import {
94
92
  getEmergencyDeleteRootBundleRootBundleId,
95
93
  getNearestSlotTime,
@@ -504,7 +502,7 @@ export async function fillRelayInstruction(
504
502
  recipientTokenAccount: Address<string>,
505
503
  repaymentAddress: EvmAddress | SvmAddress,
506
504
  repaymentChainId: number
507
- ): Promise<IInstruction> {
505
+ ): Promise<Instruction> {
508
506
  const program = toAddress(spokePool);
509
507
  assert(
510
508
  repaymentAddress.isValidOn(repaymentChainId),
@@ -579,7 +577,7 @@ export async function getFillRelayTx(
579
577
  signer: TransactionSigner,
580
578
  repaymentChainId: number,
581
579
  repaymentAddress: SdkAddress
582
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
580
+ ): Promise<SolanaTransaction> {
583
581
  const svmRelayData = toSvmRelayData(relayData);
584
582
 
585
583
  assert(
@@ -674,7 +672,7 @@ export async function getIPFillRelayTx(
674
672
  signer: TransactionSigner,
675
673
  repaymentChainId: number,
676
674
  repaymentAddress: SdkAddress
677
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
675
+ ): Promise<SolanaTransaction> {
678
676
  const program = toAddress(spokePoolAddr);
679
677
  const _relayDataHash = getRelayDataHash(
680
678
  { ...relayData, messageHash: getMessageHash(relayData.message) },
@@ -765,7 +763,7 @@ export const createFillInstruction = async (
765
763
  tokenDecimals: number,
766
764
  createRecipientAta: boolean = false,
767
765
  remainingAccounts: (WritableAccount | ReadonlyAccount)[] = []
768
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
766
+ ): Promise<SolanaTransaction> => {
769
767
  const mintInfo = await getMintInfo(solanaClient, fillInput.mint);
770
768
  const approveIx = getApproveCheckedInstruction(
771
769
  {
@@ -833,7 +831,7 @@ export const createDepositInstruction = async (
833
831
  depositInput: SvmSpokeClient.DepositInput,
834
832
  tokenDecimals: number,
835
833
  createVaultAtaIfNeeded: boolean = true
836
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
834
+ ): Promise<SolanaTransaction> => {
837
835
  const getCreateAssociatedTokenIdempotentIx = () =>
838
836
  getCreateAssociatedTokenIdempotentInstruction({
839
837
  payer: signer,
@@ -878,7 +876,7 @@ export const createRequestSlowFillInstruction = async (
878
876
  signer: TransactionSigner,
879
877
  solanaClient: SVMProvider,
880
878
  requestSlowFillInput: SvmSpokeClient.RequestSlowFillInput
881
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
879
+ ): Promise<SolanaTransaction> => {
882
880
  const requestSlowFillIx = SvmSpokeClient.getRequestSlowFillInstruction(requestSlowFillInput);
883
881
 
884
882
  return pipe(await createDefaultTransaction(solanaClient, signer), (tx) =>
@@ -903,7 +901,7 @@ export async function getSlowFillRequestTx(
903
901
  outputToken: SvmAddress;
904
902
  },
905
903
  signer: TransactionSigner
906
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
904
+ ): Promise<SolanaTransaction> {
907
905
  const program = toAddress(spokePoolAddr);
908
906
  const messageHash = getMessageHash(relayData.message);
909
907
  const relayDataHash = getRelayDataHash({ ...relayData, messageHash }, relayData.destinationChainId);
@@ -940,7 +938,7 @@ export const createCloseFillPdaInstruction = async (
940
938
  signer: TransactionSigner,
941
939
  solanaClient: SVMProvider,
942
940
  fillStatusPda: Address
943
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
941
+ ): Promise<SolanaTransaction> => {
944
942
  const closeFillPdaIx = SvmSpokeClient.getCloseFillPdaInstruction({
945
943
  signer,
946
944
  state: await getStatePda(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
@@ -955,10 +953,10 @@ export const createReceiveMessageInstruction = async (
955
953
  signer: TransactionSigner,
956
954
  solanaClient: SVMProvider,
957
955
  input: MessageTransmitterClient.ReceiveMessageInput,
958
- remainingAccounts: IAccountMeta<string>[]
959
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> => {
956
+ remainingAccounts: AccountMeta<string>[]
957
+ ): Promise<SolanaTransaction> => {
960
958
  const receiveMessageIx = MessageTransmitterClient.getReceiveMessageInstruction(input);
961
- (receiveMessageIx.accounts as IAccountMeta<string>[]).push(...remainingAccounts);
959
+ (receiveMessageIx.accounts as AccountMeta<string>[]).push(...remainingAccounts);
962
960
  return pipe(await createDefaultTransaction(solanaClient, signer), (tx) =>
963
961
  appendTransactionMessageInstruction(receiveMessageIx, tx)
964
962
  );
@@ -1094,7 +1092,7 @@ export async function getIPForFillRelayTxs(
1094
1092
  repaymentAddress: SdkAddress,
1095
1093
  signer: TransactionSigner<string>,
1096
1094
  provider: SVMProvider
1097
- ) {
1095
+ ): Promise<Array<SolanaTransaction>> {
1098
1096
  const ixs = await getFillRelayViaInstructionParamsInstructions(
1099
1097
  toAddress(spokePool),
1100
1098
  relayData,
@@ -1126,7 +1124,7 @@ export async function getFillRelayViaInstructionParamsInstructions(
1126
1124
  signer: TransactionSigner<string>,
1127
1125
  provider: SVMProvider,
1128
1126
  maxWriteSize = 450
1129
- ): Promise<IInstruction[]> {
1127
+ ): Promise<Instruction[]> {
1130
1128
  const instructionParams = await getInstructionParamsPda(spokePool, signer.address);
1131
1129
  const encodedInstructionParams = await fetchEncodedAccount(provider, instructionParams);
1132
1130
 
@@ -1143,7 +1141,7 @@ export async function getFillRelayViaInstructionParamsInstructions(
1143
1141
  instructionParams,
1144
1142
  totalSize: encodedRelayData.length,
1145
1143
  });
1146
- const instructions: IInstruction[] = [initInstructionParamsIx];
1144
+ const instructions: Instruction[] = [initInstructionParamsIx];
1147
1145
 
1148
1146
  for (let i = 0; i <= encodedRelayData.length / maxWriteSize; ++i) {
1149
1147
  const offset = i * maxWriteSize;
@@ -1328,7 +1326,7 @@ export async function getAccountMetasForTokenlessMessage(
1328
1326
  solanaClient: SVMProvider,
1329
1327
  signer: KeyPairSigner,
1330
1328
  messageBytes: string
1331
- ): Promise<IAccountMeta<string>[]> {
1329
+ ): Promise<AccountMeta<string>[]> {
1332
1330
  const messageHex = messageBytes.slice(2);
1333
1331
  const messageHeader = decodeMessageHeader(Buffer.from(messageHex, "hex"));
1334
1332
  const programAddress = SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS;
@@ -1336,7 +1334,7 @@ export async function getAccountMetasForTokenlessMessage(
1336
1334
  const selfAuthority = await getSelfAuthority();
1337
1335
  const eventAuthority = await getEventAuthority(programAddress);
1338
1336
 
1339
- const base: IAccountMeta<string>[] = [
1337
+ const base: AccountMeta<string>[] = [
1340
1338
  { address: statePda, role: AccountRole.READONLY },
1341
1339
  { address: selfAuthority, role: AccountRole.READONLY },
1342
1340
  { address: programAddress, role: AccountRole.READONLY },
@@ -1455,7 +1453,7 @@ export async function getCCTPDepositAccounts(
1455
1453
  * @returns Object containing a boolean if the input deposit requires a multipart fill, false otherwise and
1456
1454
  * the number of bytes in the serialized transaction.
1457
1455
  */
1458
- export function isSVMFillTooLarge(fillRelayTx: CompilableTransactionMessage): {
1456
+ export function isSVMFillTooLarge(fillRelayTx: SolanaTransaction): {
1459
1457
  tooLarge: boolean;
1460
1458
  sizeBytes: number;
1461
1459
  } {
@@ -1483,7 +1481,7 @@ export function base64StrToByteSize(base64TxString: string): number {
1483
1481
  * @param fillTx The compilable fill relay transaction.
1484
1482
  * @returns The number of bytes in the serialized fillRelay transaction.
1485
1483
  */
1486
- export function calculateFillSizeBytes(fillTx: CompilableTransactionMessage): number {
1484
+ export function calculateFillSizeBytes(fillTx: SolanaTransaction): number {
1487
1485
  const signedTransaction = compileTransaction(fillTx);
1488
1486
  const serializedTx = getBase64EncodedWireTransaction(signedTransaction);
1489
1487
  return base64StrToByteSize(serializedTx);
@@ -1502,7 +1500,7 @@ async function getAccountMetasForDepositMessage(
1502
1500
  hubChainId: number,
1503
1501
  tokenMessengerMinter: Address,
1504
1502
  recipientAta: SvmAddress
1505
- ): Promise<IAccountMeta<string>[]> {
1503
+ ): Promise<AccountMeta<string>[]> {
1506
1504
  const l1Usdc = EvmAddress.from(TOKEN_SYMBOLS_MAP.USDC.addresses[hubChainId]);
1507
1505
  const l2Usdc = SvmAddress.from(
1508
1506
  TOKEN_SYMBOLS_MAP.USDC.addresses[chainIsProd(hubChainId) ? CHAIN_IDs.SOLANA : CHAIN_IDs.SOLANA_DEVNET]
@@ -1577,7 +1575,7 @@ export async function getCCTPV1ReceiveMessageTx(
1577
1575
  message: AttestedCCTPMessage,
1578
1576
  hubChainId: number,
1579
1577
  recipientAta: SvmAddress
1580
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
1578
+ ): Promise<SolanaTransaction> {
1581
1579
  const [messageTransmitterPda] = await getProgramDerivedAddress({
1582
1580
  programAddress: MessageTransmitterClient.MESSAGE_TRANSMITTER_PROGRAM_ADDRESS,
1583
1581
  seeds: ["message_transmitter"],
@@ -1601,7 +1599,7 @@ export async function getCCTPV1ReceiveMessageTx(
1601
1599
  const usedNonces = await getCCTPNoncePda(solanaClient, signer, message.nonce, message.sourceDomain);
1602
1600
 
1603
1601
  // Notice: for Svm tokenless messages, we currently only support very specific finalizations: Hub -> Spoke relayRootBundle calls
1604
- const accountMetas: IAccountMeta<string>[] = isDepositForBurnEvent(message)
1602
+ const accountMetas: AccountMeta<string>[] = isDepositForBurnEvent(message)
1605
1603
  ? await getAccountMetasForDepositMessage(
1606
1604
  message,
1607
1605
  hubChainId,
@@ -10,8 +10,17 @@ import {
10
10
  SolanaRpcApiFromTransport,
11
11
  UnixTimestamp,
12
12
  type Blockhash,
13
+ type TransactionMessage,
14
+ type TransactionMessageWithBlockhashLifetime,
15
+ type TransactionMessageWithFeePayer,
13
16
  } from "@solana/kit";
14
17
 
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 & TransactionMessageWithBlockhashLifetime & TransactionMessageWithFeePayer;
23
+
15
24
  export type EventData =
16
25
  | SvmSpokeClient.BridgedToHubPool
17
26
  | SvmSpokeClient.TokensBridged
@@ -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
- IInstruction,
5
+ Instruction,
6
6
  KeyPairSigner,
7
7
  address,
8
8
  appendTransactionMessageInstruction,
@@ -26,7 +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 { AttestedCCTPMessage, EventName, SVMEventNames, SVMProvider, LatestBlockhash } from "./types";
29
+ import { AttestedCCTPMessage, EventName, SVMEventNames, SVMProvider, LatestBlockhash, SolanaTransaction } from "./types";
30
30
  import winston from "winston";
31
31
  /**
32
32
  * Basic void TransactionSigner type
@@ -411,7 +411,7 @@ export const createDefaultTransaction = async (
411
411
  rpcClient: SVMProvider,
412
412
  signer: TransactionSigner,
413
413
  latestBlockhash?: LatestBlockhash
414
- ) => {
414
+ ): Promise<SolanaTransaction> => {
415
415
  latestBlockhash = isDefined(latestBlockhash) ? latestBlockhash : (await rpcClient.getLatestBlockhash().send()).value;
416
416
  return pipe(
417
417
  createTransactionMessage({ version: 0 }),
@@ -430,7 +430,7 @@ export const createDefaultTransaction = async (
430
430
  */
431
431
  export const simulateAndDecode = async <P extends (buf: Buffer) => unknown>(
432
432
  solanaClient: SVMProvider,
433
- ix: IInstruction,
433
+ ix: Instruction,
434
434
  signer: KeyPairSigner,
435
435
  parser: P,
436
436
  latestBlockhash?: LatestBlockhash
@@ -2,7 +2,12 @@ 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 { CompilableTransactionMessage, TransactionMessageBytesBase64, compileTransaction } from "@solana/kit";
5
+ import {
6
+ TransactionMessage,
7
+ TransactionMessageBytesBase64,
8
+ TransactionMessageWithFeePayer,
9
+ compileTransaction,
10
+ } from "@solana/kit";
6
11
 
7
12
  /**
8
13
  * @notice Returns result of getFeeForMessage and getRecentPrioritizationFees RPC calls.
@@ -11,8 +16,8 @@ import { CompilableTransactionMessage, TransactionMessageBytesBase64, compileTra
11
16
  export async function messageFee(provider: SVMProvider, opts: GasPriceEstimateOptions): Promise<SvmGasPriceEstimate> {
12
17
  const { unsignedTx: _unsignedTx } = opts;
13
18
 
14
- // Cast the opaque unsignedTx type to a solana-kit CompilableTransactionMessage.
15
- const unsignedTx = _unsignedTx as CompilableTransactionMessage;
19
+ // Cast the opaque unsignedTx type to a solana-kit TransactionMessage with fee payer.
20
+ const unsignedTx = _unsignedTx as TransactionMessage & TransactionMessageWithFeePayer;
16
21
  const compiledTransaction = compileTransaction(unsignedTx);
17
22
 
18
23
  // Get this base fee. This should result in LAMPORTS_PER_SIGNATURE * nSignatures.
package/src/index.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * as arch from "./arch";
2
2
  export * as addressAggregator from "./addressAggregator";
3
3
  export * as lpFeeCalculator from "./lpFeeCalculator";
4
- export * as pool from "./pool";
5
4
  export * as relayFeeCalculator from "./relayFeeCalculator";
6
5
  export * as utils from "./utils";
7
6
  export * as contracts from "./contracts";
@@ -1,6 +1,5 @@
1
1
  import assert from "assert";
2
2
  import {
3
- getComputeUnitEstimateForTransactionMessageFactory,
4
3
  TransactionSigner,
5
4
  fetchEncodedAccount,
6
5
  isSome,
@@ -9,8 +8,7 @@ import {
9
8
  appendTransactionMessageInstruction,
10
9
  compileTransaction,
11
10
  getBase64EncodedWireTransaction,
12
- type CompilableTransactionMessage,
13
- type TransactionMessageWithBlockhashLifetime,
11
+ type Instruction,
14
12
  } from "@solana/kit";
15
13
  import {
16
14
  SVMProvider,
@@ -22,6 +20,7 @@ import {
22
20
  createDefaultTransaction,
23
21
  getAssociatedTokenAddress,
24
22
  isSVMFillTooLarge,
23
+ SolanaTransaction,
25
24
  } from "../../arch/svm";
26
25
  import { JitoInterface } from "../../providers/solana";
27
26
  import { Coingecko } from "../../coingecko";
@@ -33,7 +32,7 @@ import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator
33
32
  import { SymbolMappingType } from "./";
34
33
  import { TOKEN_PROGRAM_ADDRESS } from "@solana-program/token";
35
34
  import { TOKEN_2022_PROGRAM_ADDRESS, getTokenSize, fetchMint, Extension } from "@solana-program/token-2022";
36
- import { getSetComputeUnitLimitInstruction } from "@solana-program/compute-budget";
35
+ import { getSetComputeUnitLimitInstruction, estimateComputeUnitLimitFactory } from "@solana-program/compute-budget";
37
36
  import { arch } from "../..";
38
37
 
39
38
  /**
@@ -64,7 +63,7 @@ export class SvmQuery implements QueryInterface {
64
63
  readonly fixedGasPrice?: BigNumberish,
65
64
  readonly coingeckoBaseCurrency: string = "eth"
66
65
  ) {
67
- this.computeUnitEstimator = getComputeUnitEstimateForTransactionMessageFactory({
66
+ this.computeUnitEstimator = estimateComputeUnitLimitFactory({
68
67
  rpc: provider,
69
68
  });
70
69
  }
@@ -224,7 +223,7 @@ export class SvmQuery implements QueryInterface {
224
223
  signer: TransactionSigner,
225
224
  repaymentChainId: number,
226
225
  repaymentAddress: Address
227
- ): Promise<CompilableTransactionMessage & TransactionMessageWithBlockhashLifetime> {
226
+ ): Promise<SolanaTransaction> {
228
227
  return await getFillRelayTx(this.spokePool, this.provider, relayData, signer, repaymentChainId, repaymentAddress);
229
228
  }
230
229
 
@@ -290,7 +289,7 @@ export class SvmQuery implements QueryInterface {
290
289
  const computeUnitLimitIx = getSetComputeUnitLimitInstruction({ units: 10_000_000 });
291
290
  const fillRelayTx = pipe(_fillRelayTx, (tx) => appendTransactionMessageInstruction(computeUnitLimitIx, tx));
292
291
 
293
- const instructionParamsTxs = await mapAsync(instructionParamsIxs, async (ix) => {
292
+ const instructionParamsTxs = await mapAsync(instructionParamsIxs, async (ix: Instruction) => {
294
293
  return pipe(await createDefaultTransaction(provider, voidSigner), (tx) =>
295
294
  appendTransactionMessageInstruction(ix, tx)
296
295
  );
@@ -1,12 +0,0 @@
1
- import { Signer } from "ethers";
2
- import { TransactionRequest, TransactionReceipt } from "@ethersproject/abstract-provider";
3
- type Config = {
4
- confirmations?: number;
5
- };
6
- export type Emit = (event: string, key: string, data: TransactionReceipt | string | TransactionRequest | Error) => void;
7
- declare const _default: (config: Config, signer: Signer, emit?: Emit) => {
8
- request: (unsignedTx: TransactionRequest) => string;
9
- isMined: (key: string) => TransactionReceipt | undefined;
10
- update: () => Promise<void>;
11
- };
12
- export default _default;
@@ -1,121 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var assert_1 = tslib_1.__importDefault(require("assert"));
5
- function makeKey(tx) {
6
- return JSON.stringify(Object.entries(tx).map(function (_a) {
7
- var key = _a[0], value = _a[1];
8
- return [key, (value || "").toString()];
9
- }));
10
- }
11
- exports.default = (function (config, signer, emit) {
12
- if (emit === void 0) { emit = function () { return null; }; }
13
- (0, assert_1.default)(signer.provider, "signer requires a provider, use signer.connect(provider)");
14
- var _a = config.confirmations, confirmations = _a === void 0 ? 3 : _a;
15
- var requests = new Map();
16
- var submissions = new Map();
17
- var mined = new Map();
18
- function request(unsignedTx) {
19
- var populated = unsignedTx;
20
- var key = makeKey(populated);
21
- (0, assert_1.default)(!requests.has(key), "Transaction already in progress");
22
- requests.set(key, populated);
23
- return key;
24
- }
25
- function processRequest(key) {
26
- return tslib_1.__awaiter(this, void 0, void 0, function () {
27
- var request, sent, err_1;
28
- return tslib_1.__generator(this, function (_a) {
29
- switch (_a.label) {
30
- case 0:
31
- request = requests.get(key);
32
- (0, assert_1.default)(request, "invalid request");
33
- requests.delete(key);
34
- _a.label = 1;
35
- case 1:
36
- _a.trys.push([1, 3, , 4]);
37
- return [4, signer.sendTransaction(request)];
38
- case 2:
39
- sent = _a.sent();
40
- submissions.set(key, sent.hash);
41
- emit("submitted", key, sent.hash);
42
- return [3, 4];
43
- case 3:
44
- err_1 = _a.sent();
45
- emit("error", key, err_1);
46
- return [3, 4];
47
- case 4: return [2];
48
- }
49
- });
50
- });
51
- }
52
- function processSubmission(key) {
53
- return tslib_1.__awaiter(this, void 0, void 0, function () {
54
- var hash, receipt;
55
- return tslib_1.__generator(this, function (_a) {
56
- switch (_a.label) {
57
- case 0:
58
- hash = submissions.get(key);
59
- (0, assert_1.default)(hash, "invalid submission");
60
- (0, assert_1.default)(signer.provider, "signer requires a provider, use signer.connect(provider)");
61
- return [4, signer.provider.getTransactionReceipt(hash).catch(function () { return undefined; })];
62
- case 1:
63
- receipt = _a.sent();
64
- if (receipt == null)
65
- return [2];
66
- if (receipt.confirmations < confirmations)
67
- return [2];
68
- submissions.delete(key);
69
- mined.set(key, receipt);
70
- emit("mined", key, receipt);
71
- return [2];
72
- }
73
- });
74
- });
75
- }
76
- function isMined(key) {
77
- return mined.get(key);
78
- }
79
- function update() {
80
- return tslib_1.__awaiter(this, void 0, void 0, function () {
81
- var _i, _a, key, _b, _c, key;
82
- return tslib_1.__generator(this, function (_d) {
83
- switch (_d.label) {
84
- case 0:
85
- _i = 0, _a = Object.keys(requests);
86
- _d.label = 1;
87
- case 1:
88
- if (!(_i < _a.length)) return [3, 4];
89
- key = _a[_i];
90
- return [4, processRequest(key)];
91
- case 2:
92
- _d.sent();
93
- _d.label = 3;
94
- case 3:
95
- _i++;
96
- return [3, 1];
97
- case 4:
98
- _b = 0, _c = Object.keys(submissions);
99
- _d.label = 5;
100
- case 5:
101
- if (!(_b < _c.length)) return [3, 8];
102
- key = _c[_b];
103
- return [4, processSubmission(key)];
104
- case 6:
105
- _d.sent();
106
- _d.label = 7;
107
- case 7:
108
- _b++;
109
- return [3, 5];
110
- case 8: return [2];
111
- }
112
- });
113
- });
114
- }
115
- return {
116
- request: request,
117
- isMined: isMined,
118
- update: update,
119
- };
120
- });
121
- //# sourceMappingURL=TransactionManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransactionManager.js","sourceRoot":"","sources":["../../../src/pool/TransactionManager.ts"],"names":[],"mappings":";;;AAAA,0DAA4B;AAI5B,SAAS,OAAO,CAAC,EAAsB;IACrC,OAAO,IAAI,CAAC,SAAS,CACnB,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACjC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAMD,mBAAe,UAAC,MAAc,EAAE,MAA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,CAAC,EAAC"}
@@ -1 +0,0 @@
1
- export * from "./poolClient";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./poolClient"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pool/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}