@buildonspark/spark-sdk 0.3.7 → 0.3.9

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 (87) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/bare/index.cjs +8088 -7723
  3. package/dist/bare/index.d.cts +350 -262
  4. package/dist/bare/index.d.ts +350 -262
  5. package/dist/bare/index.js +7968 -7608
  6. package/dist/{chunk-J2P3KTQP.js → chunk-4YFT7DAE.js} +1 -1
  7. package/dist/{chunk-XWLR6G5C.js → chunk-JLF6WJ7K.js} +1 -1
  8. package/dist/{chunk-UYTT3C6H.js → chunk-MFCM6GUD.js} +40 -213
  9. package/dist/{chunk-KDEVNW7C.js → chunk-O4C4HGQL.js} +3391 -3292
  10. package/dist/{chunk-SRPKOCG4.js → chunk-S55NZT4P.js} +8 -10
  11. package/dist/{chunk-P4HYYSMU.js → chunk-WRE2T22S.js} +1 -1
  12. package/dist/{chunk-IC4IUEOS.js → chunk-YEBEN7XD.js} +309 -38
  13. package/dist/{client-Bcb7TUIp.d.cts → client-BIqiUNy4.d.cts} +2 -2
  14. package/dist/{client-D9T58OY8.d.ts → client-BaQf-5gD.d.ts} +2 -2
  15. package/dist/debug.cjs +8068 -7704
  16. package/dist/debug.d.cts +25 -18
  17. package/dist/debug.d.ts +25 -18
  18. package/dist/debug.js +5 -5
  19. package/dist/graphql/objects/index.d.cts +3 -3
  20. package/dist/graphql/objects/index.d.ts +3 -3
  21. package/dist/index.cjs +6871 -6501
  22. package/dist/index.d.cts +9 -8
  23. package/dist/index.d.ts +9 -8
  24. package/dist/index.js +36 -24
  25. package/dist/index.node.cjs +7102 -6903
  26. package/dist/index.node.d.cts +9 -8
  27. package/dist/index.node.d.ts +9 -8
  28. package/dist/index.node.js +35 -23
  29. package/dist/{logging-zkr4UlOi.d.cts → logging-CXhvuqJJ.d.cts} +45 -35
  30. package/dist/{logging-JIaZZIbR.d.ts → logging-DDeMLsVN.d.ts} +45 -35
  31. package/dist/native/{chunk-X2QXUON7.js → chunk-AFP5QR4O.js} +11 -8
  32. package/dist/native/index.react-native.cjs +7054 -6677
  33. package/dist/native/index.react-native.d.cts +180 -92
  34. package/dist/native/index.react-native.d.ts +180 -92
  35. package/dist/native/index.react-native.js +6760 -6393
  36. package/dist/native/{wasm-GKEDPGTM.js → wasm-D4TI35NF.js} +1 -1
  37. package/dist/proto/spark.cjs +309 -38
  38. package/dist/proto/spark.d.cts +1 -1
  39. package/dist/proto/spark.d.ts +1 -1
  40. package/dist/proto/spark.js +5 -1
  41. package/dist/proto/spark_token.d.cts +1 -1
  42. package/dist/proto/spark_token.d.ts +1 -1
  43. package/dist/proto/spark_token.js +2 -2
  44. package/dist/{spark-WA_4wcBr.d.cts → spark-DOpheE8_.d.cts} +69 -7
  45. package/dist/{spark-WA_4wcBr.d.ts → spark-DOpheE8_.d.ts} +69 -7
  46. package/dist/{spark-wallet.browser-DC3jdQPW.d.cts → spark-wallet.browser-CbYo8A_U.d.cts} +8 -8
  47. package/dist/{spark-wallet.browser-BwYkkOBU.d.ts → spark-wallet.browser-Cz8c4kOW.d.ts} +8 -8
  48. package/dist/{spark-wallet.node-CR_zNxmy.d.cts → spark-wallet.node-4WQgWwB2.d.cts} +9 -31
  49. package/dist/{spark-wallet.node-C9d2W-Nb.d.ts → spark-wallet.node-CmIvxtcC.d.ts} +9 -31
  50. package/dist/tests/test-utils.cjs +7341 -7065
  51. package/dist/tests/test-utils.d.cts +7 -5
  52. package/dist/tests/test-utils.d.ts +7 -5
  53. package/dist/tests/test-utils.js +7 -7
  54. package/dist/{token-transactions-BZoJuvuE.d.ts → token-transactions-Bu023ztN.d.ts} +2 -2
  55. package/dist/{token-transactions-I_OFIoNH.d.cts → token-transactions-CV8QD3I7.d.cts} +2 -2
  56. package/dist/types/index.cjs +307 -38
  57. package/dist/types/index.d.cts +2 -2
  58. package/dist/types/index.d.ts +2 -2
  59. package/dist/types/index.js +2 -2
  60. package/dist/{spark-wallet-CE5PYiIb.d.ts → wallet-config-Bmk2eAn8.d.ts} +310 -287
  61. package/dist/{spark-wallet-BuFrUWeE.d.cts → wallet-config-DQw5llqA.d.cts} +310 -287
  62. package/package.json +3 -3
  63. package/src/proto/mock.ts +0 -264
  64. package/src/proto/spark.ts +433 -46
  65. package/src/services/config.ts +5 -0
  66. package/src/services/connection/connection.browser.ts +27 -19
  67. package/src/services/connection/connection.node.ts +79 -24
  68. package/src/services/connection/connection.ts +395 -233
  69. package/src/services/coop-exit.ts +26 -107
  70. package/src/services/deposit.ts +12 -48
  71. package/src/services/lightning.ts +30 -4
  72. package/src/services/signing.ts +187 -37
  73. package/src/services/transfer.ts +553 -723
  74. package/src/services/wallet-config.ts +6 -0
  75. package/src/spark-wallet/proto-descriptors.ts +1 -1
  76. package/src/spark-wallet/spark-wallet.ts +132 -313
  77. package/src/spark-wallet/types.ts +2 -2
  78. package/src/spark_descriptors.pb +0 -0
  79. package/src/tests/connection.test.ts +537 -0
  80. package/src/tests/integration/connection.test.ts +39 -0
  81. package/src/tests/integration/lightning.test.ts +32 -16
  82. package/src/tests/integration/static_deposit.test.ts +13 -11
  83. package/src/tests/integration/transfer.test.ts +13 -1
  84. package/src/tests/isHermeticTest.ts +1 -1
  85. package/src/tests/utils/test-faucet.ts +53 -20
  86. package/src/utils/htlc-transactions.ts +224 -0
  87. package/src/utils/transaction.ts +285 -248
