@solana/react-hooks 0.0.0 → 0.0.2

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 (92) hide show
  1. package/README.md +114 -25
  2. package/dist/index.browser.cjs +1144 -0
  3. package/dist/index.browser.cjs.map +1 -0
  4. package/dist/index.browser.mjs +1109 -0
  5. package/dist/index.browser.mjs.map +1 -0
  6. package/dist/index.native.mjs +1109 -0
  7. package/dist/index.native.mjs.map +1 -0
  8. package/dist/index.node.cjs +1144 -0
  9. package/dist/index.node.cjs.map +1 -0
  10. package/dist/index.node.mjs +1109 -0
  11. package/dist/index.node.mjs.map +1 -0
  12. package/dist/types/client/src/client/actions.d.ts +18 -0
  13. package/dist/types/client/src/client/actions.d.ts.map +1 -0
  14. package/dist/types/client/src/client/createClient.d.ts +9 -0
  15. package/dist/types/client/src/client/createClient.d.ts.map +1 -0
  16. package/dist/types/client/src/client/createClientHelpers.d.ts +3 -0
  17. package/dist/types/client/src/client/createClientHelpers.d.ts.map +1 -0
  18. package/dist/types/client/src/client/createClientStore.d.ts +29 -0
  19. package/dist/types/client/src/client/createClientStore.d.ts.map +1 -0
  20. package/dist/types/client/src/client/watchers.d.ts +16 -0
  21. package/dist/types/client/src/client/watchers.d.ts.map +1 -0
  22. package/dist/types/client/src/controllers/solTransferController.d.ts +21 -0
  23. package/dist/types/client/src/controllers/solTransferController.d.ts.map +1 -0
  24. package/dist/types/client/src/controllers/splTransferController.d.ts +24 -0
  25. package/dist/types/client/src/controllers/splTransferController.d.ts.map +1 -0
  26. package/dist/types/client/src/features/sol.d.ts +41 -0
  27. package/dist/types/client/src/features/sol.d.ts.map +1 -0
  28. package/dist/types/client/src/features/spl.d.ts +59 -0
  29. package/dist/types/client/src/features/spl.d.ts.map +1 -0
  30. package/dist/types/client/src/features/transactions.d.ts +79 -0
  31. package/dist/types/client/src/features/transactions.d.ts.map +1 -0
  32. package/dist/types/client/src/index.d.ts +25 -0
  33. package/dist/types/client/src/index.d.ts.map +1 -0
  34. package/dist/types/client/src/logging/logger.d.ts +24 -0
  35. package/dist/types/client/src/logging/logger.d.ts.map +1 -0
  36. package/dist/types/client/src/numeric/amounts.d.ts +30 -0
  37. package/dist/types/client/src/numeric/amounts.d.ts.map +1 -0
  38. package/dist/types/client/src/numeric/lamports.d.ts +46 -0
  39. package/dist/types/client/src/numeric/lamports.d.ts.map +1 -0
  40. package/dist/types/client/src/numeric/math.d.ts +74 -0
  41. package/dist/types/client/src/numeric/math.d.ts.map +1 -0
  42. package/dist/types/client/src/numeric/rational.d.ts +27 -0
  43. package/dist/types/client/src/numeric/rational.d.ts.map +1 -0
  44. package/dist/types/client/src/rpc/createSolanaRpcClient.d.ts +42 -0
  45. package/dist/types/client/src/rpc/createSolanaRpcClient.d.ts.map +1 -0
  46. package/dist/types/client/src/serialization/json.d.ts +31 -0
  47. package/dist/types/client/src/serialization/json.d.ts.map +1 -0
  48. package/dist/types/client/src/signatures/status.d.ts +12 -0
  49. package/dist/types/client/src/signatures/status.d.ts.map +1 -0
  50. package/dist/types/client/src/signers/walletTransactionSigner.d.ts +33 -0
  51. package/dist/types/client/src/signers/walletTransactionSigner.d.ts.map +1 -0
  52. package/dist/types/client/src/state/asyncState.d.ts +12 -0
  53. package/dist/types/client/src/state/asyncState.d.ts.map +1 -0
  54. package/dist/types/client/src/transactions/base64.d.ts +12 -0
  55. package/dist/types/client/src/transactions/base64.d.ts.map +1 -0
  56. package/dist/types/client/src/transactions/prepareTransaction.d.ts +16 -0
  57. package/dist/types/client/src/transactions/prepareTransaction.d.ts.map +1 -0
  58. package/dist/types/client/src/transactions/referenceKeys.d.ts +10 -0
  59. package/dist/types/client/src/transactions/referenceKeys.d.ts.map +1 -0
  60. package/dist/types/client/src/transactions/transactionPoolController.d.ts +53 -0
  61. package/dist/types/client/src/transactions/transactionPoolController.d.ts.map +1 -0
  62. package/dist/types/client/src/types.d.ts +205 -0
  63. package/dist/types/client/src/types.d.ts.map +1 -0
  64. package/dist/types/client/src/utils/addressLike.d.ts +5 -0
  65. package/dist/types/client/src/utils/addressLike.d.ts.map +1 -0
  66. package/dist/types/client/src/utils/stableStringify.d.ts +2 -0
  67. package/dist/types/client/src/utils/stableStringify.d.ts.map +1 -0
  68. package/dist/types/client/src/utils.d.ts +21 -0
  69. package/dist/types/client/src/utils.d.ts.map +1 -0
  70. package/dist/types/client/src/wallet/registry.d.ts +9 -0
  71. package/dist/types/client/src/wallet/registry.d.ts.map +1 -0
  72. package/dist/types/client/src/wallet/standard.d.ts +36 -0
  73. package/dist/types/client/src/wallet/standard.d.ts.map +1 -0
  74. package/dist/types/react-hooks/src/QueryProvider.d.ts +11 -0
  75. package/dist/types/react-hooks/src/QueryProvider.d.ts.map +1 -0
  76. package/dist/types/react-hooks/src/context.d.ts +22 -0
  77. package/dist/types/react-hooks/src/context.d.ts.map +1 -0
  78. package/dist/types/react-hooks/src/hooks.d.ts +208 -0
  79. package/dist/types/react-hooks/src/hooks.d.ts.map +1 -0
  80. package/dist/types/react-hooks/src/index.d.ts +8 -0
  81. package/dist/types/react-hooks/src/index.d.ts.map +1 -0
  82. package/dist/types/react-hooks/src/query.d.ts +20 -0
  83. package/dist/types/react-hooks/src/query.d.ts.map +1 -0
  84. package/dist/types/react-hooks/src/queryHooks.d.ts +43 -0
  85. package/dist/types/react-hooks/src/queryHooks.d.ts.map +1 -0
  86. package/dist/types/react-hooks/src/querySuspenseContext.d.ts +4 -0
  87. package/dist/types/react-hooks/src/querySuspenseContext.d.ts.map +1 -0
  88. package/dist/types/react-hooks/src/useClientStore.d.ts +6 -0
  89. package/dist/types/react-hooks/src/useClientStore.d.ts.map +1 -0
  90. package/dist/types/react-hooks/src/walletStandardHooks.d.ts +78 -0
  91. package/dist/types/react-hooks/src/walletStandardHooks.d.ts.map +1 -0
  92. package/package.json +88 -84
