@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.
Files changed (74) hide show
  1. package/README.md +3 -3
  2. package/dist/index.browser.cjs +2796 -0
  3. package/dist/index.browser.cjs.map +1 -0
  4. package/dist/index.browser.mjs +2745 -0
  5. package/dist/index.browser.mjs.map +1 -0
  6. package/dist/index.native.mjs +2745 -0
  7. package/dist/index.native.mjs.map +1 -0
  8. package/dist/index.node.cjs +2796 -0
  9. package/dist/index.node.cjs.map +1 -0
  10. package/dist/index.node.mjs +2745 -0
  11. package/dist/index.node.mjs.map +1 -0
  12. package/dist/types/client/actions.d.ts +18 -0
  13. package/dist/types/client/actions.d.ts.map +1 -0
  14. package/dist/types/client/createClient.d.ts +9 -0
  15. package/dist/types/client/createClient.d.ts.map +1 -0
  16. package/dist/types/client/createClientHelpers.d.ts +3 -0
  17. package/dist/types/client/createClientHelpers.d.ts.map +1 -0
  18. package/dist/types/client/createClientStore.d.ts +29 -0
  19. package/dist/types/client/createClientStore.d.ts.map +1 -0
  20. package/dist/types/client/watchers.d.ts +16 -0
  21. package/dist/types/client/watchers.d.ts.map +1 -0
  22. package/dist/types/controllers/solTransferController.d.ts +21 -0
  23. package/dist/types/controllers/solTransferController.d.ts.map +1 -0
  24. package/dist/types/controllers/splTransferController.d.ts +24 -0
  25. package/dist/types/controllers/splTransferController.d.ts.map +1 -0
  26. package/dist/types/features/sol.d.ts +41 -0
  27. package/dist/types/features/sol.d.ts.map +1 -0
  28. package/dist/types/features/spl.d.ts +59 -0
  29. package/dist/types/features/spl.d.ts.map +1 -0
  30. package/dist/types/features/transactions.d.ts +79 -0
  31. package/dist/types/features/transactions.d.ts.map +1 -0
  32. package/dist/types/index.d.ts +25 -0
  33. package/dist/types/index.d.ts.map +1 -0
  34. package/dist/types/logging/logger.d.ts +24 -0
  35. package/dist/types/logging/logger.d.ts.map +1 -0
  36. package/dist/types/numeric/amounts.d.ts +30 -0
  37. package/dist/types/numeric/amounts.d.ts.map +1 -0
  38. package/dist/types/numeric/lamports.d.ts +46 -0
  39. package/dist/types/numeric/lamports.d.ts.map +1 -0
  40. package/dist/types/numeric/math.d.ts +74 -0
  41. package/dist/types/numeric/math.d.ts.map +1 -0
  42. package/dist/types/numeric/rational.d.ts +27 -0
  43. package/dist/types/numeric/rational.d.ts.map +1 -0
  44. package/dist/types/rpc/createSolanaRpcClient.d.ts +42 -0
  45. package/dist/types/rpc/createSolanaRpcClient.d.ts.map +1 -0
  46. package/dist/types/serialization/json.d.ts +31 -0
  47. package/dist/types/serialization/json.d.ts.map +1 -0
  48. package/dist/types/signatures/status.d.ts +12 -0
  49. package/dist/types/signatures/status.d.ts.map +1 -0
  50. package/dist/types/signers/walletTransactionSigner.d.ts +33 -0
  51. package/dist/types/signers/walletTransactionSigner.d.ts.map +1 -0
  52. package/dist/types/state/asyncState.d.ts +12 -0
  53. package/dist/types/state/asyncState.d.ts.map +1 -0
  54. package/dist/types/transactions/base64.d.ts +12 -0
  55. package/dist/types/transactions/base64.d.ts.map +1 -0
  56. package/dist/types/transactions/prepareTransaction.d.ts +16 -0
  57. package/dist/types/transactions/prepareTransaction.d.ts.map +1 -0
  58. package/dist/types/transactions/referenceKeys.d.ts +10 -0
  59. package/dist/types/transactions/referenceKeys.d.ts.map +1 -0
  60. package/dist/types/transactions/transactionPoolController.d.ts +53 -0
  61. package/dist/types/transactions/transactionPoolController.d.ts.map +1 -0
  62. package/dist/types/types.d.ts +205 -0
  63. package/dist/types/types.d.ts.map +1 -0
  64. package/dist/types/utils/addressLike.d.ts +5 -0
  65. package/dist/types/utils/addressLike.d.ts.map +1 -0
  66. package/dist/types/utils/stableStringify.d.ts +2 -0
  67. package/dist/types/utils/stableStringify.d.ts.map +1 -0
  68. package/dist/types/utils.d.ts +21 -0
  69. package/dist/types/utils.d.ts.map +1 -0
  70. package/dist/types/wallet/registry.d.ts +9 -0
  71. package/dist/types/wallet/registry.d.ts.map +1 -0
  72. package/dist/types/wallet/standard.d.ts +36 -0
  73. package/dist/types/wallet/standard.d.ts.map +1 -0
  74. package/package.json +83 -79