@@ -1,13 +1,15 @@
1
- import { B as BitcoinNetwork, M as MayHaveSspClientOptions, t as SspClientOptions, H as HasSspClientOptions, S as SparkSigner, l as KeyDerivation, i as SigningCommitmentWithOptionalNonce, V as VerifiableSecretShare, W as WalletTransfer, D as DefaultSparkSigner, L as LeavesSwapFeeEstimateOutput, u as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, w as WalletLeaf, x as LightningReceiveRequest, y as LightningSendRequest, z as LightningSendFeeEstimateInput, E as ExitSpeed, F as CoopExitFeeQuote, G as CoopExitRequest, I as TransferWithUserRequest } from './client-Bcb7TUIp.cjs';
2
- import { N as Network$1, d as SparkServiceClient, b as SparkServiceDefinition, e as SparkInvoiceFields, R as RequestedSigningCommitments, U as UserSignedTxSigningJob, c as TreeNode, T as Transfer, L as LeafRefundTxSigningResult, f as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, O as OutputWithPreviousTransactionData, g as QuerySparkInvoicesResponse } from './spark-WA_4wcBr.cjs';
3
- import { SparkTokenServiceClient, SparkTokenServiceDefinition, TokenMetadata, QueryTokenTransactionsResponse } from './proto/spark_token.cjs';
1
+ import { B as BitcoinNetwork, H as HasSspClientOptions, S as SparkSigner, t as SspClientOptions, l as KeyDerivation, i as SigningCommitmentWithOptionalNonce, V as VerifiableSecretShare, D as DefaultSparkSigner, L as LeavesSwapFeeEstimateOutput, u as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, W as WalletLeaf, w as WalletTransfer, x as LightningReceiveRequest, y as LightningSendRequest, z as LightningSendFeeEstimateInput, E as ExitSpeed, F as CoopExitFeeQuote, G as CoopExitRequest, I as TransferWithUserRequest, M as MayHaveSspClientOptions } from './client-BIqiUNy4.cjs';
4
2
  import * as btc from '@scure/btc-signer';
5
3
  import { Transaction } from '@scure/btc-signer';
4
+ import { N as Network$1, e as SparkInvoiceFields, b as SparkServiceDefinition, f as SparkServiceClient, d as SubscribeToEventsResponse, R as RequestedSigningCommitments, U as UserSignedTxSigningJob, c as TreeNode, T as Transfer, g as StartTransferRequest, L as LeafRefundTxSigningResult, h as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, i as QuerySparkInvoicesResponse, O as OutputWithPreviousTransactionData } from './spark-DOpheE8_.cjs';
5
+ import { SparkTokenServiceDefinition, SparkTokenServiceClient, QueryTokenTransactionsResponse, TokenMetadata } from './proto/spark_token.cjs';
6
+ import * as _scure_base from '@scure/base';
6
7
  import { Channel } from 'nice-grpc';
7
- import { CallOptions, ClientMiddlewareCall, Metadata } from 'nice-grpc-common';
8
+ import { CallOptions, ClientMiddleware, ClientMiddlewareCall, Metadata } from 'nice-grpc-common';
8
9
  import { Channel as Channel$1 } from 'nice-grpc-web';
9
10
  import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
10
- import * as _scure_base from '@scure/base';
11
+ import { RetryOptions as RetryOptions$1 } from 'nice-grpc-client-middleware-retry';
12
+ import { TransactionOutput } from '@scure/btc-signer/psbt';
11
13
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
12
14
  import { EventEmitter } from 'eventemitter3';
13
15
 
@@ -37,37 +39,61 @@ declare function getNetworkFromAddress(address: string): BitcoinNetwork.MAINNET
37
39
  */
38
40
  declare function getNetworkFromString(network?: string): Network;
39
41
 
