@buildonspark/spark-sdk 0.1.43 → 0.1.45

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 (153) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-DEPd_fPO.d.ts} +43 -4
  3. package/dist/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-Du0z7Om7.d.cts} +43 -4
  4. package/dist/address/index.cjs +2 -2
  5. package/dist/address/index.d.cts +2 -2
  6. package/dist/address/index.d.ts +2 -2
  7. package/dist/address/index.js +2 -2
  8. package/dist/{chunk-IRW5TWMH.js → chunk-5FUB65LX.js} +7 -9
  9. package/dist/{chunk-BUTZWYBW.js → chunk-6264CGDM.js} +4 -4
  10. package/dist/{chunk-VFJQNBFX.js → chunk-7V6N75CC.js} +5 -2
  11. package/dist/{chunk-M6A4KFIG.js → chunk-BGGEVUJK.js} +1505 -445
  12. package/dist/{chunk-DQYKQJRZ.js → chunk-C2S227QR.js} +675 -52
  13. package/dist/{chunk-GYQR4B4P.js → chunk-GZ5IPPJ2.js} +2 -2
  14. package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
  15. package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
  16. package/dist/{chunk-WWOTVNPP.js → chunk-J2IE4Z7Y.js} +544 -431
  17. package/dist/{chunk-O4RYNJNB.js → chunk-KMUMFYFX.js} +3 -3
  18. package/dist/chunk-LHRD2WT6.js +2374 -0
  19. package/dist/{chunk-ABZA6R5S.js → chunk-NTFKFRQ2.js} +1 -1
  20. package/dist/{chunk-MIVX3GHD.js → chunk-OBFKIEMP.js} +1 -1
  21. package/dist/{chunk-HRQRRDSS.js → chunk-PQN3C2MF.js} +15 -15
  22. package/dist/{chunk-DOA6QXYQ.js → chunk-R5PXJZQS.js} +3 -1
  23. package/dist/{chunk-TIUBYNN5.js → chunk-YUPMXTCJ.js} +4 -4
  24. package/dist/graphql/objects/index.d.cts +6 -43
  25. package/dist/graphql/objects/index.d.ts +6 -43
  26. package/dist/graphql/objects/index.js +1 -1
  27. package/dist/index-B2AwKW5J.d.cts +214 -0
  28. package/dist/index-CJDi1HWc.d.ts +214 -0
  29. package/dist/index.cjs +4150 -1026
  30. package/dist/index.d.cts +764 -19
  31. package/dist/index.d.ts +764 -19
  32. package/dist/index.js +17 -21
  33. package/dist/index.node.cjs +4153 -1033
  34. package/dist/index.node.d.cts +10 -8
  35. package/dist/index.node.d.ts +10 -8
  36. package/dist/index.node.js +20 -28
  37. package/dist/native/index.cjs +4166 -1042
  38. package/dist/native/index.d.cts +369 -108
  39. package/dist/native/index.d.ts +369 -108
  40. package/dist/native/index.js +4138 -1015
  41. package/dist/{network-xkBSpaTn.d.ts → network-BTJl-Sul.d.ts} +1 -1
  42. package/dist/{network-D5lKssVl.d.cts → network-CqgsdUF2.d.cts} +1 -1
  43. package/dist/proto/lrc20.cjs +222 -19
  44. package/dist/proto/lrc20.d.cts +1 -1
  45. package/dist/proto/lrc20.d.ts +1 -1
  46. package/dist/proto/lrc20.js +2 -2
  47. package/dist/proto/spark.cjs +1502 -442
  48. package/dist/proto/spark.d.cts +1 -1
  49. package/dist/proto/spark.d.ts +1 -1
  50. package/dist/proto/spark.js +5 -5
  51. package/dist/proto/spark_token.cjs +1515 -56
  52. package/dist/proto/spark_token.d.cts +153 -15
  53. package/dist/proto/spark_token.d.ts +153 -15
  54. package/dist/proto/spark_token.js +40 -4
  55. package/dist/{sdk-types-B-q9py_P.d.cts → sdk-types-B0SwjolI.d.cts} +1 -1
  56. package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-Cc4l4kb1.d.ts} +1 -1
  57. package/dist/services/config.cjs +7 -3
  58. package/dist/services/config.d.cts +5 -4
  59. package/dist/services/config.d.ts +5 -4
  60. package/dist/services/config.js +6 -6
  61. package/dist/services/connection.cjs +2938 -646
  62. package/dist/services/connection.d.cts +5 -4
  63. package/dist/services/connection.d.ts +5 -4
  64. package/dist/services/connection.js +4 -4
  65. package/dist/services/index.cjs +6381 -3461
  66. package/dist/services/index.d.cts +7 -6
  67. package/dist/services/index.d.ts +7 -6
  68. package/dist/services/index.js +15 -13
  69. package/dist/services/lrc-connection.cjs +227 -21
  70. package/dist/services/lrc-connection.d.cts +5 -4
  71. package/dist/services/lrc-connection.d.ts +5 -4
  72. package/dist/services/lrc-connection.js +4 -4
  73. package/dist/services/token-transactions.cjs +868 -244
  74. package/dist/services/token-transactions.d.cts +25 -7
  75. package/dist/services/token-transactions.d.ts +25 -7
  76. package/dist/services/token-transactions.js +5 -4
  77. package/dist/services/wallet-config.cjs +4 -1
  78. package/dist/services/wallet-config.d.cts +7 -5
  79. package/dist/services/wallet-config.d.ts +7 -5
  80. package/dist/services/wallet-config.js +3 -1
  81. package/dist/signer/signer.cjs +5 -2
  82. package/dist/signer/signer.d.cts +3 -2
  83. package/dist/signer/signer.d.ts +3 -2
  84. package/dist/signer/signer.js +2 -2
  85. package/dist/{signer-wqesWifN.d.ts → signer-BocS_J6B.d.ts} +2 -6
  86. package/dist/{signer-IO3oMRNj.d.cts → signer-DKS0AJkw.d.cts} +2 -6
  87. package/dist/{spark-CDm4gqS6.d.cts → spark-dM7EYXYQ.d.cts} +138 -42
  88. package/dist/{spark-CDm4gqS6.d.ts → spark-dM7EYXYQ.d.ts} +138 -42
  89. package/dist/spark_bindings/native/index.cjs +183 -0
  90. package/dist/spark_bindings/native/index.d.cts +14 -0
  91. package/dist/spark_bindings/native/index.d.ts +14 -0
  92. package/dist/spark_bindings/native/index.js +141 -0
  93. package/dist/spark_bindings/wasm/index.cjs +1093 -0
  94. package/dist/spark_bindings/wasm/index.d.cts +47 -0
  95. package/dist/spark_bindings/wasm/index.d.ts +47 -0
  96. package/dist/{chunk-K4C4W5FC.js → spark_bindings/wasm/index.js} +7 -6
  97. package/dist/types/index.cjs +1503 -443
  98. package/dist/types/index.d.cts +6 -5
  99. package/dist/types/index.d.ts +6 -5
  100. package/dist/types/index.js +3 -3
  101. package/dist/types-C-Rp0Oo7.d.cts +46 -0
  102. package/dist/types-C-Rp0Oo7.d.ts +46 -0
  103. package/dist/utils/index.cjs +358 -36
  104. package/dist/utils/index.d.cts +14 -134
  105. package/dist/utils/index.d.ts +14 -134
  106. package/dist/utils/index.js +8 -8
  107. package/package.json +21 -1
  108. package/src/constants.ts +5 -1
  109. package/src/graphql/client.ts +28 -0
  110. package/src/graphql/mutations/RequestCoopExit.ts +6 -0
  111. package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
  112. package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
  113. package/src/index.node.ts +0 -1
  114. package/src/index.ts +0 -1
  115. package/src/native/index.ts +1 -2
  116. package/src/proto/common.ts +5 -5
  117. package/src/proto/google/protobuf/descriptor.ts +34 -34
  118. package/src/proto/google/protobuf/duration.ts +2 -2
  119. package/src/proto/google/protobuf/empty.ts +2 -2
  120. package/src/proto/google/protobuf/timestamp.ts +2 -2
  121. package/src/proto/mock.ts +4 -4
  122. package/src/proto/spark.ts +1924 -525
  123. package/src/proto/spark_authn.ts +7 -7
  124. package/src/proto/spark_token.ts +1668 -105
  125. package/src/proto/validate/validate.ts +24 -24
  126. package/src/services/bolt11-spark.ts +62 -187
  127. package/src/services/coop-exit.ts +3 -0
  128. package/src/services/lrc20.ts +1 -1
  129. package/src/services/token-transactions.ts +209 -9
  130. package/src/services/transfer.ts +22 -3
  131. package/src/services/tree-creation.ts +13 -0
  132. package/src/services/wallet-config.ts +2 -1
  133. package/src/spark-wallet/spark-wallet.node.ts +3 -7
  134. package/src/spark-wallet/spark-wallet.ts +376 -232
  135. package/src/spark-wallet/types.ts +39 -3
  136. package/src/tests/bolt11-spark.test.ts +7 -15
  137. package/src/tests/integration/deposit.test.ts +16 -0
  138. package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
  139. package/src/tests/integration/ssp/swap.test.ts +47 -0
  140. package/src/tests/integration/swap.test.ts +453 -433
  141. package/src/tests/integration/transfer.test.ts +261 -248
  142. package/src/tests/token-identifier.test.ts +54 -0
  143. package/src/tests/tokens.test.ts +218 -22
  144. package/src/utils/token-hashing.ts +346 -52
  145. package/src/utils/token-identifier.ts +88 -0
  146. package/src/utils/token-transaction-validation.ts +350 -5
  147. package/src/utils/token-transactions.ts +12 -8
  148. package/src/utils/transaction.ts +2 -8
  149. package/dist/chunk-VA7MV4MZ.js +0 -1073
  150. package/dist/index-7RYRH5wc.d.ts +0 -815
  151. package/dist/index-BJOc8Ur-.d.cts +0 -815
  152. package/dist/wasm-7OWFHDMS.js +0 -21
  153. package/src/logger.ts +0 -3