@@ -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":["../../../../../client/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,EAChC,KAAK,gBAAgB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB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E,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClH,OAAO,EACN,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,kBAAkB,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EACN,+BAA+B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAC/B,MAAM,0CAA0C,CAAC;AAClD,YAAY,EACX,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,YAAY,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACN,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,GAC7B,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":["../../../../../../client/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":["../../../../../../client/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":["../../../../../../client/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,GAAG,QAAQ,CAAC;IAC5C,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,QAAQ,CAAC;IACxE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,QAAQ,CAAC;IACvF,GAAG,EAAE,eAAe,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjD,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;CACrE,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,YAoFzB,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAElF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,QAAQ,CAE9F;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAE3F"}
@@ -0,0 +1,74 @@
1
+ export type BigintLike = bigint | number | 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":["../../../../../../client/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":["../../../../../../client/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"}
@@ -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":["../../../../../../client/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,gCAAgC,GAAG,QAAQ,CAAC;IACvD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;I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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":["../../../../../../client/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":["../../../../../../client/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":["../../../../../../client/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":["../../../../../../client/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":["../../../../../../client/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":["../../../../../../client/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;AAMrB,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;AAqCJ,wBAAsB,kBAAkB,CAAC,QAAQ,SAAS,yBAAyB,EAClF,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GACxC,OAAO,CAAC,QAAQ,GAAG,uCAAuC,CAAC,CA4C7D"}
@@ -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":["../../../../../../client/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":["../../../../../../client/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,EAAE,WAAW,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,CAAC;CAC1D,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CACnD,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