40
- type SigningOperator = {
41
- readonly id: number;
42
- readonly identifier: string;
43
- readonly address: string;
44
- readonly identityPublicKey: string;
45
- };
46
- type ConsoleOptions = {
47
- otel?: boolean;
48
- };
49
- type ConfigOptions = MayHaveSspClientOptions & {
50
- readonly network?: NetworkType;
51
- readonly signingOperators?: Readonly<Record<string, SigningOperator>>;
52
- readonly coordinatorIdentifier?: string;
53
- readonly frostSignerAddress?: string;
54
- readonly threshold?: number;
55
- readonly tokenSignatures?: "ECDSA" | "SCHNORR";
56
- readonly tokenValidityDurationSeconds?: number;
57
- readonly electrsUrl?: string;
58
- readonly sspClientOptions?: SspClientOptions;
59
- readonly expectedWithdrawBondSats?: number;
60
- readonly expectedWithdrawRelativeBlockLocktime?: number;
61
- readonly signerWithPreExistingKeys?: boolean;
62
- readonly console?: ConsoleOptions;
63
- };
64
- declare const WalletConfig: {
65
- LOCAL: Required<ConfigOptions>;
66
- LOCAL_SCHNORR: Required<ConfigOptions>;
67
- LOCAL_ECDSA: Required<ConfigOptions>;
68
- REGTEST: Required<ConfigOptions>;
69
- MAINNET: Required<ConfigOptions>;
42
+ declare const AddressNetwork: Record<NetworkType, string>;
43
+ declare const LegacyAddressNetwork: Record<NetworkType, string>;
44
+ type Bech32String = `${string}1${string}`;
45
+ type SparkAddressFormat = `${(typeof AddressNetwork)[keyof typeof AddressNetwork]}1${string}`;
46
+ type LegacySparkAddressFormat = `${(typeof LegacyAddressNetwork)[keyof typeof LegacyAddressNetwork]}1${string}`;
47
+ interface SparkAddressData {
48
+ identityPublicKey: string;
49
+ network: NetworkType;
50
+ sparkInvoiceFields?: SparkInvoiceFields;
51
+ }
52
+ interface DecodedSparkAddressData {
53
+ identityPublicKey: string;
54
+ network: NetworkType;
55
+ sparkInvoiceFields?: {
56
+ version: number;
57
+ id: string;
58
+ paymentType?: {
59
+ type: "tokens";
60
+ tokenIdentifier?: string;
61
+ amount?: bigint;
62
+ } | {
63
+ type: "sats";
64
+ amount?: number;
65
+ };
66
+ memo?: string;
67
+ senderPublicKey?: string;
68
+ expiryTime?: Date;
69
+ };
70
+ signature?: string;
71
+ }
72
+ declare function encodeSparkAddress(payload: SparkAddressData): LegacySparkAddressFormat;
73
+ declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): LegacySparkAddressFormat;
74
+ declare function decodeSparkAddress(address: string, network: NetworkType): DecodedSparkAddressData;
75
+ declare function getNetworkFromSparkAddress(address: string): NetworkType;
76
+ declare function isLegacySparkAddress(address: string): address is LegacySparkAddressFormat;
77
+ declare function isValidSparkAddress(address: string): boolean;
78
+ declare function isValidPublicKey(publicKey: string): void;
79
+ declare function validateSparkInvoiceFields(sparkInvoiceFields: SparkInvoiceFields): void;
80
+ declare function validateSparkInvoiceSignature(invoice: SparkAddressFormat): void;
81
+ declare function toProtoTimestamp(date: Date): {
82
+ seconds: number;
83
+ nanos: number;
70
84
  };
85
+ declare function assertBech32(s: string): asserts s is Bech32String;
86
+ declare function bech32mDecode(address: string): _scure_base.Bech32Decoded<string>;
87
+ declare function isSafeForNumber(bi: bigint): boolean;
88
+
89
+ type Bech32mTokenIdentifier = `btkn1${string}` | `btknrt1${string}` | `btknt1${string}` | `btkns1${string}` | `btknl1${string}`;
90
+ interface Bech32mTokenIdentifierData {
91
+ tokenIdentifier: Uint8Array;
92
+ network: NetworkType;
93
+ }
94
+ declare function encodeBech32mTokenIdentifier(payload: Bech32mTokenIdentifierData): Bech32mTokenIdentifier;
95
+ declare function decodeBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier, network?: NetworkType): Bech32mTokenIdentifierData;
96
+ declare function getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier): NetworkType;
71
97
 
