@buildonspark/spark-sdk 0.4.1 → 0.4.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 (77) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/bare/index.cjs +1038 -236
  3. package/dist/bare/index.d.cts +143 -14
  4. package/dist/bare/index.d.ts +143 -14
  5. package/dist/bare/index.js +1043 -240
  6. package/dist/{chunk-4E23VB7E.js → chunk-6UVL674M.js} +2 -2
  7. package/dist/{chunk-YEBEN7XD.js → chunk-BHFVMNXO.js} +623 -16
  8. package/dist/{chunk-EV2PTGGR.js → chunk-JZODGME5.js} +1 -1
  9. package/dist/{chunk-JLF6WJ7K.js → chunk-LUOP2ATD.js} +1 -1
  10. package/dist/{chunk-4YFT7DAE.js → chunk-Q537QTDY.js} +1 -1
  11. package/dist/{chunk-W2S4FPZ4.js → chunk-SUGTL4PD.js} +250 -27
  12. package/dist/{chunk-JR7ZU6LX.js → chunk-U7EELMDO.js} +1 -1
  13. package/dist/{client-BaQf-5gD.d.ts → client-3MdPdtnA.d.ts} +1 -1
  14. package/dist/{client-BIqiUNy4.d.cts → client-BZFWaZ1l.d.cts} +1 -1
  15. package/dist/debug.cjs +1038 -241
  16. package/dist/debug.d.cts +5 -5
  17. package/dist/debug.d.ts +5 -5
  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 +923 -119
  22. package/dist/index.d.cts +6 -6
  23. package/dist/index.d.ts +6 -6
  24. package/dist/index.js +6 -6
  25. package/dist/index.node.cjs +923 -119
  26. package/dist/index.node.d.cts +6 -6
  27. package/dist/index.node.d.ts +6 -6
  28. package/dist/index.node.js +5 -5
  29. package/dist/{logging-BLzoEEoP.d.ts → logging-g6Oib3Ua.d.ts} +3 -3
  30. package/dist/{logging-Cl-gGtZz.d.cts → logging-miPhbIyT.d.cts} +3 -3
  31. package/dist/native/index.react-native.cjs +923 -119
  32. package/dist/native/index.react-native.d.cts +141 -16
  33. package/dist/native/index.react-native.d.ts +141 -16
  34. package/dist/native/index.react-native.js +926 -121
  35. package/dist/proto/spark.cjs +623 -16
  36. package/dist/proto/spark.d.cts +1 -1
  37. package/dist/proto/spark.d.ts +1 -1
  38. package/dist/proto/spark.js +19 -1
  39. package/dist/proto/spark_token.d.cts +1 -1
  40. package/dist/proto/spark_token.d.ts +1 -1
  41. package/dist/proto/spark_token.js +2 -2
  42. package/dist/{spark-DOpheE8_.d.cts → spark-BWkABx3N.d.cts} +124 -3
  43. package/dist/{spark-DOpheE8_.d.ts → spark-BWkABx3N.d.ts} +124 -3
  44. package/dist/{spark-wallet.browser-XT25hMYM.d.ts → spark-wallet.browser-Cm-JMRQB.d.ts} +2 -2
  45. package/dist/{spark-wallet.browser-BGMpYML0.d.cts → spark-wallet.browser-M7zcmZYm.d.cts} +2 -2
  46. package/dist/{spark-wallet.node-CAfuCfrU.d.ts → spark-wallet.node-B4y08Ri5.d.ts} +2 -2
  47. package/dist/{spark-wallet.node-C8dbiFsD.d.cts → spark-wallet.node-BotQbNoI.d.cts} +2 -2
  48. package/dist/tests/test-utils.cjs +1030 -60
  49. package/dist/tests/test-utils.d.cts +4 -4
  50. package/dist/tests/test-utils.d.ts +4 -4
  51. package/dist/tests/test-utils.js +7 -7
  52. package/dist/{token-transactions-DhVLTxEY.d.cts → token-transactions-C95IPSyM.d.cts} +2 -2
  53. package/dist/{token-transactions-vcOZg63D.d.ts → token-transactions-SPf4ygYc.d.ts} +2 -2
  54. package/dist/types/index.cjs +614 -16
  55. package/dist/types/index.d.cts +2 -2
  56. package/dist/types/index.d.ts +2 -2
  57. package/dist/types/index.js +5 -5
  58. package/dist/{wallet-config-w9e62Plc.d.ts → wallet-config-CQW-mDqN.d.ts} +41 -17
  59. package/dist/{wallet-config-DVEoQg3w.d.cts → wallet-config-JYsN3izc.d.cts} +41 -17
  60. package/package.json +1 -1
  61. package/src/proto/spark.ts +842 -80
  62. package/src/services/lightning.ts +1 -1
  63. package/src/services/transfer.ts +0 -1
  64. package/src/spark-wallet/proto-descriptors.ts +1 -1
  65. package/src/spark-wallet/spark-wallet.ts +279 -16
  66. package/src/spark-wallet/types.ts +6 -7
  67. package/src/spark_descriptors.pb +0 -0
  68. package/src/tests/address.test.ts +10 -103
  69. package/src/tests/integration/address.test.ts +7 -17
  70. package/src/tests/integration/ssp/coop-exit.test.ts +0 -1
  71. package/src/tests/integration/ssp/lightning.test.ts +67 -2
  72. package/src/tests/integration/ssp/swap.test.ts +0 -1
  73. package/src/tests/integration/static_deposit.test.ts +2 -1
  74. package/src/tests/integration/transfer.test.ts +8 -28
  75. package/src/tests/token-hashing.test.ts +4 -4
  76. package/src/tests/xchain-address.test.ts +3 -3
  77. package/src/utils/address.ts +6 -4
