@breeztech/breez-sdk-spark 0.22.2 → 0.23.0
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/breez-sdk-spark.tgz +0 -0
- package/bundler/breez_sdk_spark_wasm.d.ts +65 -5
- package/bundler/breez_sdk_spark_wasm_bg.js +66 -27
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/bundler/index.js +15 -2
- package/bundler/package.json +5 -0
- package/bundler/storage/index.js +6 -0
- package/bundler/tree-store/index.js +1518 -0
- package/bundler/tree-store/package.json +12 -0
- package/deno/breez_sdk_spark_wasm.d.ts +65 -5
- package/deno/breez_sdk_spark_wasm.js +66 -27
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/nodejs/breez_sdk_spark_wasm.d.ts +65 -5
- package/nodejs/breez_sdk_spark_wasm.js +66 -27
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/nodejs/index.js +11 -0
- package/nodejs/mysql-storage/index.cjs +9 -1
- package/nodejs/mysql-storage/migrations.cjs +6 -0
- package/nodejs/mysql-tree-store/index.cjs +296 -29
- package/nodejs/mysql-tree-store/migrations.cjs +198 -34
- package/nodejs/package.json +1 -0
- package/nodejs/postgres-storage/index.cjs +9 -1
- package/nodejs/postgres-storage/migrations.cjs +6 -0
- package/nodejs/postgres-tree-store/index.cjs +301 -40
- package/nodejs/postgres-tree-store/migrations.cjs +42 -0
- package/nodejs/storage/index.cjs +14 -3
- package/nodejs/storage/migrations.cjs +6 -0
- package/nodejs/tree-store/errors.cjs +13 -0
- package/nodejs/tree-store/index.cjs +1185 -0
- package/nodejs/tree-store/migrations.cjs +185 -0
- package/nodejs/tree-store/package.json +9 -0
- package/package.json +1 -1
- package/web/breez_sdk_spark_wasm.d.ts +74 -11
- package/web/breez_sdk_spark_wasm.js +66 -27
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/web/index.js +15 -2
- package/web/package.json +5 -0
- package/web/storage/index.js +6 -0
- package/web/tree-store/index.js +1518 -0
- package/web/tree-store/package.json +12 -0
|
@@ -30,6 +30,14 @@ interface LeavesReservation {
|
|
|
30
30
|
leaves: TreeNode[];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** A leaf together with its ancestor chain, nearest parent first up to the
|
|
34
|
+
* root, so a stored leaf always brings the intermediate nodes its exit chain
|
|
35
|
+
* walks through. */
|
|
36
|
+
interface LeafPedigree {
|
|
37
|
+
leaf: TreeNode;
|
|
38
|
+
ancestors: TreeNode[];
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
type TargetAmounts =
|
|
34
42
|
| { type: 'amountAndFee'; amountSats: number; feeSats: number | null }
|
|
35
43
|
| { type: 'exactDenominations'; denominations: number[] };
|
|
@@ -46,7 +54,10 @@ type LeafSelection =
|
|
|
46
54
|
|
|
47
55
|
export interface TreeStore {
|
|
48
56
|
addLeaves: (leaves: TreeNode[]) => Promise<void>;
|
|
57
|
+
storeAncestors: (pedigrees: LeafPedigree[]) => Promise<void>;
|
|
58
|
+
leavesMissingExitChains: () => Promise<string[]>;
|
|
49
59
|
getLeaves: () => Promise<Leaves>;
|
|
60
|
+
getExitChains: (leafIds: string[]) => Promise<LeafPedigree[]>;
|
|
50
61
|
getAvailableBalance: () => Promise<bigint>;
|
|
51
62
|
getVerifiedLeafKeys: () => Promise<[string, string, string][]>;
|
|
52
63
|
setLeaves: (leaves: TreeNode[], missingLeaves: TreeNode[], refreshStartedAtMs: number) => Promise<void>;
|
|
@@ -650,10 +661,11 @@ export interface ClaimDepositRequest {
|
|
|
650
661
|
txid: string;
|
|
651
662
|
vout: number;
|
|
652
663
|
maxFee?: MaxFee;
|
|
664
|
+
maxInstantFeeBps?: number;
|
|
653
665
|
}
|
|
654
666
|
|
|
655
667
|
export interface ClaimDepositResponse {
|
|
656
|
-
payment
|
|
668
|
+
payment?: Payment;
|
|
657
669
|
}
|
|
658
670
|
|
|
659
671
|
export interface ClaimHtlcPaymentRequest {
|
|
@@ -674,8 +686,10 @@ export interface Config {
|
|
|
674
686
|
network: Network;
|
|
675
687
|
syncIntervalSecs: number;
|
|
676
688
|
maxDepositClaimFee?: MaxFee;
|
|
689
|
+
maxInstantDepositClaimFeeBps?: number;
|
|
677
690
|
lnurlDomain?: string;
|
|
678
691
|
preferSparkOverLightning: boolean;
|
|
692
|
+
exitChainAutoFetchEnabled: boolean;
|
|
679
693
|
externalInputParsers?: ExternalInputParser[];
|
|
680
694
|
useDefaultExternalInputParsers: boolean;
|
|
681
695
|
realTimeSyncServerUrl?: string;
|
|
@@ -789,6 +803,7 @@ export interface CrossChainRoutePair {
|
|
|
789
803
|
decimals: number;
|
|
790
804
|
exactOutEligible: boolean;
|
|
791
805
|
supportedSources: SourceAsset[];
|
|
806
|
+
supportedSourceChains: SourceChain[];
|
|
792
807
|
}
|
|
793
808
|
|
|
794
809
|
export interface CurrencyInfo {
|
|
@@ -809,6 +824,7 @@ export interface DepositInfo {
|
|
|
809
824
|
refundTx?: string;
|
|
810
825
|
refundTxId?: string;
|
|
811
826
|
claimError?: DepositClaimError;
|
|
827
|
+
instantClaimStatus?: InstantClaimStatus;
|
|
812
828
|
}
|
|
813
829
|
|
|
814
830
|
export interface EcdsaSignatureBytes {
|
|
@@ -819,6 +835,10 @@ export interface EventListener {
|
|
|
819
835
|
onEvent: (e: SdkEvent) => void;
|
|
820
836
|
}
|
|
821
837
|
|
|
838
|
+
export interface ExportUnilateralExitStateResponse {
|
|
839
|
+
exitState: string;
|
|
840
|
+
}
|
|
841
|
+
|
|
822
842
|
export interface ExternalBreezSigner {
|
|
823
843
|
derivePublicKey(path: string): Promise<PublicKeyBytes>;
|
|
824
844
|
signEcdsa(message: MessageBytes, path: string): Promise<EcdsaSignatureBytes>;
|
|
@@ -1098,6 +1118,17 @@ export interface IdentifierSignaturePair {
|
|
|
1098
1118
|
signature: ExternalFrostSignatureShare;
|
|
1099
1119
|
}
|
|
1100
1120
|
|
|
1121
|
+
export interface ImportUnilateralExitStateRequest {
|
|
1122
|
+
exitState: string;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export interface ImportUnilateralExitStateResponse {
|
|
1126
|
+
importedLeaves: number;
|
|
1127
|
+
skippedForeignLeaves: number;
|
|
1128
|
+
skippedConflictingLeaves: number;
|
|
1129
|
+
skippedChains: number;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1101
1132
|
export interface IncomingChange {
|
|
1102
1133
|
newState: Record;
|
|
1103
1134
|
oldState?: Record;
|
|
@@ -1345,6 +1376,24 @@ export interface PrepareLnurlPayResponse {
|
|
|
1345
1376
|
feePolicy: FeePolicy;
|
|
1346
1377
|
}
|
|
1347
1378
|
|
|
1379
|
+
export interface PreparePaymentLinkRequest {
|
|
1380
|
+
address: string;
|
|
1381
|
+
route: CrossChainRoutePair;
|
|
1382
|
+
amount: bigint;
|
|
1383
|
+
feePolicy?: FeePolicy;
|
|
1384
|
+
maxSlippageBps?: number;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
export interface PreparePaymentLinkResponse {
|
|
1388
|
+
url: string;
|
|
1389
|
+
amountSats: number;
|
|
1390
|
+
estimatedOut: bigint;
|
|
1391
|
+
asset: string;
|
|
1392
|
+
serviceFeeAmount: bigint;
|
|
1393
|
+
serviceFeeAsset?: string;
|
|
1394
|
+
expiresAt: string;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1348
1397
|
export interface PrepareSendBatchRequest {
|
|
1349
1398
|
recipients: BatchRecipient[];
|
|
1350
1399
|
}
|
|
@@ -1752,6 +1801,8 @@ export interface TransferAuthorization {
|
|
|
1752
1801
|
username: string;
|
|
1753
1802
|
pubkey: string;
|
|
1754
1803
|
signature: string;
|
|
1804
|
+
domain: string;
|
|
1805
|
+
timestamp: number;
|
|
1755
1806
|
}
|
|
1756
1807
|
|
|
1757
1808
|
export interface TurnkeyConfig {
|
|
@@ -1913,7 +1964,7 @@ export type CrossChainProvider = "orchestra" | "boltz";
|
|
|
1913
1964
|
|
|
1914
1965
|
export type CrossChainProviderContext = { type: "orchestra"; quoteId: string; depositAddress: string; depositAmount?: string } | { type: "boltz"; swapId: string; invoice: string; invoiceAmountSats?: number; maxSlippageBps: number };
|
|
1915
1966
|
|
|
1916
|
-
export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAddressDetails } | { type: "receive"; contractAddress?: string };
|
|
1967
|
+
export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAddressDetails } | { type: "receive"; contractAddress?: string } | { type: "paymentLink"; addressDetails: CrossChainAddressDetails };
|
|
1917
1968
|
|
|
1918
1969
|
export type DepositClaimError = { type: "maxDepositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; requiredFeeSats: number; requiredFeeRateSatPerVbyte: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
|
|
1919
1970
|
|
|
@@ -1931,6 +1982,10 @@ export type FeePolicy = "feesExcluded" | "feesIncluded";
|
|
|
1931
1982
|
|
|
1932
1983
|
export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & SilentPaymentAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails) | ({ type: "crossChainAddress" } & CrossChainAddressDetails);
|
|
1933
1984
|
|
|
1985
|
+
export type InstantClaimDeclineReason = { type: "noPlan" } | { type: "feeExceeded"; maxBps: number; quotedBps: number; quotedSats: number } | { type: "submissionFailed" };
|
|
1986
|
+
|
|
1987
|
+
export type InstantClaimStatus = { type: "declined"; reason: InstantClaimDeclineReason } | { type: "submitted"; claimId: string };
|
|
1988
|
+
|
|
1934
1989
|
export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
|
|
1935
1990
|
|
|
1936
1991
|
export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
|
|
@@ -1963,9 +2018,9 @@ export type PublishSignedLnurlPayResponse = { type: "swapCompleted" } | { type:
|
|
|
1963
2018
|
|
|
1964
2019
|
export type PublishSignedTransferPackageResponse = { type: "swapCompleted" } | { type: "paymentSent"; payment: Payment } | { type: "paymentsSent"; payments: Payment[] };
|
|
1965
2020
|
|
|
1966
|
-
export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
|
|
2021
|
+
export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string; receiverIdentityPublicKey?: string };
|
|
1967
2022
|
|
|
1968
|
-
export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] };
|
|
2023
|
+
export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] } | { type: "unilateralExitStateChanged" };
|
|
1969
2024
|
|
|
1970
2025
|
export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
|
|
1971
2026
|
|
|
@@ -1979,6 +2034,8 @@ export type SessionStoreError = { type: "notFound" } | ({ type: "generic" } & st
|
|
|
1979
2034
|
|
|
1980
2035
|
export type SourceAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier: string };
|
|
1981
2036
|
|
|
2037
|
+
export type SourceChain = "spark" | "lightning" | "bitcoin";
|
|
2038
|
+
|
|
1982
2039
|
export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
|
|
1983
2040
|
|
|
1984
2041
|
export type SparkMasterIdentityPublicKey = { type: "set"; publicKey: string } | { type: "unset" };
|
|
@@ -2003,7 +2060,7 @@ export type UnilateralExitTxKind = "fanOut" | "node" | "refund" | "sweep";
|
|
|
2003
2060
|
|
|
2004
2061
|
export type UnsignedTransferPackage = { type: "swap"; prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: number[]; amountSat: number; feeSat: number } | { type: "transfer"; prepareTransfer: ExternalPrepareTransferRequest; amountSat: number; feeSat: number; target: TransferTarget } | { type: "token"; prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: number[]; tokenIdentifier: string; amount: string; fee: string; isSwap: boolean } | { type: "tokenBatch"; prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: number[]; totals: BatchTotal[]; isSwap: boolean };
|
|
2005
2062
|
|
|
2006
|
-
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
|
|
2063
|
+
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string } | { type: "instantClaim"; status: InstantClaimStatus };
|
|
2007
2064
|
|
|
2008
2065
|
export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
|
|
2009
2066
|
|
|
@@ -2048,6 +2105,7 @@ export class BreezSdk {
|
|
|
2048
2105
|
deleteContact(id: string): Promise<void>;
|
|
2049
2106
|
deleteLightningAddress(): Promise<void>;
|
|
2050
2107
|
disconnect(): Promise<void>;
|
|
2108
|
+
exportUnilateralExitState(): Promise<ExportUnilateralExitStateResponse>;
|
|
2051
2109
|
fetchConversionLimits(request: FetchConversionLimitsRequest): Promise<FetchConversionLimitsResponse>;
|
|
2052
2110
|
getCrossChainRoutes(filter: CrossChainRouteFilter): Promise<CrossChainRoutePair[]>;
|
|
2053
2111
|
getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
|
|
@@ -2056,6 +2114,7 @@ export class BreezSdk {
|
|
|
2056
2114
|
getTokenIssuer(): TokenIssuer;
|
|
2057
2115
|
getTokensMetadata(request: GetTokensMetadataRequest): Promise<GetTokensMetadataResponse>;
|
|
2058
2116
|
getUserSettings(): Promise<UserSettings>;
|
|
2117
|
+
importUnilateralExitState(request: ImportUnilateralExitStateRequest): Promise<ImportUnilateralExitStateResponse>;
|
|
2059
2118
|
listContacts(request: ListContactsRequest): Promise<Contact[]>;
|
|
2060
2119
|
listFiatCurrencies(): Promise<ListFiatCurrenciesResponse>;
|
|
2061
2120
|
listFiatRates(): Promise<ListFiatRatesResponse>;
|
|
@@ -2068,6 +2127,7 @@ export class BreezSdk {
|
|
|
2068
2127
|
optimizeLeaves(request: OptimizeLeavesRequest): Promise<OptimizeLeavesResponse>;
|
|
2069
2128
|
parse(input: string): Promise<InputType>;
|
|
2070
2129
|
prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
|
|
2130
|
+
preparePaymentLink(request: PreparePaymentLinkRequest): Promise<PreparePaymentLinkResponse>;
|
|
2071
2131
|
prepareSendBatch(request: PrepareSendBatchRequest): Promise<PrepareSendBatchResponse>;
|
|
2072
2132
|
prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
|
|
2073
2133
|
prepareUnilateralExit(request: PrepareUnilateralExitRequest): Promise<PrepareUnilateralExitResponse>;
|
|
@@ -234,6 +234,13 @@ class BreezSdk {
|
|
|
234
234
|
const ret = wasm.breezsdk_disconnect(this.__wbg_ptr);
|
|
235
235
|
return ret;
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* @returns {Promise<ExportUnilateralExitStateResponse>}
|
|
239
|
+
*/
|
|
240
|
+
exportUnilateralExitState() {
|
|
241
|
+
const ret = wasm.breezsdk_exportUnilateralExitState(this.__wbg_ptr);
|
|
242
|
+
return ret;
|
|
243
|
+
}
|
|
237
244
|
/**
|
|
238
245
|
* @param {FetchConversionLimitsRequest} request
|
|
239
246
|
* @returns {Promise<FetchConversionLimitsResponse>}
|
|
@@ -295,6 +302,14 @@ class BreezSdk {
|
|
|
295
302
|
const ret = wasm.breezsdk_getUserSettings(this.__wbg_ptr);
|
|
296
303
|
return ret;
|
|
297
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* @param {ImportUnilateralExitStateRequest} request
|
|
307
|
+
* @returns {Promise<ImportUnilateralExitStateResponse>}
|
|
308
|
+
*/
|
|
309
|
+
importUnilateralExitState(request) {
|
|
310
|
+
const ret = wasm.breezsdk_importUnilateralExitState(this.__wbg_ptr, request);
|
|
311
|
+
return ret;
|
|
312
|
+
}
|
|
298
313
|
/**
|
|
299
314
|
* @param {ListContactsRequest} request
|
|
300
315
|
* @returns {Promise<Contact[]>}
|
|
@@ -390,6 +405,14 @@ class BreezSdk {
|
|
|
390
405
|
const ret = wasm.breezsdk_prepareLnurlPay(this.__wbg_ptr, request);
|
|
391
406
|
return ret;
|
|
392
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* @param {PreparePaymentLinkRequest} request
|
|
410
|
+
* @returns {Promise<PreparePaymentLinkResponse>}
|
|
411
|
+
*/
|
|
412
|
+
preparePaymentLink(request) {
|
|
413
|
+
const ret = wasm.breezsdk_preparePaymentLink(this.__wbg_ptr, request);
|
|
414
|
+
return ret;
|
|
415
|
+
}
|
|
393
416
|
/**
|
|
394
417
|
* @param {PrepareSendBatchRequest} request
|
|
395
418
|
* @returns {Promise<PrepareSendBatchResponse>}
|
|
@@ -2243,6 +2266,10 @@ function __wbg_get_imports() {
|
|
|
2243
2266
|
const ret = createDefaultStorage(getStringFromWasm0(arg0, arg1), arg2);
|
|
2244
2267
|
return ret;
|
|
2245
2268
|
}, arguments); },
|
|
2269
|
+
__wbg_createDefaultTreeStore_231e13cea886fab8: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2270
|
+
const ret = createDefaultTreeStore(getStringFromWasm0(arg0, arg1), arg2);
|
|
2271
|
+
return ret;
|
|
2272
|
+
}, arguments); },
|
|
2246
2273
|
__wbg_createMysqlPool_8927bff3a28fcef9: function() { return handleError(function (arg0) {
|
|
2247
2274
|
const ret = createMysqlPool(arg0);
|
|
2248
2275
|
return ret;
|
|
@@ -2558,6 +2585,10 @@ function __wbg_get_imports() {
|
|
|
2558
2585
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2559
2586
|
}
|
|
2560
2587
|
}, arguments); },
|
|
2588
|
+
__wbg_getExitChains_a61db75ca1ab9009: function() { return handleError(function (arg0, arg1) {
|
|
2589
|
+
const ret = arg0.getExitChains(arg1);
|
|
2590
|
+
return ret;
|
|
2591
|
+
}, arguments); },
|
|
2561
2592
|
__wbg_getIdentityPublicKey_c6fcd87d66ed6927: function() { return handleError(function (arg0) {
|
|
2562
2593
|
const ret = arg0.getIdentityPublicKey();
|
|
2563
2594
|
return ret;
|
|
@@ -2848,6 +2879,10 @@ function __wbg_get_imports() {
|
|
|
2848
2879
|
const ret = Symbol.iterator;
|
|
2849
2880
|
return ret;
|
|
2850
2881
|
},
|
|
2882
|
+
__wbg_leavesMissingExitChains_f49172139683e37b: function() { return handleError(function (arg0) {
|
|
2883
|
+
const ret = arg0.leavesMissingExitChains();
|
|
2884
|
+
return ret;
|
|
2885
|
+
}, arguments); },
|
|
2851
2886
|
__wbg_length_0a6ce016dc1460b0: function(arg0) {
|
|
2852
2887
|
const ret = arg0.length;
|
|
2853
2888
|
return ret;
|
|
@@ -3454,6 +3489,10 @@ function __wbg_get_imports() {
|
|
|
3454
3489
|
const ret = arg0.status;
|
|
3455
3490
|
return ret;
|
|
3456
3491
|
},
|
|
3492
|
+
__wbg_storeAncestors_4977efb1f53b8d99: function() { return handleError(function (arg0, arg1) {
|
|
3493
|
+
const ret = arg0.storeAncestors(arg1);
|
|
3494
|
+
return ret;
|
|
3495
|
+
}, arguments); },
|
|
3457
3496
|
__wbg_stringify_7fd5cae8859a6f10: function() { return handleError(function (arg0) {
|
|
3458
3497
|
const ret = JSON.stringify(arg0);
|
|
3459
3498
|
return ret;
|
|
@@ -3618,62 +3657,62 @@ function __wbg_get_imports() {
|
|
|
3618
3657
|
return ret;
|
|
3619
3658
|
},
|
|
3620
3659
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
3621
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3622
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3660
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 22, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3661
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522);
|
|
3623
3662
|
return ret;
|
|
3624
3663
|
},
|
|
3625
3664
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
3626
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3665
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3627
3666
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
|
|
3628
3667
|
return ret;
|
|
3629
3668
|
},
|
|
3630
3669
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
3631
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
3670
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3632
3671
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
|
|
3633
3672
|
return ret;
|
|
3634
3673
|
},
|
|
3635
3674
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
3636
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx:
|
|
3675
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3637
3676
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
|
|
3638
3677
|
return ret;
|
|
3639
3678
|
},
|
|
3640
3679
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
3641
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
3680
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3642
3681
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
|
|
3643
3682
|
return ret;
|
|
3644
3683
|
},
|
|
3645
3684
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
3646
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
3685
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3647
3686
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
|
|
3648
3687
|
return ret;
|
|
3649
3688
|
},
|
|
3650
3689
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
3651
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx:
|
|
3652
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3690
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx: 22, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3691
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6);
|
|
3653
3692
|
return ret;
|
|
3654
3693
|
},
|
|
3655
3694
|
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
3656
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx:
|
|
3657
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3695
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx: 22, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3696
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7);
|
|
3658
3697
|
return ret;
|
|
3659
3698
|
},
|
|
3660
3699
|
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
3661
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx:
|
|
3662
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3700
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx: 22, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3701
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8);
|
|
3663
3702
|
return ret;
|
|
3664
3703
|
},
|
|
3665
3704
|
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
|
|
3666
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx:
|
|
3667
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3705
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx: 22, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3706
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9);
|
|
3668
3707
|
return ret;
|
|
3669
3708
|
},
|
|
3670
3709
|
__wbindgen_cast_000000000000000b: function(arg0, arg1) {
|
|
3671
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3710
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 400, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3672
3711
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
|
|
3673
3712
|
return ret;
|
|
3674
3713
|
},
|
|
3675
3714
|
__wbindgen_cast_000000000000000c: function(arg0, arg1) {
|
|
3676
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3715
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 429, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
3677
3716
|
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
|
|
3678
3717
|
return ret;
|
|
3679
3718
|
},
|
|
@@ -3793,36 +3832,36 @@ function wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5(arg0, a
|
|
|
3793
3832
|
wasm.wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5(arg0, arg1, arg2);
|
|
3794
3833
|
}
|
|
3795
3834
|
|
|
3796
|
-
function
|
|
3797
|
-
const ret = wasm.
|
|
3835
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522(arg0, arg1, arg2) {
|
|
3836
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522(arg0, arg1, arg2);
|
|
3798
3837
|
if (ret[1]) {
|
|
3799
3838
|
throw takeFromExternrefTable0(ret[0]);
|
|
3800
3839
|
}
|
|
3801
3840
|
}
|
|
3802
3841
|
|
|
3803
|
-
function
|
|
3804
|
-
const ret = wasm.
|
|
3842
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6(arg0, arg1, arg2) {
|
|
3843
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6(arg0, arg1, arg2);
|
|
3805
3844
|
if (ret[1]) {
|
|
3806
3845
|
throw takeFromExternrefTable0(ret[0]);
|
|
3807
3846
|
}
|
|
3808
3847
|
}
|
|
3809
3848
|
|
|
3810
|
-
function
|
|
3811
|
-
const ret = wasm.
|
|
3849
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7(arg0, arg1, arg2) {
|
|
3850
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7(arg0, arg1, arg2);
|
|
3812
3851
|
if (ret[1]) {
|
|
3813
3852
|
throw takeFromExternrefTable0(ret[0]);
|
|
3814
3853
|
}
|
|
3815
3854
|
}
|
|
3816
3855
|
|
|
3817
|
-
function
|
|
3818
|
-
const ret = wasm.
|
|
3856
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8(arg0, arg1, arg2) {
|
|
3857
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8(arg0, arg1, arg2);
|
|
3819
3858
|
if (ret[1]) {
|
|
3820
3859
|
throw takeFromExternrefTable0(ret[0]);
|
|
3821
3860
|
}
|
|
3822
3861
|
}
|
|
3823
3862
|
|
|
3824
|
-
function
|
|
3825
|
-
const ret = wasm.
|
|
3863
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9(arg0, arg1, arg2) {
|
|
3864
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9(arg0, arg1, arg2);
|
|
3826
3865
|
if (ret[1]) {
|
|
3827
3866
|
throw takeFromExternrefTable0(ret[0]);
|
|
3828
3867
|
}
|
|
Binary file
|
|
@@ -33,6 +33,7 @@ export const breezsdk_claimLightningAddressTransfer: (a: number, b: any) => any;
|
|
|
33
33
|
export const breezsdk_deleteContact: (a: number, b: number, c: number) => any;
|
|
34
34
|
export const breezsdk_deleteLightningAddress: (a: number) => any;
|
|
35
35
|
export const breezsdk_disconnect: (a: number) => any;
|
|
36
|
+
export const breezsdk_exportUnilateralExitState: (a: number) => any;
|
|
36
37
|
export const breezsdk_fetchConversionLimits: (a: number, b: any) => any;
|
|
37
38
|
export const breezsdk_getCrossChainRoutes: (a: number, b: any) => any;
|
|
38
39
|
export const breezsdk_getInfo: (a: number, b: any) => any;
|
|
@@ -41,6 +42,7 @@ export const breezsdk_getPayment: (a: number, b: any) => any;
|
|
|
41
42
|
export const breezsdk_getTokenIssuer: (a: number) => number;
|
|
42
43
|
export const breezsdk_getTokensMetadata: (a: number, b: any) => any;
|
|
43
44
|
export const breezsdk_getUserSettings: (a: number) => any;
|
|
45
|
+
export const breezsdk_importUnilateralExitState: (a: number, b: any) => any;
|
|
44
46
|
export const breezsdk_listContacts: (a: number, b: any) => any;
|
|
45
47
|
export const breezsdk_listFiatCurrencies: (a: number) => any;
|
|
46
48
|
export const breezsdk_listFiatRates: (a: number) => any;
|
|
@@ -53,6 +55,7 @@ export const breezsdk_lnurlWithdraw: (a: number, b: any) => any;
|
|
|
53
55
|
export const breezsdk_optimizeLeaves: (a: number, b: any) => any;
|
|
54
56
|
export const breezsdk_parse: (a: number, b: number, c: number) => any;
|
|
55
57
|
export const breezsdk_prepareLnurlPay: (a: number, b: any) => any;
|
|
58
|
+
export const breezsdk_preparePaymentLink: (a: number, b: any) => any;
|
|
56
59
|
export const breezsdk_prepareSendBatch: (a: number, b: any) => any;
|
|
57
60
|
export const breezsdk_prepareSendPayment: (a: number, b: any) => any;
|
|
58
61
|
export const breezsdk_prepareUnilateralExit: (a: number, b: any) => any;
|
|
@@ -178,16 +181,16 @@ export const intounderlyingsource_cancel: (a: number) => void;
|
|
|
178
181
|
export const intounderlyingsource_pull: (a: number, b: any) => any;
|
|
179
182
|
export const __wbg_externalbreezsignerhandle_free: (a: number, b: number) => void;
|
|
180
183
|
export const __wbg_defaultsessionstore_free: (a: number, b: number) => void;
|
|
181
|
-
export const __wbg_externalsigningsignerhandle_free: (a: number, b: number) => void;
|
|
182
184
|
export const __wbg_externalsparksignerhandle_free: (a: number, b: number) => void;
|
|
185
|
+
export const __wbg_externalsigningsignerhandle_free: (a: number, b: number) => void;
|
|
183
186
|
export const __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
|
|
184
187
|
export const signingonlyexternalsigners_breezSigner: (a: number) => number;
|
|
185
188
|
export const signingonlyexternalsigners_sparkSigner: (a: number) => number;
|
|
186
|
-
export const
|
|
187
|
-
export const
|
|
188
|
-
export const
|
|
189
|
-
export const
|
|
190
|
-
export const
|
|
189
|
+
export const wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522: (a: number, b: number, c: any) => [number, number];
|
|
190
|
+
export const wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6: (a: number, b: number, c: any) => [number, number];
|
|
191
|
+
export const wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7: (a: number, b: number, c: any) => [number, number];
|
|
192
|
+
export const wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8: (a: number, b: number, c: any) => [number, number];
|
|
193
|
+
export const wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9: (a: number, b: number, c: any) => [number, number];
|
|
191
194
|
export const wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
|
|
192
195
|
export const wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2: (a: number, b: number, c: any) => void;
|
|
193
196
|
export const wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2: (a: number, b: number, c: any) => void;
|
package/nodejs/index.js
CHANGED
|
@@ -14,6 +14,17 @@ try {
|
|
|
14
14
|
console.warn('Breez SDK: Storage operations may not work properly. Ignore this warning if you are not using the default storage.');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// Automatically import and set up the default tree store for Node.js
|
|
18
|
+
try {
|
|
19
|
+
const { createDefaultTreeStore } = require('./tree-store/index.cjs');
|
|
20
|
+
|
|
21
|
+
// Make createDefaultTreeStore available globally for the WASM bridge to find.
|
|
22
|
+
global.createDefaultTreeStore = createDefaultTreeStore;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.warn('Breez SDK: Failed to load Node.js tree store:', error.message);
|
|
25
|
+
console.warn('Breez SDK: Tree state will not be persisted. Ignore this warning if you are not using the default storage.');
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
// Automatically import and set up the PostgreSQL storage for Node.js
|
|
18
29
|
try {
|
|
19
30
|
const { createPostgresStorage, createPostgresPool, createPostgresStorageWithPool } = require('./postgres-storage/index.cjs');
|
|
@@ -801,7 +801,7 @@ class MysqlStorage {
|
|
|
801
801
|
async listDeposits() {
|
|
802
802
|
try {
|
|
803
803
|
const [rows] = await this.pool.query(
|
|
804
|
-
"SELECT txid, vout, amount_sats, is_mature, claim_error, refund_tx, refund_tx_id FROM brz_unclaimed_deposits WHERE user_id = ?",
|
|
804
|
+
"SELECT txid, vout, amount_sats, is_mature, claim_error, refund_tx, refund_tx_id, instant_claim_status FROM brz_unclaimed_deposits WHERE user_id = ?",
|
|
805
805
|
[this.identity]
|
|
806
806
|
);
|
|
807
807
|
|
|
@@ -814,6 +814,7 @@ class MysqlStorage {
|
|
|
814
814
|
claimError: parseJson(row.claim_error),
|
|
815
815
|
refundTx: row.refund_tx,
|
|
816
816
|
refundTxId: row.refund_tx_id,
|
|
817
|
+
instantClaimStatus: parseJson(row.instant_claim_status),
|
|
817
818
|
}));
|
|
818
819
|
} catch (error) {
|
|
819
820
|
throw new StorageError(
|
|
@@ -839,6 +840,13 @@ class MysqlStorage {
|
|
|
839
840
|
WHERE user_id = ? AND txid = ? AND vout = ?`,
|
|
840
841
|
[payload.refundTx, payload.refundTxid, this.identity, txid, vout]
|
|
841
842
|
);
|
|
843
|
+
} else if (payload.type === "instantClaim") {
|
|
844
|
+
await this.pool.query(
|
|
845
|
+
`UPDATE brz_unclaimed_deposits
|
|
846
|
+
SET instant_claim_status = ?
|
|
847
|
+
WHERE user_id = ? AND txid = ? AND vout = ?`,
|
|
848
|
+
[JSON.stringify(payload.status), this.identity, txid, vout]
|
|
849
|
+
);
|
|
842
850
|
} else {
|
|
843
851
|
throw new StorageError(`Unknown payload type: ${payload.type}`);
|
|
844
852
|
}
|
|
@@ -562,6 +562,12 @@ class MysqlMigrationManager {
|
|
|
562
562
|
)`,
|
|
563
563
|
],
|
|
564
564
|
},
|
|
565
|
+
{
|
|
566
|
+
name: "Add instant claim status to brz_unclaimed_deposits",
|
|
567
|
+
sql: [
|
|
568
|
+
`ALTER TABLE brz_unclaimed_deposits ADD COLUMN instant_claim_status JSON NULL`,
|
|
569
|
+
],
|
|
570
|
+
},
|
|
565
571
|
];
|
|
566
572
|
}
|
|
567
573
|
}
|