72
98
  declare class WalletConfigService implements HasSspClientOptions {
73
99
  private readonly config;
@@ -91,6 +117,7 @@ declare class WalletConfigService implements HasSspClientOptions {
91
117
  getSspBaseUrl(): string;
92
118
  getSspIdentityPublicKey(): string;
93
119
  getConsoleOptions(): ConsoleOptions;
120
+ getEvents(): Partial<SparkWalletEvents>;
94
121
  }
95
122
 
96
123
  /** Challenge represents the core challenge data */
@@ -195,87 +222,55 @@ interface RetryOptions {
195
222
  }
196
223
  type SparkCallOptions = CallOptions & RetryOptions;
197
224
 
198
- declare class ConnectionManager {
199
- private config;
200
- protected clients: Map<string, {
201
- client: SparkServiceClient & {
202
- close?: () => void;
203
- };
204
- authToken: string;
225
+ type ChannelKey = string;
226
+ type BrowserOrNodeJSChannel = Channel | Channel$1;
227
+ type SparkClientType = "spark" | "stream" | "tokens";
228
+ type Address = string;
229
+ declare abstract class ConnectionManager {
230
+ private static channelCache;
231
+ private static channelInflight;
232
+ private static authTokenCache;
233
+ private static authInflight;
234
+ protected makeChannelKey(address: Address, stream?: boolean): ChannelKey;
235
+ protected static acquireChannel<T extends BrowserOrNodeJSChannel>(key: ChannelKey, create: () => Promise<T>): Promise<T>;
236
+ protected static releaseChannel(key: ChannelKey): void;
237
+ private static makeAuthTokenKey;
238
+ private static getCachedAuthToken;
239
+ private static setCachedAuthToken;
240
+ private static invalidateCachedAuthToken;
241
+ private static getOrCreateAuthToken;
242
+ protected abstract createChannelWithTLS(address: Address, isStreamClientType?: boolean): Promise<Channel | Channel$1>;
243
+ protected abstract createGrpcClient<T>(definition: SparkAuthnServiceDefinition | SparkServiceDefinition | SparkTokenServiceDefinition, channel: Channel | Channel$1, withRetries: boolean, middleware?: ClientMiddleware<RetryOptions$1, {}>, channelKey?: ChannelKey): Promise<T & {
244
+ close?: () => void;
205
245
  }>;
206
- private tokenClients;
207
- private streamClients;
208
- private authPromises;
246
+ private config;
247
+ private clientsByType;
248
+ private identityPublicKeyHex?;
209
249
  constructor(config: WalletConfigService);
210
250
  createClients(): Promise<void>;
211
251
  closeConnections(): Promise<void>;
212
- protected createChannelWithTLS(address: string, certPath?: string): Promise<Channel | Channel$1>;
213
- createSparkStreamClient(address: string, certPath?: string): Promise<SparkServiceClient & {
252
+ private getDefinitionForClientType;
253
+ protected static isStreamClientType(type: SparkClientType): type is "stream";
254
+ private getAddressToClientMap;
255
+ private getOrCreateClientInternal;
256
+ createSparkStreamClient(address: string): Promise<SparkServiceClient & {
214
257
  close?: () => void;
215
258
  }>;
216
- createSparkClient(address: string, certPath?: string): Promise<SparkServiceClient & {
259
+ createSparkClient(address: string): Promise<SparkServiceClient & {
217
260
  close?: () => void;
218
261
  }>;
219
- createSparkTokenClient(address: string, certPath?: string): Promise<SparkTokenServiceClient & {
262
+ createSparkTokenClient(address: string): Promise<SparkTokenServiceClient & {
220
263
  close?: () => void;
221
264
  }>;
222
- getStreamChannel(address: string): Promise<Channel | Channel$1 | undefined>;
223
- private authenticate;
265
+ getChannelForClient(clientType: SparkClientType, address: Address): Promise<BrowserOrNodeJSChannel | undefined>;
266
+ private getIdentityPublicKeyHex;
267
+ protected authenticate(address: string): Promise<string>;
224
268
  private createSparkAuthnGrpcConnection;
225
- protected createAuthnMiddleware(): (call: ClientMiddlewareCall<any, any>, options: SparkCallOptions) => AsyncGenerator<any, any, undefined>;
226
- protected createMiddleware(address: string, authToken: string): ((call: ClientMiddlewareCall<any, any>, options: SparkCallOptions) => AsyncGenerator<any, any, undefined>) | undefined;
227
- protected handleMiddlewareError(error: unknown, address: string, call: ClientMiddlewareCall<any, any>, metadata: Metadata, options: SparkCallOptions): AsyncGenerator<any, any, undefined>;
228
- protected createGrpcClient<T>(defintion: SparkAuthnServiceDefinition | SparkServiceDefinition | SparkTokenServiceDefinition, channel: Channel | Channel$1, withRetries: boolean, middleware?: any): Promise<T & {
229
- close?: () => void;
230
- }>;
231
- }
232
-
233
- declare const AddressNetwork: Record<NetworkType, string>;
234
- declare const LegacyAddressNetwork: Record<NetworkType, string>;
235
- type Bech32String = `${string}1${string}`;
236
- type SparkAddressFormat = `${(typeof AddressNetwork)[keyof typeof AddressNetwork]}1${string}`;
237
- type LegacySparkAddressFormat = `${(typeof LegacyAddressNetwork)[keyof typeof LegacyAddressNetwork]}1${string}`;
238
- interface SparkAddressData {
239
- identityPublicKey: string;
240
- network: NetworkType;
241
- sparkInvoiceFields?: SparkInvoiceFields;
269
+ protected createAuthnMiddleware(): <Req, Res>(call: ClientMiddlewareCall<Req, Res>, options: SparkCallOptions) => AsyncGenerator<Res, Res | void, undefined>;
270
+ protected createMiddleware(address: Address): <Req, Res>(call: ClientMiddlewareCall<Req, Res>, options: SparkCallOptions) => AsyncGenerator<Res, Res | void, undefined>;
271
+ protected handleMiddlewareError<Req, Res>(error: unknown, address: string, call: ClientMiddlewareCall<Req, Res>, metadata: Metadata, options: SparkCallOptions): AsyncGenerator<Awaited<Res>, void | Awaited<Res>, undefined>;
272
+ subscribeToEvents(address: string, signal: AbortSignal): Promise<AsyncIterable<SubscribeToEventsResponse>>;
242
273
  }
243
- interface DecodedSparkAddressData {
244
- identityPublicKey: string;
245
- network: NetworkType;
246
- sparkInvoiceFields?: {
247
- version: number;
248
- id: string;
249
- paymentType?: {
250
- type: "tokens";
251
- tokenIdentifier?: string;
252
- amount?: bigint;
253
- } | {
254
- type: "sats";
255
- amount?: number;
256
- };
257
- memo?: string;
258
- senderPublicKey?: string;
259
- expiryTime?: Date;
260
- };
261
- signature?: string;
262
- }
263
- declare function encodeSparkAddress(payload: SparkAddressData): LegacySparkAddressFormat;
264
- declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): LegacySparkAddressFormat;
265
- declare function decodeSparkAddress(address: string, network: NetworkType): DecodedSparkAddressData;
266
- declare function getNetworkFromSparkAddress(address: string): NetworkType;
267
- declare function isLegacySparkAddress(address: string): address is LegacySparkAddressFormat;
268
- declare function isValidSparkAddress(address: string): boolean;
269
- declare function isValidPublicKey(publicKey: string): void;
270
- declare function validateSparkInvoiceFields(sparkInvoiceFields: SparkInvoiceFields): void;
271
- declare function validateSparkInvoiceSignature(invoice: SparkAddressFormat): void;
272
- declare function toProtoTimestamp(date: Date): {
273
- seconds: number;
274
- nanos: number;
275
- };
276
- declare function assertBech32(s: string): asserts s is Bech32String;
277
- declare function bech32mDecode(address: string): _scure_base.Bech32Decoded<string>;
278
- declare function isSafeForNumber(bi: bigint): boolean;
279
274
 
280
275
  declare class SigningService {
281
276
  private readonly config;
@@ -286,6 +281,12 @@ declare class SigningService {
286
281
  directLeafSigningJobs: UserSignedTxSigningJob[];
287
282
  directFromCpfpLeafSigningJobs: UserSignedTxSigningJob[];
288
283
  }>;
284
+ signRefundsForLightning(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, cpfpSigningCommitments: RequestedSigningCommitments[], directSigningCommitments: RequestedSigningCommitments[], directFromCpfpSigningCommitments: RequestedSigningCommitments[], hash: Uint8Array): Promise<{
285
+ cpfpLeafSigningJobs: UserSignedTxSigningJob[];
286
+ directLeafSigningJobs: UserSignedTxSigningJob[];
287
+ directFromCpfpLeafSigningJobs: UserSignedTxSigningJob[];
288
+ }>;
289
+ signSigningJobs(signingJobs: (SigningJobWithOptionalNonce & RequestedSigningCommitments)[]): Promise<Map<SigningJobType, UserSignedTxSigningJob>>;
289
290
  }
290
291
 
291
292
  type LeafKeyTweak = {
@@ -306,14 +307,27 @@ type LeafRefundSigningData = {
306
307
  directFromCpfpRefundSigningNonceCommitment: SigningCommitmentWithOptionalNonce;
307
308
  vout: number;
308
309
  };
310
+ type SigningJobType = "split" | "directSplit" | "node" | "directNode" | "cpfp" | "direct" | "directFromCpfp";
311
+ type SigningJobWithOptionalNonce = {
312
+ signingPublicKey: Uint8Array;
313
+ rawTx: Uint8Array;
314
+ signingNonceCommitment: SigningCommitmentWithOptionalNonce;
315
+ type: SigningJobType;
316
+ parentTxOut: TransactionOutput;
317
+ leafId: string;
318
+ keyDerivation: KeyDerivation;
319
+ verifyingKey: Uint8Array;
320
+ };
309
321
  declare class BaseTransferService {
310
322
  protected readonly config: WalletConfigService;
311
323
  protected readonly connectionManager: ConnectionManager;
312
324
  protected readonly signingService: SigningService;
313
325
  constructor(config: WalletConfigService, connectionManager: ConnectionManager, signingService: SigningService);
314
326
  deliverTransferPackage(transfer: Transfer, leaves: LeafKeyTweak[], cpfpRefundSignatureMap: Map<string, Uint8Array>, directRefundSignatureMap: Map<string, Uint8Array>, directFromCpfpRefundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
327
+ prepareTransferForLightning(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, paymentHash: Uint8Array, expiryTime: Date, transferID: string): Promise<StartTransferRequest>;
315
328
  sendTransferWithKeyTweaks(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array, sparkInvoice?: SparkAddressFormat): Promise<Transfer>;
316
329
  private prepareTransferPackage;
330
+ private prepareTransferPackageForLightning;
317
331
  signRefunds(leafDataMap: Map<string, LeafRefundSigningData>, operatorSigningResults: LeafRefundTxSigningResult[]): Promise<NodeSignatures[]>;
318
332
  private prepareSendTransferKeyTweaks;
319
333
  private prepareSingleSendTransferKeyTweak;
@@ -356,170 +370,12 @@ declare class TransferService extends BaseTransferService {
356
370
  claimTransferSignRefunds(transfer: Transfer, leafKeys: LeafKeyTweak[], proofMap?: Map<string, Uint8Array[]>): Promise<NodeSignatures[]>;
357
371
  private finalizeNodeSignatures;
358
372
  queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
359
- private refreshTimelockNodesInternal;
360
- refreshTimelockNodes(node: TreeNode, parentNode: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
361
- extendTimelock(node: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
362
- testonly_expireTimeLockNodeTx(node: TreeNode, parentNode: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
363
- testonly_expireTimeLockRefundtx(node: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
364
- }
365
-
366
- type Bech32mTokenIdentifier = `btkn1${string}` | `btknrt1${string}` | `btknt1${string}` | `btkns1${string}` | `btknl1${string}`;
367
- interface Bech32mTokenIdentifierData {
368
- tokenIdentifier: Uint8Array;
369
- network: NetworkType;
370
- }
371
- declare function encodeBech32mTokenIdentifier(payload: Bech32mTokenIdentifierData): Bech32mTokenIdentifier;
372
- declare function decodeBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier, network?: NetworkType): Bech32mTokenIdentifierData;
373
- declare function getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier): NetworkType;
374
-
375
- type CreateLightningInvoiceParams = {
376
- amountSats: number;
377
- memo?: string;
378
- expirySeconds?: number;
379
- includeSparkAddress?: boolean;
380
- receiverIdentityPubkey?: string;
381
- descriptionHash?: string;
382
- };
383
- type PayLightningInvoiceParams = {
384
- invoice: string;
385
- maxFeeSats: number;
386
- preferSpark?: boolean;
387
- amountSatsToSend?: number;
388
- };
389
- type TransferParams = {
390
- amountSats: number;
391
- receiverSparkAddress: string;
392
- };
393
- type TransferWithInvoiceParams = {
394
- amountSats: number;
395
- receiverIdentityPubkey: Uint8Array;
396
- sparkInvoice?: SparkAddressFormat;
397
- };
398
- type TransferWithInvoiceOutcome = {
399
- ok: true;
400
- transfer: WalletTransfer;
401
- param: TransferWithInvoiceParams;
402
- } | {
403
- ok: false;
404
- error: Error;
405
- param: TransferWithInvoiceParams;
406
- };
407
- type FulfillSparkInvoiceResponse = {
408
- satsTransactionSuccess: {
409
- invoice: SparkAddressFormat;
410
- transferResponse: WalletTransfer;
411
- }[];
412
- tokenTransactionSuccess: {
413
- tokenIdentifier: Bech32mTokenIdentifier;
414
- txid: string;
415
- }[];
416
- satsTransactionErrors: {
417
- invoice: string;
418
- error: Error;
419
- }[];
420
- tokenTransactionErrors: {
421
- tokenIdentifier: Bech32mTokenIdentifier;
422
- error: Error;
423
- }[];
424
- invalidInvoices: {
425
- invoice: string;
426
- error: Error;
427
- }[];
428
- };
429
- type TokenInvoice = {
430
- invoice: string;
431
- identifierHex: string;
432
- amount: bigint;
433
- };
434
- type InvalidInvoice = {
435
- invoice: string;
436
- error: Error;
437
- };
438
- type GroupSparkInvoicesResult = {
439
- satsInvoices: TransferWithInvoiceParams[];
440
- tokenInvoices: Map<string, TokenInvoice[]>;
441
- invalidInvoices: InvalidInvoice[];
442
- };
443
- type DepositParams = {
444
- keyDerivation: KeyDerivation;
445
- verifyingKey: Uint8Array;
446
- depositTx: Transaction;
447
- vout: number;
448
- };
449
- /**
450
- * Token metadata containing essential information about a token.
451
- * This is the wallet's internal representation with JavaScript-friendly types.
452
- *
453
- * rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the bech32m encoded token identifier.
454
- *
455
- * tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
456
- *
457
- * @example
458
- * ```typescript
459
- * const tokenMetadata: UserTokenMetadata = {
460
- * rawTokenIdentifier: new Uint8Array([1, 2, 3]),
461
- * tokenPublicKey: "0348fbb...",
462
- * tokenName: "SparkToken",
463
- * tokenTicker: "SPK",
464
- * decimals: 8,
465
- * maxSupply: 1000000n
466
- * };
467
- * ```
468
- */
469
- type UserTokenMetadata = {
470
- /** Raw binary token identifier - This is used to encode the human readable token identifier */
471
- rawTokenIdentifier: Uint8Array;
472
- /** Public key of the token issuer - Same as issuerPublicKey */
473
- tokenPublicKey: string;
474
- /** Human-readable name of the token (e.g., SparkToken)*/
475
- tokenName: string;
476
- /** Short ticker symbol for the token (e.g., "SPK") */
477
- tokenTicker: string;
478
- /** Number of decimal places for token amounts */
479
- decimals: number;
480
- /** Maximum supply of tokens that can ever be minted */
481
- maxSupply: bigint;
482
- };
483
- type TokenBalanceMap = Map<Bech32mTokenIdentifier, {
484
- balance: bigint;
485
- tokenMetadata: UserTokenMetadata;
486
- }>;
487
- type RawTokenIdentifierHex = string & {
488
- readonly __brand: "RawTokenIdentifierHex";
489
- };
490
- type TokenOutputsMap = Map<Bech32mTokenIdentifier, OutputWithPreviousTransactionData[]>;
491
- type TokenMetadataMap = Map<Bech32mTokenIdentifier, TokenMetadata>;
492
- type InitWalletResponse<T extends SparkWallet = SparkWallet> = {
493
- wallet: T;
494
- mnemonic: string | undefined;
495
- };
496
- interface SparkWalletProps {
497
- mnemonicOrSeed?: Uint8Array | string;
498
- accountNumber?: number;
499
- signer?: SparkSigner;
500
- options?: ConfigOptions;
501
- }
502
- declare const SparkWalletEvent: {
503
- readonly All: "*";
504
- readonly TransferClaimed: "transfer:claimed";
505
- readonly DepositConfirmed: "deposit:confirmed";
506
- readonly StreamConnected: "stream:connected";
507
- readonly StreamDisconnected: "stream:disconnected";
508
- readonly StreamReconnecting: "stream:reconnecting";
509
- };
510
- type SparkWalletEventType = (typeof SparkWalletEvent)[keyof typeof SparkWalletEvent];
511
- interface SparkWalletEvents {
512
- [SparkWalletEvent.All]: (eventName: string, ...args: unknown[]) => void;
513
- /** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
514
- [SparkWalletEvent.TransferClaimed]: (transferId: string, updatedBalance: bigint) => void;
515
- /** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
516
- [SparkWalletEvent.DepositConfirmed]: (depositId: string, updatedBalance: bigint) => void;
517
- /** Emitted when the stream is connected */
518
- [SparkWalletEvent.StreamConnected]: () => void;
519
- /** Emitted when the stream disconnects and fails to reconnect after max attempts */
520
- [SparkWalletEvent.StreamDisconnected]: (reason: string) => void;
521
- /** Emitted when attempting to reconnect the stream */
522
- [SparkWalletEvent.StreamReconnecting]: (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
373
+ renewRefundTxn(node: TreeNode, parentNode: TreeNode): Promise<TreeNode>;
374
+ renewNodeTxn(node: TreeNode, parentNode: TreeNode): Promise<TreeNode>;
375
+ private createRenewRefundSigningJobs;
376
+ private createRenewNodeSigningJobs;
377
+ renewZeroTimelockNodeTxn(node: TreeNode): Promise<TreeNode>;
378
+ private createRenewZeroTimelockNodeSigningJobs;
523
379
  }
524
380
 
525
381
  /**
@@ -550,16 +406,15 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
550
406
  protected tokenOutputs: TokenOutputsMap;
551
407
  private claimTransfersInterval;
552
408
  private tracer;
409
+ protected abstract buildConnectionManager(config: WalletConfigService): ConnectionManager;
553
410
  constructor(options?: ConfigOptions, signerArg?: SparkSigner);
554
411
  static initialize<T extends SparkWallet>(this: new (options?: ConfigOptions, signer?: SparkSigner) => T, { mnemonicOrSeed, accountNumber, signer, options }: SparkWalletProps): Promise<InitWalletResponse<T>>;
555
412
  private createClientsAndSyncWallet;
556
413
  private getSspClient;
557
414
  protected buildSigner(): DefaultSparkSigner;
558
- protected buildConnectionManager(config: WalletConfigService): ConnectionManager;
559
415
  private handleStreamEvent;
560
416
  protected setupBackgroundStream(): Promise<void>;
561
417
  getLeaves(isBalanceCheck?: boolean): Promise<TreeNode[]>;
562
- private checkExtendLeaves;
563
418
  private verifyKey;
564
419
  private popOrThrow;
565
420
  private selectLeaves;
@@ -870,15 +725,7 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
870
725
  private transferWithInvoice;
871
726
  private buildTweaksByAmount;
872
727
  private toSendTweak;
873
- private checkExtendTimeLockNodes;
874
- /**
875
- * Internal method to refresh timelock nodes.
876
- *
877
- * @param {string} nodeId - The optional ID of the node to refresh. If not provided, all nodes will be checked.
878
- * @returns {Promise<void>}
879
- * @private
880
- */
881
- private checkRefreshTimelockNodes;
728
+ private checkRenewLeaves;
882
729
  private claimTransferCore;
883
730
  private processClaimedTransferResults;
884
731
  /**
@@ -1117,13 +964,6 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
1117
964
  nodeTimelock: number;
1118
965
  refundTimelock: number;
1119
966
  }>;
1120
- /**
1121
- * Refresh the timelock of a specific node.
1122
- *
1123
- * @param {string} nodeId - The ID of the node to refresh
1124
- * @returns {Promise<void>} Promise that resolves when the timelock is refreshed
1125
- */
1126
- testOnly_expireTimelock(nodeId: string): Promise<void>;
1127
967
  private cleanup;
1128
968
  cleanupConnections(): Promise<void>;
1129
969
  private startPeriodicClaimTransfers;
@@ -1142,4 +982,187 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
1142
982
  private wrapSparkWalletMethodsWithTracing;
1143
983
  }
1144
984
 
1145
- export { type SparkCallOptions as $, type CreateLightningInvoiceParams as A, type Bech32mTokenIdentifier as B, ConnectionManager as C, type DecodedSparkAddressData as D, type TransferWithInvoiceParams as E, type TransferWithInvoiceOutcome as F, type FulfillSparkInvoiceResponse as G, type TokenInvoice as H, type InvalidInvoice as I, type GroupSparkInvoicesResult as J, type DepositParams as K, type LegacySparkAddressFormat as L, type TokenBalanceMap as M, Network as N, type TokenOutputsMap as O, type PayLightningInvoiceParams as P, type TokenMetadataMap as Q, type RawTokenIdentifierHex as R, type SparkAddressFormat as S, type TransferParams as T, type UserTokenMetadata as U, type InitWalletResponse as V, WalletConfigService as W, type SparkWalletProps as X, SparkWalletEvent as Y, type SparkWalletEventType as Z, type SparkWalletEvents as _, WalletConfig as a, SparkAuthnServiceDefinition as a0, SparkWallet as a1, type ConfigOptions as b, type SparkAddressData as c, encodeSparkAddressWithSignature as d, encodeSparkAddress as e, decodeSparkAddress as f, getNetworkFromSparkAddress as g, isValidSparkAddress as h, isLegacySparkAddress as i, isValidPublicKey as j, validateSparkInvoiceSignature as k, assertBech32 as l, bech32mDecode as m, isSafeForNumber as n, type NetworkType as o, NetworkToProto as p, protoToNetwork as q, getNetwork as r, getNetworkFromAddress as s, toProtoTimestamp as t, getNetworkFromString as u, validateSparkInvoiceFields as v, type Bech32mTokenIdentifierData as w, encodeBech32mTokenIdentifier as x, decodeBech32mTokenIdentifier as y, getNetworkFromBech32mTokenIdentifier as z };
985
+ type CreateLightningInvoiceParams = {
986
+ amountSats: number;
987
+ memo?: string;
988
+ expirySeconds?: number;
989
+ includeSparkAddress?: boolean;
990
+ receiverIdentityPubkey?: string;
991
+ descriptionHash?: string;
992
+ };
993
+ type PayLightningInvoiceParams = {
994
+ invoice: string;
995
+ maxFeeSats: number;
996
+ preferSpark?: boolean;
997
+ amountSatsToSend?: number;
998
+ };
999
+ type TransferParams = {
1000
+ amountSats: number;
1001
+ receiverSparkAddress: string;
1002
+ };
1003
+ type TransferWithInvoiceParams = {
1004
+ amountSats: number;
1005
+ receiverIdentityPubkey: Uint8Array;
1006
+ sparkInvoice?: SparkAddressFormat;
1007
+ };
1008
+ type TransferWithInvoiceOutcome = {
1009
+ ok: true;
1010
+ transfer: WalletTransfer;
1011
+ param: TransferWithInvoiceParams;
1012
+ } | {
1013
+ ok: false;
1014
+ error: Error;
1015
+ param: TransferWithInvoiceParams;
1016
+ };
1017
+ type FulfillSparkInvoiceResponse = {
1018
+ satsTransactionSuccess: {
1019
+ invoice: SparkAddressFormat;
1020
+ transferResponse: WalletTransfer;
1021
+ }[];
1022
+ tokenTransactionSuccess: {
1023
+ tokenIdentifier: Bech32mTokenIdentifier;
1024
+ txid: string;
1025
+ }[];
1026
+ satsTransactionErrors: {
1027
+ invoice: string;
1028
+ error: Error;
1029
+ }[];
1030
+ tokenTransactionErrors: {
1031
+ tokenIdentifier: Bech32mTokenIdentifier;
1032
+ error: Error;
1033
+ }[];
1034
+ invalidInvoices: {
1035
+ invoice: string;
1036
+ error: Error;
1037
+ }[];
1038
+ };
1039
+ type TokenInvoice = {
1040
+ invoice: string;
1041
+ identifierHex: string;
1042
+ amount: bigint;
1043
+ };
1044
+ type InvalidInvoice = {
1045
+ invoice: string;
1046
+ error: Error;
1047
+ };
1048
+ type GroupSparkInvoicesResult = {
1049
+ satsInvoices: TransferWithInvoiceParams[];
1050
+ tokenInvoices: Map<string, TokenInvoice[]>;
1051
+ invalidInvoices: InvalidInvoice[];
1052
+ };
1053
+ type DepositParams = {
1054
+ keyDerivation: KeyDerivation;
1055
+ verifyingKey: Uint8Array;
1056
+ depositTx: Transaction;
1057
+ vout: number;
1058
+ };
1059
+ /**
1060
+ * Token metadata containing essential information about a token.
1061
+ * This is the wallet's internal representation with JavaScript-friendly types.
1062
+ *
1063
+ * rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the bech32m encoded token identifier.
1064
+ *
1065
+ * tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
1066
+ *
1067
+ * @example
1068
+ * ```typescript
1069
+ * const tokenMetadata: UserTokenMetadata = {
1070
+ * rawTokenIdentifier: new Uint8Array([1, 2, 3]),
1071
+ * tokenPublicKey: "0348fbb...",
1072
+ * tokenName: "SparkToken",
1073
+ * tokenTicker: "SPK",
1074
+ * decimals: 8,
1075
+ * maxSupply: 1000000n
1076
+ * };
1077
+ * ```
1078
+ */
1079
+ type UserTokenMetadata = {
1080
+ /** Raw binary token identifier - This is used to encode the human readable token identifier */
1081
+ rawTokenIdentifier: Uint8Array;
1082
+ /** Public key of the token issuer - Same as issuerPublicKey */
1083
+ tokenPublicKey: string;
1084
+ /** Human-readable name of the token (e.g., SparkToken)*/
1085
+ tokenName: string;
1086
+ /** Short ticker symbol for the token (e.g., "SPK") */
1087
+ tokenTicker: string;
1088
+ /** Number of decimal places for token amounts */
1089
+ decimals: number;
1090
+ /** Maximum supply of tokens that can ever be minted */
1091
+ maxSupply: bigint;
1092
+ };
1093
+ type TokenBalanceMap = Map<Bech32mTokenIdentifier, {
1094
+ balance: bigint;
1095
+ tokenMetadata: UserTokenMetadata;
1096
+ }>;
1097
+ type RawTokenIdentifierHex = string & {
1098
+ readonly __brand: "RawTokenIdentifierHex";
1099
+ };
1100
+ type TokenOutputsMap = Map<Bech32mTokenIdentifier, OutputWithPreviousTransactionData[]>;
1101
+ type TokenMetadataMap = Map<Bech32mTokenIdentifier, TokenMetadata>;
1102
+ type InitWalletResponse<T extends SparkWallet = SparkWallet> = {
1103
+ wallet: T;
1104
+ mnemonic: string | undefined;
1105
+ };
1106
+ interface SparkWalletProps {
1107
+ mnemonicOrSeed?: Uint8Array | string;
1108
+ accountNumber?: number;
1109
+ signer?: SparkSigner;
1110
+ options?: ConfigOptions;
1111
+ }
1112
+ declare const SparkWalletEvent: {
1113
+ readonly All: "*";
1114
+ readonly TransferClaimed: "transfer:claimed";
1115
+ readonly DepositConfirmed: "deposit:confirmed";
1116
+ readonly StreamConnected: "stream:connected";
1117
+ readonly StreamDisconnected: "stream:disconnected";
1118
+ readonly StreamReconnecting: "stream:reconnecting";
1119
+ };
1120
+ type SparkWalletEventType = (typeof SparkWalletEvent)[keyof typeof SparkWalletEvent];
1121
+ interface SparkWalletEvents {
1122
+ [SparkWalletEvent.All]: (eventName: string, ...args: unknown[]) => void;
1123
+ /** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
1124
+ [SparkWalletEvent.TransferClaimed]: (transferId: string, updatedBalance: bigint) => void;
1125
+ /** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
1126
+ [SparkWalletEvent.DepositConfirmed]: (depositId: string, updatedBalance: bigint) => void;
1127
+ /** Emitted when the stream is connected */
1128
+ [SparkWalletEvent.StreamConnected]: () => void;
1129
+ /** Emitted when the stream disconnects and fails to reconnect after max attempts */
1130
+ [SparkWalletEvent.StreamDisconnected]: (reason: string) => void;
1131
+ /** Emitted when attempting to reconnect the stream */
1132
+ [SparkWalletEvent.StreamReconnecting]: (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
1133
+ }
1134
+
1135
+ type SigningOperator = {
1136
+ readonly id: number;
1137
+ readonly identifier: string;
1138
+ readonly address: string;
1139
+ readonly identityPublicKey: string;
1140
+ };
1141
+ type ConsoleOptions = {
1142
+ otel?: boolean;
1143
+ };
1144
+ type ConfigOptions = MayHaveSspClientOptions & {
1145
+ readonly network?: NetworkType;
1146
+ readonly signingOperators?: Readonly<Record<string, SigningOperator>>;
1147
+ readonly coordinatorIdentifier?: string;
1148
+ readonly frostSignerAddress?: string;
1149
+ readonly threshold?: number;
1150
+ readonly tokenSignatures?: "ECDSA" | "SCHNORR";
1151
+ readonly tokenValidityDurationSeconds?: number;
1152
+ readonly electrsUrl?: string;
1153
+ readonly sspClientOptions?: SspClientOptions;
1154
+ readonly expectedWithdrawBondSats?: number;
1155
+ readonly expectedWithdrawRelativeBlockLocktime?: number;
1156
+ readonly signerWithPreExistingKeys?: boolean;
1157
+ readonly console?: ConsoleOptions;
1158
+ readonly events?: Partial<SparkWalletEvents>;
1159
+ };
1160
+ declare const WalletConfig: {
1161
+ LOCAL: Required<ConfigOptions>;
1162
+ LOCAL_SCHNORR: Required<ConfigOptions>;
1163
+ LOCAL_ECDSA: Required<ConfigOptions>;
1164
+ REGTEST: Required<ConfigOptions>;
1165
+ MAINNET: Required<ConfigOptions>;
1166
+ };
1167
+
1168
+ export { type SparkCallOptions as $, type CreateLightningInvoiceParams as A, type Bech32mTokenIdentifier as B, ConnectionManager as C, type DecodedSparkAddressData as D, type TransferWithInvoiceParams as E, type TransferWithInvoiceOutcome as F, type FulfillSparkInvoiceResponse as G, type TokenInvoice as H, type InvalidInvoice as I, type GroupSparkInvoicesResult as J, type DepositParams as K, type LegacySparkAddressFormat as L, type TokenBalanceMap as M, Network as N, type TokenOutputsMap as O, type PayLightningInvoiceParams as P, type TokenMetadataMap as Q, type RawTokenIdentifierHex as R, type SparkAddressFormat as S, type TransferParams as T, type UserTokenMetadata as U, type InitWalletResponse as V, WalletConfigService as W, type SparkWalletProps as X, SparkWalletEvent as Y, type SparkWalletEventType as Z, type SparkWalletEvents as _, WalletConfig as a, SparkAuthnServiceDefinition as a0, type RetryOptions as a1, SparkWallet as a2, type ConfigOptions as b, type SparkAddressData as c, encodeSparkAddressWithSignature as d, encodeSparkAddress as e, decodeSparkAddress as f, getNetworkFromSparkAddress as g, isValidSparkAddress as h, isLegacySparkAddress as i, isValidPublicKey as j, validateSparkInvoiceSignature as k, assertBech32 as l, bech32mDecode as m, isSafeForNumber as n, type NetworkType as o, NetworkToProto as p, protoToNetwork as q, getNetwork as r, getNetworkFromAddress as s, toProtoTimestamp as t, getNetworkFromString as u, validateSparkInvoiceFields as v, type Bech32mTokenIdentifierData as w, encodeBech32mTokenIdentifier as x, decodeBech32mTokenIdentifier as y, getNetworkFromBech32mTokenIdentifier as z };