@@ -1,6 +1,6 @@
1
- export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput, W as WalletLeaf, w as WalletTransfer, at as WalletTransferLeaf, N as getClaimStaticDepositQuery, $ as getCoopExitFeeQuoteQuery, a1 as getCoopExitRequestQuery, a7 as getLeavesSwapRequestQuery, a9 as getLightningReceiveRequestQuery, ac as getLightningSendRequestQuery, au as mapTransferLeafToWalletTransferLeaf, av as mapTransferToWalletTransfer, aq as mapTreeNodeToWalletLeaf } from '../client-BIqiUNy4.cjs';
1
+ export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput, W as WalletLeaf, w as WalletTransfer, at as WalletTransferLeaf, N as getClaimStaticDepositQuery, $ as getCoopExitFeeQuoteQuery, a1 as getCoopExitRequestQuery, a7 as getLeavesSwapRequestQuery, a9 as getLightningReceiveRequestQuery, ac as getLightningSendRequestQuery, au as mapTransferLeafToWalletTransferLeaf, av as mapTransferToWalletTransfer, aq as mapTreeNodeToWalletLeaf } from '../client-BZFWaZ1l.cjs';
2
2
  export { ClaimStaticDepositInput, ClaimStaticDepositRequestType, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getUserRequestQuery } from '../graphql/objects/index.cjs';
3
- export { n as CommonProto, s as SparkProto } from '../spark-DOpheE8_.cjs';
3
+ export { n as CommonProto, s as SparkProto } from '../spark-BWkABx3N.cjs';
4
4
  import '@lightsparkdev/core';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/bip32';