@@ -1,815 +0,0 @@
1
- import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput, T as Transfer$1 } from './RequestLightningSendInput-D7fZdT4A.js';
2
- import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-BgOhEAI-.js';
3
- import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-wqesWifN.js';
4
- import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-CDm4gqS6.js';
5
- import { WalletConfigService } from './services/config.js';
6
- import { ConnectionManager } from './services/connection.js';
7
- import { Lrc20ConnectionManager } from './services/lrc-connection.js';
8
- import { Transaction } from '@scure/btc-signer';
9
- import { ConfigOptions } from './services/wallet-config.js';
10
- import { LRCWallet } from '@buildonspark/lrc20-sdk';
11
- import { EventEmitter } from 'eventemitter3';
12
- import { SparkAddressFormat } from './address/index.js';
13
- import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BPoPgzda.js';
14
- import './utils/index.js';
15
- import './network-xkBSpaTn.js';
16
-
17
- declare class SparkSDKError extends Error {
18
- readonly context: Record<string, unknown>;
19
- readonly originalError?: Error;
20
- constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
21
- toString(): string;
22
- toJSON(): Record<string, unknown>;
23
- }
24
-
25
- /**
26
- * NetworkError should be used for any errors related to network communication,
27
- * such as failed HTTP requests, timeouts, or connection issues.
28
- * This includes:
29
- * - Failed API calls
30
- * - Network timeouts
31
- * - Connection refused
32
- * - DNS resolution failures
33
- * - SSL/TLS errors
34
- */
35
- declare class NetworkError extends SparkSDKError {
36
- constructor(message: string, context?: {
37
- url?: string;
38
- method?: string;
39
- statusCode?: number;
40
- response?: unknown;
41
- errorCount?: number;
42
- errors?: string;
43
- operation?: string;
44
- nodeSignaturesCount?: number;
45
- }, originalError?: Error);
46
- }
47
- /**
48
- * ValidationError should be used for any errors related to data validation in regards to the user's input,
49
- * This includes:
50
- * - Invalid signatures
51
- * - Malformed addresses
52
- * - Invalid proof of possession
53
- * - Invalid cryptographic parameters
54
- * - Data format validation failures
55
- */
56
- declare class ValidationError extends SparkSDKError {
57
- constructor(message: string, context?: {
58
- field?: string;
59
- value?: unknown;
60
- expected?: unknown;
61
- expectedLength?: number;
62
- actualLength?: number;
63
- rValue?: bigint;
64
- fieldPrime?: bigint;
65
- sValue?: bigint;
66
- groupOrder?: bigint;
67
- index?: number;
68
- treeLength?: number;
69
- addressNodesLength?: number;
70
- }, originalError?: Error);
71
- }
72
- /**
73
- * InternalValidationError should be used for any errors related to internal data validation
74
- * that is not related to the user's input.
75
- * This includes:
76
- * - Invalid SO responses
77
- */
78
- declare class InternalValidationError extends SparkSDKError {
79
- constructor(message: string, context?: {
80
- field?: string;
81
- value?: unknown;
82
- expected?: unknown;
83
- outputIndex?: number;
84
- keyshareInfo?: unknown;
85
- signingOperators?: unknown;
86
- }, originalError?: Error);
87
- }
88
- /**
89
- * AuthenticationError should be used specifically for authentication and authorization failures,
90
- * such as invalid credentials or insufficient permissions.
91
- * This includes:
92
- * - Invalid API keys
93
- * - Expired tokens
94
- * - Insufficient permissions
95
- * - Authentication token validation failures
96
- * - Authorization failures
97
- */
98
- declare class AuthenticationError extends SparkSDKError {
99
- constructor(message: string, context?: {
100
- endpoint?: string;
101
- reason?: string;
102
- }, originalError?: Error);
103
- }
104
- /**
105
- * RPCError should be used for errors that occur during RPC (Remote Procedure Call) operations,
106
- * such as invalid RPC parameters or RPC-specific failures.
107
- * This includes:
108
- * - Invalid RPC method calls
109
- * - RPC parameter validation failures
110
- * - RPC-specific error codes
111
- * - RPC protocol errors
112
- */
113
- declare class RPCError extends SparkSDKError {
114
- constructor(message: string, context?: {
115
- method?: string;
116
- params?: unknown;
117
- code?: number;
118
- }, originalError?: Error);
119
- }
120
- /**
121
- * ConfigurationError should be used for errors related to SDK configuration,
122
- * such as missing or invalid configuration values.
123
- * This includes:
124
- * - Missing required configuration
125
- * - Invalid configuration values
126
- * - Configuration format errors
127
- * - Environment-specific configuration issues
128
- */
129
- declare class ConfigurationError extends SparkSDKError {
130
- constructor(message: string, context?: {
131
- configKey?: string;
132
- value?: unknown;
133
- }, originalError?: Error);
134
- }
135
- /***
136
- * NotImplementedError should be used for any errors related to features that are not yet implemented.
137
- */
138
- declare class NotImplementedError extends SparkSDKError {
139
- constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
140
- }
141
-
142
- declare class SigningService {
143
- private readonly config;
144
- constructor(config: WalletConfigService);
145
- signRefunds(leaves: LeafKeyTweak[], signingCommitments: RequestedSigningCommitments[], receiverIdentityPubkey: Uint8Array): Promise<UserSignedTxSigningJob[]>;
146
- }
147
-
148
- type LeafKeyTweak = {
149
- leaf: TreeNode;
150
- signingPubKey: Uint8Array;
151
- newSigningPubKey: Uint8Array;
152
- };
153
- type ClaimLeafData = {
154
- signingPubKey: Uint8Array;
155
- tx?: Transaction;
156
- refundTx?: Transaction;
157
- signingNonceCommitment: SigningCommitment;
158
- vout?: number;
159
- };
160
- type LeafRefundSigningData = {
161
- signingPubKey: Uint8Array;
162
- receivingPubkey: Uint8Array;
163
- tx: Transaction;
164
- refundTx?: Transaction;
165
- signingNonceCommitment: SigningCommitment;
166
- vout: number;
167
- };
168
- declare class BaseTransferService {
169
- protected readonly config: WalletConfigService;
170
- protected readonly connectionManager: ConnectionManager;
171
- protected readonly signingService: SigningService;
172
- constructor(config: WalletConfigService, connectionManager: ConnectionManager, signingService: SigningService);
173
- sendTransferTweakKey(transfer: Transfer, leaves: LeafKeyTweak[], refundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
174
- deliverTransferPackage(transfer: Transfer, leaves: LeafKeyTweak[], refundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
175
- sendTransferWithKeyTweaks(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array): Promise<Transfer>;
176
- private prepareTransferPackage;
177
- private finalizeTransfer;
178
- signRefunds(leafDataMap: Map<string, ClaimLeafData>, operatorSigningResults: LeafRefundTxSigningResult[], adaptorPubKey?: Uint8Array): Promise<NodeSignatures[]>;
179
- private prepareSendTransferKeyTweaks;
180
- private prepareSingleSendTransferKeyTweak;
181
- protected findShare(shares: VerifiableSecretShare[], operatorID: number): VerifiableSecretShare | undefined;
182
- private compareTransfers;
183
- }
184
- declare class TransferService extends BaseTransferService {
185
- constructor(config: WalletConfigService, connectionManager: ConnectionManager, signingService: SigningService);
186
- /**
187
- * @deprecated Use sendTransferWithKeyTweaks instead
188
- * Deprecated in v0.1.32
189
- */
190
- sendTransfer(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array): Promise<Transfer>;
191
- claimTransfer(transfer: Transfer, leaves: LeafKeyTweak[]): Promise<FinalizeNodeSignaturesResponse>;
192
- queryPendingTransfers(): Promise<QueryTransfersResponse>;
193
- queryAllTransfers(limit: number, offset: number): Promise<QueryTransfersResponse>;
194
- verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
195
- queryTransfer(transferId: string): Promise<Transfer | undefined>;
196
- sendTransferSignRefund(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, expiryTime: Date): Promise<{
197
- transfer: Transfer;
198
- signatureMap: Map<string, Uint8Array>;
199
- leafDataMap: Map<string, LeafRefundSigningData>;
200
- }>;
201
- startSwapSignRefund(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, expiryTime: Date): Promise<{
202
- transfer: Transfer;
203
- signatureMap: Map<string, Uint8Array>;
204
- leafDataMap: Map<string, LeafRefundSigningData>;
205
- }>;
206
- counterSwapSignRefund(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, expiryTime: Date, adaptorPubKey?: Uint8Array): Promise<{
207
- transfer: Transfer;
208
- signatureMap: Map<string, Uint8Array>;
209
- leafDataMap: Map<string, LeafRefundSigningData>;
210
- signingResults: LeafRefundTxSigningResult[];
211
- }>;
212
- sendTransferSignRefundInternal(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, expiryTime: Date, forSwap: boolean, adaptorPubKey?: Uint8Array): Promise<{
213
- transfer: Transfer;
214
- signatureMap: Map<string, Uint8Array>;
215
- leafDataMap: Map<string, LeafRefundSigningData>;
216
- signingResults: LeafRefundTxSigningResult[];
217
- }>;
218
- private prepareRefundSoSigningJobs;
219
- claimTransferTweakKeys(transfer: Transfer, leaves: LeafKeyTweak[]): Promise<Map<string, Uint8Array[]>>;
220
- private prepareClaimLeavesKeyTweaks;
221
- private prepareClaimLeafKeyTweaks;
222
- claimTransferSignRefunds(transfer: Transfer, leafKeys: LeafKeyTweak[], proofMap?: Map<string, Uint8Array[]>): Promise<NodeSignatures[]>;
223
- private finalizeNodeSignatures;
224
- cancelTransfer(transfer: Transfer, operatorAddress: string): Promise<Transfer | undefined>;
225
- queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
226
- refreshTimelockNodes(nodes: TreeNode[], parentNode: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
227
- extendTimelock(node: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
228
- refreshTimelockRefundTx(node: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
229
- }
230
-
231
- type CreateLightningInvoiceParams = {
232
- amountSats: number;
233
- memo?: string;
234
- expirySeconds?: number;
235
- includeSparkAddress?: boolean;
236
- receiverIdentityPubkey?: string;
237
- descriptionHash?: string;
238
- };
239
- type PayLightningInvoiceParams = {
240
- invoice: string;
241
- maxFeeSats: number;
242
- preferSpark?: boolean;
243
- amountSatsToSend?: number;
244
- };
245
- type TransferParams = {
246
- amountSats: number;
247
- receiverSparkAddress: string;
248
- };
249
- type DepositParams = {
250
- signingPubKey: Uint8Array;
251
- verifyingKey: Uint8Array;
252
- depositTx: Transaction;
253
- vout: number;
254
- };
255
- type TokenInfo = {
256
- tokenPublicKey: string;
257
- tokenName: string;
258
- tokenSymbol: string;
259
- tokenDecimals: number;
260
- maxSupply: bigint;
261
- };
262
- type InitWalletResponse = {
263
- mnemonic?: string | undefined;
264
- };
265
- interface SparkWalletProps {
266
- mnemonicOrSeed?: Uint8Array | string;
267
- accountNumber?: number;
268
- signer?: SparkSigner;
269
- options?: ConfigOptions;
270
- }
271
- interface SparkWalletEvents {
272
- /** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
273
- "transfer:claimed": (transferId: string, updatedBalance: number) => void;
274
- /** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
275
- "deposit:confirmed": (depositId: string, updatedBalance: number) => void;
276
- /** Emitted when the stream is connected */
277
- "stream:connected": () => void;
278
- /** Emitted when the stream disconnects and fails to reconnect after max attempts */
279
- "stream:disconnected": (reason: string) => void;
280
- /** Emitted when attempting to reconnect the stream */
281
- "stream:reconnecting": (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
282
- }
283
-
284
- /**
285
- * The SparkWallet class is the primary interface for interacting with the Spark network.
286
- * It provides methods for creating and managing wallets, handling deposits, executing transfers,
287
- * and interacting with the Lightning Network.
288
- */
289
- declare class SparkWallet extends EventEmitter {
290
- protected config: WalletConfigService;
291
- protected connectionManager: ConnectionManager;
292
- protected lrc20ConnectionManager: Lrc20ConnectionManager;
293
- protected lrc20Wallet: LRCWallet | undefined;
294
- protected transferService: TransferService;
295
- protected tracerId: string;
296
- private depositService;
297
- private treeCreationService;
298
- private lightningService;
299
- private coopExitService;
300
- private signingService;
301
- private tokenTransactionService;
302
- private claimTransferMutex;
303
- private leavesMutex;
304
- private optimizationInProgress;
305
- private sspClient;
306
- private mutexes;
307
- private pendingWithdrawnOutputIds;
308
- private sparkAddress;
309
- private streamController;
310
- protected leaves: TreeNode[];
311
- protected tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>;
312
- private claimTransfersInterval;
313
- protected wrapWithOtelSpan<T>(name: string, fn: (...args: any[]) => Promise<T>): (...args: any[]) => Promise<T>;
314
- protected constructor(options?: ConfigOptions, signer?: SparkSigner);
315
- static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
316
- mnemonic?: string | undefined;
317
- wallet: SparkWallet;
318
- }>;
319
- private initializeWallet;
320
- private getSspClient;
321
- private handleStreamEvent;
322
- protected setupBackgroundStream(): Promise<void>;
323
- getLeaves(isBalanceCheck?: boolean): Promise<TreeNode[]>;
324
- private selectLeaves;
325
- private selectLeavesForSwap;
326
- private areLeavesInefficient;
327
- private optimizeLeaves;
328
- private syncWallet;
329
- private withLeaves;
330
- /**
331
- * Gets the identity public key of the wallet.
332
- *
333
- * @returns {Promise<string>} The identity public key as a hex string.
334
- */
335
- getIdentityPublicKey(): Promise<string>;
336
- /**
337
- * Gets the Spark address of the wallet.
338
- *
339
- * @returns {Promise<string>} The Spark address as a hex string.
340
- */
341
- getSparkAddress(): Promise<SparkAddressFormat>;
342
- createSparkPaymentIntent(assetIdentifier?: string, assetAmount?: bigint, memo?: string): Promise<SparkAddressFormat>;
343
- /**
344
- * Initializes the wallet using either a mnemonic phrase or a raw seed.
345
- * initWallet will also claim any pending incoming lightning payment, spark transfer,
346
- * or bitcoin deposit.
347
- *
348
- * @param {Uint8Array | string} [mnemonicOrSeed] - (Optional) Either:
349
- * - A BIP-39 mnemonic phrase as string
350
- * - A raw seed as Uint8Array or hex string
351
- * If not provided, generates a new mnemonic and uses it to create a new wallet
352
- *
353
- * @param {number} [accountNumber] - (Optional) The account number to use for the wallet. Defaults to 1 to maintain backwards compatability for legacy mainnet wallets.
354
- *
355
- * @returns {Promise<Object>} Object containing:
356
- * - mnemonic: The mnemonic if one was generated (undefined for raw seed)
357
- * - balance: The wallet's initial balance in satoshis
358
- * - tokenBalance: Map of token balances
359
- * @private
360
- */
361
- protected initWallet(mnemonicOrSeed?: Uint8Array | string, accountNumber?: number): Promise<InitWalletResponse | undefined>;
362
- /**
363
- * Initializes a wallet from a seed.
364
- *
365
- * @param {Uint8Array | string} seed - The seed to initialize the wallet from
366
- * @returns {Promise<string>} The identity public key
367
- * @private
368
- */
369
- private initWalletFromSeed;
370
- /**
371
- * Gets the estimated fee for a swap of leaves.
372
- *
373
- * @param amountSats - The amount of sats to swap
374
- * @returns {Promise<LeavesSwapFeeEstimateOutput>} The estimated fee for the swap
375
- */
376
- getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput>;
377
- /**
378
- * Requests a swap of leaves to optimize wallet structure.
379
- *
380
- * @param {Object} params - Parameters for the leaves swap
381
- * @param {number} [params.targetAmount] - Target amount for the swap
382
- * @param {TreeNode[]} [params.leaves] - Specific leaves to swap
383
- * @returns {Promise<Object>} The completed swap response
384
- * @private
385
- */
386
- private requestLeavesSwap;
387
- /**
388
- * Processes a single batch of leaves for swapping.
389
- */
390
- private processSwapBatch;
391
- /**
392
- * Gets all transfers for the wallet.
393
- *
394
- * @param {number} [limit=20] - Maximum number of transfers to return
395
- * @param {number} [offset=0] - Offset for pagination
396
- * @returns {Promise<QueryTransfersResponse>} Response containing the list of transfers
397
- */
398
- getTransfers(limit?: number, offset?: number): Promise<{
399
- transfers: WalletTransfer[];
400
- offset: number;
401
- }>;
402
- /**
403
- * Gets the held token info for the wallet.
404
- *
405
- * @deprecated The information is returned in getBalance
406
- */
407
- getTokenInfo(): Promise<TokenInfo[]>;
408
- /**
409
- * Gets the current balance of the wallet.
410
- * You can use the forceRefetch option to synchronize your wallet and claim any
411
- * pending incoming lightning payment, spark transfer, or bitcoin deposit before returning the balance.
412
- *
413
- * @returns {Promise<Object>} Object containing:
414
- * - balance: The wallet's current balance in satoshis
415
- * - tokenBalances: Map of token public keys to token balances and token info
416
- */
417
- getBalance(): Promise<{
418
- balance: bigint;
419
- tokenBalances: Map<string, {
420
- balance: bigint;
421
- tokenInfo: TokenInfo;
422
- }>;
423
- }>;
424
- private getTokenBalance;
425
- private getInternalBalance;
426
- /**
427
- * Generates a new deposit address for receiving bitcoin funds.
428
- * Note that this function returns a bitcoin address, not a spark address, and this address is single use.
429
- * Once you deposit funds to this address, it cannot be used again.
430
- * For Layer 1 Bitcoin deposits, Spark generates Pay to Taproot (P2TR) addresses.
431
- * These addresses start with "bc1p" and can be used to receive Bitcoin from any wallet.
432
- *
433
- * @returns {Promise<string>} A Bitcoin address for depositing funds
434
- */
435
- getSingleUseDepositAddress(): Promise<string>;
436
- /**
437
- * Generates a new static deposit address for receiving bitcoin funds.
438
- * This address is permanent and can be used multiple times.
439
- *
440
- * @returns {Promise<string>} A Bitcoin address for depositing funds
441
- */
442
- getStaticDepositAddress(): Promise<string>;
443
- /**
444
- * Generates a deposit address for receiving funds.
445
- *
446
- * @param {boolean} static - Whether the address is static or single use
447
- * @returns {Promise<string>} A deposit address
448
- * @private
449
- */
450
- private generateDepositAddress;
451
- queryStaticDepositAddresses(): Promise<string[]>;
452
- /**
453
- * Get a quote on how much credit you can claim for a deposit from the SSP.
454
- *
455
- * @param {string} transactionId - The ID of the transaction
456
- * @param {number} [outputIndex] - The index of the output
457
- * @returns {Promise<StaticDepositQuoteOutput>} Quote for claiming a deposit to a static deposit address
458
- */
459
- getClaimStaticDepositQuote(transactionId: string, outputIndex?: number): Promise<StaticDepositQuoteOutput>;
460
- /**
461
- * Claims a deposit to a static deposit address.
462
- *
463
- * @param {string} transactionId - The ID of the transaction
464
- * @param {number} creditAmountSats - The amount of credit to claim
465
- * @param {string} sspSignature - The SSP signature for the deposit
466
- * @param {number} [outputIndex] - The index of the output
467
- * @returns {Promise<RequestClaimDepositQuoteOutput | null>} Quote for claiming a deposit to a static deposit address
468
- */
469
- claimStaticDeposit({ transactionId, creditAmountSats, sspSignature, outputIndex, }: {
470
- transactionId: string;
471
- creditAmountSats: number;
472
- sspSignature: string;
473
- outputIndex?: number;
474
- }): Promise<ClaimStaticDepositOutput | null>;
475
- /**
476
- * Refunds a static deposit to a destination address.
477
- *
478
- * @param {string} depositTransactionId - The ID of the transaction
479
- * @param {number} [outputIndex] - The index of the output
480
- * @param {string} destinationAddress - The destination address
481
- * @param {number} fee - The fee to refund
482
- * @returns {Promise<string>} The hex of the refund transaction
483
- */
484
- refundStaticDeposit({ depositTransactionId, outputIndex, destinationAddress, fee, }: {
485
- depositTransactionId: string;
486
- outputIndex?: number;
487
- destinationAddress: string;
488
- fee: number;
489
- }): Promise<string>;
490
- private getStaticDepositSigningPayload;
491
- private getDepositTransactionVout;
492
- private getDepositTransaction;
493
- /**
494
- * Finalizes a deposit to the wallet.
495
- *
496
- * @param {DepositParams} params - Parameters for finalizing the deposit
497
- * @returns {Promise<void>} The nodes created from the deposit
498
- * @private
499
- */
500
- private finalizeDeposit;
501
- /**
502
- * Gets all unused deposit addresses for the wallet.
503
- *
504
- * @returns {Promise<string[]>} The unused deposit addresses
505
- */
506
- getUnusedDepositAddresses(): Promise<string[]>;
507
- /**
508
- * Claims a deposit to the wallet.
509
- * Note that if you used advancedDeposit, you don't need to call this function.
510
- * @param {string} txid - The transaction ID of the deposit
511
- * @returns {Promise<WalletLeaf[] | undefined>} The nodes resulting from the deposit
512
- */
513
- claimDeposit(txid: string): Promise<WalletLeaf[]>;
514
- /**
515
- * Non-trusty flow for depositing funds to the wallet.
516
- * Construct the tx spending from an L1 wallet to the Spark address.
517
- * After calling this function, you must sign and broadcast the tx.
518
- *
519
- * @param {string} txHex - The hex string of the transaction to deposit
520
- * @returns {Promise<TreeNode[] | undefined>} The nodes resulting from the deposit
521
- */
522
- advancedDeposit(txHex: string): Promise<TreeNode[]>;
523
- /**
524
- * Transfers deposit to self to claim ownership.
525
- *
526
- * @param {TreeNode[]} leaves - The leaves to transfer
527
- * @param {Uint8Array} signingPubKey - The signing public key
528
- * @returns {Promise<TreeNode[] | undefined>} The nodes resulting from the transfer
529
- * @private
530
- */
531
- private transferLeavesToSelf;
532
- /**
533
- * Sends a transfer to another Spark user.
534
- *
535
- * @param {TransferParams} params - Parameters for the transfer
536
- * @param {string} params.receiverSparkAddress - The recipient's Spark address
537
- * @param {number} params.amountSats - Amount to send in satoshis
538
- * @returns {Promise<WalletTransfer>} The completed transfer details
539
- */
540
- transfer({ amountSats, receiverSparkAddress, }: TransferParams): Promise<WalletTransfer>;
541
- private checkExtendTimeLockNodes;
542
- /**
543
- * Internal method to refresh timelock nodes.
544
- *
545
- * @param {string} nodeId - The optional ID of the node to refresh. If not provided, all nodes will be checked.
546
- * @returns {Promise<void>}
547
- * @private
548
- */
549
- private checkRefreshTimelockNodes;
550
- /**
551
- * Claims a specific transfer.
552
- *
553
- * @param {Transfer} transfer - The transfer to claim
554
- * @returns {Promise<Object>} The claim result
555
- */
556
- private claimTransfer;
557
- /**
558
- * Claims all pending transfers.
559
- *
560
- * @returns {Promise<string[]>} Array of successfully claimed transfer IDs
561
- * @private
562
- */
563
- private claimTransfers;
564
- /**
565
- * Cancels all sender-initiated transfers.
566
- *
567
- * @returns {Promise<void>}
568
- * @private
569
- */
570
- private cancelAllSenderInitiatedTransfers;
571
- /**
572
- * Creates a Lightning invoice for receiving payments.
573
- *
574
- * @param {Object} params - Parameters for the lightning invoice
575
- * @param {number} params.amountSats - Amount in satoshis
576
- * @param {string} [params.memo] - Description for the invoice. Should not be provided if the descriptionHash is provided.
577
- * @param {number} [params.expirySeconds] - Optional expiry time in seconds
578
- * @param {boolean} [params.includeSparkAddress] - Optional boolean signalling whether or not to include the spark address in the invoice
579
- * @param {string} [params.receiverIdentityPubkey] - Optional public key of the wallet receiving the lightning invoice. If not present, the receiver will be the creator of this request.
580
- * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive with the memo field. Only one or the other should be provided.
581
- * @returns {Promise<LightningReceiveRequest>} BOLT11 encoded invoice
582
- */
583
- createLightningInvoice({ amountSats, memo, expirySeconds, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: CreateLightningInvoiceParams): Promise<LightningReceiveRequest>;
584
- /**
585
- * Pays a Lightning invoice.
586
- *
587
- * @param {Object} params - Parameters for paying the invoice
588
- * @param {string} params.invoice - The BOLT11-encoded Lightning invoice to pay
589
- * @param {boolean} [params.preferSpark] - Whether to prefer a spark transfer over lightning for the payment
590
- * @param {number} [params.amountSatsToSend] - The amount in sats to send. This is only valid for 0 amount lightning invoices.
591
- * @returns {Promise<LightningSendRequest>} The Lightning payment request details
592
- */
593
- payLightningInvoice({ invoice, maxFeeSats, preferSpark, amountSatsToSend, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
594
- /**
595
- * Gets fee estimate for sending Lightning payments.
596
- *
597
- * @param {LightningSendFeeEstimateInput} params - Input parameters for fee estimation
598
- * @returns {Promise<number>} Fee estimate for sending Lightning payments
599
- */
600
- getLightningSendFeeEstimate({ encodedInvoice, amountSats, }: LightningSendFeeEstimateInput): Promise<number>;
601
- /**
602
- * Generates a deposit address for a tree.
603
- *
604
- * @param {number} vout - The vout index
605
- * @param {Uint8Array} parentSigningPubKey - The parent signing public key
606
- * @param {Transaction} [parentTx] - Optional parent transaction
607
- * @param {TreeNode} [parentNode] - Optional parent node
608
- * @returns {Promise<Object>} Deposit address information
609
- * @private
610
- */
611
- private generateDepositAddressForTree;
612
- /**
613
- * Creates a tree structure.
614
- *
615
- * @param {number} vout - The vout index
616
- * @param {DepositAddressTree} root - The root of the tree
617
- * @param {boolean} createLeaves - Whether to create leaves
618
- * @param {Transaction} [parentTx] - Optional parent transaction
619
- * @param {TreeNode} [parentNode] - Optional parent node
620
- * @returns {Promise<Object>} The created tree
621
- * @private
622
- */
623
- private createTree;
624
- /**
625
- * Initiates a withdrawal to move funds from the Spark network to an on-chain Bitcoin address.
626
- *
627
- * @param {Object} params - Parameters for the withdrawal
628
- * @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
629
- * @param {number} [params.amountSats] - The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds
630
- * @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
631
- */
632
- withdraw({ onchainAddress, exitSpeed, amountSats, }: {
633
- onchainAddress: string;
634
- exitSpeed: ExitSpeed;
635
- amountSats?: number;
636
- }): Promise<CoopExitRequest | null>;
637
- /**
638
- * Internal method to perform a cooperative exit (withdrawal).
639
- *
640
- * @param {string} onchainAddress - The Bitcoin address where the funds should be sent
641
- * @param {number} [targetAmountSats] - The amount in satoshis to withdraw
642
- * @returns {Promise<Object | null | undefined>} The exit request details
643
- * @private
644
- */
645
- private coopExit;
646
- /**
647
- * Gets fee estimate for cooperative exit (on-chain withdrawal).
648
- *
649
- * @param {Object} params - Input parameters for fee estimation
650
- * @param {number} params.amountSats - The amount in satoshis to withdraw
651
- * @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
652
- * @returns {Promise<CoopExitFeeEstimatesOutput | null>} Fee estimate for the withdrawal
653
- */
654
- getWithdrawalFeeEstimate({ amountSats, withdrawalAddress, }: {
655
- amountSats: number;
656
- withdrawalAddress: string;
657
- }): Promise<CoopExitFeeEstimatesOutput | null>;
658
- /**
659
- * Gets a transfer that has been sent by the SSP to the wallet.
660
- *
661
- * @param {string} id - The ID of the transfer
662
- * @returns {Promise<GraphQLTransferObj | null>} The transfer
663
- */
664
- getTransferFromSsp(id: string): Promise<Transfer$1 | null>;
665
- /**
666
- * Gets a transfer, that the wallet is a participant of, in the Spark network.
667
- * Only contains data about the spark->spark transfer, use getTransferFromSsp if you're
668
- * looking for information related to a lightning transfer.
669
- *
670
- * @param {string} id - The ID of the transfer
671
- * @returns {Promise<Transfer | undefined>} The transfer
672
- */
673
- getTransfer(id: string): Promise<Transfer | undefined>;
674
- /**
675
- * Synchronizes token outputs for the wallet.
676
- *
677
- * @returns {Promise<void>}
678
- * @private
679
- */
680
- protected syncTokenOutputs(): Promise<void>;
681
- /**
682
- * Transfers tokens to another user.
683
- *
684
- * @param {Object} params - Parameters for the token transfer
685
- * @param {string} params.tokenPublicKey - The public key of the token to transfer
686
- * @param {bigint} params.tokenAmount - The amount of tokens to transfer
687
- * @param {string} params.receiverSparkAddress - The recipient's public key
688
- * @param {OutputWithPreviousTransactionData[]} [params.selectedOutputs] - Optional specific leaves to use for the transfer
689
- * @returns {Promise<string>} The transaction ID of the token transfer
690
- */
691
- transferTokens({ tokenPublicKey, tokenAmount, receiverSparkAddress, outputSelectionStrategy, selectedOutputs, }: {
692
- tokenPublicKey: string;
693
- tokenAmount: bigint;
694
- receiverSparkAddress: string;
695
- outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST";
696
- selectedOutputs?: OutputWithPreviousTransactionData[];
697
- }): Promise<string>;
698
- /**
699
- * Transfers tokens with multiple outputs
700
- *
701
- * @param {Array} receiverOutputs - Array of transfer parameters
702
- * @param {string} receiverOutputs[].tokenPublicKey - The public key of the token to transfer
703
- * @param {bigint} receiverOutputs[].tokenAmount - The amount of tokens to transfer
704
- * @param {string} receiverOutputs[].receiverSparkAddress - The recipient's public key
705
- * @param {OutputWithPreviousTransactionData[]} [selectedOutputs] - Optional specific leaves to use for the transfer
706
- * @returns {Promise<string[]>} Array of transaction IDs for the token transfers
707
- */
708
- batchTransferTokens(receiverOutputs: {
709
- tokenPublicKey: string;
710
- tokenAmount: bigint;
711
- receiverSparkAddress: string;
712
- }[], outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST", selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
713
- /**
714
- * Retrieves token transaction history for specified tokens owned by the wallet.
715
- * Can optionally filter by specific transaction hashes.
716
- *
717
- * @param tokenPublicKeys - Array of token public keys to query transactions for
718
- * @param tokenTransactionHashes - Optional array of specific transaction hashes to filter by
719
- * @returns Promise resolving to array of token transactions with their current status
720
- */
721
- queryTokenTransactions(tokenPublicKeys: string[], tokenTransactionHashes?: string[]): Promise<TokenTransactionWithStatus[]>;
722
- getTokenL1Address(): Promise<string>;
723
- /**
724
- * Signs a message with the identity key.
725
- *
726
- * @param {string} message - The message to sign
727
- * @param {boolean} [compact] - Whether to use compact encoding. If false, the message will be encoded as DER.
728
- * @returns {Promise<string>} The signed message
729
- */
730
- signMessageWithIdentityKey(message: string, compact?: boolean): Promise<string>;
731
- /**
732
- * Validates a message with the identity key.
733
- *
734
- * @param {string} message - The original message that was signed
735
- * @param {string | Uint8Array} signature - Signature to validate
736
- * @returns {Promise<boolean>} Whether the message is valid
737
- */
738
- validateMessageWithIdentityKey(message: string, signature: string | Uint8Array): Promise<boolean>;
739
- /**
740
- * Signs a transaction with wallet keys.
741
- *
742
- * @param {string} txHex - The transaction hex to sign
743
- * @param {string} keyType - The type of key to use for signing ("identity", "deposit", or "auto-detect")
744
- * @returns {Promise<string>} The signed transaction hex
745
- */
746
- signTransaction(txHex: string, keyType?: string): Promise<string>;
747
- /**
748
- * Helper method to auto-detect which key should be used for signing a transaction.
749
- */
750
- private detectKeyForTransaction;
751
- /**
752
- * Get a Lightning receive request by ID.
753
- *
754
- * @param {string} id - The ID of the Lightning receive request
755
- * @returns {Promise<LightningReceiveRequest | null>} The Lightning receive request
756
- */
757
- getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
758
- /**
759
- * Get a Lightning send request by ID.
760
- *
761
- * @param {string} id - The ID of the Lightning send request
762
- * @returns {Promise<LightningSendRequest | null>} The Lightning send request
763
- */
764
- getLightningSendRequest(id: string): Promise<LightningSendRequest | null>;
765
- /**
766
- * Get a coop exit request by ID.
767
- *
768
- * @param {string} id - The ID of the coop exit request
769
- * @returns {Promise<CoopExitRequest | null>} The coop exit request
770
- */
771
- getCoopExitRequest(id: string): Promise<CoopExitRequest | null>;
772
- /**
773
- * Check the remaining timelock on a given node.
774
- *
775
- * @param {string} nodeId - The ID of the node to check
776
- * @returns {Promise<{nodeTimelock: number, refundTimelock: number}>} The remaining timelocks in blocks for both node and refund transactions
777
- */
778
- checkTimelock(nodeId: string): Promise<{
779
- nodeTimelock: number;
780
- refundTimelock: number;
781
- }>;
782
- /**
783
- * Refresh the timelock of a specific node.
784
- *
785
- * @param {string} nodeId - The ID of the node to refresh
786
- * @returns {Promise<void>} Promise that resolves when the timelock is refreshed
787
- */
788
- testOnly_expireTimelock(nodeId: string): Promise<void>;
789
- /**
790
- * Refresh the timelock of a specific node's refund transaction only.
791
- *
792
- * @param {string} nodeId - The ID of the node whose refund transaction to refresh
793
- * @returns {Promise<void>} Promise that resolves when the refund timelock is refreshed
794
- */
795
- testOnly_expireTimelockRefundTx(nodeId: string): Promise<void>;
796
- private cleanup;
797
- cleanupConnections(): Promise<void>;
798
- private startPeriodicClaimTransfers;
799
- private updateLeaves;
800
- private queryNodes;
801
- }
802
-
803
- declare class DummyTx {
804
- private constructor();
805
- free(): void;
806
- tx: Uint8Array;
807
- txid: string;
808
- }
809
-
810
- declare function createDummyTx({ address, amountSats, }: {
811
- address: string;
812
- amountSats: bigint;
813
- }): DummyTx;
814
-
815
- export { AuthenticationError as A, ConfigurationError as C, type DepositParams as D, type InitWalletResponse as I, NetworkError as N, type PayLightningInvoiceParams as P, RPCError as R, SparkWallet as S, type TransferParams as T, ValidationError as V, SparkSDKError as a, InternalValidationError as b, createDummyTx as c, NotImplementedError as d, type CreateLightningInvoiceParams as e, type TokenInfo as f, type SparkWalletProps as g, type SparkWalletEvents as h };