@buildonspark/spark-sdk 0.3.6 → 0.3.7

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 (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bare/index.cjs +9240 -9125
  3. package/dist/bare/index.d.cts +14 -11
  4. package/dist/bare/index.d.ts +14 -11
  5. package/dist/bare/index.js +3917 -3802
  6. package/dist/{chunk-XPHYQ2L6.js → chunk-KDEVNW7C.js} +4895 -4779
  7. package/dist/{chunk-LIZFXQWK.js → chunk-P4HYYSMU.js} +1 -1
  8. package/dist/{chunk-EHKP3Y65.js → chunk-SRPKOCG4.js} +1 -2
  9. package/dist/{chunk-FJ7LTA2O.js → chunk-UYTT3C6H.js} +1 -1
  10. package/dist/{client-AHn11NHe.d.cts → client-Bcb7TUIp.d.cts} +11 -9
  11. package/dist/{client-GOlkXliC.d.ts → client-D9T58OY8.d.ts} +11 -9
  12. package/dist/debug.cjs +1852 -1738
  13. package/dist/debug.d.cts +4 -4
  14. package/dist/debug.d.ts +4 -4
  15. package/dist/debug.js +2 -2
  16. package/dist/graphql/objects/index.d.cts +2 -2
  17. package/dist/graphql/objects/index.d.ts +2 -2
  18. package/dist/index.cjs +174 -58
  19. package/dist/index.d.cts +5 -5
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +3 -3
  22. package/dist/index.node.cjs +174 -57
  23. package/dist/index.node.d.cts +5 -5
  24. package/dist/index.node.d.ts +5 -5
  25. package/dist/index.node.js +2 -2
  26. package/dist/{logging-D7ukPwRA.d.ts → logging-JIaZZIbR.d.ts} +2 -2
  27. package/dist/{logging-CW3kwBaM.d.cts → logging-zkr4UlOi.d.cts} +2 -2
  28. package/dist/native/{index.cjs → index.react-native.cjs} +182 -62
  29. package/dist/native/{index.d.cts → index.react-native.d.cts} +19 -15
  30. package/dist/native/{index.d.ts → index.react-native.d.ts} +19 -15
  31. package/dist/native/{index.js → index.react-native.js} +179 -60
  32. package/dist/{spark-wallet-NxG55m7K.d.cts → spark-wallet-BuFrUWeE.d.cts} +4 -3
  33. package/dist/{spark-wallet-jwNvWvpK.d.ts → spark-wallet-CE5PYiIb.d.ts} +4 -3
  34. package/dist/{spark-wallet.browser-Cg4fB-Nm.d.ts → spark-wallet.browser-BwYkkOBU.d.ts} +1 -1
  35. package/dist/{spark-wallet.browser-Db7Y95Kt.d.cts → spark-wallet.browser-DC3jdQPW.d.cts} +1 -1
  36. package/dist/{spark-wallet.node-DB3ZqtJG.d.ts → spark-wallet.node-C9d2W-Nb.d.ts} +1 -1
  37. package/dist/{spark-wallet.node-HEG2ahNd.d.cts → spark-wallet.node-CR_zNxmy.d.cts} +1 -1
  38. package/dist/tests/test-utils.cjs +168 -51
  39. package/dist/tests/test-utils.d.cts +4 -4
  40. package/dist/tests/test-utils.d.ts +4 -4
  41. package/dist/tests/test-utils.js +4 -4
  42. package/dist/{token-transactions-B2-BO7Oz.d.ts → token-transactions-BZoJuvuE.d.ts} +1 -1
  43. package/dist/{token-transactions-BAN68xwg.d.cts → token-transactions-I_OFIoNH.d.cts} +1 -1
  44. package/dist/types/index.d.cts +1 -1
  45. package/dist/types/index.d.ts +1 -1
  46. package/package.json +14 -4
  47. package/src/graphql/client.ts +6 -9
  48. package/src/graphql/mutations/CompleteCoopExit.ts +1 -1
  49. package/src/graphql/mutations/RequestCoopExit.ts +3 -1
  50. package/src/graphql/mutations/RequestLightningSend.ts +3 -1
  51. package/src/graphql/objects/CompleteCoopExitInput.ts +22 -33
  52. package/src/graphql/objects/RequestCoopExitInput.ts +39 -45
  53. package/src/graphql/objects/RequestLightningSendInput.ts +31 -39
  54. package/src/index.react-native.ts +21 -0
  55. package/src/services/config.ts +2 -2
  56. package/src/services/connection/connection.ts +10 -0
  57. package/src/services/coop-exit.ts +5 -1
  58. package/src/services/token-transactions.ts +8 -8
  59. package/src/spark-wallet/spark-wallet.browser.ts +0 -1
  60. package/src/spark-wallet/spark-wallet.react-native.ts +5 -3
  61. package/src/spark-wallet/spark-wallet.ts +56 -9
  62. package/src/tests/integration/coop-exit.test.ts +2 -0
  63. package/src/tests/integration/lightning.test.ts +5 -1
  64. package/src/tests/integration/ssp/coop-exit-validation.test.ts +5 -6
  65. package/src/tests/integration/ssp/static_deposit.test.ts +45 -35
  66. package/src/tests/optimize.test.ts +45 -0
  67. package/src/tests/token-outputs.test.ts +60 -1
  68. package/src/tests/utils/test-faucet.ts +12 -8
  69. package/src/utils/optimize.ts +226 -0
  70. package/src/native/index.ts +0 -21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setCrypto
3
- } from "./chunk-XPHYQ2L6.js";
3
+ } from "./chunk-KDEVNW7C.js";
4
4
 
5
5
  // src/index.ts