@@ -1,6 +1,6 @@
1
- export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput, W as WalletLeaf, w as WalletTransfer, at as WalletTransferLeaf, N as getClaimStaticDepositQuery, $ as getCoopExitFeeQuoteQuery, a1 as getCoopExitRequestQuery, a7 as getLeavesSwapRequestQuery, a9 as getLightningReceiveRequestQuery, ac as getLightningSendRequestQuery, au as mapTransferLeafToWalletTransferLeaf, av as mapTransferToWalletTransfer, aq as mapTreeNodeToWalletLeaf } from '../client-BaQf-5gD.js';
1
+ export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput, W as WalletLeaf, w as WalletTransfer, at as WalletTransferLeaf, N as getClaimStaticDepositQuery, $ as getCoopExitFeeQuoteQuery, a1 as getCoopExitRequestQuery, a7 as getLeavesSwapRequestQuery, a9 as getLightningReceiveRequestQuery, ac as getLightningSendRequestQuery, au as mapTransferLeafToWalletTransferLeaf, av as mapTransferToWalletTransfer, aq as mapTreeNodeToWalletLeaf } from '../client-3MdPdtnA.js';
2
2
  export { ClaimStaticDepositInput, ClaimStaticDepositRequestType, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getUserRequestQuery } from '../graphql/objects/index.js';
3
- export { n as CommonProto, s as SparkProto } from '../spark-DOpheE8_.js';
3
+ export { n as CommonProto, s as SparkProto } from '../spark-BWkABx3N.js';
4
4
  import '@lightsparkdev/core';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/bip32';
@@ -3,11 +3,7 @@ import {
3
3
  mapTransferLeafToWalletTransferLeaf,
4
4
  mapTransferToWalletTransfer,
5
5
  mapTreeNodeToWalletLeaf
6
- } from "../chunk-4YFT7DAE.js";
7
- import {
8
- common_exports,
9
- spark_exports
10
- } from "../chunk-YEBEN7XD.js";
6
+ } from "../chunk-Q537QTDY.js";
11
7
  import {
12
8
  BitcoinNetwork_default,
13
9
  ClaimStaticDepositRequestType_default,
@@ -29,6 +25,10 @@ import {
29
25
  getLightningSendRequestQuery,
30
26
  getUserRequestQuery
31
27
  } from "../chunk-CQY5ML2A.js";
28
+ import {
29
+ common_exports,
30
+ spark_exports
31
+ } from "../chunk-BHFVMNXO.js";
32
32
  import "../chunk-MVRQ5US7.js";
33
33
  export {
34
34
  BitcoinNetwork_default as BitcoinNetwork,
@@ -1,7 +1,7 @@
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-BaQf-5gD.js';
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-3MdPdtnA.js';
2
2
  import * as btc from '@scure/btc-signer';
3
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_.js';
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-BWkABx3N.js';
5
5
  import { SparkTokenServiceDefinition, SparkTokenServiceClient, QueryTokenTransactionsResponse, TokenMetadata } from './proto/spark_token.js';
6
6
  import * as _scure_base from '@scure/base';
7
7
  import { Channel } from 'nice-grpc';
@@ -69,8 +69,8 @@ interface DecodedSparkAddressData {
69
69
  };
70
70
  signature?: string;
71
71
  }
72
- declare function encodeSparkAddress(payload: SparkAddressData): LegacySparkAddressFormat;
73
- declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): LegacySparkAddressFormat;
72
+ declare function encodeSparkAddress(payload: SparkAddressData): SparkAddressFormat;
73
+ declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): SparkAddressFormat;
74
74
  declare function decodeSparkAddress(address: string, network: NetworkType): DecodedSparkAddressData;
75
75
  declare function getNetworkFromSparkAddress(address: string): NetworkType;
76
76
  declare function isLegacySparkAddress(address: string): address is LegacySparkAddressFormat;
@@ -462,14 +462,14 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
462
462
  * @param {Object} params - Parameters for the sats payment
463
463
  * @param {number} params.amount - The amount of sats to receive
464
464
  * @param {string} [params.memo] - The memo for the payment
465
- * @param {string} [params.senderPublicKey] - The public key of the expected sender
465
+ * @param {string} [params.senderSparkAddress] - The spark address of the expected sender
466
466
  * @param {Date} [params.expiryTime] - The expiry time of the payment
467
467
  * @returns {Promise<SparkAddressFormat>} The Spark address for the sats payment
