@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.
- package/CHANGELOG.md +8 -0
- package/dist/bare/index.cjs +9240 -9125
- package/dist/bare/index.d.cts +14 -11
- package/dist/bare/index.d.ts +14 -11
- package/dist/bare/index.js +3917 -3802
- package/dist/{chunk-XPHYQ2L6.js → chunk-KDEVNW7C.js} +4895 -4779
- package/dist/{chunk-LIZFXQWK.js → chunk-P4HYYSMU.js} +1 -1
- package/dist/{chunk-EHKP3Y65.js → chunk-SRPKOCG4.js} +1 -2
- package/dist/{chunk-FJ7LTA2O.js → chunk-UYTT3C6H.js} +1 -1
- package/dist/{client-AHn11NHe.d.cts → client-Bcb7TUIp.d.cts} +11 -9
- package/dist/{client-GOlkXliC.d.ts → client-D9T58OY8.d.ts} +11 -9
- package/dist/debug.cjs +1852 -1738
- package/dist/debug.d.cts +4 -4
- package/dist/debug.d.ts +4 -4
- package/dist/debug.js +2 -2
- package/dist/graphql/objects/index.d.cts +2 -2
- package/dist/graphql/objects/index.d.ts +2 -2
- package/dist/index.cjs +174 -58
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/index.node.cjs +174 -57
- package/dist/index.node.d.cts +5 -5
- package/dist/index.node.d.ts +5 -5
- package/dist/index.node.js +2 -2
- package/dist/{logging-D7ukPwRA.d.ts → logging-JIaZZIbR.d.ts} +2 -2
- package/dist/{logging-CW3kwBaM.d.cts → logging-zkr4UlOi.d.cts} +2 -2
- package/dist/native/{index.cjs → index.react-native.cjs} +182 -62
- package/dist/native/{index.d.cts → index.react-native.d.cts} +19 -15
- package/dist/native/{index.d.ts → index.react-native.d.ts} +19 -15
- package/dist/native/{index.js → index.react-native.js} +179 -60
- package/dist/{spark-wallet-NxG55m7K.d.cts → spark-wallet-BuFrUWeE.d.cts} +4 -3
- package/dist/{spark-wallet-jwNvWvpK.d.ts → spark-wallet-CE5PYiIb.d.ts} +4 -3
- package/dist/{spark-wallet.browser-Cg4fB-Nm.d.ts → spark-wallet.browser-BwYkkOBU.d.ts} +1 -1
- package/dist/{spark-wallet.browser-Db7Y95Kt.d.cts → spark-wallet.browser-DC3jdQPW.d.cts} +1 -1
- package/dist/{spark-wallet.node-DB3ZqtJG.d.ts → spark-wallet.node-C9d2W-Nb.d.ts} +1 -1
- package/dist/{spark-wallet.node-HEG2ahNd.d.cts → spark-wallet.node-CR_zNxmy.d.cts} +1 -1
- package/dist/tests/test-utils.cjs +168 -51
- package/dist/tests/test-utils.d.cts +4 -4
- package/dist/tests/test-utils.d.ts +4 -4
- package/dist/tests/test-utils.js +4 -4
- package/dist/{token-transactions-B2-BO7Oz.d.ts → token-transactions-BZoJuvuE.d.ts} +1 -1
- package/dist/{token-transactions-BAN68xwg.d.cts → token-transactions-I_OFIoNH.d.cts} +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +14 -4
- package/src/graphql/client.ts +6 -9
- package/src/graphql/mutations/CompleteCoopExit.ts +1 -1
- package/src/graphql/mutations/RequestCoopExit.ts +3 -1
- package/src/graphql/mutations/RequestLightningSend.ts +3 -1
- package/src/graphql/objects/CompleteCoopExitInput.ts +22 -33
- package/src/graphql/objects/RequestCoopExitInput.ts +39 -45
- package/src/graphql/objects/RequestLightningSendInput.ts +31 -39
- package/src/index.react-native.ts +21 -0
- package/src/services/config.ts +2 -2
- package/src/services/connection/connection.ts +10 -0
- package/src/services/coop-exit.ts +5 -1
- package/src/services/token-transactions.ts +8 -8
- package/src/spark-wallet/spark-wallet.browser.ts +0 -1
- package/src/spark-wallet/spark-wallet.react-native.ts +5 -3
- package/src/spark-wallet/spark-wallet.ts +56 -9
- package/src/tests/integration/coop-exit.test.ts +2 -0
- package/src/tests/integration/lightning.test.ts +5 -1
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +5 -6
- package/src/tests/integration/ssp/static_deposit.test.ts +45 -35
- package/src/tests/optimize.test.ts +45 -0
- package/src/tests/token-outputs.test.ts +60 -1
- package/src/tests/utils/test-faucet.ts +12 -8
- package/src/utils/optimize.ts +226 -0
- package/src/native/index.ts +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setCrypto
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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
|
};
|
|
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
|
|
|
651
651
|
|
|
652
652
|
interface CompleteCoopExitInput {
|
|
653
653
|
userOutboundTransferExternalId: string;
|
|
654
|
-
coopExitRequestId
|
|
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
|
|
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
|
|
808
|
+
idempotencyKey?: string | undefined;
|
|
808
809
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
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,
|
|
870
|
-
requestCoopExit({ leafExternalIds, withdrawalAddress,
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
808
|
+
idempotencyKey?: string | undefined;
|
|
808
809
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
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,
|
|
870
|
-
requestCoopExit({ leafExternalIds, withdrawalAddress,
|
|
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,
|
|
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>;
|