@@ -0,0 +1,9 @@
1
+ import type { SolanaClient, SolanaClientConfig } from '../types';
2
+ /**
3
+ * Creates a Solana client instance using the provided configuration.
4
+ *
5
+ * @param config - High-level configuration supplied by integrators.
6
+ * @returns Fully initialized {@link SolanaClient} instance.
7
+ */
8
+ export declare function createClient(config: SolanaClientConfig): SolanaClient;
9
+ //# sourceMappingURL=createClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/createClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,YAAY,EAAE,kBAAkB,EAAuB,MAAM,UAAU,CAAC;AAQnG;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAyErE"}
@@ -0,0 +1,3 @@
1
+ import type { ClientHelpers, ClientStore, SolanaClientRuntime } from '../types';
2
+ export declare function createClientHelpers(runtime: SolanaClientRuntime, store: ClientStore): ClientHelpers;
3
+ //# sourceMappingURL=createClientHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createClientHelpers.d.ts","sourceRoot":"","sources":["../../../src/client/createClientHelpers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsEhF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,WAAW,GAAG,aAAa,CAqDnG"}
@@ -0,0 +1,29 @@
1
+ import type { Commitment } from '@solana/kit';
2
+ import type { ClientState, ClientStore, ClusterState } from '../types';
3
+ export type ClientStoreConfig = Readonly<{
4
+ commitment: Commitment;
5
+ endpoint: ClusterState['endpoint'];
6
+ websocketEndpoint?: ClusterState['websocketEndpoint'];
7
+ }>;
8
+ /**
9
+ * Creates the initial {@link ClientState} using the supplied cluster configuration.
10
+ *
11
+ * @param config - Initial cluster configuration including endpoints and commitment.
12
+ * @returns Deep-frozen client state snapshot.
13
+ */
14
+ export declare function createInitialClientState(config: ClientStoreConfig): ClientState;
15
+ /**
16
+ * Creates a Zustand store using the supplied initial state snapshot.
17
+ *
18
+ * @param initialState - State snapshot produced by {@link createInitialClientState}.
19
+ * @returns Zustand store instance containing the provided state.
20
+ */
21
+ export declare function createClientStore(initialState: ClientState): ClientStore;
22
+ /**
23
+ * Convenience helper that creates both the initial state and the store in one step.
24
+ *
25
+ * @param config - Initial cluster configuration including endpoints and commitment.
26
+ * @returns Zustand store instance preloaded with the initial state.
27
+ */
28
+ export declare function createDefaultClientStore(config: ClientStoreConfig): ClientStore;
29
+ //# sourceMappingURL=createClientStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createClientStore.d.ts","sourceRoot":"","sources":["../../../src/client/createClientStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAiB,MAAM,UAAU,CAAC;AAGtF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACxC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC;CACtD,CAAC,CAAC;AAWH;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CAmB/E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CAE/E"}
@@ -0,0 +1,16 @@
1
+ import { createLogger } from '../logging/logger';
2
+ import type { ClientStore, ClientWatchers, SolanaClientRuntime } from '../types';
3
+ type WatcherDeps = Readonly<{
4
+ logger?: ReturnType<typeof createLogger>;
5
+ runtime: SolanaClientRuntime;
6
+ store: ClientStore;
7
+ }>;
8
+ /**
9
+ * Creates watcher helpers that wrap RPC subscriptions and keep store metadata in sync.
10
+ *
11
+ * @param deps - Dependencies required to construct watcher helpers.
12
+ * @returns Collection of watcher functions.
13
+ */
14
+ export declare function createWatchers({ logger: inputLogger, runtime, store }: WatcherDeps): ClientWatchers;
15
+ export {};
16
+ //# sourceMappingURL=watchers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchers.d.ts","sourceRoot":"","sources":["../../../src/client/watchers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAIX,WAAW,EACX,cAAc,EAEd,mBAAmB,EAEnB,MAAM,UAAU,CAAC;AAKlB,KAAK,WAAW,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACzC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;CACnB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,GAAG,cAAc,CAkOnG"}
@@ -0,0 +1,21 @@
1
+ import type { SolTransferHelper, SolTransferPrepareConfig, SolTransferSendOptions } from '../features/sol';
2
+ import { type AsyncState } from '../state/asyncState';
3
+ type SolTransferSignature = Awaited<ReturnType<SolTransferHelper['sendTransfer']>>;
4
+ type Listener = () => void;
5
+ export type SolTransferControllerConfig = Readonly<{
6
+ authorityProvider?: () => SolTransferPrepareConfig['authority'] | undefined;
7
+ helper: SolTransferHelper;
8
+ }>;
9
+ export type SolTransferInput = Omit<SolTransferPrepareConfig, 'authority'> & {
10
+ authority?: SolTransferPrepareConfig['authority'];
11
+ };
12
+ export type SolTransferController = Readonly<{
13
+ getHelper(): SolTransferHelper;
14
+ getState(): AsyncState<SolTransferSignature>;
15
+ reset(): void;
16
+ send(config: SolTransferInput, options?: SolTransferSendOptions): Promise<SolTransferSignature>;
17
+ subscribe(listener: Listener): () => void;
18
+ }>;
19
+ export declare function createSolTransferController(config: SolTransferControllerConfig): SolTransferController;
20
+ export {};
21
+ //# sourceMappingURL=solTransferController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solTransferController.d.ts","sourceRoot":"","sources":["../../../src/controllers/solTransferController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,KAAK,UAAU,EAA6C,MAAM,qBAAqB,CAAC;AAEjG,KAAK,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEnF,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAClD,iBAAiB,CAAC,EAAE,MAAM,wBAAwB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAC5E,MAAM,EAAE,iBAAiB,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,GAAG;IAC5E,SAAS,CAAC,EAAE,wBAAwB,CAAC,WAAW,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC5C,SAAS,IAAI,iBAAiB,CAAC;IAC/B,QAAQ,IAAI,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAC7C,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAChG,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;CAC1C,CAAC,CAAC;AAgBH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,GAAG,qBAAqB,CAgDtG"}
@@ -0,0 +1,24 @@
1
+ import type { SolTransferSendOptions } from '../features/sol';
2
+ import type { SplTokenHelper, SplTransferPrepareConfig } from '../features/spl';
3
+ import { type AsyncState } from '../state/asyncState';
4
+ type SplTransferSignature = Awaited<ReturnType<SplTokenHelper['sendTransfer']>>;
5
+ type Listener = () => void;
6
+ export type SplTransferInput = Omit<SplTransferPrepareConfig, 'authority' | 'sourceOwner'> & {
7
+ authority?: SplTransferPrepareConfig['authority'];
8
+ sourceOwner?: SplTransferPrepareConfig['sourceOwner'];
9
+ };
10
+ export type SplTransferControllerConfig = Readonly<{
11
+ authorityProvider?: () => SplTransferPrepareConfig['authority'] | undefined;
12
+ helper: SplTokenHelper;
13
+ sourceOwnerProvider?: () => SplTransferPrepareConfig['sourceOwner'] | undefined;
14
+ }>;
15
+ export type SplTransferController = Readonly<{
16
+ getHelper(): SplTokenHelper;
17
+ getState(): AsyncState<SplTransferSignature>;
18
+ reset(): void;
19
+ send(config: SplTransferInput, options?: SolTransferSendOptions): Promise<SplTransferSignature>;
20
+ subscribe(listener: Listener): () => void;
21
+ }>;
22
+ export declare function createSplTransferController(config: SplTransferControllerConfig): SplTransferController;
23
+ export {};
24
+ //# sourceMappingURL=splTransferController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splTransferController.d.ts","sourceRoot":"","sources":["../../../src/controllers/splTransferController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAA6C,MAAM,qBAAqB,CAAC;AAEjG,KAAK,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEhF,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,EAAE,WAAW,GAAG,aAAa,CAAC,GAAG;IAC5F,SAAS,CAAC,EAAE,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAClD,iBAAiB,CAAC,EAAE,MAAM,wBAAwB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAC5E,MAAM,EAAE,cAAc,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,wBAAwB,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;CAChF,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC5C,SAAS,IAAI,cAAc,CAAC;IAC5B,QAAQ,IAAI,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAC7C,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAChG,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;CAC1C,CAAC,CAAC;AAsBH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,GAAG,qBAAqB,CAqDtG"}
@@ -0,0 +1,41 @@
1
+ import { type Address, type Blockhash, type Commitment, type Slot, signature, signTransactionMessageWithSigners, type TransactionPlan, type TransactionSigner, type TransactionVersion } from '@solana/kit';
2
+ import type { SolanaClientRuntime, WalletSession } from '../types';
3
+ type BlockhashLifetime = Readonly<{
4
+ blockhash: Blockhash;
5
+ lastValidBlockHeight: bigint;
6
+ }>;
7
+ type SolTransferAmount = bigint | number | string;
8
+ type SolTransferAuthority = TransactionSigner<string> | WalletSession;
9
+ type SignableSolTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
10
+ export type SolTransferPrepareConfig = Readonly<{
11
+ amount: SolTransferAmount;
12
+ authority: SolTransferAuthority;
13
+ commitment?: Commitment;
14
+ destination: Address | string;
15
+ lifetime?: BlockhashLifetime;
16
+ transactionVersion?: TransactionVersion;
17
+ }>;
18
+ export type SolTransferSendOptions = Readonly<{
19
+ abortSignal?: AbortSignal;
20
+ commitment?: Commitment;
21
+ maxRetries?: bigint | number;
22
+ minContextSlot?: Slot;
23
+ skipPreflight?: boolean;
24
+ }>;
25
+ type PreparedSolTransfer = Readonly<{
26
+ commitment?: Commitment;
27
+ lifetime: BlockhashLifetime;
28
+ message: SignableSolTransactionMessage;
29
+ mode: 'partial' | 'send';
30
+ signer: TransactionSigner;
31
+ plan?: TransactionPlan;
32
+ }>;
33
+ export type SolTransferHelper = Readonly<{
34
+ prepareTransfer(config: SolTransferPrepareConfig): Promise<PreparedSolTransfer>;
35
+ sendPreparedTransfer(prepared: PreparedSolTransfer, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
36
+ sendTransfer(config: SolTransferPrepareConfig, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
37
+ }>;
38
+ /** Creates documented helpers that build and submit System Program SOL transfers. */
39
+ export declare function createSolTransferHelper(runtime: SolanaClientRuntime): SolTransferHelper;
40
+ export {};
41
+ //# sourceMappingURL=sol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sol.d.ts","sourceRoot":"","sources":["../../../src/features/sol.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,SAAS,EACd,KAAK,UAAU,EAMf,KAAK,IAAI,EAIT,SAAS,EACT,iCAA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AAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC,CAAC;AAiCH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACxC,eAAe,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChF,oBAAoB,CACnB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACzC,YAAY,CACX,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH,qFAAqF;AACrF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,iBAAiB,CAyFvF"}
@@ -0,0 +1,59 @@
1
+ import { type Address, type Blockhash, type Commitment, signature, signTransactionMessageWithSigners, type TransactionPlan, type TransactionSigner, type TransactionVersion } from '@solana/kit';
2
+ import type { SolanaClientRuntime, WalletSession } from '../types';
3
+ import type { SolTransferSendOptions } from './sol';
4
+ type BlockhashLifetime = Readonly<{
5
+ blockhash: Blockhash;
6
+ lastValidBlockHeight: bigint;
7
+ }>;
8
+ type SplTokenAuthority = TransactionSigner<string> | WalletSession;
9
+ type SignableSplTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
10
+ export type SplTokenHelperConfig = Readonly<{
11
+ associatedTokenProgram?: Address | string;
12
+ commitment?: Commitment;
13
+ decimals?: number;
14
+ mint: Address | string;
15
+ tokenProgram?: Address | string;
16
+ }>;
17
+ export type SplTokenBalance = Readonly<{
18
+ amount: bigint;
19
+ ataAddress: Address;
20
+ decimals: number;
21
+ exists: boolean;
22
+ uiAmount: string;
23
+ }>;
24
+ export type SplTransferPrepareConfig = Readonly<{
25
+ amount: bigint | number | string;
26
+ amountInBaseUnits?: boolean;
27
+ authority: SplTokenAuthority;
28
+ commitment?: Commitment;
29
+ destinationOwner: Address | string;
30
+ destinationToken?: Address | string;
31
+ ensureDestinationAta?: boolean;
32
+ lifetime?: BlockhashLifetime;
33
+ sourceOwner?: Address | string;
34
+ sourceToken?: Address | string;
35
+ transactionVersion?: TransactionVersion;
36
+ }>;
37
+ type PreparedSplTransfer = Readonly<{
38
+ amount: bigint;
39
+ commitment?: Commitment;
40
+ decimals: number;
41
+ destinationAta: Address;
42
+ lifetime: BlockhashLifetime;
43
+ message: SignableSplTransactionMessage;
44
+ mode: 'partial' | 'send';
45
+ signer: TransactionSigner;
46
+ sourceAta: Address;
47
+ plan?: TransactionPlan;
48
+ }>;
49
+ export type SplTokenHelper = Readonly<{
50
+ deriveAssociatedTokenAddress(owner: Address | string): Promise<Address>;
51
+ fetchBalance(owner: Address | string, commitment?: Commitment): Promise<SplTokenBalance>;
52
+ prepareTransfer(config: SplTransferPrepareConfig): Promise<PreparedSplTransfer>;
53
+ sendPreparedTransfer(prepared: PreparedSplTransfer, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
54
+ sendTransfer(config: SplTransferPrepareConfig, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
55
+ }>;
56
+ /** Creates helpers dedicated to SPL token account discovery, balances, and transfers. */
57
+ export declare function createSplTokenHelper(runtime: SolanaClientRuntime, config: SplTokenHelperConfig): SplTokenHelper;
58
+ export {};
59
+ //# sourceMappingURL=spl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spl.d.ts","sourceRoot":"","sources":["../../../src/features/spl.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,SAAS,EACd,KAAK,UAAU,EAWf,SAAS,EACT,iCAAiC,EAEjC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,aAAa,CAAC;AAWrB,OAAO,KAAK,EAAE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OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,GAAG,cAAc,CA8M/G"}
@@ -0,0 +1,79 @@
1
+ import type { Address, appendTransactionMessageInstruction, Blockhash, Commitment, InstructionPlan, Slot, TransactionPlan, TransactionPlannerConfig, TransactionSigner, TransactionVersion } from '@solana/kit';
2
+ import { signature, signTransactionMessageWithSigners } from '@solana/kit';
3
+ import { type PrepareTransactionMessage, type PrepareTransactionOptions } from '../transactions/prepareTransaction';
4
+ import type { SolanaClientRuntime, WalletSession } from '../types';
5
+ type BlockhashLifetime = Readonly<{
6
+ blockhash: Blockhash;
7
+ lastValidBlockHeight: bigint;
8
+ }>;
9
+ type TransactionInstruction = Parameters<typeof appendTransactionMessageInstruction>[0];
10
+ export type TransactionInstructionInput = TransactionInstruction;
11
+ type SignableTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
12
+ type TransactionAuthority = TransactionSigner | WalletSession;
13
+ type PrepareTransactionOverrides = Omit<PrepareTransactionOptions<PrepareTransactionMessage>, 'transaction'>;
14
+ type TransactionRecipeMetadata = Readonly<{
15
+ commitment: Commitment;
16
+ computeUnitLimit?: bigint;
17
+ computeUnitPrice?: bigint;
18
+ feePayer: Address;
19
+ instructions: readonly TransactionInstruction[];
20
+ lifetime: BlockhashLifetime;
21
+ mode: 'partial' | 'send';
22
+ version: TransactionVersion;
23
+ }>;
24
+ export type TransactionRecipe = TransactionRecipeMetadata & Readonly<{
25
+ createTransactionMessage: TransactionPlannerConfig['createTransactionMessage'];
26
+ instructionPlan: InstructionPlan;
27
+ }>;
28
+ export type TransactionRecipeContext = Readonly<{
29
+ getFallbackCommitment(): Commitment;
30
+ runtime: SolanaClientRuntime;
31
+ }>;
32
+ export type TransactionPrepareRequest = Readonly<{
33
+ abortSignal?: AbortSignal;
34
+ authority?: TransactionAuthority;
35
+ commitment?: Commitment;
36
+ computeUnitLimit?: bigint | number;
37
+ computeUnitPrice?: bigint | number;
38
+ feePayer?: Address | string | TransactionSigner;
39
+ instructions: readonly TransactionInstruction[];
40
+ lifetime?: BlockhashLifetime;
41
+ version?: TransactionVersion | 'auto';
42
+ }>;
43
+ export type TransactionPrepareAndSendRequest = TransactionPrepareRequest & Readonly<{
44
+ prepareTransaction?: false | PrepareTransactionOverrides;
45
+ }>;
46
+ export type TransactionPrepared = Readonly<{
47
+ commitment: Commitment;
48
+ computeUnitLimit?: bigint;
49
+ computeUnitPrice?: bigint;
50
+ feePayer: Address;
51
+ instructions: readonly TransactionInstruction[];
52
+ lifetime: BlockhashLifetime;
53
+ message: SignableTransactionMessage;
54
+ mode: 'partial' | 'send';
55
+ plan?: TransactionPlan;
56
+ version: TransactionVersion;
57
+ }>;
58
+ export type TransactionSignOptions = Readonly<{
59
+ abortSignal?: AbortSignal;
60
+ minContextSlot?: Slot;
61
+ }>;
62
+ export type TransactionSendOptions = Readonly<{
63
+ abortSignal?: AbortSignal;
64
+ commitment?: Commitment;
65
+ maxRetries?: bigint | number;
66
+ minContextSlot?: Slot;
67
+ skipPreflight?: boolean;
68
+ }>;
69
+ export type TransactionHelper = Readonly<{
70
+ prepare(request: TransactionPrepareRequest): Promise<TransactionPrepared>;
71
+ sign(prepared: TransactionPrepared, options?: TransactionSignOptions): ReturnType<typeof signTransactionMessageWithSigners>;
72
+ toWire(prepared: TransactionPrepared, options?: TransactionSignOptions): Promise<string>;
73
+ send(prepared: TransactionPrepared, options?: TransactionSendOptions): Promise<ReturnType<typeof signature>>;
74
+ prepareAndSend(request: TransactionPrepareAndSendRequest, options?: TransactionSendOptions): Promise<ReturnType<typeof signature>>;
75
+ }>;
76
+ export declare function createTransactionRecipe(request: TransactionPrepareRequest, context: TransactionRecipeContext): Promise<TransactionRecipe>;
77
+ export declare function createTransactionHelper(runtime: SolanaClientRuntime, getFallbackCommitment: () => Commitment): TransactionHelper;
78
+ export {};
79
+ //# sourceMappingURL=transactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../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AAO,CAAC,iBAAiB,CAAC,CA0E5B;AAWD,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,mBAAmB,EAC5B,qBAAqB,EAAE,MAAM,UAAU,GACrC,iBAAiB,CAgKnB"}
@@ -0,0 +1,25 @@
1
+ export { createClient } from './client/createClient';
2
+ export { createClientStore, createDefaultClientStore, createInitialClientState } from './client/createClientStore';
3
+ export { createSolTransferController, type SolTransferController, type SolTransferControllerConfig, type SolTransferInput, } from './controllers/solTransferController';
4
+ export { createSplTransferController, type SplTransferController, type SplTransferControllerConfig, type SplTransferInput, } from './controllers/splTransferController';
5
+ export { createSolTransferHelper, type SolTransferHelper, type SolTransferPrepareConfig, type SolTransferSendOptions, } from './features/sol';
6
+ export { createSplTokenHelper, type SplTokenBalance, type SplTokenHelper, type SplTokenHelperConfig, type SplTransferPrepareConfig, } from './features/spl';
7
+ export { createTransactionHelper, createTransactionRecipe, type TransactionHelper, type TransactionInstructionInput, type TransactionPrepareAndSendRequest, type TransactionPrepared, type TransactionPrepareRequest, type TransactionRecipe, type TransactionRecipeContext, type TransactionSendOptions, type TransactionSignOptions, } from './features/transactions';
8
+ export { createTokenAmount, type FormatAmountOptions, type ParseAmountOptions, type TokenAmountMath, } from './numeric/amounts';
9
+ export { LAMPORTS_PER_SOL, lamports, lamportsFromSol, lamportsMath, lamportsToSolString } from './numeric/lamports';
10
+ export { assertDecimals, assertNonNegative, type BigintLike, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, pow10, toBigint, } from './numeric/math';
11
+ export { type ApplyRatioOptions, applyRatio, createRatio, type Ratio, type RoundingMode } from './numeric/rational';
12
+ export { type CreateSolanaRpcClientConfig, createSolanaRpcClient, type SendAndConfirmTransactionOptions, type SimulateTransactionOptions, type SolanaRpcClient, } from './rpc/createSolanaRpcClient';
13
+ export { bigintFromJson, bigintToJson, lamportsFromJson, lamportsToJson } from './serialization/json';
14
+ export { type ConfirmationCommitment, confirmationMeetsCommitment, deriveConfirmationStatus, normalizeSignature, SIGNATURE_STATUS_TIMEOUT_MS, type SignatureLike, type SignatureStatusLike, } from './signatures/status';
15
+ export { type AsyncState, type AsyncStatus, createAsyncState, createInitialAsyncState } from './state/asyncState';
16
+ export { transactionToBase64, transactionToBase64WithSigners, } from './transactions/base64';
17
+ export { type PrepareTransactionConfig, type PrepareTransactionMessage, type PrepareTransactionOptions, prepareTransaction, } from './transactions/prepareTransaction';
18
+ export { insertReferenceKey, insertReferenceKeys } from './transactions/referenceKeys';
19
+ export { createTransactionPoolController, type LatestBlockhashCache, type TransactionInstructionList, type TransactionPoolConfig, type TransactionPoolController, type TransactionPoolPrepareAndSendOptions, type TransactionPoolPrepareOptions, type TransactionPoolSendOptions, type TransactionPoolSignOptions, } from './transactions/transactionPoolController';
20
+ export type { AccountCache, AccountCacheEntry, AccountWatcherConfig, BalanceWatcherConfig, ClientActions, ClientHelpers, ClientState, ClientStore, ClientWatchers, SolanaClient, SolanaClientConfig, WalletConnector, WalletConnectorMetadata, WalletRegistry, WalletSession, WalletStatus, } from './types';
21
+ export { type AddressLike, toAddress, toAddressString } from './utils/addressLike';
22
+ export { stableStringify } from './utils/stableStringify';
23
+ export { createWalletRegistry } from './wallet/registry';
24
+ export { createWalletStandardConnector, getWalletStandardConnectors, watchWalletStandardConnectors, } from './wallet/standard';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACnH,OAAO,EACN,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B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AC7B,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ClientLogger, LogLevel } from '../types';
2
+ /**
3
+ * Creates a logger function that falls back to console logging when no custom logger is provided.
4
+ *
5
+ * @param logger - Optional logger implementation supplied by the integrator.
6
+ * @returns A {@link ClientLogger} instance ready for dependency injection.
7
+ */
8
+ export declare function createLogger(logger?: ClientLogger): ClientLogger;
9
+ /**
10
+ * Formats an error into a structured payload for logging.
11
+ *
12
+ * @param error - Arbitrary error value that will be recorded.
13
+ * @returns Serializable shape containing the original error and message.
14
+ */
15
+ export declare function formatError(error: unknown): Record<string, unknown>;
16
+ /**
17
+ * Returns whether the provided log level is at least as severe as the threshold.
18
+ *
19
+ * @param level - Log level to evaluate.
20
+ * @param threshold - Minimum severity level that should pass.
21
+ * @returns `true` when the level meets or exceeds the threshold.
22
+ */
23
+ export declare function isLevelAtLeast(level: LogLevel, threshold: LogLevel): boolean;
24
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/logging/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAUvD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,CAoBhE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKnE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,GAAG,OAAO,CAE5E"}
@@ -0,0 +1,30 @@
1
+ import { type BigintLike } from './math';
2
+ import { type ApplyRatioOptions, type Ratio, type RoundingMode } from './rational';
3
+ export type ParseAmountOptions = Readonly<{
4
+ label?: string;
5
+ rounding?: RoundingMode;
6
+ }>;
7
+ export type FormatAmountOptions = Readonly<{
8
+ minimumFractionDigits?: number;
9
+ trimTrailingZeros?: boolean;
10
+ }>;
11
+ export type TokenAmountMath = Readonly<{
12
+ add(lhs: bigint, rhs: bigint): bigint;
13
+ compare(lhs: bigint, rhs: bigint): number;
14
+ decimals: number;
15
+ fromBaseUnits(value: BigintLike, label?: string): bigint;
16
+ fromDecimal(value: number | string, options?: ParseAmountOptions): bigint;
17
+ isZero(amount: bigint): boolean;
18
+ multiplyByRatio(amount: bigint, ratio: Ratio, options?: ApplyRatioOptions): bigint;
19
+ scale: bigint;
20
+ subtract(lhs: bigint, rhs: bigint): bigint;
21
+ toDecimalString(amount: bigint, options?: FormatAmountOptions): string;
22
+ }>;
23
+ /**
24
+ * Factory that returns integer-safe helpers for working with token amounts across arbitrary decimals.
25
+ *
26
+ * @param decimals - Token decimal precision (0-38) used to scale values.
27
+ * @returns Helper collection for conversions and arithmetic over bigint amounts.
28
+ */
29
+ export declare function createTokenAmount(decimals: number): TokenAmountMath;
30
+ //# sourceMappingURL=amounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amounts.d.ts","sourceRoot":"","sources":["../../../src/numeric/amounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,UAAU,EAKf,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,KAAK,iBAAiB,EAAc,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/F,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,YAAY,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAC1C,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACtC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAC1E,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;CACvE,CAAC,CAAC;AA2HH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAgInE"}
@@ -0,0 +1,46 @@
1
+ import type { Lamports } from '@solana/kit';
2
+ import { type FormatAmountOptions, type ParseAmountOptions, type TokenAmountMath } from './amounts';
3
+ import type { ApplyRatioOptions, Ratio } from './rational';
4
+ export declare const LAMPORTS_PER_SOL: bigint;
5
+ export type LamportsMath = Readonly<{
6
+ add(lhs: Lamports, rhs: Lamports): Lamports;
7
+ compare(lhs: Lamports, rhs: Lamports): number;
8
+ decimals: number;
9
+ fromLamports(value: bigint | number | string, label?: string): Lamports;
10
+ fromSol(value: number | string, options?: ParseAmountOptions): Lamports;
11
+ isZero(amount: Lamports): boolean;
12
+ multiplyByRatio(amount: Lamports, ratio: Ratio, options?: ApplyRatioOptions): Lamports;
13
+ raw: TokenAmountMath;
14
+ scale: bigint;
15
+ subtract(lhs: Lamports, rhs: Lamports): Lamports;
16
+ toSolString(amount: Lamports, options?: FormatAmountOptions): string;
17
+ }>;
18
+ /**
19
+ * Typed helpers for working with lamport-denominated values.
20
+ */
21
+ export declare const lamportsMath: LamportsMath;
22
+ /**
23
+ * Shortcut for constructing lamport values from base units.
24
+ *
25
+ * @param value - Integer-like lamport amount.
26
+ * @param label - Optional label used for error reporting.
27
+ * @returns Normalized lamport bigint.
28
+ */
29
+ export declare function lamports(value: bigint | number | string, label?: string): Lamports;
30
+ /**
31
+ * Converts an SOL-denominated value into lamports.
32
+ *
33
+ * @param value - Decimal representation of SOL.
34
+ * @param options - Optional rounding and labelling configuration.
35
+ * @returns Lamport amount.
36
+ */
37
+ export declare function lamportsFromSol(value: number | string, options?: ParseAmountOptions): Lamports;
38
+ /**
39
+ * Converts lamports into a human-readable SOL string.
40
+ *
41
+ * @param amount - Lamport amount to format.
42
+ * @param options - Formatting preferences.
43
+ * @returns SOL string representation.
44
+ */
45
+ export declare function lamportsToSolString(amount: Lamports, options?: FormatAmountOptions): string;
46
+ //# sourceMappingURL=lamports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lamports.d.ts","sourceRoot":"","sources":["../../../src/numeric/lamports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAqB,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACvH,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAI3D,eAAO,MAAM,gBAAgB,QAAsB,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GA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| string;
2
+ /**
3
+ * Raises 10 to the power of the provided non-negative integer exponent.
4
+ *
5
+ * @param exponent - Exponent that must be between 0 and 38 inclusive.
6
+ * @returns Power-of-ten bigint value.
7
+ */
8
+ export declare function pow10(exponent: number): bigint;
9
+ /**
10
+ * Ensures the provided bigint is not negative.
11
+ *
12
+ * @param value - Bigint value to validate.
13
+ * @param label - Optional label used in error messages.
14
+ * @throws When the value is negative.
15
+ */
16
+ export declare function assertNonNegative(value: bigint, label?: string): void;
17
+ /**
18
+ * Ensures the provided decimals value is a safe non-negative integer within typical SPL limits.
19
+ *
20
+ * @param decimals - Decimal precision to validate.
21
+ * @param label - Optional label used in error messages.
22
+ * @throws When the value is not an integer between 0 and 38 inclusive.
23
+ */
24
+ export declare function assertDecimals(decimals: number, label?: string): void;
25
+ /**
26
+ * Converts supported numeric inputs into bigint while enforcing integer semantics.
27
+ *
28
+ * @param value - Integer-like value to convert.
29
+ * @param label - Optional label used in error messages.
30
+ * @returns Bigint representation of the supplied value.
31
+ * @throws When the input is not a finite integer.
32
+ */
33
+ export declare function toBigint(value: BigintLike, label?: string): bigint;
34
+ /**
35
+ * Adds two bigint values while enforcing non-negative outputs.
36
+ *
37
+ * @param lhs - Left-hand side operand.
38
+ * @param rhs - Right-hand side operand.
39
+ * @param label - Optional label used in error messages.
40
+ * @returns Sum of the operands.
41
+ * @throws When the result is negative.
42
+ */
43
+ export declare function checkedAdd(lhs: bigint, rhs: bigint, label?: string): bigint;
44
+ /**
45
+ * Subtracts two bigint values, throwing if the operation would go negative.
46
+ *
47
+ * @param lhs - Left-hand side operand.
48
+ * @param rhs - Right-hand side operand.
49
+ * @param label - Optional label used in error messages.
50
+ * @returns Difference of the operands.
51
+ * @throws When the result is negative.
52
+ */
53
+ export declare function checkedSubtract(lhs: bigint, rhs: bigint, label?: string): bigint;
54
+ /**
55
+ * Multiplies two bigint values and ensures the result is non-negative.
56
+ *
57
+ * @param lhs - Left-hand side operand.
58
+ * @param rhs - Right-hand side operand.
59
+ * @param label - Optional label used in error messages.
60
+ * @returns Product of the operands.
61
+ * @throws When the result is negative.
62
+ */
63
+ export declare function checkedMultiply(lhs: bigint, rhs: bigint, label?: string): bigint;
64
+ /**
65
+ * Performs integer division and verifies that the divisor is non-zero and the result is non-negative.
66
+ *
67
+ * @param dividend - Value to be divided.
68
+ * @param divisor - Value to divide by.
69
+ * @param label - Optional label used in error messages.
70
+ * @returns Quotient of the division.
71
+ * @throws When the divisor is zero or the result is negative.
72
+ */
73
+ export declare function checkedDivide(dividend: bigint, divisor: bigint, label?: string): bigint;
74
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/numeric/math.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAIlD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAU,GAAG,IAAI,CAItE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAa,GAAG,IAAI,CAIzE;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,SAAU,GAAG,MAAM,CAmBnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,SAAW,GAAG,MAAM,CAI7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,SAAW,GAAG,MAAM,CAIlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,SAAW,GAAG,MAAM,CAIlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAW,GAAG,MAAM,CAOzF"}
@@ -0,0 +1,27 @@
1
+ import { type BigintLike } from './math';
2
+ export type RoundingMode = 'ceil' | 'floor' | 'round';
3
+ export type Ratio = Readonly<{
4
+ denominator: bigint;
5
+ numerator: bigint;
6
+ }>;
7
+ /**
8
+ * Creates a ratio used for slippage, fee, or percentage calculations.
9
+ *
10
+ * @param numeratorInput - Numerator part of the ratio; must be non-negative.
11
+ * @param denominatorInput - Denominator part of the ratio; must be positive.
12
+ * @returns Immutable ratio descriptor.
13
+ */
14
+ export declare function createRatio(numeratorInput: BigintLike, denominatorInput: BigintLike): Ratio;
15
+ export type ApplyRatioOptions = Readonly<{
16
+ rounding?: RoundingMode;
17
+ }>;
18
+ /**
19
+ * Multiplies an integer amount by the provided ratio using the requested rounding strategy.
20
+ *
21
+ * @param amount - Base amount to scale; must be non-negative.
22
+ * @param ratio - Ratio produced by {@link createRatio}.
23
+ * @param options - Optional rounding configuration.
24
+ * @returns Scaled amount as a bigint.
25
+ */
26
+ export declare function applyRatio(amount: bigint, ratio: Ratio, options?: ApplyRatioOptions): bigint;
27
+ //# sourceMappingURL=rational.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rational.d.ts","sourceRoot":"","sources":["../../../src/numeric/rational.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,UAAU,EAAY,MAAM,QAAQ,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AA+BH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,GAAG,KAAK,CAQ3F;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACxC,QAAQ,CAAC,EAAE,YAAY,CAAC;CACxB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAKhG"}