@solana/client 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.browser.cjs +2796 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.mjs +2745 -0
- package/dist/index.browser.mjs.map +1 -0
- package/dist/index.native.mjs +2745 -0
- package/dist/index.native.mjs.map +1 -0
- package/dist/index.node.cjs +2796 -0
- package/dist/index.node.cjs.map +1 -0
- package/dist/index.node.mjs +2745 -0
- package/dist/index.node.mjs.map +1 -0
- package/dist/types/client/actions.d.ts +18 -0
- package/dist/types/client/actions.d.ts.map +1 -0
- package/dist/types/client/createClient.d.ts +9 -0
- package/dist/types/client/createClient.d.ts.map +1 -0
- package/dist/types/client/createClientHelpers.d.ts +3 -0
- package/dist/types/client/createClientHelpers.d.ts.map +1 -0
- package/dist/types/client/createClientStore.d.ts +29 -0
- package/dist/types/client/createClientStore.d.ts.map +1 -0
- package/dist/types/client/watchers.d.ts +16 -0
- package/dist/types/client/watchers.d.ts.map +1 -0
- package/dist/types/controllers/solTransferController.d.ts +21 -0
- package/dist/types/controllers/solTransferController.d.ts.map +1 -0
- package/dist/types/controllers/splTransferController.d.ts +24 -0
- package/dist/types/controllers/splTransferController.d.ts.map +1 -0
- package/dist/types/features/sol.d.ts +41 -0
- package/dist/types/features/sol.d.ts.map +1 -0
- package/dist/types/features/spl.d.ts +59 -0
- package/dist/types/features/spl.d.ts.map +1 -0
- package/dist/types/features/transactions.d.ts +79 -0
- package/dist/types/features/transactions.d.ts.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/logging/logger.d.ts +24 -0
- package/dist/types/logging/logger.d.ts.map +1 -0
- package/dist/types/numeric/amounts.d.ts +30 -0
- package/dist/types/numeric/amounts.d.ts.map +1 -0
- package/dist/types/numeric/lamports.d.ts +46 -0
- package/dist/types/numeric/lamports.d.ts.map +1 -0
- package/dist/types/numeric/math.d.ts +74 -0
- package/dist/types/numeric/math.d.ts.map +1 -0
- package/dist/types/numeric/rational.d.ts +27 -0
- package/dist/types/numeric/rational.d.ts.map +1 -0
- package/dist/types/rpc/createSolanaRpcClient.d.ts +42 -0
- package/dist/types/rpc/createSolanaRpcClient.d.ts.map +1 -0
- package/dist/types/serialization/json.d.ts +31 -0
- package/dist/types/serialization/json.d.ts.map +1 -0
- package/dist/types/signatures/status.d.ts +12 -0
- package/dist/types/signatures/status.d.ts.map +1 -0
- package/dist/types/signers/walletTransactionSigner.d.ts +33 -0
- package/dist/types/signers/walletTransactionSigner.d.ts.map +1 -0
- package/dist/types/state/asyncState.d.ts +12 -0
- package/dist/types/state/asyncState.d.ts.map +1 -0
- package/dist/types/transactions/base64.d.ts +12 -0
- package/dist/types/transactions/base64.d.ts.map +1 -0
- package/dist/types/transactions/prepareTransaction.d.ts +16 -0
- package/dist/types/transactions/prepareTransaction.d.ts.map +1 -0
- package/dist/types/transactions/referenceKeys.d.ts +10 -0
- package/dist/types/transactions/referenceKeys.d.ts.map +1 -0
- package/dist/types/transactions/transactionPoolController.d.ts +53 -0
- package/dist/types/transactions/transactionPoolController.d.ts.map +1 -0
- package/dist/types/types.d.ts +205 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/addressLike.d.ts +5 -0
- package/dist/types/utils/addressLike.d.ts.map +1 -0
- package/dist/types/utils/stableStringify.d.ts +2 -0
- package/dist/types/utils/stableStringify.d.ts.map +1 -0
- package/dist/types/utils.d.ts +21 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/wallet/registry.d.ts +9 -0
- package/dist/types/wallet/registry.d.ts.map +1 -0
- package/dist/types/wallet/standard.d.ts +36 -0
- package/dist/types/wallet/standard.d.ts.map +1 -0
- package/package.json +83 -79
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ClusterUrl, type Commitment, createSolanaRpc, createSolanaRpcSubscriptions, type SendableTransaction, type Signature, type Transaction } from '@solana/kit';
|
|
2
|
+
import type { TransactionWithLastValidBlockHeight } from '@solana/transaction-confirmation';
|
|
3
|
+
type SolanaRpcInstance = ReturnType<typeof createSolanaRpc>;
|
|
4
|
+
type SolanaRpcSubscriptionsInstance = ReturnType<typeof createSolanaRpcSubscriptions>;
|
|
5
|
+
type ConfirmableTransaction = SendableTransaction & Transaction & TransactionWithLastValidBlockHeight;
|
|
6
|
+
type SimulateTransactionPlan = ReturnType<SolanaRpcInstance['simulateTransaction']>;
|
|
7
|
+
type SimulateTransactionConfig = Parameters<SolanaRpcInstance['simulateTransaction']>[1];
|
|
8
|
+
type SimulateTransactionResult = Awaited<ReturnType<SimulateTransactionPlan['send']>>;
|
|
9
|
+
export type SendAndConfirmTransactionOptions = Readonly<{
|
|
10
|
+
abortSignal?: AbortSignal;
|
|
11
|
+
commitment?: Commitment;
|
|
12
|
+
maxRetries?: bigint | number;
|
|
13
|
+
minContextSlot?: bigint | number;
|
|
14
|
+
skipPreflight?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export type SimulateTransactionOptions = Readonly<{
|
|
17
|
+
abortSignal?: AbortSignal;
|
|
18
|
+
commitment?: Commitment;
|
|
19
|
+
config?: SimulateTransactionConfig;
|
|
20
|
+
}>;
|
|
21
|
+
export type SolanaRpcClient = Readonly<{
|
|
22
|
+
commitment: Commitment;
|
|
23
|
+
endpoint: ClusterUrl;
|
|
24
|
+
rpc: SolanaRpcInstance;
|
|
25
|
+
rpcSubscriptions: SolanaRpcSubscriptionsInstance;
|
|
26
|
+
sendAndConfirmTransaction(transaction: ConfirmableTransaction, options?: SendAndConfirmTransactionOptions): Promise<Signature>;
|
|
27
|
+
simulateTransaction(transaction: SendableTransaction & Transaction, options?: SimulateTransactionOptions): Promise<SimulateTransactionResult>;
|
|
28
|
+
websocketEndpoint: ClusterUrl;
|
|
29
|
+
}>;
|
|
30
|
+
export type CreateSolanaRpcClientConfig = Readonly<{
|
|
31
|
+
commitment?: Commitment;
|
|
32
|
+
endpoint: ClusterUrl;
|
|
33
|
+
rpcConfig?: Parameters<typeof createSolanaRpc>[1];
|
|
34
|
+
rpcSubscriptionsConfig?: Parameters<typeof createSolanaRpcSubscriptions>[1];
|
|
35
|
+
websocketEndpoint?: ClusterUrl;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a lightweight RPC client that wires up JSON-RPC, subscriptions, and common helpers.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createSolanaRpcClient(config: CreateSolanaRpcClientConfig): SolanaRpcClient;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=createSolanaRpcClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSolanaRpcClient.d.ts","sourceRoot":"","sources":["../../../src/rpc/createSolanaRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,UAAU,EACf,eAAe,EACf,4BAA4B,EAE5B,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AAO5F,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC5D,KAAK,8BAA8B,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEtF,KAAK,sBAAsB,GAAG,mBAAmB,GAAG,WAAW,GAAG,mCAAmC,CAAC;AAEtG,KAAK,uBAAuB,GAAG,UAAU,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC;AACpF,KAAK,yBAAyB,GAAG,UAAU,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,KAAK,yBAAyB,GAAG,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtF,MAAM,MAAM,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G;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,2BAA2B,GAAG,eAAe,CA6E1F"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Lamports } from '@solana/kit';
|
|
2
|
+
import { type BigintLike } from '../numeric/math';
|
|
3
|
+
/**
|
|
4
|
+
* Serializes a bigint to its decimal string representation for JSON payloads.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Bigint value to serialize.
|
|
7
|
+
* @returns Decimal string representation suitable for JSON.
|
|
8
|
+
*/
|
|
9
|
+
export declare function bigintToJson(value: bigint): string;
|
|
10
|
+
/**
|
|
11
|
+
* Parses a bigint-compatible JSON value.
|
|
12
|
+
*
|
|
13
|
+
* @param value - JSON value that should contain an integer string or number.
|
|
14
|
+
* @returns Parsed bigint.
|
|
15
|
+
*/
|
|
16
|
+
export declare function bigintFromJson(value: BigintLike): bigint;
|
|
17
|
+
/**
|
|
18
|
+
* Serializes lamports to a string since JSON cannot encode bigint directly.
|
|
19
|
+
*
|
|
20
|
+
* @param value - Lamport amount to serialize.
|
|
21
|
+
* @returns Decimal string representation of the lamport amount.
|
|
22
|
+
*/
|
|
23
|
+
export declare function lamportsToJson(value: Lamports): string;
|
|
24
|
+
/**
|
|
25
|
+
* Parses a lamport value from JSON primitives.
|
|
26
|
+
*
|
|
27
|
+
* @param value - JSON value containing an integer string or number.
|
|
28
|
+
* @returns Parsed lamport amount.
|
|
29
|
+
*/
|
|
30
|
+
export declare function lamportsFromJson(value: BigintLike): Lamports;
|
|
31
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/serialization/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,iBAAiB,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAE5D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Commitment, type Signature } from '@solana/kit';
|
|
2
|
+
export type SignatureLike = Signature | string;
|
|
3
|
+
export type ConfirmationCommitment = Extract<Commitment, 'confirmed' | 'finalized' | 'processed'>;
|
|
4
|
+
export type SignatureStatusLike = Readonly<{
|
|
5
|
+
confirmationStatus?: ConfirmationCommitment | null;
|
|
6
|
+
confirmations?: number | bigint | null;
|
|
7
|
+
}> | null;
|
|
8
|
+
export declare const SIGNATURE_STATUS_TIMEOUT_MS = 20000;
|
|
9
|
+
export declare function normalizeSignature(input?: SignatureLike): Signature | undefined;
|
|
10
|
+
export declare function deriveConfirmationStatus(status: SignatureStatusLike): ConfirmationCommitment | null;
|
|
11
|
+
export declare function confirmationMeetsCommitment(confirmation: ConfirmationCommitment | null, target: ConfirmationCommitment): boolean;
|
|
12
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/signatures/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAA+B,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3F,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;AAE/C,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC;AAElG,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAC1C,kBAAkB,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACnD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACvC,CAAC,GAAG,IAAI,CAAC;AAQV,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAK/E;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,sBAAsB,GAAG,IAAI,CAkBnG;AAED,wBAAgB,2BAA2B,CAC1C,YAAY,EAAE,sBAAsB,GAAG,IAAI,EAC3C,MAAM,EAAE,sBAAsB,GAC5B,OAAO,CAKT"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Commitment, type TransactionSigner } from '@solana/kit';
|
|
2
|
+
import type { WalletSession } from '../types';
|
|
3
|
+
type WalletTransactionSignerMode = 'partial' | 'send';
|
|
4
|
+
export type WalletTransactionSigner = Readonly<{
|
|
5
|
+
mode: WalletTransactionSignerMode;
|
|
6
|
+
signer: TransactionSigner;
|
|
7
|
+
}>;
|
|
8
|
+
export type WalletTransactionSignerConfig = Readonly<{
|
|
9
|
+
commitment?: Commitment;
|
|
10
|
+
}>;
|
|
11
|
+
/** Type guard that determines whether the provided value is a {@link WalletSession}. */
|
|
12
|
+
export declare function isWalletSession(value: unknown): value is WalletSession;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a {@link TransactionSigner} wrapper around a {@link WalletSession}.
|
|
15
|
+
*
|
|
16
|
+
* The returned signer implements the most capable interface supported by the underlying wallet:
|
|
17
|
+
* - if the wallet exposes `signTransaction`, a partial signer is returned;
|
|
18
|
+
* - otherwise, if the wallet only exposes `sendTransaction`, a sending signer is returned.
|
|
19
|
+
*
|
|
20
|
+
* @param session - Connected wallet session used to sign or send transactions.
|
|
21
|
+
* @param config - Optional configuration that propagates commitment preferences when the wallet sends transactions.
|
|
22
|
+
* @returns Object containing the wrapped {@link TransactionSigner} and the strategy it supports.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createWalletTransactionSigner(session: WalletSession, config?: WalletTransactionSignerConfig): WalletTransactionSigner;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the most capable signing strategy for a {@link TransactionSigner}.
|
|
27
|
+
*
|
|
28
|
+
* @param signer - Arbitrary transaction signer.
|
|
29
|
+
* @returns Strategy descriptor indicating whether the signer can partially sign transactions.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveSignerMode(signer: TransactionSigner): WalletTransactionSignerMode;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=walletTransactionSigner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletTransactionSigner.d.ts","sourceRoot":"","sources":["../../../src/signers/walletTransactionSigner.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,UAAU,EAWf,KAAK,iBAAiB,EAGtB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,KAAK,2BAA2B,GAAG,SAAS,GAAG,MAAM,CAAC;AAEtD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC9C,IAAI,EAAE,2BAA2B,CAAC;IAClC,MAAM,EAAE,iBAAiB,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC;IACpD,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC,CAAC;AAEH,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAKtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,aAAa,EACtB,MAAM,GAAE,6BAAkC,GACxC,uBAAuB,CAuFzB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,2BAA2B,CASxF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AsyncStatus = 'error' | 'idle' | 'loading' | 'success';
|
|
2
|
+
export type AsyncState<T> = Readonly<{
|
|
3
|
+
data?: T;
|
|
4
|
+
error?: unknown;
|
|
5
|
+
status: AsyncStatus;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function createInitialAsyncState<T>(): AsyncState<T>;
|
|
8
|
+
export declare function createAsyncState<T>(status: AsyncStatus, payload?: Readonly<{
|
|
9
|
+
data?: T;
|
|
10
|
+
error?: unknown;
|
|
11
|
+
}>): AsyncState<T>;
|
|
12
|
+
//# sourceMappingURL=asyncState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncState.d.ts","sourceRoot":"","sources":["../../../src/state/asyncState.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnE,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;IACpC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACpB,CAAC,CAAC;AAEH,wBAAgB,uBAAuB,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAE1D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EACjC,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,QAAQ,CAAC;IAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAM,GACnD,UAAU,CAAC,CAAC,CAAC,CAMf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Base64EncodedWireTransaction, Transaction, TransactionMessage, TransactionMessageWithFeePayer } from '@solana/kit';
|
|
2
|
+
type Base64ConvertibleTransaction = (TransactionMessage & TransactionMessageWithFeePayer) | Transaction;
|
|
3
|
+
/**
|
|
4
|
+
* Serializes a transaction message or fully signed transaction to a base64-encoded wire format string.
|
|
5
|
+
*/
|
|
6
|
+
export declare function transactionToBase64(tx: Base64ConvertibleTransaction): Base64EncodedWireTransaction;
|
|
7
|
+
/**
|
|
8
|
+
* Serializes a transaction after ensuring all attached signers have produced signatures.
|
|
9
|
+
*/
|
|
10
|
+
export declare function transactionToBase64WithSigners(tx: Base64ConvertibleTransaction): Promise<Base64EncodedWireTransaction>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=base64.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/transactions/base64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,4BAA4B,EAC5B,WAAW,EACX,kBAAkB,EAClB,8BAA8B,EAC9B,MAAM,aAAa,CAAC;AAOrB,KAAK,4BAA4B,GAAG,CAAC,kBAAkB,GAAG,8BAA8B,CAAC,GAAG,WAAW,CAAC;AAExG;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,4BAA4B,GAAG,4BAA4B,CAKlG;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CACnD,EAAE,EAAE,4BAA4B,GAC9B,OAAO,CAAC,4BAA4B,CAAC,CAMvC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GetLatestBlockhashApi, Rpc, SimulateTransactionApi, TransactionMessage, TransactionMessageWithBlockhashLifetime, TransactionMessageWithFeePayer } from '@solana/kit';
|
|
2
|
+
export type PrepareTransactionMessage = TransactionMessage & TransactionMessageWithFeePayer;
|
|
3
|
+
export type PrepareTransactionOptions<TMessage extends PrepareTransactionMessage> = Readonly<{
|
|
4
|
+
transaction: TMessage;
|
|
5
|
+
computeUnitLimitMultiplier?: number;
|
|
6
|
+
computeUnitLimitReset?: boolean;
|
|
7
|
+
blockhashReset?: boolean;
|
|
8
|
+
logRequest?: (payload: {
|
|
9
|
+
base64WireTransaction: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
}>;
|
|
12
|
+
export type PrepareTransactionConfig<TMessage extends PrepareTransactionMessage> = PrepareTransactionOptions<TMessage> & Readonly<{
|
|
13
|
+
rpc: Rpc<GetLatestBlockhashApi & SimulateTransactionApi>;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function prepareTransaction<TMessage extends PrepareTransactionMessage>(config: PrepareTransactionConfig<TMessage>): Promise<TMessage & TransactionMessageWithBlockhashLifetime>;
|
|
16
|
+
//# sourceMappingURL=prepareTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../../../src/transactions/prepareTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,qBAAqB,EACrB,GAAG,EACH,sBAAsB,EACtB,kBAAkB,EAClB,uCAAuC,EACvC,8BAA8B,EAC9B,MAAM,aAAa,CAAC;AAWrB,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GAAG,8BAA8B,CAAC;AAE5F,MAAM,MAAM,yBAAyB,CAAC,QAAQ,SAAS,yBAAyB,IAAI,QAAQ,CAAC;IAC5F,WAAW,EAAE,QAAQ,CAAC;IACtB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,qBAAqB,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClE,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,CAAC,QAAQ,SAAS,yBAAyB,IAAI,yBAAyB,CAAC,QAAQ,CAAC,GACrH,QAAQ,CAAC;IACR,GAAG,EAAE,GAAG,CAAC,qBAAqB,GAAG,sBAAsB,CAAC,CAAC;CACzD,CAAC,CAAC;AAyDJ,wBAAsB,kBAAkB,CAAC,QAAQ,SAAS,yBAAyB,EAClF,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GACxC,OAAO,CAAC,QAAQ,GAAG,uCAAuC,CAAC,CAkD7D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Address, BaseTransactionMessage } from '@solana/kit';
|
|
2
|
+
/**
|
|
3
|
+
* Appends reference address metadata to the first non-memo instruction in a transaction.
|
|
4
|
+
*/
|
|
5
|
+
export declare function insertReferenceKey<T extends BaseTransactionMessage>(reference: Address, transaction: T): T;
|
|
6
|
+
/**
|
|
7
|
+
* Appends multiple reference addresses to the first non-memo instruction in a transaction.
|
|
8
|
+
*/
|
|
9
|
+
export declare function insertReferenceKeys<T extends BaseTransactionMessage>(references: Address[], transaction: T): T;
|
|
10
|
+
//# sourceMappingURL=referenceKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceKeys.d.ts","sourceRoot":"","sources":["../../../src/transactions/referenceKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAgBnE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,sBAAsB,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAE1G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,sBAAsB,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAa9G"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { TransactionHelper, TransactionInstructionInput, TransactionPrepareAndSendRequest, TransactionPrepared, TransactionPrepareRequest, TransactionSendOptions, TransactionSignOptions } from '../features/transactions';
|
|
2
|
+
import { type AsyncState } from '../state/asyncState';
|
|
3
|
+
type Listener = () => void;
|
|
4
|
+
export type TransactionInstructionList = readonly TransactionInstructionInput[];
|
|
5
|
+
type TransactionSignature = Awaited<ReturnType<TransactionHelper['send']>>;
|
|
6
|
+
export type LatestBlockhashCache = Readonly<{
|
|
7
|
+
updatedAt: number;
|
|
8
|
+
value: NonNullable<TransactionPrepareRequest['lifetime']>;
|
|
9
|
+
}>;
|
|
10
|
+
export type TransactionPoolConfig = Readonly<{
|
|
11
|
+
blockhashMaxAgeMs?: number;
|
|
12
|
+
helper: TransactionHelper;
|
|
13
|
+
initialInstructions?: TransactionInstructionList;
|
|
14
|
+
}>;
|
|
15
|
+
export type TransactionPoolPrepareOptions = Readonly<Partial<Omit<TransactionPrepareRequest, 'instructions'>> & {
|
|
16
|
+
instructions?: TransactionInstructionList;
|
|
17
|
+
}>;
|
|
18
|
+
export type TransactionPoolSignOptions = Readonly<TransactionSignOptions & {
|
|
19
|
+
prepared?: TransactionPrepared;
|
|
20
|
+
}>;
|
|
21
|
+
export type TransactionPoolSendOptions = Readonly<TransactionSendOptions & {
|
|
22
|
+
prepared?: TransactionPrepared;
|
|
23
|
+
}>;
|
|
24
|
+
export type TransactionPoolPrepareAndSendOptions = Readonly<Omit<TransactionPrepareAndSendRequest, 'instructions'> & {
|
|
25
|
+
instructions?: TransactionInstructionList;
|
|
26
|
+
}>;
|
|
27
|
+
export type TransactionPoolController = Readonly<{
|
|
28
|
+
addInstruction(instruction: TransactionInstructionInput): void;
|
|
29
|
+
addInstructions(instructionSet: TransactionInstructionList): void;
|
|
30
|
+
clearInstructions(): void;
|
|
31
|
+
getInstructions(): TransactionInstructionList;
|
|
32
|
+
getPrepareState(): AsyncState<TransactionPrepared>;
|
|
33
|
+
getPrepared(): TransactionPrepared | null;
|
|
34
|
+
getSendState(): AsyncState<TransactionSignature>;
|
|
35
|
+
getLatestBlockhashCache(): LatestBlockhashCache | undefined;
|
|
36
|
+
prepare(options?: TransactionPoolPrepareOptions): Promise<TransactionPrepared>;
|
|
37
|
+
prepareAndSend(request?: TransactionPoolPrepareAndSendOptions, sendOptions?: TransactionSendOptions): Promise<TransactionSignature>;
|
|
38
|
+
removeInstruction(index: number): void;
|
|
39
|
+
replaceInstructions(instructionSet: TransactionInstructionList): void;
|
|
40
|
+
reset(): void;
|
|
41
|
+
send(options?: TransactionPoolSendOptions): Promise<TransactionSignature>;
|
|
42
|
+
setLatestBlockhashCache(cache: LatestBlockhashCache | undefined): void;
|
|
43
|
+
sign(options?: TransactionPoolSignOptions): ReturnType<TransactionHelper['sign']>;
|
|
44
|
+
subscribeInstructions(listener: Listener): () => void;
|
|
45
|
+
subscribePrepareState(listener: Listener): () => void;
|
|
46
|
+
subscribePrepared(listener: Listener): () => void;
|
|
47
|
+
subscribeSendState(listener: Listener): () => void;
|
|
48
|
+
toWire(options?: TransactionPoolSignOptions): ReturnType<TransactionHelper['toWire']>;
|
|
49
|
+
get helper(): TransactionHelper;
|
|
50
|
+
}>;
|
|
51
|
+
export declare function createTransactionPoolController(config: TransactionPoolConfig): TransactionPoolController;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=transactionPoolController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionPoolController.d.ts","sourceRoot":"","sources":["../../../src/transactions/transactionPoolController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,2BAA2B,EAC3B,gCAAgC,EAChC,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,UAAU,EAA6C,MAAM,qBAAqB,CAAC;AAEjG,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,MAAM,0BAA0B,GAAG,SAAS,2BAA2B,EAAE,CAAC;AAEhF,KAAK,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,E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5D,OAAO,CAAC,OAAO,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/E,cAAc,CACb,OAAO,CAAC,EAAE,oCAAoC,EAC9C,WAAW,CAAC,EAAE,sBAAsB,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,mBAAmB,CAAC,cAAc,EAAE,0BAA0B,GAAG,IAAI,CAAC;IACtE,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC1E,uBAAuB,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACtD,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACtD,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IAClD,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACnD,MAAM,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtF,IAAI,MAAM,IAAI,iBAAiB,CAAC;CAChC,CAAC,CAAC;AAEH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,qBAAqB,GAAG,yBAAyB,CAuNxG"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { Address, ClusterUrl, Commitment, Lamports, SendableTransaction, Signature, Transaction, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
|
|
2
|
+
import type { TransactionWithLastValidBlockHeight } from '@solana/transaction-confirmation';
|
|
3
|
+
import type { StoreApi } from 'zustand/vanilla';
|
|
4
|
+
import type { SolTransferHelper } from './features/sol';
|
|
5
|
+
import type { SplTokenHelper, SplTokenHelperConfig } from './features/spl';
|
|
6
|
+
import type { TransactionHelper } from './features/transactions';
|
|
7
|
+
import type { SolanaRpcClient } from './rpc/createSolanaRpcClient';
|
|
8
|
+
import type { PrepareTransactionMessage, PrepareTransactionOptions } from './transactions/prepareTransaction';
|
|
9
|
+
type SolanaRpcInstance = ReturnType<typeof import('@solana/kit')['createSolanaRpc']>;
|
|
10
|
+
type SolanaSubscriptionsInstance = ReturnType<typeof import('@solana/kit')['createSolanaRpcSubscriptions']>;
|
|
11
|
+
export type LogLevel = 'debug' | 'error' | 'info' | 'warn';
|
|
12
|
+
export type ClientLogger = (event: {
|
|
13
|
+
data?: Record<string, unknown>;
|
|
14
|
+
level: LogLevel;
|
|
15
|
+
message: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
export type WalletConnectorMetadata = Readonly<{
|
|
18
|
+
canAutoConnect?: boolean;
|
|
19
|
+
icon?: string;
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type WalletAccount = Readonly<{
|
|
24
|
+
address: Address;
|
|
25
|
+
label?: string;
|
|
26
|
+
publicKey: Uint8Array;
|
|
27
|
+
}>;
|
|
28
|
+
export type WalletSession = Readonly<{
|
|
29
|
+
account: WalletAccount;
|
|
30
|
+
connector: WalletConnectorMetadata;
|
|
31
|
+
disconnect(): Promise<void>;
|
|
32
|
+
sendTransaction?(transaction: SendableTransaction & Transaction, config?: Readonly<{
|
|
33
|
+
commitment?: Commitment;
|
|
34
|
+
}>): Promise<Signature>;
|
|
35
|
+
signMessage?(message: Uint8Array): Promise<Uint8Array>;
|
|
36
|
+
signTransaction?(transaction: SendableTransaction & Transaction): Promise<SendableTransaction & Transaction>;
|
|
37
|
+
}>;
|
|
38
|
+
export type WalletConnector = WalletConnectorMetadata & {
|
|
39
|
+
connect(opts?: Readonly<{
|
|
40
|
+
autoConnect?: boolean;
|
|
41
|
+
}>): Promise<WalletSession>;
|
|
42
|
+
disconnect(): Promise<void>;
|
|
43
|
+
isSupported(): boolean;
|
|
44
|
+
};
|
|
45
|
+
type WalletStatusConnected = Readonly<{
|
|
46
|
+
connectorId: string;
|
|
47
|
+
session: WalletSession;
|
|
48
|
+
status: 'connected';
|
|
49
|
+
}>;
|
|
50
|
+
type WalletStatusConnecting = Readonly<{
|
|
51
|
+
connectorId: string;
|
|
52
|
+
status: 'connecting';
|
|
53
|
+
}>;
|
|
54
|
+
type WalletStatusDisconnected = Readonly<{
|
|
55
|
+
status: 'disconnected';
|
|
56
|
+
}>;
|
|
57
|
+
type WalletStatusError = Readonly<{
|
|
58
|
+
connectorId?: string;
|
|
59
|
+
error: unknown;
|
|
60
|
+
status: 'error';
|
|
61
|
+
}>;
|
|
62
|
+
export type WalletStatus = WalletStatusConnected | WalletStatusConnecting | WalletStatusDisconnected | WalletStatusError;
|
|
63
|
+
type ClusterStatusConnecting = Readonly<{
|
|
64
|
+
status: 'connecting';
|
|
65
|
+
}>;
|
|
66
|
+
type ClusterStatusError = Readonly<{
|
|
67
|
+
error: unknown;
|
|
68
|
+
status: 'error';
|
|
69
|
+
}>;
|
|
70
|
+
type ClusterStatusIdle = Readonly<{
|
|
71
|
+
status: 'idle';
|
|
72
|
+
}>;
|
|
73
|
+
type ClusterStatusReady = Readonly<{
|
|
74
|
+
latencyMs?: number;
|
|
75
|
+
status: 'ready';
|
|
76
|
+
}>;
|
|
77
|
+
export type ClusterStatus = ClusterStatusConnecting | ClusterStatusError | ClusterStatusIdle | ClusterStatusReady;
|
|
78
|
+
export type ClusterState = Readonly<{
|
|
79
|
+
commitment: Commitment;
|
|
80
|
+
endpoint: ClusterUrl;
|
|
81
|
+
status: ClusterStatus;
|
|
82
|
+
websocketEndpoint?: ClusterUrl;
|
|
83
|
+
}>;
|
|
84
|
+
export type AccountCacheEntry = Readonly<{
|
|
85
|
+
address: Address;
|
|
86
|
+
data?: unknown;
|
|
87
|
+
error?: unknown;
|
|
88
|
+
fetching: boolean;
|
|
89
|
+
lamports: Lamports | null;
|
|
90
|
+
lastFetchedAt?: number;
|
|
91
|
+
slot: bigint | null;
|
|
92
|
+
}>;
|
|
93
|
+
export type AccountCache = Record<string, AccountCacheEntry>;
|
|
94
|
+
export type TransactionRecord = Readonly<{
|
|
95
|
+
error?: unknown;
|
|
96
|
+
lastUpdatedAt: number;
|
|
97
|
+
signature?: Signature;
|
|
98
|
+
status: 'confirmed' | 'failed' | 'idle' | 'sending' | 'waiting';
|
|
99
|
+
}>;
|
|
100
|
+
export type TransactionState = Record<string, TransactionRecord>;
|
|
101
|
+
type SubscriptionStatusActivating = Readonly<{
|
|
102
|
+
status: 'activating';
|
|
103
|
+
}>;
|
|
104
|
+
type SubscriptionStatusActive = Readonly<{
|
|
105
|
+
status: 'active';
|
|
106
|
+
}>;
|
|
107
|
+
type SubscriptionStatusError = Readonly<{
|
|
108
|
+
error: unknown;
|
|
109
|
+
status: 'error';
|
|
110
|
+
}>;
|
|
111
|
+
type SubscriptionStatusInactive = Readonly<{
|
|
112
|
+
status: 'inactive';
|
|
113
|
+
}>;
|
|
114
|
+
export type SubscriptionStatus = SubscriptionStatusActivating | SubscriptionStatusActive | SubscriptionStatusError | SubscriptionStatusInactive;
|
|
115
|
+
export type SubscriptionState = Readonly<{
|
|
116
|
+
account: Record<string, SubscriptionStatus>;
|
|
117
|
+
signature: Record<string, SubscriptionStatus>;
|
|
118
|
+
}>;
|
|
119
|
+
export type ClientState = Readonly<{
|
|
120
|
+
accounts: AccountCache;
|
|
121
|
+
cluster: ClusterState;
|
|
122
|
+
lastUpdatedAt: number;
|
|
123
|
+
subscriptions: SubscriptionState;
|
|
124
|
+
transactions: TransactionState;
|
|
125
|
+
wallet: WalletStatus;
|
|
126
|
+
}>;
|
|
127
|
+
export type ClientStore = StoreApi<ClientState>;
|
|
128
|
+
export type CreateStoreFn = (state: ClientState) => ClientStore;
|
|
129
|
+
export type SolanaClientConfig = Readonly<{
|
|
130
|
+
commitment?: Commitment;
|
|
131
|
+
createStore?: CreateStoreFn;
|
|
132
|
+
endpoint: ClusterUrl;
|
|
133
|
+
logger?: ClientLogger;
|
|
134
|
+
rpcClient?: SolanaRpcClient;
|
|
135
|
+
walletConnectors?: readonly WalletConnector[];
|
|
136
|
+
websocketEndpoint?: ClusterUrl;
|
|
137
|
+
}>;
|
|
138
|
+
export type SolanaClientRuntime = {
|
|
139
|
+
rpc: SolanaRpcInstance;
|
|
140
|
+
rpcSubscriptions: SolanaSubscriptionsInstance;
|
|
141
|
+
};
|
|
142
|
+
export type BalanceWatcherConfig = Readonly<{
|
|
143
|
+
address: Address;
|
|
144
|
+
commitment?: Commitment;
|
|
145
|
+
}>;
|
|
146
|
+
export type AccountWatcherConfig = Readonly<{
|
|
147
|
+
address: Address;
|
|
148
|
+
commitment?: Commitment;
|
|
149
|
+
}>;
|
|
150
|
+
export type SignatureWatcherConfig = Readonly<{
|
|
151
|
+
commitment?: Commitment;
|
|
152
|
+
enableReceivedNotification?: boolean;
|
|
153
|
+
signature: Signature;
|
|
154
|
+
}>;
|
|
155
|
+
export type WatchSubscription = Readonly<{
|
|
156
|
+
abort(): void;
|
|
157
|
+
}>;
|
|
158
|
+
export type ClientActions = Readonly<{
|
|
159
|
+
connectWallet(connectorId: string, options?: Readonly<{
|
|
160
|
+
autoConnect?: boolean;
|
|
161
|
+
}>): Promise<void>;
|
|
162
|
+
disconnectWallet(): Promise<void>;
|
|
163
|
+
fetchAccount(address: Address, commitment?: Commitment): Promise<AccountCacheEntry>;
|
|
164
|
+
fetchBalance(address: Address, commitment?: Commitment): Promise<Lamports>;
|
|
165
|
+
requestAirdrop(address: Address, lamports: Lamports): Promise<Signature>;
|
|
166
|
+
sendTransaction(transaction: SendableTransaction & Transaction & TransactionWithLastValidBlockHeight, commitment?: Commitment): Promise<Signature>;
|
|
167
|
+
setCluster(endpoint: ClusterUrl, config?: Readonly<{
|
|
168
|
+
commitment?: Commitment;
|
|
169
|
+
websocketEndpoint?: ClusterUrl;
|
|
170
|
+
}>): Promise<void>;
|
|
171
|
+
}>;
|
|
172
|
+
export type ClientWatchers = Readonly<{
|
|
173
|
+
watchAccount(config: AccountWatcherConfig, listener: (account: AccountCacheEntry) => void): WatchSubscription;
|
|
174
|
+
watchBalance(config: BalanceWatcherConfig, listener: (lamports: Lamports) => void): WatchSubscription;
|
|
175
|
+
watchSignature(config: SignatureWatcherConfig, listener: (notification: unknown) => void): WatchSubscription;
|
|
176
|
+
}>;
|
|
177
|
+
export type ClientHelpers = Readonly<{
|
|
178
|
+
solTransfer: SolTransferHelper;
|
|
179
|
+
splToken(config: SplTokenHelperConfig): SplTokenHelper;
|
|
180
|
+
transaction: TransactionHelper;
|
|
181
|
+
prepareTransaction<TMessage extends PrepareTransactionMessage>(config: PrepareTransactionOptions<TMessage>): Promise<TMessage & TransactionMessageWithBlockhashLifetime>;
|
|
182
|
+
}>;
|
|
183
|
+
export type WalletRegistry = Readonly<{
|
|
184
|
+
all: readonly WalletConnector[];
|
|
185
|
+
get(id: string): WalletConnector | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
export type SolanaClient = Readonly<{
|
|
188
|
+
actions: ClientActions;
|
|
189
|
+
config: SolanaClientConfig;
|
|
190
|
+
connectors: WalletRegistry;
|
|
191
|
+
destroy(): void;
|
|
192
|
+
runtime: Readonly<SolanaClientRuntime>;
|
|
193
|
+
store: ClientStore;
|
|
194
|
+
watchers: ClientWatchers;
|
|
195
|
+
helpers: ClientHelpers;
|
|
196
|
+
solTransfer: SolTransferHelper;
|
|
197
|
+
SolTransfer: SolTransferHelper;
|
|
198
|
+
splToken(config: SplTokenHelperConfig): SplTokenHelper;
|
|
199
|
+
SplToken(config: SplTokenHelperConfig): SplTokenHelper;
|
|
200
|
+
SplHelper(config: SplTokenHelperConfig): SplTokenHelper;
|
|
201
|
+
transaction: TransactionHelper;
|
|
202
|
+
prepareTransaction: ClientHelpers['prepareTransaction'];
|
|
203
|
+
}>;
|
|
204
|
+
export {};
|
|
205
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,uCAAuC,EACvC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9G,KAAK,iBAAiB,GAAG,UAAU,CAAC,cAAc,aAAa,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACrF,KAAK,2BAA2B,GAAG,UAAU,CAAC,cAAc,aAAa,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAE5G,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,C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C/B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAAC;IACvD,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAAC;IACxD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,kBAAkB,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACxD,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Address } from '@solana/kit';
|
|
2
|
+
export type AddressLike = Address | string;
|
|
3
|
+
export declare function toAddress(addressLike: AddressLike): Address;
|
|
4
|
+
export declare function toAddressString(addressLike: AddressLike): string;
|
|
5
|
+
//# sourceMappingURL=addressLike.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addressLike.d.ts","sourceRoot":"","sources":["../../../src/utils/addressLike.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAA2B,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE3D;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stableStringify.d.ts","sourceRoot":"","sources":["../../../src/utils/stableStringify.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWtD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively freezes a value to avoid accidental mutation of initial state snapshots.
|
|
3
|
+
*
|
|
4
|
+
* @param value - Value to freeze in place.
|
|
5
|
+
* @returns The same value with all nested objects frozen.
|
|
6
|
+
*/
|
|
7
|
+
export declare function deepFreeze<T>(value: T): T;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the current timestamp in milliseconds.
|
|
10
|
+
*
|
|
11
|
+
* @returns Millisecond timestamp provided by {@link Date.now}.
|
|
12
|
+
*/
|
|
13
|
+
export declare function now(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Converts optional errors to a serializable string for logging.
|
|
16
|
+
*
|
|
17
|
+
* @param error - Arbitrary error value to format.
|
|
18
|
+
* @returns String representation of the provided error.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toErrorMessage(error: unknown): string;
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAUzC;AAED;;;;GAIG;AACH,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYrD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WalletConnector, WalletRegistry } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an in-memory wallet registry from the provided connectors.
|
|
4
|
+
*
|
|
5
|
+
* @param connectors - Wallet connector implementations to register.
|
|
6
|
+
* @returns A registry exposing iteration and lookup helpers.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createWalletRegistry(connectors: readonly WalletConnector[]): WalletRegistry;
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/wallet/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,GAAG,cAAc,CAmB3F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IdentifierString, Wallet } from '@wallet-standard/base';
|
|
2
|
+
import type { WalletConnector } from '../types';
|
|
3
|
+
export type WalletStandardConnectorMetadata = Readonly<{
|
|
4
|
+
canAutoConnect?: boolean;
|
|
5
|
+
defaultChain?: IdentifierString;
|
|
6
|
+
icon?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Builds a connector function that adheres to the wallet standard API.
|
|
12
|
+
*
|
|
13
|
+
* @param wallet - Wallet instance compatible with Wallet Standard.
|
|
14
|
+
* @param options - Optional overrides for connector metadata.
|
|
15
|
+
* @returns A {@link WalletConnector} wrapping the provided wallet.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createWalletStandardConnector(wallet: Wallet, options?: WalletStandardConnectorMetadata): WalletConnector;
|
|
18
|
+
export type WalletStandardDiscoveryOptions = Readonly<{
|
|
19
|
+
overrides?: (wallet: Wallet) => WalletStandardConnectorMetadata | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns connectors for all wallets currently registered with Wallet Standard.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Optional discovery configuration.
|
|
25
|
+
* @returns A deduplicated list of wallet connectors.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getWalletStandardConnectors(options?: WalletStandardDiscoveryOptions): readonly WalletConnector[];
|
|
28
|
+
/**
|
|
29
|
+
* Watches Wallet Standard registrations and emits new connector lists whenever the set changes.
|
|
30
|
+
*
|
|
31
|
+
* @param onChange - Callback invoked each time the connector set changes.
|
|
32
|
+
* @param options - Optional discovery configuration overrides.
|
|
33
|
+
* @returns Cleanup function that removes all listeners.
|
|
34
|
+
*/
|
|
35
|
+
export declare function watchWalletStandardConnectors(onChange: (connectors: readonly WalletConnector[]) => void, options?: WalletStandardDiscoveryOptions): () => void;
|
|
36
|
+
//# sourceMappingURL=standard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../src/wallet/standard.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAA0C,MAAM,uBAAuB,CAAC;AAI9G,OAAO,KAAK,EAAiB,eAAe,EAA0C,MAAM,UAAU,CAAC;AAEvG,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC;IACtD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAqFH;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,+BAAoC,GAC3C,eAAe,CA0JjB;AAgBD,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,+BAA+B,GAAG,SAAS,CAAC;CAC5E,CAAC,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,8BAAmC,GAAG,SAAS,eAAe,EAAE,CAapH;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,EAC1D,OAAO,GAAE,8BAAmC,GAC1C,MAAM,IAAI,CAwBZ"}
|