@breeztech/breez-sdk-spark 0.19.2 → 0.21.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 +170 -12
- package/bundler/breez_sdk_spark_wasm.js +1 -1
- package/bundler/breez_sdk_spark_wasm_bg.js +186 -44
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +11 -0
- package/deno/breez_sdk_spark_wasm.d.ts +170 -12
- package/deno/breez_sdk_spark_wasm.js +186 -44
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +11 -0
- package/itest/.gitignore +2 -0
- package/itest/helpers/assert.test.js +70 -0
- package/itest/helpers/faucet.js +68 -0
- package/itest/helpers/lnurl-fixture.js +229 -0
- package/itest/helpers/scenario.js +444 -0
- package/itest/package-lock.json +519 -0
- package/itest/package.json +18 -0
- package/itest/scenarios.test.js +47 -0
- package/itest/smoke.test.js +184 -0
- package/nodejs/breez_sdk_spark_wasm.d.ts +170 -12
- package/nodejs/breez_sdk_spark_wasm.js +188 -44
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +11 -0
- package/nodejs/index.mjs +2 -0
- package/nodejs/mysql-token-store/index.cjs +302 -205
- package/nodejs/mysql-tree-store/index.cjs +43 -24
- package/nodejs/postgres-token-store/index.cjs +284 -205
- package/nodejs/postgres-tree-store/index.cjs +33 -17
- package/package.json +1 -1
- package/ssr/index.js +12 -0
- package/web/breez_sdk_spark_wasm.d.ts +181 -12
- package/web/breez_sdk_spark_wasm.js +186 -44
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +11 -0
- package/web/passkey-prf-provider/index.d.ts +9 -2
- package/web/passkey-prf-provider/index.js +49 -11
|
@@ -40,6 +40,16 @@ const RESERVATION_TIMEOUT_SECS = 300; // 5 minutes
|
|
|
40
40
|
*/
|
|
41
41
|
const SPENT_MARKER_CLEANUP_THRESHOLD_MS = 5 * 60 * 1000; // 5 minutes
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Leaves per INSERT when upserting a refreshed leaf set.
|
|
45
|
+
*
|
|
46
|
+
* A wallet can hold six figures of leaves, each serializing to a JSON blob
|
|
47
|
+
* carrying up to five transactions. Building that as a single statement
|
|
48
|
+
* materializes the whole set at once, which is the largest allocation in a
|
|
49
|
+
* refresh and lands at its very end.
|
|
50
|
+
*/
|
|
51
|
+
const LEAF_UPSERT_CHUNK_SIZE = 1000;
|
|
52
|
+
|
|
43
53
|
/**
|
|
44
54
|
* Slim projection: only (id, value) for leaves the selection might use.
|
|
45
55
|
* Includes all leaves with value <= $2 (covers exact-match + the small-leaf
|
|
@@ -1019,23 +1029,29 @@ class PostgresTreeStore {
|
|
|
1019
1029
|
|
|
1020
1030
|
if (filtered.length === 0) return;
|
|
1021
1031
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1032
|
+
// All chunks run inside the caller's transaction, and NOW() is the
|
|
1033
|
+
// transaction timestamp, so every row still lands atomically with one
|
|
1034
|
+
// shared added_at.
|
|
1035
|
+
for (let i = 0; i < filtered.length; i += LEAF_UPSERT_CHUNK_SIZE) {
|
|
1036
|
+
const chunk = filtered.slice(i, i + LEAF_UPSERT_CHUNK_SIZE);
|
|
1037
|
+
const ids = chunk.map((l) => l.id);
|
|
1038
|
+
const statuses = chunk.map((l) => l.status);
|
|
1039
|
+
const missingFlags = chunk.map(() => isMissingFromOperators);
|
|
1040
|
+
const dataValues = chunk.map((l) => JSON.stringify(l));
|
|
1041
|
+
|
|
1042
|
+
await client.query(
|
|
1043
|
+
`INSERT INTO brz_tree_leaves (user_id, id, status, is_missing_from_operators, data, added_at)
|
|
1044
|
+
SELECT $5, id, status, missing, data::jsonb, NOW()
|
|
1045
|
+
FROM UNNEST($1::text[], $2::text[], $3::bool[], $4::text[])
|
|
1046
|
+
AS t(id, status, missing, data)
|
|
1047
|
+
ON CONFLICT (user_id, id) DO UPDATE SET
|
|
1048
|
+
status = EXCLUDED.status,
|
|
1049
|
+
is_missing_from_operators = EXCLUDED.is_missing_from_operators,
|
|
1050
|
+
data = EXCLUDED.data,
|
|
1051
|
+
added_at = NOW()`,
|
|
1052
|
+
[ids, statuses, missingFlags, dataValues, this.identity]
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1039
1055
|
}
|
|
1040
1056
|
|
|
1041
1057
|
/**
|
package/package.json
CHANGED
package/ssr/index.js
CHANGED
|
@@ -113,6 +113,11 @@ export function postgresStorage(...args) {
|
|
|
113
113
|
return _module.postgresStorage(...args);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
export function singleKeyCpfpSigner(...args) {
|
|
117
|
+
if (!_module) _notInitialized('singleKeyCpfpSigner');
|
|
118
|
+
return _module.singleKeyCpfpSigner(...args);
|
|
119
|
+
}
|
|
120
|
+
|
|
116
121
|
export function start(...args) {
|
|
117
122
|
if (!_module) _notInitialized('start');
|
|
118
123
|
return _module.start(...args);
|
|
@@ -142,6 +147,13 @@ export class BreezSdk {
|
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
|
|
150
|
+
export class DefaultCpfpSigner {
|
|
151
|
+
constructor(...args) {
|
|
152
|
+
if (!_module) _notInitialized('new DefaultCpfpSigner');
|
|
153
|
+
return new _module.DefaultCpfpSigner(...args);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
145
157
|
export class DefaultSessionStore {
|
|
146
158
|
constructor(...args) {
|
|
147
159
|
if (!_module) _notInitialized('new DefaultSessionStore');
|
|
@@ -89,7 +89,7 @@ interface WasmTokenOutputWithPrevOut {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
interface WasmTokenOutputs {
|
|
92
|
-
metadata: WasmTokenMetadata;
|
|
92
|
+
metadata: WasmTokenMetadata[];
|
|
93
93
|
outputs: WasmTokenOutputWithPrevOut[];
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -119,26 +119,23 @@ type WasmReservationTarget =
|
|
|
119
119
|
| { type: 'maxOutputCount'; value: number };
|
|
120
120
|
|
|
121
121
|
export interface TokenStore {
|
|
122
|
-
setTokensOutputs: (tokenOutputs: WasmTokenOutputs
|
|
122
|
+
setTokensOutputs: (tokenOutputs: WasmTokenOutputs, refreshStartedAtMs: number) => Promise<void>;
|
|
123
123
|
listTokensOutputs: () => Promise<WasmTokenOutputsPerStatus[]>;
|
|
124
124
|
getTokenBalances: () => Promise<WasmTokenBalance[]>;
|
|
125
125
|
getTokenOutputs: (filter: WasmGetTokenOutputsFilter) => Promise<WasmTokenOutputsPerStatus>;
|
|
126
|
-
updateTokenOutputs: (outputsToRemove: [string, number][], outputsToAdd: WasmTokenOutputs
|
|
126
|
+
updateTokenOutputs: (outputsToRemove: [string, number][], outputsToAdd: WasmTokenOutputs) => Promise<void>;
|
|
127
127
|
reserveTokenOutputs: (
|
|
128
|
-
|
|
129
|
-
target: WasmReservationTarget,
|
|
128
|
+
targets: [string, WasmReservationTarget][],
|
|
130
129
|
purpose: string,
|
|
131
130
|
preferredOutputs: WasmTokenOutputWithPrevOut[] | null,
|
|
132
131
|
selectionStrategy: string | null
|
|
133
132
|
) => Promise<WasmTokenOutputsReservation>;
|
|
134
133
|
selectTokenOutputs: (
|
|
135
|
-
|
|
136
|
-
target: WasmReservationTarget,
|
|
134
|
+
targets: [string, WasmReservationTarget][],
|
|
137
135
|
preferredOutputs: WasmTokenOutputWithPrevOut[] | null,
|
|
138
136
|
selectionStrategy: string | null
|
|
139
137
|
) => Promise<WasmTokenOutputs>;
|
|
140
138
|
reserveTokenOutputsByOutpoints: (
|
|
141
|
-
tokenIdentifier: string,
|
|
142
139
|
outpoints: { prevTxHash: string; prevTxVout: number }[],
|
|
143
140
|
purpose: string
|
|
144
141
|
) => Promise<WasmTokenOutputsReservation>;
|
|
@@ -147,6 +144,20 @@ export interface TokenStore {
|
|
|
147
144
|
now: () => Promise<number>;
|
|
148
145
|
}
|
|
149
146
|
|
|
147
|
+
/**
|
|
148
|
+
* A created credential, plus the PRF outputs when the browser evaluated
|
|
149
|
+
* them during the create ceremony. `seeds` is null when it did not, so
|
|
150
|
+
* the caller derives through `deriveSeeds`.
|
|
151
|
+
*
|
|
152
|
+
* Seeds returned here must equal what `deriveSeeds` returns for the same
|
|
153
|
+
* salts: the wallet is derived from them either way, so a mismatch means
|
|
154
|
+
* register and sign-in land on different wallets.
|
|
155
|
+
*/
|
|
156
|
+
export interface CreatePasskeyOutput {
|
|
157
|
+
credential: PasskeyCredential;
|
|
158
|
+
seeds?: Uint8Array[] | null;
|
|
159
|
+
}
|
|
160
|
+
|
|
150
161
|
/**
|
|
151
162
|
* A passkey credential from `register` or `signIn`. `credentialId` is
|
|
152
163
|
* always set. The attestation fields (`userId`, `aaguid`,
|
|
@@ -297,10 +308,14 @@ export interface PrfProvider {
|
|
|
297
308
|
* `excludeCredentials` lists already-registered IDs; a match raises
|
|
298
309
|
* `PasskeyAlreadyExistsError`.
|
|
299
310
|
*
|
|
311
|
+
* Evaluating PRF for `salts` in the same ceremony returns the seeds on
|
|
312
|
+
* `seeds`, and the caller then needs no assertion. Return `seeds: null`
|
|
313
|
+
* when the authenticator evaluated none, or fewer than one per salt.
|
|
314
|
+
*
|
|
300
315
|
* @throws `PasskeyAlreadyExistsError` when an entry in
|
|
301
316
|
* `excludeCredentials` matches a credential already on the device.
|
|
302
317
|
*/
|
|
303
|
-
createPasskey?(excludeCredentials: Uint8Array[]): Promise<
|
|
318
|
+
createPasskey?(excludeCredentials: Uint8Array[], salts: string[]): Promise<CreatePasskeyOutput>;
|
|
304
319
|
|
|
305
320
|
/**
|
|
306
321
|
* Whether this provider can produce PRF outputs on the current
|
|
@@ -488,6 +503,17 @@ export interface AuthorizeTransferRequest {
|
|
|
488
503
|
transfereePubkey: string;
|
|
489
504
|
}
|
|
490
505
|
|
|
506
|
+
export interface BatchRecipient {
|
|
507
|
+
paymentRequest: string;
|
|
508
|
+
amount?: bigint;
|
|
509
|
+
tokenIdentifier?: string;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export interface BatchTotal {
|
|
513
|
+
tokenIdentifier?: string;
|
|
514
|
+
amount: bigint;
|
|
515
|
+
}
|
|
516
|
+
|
|
491
517
|
export interface Bip21Details {
|
|
492
518
|
amountSat?: number;
|
|
493
519
|
assetId?: string;
|
|
@@ -511,8 +537,10 @@ export interface BitcoinAddressDetails {
|
|
|
511
537
|
|
|
512
538
|
export interface BitcoinChainService {
|
|
513
539
|
getAddressUtxos(address: string): Promise<Utxo[]>;
|
|
540
|
+
getAddressTxos(address: string): Promise<Utxo[]>;
|
|
514
541
|
getTransactionStatus(txid: string): Promise<TxStatus>;
|
|
515
542
|
getTransactionHex(txid: string): Promise<string>;
|
|
543
|
+
getOutspend(txid: string, vout: number): Promise<Outspend>;
|
|
516
544
|
broadcastTransaction(tx: string): Promise<void>;
|
|
517
545
|
recommendedFees(): Promise<RecommendedFees>;
|
|
518
546
|
}
|
|
@@ -583,6 +611,10 @@ export interface Bolt12OfferDetails {
|
|
|
583
611
|
signingPubkey?: string;
|
|
584
612
|
}
|
|
585
613
|
|
|
614
|
+
export interface BuildUnsignedBatchPackageRequest {
|
|
615
|
+
prepareResponse: PrepareSendBatchResponse;
|
|
616
|
+
}
|
|
617
|
+
|
|
586
618
|
export interface BuildUnsignedLnurlPayPackageRequest {
|
|
587
619
|
prepareResponse: PrepareLnurlPayResponse;
|
|
588
620
|
}
|
|
@@ -718,6 +750,10 @@ export interface ConversionSide {
|
|
|
718
750
|
fee: string;
|
|
719
751
|
}
|
|
720
752
|
|
|
753
|
+
export interface CpfpSigner {
|
|
754
|
+
signPsbt(psbtBytes: Uint8Array): Promise<Uint8Array>;
|
|
755
|
+
}
|
|
756
|
+
|
|
721
757
|
export interface CreateIssuerTokenRequest {
|
|
722
758
|
name: string;
|
|
723
759
|
ticker: string;
|
|
@@ -955,6 +991,7 @@ export interface ExternalSparkSigner {
|
|
|
955
991
|
getStaticDepositPublicKey(index: number): Promise<PublicKeyBytes>;
|
|
956
992
|
signAuthenticationChallenge(challenge: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
957
993
|
signMessage(message: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
994
|
+
signLeafRefundSpend(leafId: ExternalTreeNodeId, sighash: Uint8Array): Promise<SchnorrSignatureBytes>;
|
|
958
995
|
signFrost(jobs: ExternalFrostJob[]): Promise<ExternalFrostShareResult[]>;
|
|
959
996
|
prepareTransfer(request: ExternalPrepareTransferRequest): Promise<ExternalPreparedTransfer>;
|
|
960
997
|
prepareClaim(request: ExternalPrepareClaimRequest): Promise<ExternalPreparedClaim>;
|
|
@@ -1282,6 +1319,11 @@ export interface PaymentRequestSource {
|
|
|
1282
1319
|
bip353Address?: string;
|
|
1283
1320
|
}
|
|
1284
1321
|
|
|
1322
|
+
export interface PerBranchFunding {
|
|
1323
|
+
leafId: string;
|
|
1324
|
+
fundingSat: number;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1285
1327
|
export interface PrepareLnurlPayRequest {
|
|
1286
1328
|
amount: bigint;
|
|
1287
1329
|
comment?: string;
|
|
@@ -1303,6 +1345,15 @@ export interface PrepareLnurlPayResponse {
|
|
|
1303
1345
|
feePolicy: FeePolicy;
|
|
1304
1346
|
}
|
|
1305
1347
|
|
|
1348
|
+
export interface PrepareSendBatchRequest {
|
|
1349
|
+
recipients: BatchRecipient[];
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
export interface PrepareSendBatchResponse {
|
|
1353
|
+
recipients: ResolvedBatchRecipient[];
|
|
1354
|
+
totals: BatchTotal[];
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1306
1357
|
export interface PrepareSendPaymentRequest {
|
|
1307
1358
|
paymentRequest: PaymentRequest;
|
|
1308
1359
|
amount?: bigint;
|
|
@@ -1319,6 +1370,24 @@ export interface PrepareSendPaymentResponse {
|
|
|
1319
1370
|
feePolicy: FeePolicy;
|
|
1320
1371
|
}
|
|
1321
1372
|
|
|
1373
|
+
export interface PrepareUnilateralExitRequest {
|
|
1374
|
+
feeRateSatPerVbyte: number;
|
|
1375
|
+
fundingKind: CpfpFundingKind;
|
|
1376
|
+
destination: string;
|
|
1377
|
+
selection: ExitLeafSelection;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
export interface PrepareUnilateralExitResponse {
|
|
1381
|
+
leaves: UnilateralExitLeaf[];
|
|
1382
|
+
recoverableValueSat: number;
|
|
1383
|
+
totalFeeSat: number;
|
|
1384
|
+
fanoutFeeSat: number;
|
|
1385
|
+
singleUtxoFundingSat: number;
|
|
1386
|
+
perBranchFunding: PerBranchFunding[];
|
|
1387
|
+
feeRateSatPerVbyte: number;
|
|
1388
|
+
destination: string;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1322
1391
|
export interface ProvisionalPayment {
|
|
1323
1392
|
paymentId: string;
|
|
1324
1393
|
amount: bigint;
|
|
@@ -1394,6 +1463,12 @@ export interface RefundDepositResponse {
|
|
|
1394
1463
|
txHex: string;
|
|
1395
1464
|
}
|
|
1396
1465
|
|
|
1466
|
+
export interface RefundPendingConversionsResponse {
|
|
1467
|
+
refunded: number;
|
|
1468
|
+
skipped: number;
|
|
1469
|
+
failed: number;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1397
1472
|
export interface RegisterLightningAddressRequest {
|
|
1398
1473
|
username: string;
|
|
1399
1474
|
description?: string;
|
|
@@ -1409,6 +1484,12 @@ export interface RegisterWebhookResponse {
|
|
|
1409
1484
|
webhookId: string;
|
|
1410
1485
|
}
|
|
1411
1486
|
|
|
1487
|
+
export interface ResolvedBatchRecipient {
|
|
1488
|
+
destination: BatchDestination;
|
|
1489
|
+
amount: bigint;
|
|
1490
|
+
tokenIdentifier?: string;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1412
1493
|
export interface RestClient {
|
|
1413
1494
|
getRequest(url: string, headers?: Record<string, string>): Promise<RestResponse>;
|
|
1414
1495
|
postRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
|
|
@@ -1428,6 +1509,14 @@ export interface SecretBytes {
|
|
|
1428
1509
|
bytes: number[];
|
|
1429
1510
|
}
|
|
1430
1511
|
|
|
1512
|
+
export interface SendBatchRequest {
|
|
1513
|
+
prepareResponse: PrepareSendBatchResponse;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
export interface SendBatchResponse {
|
|
1517
|
+
payments: Payment[];
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1431
1520
|
export interface SendOnchainFeeQuote {
|
|
1432
1521
|
id: string;
|
|
1433
1522
|
expiresAt: number;
|
|
@@ -1701,6 +1790,34 @@ export interface UnfreezeIssuerTokenResponse {
|
|
|
1701
1790
|
impactedTokenAmount: bigint;
|
|
1702
1791
|
}
|
|
1703
1792
|
|
|
1793
|
+
export interface UnilateralExitLeaf {
|
|
1794
|
+
leafId: string;
|
|
1795
|
+
value: number;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
export interface UnilateralExitRequest {
|
|
1799
|
+
prepared: PrepareUnilateralExitResponse;
|
|
1800
|
+
fundingInputs: CpfpInput[];
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
export interface UnilateralExitResponse {
|
|
1804
|
+
recoverableValueSat: number;
|
|
1805
|
+
totalFeeSat: number;
|
|
1806
|
+
leaves: UnilateralExitLeaf[];
|
|
1807
|
+
transactions: UnilateralExitTransaction[];
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
export interface UnilateralExitTransaction {
|
|
1811
|
+
kind: UnilateralExitTxKind;
|
|
1812
|
+
nodeId?: string;
|
|
1813
|
+
txid: string;
|
|
1814
|
+
txHex: string;
|
|
1815
|
+
cpfpTxHex?: string;
|
|
1816
|
+
csvTimelockBlocks?: number;
|
|
1817
|
+
dependsOn: string[];
|
|
1818
|
+
status: ConfirmationStatus;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1704
1821
|
export interface UnregisterWebhookRequest {
|
|
1705
1822
|
webhookId: string;
|
|
1706
1823
|
}
|
|
@@ -1720,6 +1837,7 @@ export interface UpdateContactRequest {
|
|
|
1720
1837
|
export interface UpdateUserSettingsRequest {
|
|
1721
1838
|
sparkPrivateModeEnabled?: boolean;
|
|
1722
1839
|
stableBalanceActiveLabel?: StableBalanceActiveLabel;
|
|
1840
|
+
sparkMasterIdentityPublicKey?: SparkMasterIdentityPublicKey;
|
|
1723
1841
|
}
|
|
1724
1842
|
|
|
1725
1843
|
export interface UrlSuccessActionData {
|
|
@@ -1731,6 +1849,7 @@ export interface UrlSuccessActionData {
|
|
|
1731
1849
|
export interface UserSettings {
|
|
1732
1850
|
sparkPrivateModeEnabled: boolean;
|
|
1733
1851
|
stableBalanceActiveLabel?: string;
|
|
1852
|
+
sparkMasterIdentityPublicKey?: string;
|
|
1734
1853
|
}
|
|
1735
1854
|
|
|
1736
1855
|
export interface Utxo {
|
|
@@ -1756,6 +1875,8 @@ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier
|
|
|
1756
1875
|
|
|
1757
1876
|
export type AutoOptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
|
|
1758
1877
|
|
|
1878
|
+
export type BatchDestination = { type: "sparkAddress"; address: string } | { type: "sparkInvoice"; invoiceDetails: SparkInvoiceDetails };
|
|
1879
|
+
|
|
1759
1880
|
export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
|
|
1760
1881
|
|
|
1761
1882
|
export type BuildTransferPackageOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number };
|
|
@@ -1764,6 +1885,8 @@ export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; red
|
|
|
1764
1885
|
|
|
1765
1886
|
export type ChainApiType = "esplora" | "mempoolSpace";
|
|
1766
1887
|
|
|
1888
|
+
export type ConfirmationStatus = "confirmed" | "unconfirmed" | "unverified";
|
|
1889
|
+
|
|
1767
1890
|
export type ConversionChain = { type: "spark" } | { type: "lightning" } | { type: "external"; name: string; chainId?: string };
|
|
1768
1891
|
|
|
1769
1892
|
export type ConversionFilter = "ammRefundNeeded" | "orchestraPending" | "boltzPending";
|
|
@@ -1778,6 +1901,10 @@ export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeede
|
|
|
1778
1901
|
|
|
1779
1902
|
export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
|
|
1780
1903
|
|
|
1904
|
+
export type CpfpFundingKind = { type: "p2wpkh" } | { type: "p2tr" } | { type: "custom"; scriptPubkeyHex: string; signedInputWeight: number };
|
|
1905
|
+
|
|
1906
|
+
export type CpfpInput = { type: "p2wpkh"; txid: string; vout: number; value: number; pubkey: string } | { type: "p2tr"; txid: string; vout: number; value: number; pubkey: string } | { type: "custom"; txid: string; vout: number; value: number; scriptPubkeyHex: string; signedInputWeight: number };
|
|
1907
|
+
|
|
1781
1908
|
export type CrossChainAddressFamily = "evm" | "solana" | "tron";
|
|
1782
1909
|
|
|
1783
1910
|
export type CrossChainFeeMode = "feesExcluded" | "feesIncluded";
|
|
@@ -1790,6 +1917,8 @@ export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAd
|
|
|
1790
1917
|
|
|
1791
1918
|
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 };
|
|
1792
1919
|
|
|
1920
|
+
export type ExitLeafSelection = { type: "auto" } | { type: "specific"; leafIds: string[] };
|
|
1921
|
+
|
|
1793
1922
|
export type ExternalFrostDerivation = { type: "signingLeaf"; leafId: ExternalTreeNodeId } | { type: "staticDeposit"; index: number } | { type: "htlcPreimage" } | { type: "identity" };
|
|
1794
1923
|
|
|
1795
1924
|
export type ExternalSparkInvoiceKind = "sats" | "tokens";
|
|
@@ -1814,6 +1943,8 @@ export type OptimizationMode = "full" | "singleRound";
|
|
|
1814
1943
|
|
|
1815
1944
|
export type OptimizationOutcome = { type: "completed"; roundsExecuted: number } | { type: "inProgress" };
|
|
1816
1945
|
|
|
1946
|
+
export type Outspend = { type: "unspent" } | { type: "spent"; txid: string; vin: number; status: TxStatus };
|
|
1947
|
+
|
|
1817
1948
|
export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata; conversionInfo?: ConversionInfo } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string; vout: number };
|
|
1818
1949
|
|
|
1819
1950
|
export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
|
|
@@ -1830,7 +1961,7 @@ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: st
|
|
|
1830
1961
|
|
|
1831
1962
|
export type PublishSignedLnurlPayResponse = { type: "swapCompleted" } | { type: "paymentSent"; response: LnurlPayResponse };
|
|
1832
1963
|
|
|
1833
|
-
export type PublishSignedTransferPackageResponse = { type: "swapCompleted" } | { type: "paymentSent"; payment: Payment };
|
|
1964
|
+
export type PublishSignedTransferPackageResponse = { type: "swapCompleted" } | { type: "paymentSent"; payment: Payment } | { type: "paymentsSent"; payments: Payment[] };
|
|
1834
1965
|
|
|
1835
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 };
|
|
1836
1967
|
|
|
@@ -1850,6 +1981,8 @@ export type SourceAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier
|
|
|
1850
1981
|
|
|
1851
1982
|
export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
|
|
1852
1983
|
|
|
1984
|
+
export type SparkMasterIdentityPublicKey = { type: "set"; publicKey: string } | { type: "unset" };
|
|
1985
|
+
|
|
1853
1986
|
export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
|
|
1854
1987
|
|
|
1855
1988
|
export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionFilter?: ConversionFilter } | { type: "token"; conversionFilter?: ConversionFilter; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[]; conversionFilter?: ConversionFilter };
|
|
@@ -1864,7 +1997,9 @@ export type TransferSignature = { type: "transfer"; signed: ExternalPreparedTran
|
|
|
1864
1997
|
|
|
1865
1998
|
export type TransferTarget = { type: "spark"; address: string; sparkInvoice?: string } | { type: "lightning"; bolt11: string; lnurlPay?: LnurlPayContext; feePolicy: FeePolicy; completionTimeoutSecs?: number } | { type: "coopExit"; address: string; feeQuote: SendOnchainFeeQuote; confirmationSpeed: OnchainConfirmationSpeed };
|
|
1866
1999
|
|
|
1867
|
-
export type
|
|
2000
|
+
export type UnilateralExitTxKind = "fanOut" | "node" | "refund" | "sweep";
|
|
2001
|
+
|
|
2002
|
+
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 };
|
|
1868
2003
|
|
|
1869
2004
|
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
|
|
1870
2005
|
|
|
@@ -1884,7 +2019,9 @@ export class BitcoinChainServiceHandle {
|
|
|
1884
2019
|
free(): void;
|
|
1885
2020
|
[Symbol.dispose](): void;
|
|
1886
2021
|
broadcastTransaction(tx: string): Promise<void>;
|
|
2022
|
+
getAddressTxos(address: string): Promise<any>;
|
|
1887
2023
|
getAddressUtxos(address: string): Promise<any>;
|
|
2024
|
+
getOutspend(txid: string, vout: number): Promise<any>;
|
|
1888
2025
|
getTransactionHex(txid: string): Promise<any>;
|
|
1889
2026
|
getTransactionStatus(txid: string): Promise<any>;
|
|
1890
2027
|
recommendedFees(): Promise<any>;
|
|
@@ -1897,6 +2034,7 @@ export class BreezSdk {
|
|
|
1897
2034
|
addContact(request: AddContactRequest): Promise<Contact>;
|
|
1898
2035
|
addEventListener(listener: EventListener): Promise<string>;
|
|
1899
2036
|
authorizeLightningAddressTransfer(request: AuthorizeTransferRequest): Promise<TransferAuthorization>;
|
|
2037
|
+
buildUnsignedBatchPackage(request: BuildUnsignedBatchPackageRequest): Promise<UnsignedTransferPackage>;
|
|
1900
2038
|
buildUnsignedLnurlPayPackage(request: BuildUnsignedLnurlPayPackageRequest): Promise<UnsignedTransferPackage>;
|
|
1901
2039
|
buildUnsignedTransferPackage(request: BuildUnsignedTransferPackageRequest): Promise<UnsignedTransferPackage>;
|
|
1902
2040
|
buyBitcoin(request: BuyBitcoinRequest): Promise<BuyBitcoinResponse>;
|
|
@@ -1928,24 +2066,38 @@ export class BreezSdk {
|
|
|
1928
2066
|
optimizeLeaves(request: OptimizeLeavesRequest): Promise<OptimizeLeavesResponse>;
|
|
1929
2067
|
parse(input: string): Promise<InputType>;
|
|
1930
2068
|
prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
|
|
2069
|
+
prepareSendBatch(request: PrepareSendBatchRequest): Promise<PrepareSendBatchResponse>;
|
|
1931
2070
|
prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
|
|
2071
|
+
prepareUnilateralExit(request: PrepareUnilateralExitRequest): Promise<PrepareUnilateralExitResponse>;
|
|
1932
2072
|
publishSignedLnurlPayPackage(request: PublishSignedLnurlPayPackageRequest): Promise<PublishSignedLnurlPayResponse>;
|
|
1933
2073
|
publishSignedTransferPackage(request: PublishSignedTransferPackageRequest): Promise<PublishSignedTransferPackageResponse>;
|
|
1934
2074
|
receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
|
|
1935
2075
|
recommendedFees(): Promise<RecommendedFees>;
|
|
1936
2076
|
refundDeposit(request: RefundDepositRequest): Promise<RefundDepositResponse>;
|
|
1937
|
-
refundPendingConversions(): Promise<
|
|
2077
|
+
refundPendingConversions(): Promise<RefundPendingConversionsResponse>;
|
|
1938
2078
|
registerLightningAddress(request: RegisterLightningAddressRequest): Promise<LightningAddressInfo>;
|
|
1939
2079
|
registerWebhook(request: RegisterWebhookRequest): Promise<RegisterWebhookResponse>;
|
|
1940
2080
|
removeEventListener(id: string): Promise<boolean>;
|
|
2081
|
+
sendBatch(request: SendBatchRequest): Promise<SendBatchResponse>;
|
|
1941
2082
|
sendPayment(request: SendPaymentRequest): Promise<SendPaymentResponse>;
|
|
1942
2083
|
signMessage(request: SignMessageRequest): Promise<SignMessageResponse>;
|
|
1943
2084
|
syncWallet(request: SyncWalletRequest): Promise<SyncWalletResponse>;
|
|
2085
|
+
unilateralExit(request: UnilateralExitRequest, signer: CpfpSigner): Promise<UnilateralExitResponse>;
|
|
1944
2086
|
unregisterWebhook(request: UnregisterWebhookRequest): Promise<void>;
|
|
1945
2087
|
updateContact(request: UpdateContactRequest): Promise<Contact>;
|
|
1946
2088
|
updateUserSettings(request: UpdateUserSettingsRequest): Promise<void>;
|
|
1947
2089
|
}
|
|
1948
2090
|
|
|
2091
|
+
/**
|
|
2092
|
+
* A CPFP signer matching the `CpfpSigner` TypeScript interface.
|
|
2093
|
+
*/
|
|
2094
|
+
export class DefaultCpfpSigner {
|
|
2095
|
+
private constructor();
|
|
2096
|
+
free(): void;
|
|
2097
|
+
[Symbol.dispose](): void;
|
|
2098
|
+
signPsbt(psbt_bytes: Uint8Array): Promise<Uint8Array>;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
1949
2101
|
/**
|
|
1950
2102
|
* A JS handle to a backend's own session store (from `defaultSessionStore`),
|
|
1951
2103
|
* exposing the same `getSession` / `setSession` interface. Wrap it in a JS
|
|
@@ -2041,6 +2193,7 @@ export class ExternalSparkSignerHandle {
|
|
|
2041
2193
|
prepareTransfer(request: ExternalPrepareTransferRequest): Promise<ExternalPreparedTransfer>;
|
|
2042
2194
|
signAuthenticationChallenge(challenge: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
2043
2195
|
signFrost(jobs: ExternalFrostJob[]): Promise<ExternalFrostShareResult[]>;
|
|
2196
|
+
signLeafRefundSpend(leaf_id: ExternalTreeNodeId, sighash: Uint8Array): Promise<SchnorrSignatureBytes>;
|
|
2044
2197
|
signMessage(message: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
2045
2198
|
signSparkInvoice(request: ExternalSignSparkInvoiceRequest): Promise<ExternalSignedSparkInvoice>;
|
|
2046
2199
|
signStaticDepositRefund(request: ExternalSignStaticDepositRefundRequest): Promise<ExternalFrostSignature>;
|
|
@@ -2365,6 +2518,11 @@ export function newSharedSdkContext(config: WasmSdkContextConfig): Promise<WasmS
|
|
|
2365
2518
|
*/
|
|
2366
2519
|
export function postgresStorage(config: PostgresStorageConfig): WasmStorageConfig;
|
|
2367
2520
|
|
|
2521
|
+
/**
|
|
2522
|
+
* Creates a default CPFP signer backed by a single private key.
|
|
2523
|
+
*/
|
|
2524
|
+
export function singleKeyCpfpSigner(secret_key_bytes: Uint8Array): DefaultCpfpSigner;
|
|
2525
|
+
|
|
2368
2526
|
/**
|
|
2369
2527
|
* Runs automatically when the wasm module is instantiated. Installs the
|
|
2370
2528
|
* panic hook so Rust panics surface as readable `console.error` output
|
|
@@ -2384,6 +2542,7 @@ export interface InitOutput {
|
|
|
2384
2542
|
readonly memory: WebAssembly.Memory;
|
|
2385
2543
|
readonly __wbg_bitcoinchainservicehandle_free: (a: number, b: number) => void;
|
|
2386
2544
|
readonly __wbg_breezsdk_free: (a: number, b: number) => void;
|
|
2545
|
+
readonly __wbg_defaultcpfpsigner_free: (a: number, b: number) => void;
|
|
2387
2546
|
readonly __wbg_externalsigners_free: (a: number, b: number) => void;
|
|
2388
2547
|
readonly __wbg_passkeyclient_free: (a: number, b: number) => void;
|
|
2389
2548
|
readonly __wbg_passkeylabels_free: (a: number, b: number) => void;
|
|
@@ -2392,13 +2551,16 @@ export interface InitOutput {
|
|
|
2392
2551
|
readonly __wbg_wasmsdkcontext_free: (a: number, b: number) => void;
|
|
2393
2552
|
readonly __wbg_wasmstorageconfig_free: (a: number, b: number) => void;
|
|
2394
2553
|
readonly bitcoinchainservicehandle_broadcastTransaction: (a: number, b: number, c: number) => any;
|
|
2554
|
+
readonly bitcoinchainservicehandle_getAddressTxos: (a: number, b: number, c: number) => any;
|
|
2395
2555
|
readonly bitcoinchainservicehandle_getAddressUtxos: (a: number, b: number, c: number) => any;
|
|
2556
|
+
readonly bitcoinchainservicehandle_getOutspend: (a: number, b: number, c: number, d: number) => any;
|
|
2396
2557
|
readonly bitcoinchainservicehandle_getTransactionHex: (a: number, b: number, c: number) => any;
|
|
2397
2558
|
readonly bitcoinchainservicehandle_getTransactionStatus: (a: number, b: number, c: number) => any;
|
|
2398
2559
|
readonly bitcoinchainservicehandle_recommendedFees: (a: number) => any;
|
|
2399
2560
|
readonly breezsdk_addContact: (a: number, b: any) => any;
|
|
2400
2561
|
readonly breezsdk_addEventListener: (a: number, b: any) => any;
|
|
2401
2562
|
readonly breezsdk_authorizeLightningAddressTransfer: (a: number, b: any) => any;
|
|
2563
|
+
readonly breezsdk_buildUnsignedBatchPackage: (a: number, b: any) => any;
|
|
2402
2564
|
readonly breezsdk_buildUnsignedLnurlPayPackage: (a: number, b: any) => any;
|
|
2403
2565
|
readonly breezsdk_buildUnsignedTransferPackage: (a: number, b: any) => any;
|
|
2404
2566
|
readonly breezsdk_buyBitcoin: (a: number, b: any) => any;
|
|
@@ -2430,7 +2592,9 @@ export interface InitOutput {
|
|
|
2430
2592
|
readonly breezsdk_optimizeLeaves: (a: number, b: any) => any;
|
|
2431
2593
|
readonly breezsdk_parse: (a: number, b: number, c: number) => any;
|
|
2432
2594
|
readonly breezsdk_prepareLnurlPay: (a: number, b: any) => any;
|
|
2595
|
+
readonly breezsdk_prepareSendBatch: (a: number, b: any) => any;
|
|
2433
2596
|
readonly breezsdk_prepareSendPayment: (a: number, b: any) => any;
|
|
2597
|
+
readonly breezsdk_prepareUnilateralExit: (a: number, b: any) => any;
|
|
2434
2598
|
readonly breezsdk_publishSignedLnurlPayPackage: (a: number, b: any) => any;
|
|
2435
2599
|
readonly breezsdk_publishSignedTransferPackage: (a: number, b: any) => any;
|
|
2436
2600
|
readonly breezsdk_receivePayment: (a: number, b: any) => any;
|
|
@@ -2440,9 +2604,11 @@ export interface InitOutput {
|
|
|
2440
2604
|
readonly breezsdk_registerLightningAddress: (a: number, b: any) => any;
|
|
2441
2605
|
readonly breezsdk_registerWebhook: (a: number, b: any) => any;
|
|
2442
2606
|
readonly breezsdk_removeEventListener: (a: number, b: number, c: number) => any;
|
|
2607
|
+
readonly breezsdk_sendBatch: (a: number, b: any) => any;
|
|
2443
2608
|
readonly breezsdk_sendPayment: (a: number, b: any) => any;
|
|
2444
2609
|
readonly breezsdk_signMessage: (a: number, b: any) => any;
|
|
2445
2610
|
readonly breezsdk_syncWallet: (a: number, b: any) => any;
|
|
2611
|
+
readonly breezsdk_unilateralExit: (a: number, b: any, c: any) => any;
|
|
2446
2612
|
readonly breezsdk_unregisterWebhook: (a: number, b: any) => any;
|
|
2447
2613
|
readonly breezsdk_updateContact: (a: number, b: any) => any;
|
|
2448
2614
|
readonly breezsdk_updateUserSettings: (a: number, b: any) => any;
|
|
@@ -2458,6 +2624,7 @@ export interface InitOutput {
|
|
|
2458
2624
|
readonly defaultServerConfig: (a: any) => any;
|
|
2459
2625
|
readonly defaultSessionStore: (a: number, b: any, c: number, d: number) => any;
|
|
2460
2626
|
readonly defaultStorage: (a: number, b: number) => number;
|
|
2627
|
+
readonly defaultcpfpsigner_signPsbt: (a: number, b: number, c: number) => any;
|
|
2461
2628
|
readonly defaultsessionstore_getSession: (a: number, b: number, c: number) => any;
|
|
2462
2629
|
readonly defaultsessionstore_setSession: (a: number, b: number, c: number, d: any) => any;
|
|
2463
2630
|
readonly externalbreezsignerhandle_decryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
@@ -2484,6 +2651,7 @@ export interface InitOutput {
|
|
|
2484
2651
|
readonly externalsparksignerhandle_prepareTransfer: (a: number, b: any) => any;
|
|
2485
2652
|
readonly externalsparksignerhandle_signAuthenticationChallenge: (a: number, b: number, c: number) => any;
|
|
2486
2653
|
readonly externalsparksignerhandle_signFrost: (a: number, b: number, c: number) => any;
|
|
2654
|
+
readonly externalsparksignerhandle_signLeafRefundSpend: (a: number, b: any, c: number, d: number) => any;
|
|
2487
2655
|
readonly externalsparksignerhandle_signMessage: (a: number, b: number, c: number) => any;
|
|
2488
2656
|
readonly externalsparksignerhandle_signSparkInvoice: (a: number, b: any) => any;
|
|
2489
2657
|
readonly externalsparksignerhandle_signStaticDepositRefund: (a: number, b: any) => any;
|
|
@@ -2520,6 +2688,7 @@ export interface InitOutput {
|
|
|
2520
2688
|
readonly sdkbuilder_withSharedContext: (a: number, b: number) => number;
|
|
2521
2689
|
readonly sdkbuilder_withStorage: (a: number, b: any) => number;
|
|
2522
2690
|
readonly sdkbuilder_withStorageBackend: (a: number, b: number) => number;
|
|
2691
|
+
readonly singleKeyCpfpSigner: (a: number, b: number) => [number, number, number];
|
|
2523
2692
|
readonly start: () => void;
|
|
2524
2693
|
readonly tokenissuer_burnIssuerToken: (a: number, b: any) => any;
|
|
2525
2694
|
readonly tokenissuer_createIssuerToken: (a: number, b: any) => any;
|