468
468
  */
469
- createSatsInvoice({ amount, memo, senderPublicKey, expiryTime, }: {
469
+ createSatsInvoice({ amount, memo, senderSparkAddress, expiryTime, }: {
470
470
  amount?: number;
471
471
  memo?: string;
472
- senderPublicKey?: string;
472
+ senderSparkAddress?: SparkAddressFormat;
473
473
  expiryTime?: Date;
474
474
  }): Promise<SparkAddressFormat>;
475
475
  /**
@@ -479,15 +479,15 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
479
479
  * @param {bigint} [params.amount] - The amount of tokens to receive
480
480
  * @param {Bech32mTokenIdentifier} [params.tokenIdentifier] - The token identifier
481
481
  * @param {string} [params.memo] - The memo for the payment
482
- * @param {string} [params.senderPublicKey] - The public key of the expected sender
482
+ * @param {string} [params.senderSparkAddress] - The spark address of the expected sender
483
483
  * @param {Date} [params.expiryTime] - The expiry time of the payment
484
484
  * @returns {Promise<SparkAddressFormat>} The Spark address for the tokens payment
485
485
  */
486
- createTokensInvoice({ amount, tokenIdentifier, memo, senderPublicKey, expiryTime, }: {
486
+ createTokensInvoice({ amount, tokenIdentifier, memo, senderSparkAddress, expiryTime, }: {
487
487
  tokenIdentifier?: Bech32mTokenIdentifier;
488
488
  amount?: bigint;
489
489
  memo?: string;
490
- senderPublicKey?: string;
490
+ senderSparkAddress?: SparkAddressFormat;
491
491
  expiryTime?: Date;
492
492
  }): Promise<SparkAddressFormat>;
493
493
  /**
@@ -786,6 +786,31 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
786
786
  * @returns {Promise<LightningSendRequest>} The Lightning payment request details
787
787
  */
788
788
  payLightningInvoice({ invoice, maxFeeSats, preferSpark, amountSatsToSend, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
789
+ /**
790
+ * Fulfills one or more Spark invoices.
791
+ *
792
+ * Processes each provided invoice and attempts to pay it according to the wallet’s
793
+ * funding/selection strategy.
794
+ *
795
+ * @param sparkInvoices - Invoices to fulfill.
796
+ * @param sparkInvoices[].invoice - The parsed Spark address/invoice to pay.
797
+ * Must be a valid Spark address or invoice.
798
+ * Must use spark1... prefixed invoices.
799
+ * Deprecated sp1... prefixed invoices are not supported.
800
+ * @param sparkInvoices[].amount - Used to define an amount for invoices without an amount encoded.
801
+ * For sats invoices, this is the amount in sats. For token invoices, this is the amount in tokens.
802
+ * Amount encoded in the invoice takes precedence if both are provided.
803
+ *
804
+ * @returns Promise<string> A payment or transaction identifier (implementation‑specific).
805
+ *
806
+ * @throws {ValidationError} If validation fails (malformed invoice, zero/negative amount, unsupported network),
807
+ *
808
+ * @example
809
+ * await wallet.fulfillSparkInvoice([
810
+ * { invoice: invoiceWithNilAmount, amount: 1000n },
811
+ * { invoice: invoiceWithEncodedAmount }, // uses amount encoded in the invoice
812
+ * ]);
813
+ */
789
814
  fulfillSparkInvoice(sparkInvoices: {
790
815
  invoice: SparkAddressFormat;
791
816
  amount?: bigint;
@@ -1043,28 +1068,27 @@ type FulfillSparkInvoiceResponse = {
1043
1068
  }[];
1044
1069
  tokenTransactionSuccess: {
1045
1070
  tokenIdentifier: Bech32mTokenIdentifier;
1071
+ invoices: SparkAddressFormat[];
1046
1072
  txid: string;
1047
1073
  }[];
1048
1074
  satsTransactionErrors: {
1049
- invoice: string;
1075
+ invoice: SparkAddressFormat;
1050
1076
  error: Error;
1051
1077
  }[];
1052
1078
  tokenTransactionErrors: {
1053
1079
  tokenIdentifier: Bech32mTokenIdentifier;
1080
+ invoices: SparkAddressFormat[];
1054
1081
  error: Error;
1055
1082
  }[];
1056
- invalidInvoices: {
1057
- invoice: string;
1058
- error: Error;
1059
- }[];
1083
+ invalidInvoices: InvalidInvoice[];
1060
1084
  };
1061
1085
  type TokenInvoice = {
1062
- invoice: string;
1086
+ invoice: SparkAddressFormat;
1063
1087
  identifierHex: string;
1064
1088
  amount: bigint;
1065
1089
  };
1066
1090
  type InvalidInvoice = {
1067
- invoice: string;
1091
+ invoice: SparkAddressFormat;
1068
1092
  error: Error;
1069
1093
  };
1070
1094
  type GroupSparkInvoicesResult = {
@@ -1,7 +1,7 @@
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';
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-BZFWaZ1l.cjs';
2
2
  import * as btc from '@scure/btc-signer';
3
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';
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-BWkABx3N.cjs';
5
5
  import { SparkTokenServiceDefinition, SparkTokenServiceClient, QueryTokenTransactionsResponse, TokenMetadata } from './proto/spark_token.cjs';
6
6
  import * as _scure_base from '@scure/base';
7
7
  import { Channel } from 'nice-grpc';
@@ -69,8 +69,8 @@ interface DecodedSparkAddressData {
69
69
  };
70
70
  signature?: string;
71
71
  }
72
- declare function encodeSparkAddress(payload: SparkAddressData): LegacySparkAddressFormat;
73
- declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): LegacySparkAddressFormat;
72
+ declare function encodeSparkAddress(payload: SparkAddressData): SparkAddressFormat;
73
+ declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): SparkAddressFormat;
74
74
  declare function decodeSparkAddress(address: string, network: NetworkType): DecodedSparkAddressData;
75
75
  declare function getNetworkFromSparkAddress(address: string): NetworkType;
76
76
  declare function isLegacySparkAddress(address: string): address is LegacySparkAddressFormat;
@@ -462,14 +462,14 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
462
462
  * @param {Object} params - Parameters for the sats payment
463
463
  * @param {number} params.amount - The amount of sats to receive
464
464
  * @param {string} [params.memo] - The memo for the payment
465
- * @param {string} [params.senderPublicKey] - The public key of the expected sender
465
+ * @param {string} [params.senderSparkAddress] - The spark address of the expected sender
466
466
  * @param {Date} [params.expiryTime] - The expiry time of the payment
467
467
  * @returns {Promise<SparkAddressFormat>} The Spark address for the sats payment
468
468
  */
469
- createSatsInvoice({ amount, memo, senderPublicKey, expiryTime, }: {
469
+ createSatsInvoice({ amount, memo, senderSparkAddress, expiryTime, }: {
470
470
  amount?: number;
471
471
  memo?: string;
472
- senderPublicKey?: string;
472
+ senderSparkAddress?: SparkAddressFormat;
473
473
  expiryTime?: Date;
474
474
  }): Promise<SparkAddressFormat>;
475
475
  /**
@@ -479,15 +479,15 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
479
479
  * @param {bigint} [params.amount] - The amount of tokens to receive
480
480
  * @param {Bech32mTokenIdentifier} [params.tokenIdentifier] - The token identifier
481
481
  * @param {string} [params.memo] - The memo for the payment
482
- * @param {string} [params.senderPublicKey] - The public key of the expected sender
482
+ * @param {string} [params.senderSparkAddress] - The spark address of the expected sender
483
483
  * @param {Date} [params.expiryTime] - The expiry time of the payment
484
484
  * @returns {Promise<SparkAddressFormat>} The Spark address for the tokens payment
485
485
  */
486
- createTokensInvoice({ amount, tokenIdentifier, memo, senderPublicKey, expiryTime, }: {
486
+ createTokensInvoice({ amount, tokenIdentifier, memo, senderSparkAddress, expiryTime, }: {
487
487
  tokenIdentifier?: Bech32mTokenIdentifier;
488
488
  amount?: bigint;
489
489
  memo?: string;
490
- senderPublicKey?: string;
490
+ senderSparkAddress?: SparkAddressFormat;
491
491
  expiryTime?: Date;
492
492
  }): Promise<SparkAddressFormat>;
493
493
  /**
@@ -786,6 +786,31 @@ declare abstract class SparkWallet extends EventEmitter<SparkWalletEvents> {
786
786
  * @returns {Promise<LightningSendRequest>} The Lightning payment request details
787
787
  */
788
788
  payLightningInvoice({ invoice, maxFeeSats, preferSpark, amountSatsToSend, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
789
+ /**
790
+ * Fulfills one or more Spark invoices.
791
+ *
792
+ * Processes each provided invoice and attempts to pay it according to the wallet’s
793
+ * funding/selection strategy.
794
+ *
795
+ * @param sparkInvoices - Invoices to fulfill.
796
+ * @param sparkInvoices[].invoice - The parsed Spark address/invoice to pay.
797
+ * Must be a valid Spark address or invoice.
798
+ * Must use spark1... prefixed invoices.
799
+ * Deprecated sp1... prefixed invoices are not supported.
800
+ * @param sparkInvoices[].amount - Used to define an amount for invoices without an amount encoded.
801
+ * For sats invoices, this is the amount in sats. For token invoices, this is the amount in tokens.
802
+ * Amount encoded in the invoice takes precedence if both are provided.
803
+ *
804
+ * @returns Promise<string> A payment or transaction identifier (implementation‑specific).
805
+ *
806
+ * @throws {ValidationError} If validation fails (malformed invoice, zero/negative amount, unsupported network),
807
+ *
808
+ * @example
809
+ * await wallet.fulfillSparkInvoice([
810
+ * { invoice: invoiceWithNilAmount, amount: 1000n },
811
+ * { invoice: invoiceWithEncodedAmount }, // uses amount encoded in the invoice
812
+ * ]);
813
+ */
789
814
  fulfillSparkInvoice(sparkInvoices: {
790
815
  invoice: SparkAddressFormat;
791
816
  amount?: bigint;
@@ -1043,28 +1068,27 @@ type FulfillSparkInvoiceResponse = {
1043
1068
  }[];
1044
1069
  tokenTransactionSuccess: {
1045
1070
  tokenIdentifier: Bech32mTokenIdentifier;
1071
+ invoices: SparkAddressFormat[];
1046
1072
  txid: string;
1047
1073
  }[];
1048
1074
  satsTransactionErrors: {
1049
- invoice: string;
1075
+ invoice: SparkAddressFormat;
1050
1076
  error: Error;
1051
1077
  }[];
1052
1078
  tokenTransactionErrors: {
1053
1079
  tokenIdentifier: Bech32mTokenIdentifier;
1080
+ invoices: SparkAddressFormat[];
1054
1081
  error: Error;
1055
1082
  }[];
1056
- invalidInvoices: {
1057
- invoice: string;
1058
- error: Error;
1059
- }[];
1083
+ invalidInvoices: InvalidInvoice[];
1060
1084
  };
1061
1085
  type TokenInvoice = {
1062
- invoice: string;
1086
+ invoice: SparkAddressFormat;
1063
1087
  identifierHex: string;
1064
1088
  amount: bigint;
1065
1089
  };
1066
1090
  type InvalidInvoice = {
1067
- invoice: string;
1091
+ invoice: SparkAddressFormat;
1068
1092
  error: Error;
1069
1093
  };
1070
1094
  type GroupSparkInvoicesResult = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildonspark/spark-sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "author": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",