6
6
  var cryptoImpl = typeof window !== "undefined" && window.crypto ? window.crypto : typeof globalThis !== "undefined" && globalThis.crypto ? globalThis.crypto : null;
@@ -3,7 +3,7 @@ import {
3
3
  NetworkError,
4
4
  SparkWallet,
5
5
  clientEnv
6
- } from "./chunk-XPHYQ2L6.js";
6
+ } from "./chunk-KDEVNW7C.js";
7
7
 
8
8
  // src/services/connection/connection.browser.ts
9
9
  import {
@@ -106,7 +106,6 @@ var SparkWalletBrowser = class extends SparkWallet {
106
106
  spanProcessors,
107
107
  traceUrls
108
108
  }) {
109
- console.log("initializeTracerEnvBrowser");
110
109
  initializeTracerEnvBrowser({ spanProcessors, traceUrls });
111
110
  }
112
111
  };
@@ -3,7 +3,7 @@ import {
3
3
  NetworkError,
4
4
  SparkWallet,
5
5
  clientEnv
6
- } from "./chunk-XPHYQ2L6.js";
6
+ } from "./chunk-KDEVNW7C.js";
7
7
  import {
8
8
  Empty
9
9
  } from "./chunk-IC4IUEOS.js";
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
651
651
 
652
652
  interface CompleteCoopExitInput {
653
653
  userOutboundTransferExternalId: string;
654
- coopExitRequestId: string;
654
+ coopExitRequestId?: string | undefined;
655
655
  }
656
656
 
657
657
  interface CompleteLeavesSwapInput {
@@ -740,11 +740,12 @@ interface LightningSendFeeEstimateOutput {
740
740
  interface RequestCoopExitInput {
741
741
  leafExternalIds: string[];
742
742
  withdrawalAddress: string;
743
- idempotencyKey: string;
743
+ idempotencyKey?: string | undefined;
744
744
  exitSpeed: ExitSpeed;
745
745
  withdrawAll: boolean;
746
746
  feeLeafExternalIds?: string[] | undefined;
747
747
  feeQuoteId?: string | undefined;
748
+ userOutboundTransferExternalId?: string | undefined;
748
749
  }
749
750
 
750
751
  interface UserLeafInput {
@@ -804,12 +805,13 @@ interface RequestLightningReceiveInput {
804
805
 
805
806
  interface RequestLightningSendInput {
806
807
  encodedInvoice: string;
807
- idempotencyKey: string;
808
+ idempotencyKey?: string | undefined;
808
809
  /**
809
- * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
810
- * zero.
811
- **/
810
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
811
+ * zero.
812
+ **/
812
813
  amountSats?: number | undefined;
814
+ userOutboundTransferExternalId?: string | undefined;
813
815
  }
814
816
 
815
817
  interface StaticDepositQuoteInput {
@@ -866,10 +868,10 @@ declare class SspClient {
866
868
  getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
867
869
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
868
870
  getCurrentUser(): Promise<void>;
869
- completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
870
- requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
+ completeCoopExit({ userOutboundTransferExternalId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
872
+ requestCoopExit({ leafExternalIds, withdrawalAddress, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, userOutboundTransferExternalId, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
873
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
872
- requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
874
+ requestLightningSend({ encodedInvoice, amountSats, userOutboundTransferExternalId, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
873
875
  requestLeaveSwap({ adaptorPubkey, directAdaptorPubkey, directFromCpfpAdaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
874
876
  completeLeaveSwap({ adaptorSecretKey, directAdaptorSecretKey, directFromCpfpAdaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
875
877
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
651
651
 
652
652
  interface CompleteCoopExitInput {
653
653
  userOutboundTransferExternalId: string;
654
- coopExitRequestId: string;
654
+ coopExitRequestId?: string | undefined;
655
655
  }
656
656
 
657
657
  interface CompleteLeavesSwapInput {
@@ -740,11 +740,12 @@ interface LightningSendFeeEstimateOutput {
740
740
  interface RequestCoopExitInput {
741
741
  leafExternalIds: string[];
742
742
  withdrawalAddress: string;
743
- idempotencyKey: string;
743
+ idempotencyKey?: string | undefined;
744
744
  exitSpeed: ExitSpeed;
745
745
  withdrawAll: boolean;
746
746
  feeLeafExternalIds?: string[] | undefined;
747
747
  feeQuoteId?: string | undefined;
748
+ userOutboundTransferExternalId?: string | undefined;
748
749
  }
749
750
 
750
751
  interface UserLeafInput {
@@ -804,12 +805,13 @@ interface RequestLightningReceiveInput {
804
805
 
805
806
  interface RequestLightningSendInput {
806
807
  encodedInvoice: string;
807
- idempotencyKey: string;
808
+ idempotencyKey?: string | undefined;
808
809
  /**
809
- * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
810
- * zero.
811
- **/
810
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
811
+ * zero.
812
+ **/
812
813
  amountSats?: number | undefined;
814
+ userOutboundTransferExternalId?: string | undefined;
813
815
  }
814
816
 
815
817
  interface StaticDepositQuoteInput {
@@ -866,10 +868,10 @@ declare class SspClient {
866
868
  getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
867
869
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
868
870
  getCurrentUser(): Promise<void>;
869
- completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
870
- requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
+ completeCoopExit({ userOutboundTransferExternalId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
872
+ requestCoopExit({ leafExternalIds, withdrawalAddress, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, userOutboundTransferExternalId, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
873
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
872
- requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
874
+ requestLightningSend({ encodedInvoice, amountSats, userOutboundTransferExternalId, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
873
875
  requestLeaveSwap({ adaptorPubkey, directAdaptorPubkey, directFromCpfpAdaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
874
876
  completeLeaveSwap({ adaptorSecretKey, directAdaptorSecretKey, directFromCpfpAdaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
875
877
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;