@across-protocol/sdk 4.3.32-alpha.2 → 4.3.33
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 +2 -2
- package/dist/cjs/arch/svm/SpokeUtils.js +24 -30
- 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/quicknode.d.ts +2 -0
- package/dist/cjs/providers/quicknode.js +25 -0
- package/dist/cjs/providers/quicknode.js.map +1 -0
- package/dist/cjs/providers/solana/retryRpcFactory.js +3 -4
- package/dist/cjs/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/cjs/providers/utils.js +3 -1
- package/dist/cjs/providers/utils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +2 -2
- package/dist/esm/arch/svm/SpokeUtils.js +26 -37
- 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/quicknode.d.ts +2 -0
- package/dist/esm/providers/quicknode.js +22 -0
- package/dist/esm/providers/quicknode.js.map +1 -0
- package/dist/esm/providers/solana/retryRpcFactory.js +3 -4
- package/dist/esm/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/esm/providers/utils.js +3 -1
- package/dist/esm/providers/utils.js.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +2 -2
- 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 +3 -0
- package/dist/types/providers/quicknode.d.ts.map +1 -0
- package/dist/types/providers/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/svm/SpokeUtils.ts +20 -42
- package/src/arch/svm/index.ts +0 -1
- package/src/arch/svm/utils.ts +0 -23
- package/src/providers/quicknode.ts +26 -0
- package/src/providers/solana/retryRpcFactory.ts +3 -3
- package/src/providers/utils.ts +3 -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":"index.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
3
2
|
import { Idl } from "@coral-xyz/anchor";
|
|
4
3
|
import { Address, IInstruction, KeyPairSigner, type Commitment, type TransactionSigner } from "@solana/kit";
|
|
5
4
|
import { RelayData } from "../../interfaces";
|
|
@@ -167,13 +166,6 @@ export declare const isEmergencyDeleteRootBundleMessageBody: (body: Buffer) => b
|
|
|
167
166
|
* @returns The root bundle ID.
|
|
168
167
|
*/
|
|
169
168
|
export declare const getEmergencyDeleteRootBundleRootBundleId: (body: Buffer) => number;
|
|
170
|
-
/**
|
|
171
|
-
* Converts a common `RelayData` type to an SvmSpokeClient.RelayData` type. This is useful for when we need
|
|
172
|
-
* to interface directly with the SvmSpoke.
|
|
173
|
-
* @param relayData The common RelayData TS type.
|
|
174
|
-
* @returns RelayData which conforms to the typing of the SvmSpoke.
|
|
175
|
-
*/
|
|
176
|
-
export declare function toSvmRelayData(relayData: RelayData): SvmSpokeClient.RelayData;
|
|
177
169
|
/**
|
|
178
170
|
* Convert a bigint (0 ≤ n < 2^256) to a 32-byte Uint8Array (big-endian).
|
|
179
171
|
* @param n The bigint to convert.
|
|
@@ -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;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eAAO,MAAM,wBAAwB,cAAqB,WAAW,UAAU,iBAAiB;;;gBAO/F,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quicknode.d.ts","sourceRoot":"","sources":["../../../src/providers/quicknode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,MAAM,CAsBvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/providers/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,EAAE,WAAW,EAA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;;;;;EAG7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAkBnG;AAED,oBAAY,SAAS;IACnB,IAAI,IAAA;IACJ,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,oBAAoB,IAAA;CACrB"}
|
package/package.json
CHANGED
|
@@ -32,11 +32,9 @@ import {
|
|
|
32
32
|
signTransactionMessageWithSigners,
|
|
33
33
|
some,
|
|
34
34
|
type TransactionSigner,
|
|
35
|
-
type WritableAccount,
|
|
36
|
-
type ReadonlyAccount,
|
|
37
35
|
} from "@solana/kit";
|
|
38
36
|
import assert from "assert";
|
|
39
|
-
import { arrayify } from "ethers/lib/utils";
|
|
37
|
+
import { arrayify, hexZeroPad, hexlify } from "ethers/lib/utils";
|
|
40
38
|
import { Logger } from "winston";
|
|
41
39
|
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "../../constants";
|
|
42
40
|
import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
|
|
@@ -68,9 +66,6 @@ import {
|
|
|
68
66
|
toAddress,
|
|
69
67
|
unwrapEventData,
|
|
70
68
|
getRootBundlePda,
|
|
71
|
-
getAcrossPlusMessageDecoder,
|
|
72
|
-
getAccountMeta,
|
|
73
|
-
toSvmRelayData,
|
|
74
69
|
} from "./";
|
|
75
70
|
import { SvmCpiEventsClient } from "./eventsClient";
|
|
76
71
|
import { SVM_BLOCK_NOT_AVAILABLE, SVM_SLOT_SKIPPED, isSolanaError } from "./provider";
|
|
@@ -606,8 +601,6 @@ export async function getFillRelayTx(
|
|
|
606
601
|
getEventAuthority(program),
|
|
607
602
|
]);
|
|
608
603
|
|
|
609
|
-
const _message = relayData.message.startsWith("0x") ? relayData.message.slice(2) : relayData.message;
|
|
610
|
-
const message = new Uint8Array(Buffer.from(_message, "hex"));
|
|
611
604
|
const svmRelayData: SvmSpokeClient.FillRelayInput["relayData"] = {
|
|
612
605
|
depositor: toAddress(depositor),
|
|
613
606
|
recipient: toAddress(recipient),
|
|
@@ -620,25 +613,9 @@ export async function getFillRelayTx(
|
|
|
620
613
|
depositId: new Uint8Array(intToU8Array32(relayData.depositId.toNumber())),
|
|
621
614
|
fillDeadline: relayData.fillDeadline,
|
|
622
615
|
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
623
|
-
message,
|
|
616
|
+
message: new Uint8Array(Buffer.from(relayData.message, "hex")),
|
|
624
617
|
};
|
|
625
618
|
|
|
626
|
-
// Add remaining accounts if the relayData has a non-empty message.
|
|
627
|
-
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
628
|
-
const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
|
|
629
|
-
if (message.length !== 0) {
|
|
630
|
-
const acrossPlusMessageDecoder = getAcrossPlusMessageDecoder();
|
|
631
|
-
const acrossPlusMessage = acrossPlusMessageDecoder.decode(message);
|
|
632
|
-
// The first `remainingAccount` _must_ be the handler address.
|
|
633
|
-
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/message_utils.rs#L36.
|
|
634
|
-
remainingAccounts.push(getAccountMeta(acrossPlusMessage.handler, true));
|
|
635
|
-
remainingAccounts.push(
|
|
636
|
-
...acrossPlusMessage.accounts.map((account, idx) =>
|
|
637
|
-
getAccountMeta(account, idx < acrossPlusMessage.accounts.length - acrossPlusMessage.read_only_len)
|
|
638
|
-
)
|
|
639
|
-
);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
619
|
const fillInput: SvmSpokeClient.FillRelayInput = {
|
|
643
620
|
signer: signer,
|
|
644
621
|
state,
|
|
@@ -659,7 +636,7 @@ export async function getFillRelayTx(
|
|
|
659
636
|
};
|
|
660
637
|
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
661
638
|
// if it doesn't exist.
|
|
662
|
-
return createFillInstruction(signer, solanaClient, fillInput, mintInfo.data.decimals, true
|
|
639
|
+
return createFillInstruction(signer, solanaClient, fillInput, mintInfo.data.decimals, true);
|
|
663
640
|
}
|
|
664
641
|
|
|
665
642
|
/**
|
|
@@ -676,8 +653,7 @@ export const createFillInstruction = async (
|
|
|
676
653
|
solanaClient: SVMProvider,
|
|
677
654
|
fillInput: SvmSpokeClient.FillRelayInput,
|
|
678
655
|
tokenDecimals: number,
|
|
679
|
-
createRecipientAtaIfNeeded: boolean = true
|
|
680
|
-
remainingAccounts: (WritableAccount | ReadonlyAccount)[] = []
|
|
656
|
+
createRecipientAtaIfNeeded: boolean = true
|
|
681
657
|
) => {
|
|
682
658
|
const mintInfo = await getMintInfo(solanaClient, fillInput.mint);
|
|
683
659
|
const approveIx = getApproveCheckedInstruction(
|
|
@@ -706,9 +682,6 @@ export const createFillInstruction = async (
|
|
|
706
682
|
|
|
707
683
|
const createFillIx = SvmSpokeClient.getFillRelayInstruction(fillInput);
|
|
708
684
|
|
|
709
|
-
// Add remaining accounts.
|
|
710
|
-
createFillIx.accounts.push(...remainingAccounts);
|
|
711
|
-
|
|
712
685
|
return pipe(
|
|
713
686
|
await createDefaultTransaction(solanaClient, signer),
|
|
714
687
|
(tx) =>
|
|
@@ -909,23 +882,28 @@ export async function getAssociatedTokenAddress(
|
|
|
909
882
|
}
|
|
910
883
|
|
|
911
884
|
export function getRelayDataHash(relayData: RelayData, destinationChainId: number): string {
|
|
912
|
-
|
|
885
|
+
const addressEncoder = getAddressEncoder();
|
|
913
886
|
const uint64Encoder = getU64Encoder();
|
|
887
|
+
const uint32Encoder = getU32Encoder();
|
|
914
888
|
|
|
915
|
-
|
|
916
|
-
const
|
|
917
|
-
const encodedRelayData = relayDataEncoder.encode(svmRelayData);
|
|
918
|
-
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)));
|
|
919
891
|
|
|
920
|
-
// Reformat the encoded relay data the same way it is done in the SvmSpoke:
|
|
921
|
-
// https://github.com/across-protocol/contracts/blob/3310f8dc716407a5f97ef5fd2eae63df83251f2f/programs/svm-spoke/src/utils/merkle_proof_utils.rs#L5
|
|
922
|
-
const messageOffset = encodedRelayData.length - 4 - encodedMessage.length;
|
|
923
892
|
const contentToHash = Buffer.concat([
|
|
924
|
-
|
|
925
|
-
|
|
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))),
|
|
926
905
|
Uint8Array.from(uint64Encoder.encode(BigInt(destinationChainId))),
|
|
927
906
|
]);
|
|
928
|
-
|
|
929
907
|
return keccak256(contentToHash);
|
|
930
908
|
}
|
|
931
909
|
|
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.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CHAIN_IDs, PUBLIC_NETWORKS } from "../constants";
|
|
2
|
+
import { RPCTransport } from "./types";
|
|
3
|
+
|
|
4
|
+
export function getURL(chainId: number, apiKey: string, transport: RPCTransport): string {
|
|
5
|
+
const envVar = "RPC_PROVIDER_KEY_QUICKNODE_PREFIX";
|
|
6
|
+
const prefix = process.env[`${envVar}_${chainId}`] ?? process.env[envVar];
|
|
7
|
+
if (!prefix) {
|
|
8
|
+
throw new Error(`No API key prefix supplied for QuickNode (${envVar})`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Ethereum and Optimism are special snowflakes */
|
|
12
|
+
if (chainId === CHAIN_IDs.MAINNET) {
|
|
13
|
+
return `${transport}://${prefix}.quicknode.pro/${apiKey}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (chainId === CHAIN_IDs.OPTIMISM) {
|
|
17
|
+
return `${transport}://${prefix}.optimism.quicknode.pro/${apiKey}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const chain = PUBLIC_NETWORKS[chainId]?.name.toLowerCase().replace(" ", "-");
|
|
21
|
+
if (!chain) {
|
|
22
|
+
throw new Error(`No known QuickNode provider for chainId ${chainId}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return `${transport}://${prefix}.${chain}.quicknode.pro/${apiKey}`;
|
|
26
|
+
}
|
|
@@ -71,9 +71,9 @@ export class RetrySolanaRpcFactory extends SolanaClusterRpcFactory {
|
|
|
71
71
|
// Implement a slightly aggressive exponential backoff to account for fierce parallelism.
|
|
72
72
|
const { retryDelaySeconds } = this;
|
|
73
73
|
const exponentialBackoff = retryDelaySeconds * Math.pow(2, retryAttempt - 1);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const jitter = 1 + 2 * Math.random(); // Range jitter from [1, 3]s to offset problem where there are many
|
|
75
|
+
// concurrent retry requests sent at the same time.
|
|
76
|
+
const delayS = this.isRateLimitResponse(error) ? exponentialBackoff + jitter : retryDelaySeconds;
|
|
77
77
|
|
|
78
78
|
// Log retry attempt if logger is available
|
|
79
79
|
this.logger.debug({
|
package/src/providers/utils.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { RPCProvider, RPCTransport } from "./types";
|
|
|
7
7
|
import * as alchemy from "./alchemy";
|
|
8
8
|
import * as infura from "./infura";
|
|
9
9
|
import * as drpc from "./drpc";
|
|
10
|
+
import * as quicknode from "./quicknode";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Infura DIN is identified separately to allow it to be configured explicitly.
|
|
@@ -16,6 +17,7 @@ const PROVIDERS = {
|
|
|
16
17
|
INFURA: infura.getURL,
|
|
17
18
|
INFURA_DIN: infura.getURL,
|
|
18
19
|
DRPC: drpc.getURL,
|
|
20
|
+
QUICKNODE: quicknode.getURL,
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -24,7 +26,7 @@ const PROVIDERS = {
|
|
|
24
26
|
* @returns True if the provider string is a supported provider.
|
|
25
27
|
*/
|
|
26
28
|
export function isSupportedProvider(provider: string): provider is RPCProvider {
|
|
27
|
-
return
|
|
29
|
+
return Object.keys(PROVIDERS).includes(provider);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -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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,CAAC;QACpC,CAAC,qBAAqB,EAAE,IAAA,qBAAe,EAAC,IAAA,kBAAY,GAAE,CAAC,CAAC;QACxD,CAAC,MAAM,EAAE,IAAA,0BAAoB,EAAC,IAAA,qBAAe,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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoders.d.ts","sourceRoot":"","sources":["../../../../src/arch/svm/encoders.ts"],"names":[],"mappings":"AAAA,OAAO,EAkBL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,eAAe,EAAE,kBAAkB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAQxE;AAED,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAQxE;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAErE;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,CAM1D;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,CAM1D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,eAAe,CAKrG"}
|
package/src/arch/svm/encoders.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AccountRole,
|
|
3
|
-
addDecoderSizePrefix,
|
|
4
|
-
addEncoderSizePrefix,
|
|
5
|
-
getAddressDecoder,
|
|
6
|
-
getAddressEncoder,
|
|
7
|
-
getArrayEncoder,
|
|
8
|
-
getArrayDecoder,
|
|
9
|
-
getBytesDecoder,
|
|
10
|
-
getBytesEncoder,
|
|
11
|
-
getStructDecoder,
|
|
12
|
-
getStructEncoder,
|
|
13
|
-
getU8Decoder,
|
|
14
|
-
getU8Encoder,
|
|
15
|
-
getU32Decoder,
|
|
16
|
-
getU32Encoder,
|
|
17
|
-
getU64Decoder,
|
|
18
|
-
getU64Encoder,
|
|
19
|
-
type Address,
|
|
20
|
-
type Decoder,
|
|
21
|
-
type Encoder,
|
|
22
|
-
type ReadonlyUint8Array,
|
|
23
|
-
type WritableAccount,
|
|
24
|
-
type ReadonlyAccount,
|
|
25
|
-
} from "@solana/kit";
|
|
26
|
-
|
|
27
|
-
export type AcrossPlusMessage = {
|
|
28
|
-
handler: Address;
|
|
29
|
-
read_only_len: number;
|
|
30
|
-
value_amount: bigint;
|
|
31
|
-
accounts: Array<Address>;
|
|
32
|
-
handler_message: ReadonlyUint8Array;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type CompiledIx = {
|
|
36
|
-
program_id_index: number;
|
|
37
|
-
account_key_indexes: Array<number>;
|
|
38
|
-
data: ReadonlyUint8Array;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export function getAcrossPlusMessageEncoder(): Encoder<AcrossPlusMessage> {
|
|
42
|
-
return getStructEncoder([
|
|
43
|
-
["handler", getAddressEncoder()],
|
|
44
|
-
["read_only_len", getU8Encoder()],
|
|
45
|
-
["value_amount", getU64Encoder()],
|
|
46
|
-
["accounts", getArrayEncoder(getAddressEncoder())],
|
|
47
|
-
["handler_message", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
48
|
-
]);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function getAcrossPlusMessageDecoder(): Decoder<AcrossPlusMessage> {
|
|
52
|
-
return getStructDecoder([
|
|
53
|
-
["handler", getAddressDecoder()],
|
|
54
|
-
["read_only_len", getU8Decoder()],
|
|
55
|
-
["value_amount", getU64Decoder()],
|
|
56
|
-
["accounts", getArrayDecoder(getAddressDecoder())],
|
|
57
|
-
["handler_message", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function getHandlerMessageEncoder(): Encoder<Array<CompiledIx>> {
|
|
62
|
-
return getArrayEncoder(getCompiledIxEncoder());
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function getCompiledIxEncoder(): Encoder<CompiledIx> {
|
|
66
|
-
return getStructEncoder([
|
|
67
|
-
["program_id_index", getU8Encoder()],
|
|
68
|
-
["account_key_indexes", getArrayEncoder(getU8Encoder())],
|
|
69
|
-
["data", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
70
|
-
]);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function getCompiledIxDecoder(): Decoder<CompiledIx> {
|
|
74
|
-
return getStructDecoder([
|
|
75
|
-
["program_id_index", getU8Decoder()],
|
|
76
|
-
["account_key_indexes", getArrayDecoder(getU8Decoder())],
|
|
77
|
-
["data", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
78
|
-
]);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function getAccountMeta(value: Address, isWritable: boolean): WritableAccount | ReadonlyAccount {
|
|
82
|
-
return Object.freeze({
|
|
83
|
-
address: value,
|
|
84
|
-
role: isWritable ? AccountRole.WRITABLE : AccountRole.READONLY,
|
|
85
|
-
});
|
|
86
|
-
}
|