@across-protocol/sdk 4.3.34-alpha.1 → 4.3.35
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 +10 -21
- package/dist/cjs/arch/svm/SpokeUtils.js +27 -134
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/index.d.ts +0 -1
- package/dist/cjs/arch/svm/index.js +0 -1
- package/dist/cjs/arch/svm/index.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +0 -2
- package/dist/cjs/arch/svm/utils.js +1 -18
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/providers/alchemy.js +1 -1
- package/dist/cjs/providers/alchemy.js.map +1 -1
- package/dist/cjs/providers/infura.js +1 -1
- package/dist/cjs/providers/infura.js.map +1 -1
- package/dist/cjs/providers/quicknode.js +19 -7
- package/dist/cjs/providers/quicknode.js.map +1 -1
- package/dist/cjs/providers/types.d.ts +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +10 -38
- package/dist/esm/arch/svm/SpokeUtils.js +28 -160
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/index.d.ts +0 -1
- package/dist/esm/arch/svm/index.js +0 -1
- package/dist/esm/arch/svm/index.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +0 -8
- package/dist/esm/arch/svm/utils.js +0 -22
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/providers/alchemy.js +1 -1
- package/dist/esm/providers/alchemy.js.map +1 -1
- package/dist/esm/providers/infura.js +1 -1
- package/dist/esm/providers/infura.js.map +1 -1
- package/dist/esm/providers/quicknode.js +21 -9
- package/dist/esm/providers/quicknode.js.map +1 -1
- package/dist/esm/providers/types.d.ts +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +10 -38
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/index.d.ts +0 -1
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +0 -8
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/providers/quicknode.d.ts.map +1 -1
- package/dist/types/providers/types.d.ts +1 -1
- package/dist/types/providers/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/svm/SpokeUtils.ts +22 -193
- package/src/arch/svm/index.ts +0 -1
- package/src/arch/svm/utils.ts +0 -23
- package/src/providers/alchemy.ts +2 -2
- package/src/providers/infura.ts +2 -2
- package/src/providers/quicknode.ts +22 -9
- package/src/providers/types.ts +1 -1
- package/dist/cjs/arch/svm/encoders.d.ts +0 -19
- package/dist/cjs/arch/svm/encoders.js +0 -52
- package/dist/cjs/arch/svm/encoders.js.map +0 -1
- package/dist/esm/arch/svm/encoders.d.ts +0 -19
- package/dist/esm/arch/svm/encoders.js +0 -43
- package/dist/esm/arch/svm/encoders.js.map +0 -1
- package/dist/types/arch/svm/encoders.d.ts +0 -20
- package/dist/types/arch/svm/encoders.d.ts.map +0 -1
- package/src/arch/svm/encoders.ts +0 -86
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/utils.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/utils.ts"],"names":[],"mappings":";AACA,OAAO,EAAuB,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,YAAY,EACZ,aAAa,EAcb,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAY,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,IAAI,UAAU,EAAoD,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,mBAAmB,EAAE,SA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mBAA0B,MAAM,KAAK,OAAO,gBAC1D,WAAW,MACrB,YAAY,UACR,aAAa,sCAgBtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,iBACZ,WAAW,UACjB,aAAa,SACd,MAAM,gBACC,MAAM,qBAoBrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAEzE;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,SAAU,MAAM,KAAG,OAO3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sCAAsC,SAAU,MAAM,KAAG,OAOrE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wCAAwC,SAAU,MAAM,KAAG,MAIvE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAMnD;AAED,eAAO,MAAM,UAAU,OAAQ,MAAM,GAAG,SAAS,eACmB,CAAC;AAErE,eAAO,MAAM,aAAa,MAAO,MAAM,eAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quicknode.d.ts","sourceRoot":"","sources":["../../../src/providers/quicknode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"quicknode.d.ts","sourceRoot":"","sources":["../../../src/providers/quicknode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAYvC,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,MAAM,CAyBvF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type RPCProvider = "ALCHEMY" | "DRPC" | "INFURA" | "INFURA_DIN";
|
|
1
|
+
export type RPCProvider = "ALCHEMY" | "DRPC" | "INFURA" | "INFURA_DIN" | "QUICKNODE";
|
|
2
2
|
export type RPCTransport = "https" | "wss";
|
|
3
3
|
export declare const JsonRpcError: import("superstruct").Struct<{
|
|
4
4
|
error: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AACrF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAK3C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;EAQvB,CAAC;AAGH,eAAO,MAAM,QAAQ;;;;;;EAGnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
Address,
|
|
18
18
|
FetchAccountConfig,
|
|
19
19
|
IAccountMeta,
|
|
20
|
-
IInstruction,
|
|
21
20
|
KeyPairSigner,
|
|
22
21
|
ReadonlyUint8Array,
|
|
23
22
|
appendTransactionMessageInstruction,
|
|
@@ -33,11 +32,9 @@ import {
|
|
|
33
32
|
signTransactionMessageWithSigners,
|
|
34
33
|
some,
|
|
35
34
|
type TransactionSigner,
|
|
36
|
-
type WritableAccount,
|
|
37
|
-
type ReadonlyAccount,
|
|
38
35
|
} from "@solana/kit";
|
|
39
36
|
import assert from "assert";
|
|
40
|
-
import { arrayify } from "ethers/lib/utils";
|
|
37
|
+
import { arrayify, hexZeroPad, hexlify } from "ethers/lib/utils";
|
|
41
38
|
import { Logger } from "winston";
|
|
42
39
|
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "../../constants";
|
|
43
40
|
import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
|
|
@@ -69,11 +66,6 @@ import {
|
|
|
69
66
|
toAddress,
|
|
70
67
|
unwrapEventData,
|
|
71
68
|
getRootBundlePda,
|
|
72
|
-
getAcrossPlusMessageDecoder,
|
|
73
|
-
getAccountMeta,
|
|
74
|
-
toSvmRelayData,
|
|
75
|
-
getInstructionParamsPda,
|
|
76
|
-
type AcrossPlusMessage,
|
|
77
69
|
} from "./";
|
|
78
70
|
import { SvmCpiEventsClient } from "./eventsClient";
|
|
79
71
|
import { SVM_BLOCK_NOT_AVAILABLE, SVM_SLOT_SKIPPED, isSolanaError } from "./provider";
|
|
@@ -609,7 +601,6 @@ export async function getFillRelayTx(
|
|
|
609
601
|
getEventAuthority(program),
|
|
610
602
|
]);
|
|
611
603
|
|
|
612
|
-
const message = new Uint8Array(Buffer.from(relayData.message.slice(2), "hex"));
|
|
613
604
|
const svmRelayData: SvmSpokeClient.FillRelayInput["relayData"] = {
|
|
614
605
|
depositor: toAddress(depositor),
|
|
615
606
|
recipient: toAddress(recipient),
|
|
@@ -622,24 +613,9 @@ export async function getFillRelayTx(
|
|
|
622
613
|
depositId: new Uint8Array(intToU8Array32(relayData.depositId.toNumber())),
|
|
623
614
|
fillDeadline: relayData.fillDeadline,
|
|
624
615
|
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
625
|
-
message,
|
|
616
|
+
message: new Uint8Array(Buffer.from(relayData.message, "hex")),
|
|
626
617
|
};
|
|
627
618
|
|
|
628
|
-
// Add remaining accounts if the relayData has a non-empty message.
|
|
629
|
-
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
630
|
-
const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
|
|
631
|
-
if (relayData.message !== "0x") {
|
|
632
|
-
const acrossPlusMessage = deserializeMessage(relayData.message);
|
|
633
|
-
// The first `remainingAccount` _must_ be the handler address.
|
|
634
|
-
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
|
|
635
|
-
remainingAccounts.push(getAccountMeta(acrossPlusMessage.handler, true));
|
|
636
|
-
remainingAccounts.push(
|
|
637
|
-
...acrossPlusMessage.accounts.map((account, idx) =>
|
|
638
|
-
getAccountMeta(account, idx < acrossPlusMessage.accounts.length - acrossPlusMessage.read_only_len)
|
|
639
|
-
)
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
|
|
643
619
|
const fillInput: SvmSpokeClient.FillRelayInput = {
|
|
644
620
|
signer: signer,
|
|
645
621
|
state,
|
|
@@ -660,105 +636,7 @@ export async function getFillRelayTx(
|
|
|
660
636
|
};
|
|
661
637
|
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
662
638
|
// if it doesn't exist.
|
|
663
|
-
return createFillInstruction(
|
|
664
|
-
signer,
|
|
665
|
-
solanaClient,
|
|
666
|
-
fillInput,
|
|
667
|
-
svmRelayData,
|
|
668
|
-
mintInfo.data.decimals,
|
|
669
|
-
true,
|
|
670
|
-
remainingAccounts
|
|
671
|
-
);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Creates a fill instruction with an instruction params PDA as the relayData input.
|
|
676
|
-
* @param spokePoolAddr Address of the spoke pool we're trying to fill through
|
|
677
|
-
* @param solanaClient RPC client to interact with Solana chain
|
|
678
|
-
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
679
|
-
* @param signer signer associated with the relayer creating a Fill. Can be VoidSigner for gas estimation
|
|
680
|
-
* @param repaymentChainId Chain id where relayer repayment is desired
|
|
681
|
-
* @param repaymentAddress Address to which repayment will go to on repaymentChainId
|
|
682
|
-
* @returns FillRelay transaction
|
|
683
|
-
*/
|
|
684
|
-
export async function getIPFillRelayTx(
|
|
685
|
-
spokePoolAddr: SvmAddress,
|
|
686
|
-
solanaClient: SVMProvider,
|
|
687
|
-
relayData: Omit<RelayData, "recipient" | "outputToken"> & {
|
|
688
|
-
destinationChainId: number;
|
|
689
|
-
recipient: SvmAddress;
|
|
690
|
-
outputToken: SvmAddress;
|
|
691
|
-
},
|
|
692
|
-
signer: TransactionSigner,
|
|
693
|
-
repaymentChainId: number,
|
|
694
|
-
repaymentAddress: SdkAddress
|
|
695
|
-
) {
|
|
696
|
-
const program = toAddress(spokePoolAddr);
|
|
697
|
-
const _relayDataHash = getRelayDataHash(relayData, relayData.destinationChainId);
|
|
698
|
-
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
699
|
-
|
|
700
|
-
const [state, delegate, instructionParams] = await Promise.all([
|
|
701
|
-
getStatePda(program),
|
|
702
|
-
getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
|
|
703
|
-
getInstructionParamsPda(program, signer.address),
|
|
704
|
-
]);
|
|
705
|
-
|
|
706
|
-
const mint = toAddress(relayData.outputToken);
|
|
707
|
-
const mintInfo = await getMintInfo(solanaClient, mint);
|
|
708
|
-
|
|
709
|
-
const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
|
|
710
|
-
getAssociatedTokenAddress(relayData.recipient, relayData.outputToken, mintInfo.programAddress),
|
|
711
|
-
getAssociatedTokenAddress(SvmAddress.from(signer.address), relayData.outputToken, mintInfo.programAddress),
|
|
712
|
-
getFillStatusPda(program, relayData, relayData.destinationChainId),
|
|
713
|
-
getEventAuthority(program),
|
|
714
|
-
]);
|
|
715
|
-
|
|
716
|
-
// Add remaining accounts if the relayData has a non-empty message.
|
|
717
|
-
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
718
|
-
const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
|
|
719
|
-
if (relayData.message !== "0x") {
|
|
720
|
-
const acrossPlusMessage = deserializeMessage(relayData.message);
|
|
721
|
-
// The first `remainingAccount` _must_ be the handler address.
|
|
722
|
-
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
|
|
723
|
-
remainingAccounts.push(getAccountMeta(acrossPlusMessage.handler, true));
|
|
724
|
-
remainingAccounts.push(
|
|
725
|
-
...acrossPlusMessage.accounts.map((account, idx) =>
|
|
726
|
-
getAccountMeta(account, idx < acrossPlusMessage.accounts.length - acrossPlusMessage.read_only_len)
|
|
727
|
-
)
|
|
728
|
-
);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
const fillInput: SvmSpokeClient.FillRelayInput = {
|
|
732
|
-
signer: signer,
|
|
733
|
-
state,
|
|
734
|
-
delegate,
|
|
735
|
-
mint,
|
|
736
|
-
relayerTokenAccount: relayerAta,
|
|
737
|
-
recipientTokenAccount: recipientAta,
|
|
738
|
-
fillStatus,
|
|
739
|
-
tokenProgram: mintInfo.programAddress,
|
|
740
|
-
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
741
|
-
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
742
|
-
eventAuthority,
|
|
743
|
-
program,
|
|
744
|
-
instructionParams,
|
|
745
|
-
relayHash: relayDataHash,
|
|
746
|
-
relayData: null,
|
|
747
|
-
repaymentChainId: null,
|
|
748
|
-
repaymentAddress: null,
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
752
|
-
// if it doesn't exist.
|
|
753
|
-
return createFillInstruction(
|
|
754
|
-
signer,
|
|
755
|
-
solanaClient,
|
|
756
|
-
fillInput,
|
|
757
|
-
{ outputAmount: relayData.outputAmount.toBigInt(), recipient: toAddress(relayData.recipient) },
|
|
758
|
-
mintInfo.data.decimals,
|
|
759
|
-
true,
|
|
760
|
-
remainingAccounts
|
|
761
|
-
);
|
|
639
|
+
return createFillInstruction(signer, solanaClient, fillInput, mintInfo.data.decimals, true);
|
|
762
640
|
}
|
|
763
641
|
|
|
764
642
|
/**
|
|
@@ -774,10 +652,8 @@ export const createFillInstruction = async (
|
|
|
774
652
|
signer: TransactionSigner,
|
|
775
653
|
solanaClient: SVMProvider,
|
|
776
654
|
fillInput: SvmSpokeClient.FillRelayInput,
|
|
777
|
-
relayData: Pick<SvmSpokeClient.RelayDataArgs, "outputAmount" | "recipient">,
|
|
778
655
|
tokenDecimals: number,
|
|
779
|
-
createRecipientAtaIfNeeded: boolean = true
|
|
780
|
-
remainingAccounts: (WritableAccount | ReadonlyAccount)[] = []
|
|
656
|
+
createRecipientAtaIfNeeded: boolean = true
|
|
781
657
|
) => {
|
|
782
658
|
const mintInfo = await getMintInfo(solanaClient, fillInput.mint);
|
|
783
659
|
const approveIx = getApproveCheckedInstruction(
|
|
@@ -786,7 +662,7 @@ export const createFillInstruction = async (
|
|
|
786
662
|
mint: fillInput.mint,
|
|
787
663
|
delegate: fillInput.delegate,
|
|
788
664
|
owner: fillInput.signer,
|
|
789
|
-
amount: relayData.outputAmount,
|
|
665
|
+
amount: (fillInput.relayData as SvmSpokeClient.RelayDataArgs).outputAmount,
|
|
790
666
|
decimals: tokenDecimals,
|
|
791
667
|
},
|
|
792
668
|
{
|
|
@@ -797,7 +673,7 @@ export const createFillInstruction = async (
|
|
|
797
673
|
const getCreateAssociatedTokenIdempotentIx = () =>
|
|
798
674
|
getCreateAssociatedTokenIdempotentInstruction({
|
|
799
675
|
payer: signer,
|
|
800
|
-
owner: relayData.recipient,
|
|
676
|
+
owner: (fillInput.relayData as SvmSpokeClient.RelayDataArgs).recipient,
|
|
801
677
|
mint: fillInput.mint,
|
|
802
678
|
ata: fillInput.recipientTokenAccount,
|
|
803
679
|
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
@@ -806,9 +682,6 @@ export const createFillInstruction = async (
|
|
|
806
682
|
|
|
807
683
|
const createFillIx = SvmSpokeClient.getFillRelayInstruction(fillInput);
|
|
808
684
|
|
|
809
|
-
// Add remaining accounts.
|
|
810
|
-
createFillIx.accounts.push(...remainingAccounts);
|
|
811
|
-
|
|
812
685
|
return pipe(
|
|
813
686
|
await createDefaultTransaction(solanaClient, signer),
|
|
814
687
|
(tx) =>
|
|
@@ -818,14 +691,6 @@ export const createFillInstruction = async (
|
|
|
818
691
|
);
|
|
819
692
|
};
|
|
820
693
|
|
|
821
|
-
export function deserializeMessage(_message: string): AcrossPlusMessage {
|
|
822
|
-
const message = new Uint8Array(Buffer.from(_message.slice(2), "hex"));
|
|
823
|
-
// Add remaining accounts if the relayData has a non-empty message.
|
|
824
|
-
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
825
|
-
const acrossPlusMessageDecoder = getAcrossPlusMessageDecoder();
|
|
826
|
-
return acrossPlusMessageDecoder.decode(message);
|
|
827
|
-
}
|
|
828
|
-
|
|
829
694
|
/**
|
|
830
695
|
* Creates a deposit instruction.
|
|
831
696
|
* @param signer - The signer of the transaction.
|
|
@@ -1017,23 +882,28 @@ export async function getAssociatedTokenAddress(
|
|
|
1017
882
|
}
|
|
1018
883
|
|
|
1019
884
|
export function getRelayDataHash(relayData: RelayData, destinationChainId: number): string {
|
|
1020
|
-
|
|
885
|
+
const addressEncoder = getAddressEncoder();
|
|
1021
886
|
const uint64Encoder = getU64Encoder();
|
|
887
|
+
const uint32Encoder = getU32Encoder();
|
|
1022
888
|
|
|
1023
|
-
|
|
1024
|
-
const
|
|
1025
|
-
const encodedRelayData = relayDataEncoder.encode(svmRelayData);
|
|
1026
|
-
const encodedMessage = Buffer.from(relayData.message.slice(2), "hex");
|
|
889
|
+
assert(relayData.message.startsWith("0x"), "Message must be a hex string");
|
|
890
|
+
const encodeAddress = (data: SdkAddress) => Uint8Array.from(addressEncoder.encode(toAddress(data)));
|
|
1027
891
|
|
|
1028
|
-
// Reformat the encoded relay data the same way it is done in the SvmSpoke:
|
|
1029
|
-
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/merkle_proof_utils.rs#L5
|
|
1030
|
-
const messageOffset = encodedRelayData.length - 4 - encodedMessage.length;
|
|
1031
892
|
const contentToHash = Buffer.concat([
|
|
1032
|
-
|
|
1033
|
-
|
|
893
|
+
encodeAddress(relayData.depositor),
|
|
894
|
+
encodeAddress(relayData.recipient),
|
|
895
|
+
encodeAddress(relayData.exclusiveRelayer),
|
|
896
|
+
encodeAddress(relayData.inputToken),
|
|
897
|
+
encodeAddress(relayData.outputToken),
|
|
898
|
+
arrayify(hexZeroPad(hexlify(relayData.inputAmount), 32)),
|
|
899
|
+
Uint8Array.from(uint64Encoder.encode(BigInt(relayData.outputAmount.toString()))),
|
|
900
|
+
Uint8Array.from(uint64Encoder.encode(BigInt(relayData.originChainId.toString()))),
|
|
901
|
+
arrayify(hexZeroPad(hexlify(relayData.depositId), 32)),
|
|
902
|
+
Uint8Array.from(uint32Encoder.encode(relayData.fillDeadline)),
|
|
903
|
+
Uint8Array.from(uint32Encoder.encode(relayData.exclusivityDeadline)),
|
|
904
|
+
hashNonEmptyMessage(Buffer.from(arrayify(relayData.message))),
|
|
1034
905
|
Uint8Array.from(uint64Encoder.encode(BigInt(destinationChainId))),
|
|
1035
906
|
]);
|
|
1036
|
-
|
|
1037
907
|
return keccak256(contentToHash);
|
|
1038
908
|
}
|
|
1039
909
|
|
|
@@ -1121,47 +991,6 @@ async function fetchBatchFillStatusFromPdaAccounts(
|
|
|
1121
991
|
return fillStatuses;
|
|
1122
992
|
}
|
|
1123
993
|
|
|
1124
|
-
/**
|
|
1125
|
-
* Returns a set of instructions to execute to fill a relay via instruction params.
|
|
1126
|
-
* @param spokePool The program ID of the Solana spoke pool.
|
|
1127
|
-
* @param relayData The relay data to write to the instruction params PDA.
|
|
1128
|
-
* @param signer The transaction signer and authority of the instruction params PDA.
|
|
1129
|
-
* @param maxWriteSize The maximum fragment size to write to instruction params.
|
|
1130
|
-
*/
|
|
1131
|
-
export async function getFillRelayViaInstructionParamsInstructions(
|
|
1132
|
-
spokePool: Address<string>,
|
|
1133
|
-
relayData: RelayData,
|
|
1134
|
-
signer: TransactionSigner<string>,
|
|
1135
|
-
maxWriteSize = 450
|
|
1136
|
-
): Promise<IInstruction[]> {
|
|
1137
|
-
const instructionParams = await getInstructionParamsPda(spokePool, signer.address);
|
|
1138
|
-
|
|
1139
|
-
const relayDataEncoder = SvmSpokeClient.getRelayDataEncoder();
|
|
1140
|
-
const svmRelayData = toSvmRelayData(relayData);
|
|
1141
|
-
const encodedRelayData = relayDataEncoder.encode(svmRelayData);
|
|
1142
|
-
|
|
1143
|
-
const initInstructionParamsIx = SvmSpokeClient.getInitializeInstructionParamsInstruction({
|
|
1144
|
-
signer,
|
|
1145
|
-
instructionParams,
|
|
1146
|
-
totalSize: encodedRelayData.length,
|
|
1147
|
-
});
|
|
1148
|
-
const instructions: IInstruction[] = [initInstructionParamsIx];
|
|
1149
|
-
|
|
1150
|
-
for (let i = 0; i <= encodedRelayData.length / maxWriteSize; ++i) {
|
|
1151
|
-
const offset = i * maxWriteSize;
|
|
1152
|
-
const offsetEnd = Math.min(offset + maxWriteSize, encodedRelayData.length);
|
|
1153
|
-
const fragment = encodedRelayData.slice(offset, offsetEnd);
|
|
1154
|
-
const writeInstructionParamsIx = SvmSpokeClient.getWriteInstructionParamsFragmentInstruction({
|
|
1155
|
-
signer,
|
|
1156
|
-
instructionParams,
|
|
1157
|
-
offset,
|
|
1158
|
-
fragment,
|
|
1159
|
-
});
|
|
1160
|
-
instructions.push(writeInstructionParamsIx);
|
|
1161
|
-
}
|
|
1162
|
-
return instructions;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
994
|
/**
|
|
1166
995
|
* Returns the delegate PDA for deposit.
|
|
1167
996
|
*/
|
package/src/arch/svm/index.ts
CHANGED
package/src/arch/svm/utils.ts
CHANGED
|
@@ -507,29 +507,6 @@ export const getEmergencyDeleteRootBundleRootBundleId = (body: Buffer): number =
|
|
|
507
507
|
return result.rootBundleId.toNumber();
|
|
508
508
|
};
|
|
509
509
|
|
|
510
|
-
/**
|
|
511
|
-
* Converts a common `RelayData` type to an SvmSpokeClient.RelayData` type. This is useful for when we need
|
|
512
|
-
* to interface directly with the SvmSpoke.
|
|
513
|
-
* @param relayData The common RelayData TS type.
|
|
514
|
-
* @returns RelayData which conforms to the typing of the SvmSpoke.
|
|
515
|
-
*/
|
|
516
|
-
export function toSvmRelayData(relayData: RelayData): SvmSpokeClient.RelayData {
|
|
517
|
-
return {
|
|
518
|
-
originChainId: BigInt(relayData.originChainId),
|
|
519
|
-
depositor: address(relayData.depositor.toBase58()),
|
|
520
|
-
recipient: address(relayData.recipient.toBase58()),
|
|
521
|
-
depositId: ethers.utils.arrayify(ethers.utils.hexZeroPad(relayData.depositId.toHexString(), 32)),
|
|
522
|
-
inputToken: address(relayData.inputToken.toBase58()),
|
|
523
|
-
outputToken: address(relayData.outputToken.toBase58()),
|
|
524
|
-
inputAmount: ethers.utils.arrayify(ethers.utils.hexZeroPad(relayData.inputAmount.toHexString(), 32)),
|
|
525
|
-
outputAmount: relayData.outputAmount.toBigInt(),
|
|
526
|
-
message: Uint8Array.from(Buffer.from(relayData.message.slice(2), "hex")),
|
|
527
|
-
fillDeadline: relayData.fillDeadline,
|
|
528
|
-
exclusiveRelayer: address(relayData.exclusiveRelayer.toBase58()),
|
|
529
|
-
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
|
|
533
510
|
/**
|
|
534
511
|
* Convert a bigint (0 ≤ n < 2^256) to a 32-byte Uint8Array (big-endian).
|
|
535
512
|
* @param n The bigint to convert.
|
package/src/providers/alchemy.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CHAIN_IDs, MAINNET_CHAIN_IDs as _MAINNET_CHAIN_IDs, PUBLIC_NETWORKS } from "../constants";
|
|
2
2
|
import { RPCTransport } from "./types";
|
|
3
3
|
|
|
4
|
-
const MAINNET_CHAIN_IDs = Object.values(_MAINNET_CHAIN_IDs);
|
|
4
|
+
const MAINNET_CHAIN_IDs = Object.values(_MAINNET_CHAIN_IDs).map(Number);
|
|
5
5
|
|
|
6
6
|
// Chain-specific overrides for when the endpoint name does not match the canonical chain name.
|
|
7
|
-
const endpoints: { [chainId:
|
|
7
|
+
const endpoints: { [chainId: number]: string } = {
|
|
8
8
|
[CHAIN_IDs.ARBITRUM]: "arb",
|
|
9
9
|
[CHAIN_IDs.ARBITRUM_SEPOLIA]: "arb-sepolia",
|
|
10
10
|
[CHAIN_IDs.MAINNET]: "eth",
|
package/src/providers/infura.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CHAIN_IDs, MAINNET_CHAIN_IDs as _MAINNET_CHAIN_IDs, PUBLIC_NETWORKS } from "../constants";
|
|
2
2
|
import { RPCTransport } from "./types";
|
|
3
3
|
|
|
4
|
-
const MAINNET_CHAIN_IDs = Object.values(_MAINNET_CHAIN_IDs);
|
|
4
|
+
const MAINNET_CHAIN_IDs = Object.values(_MAINNET_CHAIN_IDs).map(Number);
|
|
5
5
|
|
|
6
6
|
// Chain-specific overrides for when the endpoint name does not match the canonical chain name.
|
|
7
|
-
const endpoints: { [chainId:
|
|
7
|
+
const endpoints: { [chainId: number]: string } = {
|
|
8
8
|
[CHAIN_IDs.ARBITRUM]: "arbitrum",
|
|
9
9
|
[CHAIN_IDs.BSC]: "bsc",
|
|
10
10
|
};
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { CHAIN_IDs, PUBLIC_NETWORKS } from "../constants";
|
|
1
|
+
import { CHAIN_IDs, MAINNET_CHAIN_IDs as _MAINNET_CHAIN_IDs, PUBLIC_NETWORKS } from "../constants";
|
|
2
2
|
import { RPCTransport } from "./types";
|
|
3
3
|
|
|
4
|
+
const SNOWFLAKES = {
|
|
5
|
+
[CHAIN_IDs.ARBITRUM]: "arbitrum-mainnet",
|
|
6
|
+
[CHAIN_IDs.BSC]: "bsc",
|
|
7
|
+
[CHAIN_IDs.POLYGON]: "matic",
|
|
8
|
+
[CHAIN_IDs.OPTIMISM]: "optimism",
|
|
9
|
+
[CHAIN_IDs.WORLD_CHAIN]: "worldchain-mainnet",
|
|
10
|
+
};
|
|
11
|
+
const SNOWFLAKE_CHAIN_IDs = Object.keys(SNOWFLAKES).map(Number);
|
|
12
|
+
const MAINNET_CHAIN_IDs = Object.values(_MAINNET_CHAIN_IDs).map(Number);
|
|
13
|
+
|
|
4
14
|
export function getURL(chainId: number, apiKey: string, transport: RPCTransport): string {
|
|
5
15
|
const envVar = "RPC_PROVIDER_KEY_QUICKNODE_PREFIX";
|
|
6
16
|
const prefix = process.env[`${envVar}_${chainId}`] ?? process.env[envVar];
|
|
@@ -8,19 +18,22 @@ export function getURL(chainId: number, apiKey: string, transport: RPCTransport)
|
|
|
8
18
|
throw new Error(`No API key prefix supplied for QuickNode (${envVar})`);
|
|
9
19
|
}
|
|
10
20
|
|
|
11
|
-
|
|
12
|
-
if (chainId === CHAIN_IDs.MAINNET) {
|
|
13
|
-
return `${transport}://${prefix}.quicknode.pro/${apiKey}`;
|
|
14
|
-
}
|
|
21
|
+
const domain = "quicknode.pro";
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
/* Some chains are special snowflakes */
|
|
24
|
+
if (chainId === CHAIN_IDs.MAINNET) {
|
|
25
|
+
return `${transport}://${prefix}.${domain}/${apiKey}`;
|
|
18
26
|
}
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
let chain = SNOWFLAKES[chainId] ?? PUBLIC_NETWORKS[chainId]?.name;
|
|
21
29
|
if (!chain) {
|
|
22
30
|
throw new Error(`No known QuickNode provider for chainId ${chainId}`);
|
|
23
31
|
}
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
if (MAINNET_CHAIN_IDs.includes(chainId) && !SNOWFLAKE_CHAIN_IDs.includes(chainId)) {
|
|
34
|
+
chain += "-mainnet";
|
|
35
|
+
}
|
|
36
|
+
chain = chain.toLowerCase().replace(" ", "-");
|
|
37
|
+
|
|
38
|
+
return `${transport}://${prefix}.${chain}.${domain}/${apiKey}`;
|
|
26
39
|
}
|
package/src/providers/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { any, literal, nullable, number, string, type, union } from "superstruct";
|
|
2
2
|
|
|
3
|
-
export type RPCProvider = "ALCHEMY" | "DRPC" | "INFURA" | "INFURA_DIN";
|
|
3
|
+
export type RPCProvider = "ALCHEMY" | "DRPC" | "INFURA" | "INFURA_DIN" | "QUICKNODE";
|
|
4
4
|
export type RPCTransport = "https" | "wss";
|
|
5
5
|
|
|
6
6
|
// JSON-RPC 2.0 Error object
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAccountMeta = exports.getCompiledIxDecoder = exports.getCompiledIxEncoder = exports.getHandlerMessageEncoder = exports.getAcrossPlusMessageDecoder = exports.getAcrossPlusMessageEncoder = void 0;
|
|
4
|
-
var kit_1 = require("@solana/kit");
|
|
5
|
-
function getAcrossPlusMessageEncoder() {
|
|
6
|
-
return (0, kit_1.getStructEncoder)([
|
|
7
|
-
["handler", (0, kit_1.getAddressEncoder)()],
|
|
8
|
-
["read_only_len", (0, kit_1.getU8Encoder)()],
|
|
9
|
-
["value_amount", (0, kit_1.getU64Encoder)()],
|
|
10
|
-
["accounts", (0, kit_1.getArrayEncoder)((0, kit_1.getAddressEncoder)())],
|
|
11
|
-
["handler_message", (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
|
|
12
|
-
]);
|
|
13
|
-
}
|
|
14
|
-
exports.getAcrossPlusMessageEncoder = getAcrossPlusMessageEncoder;
|
|
15
|
-
function getAcrossPlusMessageDecoder() {
|
|
16
|
-
return (0, kit_1.getStructDecoder)([
|
|
17
|
-
["handler", (0, kit_1.getAddressDecoder)()],
|
|
18
|
-
["read_only_len", (0, kit_1.getU8Decoder)()],
|
|
19
|
-
["value_amount", (0, kit_1.getU64Decoder)()],
|
|
20
|
-
["accounts", (0, kit_1.getArrayDecoder)((0, kit_1.getAddressDecoder)())],
|
|
21
|
-
["handler_message", (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
|
|
22
|
-
]);
|
|
23
|
-
}
|
|
24
|
-
exports.getAcrossPlusMessageDecoder = getAcrossPlusMessageDecoder;
|
|
25
|
-
function getHandlerMessageEncoder() {
|
|
26
|
-
return (0, kit_1.getArrayEncoder)(getCompiledIxEncoder());
|
|
27
|
-
}
|
|
28
|
-
exports.getHandlerMessageEncoder = getHandlerMessageEncoder;
|
|
29
|
-
function getCompiledIxEncoder() {
|
|
30
|
-
return (0, kit_1.getStructEncoder)([
|
|
31
|
-
["program_id_index", (0, kit_1.getU8Encoder)()],
|
|
32
|
-
["account_key_indexes", (0, kit_1.getArrayEncoder)((0, kit_1.getU8Encoder)())],
|
|
33
|
-
["data", (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
exports.getCompiledIxEncoder = getCompiledIxEncoder;
|
|
37
|
-
function getCompiledIxDecoder() {
|
|
38
|
-
return (0, kit_1.getStructDecoder)([
|
|
39
|
-
["program_id_index", (0, kit_1.getU8Decoder)()],
|
|
40
|
-
["account_key_indexes", (0, kit_1.getArrayDecoder)((0, kit_1.getU8Decoder)())],
|
|
41
|
-
["data", (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
exports.getCompiledIxDecoder = getCompiledIxDecoder;
|
|
45
|
-
function getAccountMeta(value, isWritable) {
|
|
46
|
-
return Object.freeze({
|
|
47
|
-
address: value,
|
|
48
|
-
role: isWritable ? kit_1.AccountRole.WRITABLE : kit_1.AccountRole.READONLY,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
exports.getAccountMeta = getAccountMeta;
|
|
52
|
-
//# sourceMappingURL=encoders.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoders.js","sourceRoot":"","sources":["../../../../src/arch/svm/encoders.ts"],"names":[],"mappings":";;;AAAA,mCAwBqB;AAgBrB,SAAgB,2BAA2B;IACzC,OAAO,IAAA,sBAAgB,EAAC;QACtB,CAAC,SAAS,EAAE,IAAA,uBAAiB,GAAE,CAAC;QAChC,CAAC,eAAe,EAAE,IAAA,kBAAY,GAAE,CAAC;QACjC,CAAC,cAAc,EAAE,IAAA,mBAAa,GAAE,CAAC;QACjC,CAAC,UAAU,EAAE,IAAA,qBAAe,EAAC,IAAA,uBAAiB,GAAE,CAAC,CAAC;QA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,GAAE,EAAE,IAAA,mBAAa,GAAE,CAAC,CAAC;KACnE,CAAC,CAAC;AACL,CAAC;AAND,oDAMC;AAED,SAAgB,cAAc,CAAC,KAAc,EAAE,UAAmB;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,iBAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAW,CAAC,QAAQ;KAC/D,CAAC,CAAC;AACL,CAAC;AALD,wCAKC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { AccountRole, addDecoderSizePrefix, addEncoderSizePrefix, getAddressDecoder, getAddressEncoder, getArrayEncoder, getArrayDecoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU8Decoder, getU8Encoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, } from "@solana/kit";
|
|
2
|
-
export function getAcrossPlusMessageEncoder() {
|
|
3
|
-
return getStructEncoder([
|
|
4
|
-
["handler", getAddressEncoder()],
|
|
5
|
-
["read_only_len", getU8Encoder()],
|
|
6
|
-
["value_amount", getU64Encoder()],
|
|
7
|
-
["accounts", getArrayEncoder(getAddressEncoder())],
|
|
8
|
-
["handler_message", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
11
|
-
export function getAcrossPlusMessageDecoder() {
|
|
12
|
-
return getStructDecoder([
|
|
13
|
-
["handler", getAddressDecoder()],
|
|
14
|
-
["read_only_len", getU8Decoder()],
|
|
15
|
-
["value_amount", getU64Decoder()],
|
|
16
|
-
["accounts", getArrayDecoder(getAddressDecoder())],
|
|
17
|
-
["handler_message", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
18
|
-
]);
|
|
19
|
-
}
|
|
20
|
-
export function getHandlerMessageEncoder() {
|
|
21
|
-
return getArrayEncoder(getCompiledIxEncoder());
|
|
22
|
-
}
|
|
23
|
-
export function getCompiledIxEncoder() {
|
|
24
|
-
return getStructEncoder([
|
|
25
|
-
["program_id_index", getU8Encoder()],
|
|
26
|
-
["account_key_indexes", getArrayEncoder(getU8Encoder())],
|
|
27
|
-
["data", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
export function getCompiledIxDecoder() {
|
|
31
|
-
return getStructDecoder([
|
|
32
|
-
["program_id_index", getU8Decoder()],
|
|
33
|
-
["account_key_indexes", getArrayDecoder(getU8Decoder())],
|
|
34
|
-
["data", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
35
|
-
]);
|
|
36
|
-
}
|
|
37
|
-
export function getAccountMeta(value, isWritable) {
|
|
38
|
-
return Object.freeze({
|
|
39
|
-
address: value,
|
|
40
|
-
role: isWritable ? AccountRole.WRITABLE : AccountRole.READONLY,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=encoders.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoders.js","sourceRoot":"","sources":["../../../../src/arch/svm/encoders.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,GAOd,MAAM,aAAa,CAAC;AAgBrB,MAAM,UAAU,2BAA2B;IACzC,OAAO,gBAAgB,CAAC;QACtB,CAAC,SAAS,EAAE,iBAAiB,EAAE,CAAC;QAChC,CAAC,eAAe,EAAE,YAAY,EAAE,CAAC;QACjC,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;QACjC,CAAC,UAAU,EAAE,eAAe,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAClD,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;KAC9E,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,OAAO,gBAAgB,CAAC;QACtB,CAAC,SAAS,EAAE,iBAAiB,EAAE,CAAC;QAChC,CAAC,eAAe,EAAE,YAAY,EAAE,CAAC;QACjC,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;QACjC,CAAC,UAAU,EAAE,eAAe,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAClD,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;KAC9E,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO,eAAe,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,gBAAgB,CAAC;QACtB,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC;QACpC,CAAC,qBAAqB,EAAE,eAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QACxD,CAAC,MAAM,EAAE,oBAAoB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;KACnE,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,gBAAgB,CAAC;QACtB,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC;QACpC,CAAC,qBAAqB,EAAE,eAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QACxD,CAAC,MAAM,EAAE,oBAAoB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;KACnE,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,UAAmB;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ;KAC/D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|