@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
package/breez-sdk-spark.tgz
CHANGED
|
Binary file
|
|
@@ -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>;
|
|
@@ -231,6 +231,13 @@ export class BreezSdk {
|
|
|
231
231
|
const ret = wasm.breezsdk_disconnect(this.__wbg_ptr);
|
|
232
232
|
return ret;
|
|
233
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* @returns {Promise<ExportUnilateralExitStateResponse>}
|
|
236
|
+
*/
|
|
237
|
+
exportUnilateralExitState() {
|
|
238
|
+
const ret = wasm.breezsdk_exportUnilateralExitState(this.__wbg_ptr);
|
|
239
|
+
return ret;
|
|
240
|
+
}
|
|
234
241
|
/**
|
|
235
242
|
* @param {FetchConversionLimitsRequest} request
|
|
236
243
|
* @returns {Promise<FetchConversionLimitsResponse>}
|
|
@@ -292,6 +299,14 @@ export class BreezSdk {
|
|
|
292
299
|
const ret = wasm.breezsdk_getUserSettings(this.__wbg_ptr);
|
|
293
300
|
return ret;
|
|
294
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* @param {ImportUnilateralExitStateRequest} request
|
|
304
|
+
* @returns {Promise<ImportUnilateralExitStateResponse>}
|
|
305
|
+
*/
|
|
306
|
+
importUnilateralExitState(request) {
|
|
307
|
+
const ret = wasm.breezsdk_importUnilateralExitState(this.__wbg_ptr, request);
|
|
308
|
+
return ret;
|
|
309
|
+
}
|
|
295
310
|
/**
|
|
296
311
|
* @param {ListContactsRequest} request
|
|
297
312
|
* @returns {Promise<Contact[]>}
|
|
@@ -387,6 +402,14 @@ export class BreezSdk {
|
|
|
387
402
|
const ret = wasm.breezsdk_prepareLnurlPay(this.__wbg_ptr, request);
|
|
388
403
|
return ret;
|
|
389
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* @param {PreparePaymentLinkRequest} request
|
|
407
|
+
* @returns {Promise<PreparePaymentLinkResponse>}
|
|
408
|
+
*/
|
|
409
|
+
preparePaymentLink(request) {
|
|
410
|
+
const ret = wasm.breezsdk_preparePaymentLink(this.__wbg_ptr, request);
|
|
411
|
+
return ret;
|
|
412
|
+
}
|
|
390
413
|
/**
|
|
391
414
|
* @param {PrepareSendBatchRequest} request
|
|
392
415
|
* @returns {Promise<PrepareSendBatchResponse>}
|
|
@@ -2199,6 +2222,10 @@ export function __wbg_createDefaultStorage_0d66fd24fb8cc6f3() { return handleErr
|
|
|
2199
2222
|
const ret = createDefaultStorage(getStringFromWasm0(arg0, arg1), arg2);
|
|
2200
2223
|
return ret;
|
|
2201
2224
|
}, arguments); }
|
|
2225
|
+
export function __wbg_createDefaultTreeStore_231e13cea886fab8() { return handleError(function (arg0, arg1, arg2) {
|
|
2226
|
+
const ret = createDefaultTreeStore(getStringFromWasm0(arg0, arg1), arg2);
|
|
2227
|
+
return ret;
|
|
2228
|
+
}, arguments); }
|
|
2202
2229
|
export function __wbg_createMysqlPool_8927bff3a28fcef9() { return handleError(function (arg0) {
|
|
2203
2230
|
const ret = createMysqlPool(arg0);
|
|
2204
2231
|
return ret;
|
|
@@ -2514,6 +2541,10 @@ export function __wbg_getCrossChainSwap_e3b8fcf14d3d17ce() { return handleError(
|
|
|
2514
2541
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2515
2542
|
}
|
|
2516
2543
|
}, arguments); }
|
|
2544
|
+
export function __wbg_getExitChains_a61db75ca1ab9009() { return handleError(function (arg0, arg1) {
|
|
2545
|
+
const ret = arg0.getExitChains(arg1);
|
|
2546
|
+
return ret;
|
|
2547
|
+
}, arguments); }
|
|
2517
2548
|
export function __wbg_getIdentityPublicKey_c6fcd87d66ed6927() { return handleError(function (arg0) {
|
|
2518
2549
|
const ret = arg0.getIdentityPublicKey();
|
|
2519
2550
|
return ret;
|
|
@@ -2804,6 +2835,10 @@ export function __wbg_iterator_9d68985a1d096fc2() {
|
|
|
2804
2835
|
const ret = Symbol.iterator;
|
|
2805
2836
|
return ret;
|
|
2806
2837
|
}
|
|
2838
|
+
export function __wbg_leavesMissingExitChains_f49172139683e37b() { return handleError(function (arg0) {
|
|
2839
|
+
const ret = arg0.leavesMissingExitChains();
|
|
2840
|
+
return ret;
|
|
2841
|
+
}, arguments); }
|
|
2807
2842
|
export function __wbg_length_0a6ce016dc1460b0(arg0) {
|
|
2808
2843
|
const ret = arg0.length;
|
|
2809
2844
|
return ret;
|
|
@@ -3410,6 +3445,10 @@ export function __wbg_status_157e67ab07d01f8a(arg0) {
|
|
|
3410
3445
|
const ret = arg0.status;
|
|
3411
3446
|
return ret;
|
|
3412
3447
|
}
|
|
3448
|
+
export function __wbg_storeAncestors_4977efb1f53b8d99() { return handleError(function (arg0, arg1) {
|
|
3449
|
+
const ret = arg0.storeAncestors(arg1);
|
|
3450
|
+
return ret;
|
|
3451
|
+
}, arguments); }
|
|
3413
3452
|
export function __wbg_stringify_7fd5cae8859a6f10() { return handleError(function (arg0) {
|
|
3414
3453
|
const ret = JSON.stringify(arg0);
|
|
3415
3454
|
return ret;
|
|
@@ -3574,62 +3613,62 @@ export function __wbg_wasmsdkcontext_new(arg0) {
|
|
|
3574
3613
|
return ret;
|
|
3575
3614
|
}
|
|
3576
3615
|
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
3577
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3578
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3616
|
+
// 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`.
|
|
3617
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522);
|
|
3579
3618
|
return ret;
|
|
3580
3619
|
}
|
|
3581
3620
|
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
3582
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3621
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3583
3622
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
|
|
3584
3623
|
return ret;
|
|
3585
3624
|
}
|
|
3586
3625
|
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
3587
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
3626
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3588
3627
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
|
|
3589
3628
|
return ret;
|
|
3590
3629
|
}
|
|
3591
3630
|
export function __wbindgen_cast_0000000000000004(arg0, arg1) {
|
|
3592
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx:
|
|
3631
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3593
3632
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
|
|
3594
3633
|
return ret;
|
|
3595
3634
|
}
|
|
3596
3635
|
export function __wbindgen_cast_0000000000000005(arg0, arg1) {
|
|
3597
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
3636
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3598
3637
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
|
|
3599
3638
|
return ret;
|
|
3600
3639
|
}
|
|
3601
3640
|
export function __wbindgen_cast_0000000000000006(arg0, arg1) {
|
|
3602
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
3641
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 395, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3603
3642
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
|
|
3604
3643
|
return ret;
|
|
3605
3644
|
}
|
|
3606
3645
|
export function __wbindgen_cast_0000000000000007(arg0, arg1) {
|
|
3607
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx:
|
|
3608
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3646
|
+
// 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`.
|
|
3647
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6);
|
|
3609
3648
|
return ret;
|
|
3610
3649
|
}
|
|
3611
3650
|
export function __wbindgen_cast_0000000000000008(arg0, arg1) {
|
|
3612
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx:
|
|
3613
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3651
|
+
// 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`.
|
|
3652
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7);
|
|
3614
3653
|
return ret;
|
|
3615
3654
|
}
|
|
3616
3655
|
export function __wbindgen_cast_0000000000000009(arg0, arg1) {
|
|
3617
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx:
|
|
3618
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3656
|
+
// 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`.
|
|
3657
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8);
|
|
3619
3658
|
return ret;
|
|
3620
3659
|
}
|
|
3621
3660
|
export function __wbindgen_cast_000000000000000a(arg0, arg1) {
|
|
3622
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx:
|
|
3623
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3661
|
+
// 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`.
|
|
3662
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9);
|
|
3624
3663
|
return ret;
|
|
3625
3664
|
}
|
|
3626
3665
|
export function __wbindgen_cast_000000000000000b(arg0, arg1) {
|
|
3627
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3666
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 400, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3628
3667
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
|
|
3629
3668
|
return ret;
|
|
3630
3669
|
}
|
|
3631
3670
|
export function __wbindgen_cast_000000000000000c(arg0, arg1) {
|
|
3632
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3671
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 429, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
3633
3672
|
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
|
|
3634
3673
|
return ret;
|
|
3635
3674
|
}
|
|
@@ -3742,36 +3781,36 @@ function wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5(arg0, a
|
|
|
3742
3781
|
wasm.wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5(arg0, arg1, arg2);
|
|
3743
3782
|
}
|
|
3744
3783
|
|
|
3745
|
-
function
|
|
3746
|
-
const ret = wasm.
|
|
3784
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522(arg0, arg1, arg2) {
|
|
3785
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522(arg0, arg1, arg2);
|
|
3747
3786
|
if (ret[1]) {
|
|
3748
3787
|
throw takeFromExternrefTable0(ret[0]);
|
|
3749
3788
|
}
|
|
3750
3789
|
}
|
|
3751
3790
|
|
|
3752
|
-
function
|
|
3753
|
-
const ret = wasm.
|
|
3791
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6(arg0, arg1, arg2) {
|
|
3792
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6(arg0, arg1, arg2);
|
|
3754
3793
|
if (ret[1]) {
|
|
3755
3794
|
throw takeFromExternrefTable0(ret[0]);
|
|
3756
3795
|
}
|
|
3757
3796
|
}
|
|
3758
3797
|
|
|
3759
|
-
function
|
|
3760
|
-
const ret = wasm.
|
|
3798
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7(arg0, arg1, arg2) {
|
|
3799
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7(arg0, arg1, arg2);
|
|
3761
3800
|
if (ret[1]) {
|
|
3762
3801
|
throw takeFromExternrefTable0(ret[0]);
|
|
3763
3802
|
}
|
|
3764
3803
|
}
|
|
3765
3804
|
|
|
3766
|
-
function
|
|
3767
|
-
const ret = wasm.
|
|
3805
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8(arg0, arg1, arg2) {
|
|
3806
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8(arg0, arg1, arg2);
|
|
3768
3807
|
if (ret[1]) {
|
|
3769
3808
|
throw takeFromExternrefTable0(ret[0]);
|
|
3770
3809
|
}
|
|
3771
3810
|
}
|
|
3772
3811
|
|
|
3773
|
-
function
|
|
3774
|
-
const ret = wasm.
|
|
3812
|
+
function wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9(arg0, arg1, arg2) {
|
|
3813
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9(arg0, arg1, arg2);
|
|
3775
3814
|
if (ret[1]) {
|
|
3776
3815
|
throw takeFromExternrefTable0(ret[0]);
|
|
3777
3816
|
}
|
|
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/bundler/index.js
CHANGED
|
@@ -10,16 +10,29 @@ const setupWebStorage = async () => {
|
|
|
10
10
|
try {
|
|
11
11
|
// Dynamic import of storage module
|
|
12
12
|
const { createDefaultStorage } = await import('./storage/index.js');
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
// Make createDefaultStorage available globally for WASM to find
|
|
15
15
|
globalThis.createDefaultStorage = createDefaultStorage;
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
console.log('Breez SDK: Web IndexedDB storage automatically enabled');
|
|
18
18
|
storageSetupComplete = true;
|
|
19
19
|
} catch (error) {
|
|
20
20
|
console.warn('Breez SDK: Failed to load Web storage:', error.message);
|
|
21
21
|
console.warn('Breez SDK: Storage operations may not work properly. Ignore this warning if you are not using the default storage.');
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
// Dynamic import of the IndexedDB tree store module
|
|
26
|
+
const { createWebTreeStore } = await import('./tree-store/index.js');
|
|
27
|
+
|
|
28
|
+
// Make createDefaultTreeStore available globally for the WASM bridge to
|
|
29
|
+
// find. The browser store uses its own `-tree` database.
|
|
30
|
+
globalThis.createDefaultTreeStore = (dbName, logger) =>
|
|
31
|
+
createWebTreeStore(`${dbName}-tree`, logger);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.warn('Breez SDK: Failed to load Web tree store:', error.message);
|
|
34
|
+
console.warn('Breez SDK: Tree state will not be persisted. Ignore this warning if you are not using the default storage.');
|
|
35
|
+
}
|
|
23
36
|
};
|
|
24
37
|
|
|
25
38
|
// Initialize WASM and storage
|
package/bundler/package.json
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"./storage": {
|
|
10
10
|
"default": "./storage/index.js",
|
|
11
11
|
"import": "./storage/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./tree-store": {
|
|
14
|
+
"default": "./tree-store/index.js",
|
|
15
|
+
"import": "./tree-store/index.js"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"files": [
|
|
@@ -17,6 +21,7 @@
|
|
|
17
21
|
"breez_sdk_spark_wasm_bg.js",
|
|
18
22
|
"breez_sdk_spark_wasm.d.ts",
|
|
19
23
|
"storage/",
|
|
24
|
+
"tree-store/",
|
|
20
25
|
"index.js"
|
|
21
26
|
],
|
|
22
27
|
"main": "index.js",
|
package/bundler/storage/index.js
CHANGED
|
@@ -1418,6 +1418,7 @@ class IndexedDBStorage {
|
|
|
1418
1418
|
claimError: existing?.claimError ?? null,
|
|
1419
1419
|
refundTx: existing?.refundTx ?? null,
|
|
1420
1420
|
refundTxId: existing?.refundTxId ?? null,
|
|
1421
|
+
instantClaimStatus: existing?.instantClaimStatus ?? null,
|
|
1421
1422
|
};
|
|
1422
1423
|
|
|
1423
1424
|
const putRequest = store.put(depositToStore);
|
|
@@ -1490,6 +1491,9 @@ class IndexedDBStorage {
|
|
|
1490
1491
|
claimError: row.claimError ? JSON.parse(row.claimError) : null,
|
|
1491
1492
|
refundTx: row.refundTx,
|
|
1492
1493
|
refundTxId: row.refundTxId,
|
|
1494
|
+
instantClaimStatus: row.instantClaimStatus
|
|
1495
|
+
? JSON.parse(row.instantClaimStatus)
|
|
1496
|
+
: null,
|
|
1493
1497
|
}));
|
|
1494
1498
|
resolve(deposits);
|
|
1495
1499
|
};
|
|
@@ -1539,6 +1543,8 @@ class IndexedDBStorage {
|
|
|
1539
1543
|
updatedDeposit.refundTx = payload.refundTx;
|
|
1540
1544
|
updatedDeposit.refundTxId = payload.refundTxid;
|
|
1541
1545
|
updatedDeposit.claimError = null;
|
|
1546
|
+
} else if (payload.type === "instantClaim") {
|
|
1547
|
+
updatedDeposit.instantClaimStatus = JSON.stringify(payload.status);
|
|
1542
1548
|
} else {
|
|
1543
1549
|
reject(new StorageError(`Unknown payload type: ${payload.type}`));
|
|
1544
1550
|
return;
|