@breeztech/breez-sdk-spark 0.25.0 → 0.26.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 +44 -10
- package/bundler/breez_sdk_spark_wasm_bg.js +40 -24
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -5
- package/bundler/storage/index.js +145 -1
- package/deno/breez_sdk_spark_wasm.d.ts +44 -10
- package/deno/breez_sdk_spark_wasm.js +40 -24
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -5
- package/nodejs/breez_sdk_spark_wasm.d.ts +44 -10
- package/nodejs/breez_sdk_spark_wasm.js +40 -24
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -5
- package/nodejs/mysql-storage/index.cjs +67 -1
- package/nodejs/mysql-storage/migrations.cjs +23 -0
- package/nodejs/postgres-storage/index.cjs +67 -1
- package/nodejs/postgres-storage/migrations.cjs +23 -0
- package/nodejs/storage/index.cjs +81 -1
- package/nodejs/storage/migrations.cjs +21 -0
- package/package.json +1 -1
- package/web/breez_sdk_spark_wasm.d.ts +49 -15
- package/web/breez_sdk_spark_wasm.js +40 -24
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -5
- package/web/storage/index.js +145 -1
|
@@ -545,7 +545,7 @@ export interface BatchRecipient {
|
|
|
545
545
|
|
|
546
546
|
export interface BatchTotal {
|
|
547
547
|
tokenIdentifier?: string;
|
|
548
|
-
amount:
|
|
548
|
+
amount: string;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
export interface Bip21Details {
|
|
@@ -705,7 +705,7 @@ export interface ClaimDepositRequest {
|
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
export interface ClaimDepositResponse {
|
|
708
|
-
|
|
708
|
+
outcome: ClaimDepositOutcome;
|
|
709
709
|
}
|
|
710
710
|
|
|
711
711
|
export interface ClaimHtlcPaymentRequest {
|
|
@@ -832,12 +832,17 @@ export interface Credentials {
|
|
|
832
832
|
password: string;
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
+
export interface CrossChainAcceptedAsset {
|
|
836
|
+
asset: SparkAsset;
|
|
837
|
+
limits?: CrossChainRouteLimits;
|
|
838
|
+
}
|
|
839
|
+
|
|
835
840
|
export interface CrossChainAddressDetails {
|
|
836
841
|
address: string;
|
|
837
842
|
addressFamily: CrossChainAddressFamily;
|
|
838
843
|
contractAddress?: string;
|
|
839
844
|
chainId?: number;
|
|
840
|
-
amount?:
|
|
845
|
+
amount?: string;
|
|
841
846
|
}
|
|
842
847
|
|
|
843
848
|
export interface CrossChainConfig {
|
|
@@ -853,9 +858,17 @@ export interface CrossChainReceiveInfo {
|
|
|
853
858
|
tokenIdentifier?: string;
|
|
854
859
|
serviceFeeAmount: string;
|
|
855
860
|
serviceFeeAsset?: string;
|
|
861
|
+
serviceFeeAssetDecimals?: number;
|
|
856
862
|
expiresAt: number;
|
|
857
863
|
}
|
|
858
864
|
|
|
865
|
+
export interface CrossChainRouteLimits {
|
|
866
|
+
minAmount?: string;
|
|
867
|
+
maxAmount?: string;
|
|
868
|
+
minUsdCents?: number;
|
|
869
|
+
maxUsdCents?: number;
|
|
870
|
+
}
|
|
871
|
+
|
|
859
872
|
export interface CrossChainRoutePair {
|
|
860
873
|
provider: CrossChainProvider;
|
|
861
874
|
chain: string;
|
|
@@ -864,7 +877,7 @@ export interface CrossChainRoutePair {
|
|
|
864
877
|
contractAddress?: string;
|
|
865
878
|
decimals: number;
|
|
866
879
|
exactOutEligible: boolean;
|
|
867
|
-
acceptedAssets:
|
|
880
|
+
acceptedAssets: CrossChainAcceptedAsset[];
|
|
868
881
|
deliveryMethods: DeliveryMethod[];
|
|
869
882
|
}
|
|
870
883
|
|
|
@@ -888,6 +901,7 @@ export interface DepositInfo {
|
|
|
888
901
|
claimError?: DepositClaimError;
|
|
889
902
|
instantClaimStatus?: InstantClaimStatus;
|
|
890
903
|
refundState?: RefundState;
|
|
904
|
+
maxClaimFee?: MaxFee;
|
|
891
905
|
}
|
|
892
906
|
|
|
893
907
|
export interface EcdsaSignatureBytes {
|
|
@@ -968,6 +982,10 @@ export interface ExternalInputParser {
|
|
|
968
982
|
parserUrl: string;
|
|
969
983
|
}
|
|
970
984
|
|
|
985
|
+
export interface ExternalLeafSigningKey {
|
|
986
|
+
derivedFrom: ExternalTreeNodeId;
|
|
987
|
+
}
|
|
988
|
+
|
|
971
989
|
export interface ExternalNewLeafKey {
|
|
972
990
|
nodeId: ExternalTreeNodeId;
|
|
973
991
|
newSigningPublicKey: number[];
|
|
@@ -1114,6 +1132,7 @@ export interface ExternalStartedStaticDepositRefund {
|
|
|
1114
1132
|
export interface ExternalTransferLeafInput {
|
|
1115
1133
|
nodeId: ExternalTreeNodeId;
|
|
1116
1134
|
newLeafId: ExternalTreeNodeId;
|
|
1135
|
+
signingKey: ExternalLeafSigningKey;
|
|
1117
1136
|
}
|
|
1118
1137
|
|
|
1119
1138
|
export interface ExternalTreeNodeId {
|
|
@@ -1486,6 +1505,7 @@ export interface PreparePaymentLinkResponse {
|
|
|
1486
1505
|
asset: string;
|
|
1487
1506
|
serviceFeeAmount: bigint;
|
|
1488
1507
|
serviceFeeAsset?: string;
|
|
1508
|
+
serviceFeeAssetDecimals?: number;
|
|
1489
1509
|
expiresAt: string;
|
|
1490
1510
|
}
|
|
1491
1511
|
|
|
@@ -1831,6 +1851,8 @@ export interface Storage {
|
|
|
1831
1851
|
deleteDeposit: (txid: string, vout: number) => Promise<void>;
|
|
1832
1852
|
listDeposits: () => Promise<DepositInfo[]>;
|
|
1833
1853
|
updateDeposit: (txid: string, vout: number, payload: UpdateDepositPayload) => Promise<void>;
|
|
1854
|
+
listWatchedDepositAddresses: () => Promise<WatchedDepositAddress[]>;
|
|
1855
|
+
updateWatchedDepositAddress: (address: string, payload: UpdateWatchedAddressPayload) => Promise<void>;
|
|
1834
1856
|
setLnurlMetadata: (metadata: SetLnurlMetadataItem[]) => Promise<void>;
|
|
1835
1857
|
getPaymentsByParentIds: (parentPaymentIds: string[]) => Promise<{ [parentId: string]: RelatedPayment[] }>;
|
|
1836
1858
|
listContacts: (request: ListContactsRequest) => Promise<Contact[]>;
|
|
@@ -2025,6 +2047,12 @@ export interface Utxo {
|
|
|
2025
2047
|
status: TxStatus;
|
|
2026
2048
|
}
|
|
2027
2049
|
|
|
2050
|
+
export interface WatchedDepositAddress {
|
|
2051
|
+
address: string;
|
|
2052
|
+
issuedAt: number;
|
|
2053
|
+
seen: boolean;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2028
2056
|
export interface Webhook {
|
|
2029
2057
|
id: string;
|
|
2030
2058
|
url: string;
|
|
@@ -2051,11 +2079,15 @@ export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; red
|
|
|
2051
2079
|
|
|
2052
2080
|
export type ChainApiType = "esplora" | "mempoolSpace";
|
|
2053
2081
|
|
|
2082
|
+
export type ClaimDeferredReason = { type: "maxFeeExceeded"; requiredFeeSats: number; maxFeeSats: number } | { type: "noEarlyClaimAvailable" } | { type: "providerDeclined"; message: string };
|
|
2083
|
+
|
|
2084
|
+
export type ClaimDepositOutcome = { type: "settled"; payment: Payment } | { type: "submitted" } | { type: "deferred"; reason: ClaimDeferredReason };
|
|
2085
|
+
|
|
2054
2086
|
export type ConversionChain = { type: "spark" } | { type: "lightning" } | { type: "external"; name: string; chainId?: string };
|
|
2055
2087
|
|
|
2056
2088
|
export type ConversionFilter = "ammRefundNeeded" | "orchestraPending" | "boltzPending";
|
|
2057
2089
|
|
|
2058
|
-
export type ConversionInfo = { type: "amm"; poolId: string; conversionId: string; status: ConversionStatus; fee?: string; purpose?: ConversionPurpose; amountAdjustment?: AmountAdjustmentReason; degradation?: SwapDegradation } | { type: "orchestra"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; externalTxHash?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; assetDecimals: number; orderId: string; quoteId: string; readToken?: string } | { type: "boltz"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; assetDecimals: number; swapId: string; invoice: string; invoiceAmountSats: number; bridgeRef?: string; maxSlippageBps: number; quoteDegraded?: boolean };
|
|
2090
|
+
export type ConversionInfo = { type: "amm"; poolId: string; conversionId: string; status: ConversionStatus; fee?: string; purpose?: ConversionPurpose; amountAdjustment?: AmountAdjustmentReason; degradation?: SwapDegradation } | { type: "orchestra"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; externalTxHash?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; serviceFeeAssetDecimals?: number; assetDecimals: number; orderId: string; quoteId: string; readToken?: string } | { type: "boltz"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; assetDecimals: number; swapId: string; invoice: string; invoiceAmountSats: number; bridgeRef?: string; maxSlippageBps: number; quoteDegraded?: boolean };
|
|
2059
2091
|
|
|
2060
2092
|
export type ConversionProvider = "amm" | "orchestra" | "boltz";
|
|
2061
2093
|
|
|
@@ -2103,13 +2135,13 @@ export type FeePolicy = "feesExcluded" | "feesIncluded";
|
|
|
2103
2135
|
|
|
2104
2136
|
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);
|
|
2105
2137
|
|
|
2106
|
-
export type InstantClaimStatus = { type: "declined"; maxFeeSats?: number; confirmations?: number } | { type: "submitted"; claimId: string };
|
|
2138
|
+
export type InstantClaimStatus = { type: "declined"; maxFeeSats?: number; confirmations?: number } | { type: "submitted"; claimId: string } | { type: "claimed" };
|
|
2107
2139
|
|
|
2108
2140
|
export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
|
|
2109
2141
|
|
|
2110
2142
|
export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
|
|
2111
2143
|
|
|
2112
|
-
export type Network = "mainnet" | "regtest";
|
|
2144
|
+
export type Network = "mainnet" | "regtest" | "signet";
|
|
2113
2145
|
|
|
2114
2146
|
export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
|
|
2115
2147
|
|
|
@@ -2141,11 +2173,11 @@ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvo
|
|
|
2141
2173
|
|
|
2142
2174
|
export type RefundState = { type: "broadcastPending"; lastError?: string } | { type: "broadcast" };
|
|
2143
2175
|
|
|
2144
|
-
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" };
|
|
2176
|
+
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: "paymentMetadataUpdated"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] } | { type: "unilateralExitStateChanged" };
|
|
2145
2177
|
|
|
2146
2178
|
export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
|
|
2147
2179
|
|
|
2148
|
-
export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string } | { type: "crossChainAddress"; route: CrossChainRoutePair; recipientAddress: string; amountIn: string; assetAmountIn: string; estimatedOut: string; feeAmount: string; serviceFeeAmount: string; serviceFeeAsset?: string; sourceTransferFeeSats: number; feeMode: CrossChainFeeMode; expiresAt: string; providerContext: CrossChainProviderContext };
|
|
2180
|
+
export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string } | { type: "crossChainAddress"; route: CrossChainRoutePair; recipientAddress: string; amountIn: string; assetAmountIn: string; estimatedOut: string; feeAmount: string; serviceFeeAmount: string; serviceFeeAsset?: string; serviceFeeAssetDecimals?: number; sourceTransferFeeSats: number; feeMode: CrossChainFeeMode; expiresAt: string; providerContext: CrossChainProviderContext };
|
|
2149
2181
|
|
|
2150
2182
|
export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
|
|
2151
2183
|
|
|
@@ -2183,7 +2215,9 @@ export type UnilateralExitVerdict = { type: "valid" } | { type: "done" } | { typ
|
|
|
2183
2215
|
|
|
2184
2216
|
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 };
|
|
2185
2217
|
|
|
2186
|
-
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string; state: RefundState } | { type: "instantClaim"; status: InstantClaimStatus } | { type: "refundBroadcastState"; refundTxid: string; state: RefundState };
|
|
2218
|
+
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string; state: RefundState } | { type: "instantClaim"; status: InstantClaimStatus } | { type: "refundBroadcastState"; refundTxid: string; state: RefundState } | { type: "maxClaimFee"; maxFee?: MaxFee };
|
|
2219
|
+
|
|
2220
|
+
export type UpdateWatchedAddressPayload = { type: "watch"; issuedAt: number } | { type: "seen" } | { type: "unwatch"; issuedAt: number };
|
|
2187
2221
|
|
|
2188
2222
|
export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
|
|
2189
2223
|
|
|
@@ -2916,11 +2950,11 @@ export interface InitOutput {
|
|
|
2916
2950
|
readonly __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
|
|
2917
2951
|
readonly signingonlyexternalsigners_breezSigner: (a: number) => number;
|
|
2918
2952
|
readonly signingonlyexternalsigners_sparkSigner: (a: number) => number;
|
|
2919
|
-
readonly
|
|
2920
|
-
readonly
|
|
2921
|
-
readonly
|
|
2922
|
-
readonly
|
|
2923
|
-
readonly
|
|
2953
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a: (a: number, b: number, c: any) => [number, number];
|
|
2954
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_4: (a: number, b: number, c: any) => [number, number];
|
|
2955
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_5: (a: number, b: number, c: any) => [number, number];
|
|
2956
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_6: (a: number, b: number, c: any) => [number, number];
|
|
2957
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_7: (a: number, b: number, c: any) => [number, number];
|
|
2924
2958
|
readonly wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
|
|
2925
2959
|
readonly wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25: (a: number, b: number, c: any) => void;
|
|
2926
2960
|
readonly wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_2: (a: number, b: number, c: any) => void;
|
|
@@ -2896,6 +2896,10 @@ function __wbg_get_imports() {
|
|
|
2896
2896
|
const ret = arg0.listTokensOutputs();
|
|
2897
2897
|
return ret;
|
|
2898
2898
|
}, arguments); },
|
|
2899
|
+
__wbg_listWatchedDepositAddresses_55fe8af0643e3ea9: function() { return handleError(function (arg0) {
|
|
2900
|
+
const ret = arg0.listWatchedDepositAddresses();
|
|
2901
|
+
return ret;
|
|
2902
|
+
}, arguments); },
|
|
2899
2903
|
__wbg_log_cf86719f8acabfda: function(arg0, arg1) {
|
|
2900
2904
|
arg0.log(arg1);
|
|
2901
2905
|
},
|
|
@@ -3595,6 +3599,18 @@ function __wbg_get_imports() {
|
|
|
3595
3599
|
const ret = arg0.updateTokenOutputs(arg1, arg2);
|
|
3596
3600
|
return ret;
|
|
3597
3601
|
}, arguments); },
|
|
3602
|
+
__wbg_updateWatchedDepositAddress_260322f77dee1443: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3603
|
+
let deferred0_0;
|
|
3604
|
+
let deferred0_1;
|
|
3605
|
+
try {
|
|
3606
|
+
deferred0_0 = arg1;
|
|
3607
|
+
deferred0_1 = arg2;
|
|
3608
|
+
const ret = arg0.updateWatchedDepositAddress(getStringFromWasm0(arg1, arg2), arg3);
|
|
3609
|
+
return ret;
|
|
3610
|
+
} finally {
|
|
3611
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
3612
|
+
}
|
|
3613
|
+
}, arguments); },
|
|
3598
3614
|
__wbg_url_68fd9a221360e0db: function(arg0, arg1) {
|
|
3599
3615
|
const ret = arg1.url;
|
|
3600
3616
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -3630,47 +3646,47 @@ function __wbg_get_imports() {
|
|
|
3630
3646
|
return ret;
|
|
3631
3647
|
},
|
|
3632
3648
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
3633
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3634
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3649
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3650
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a);
|
|
3635
3651
|
return ret;
|
|
3636
3652
|
},
|
|
3637
3653
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
3638
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3654
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 405, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3639
3655
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25);
|
|
3640
3656
|
return ret;
|
|
3641
3657
|
},
|
|
3642
3658
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
3643
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
3659
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 405, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3644
3660
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_2);
|
|
3645
3661
|
return ret;
|
|
3646
3662
|
},
|
|
3647
3663
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
3648
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
3664
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 405, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3649
3665
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_3);
|
|
3650
3666
|
return ret;
|
|
3651
3667
|
},
|
|
3652
3668
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
3653
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx:
|
|
3654
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3669
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3670
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_4);
|
|
3655
3671
|
return ret;
|
|
3656
3672
|
},
|
|
3657
3673
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
3658
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx:
|
|
3659
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3674
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3675
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_5);
|
|
3660
3676
|
return ret;
|
|
3661
3677
|
},
|
|
3662
3678
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
3663
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx:
|
|
3664
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3679
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3680
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_6);
|
|
3665
3681
|
return ret;
|
|
3666
3682
|
},
|
|
3667
3683
|
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
3668
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx:
|
|
3669
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3684
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3685
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_7);
|
|
3670
3686
|
return ret;
|
|
3671
3687
|
},
|
|
3672
3688
|
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
3673
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3689
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 409, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3674
3690
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h484cd36e13f37bd7);
|
|
3675
3691
|
return ret;
|
|
3676
3692
|
},
|
|
@@ -3778,36 +3794,36 @@ function wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_3(arg0, a
|
|
|
3778
3794
|
wasm.wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_3(arg0, arg1, arg2);
|
|
3779
3795
|
}
|
|
3780
3796
|
|
|
3781
|
-
function
|
|
3782
|
-
const ret = wasm.
|
|
3797
|
+
function wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a(arg0, arg1, arg2) {
|
|
3798
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a(arg0, arg1, arg2);
|
|
3783
3799
|
if (ret[1]) {
|
|
3784
3800
|
throw takeFromExternrefTable0(ret[0]);
|
|
3785
3801
|
}
|
|
3786
3802
|
}
|
|
3787
3803
|
|
|
3788
|
-
function
|
|
3789
|
-
const ret = wasm.
|
|
3804
|
+
function wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_4(arg0, arg1, arg2) {
|
|
3805
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_4(arg0, arg1, arg2);
|
|
3790
3806
|
if (ret[1]) {
|
|
3791
3807
|
throw takeFromExternrefTable0(ret[0]);
|
|
3792
3808
|
}
|
|
3793
3809
|
}
|
|
3794
3810
|
|
|
3795
|
-
function
|
|
3796
|
-
const ret = wasm.
|
|
3811
|
+
function wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_5(arg0, arg1, arg2) {
|
|
3812
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_5(arg0, arg1, arg2);
|
|
3797
3813
|
if (ret[1]) {
|
|
3798
3814
|
throw takeFromExternrefTable0(ret[0]);
|
|
3799
3815
|
}
|
|
3800
3816
|
}
|
|
3801
3817
|
|
|
3802
|
-
function
|
|
3803
|
-
const ret = wasm.
|
|
3818
|
+
function wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_6(arg0, arg1, arg2) {
|
|
3819
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_6(arg0, arg1, arg2);
|
|
3804
3820
|
if (ret[1]) {
|
|
3805
3821
|
throw takeFromExternrefTable0(ret[0]);
|
|
3806
3822
|
}
|
|
3807
3823
|
}
|
|
3808
3824
|
|
|
3809
|
-
function
|
|
3810
|
-
const ret = wasm.
|
|
3825
|
+
function wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_7(arg0, arg1, arg2) {
|
|
3826
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_7(arg0, arg1, arg2);
|
|
3811
3827
|
if (ret[1]) {
|
|
3812
3828
|
throw takeFromExternrefTable0(ret[0]);
|
|
3813
3829
|
}
|
|
Binary file
|
|
@@ -189,11 +189,11 @@ export const __wbg_externalsparksignerhandle_free: (a: number, b: number) => voi
|
|
|
189
189
|
export const __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
|
|
190
190
|
export const signingonlyexternalsigners_breezSigner: (a: number) => number;
|
|
191
191
|
export const signingonlyexternalsigners_sparkSigner: (a: number) => number;
|
|
192
|
-
export const
|
|
193
|
-
export const
|
|
194
|
-
export const
|
|
195
|
-
export const
|
|
196
|
-
export const
|
|
192
|
+
export const wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a: (a: number, b: number, c: any) => [number, number];
|
|
193
|
+
export const wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_4: (a: number, b: number, c: any) => [number, number];
|
|
194
|
+
export const wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_5: (a: number, b: number, c: any) => [number, number];
|
|
195
|
+
export const wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_6: (a: number, b: number, c: any) => [number, number];
|
|
196
|
+
export const wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_7: (a: number, b: number, c: any) => [number, number];
|
|
197
197
|
export const wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
|
|
198
198
|
export const wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25: (a: number, b: number, c: any) => void;
|
|
199
199
|
export const wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_2: (a: number, b: number, c: any) => void;
|
package/web/storage/index.js
CHANGED
|
@@ -611,6 +611,19 @@ class MigrationManager {
|
|
|
611
611
|
};
|
|
612
612
|
},
|
|
613
613
|
},
|
|
614
|
+
{
|
|
615
|
+
// Deposit addresses polled on-chain for deposits still in the mempool.
|
|
616
|
+
// Entries are removed once watching them can no longer lead to an early
|
|
617
|
+
// claim, so the store holds only the live watch set.
|
|
618
|
+
name: "Create watched_deposit_addresses store",
|
|
619
|
+
upgrade: (db) => {
|
|
620
|
+
if (!db.objectStoreNames.contains("watched_deposit_addresses")) {
|
|
621
|
+
db.createObjectStore("watched_deposit_addresses", {
|
|
622
|
+
keyPath: "address",
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
},
|
|
614
627
|
];
|
|
615
628
|
}
|
|
616
629
|
}
|
|
@@ -639,7 +652,7 @@ class IndexedDBStorage {
|
|
|
639
652
|
// so existing databases depend on indices never shifting. Never insert,
|
|
640
653
|
// reorder, or delete a migration — only append. dbVersion MUST equal the
|
|
641
654
|
// number of migrations (enforced by the guard in initialize()).
|
|
642
|
-
this.dbVersion =
|
|
655
|
+
this.dbVersion = 22; // Current schema version (= migration count)
|
|
643
656
|
}
|
|
644
657
|
|
|
645
658
|
/**
|
|
@@ -1445,6 +1458,7 @@ class IndexedDBStorage {
|
|
|
1445
1458
|
refundTxId: existing?.refundTxId ?? null,
|
|
1446
1459
|
instantClaimStatus: existing?.instantClaimStatus ?? null,
|
|
1447
1460
|
refundState: existing?.refundState ?? null,
|
|
1461
|
+
maxClaimFee: existing?.maxClaimFee ?? null,
|
|
1448
1462
|
};
|
|
1449
1463
|
|
|
1450
1464
|
const putRequest = store.put(depositToStore);
|
|
@@ -1521,6 +1535,7 @@ class IndexedDBStorage {
|
|
|
1521
1535
|
? JSON.parse(row.instantClaimStatus)
|
|
1522
1536
|
: null,
|
|
1523
1537
|
refundState: row.refundState ? JSON.parse(row.refundState) : null,
|
|
1538
|
+
maxClaimFee: row.maxClaimFee ? JSON.parse(row.maxClaimFee) : null,
|
|
1524
1539
|
}));
|
|
1525
1540
|
resolve(deposits);
|
|
1526
1541
|
};
|
|
@@ -1576,6 +1591,10 @@ class IndexedDBStorage {
|
|
|
1576
1591
|
if (existingDeposit.refundTxId === payload.refundTxid) {
|
|
1577
1592
|
updatedDeposit.refundState = JSON.stringify(payload.state);
|
|
1578
1593
|
}
|
|
1594
|
+
} else if (payload.type === "maxClaimFee") {
|
|
1595
|
+
updatedDeposit.maxClaimFee = payload.maxFee
|
|
1596
|
+
? JSON.stringify(payload.maxFee)
|
|
1597
|
+
: null;
|
|
1579
1598
|
} else {
|
|
1580
1599
|
reject(new StorageError(`Unknown payload type: ${payload.type}`));
|
|
1581
1600
|
return;
|
|
@@ -1606,6 +1625,131 @@ class IndexedDBStorage {
|
|
|
1606
1625
|
});
|
|
1607
1626
|
}
|
|
1608
1627
|
|
|
1628
|
+
async listWatchedDepositAddresses() {
|
|
1629
|
+
if (!this.db) {
|
|
1630
|
+
throw new StorageError("Database not initialized");
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
return new Promise((resolve, reject) => {
|
|
1634
|
+
const transaction = this.db.transaction(
|
|
1635
|
+
"watched_deposit_addresses",
|
|
1636
|
+
"readonly"
|
|
1637
|
+
);
|
|
1638
|
+
const store = transaction.objectStore("watched_deposit_addresses");
|
|
1639
|
+
const request = store.getAll();
|
|
1640
|
+
|
|
1641
|
+
request.onsuccess = () => {
|
|
1642
|
+
const watched = (request.result || []).map((entry) => ({
|
|
1643
|
+
address: entry.address,
|
|
1644
|
+
issuedAt: entry.issuedAt,
|
|
1645
|
+
seen: Boolean(entry.seen),
|
|
1646
|
+
}));
|
|
1647
|
+
// The store is keyed by address, so ordering is applied here rather
|
|
1648
|
+
// than by an index.
|
|
1649
|
+
watched.sort((a, b) => Number(b.issuedAt) - Number(a.issuedAt));
|
|
1650
|
+
resolve(watched);
|
|
1651
|
+
};
|
|
1652
|
+
request.onerror = () =>
|
|
1653
|
+
reject(
|
|
1654
|
+
new StorageError(
|
|
1655
|
+
`Failed to list watched deposit addresses: ${request.error}`
|
|
1656
|
+
)
|
|
1657
|
+
);
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
async updateWatchedDepositAddress(address, payload) {
|
|
1662
|
+
if (!this.db) {
|
|
1663
|
+
throw new StorageError("Database not initialized");
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
return new Promise((resolve, reject) => {
|
|
1667
|
+
const transaction = this.db.transaction(
|
|
1668
|
+
"watched_deposit_addresses",
|
|
1669
|
+
"readwrite"
|
|
1670
|
+
);
|
|
1671
|
+
const store = transaction.objectStore("watched_deposit_addresses");
|
|
1672
|
+
|
|
1673
|
+
if (payload.type === "watch") {
|
|
1674
|
+
const request = store.put({
|
|
1675
|
+
address,
|
|
1676
|
+
issuedAt: payload.issuedAt,
|
|
1677
|
+
seen: false,
|
|
1678
|
+
});
|
|
1679
|
+
request.onsuccess = () => resolve();
|
|
1680
|
+
request.onerror = () =>
|
|
1681
|
+
reject(
|
|
1682
|
+
new StorageError(
|
|
1683
|
+
`Failed to watch deposit address '${address}': ${request.error}`
|
|
1684
|
+
)
|
|
1685
|
+
);
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
if (payload.type === "unwatch") {
|
|
1690
|
+
// Conditional on issuedAt, so an address handed out again since the
|
|
1691
|
+
// caller read it is not retired by a decision taken before that. The
|
|
1692
|
+
// get and the delete share one readwrite transaction, so nothing can
|
|
1693
|
+
// interleave between them.
|
|
1694
|
+
const getRequest = store.get(address);
|
|
1695
|
+
getRequest.onsuccess = () => {
|
|
1696
|
+
const existing = getRequest.result;
|
|
1697
|
+
const stale =
|
|
1698
|
+
!existing || String(existing.issuedAt) !== String(payload.issuedAt);
|
|
1699
|
+
if (stale) {
|
|
1700
|
+
resolve();
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
const request = store.delete(address);
|
|
1704
|
+
request.onsuccess = () => resolve();
|
|
1705
|
+
request.onerror = () =>
|
|
1706
|
+
reject(
|
|
1707
|
+
new StorageError(
|
|
1708
|
+
`Failed to unwatch deposit address '${address}': ${request.error}`
|
|
1709
|
+
)
|
|
1710
|
+
);
|
|
1711
|
+
};
|
|
1712
|
+
getRequest.onerror = () =>
|
|
1713
|
+
reject(
|
|
1714
|
+
new StorageError(
|
|
1715
|
+
`Failed to read watched deposit address '${address}': ${getRequest.error}`
|
|
1716
|
+
)
|
|
1717
|
+
);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
if (payload.type === "seen") {
|
|
1722
|
+
const getRequest = store.get(address);
|
|
1723
|
+
getRequest.onsuccess = () => {
|
|
1724
|
+
const existing = getRequest.result;
|
|
1725
|
+
if (!existing) {
|
|
1726
|
+
// Not watched, so there is nothing to mark (matches the SQL stores,
|
|
1727
|
+
// whose UPDATE affects no rows).
|
|
1728
|
+
resolve();
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
const request = store.put({ ...existing, seen: true });
|
|
1732
|
+
request.onsuccess = () => resolve();
|
|
1733
|
+
request.onerror = () =>
|
|
1734
|
+
reject(
|
|
1735
|
+
new StorageError(
|
|
1736
|
+
`Failed to mark deposit address '${address}' seen: ${request.error}`
|
|
1737
|
+
)
|
|
1738
|
+
);
|
|
1739
|
+
};
|
|
1740
|
+
getRequest.onerror = () =>
|
|
1741
|
+
reject(
|
|
1742
|
+
new StorageError(
|
|
1743
|
+
`Failed to read watched deposit address '${address}': ${getRequest.error}`
|
|
1744
|
+
)
|
|
1745
|
+
);
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
reject(new StorageError(`Unknown payload type: ${payload.type}`));
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1609
1753
|
async setLnurlMetadata(metadata) {
|
|
1610
1754
|
if (!this.db) {
|
|
1611
1755
|
throw new StorageError("Database not initialized");
|