@breeztech/breez-sdk-spark 0.19.2 → 0.20.0-dev1
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 +101 -1
- package/bundler/breez_sdk_spark_wasm.js +1 -1
- package/bundler/breez_sdk_spark_wasm_bg.js +149 -13
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +8 -0
- package/deno/breez_sdk_spark_wasm.d.ts +101 -1
- package/deno/breez_sdk_spark_wasm.js +149 -13
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +8 -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 +101 -1
- package/nodejs/breez_sdk_spark_wasm.js +151 -13
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +8 -0
- package/nodejs/index.mjs +2 -0
- package/package.json +1 -1
- package/ssr/index.js +12 -0
- package/web/breez_sdk_spark_wasm.d.ts +109 -1
- package/web/breez_sdk_spark_wasm.js +149 -13
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +8 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// Smoke test for the npm package API, exercised the way the reference web
|
|
4
|
+
// app uses it (packages/wasm/examples/web): SdkBuilder + default storage,
|
|
5
|
+
// events, receive, parse, send between two instances, payment listing, and
|
|
6
|
+
// lnurl-pay against the docker LNURL fixture. Deep per-command behavior
|
|
7
|
+
// lives in the shared CLI scenarios; this pins the API surface itself.
|
|
8
|
+
|
|
9
|
+
require('dotenv').config()
|
|
10
|
+
|
|
11
|
+
const assert = require('node:assert/strict')
|
|
12
|
+
const fs = require('fs')
|
|
13
|
+
const os = require('os')
|
|
14
|
+
const path = require('path')
|
|
15
|
+
const test = require('node:test')
|
|
16
|
+
|
|
17
|
+
const { defaultConfig, SdkBuilder } = require('@breeztech/breez-sdk-spark/nodejs')
|
|
18
|
+
|
|
19
|
+
const { fundAddress } = require('./helpers/faucet')
|
|
20
|
+
const { LnurlFixture, dockerAvailable } = require('./helpers/lnurl-fixture')
|
|
21
|
+
|
|
22
|
+
function sleep(ms) {
|
|
23
|
+
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Queue-backed event listener with a predicate wait. */
|
|
27
|
+
class EventQueue {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.events = []
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onEvent(event) {
|
|
33
|
+
this.events.push(event)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async waitFor(predicate, timeoutMs) {
|
|
37
|
+
const deadline = Date.now() + timeoutMs
|
|
38
|
+
for (;;) {
|
|
39
|
+
const event = this.events.find(predicate)
|
|
40
|
+
if (event !== undefined) {
|
|
41
|
+
return event
|
|
42
|
+
}
|
|
43
|
+
if (Date.now() >= deadline) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`timed out waiting for event; seen: ${this.events.map((e) => e.type).join(', ')}`
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
await sleep(200)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function connectWallet(name, lnurlDomain) {
|
|
54
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), `breez-smoke-${name}-`))
|
|
55
|
+
let sdk
|
|
56
|
+
try {
|
|
57
|
+
const config = defaultConfig('regtest')
|
|
58
|
+
if (lnurlDomain !== undefined) {
|
|
59
|
+
config.lnurlDomain = lnurlDomain
|
|
60
|
+
}
|
|
61
|
+
const mnemonic = require('bip39').generateMnemonic()
|
|
62
|
+
let builder = SdkBuilder.new(config, { type: 'mnemonic', mnemonic })
|
|
63
|
+
builder = await builder.withDefaultStorage(dir)
|
|
64
|
+
sdk = await builder.build()
|
|
65
|
+
const events = new EventQueue()
|
|
66
|
+
await sdk.addEventListener(events)
|
|
67
|
+
return { sdk, events, dir }
|
|
68
|
+
} catch (e) {
|
|
69
|
+
// Partial failure leaves nothing behind: the caller only cleans up
|
|
70
|
+
// wallets it received.
|
|
71
|
+
await sdk?.disconnect().catch(() => {})
|
|
72
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
73
|
+
throw e
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function waitForBalance(sdk, floorSats, timeoutMs) {
|
|
78
|
+
const deadline = Date.now() + timeoutMs
|
|
79
|
+
for (;;) {
|
|
80
|
+
const info = await sdk.getInfo({ ensureSynced: true })
|
|
81
|
+
if (info.balanceSats >= floorSats) {
|
|
82
|
+
return info
|
|
83
|
+
}
|
|
84
|
+
if (Date.now() >= deadline) {
|
|
85
|
+
throw new Error(`balance stayed below ${floorSats} (last: ${info.balanceSats})`)
|
|
86
|
+
}
|
|
87
|
+
await sleep(5000)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
test('npm API smoke: connect, receive, parse, pay, list, lnurl-pay', async (t) => {
|
|
92
|
+
if (!process.env.FAUCET_USERNAME) {
|
|
93
|
+
t.skip('FAUCET_USERNAME not set')
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
const haveDocker = dockerAvailable()
|
|
97
|
+
|
|
98
|
+
let lnurl
|
|
99
|
+
const wallets = []
|
|
100
|
+
try {
|
|
101
|
+
if (haveDocker) {
|
|
102
|
+
lnurl = await LnurlFixture.start()
|
|
103
|
+
}
|
|
104
|
+
const alice = await connectWallet('alice')
|
|
105
|
+
wallets.push(alice)
|
|
106
|
+
const bob = await connectWallet('bob', lnurl?.httpUrl)
|
|
107
|
+
wallets.push(bob)
|
|
108
|
+
|
|
109
|
+
// Balance and event surface on a fresh wallet.
|
|
110
|
+
const info = await alice.sdk.getInfo({ ensureSynced: true })
|
|
111
|
+
assert.equal(info.balanceSats, 0)
|
|
112
|
+
assert.equal(typeof info.identityPubkey, 'string')
|
|
113
|
+
await alice.events.waitFor((e) => e.type === 'synced', 30_000)
|
|
114
|
+
|
|
115
|
+
// Receive requests and parsing.
|
|
116
|
+
const bolt11 = await alice.sdk.receivePayment({
|
|
117
|
+
paymentMethod: { type: 'bolt11Invoice', description: 'smoke test', amountSats: 2500 }
|
|
118
|
+
})
|
|
119
|
+
const parsed = await alice.sdk.parse(bolt11.paymentRequest)
|
|
120
|
+
assert.equal(parsed.type, 'bolt11Invoice')
|
|
121
|
+
assert.equal(parsed.amountMsat, 2_500_000)
|
|
122
|
+
assert.equal(parsed.description, 'smoke test')
|
|
123
|
+
|
|
124
|
+
const bobAddress = await bob.sdk.receivePayment({ paymentMethod: { type: 'sparkAddress' } })
|
|
125
|
+
assert.equal((await bob.sdk.parse(bobAddress.paymentRequest)).type, 'sparkAddress')
|
|
126
|
+
|
|
127
|
+
// Fund alice through an on-chain deposit and wait for the auto-claim.
|
|
128
|
+
const deposit = await alice.sdk.receivePayment({ paymentMethod: { type: 'bitcoinAddress' } })
|
|
129
|
+
await fundAddress(deposit.paymentRequest, 50_000)
|
|
130
|
+
await waitForBalance(alice.sdk, 40_000, 180_000)
|
|
131
|
+
|
|
132
|
+
// Spark payment alice -> bob.
|
|
133
|
+
const prepared = await alice.sdk.prepareSendPayment({
|
|
134
|
+
paymentRequest: { type: 'input', input: bobAddress.paymentRequest },
|
|
135
|
+
amount: 1000n
|
|
136
|
+
})
|
|
137
|
+
assert.equal(prepared.paymentMethod.type, 'sparkAddress')
|
|
138
|
+
const sent = await alice.sdk.sendPayment({ prepareResponse: prepared })
|
|
139
|
+
assert.equal(sent.payment.status, 'completed')
|
|
140
|
+
assert.equal(sent.payment.paymentType, 'send')
|
|
141
|
+
|
|
142
|
+
const fetched = await alice.sdk.getPayment({ paymentId: sent.payment.id })
|
|
143
|
+
assert.equal(fetched.payment.id, sent.payment.id)
|
|
144
|
+
const listed = await alice.sdk.listPayments({})
|
|
145
|
+
assert.ok(listed.payments.some((p) => p.id === sent.payment.id))
|
|
146
|
+
|
|
147
|
+
await waitForBalance(bob.sdk, 1000, 90_000)
|
|
148
|
+
|
|
149
|
+
// lnurl-pay against the local LNURL server (docker only).
|
|
150
|
+
if (haveDocker) {
|
|
151
|
+
const registered = await bob.sdk.registerLightningAddress({
|
|
152
|
+
username: 'smoketest',
|
|
153
|
+
description: 'smoke test address'
|
|
154
|
+
})
|
|
155
|
+
const lnAddress = await alice.sdk.parse(registered.lightningAddress)
|
|
156
|
+
assert.equal(lnAddress.type, 'lightningAddress')
|
|
157
|
+
const preparedLnurl = await alice.sdk.prepareLnurlPay({
|
|
158
|
+
amount: 1500n,
|
|
159
|
+
payRequest: lnAddress.payRequest,
|
|
160
|
+
comment: 'smoke comment'
|
|
161
|
+
})
|
|
162
|
+
// The payment can return pending: completion needs the receiver to
|
|
163
|
+
// claim, so poll until the preimage is released.
|
|
164
|
+
const paid = await alice.sdk.lnurlPay({ prepareResponse: preparedLnurl })
|
|
165
|
+
const deadline = Date.now() + 120_000
|
|
166
|
+
let status = paid.payment.status
|
|
167
|
+
while (status !== 'completed') {
|
|
168
|
+
if (Date.now() >= deadline) {
|
|
169
|
+
throw new Error(`lnurl payment stayed ${status}`)
|
|
170
|
+
}
|
|
171
|
+
await sleep(5000)
|
|
172
|
+
status = (await alice.sdk.getPayment({ paymentId: paid.payment.id })).payment.status
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
console.error('skipping lnurl-pay part: docker not available')
|
|
176
|
+
}
|
|
177
|
+
} finally {
|
|
178
|
+
for (const wallet of wallets) {
|
|
179
|
+
await wallet.sdk.disconnect().catch(() => {})
|
|
180
|
+
fs.rmSync(wallet.dir, { recursive: true, force: true })
|
|
181
|
+
}
|
|
182
|
+
lnurl?.stop()
|
|
183
|
+
}
|
|
184
|
+
})
|
|
@@ -511,8 +511,10 @@ export interface BitcoinAddressDetails {
|
|
|
511
511
|
|
|
512
512
|
export interface BitcoinChainService {
|
|
513
513
|
getAddressUtxos(address: string): Promise<Utxo[]>;
|
|
514
|
+
getAddressTxos(address: string): Promise<Utxo[]>;
|
|
514
515
|
getTransactionStatus(txid: string): Promise<TxStatus>;
|
|
515
516
|
getTransactionHex(txid: string): Promise<string>;
|
|
517
|
+
getOutspend(txid: string, vout: number): Promise<Outspend>;
|
|
516
518
|
broadcastTransaction(tx: string): Promise<void>;
|
|
517
519
|
recommendedFees(): Promise<RecommendedFees>;
|
|
518
520
|
}
|
|
@@ -718,6 +720,10 @@ export interface ConversionSide {
|
|
|
718
720
|
fee: string;
|
|
719
721
|
}
|
|
720
722
|
|
|
723
|
+
export interface CpfpSigner {
|
|
724
|
+
signPsbt(psbtBytes: Uint8Array): Promise<Uint8Array>;
|
|
725
|
+
}
|
|
726
|
+
|
|
721
727
|
export interface CreateIssuerTokenRequest {
|
|
722
728
|
name: string;
|
|
723
729
|
ticker: string;
|
|
@@ -955,6 +961,7 @@ export interface ExternalSparkSigner {
|
|
|
955
961
|
getStaticDepositPublicKey(index: number): Promise<PublicKeyBytes>;
|
|
956
962
|
signAuthenticationChallenge(challenge: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
957
963
|
signMessage(message: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
964
|
+
signLeafRefundSpend(leafId: ExternalTreeNodeId, sighash: Uint8Array): Promise<SchnorrSignatureBytes>;
|
|
958
965
|
signFrost(jobs: ExternalFrostJob[]): Promise<ExternalFrostShareResult[]>;
|
|
959
966
|
prepareTransfer(request: ExternalPrepareTransferRequest): Promise<ExternalPreparedTransfer>;
|
|
960
967
|
prepareClaim(request: ExternalPrepareClaimRequest): Promise<ExternalPreparedClaim>;
|
|
@@ -1282,6 +1289,11 @@ export interface PaymentRequestSource {
|
|
|
1282
1289
|
bip353Address?: string;
|
|
1283
1290
|
}
|
|
1284
1291
|
|
|
1292
|
+
export interface PerBranchFunding {
|
|
1293
|
+
leafId: string;
|
|
1294
|
+
fundingSat: number;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1285
1297
|
export interface PrepareLnurlPayRequest {
|
|
1286
1298
|
amount: bigint;
|
|
1287
1299
|
comment?: string;
|
|
@@ -1319,6 +1331,24 @@ export interface PrepareSendPaymentResponse {
|
|
|
1319
1331
|
feePolicy: FeePolicy;
|
|
1320
1332
|
}
|
|
1321
1333
|
|
|
1334
|
+
export interface PrepareUnilateralExitRequest {
|
|
1335
|
+
feeRateSatPerVbyte: number;
|
|
1336
|
+
fundingKind: CpfpFundingKind;
|
|
1337
|
+
destination: string;
|
|
1338
|
+
selection: ExitLeafSelection;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
export interface PrepareUnilateralExitResponse {
|
|
1342
|
+
leaves: UnilateralExitLeaf[];
|
|
1343
|
+
recoverableValueSat: number;
|
|
1344
|
+
totalFeeSat: number;
|
|
1345
|
+
fanoutFeeSat: number;
|
|
1346
|
+
singleUtxoFundingSat: number;
|
|
1347
|
+
perBranchFunding: PerBranchFunding[];
|
|
1348
|
+
feeRateSatPerVbyte: number;
|
|
1349
|
+
destination: string;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1322
1352
|
export interface ProvisionalPayment {
|
|
1323
1353
|
paymentId: string;
|
|
1324
1354
|
amount: bigint;
|
|
@@ -1394,6 +1424,12 @@ export interface RefundDepositResponse {
|
|
|
1394
1424
|
txHex: string;
|
|
1395
1425
|
}
|
|
1396
1426
|
|
|
1427
|
+
export interface RefundPendingConversionsResponse {
|
|
1428
|
+
refunded: number;
|
|
1429
|
+
skipped: number;
|
|
1430
|
+
failed: number;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1397
1433
|
export interface RegisterLightningAddressRequest {
|
|
1398
1434
|
username: string;
|
|
1399
1435
|
description?: string;
|
|
@@ -1701,6 +1737,34 @@ export interface UnfreezeIssuerTokenResponse {
|
|
|
1701
1737
|
impactedTokenAmount: bigint;
|
|
1702
1738
|
}
|
|
1703
1739
|
|
|
1740
|
+
export interface UnilateralExitLeaf {
|
|
1741
|
+
leafId: string;
|
|
1742
|
+
value: number;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
export interface UnilateralExitRequest {
|
|
1746
|
+
prepared: PrepareUnilateralExitResponse;
|
|
1747
|
+
fundingInputs: CpfpInput[];
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
export interface UnilateralExitResponse {
|
|
1751
|
+
recoverableValueSat: number;
|
|
1752
|
+
totalFeeSat: number;
|
|
1753
|
+
leaves: UnilateralExitLeaf[];
|
|
1754
|
+
transactions: UnilateralExitTransaction[];
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
export interface UnilateralExitTransaction {
|
|
1758
|
+
kind: UnilateralExitTxKind;
|
|
1759
|
+
nodeId?: string;
|
|
1760
|
+
txid: string;
|
|
1761
|
+
txHex: string;
|
|
1762
|
+
cpfpTxHex?: string;
|
|
1763
|
+
csvTimelockBlocks?: number;
|
|
1764
|
+
dependsOn: string[];
|
|
1765
|
+
status: ConfirmationStatus;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1704
1768
|
export interface UnregisterWebhookRequest {
|
|
1705
1769
|
webhookId: string;
|
|
1706
1770
|
}
|
|
@@ -1720,6 +1784,7 @@ export interface UpdateContactRequest {
|
|
|
1720
1784
|
export interface UpdateUserSettingsRequest {
|
|
1721
1785
|
sparkPrivateModeEnabled?: boolean;
|
|
1722
1786
|
stableBalanceActiveLabel?: StableBalanceActiveLabel;
|
|
1787
|
+
sparkMasterIdentityPublicKey?: SparkMasterIdentityPublicKey;
|
|
1723
1788
|
}
|
|
1724
1789
|
|
|
1725
1790
|
export interface UrlSuccessActionData {
|
|
@@ -1731,6 +1796,7 @@ export interface UrlSuccessActionData {
|
|
|
1731
1796
|
export interface UserSettings {
|
|
1732
1797
|
sparkPrivateModeEnabled: boolean;
|
|
1733
1798
|
stableBalanceActiveLabel?: string;
|
|
1799
|
+
sparkMasterIdentityPublicKey?: string;
|
|
1734
1800
|
}
|
|
1735
1801
|
|
|
1736
1802
|
export interface Utxo {
|
|
@@ -1764,6 +1830,8 @@ export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; red
|
|
|
1764
1830
|
|
|
1765
1831
|
export type ChainApiType = "esplora" | "mempoolSpace";
|
|
1766
1832
|
|
|
1833
|
+
export type ConfirmationStatus = "confirmed" | "unconfirmed" | "unverified";
|
|
1834
|
+
|
|
1767
1835
|
export type ConversionChain = { type: "spark" } | { type: "lightning" } | { type: "external"; name: string; chainId?: string };
|
|
1768
1836
|
|
|
1769
1837
|
export type ConversionFilter = "ammRefundNeeded" | "orchestraPending" | "boltzPending";
|
|
@@ -1778,6 +1846,10 @@ export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeede
|
|
|
1778
1846
|
|
|
1779
1847
|
export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
|
|
1780
1848
|
|
|
1849
|
+
export type CpfpFundingKind = { type: "p2wpkh" } | { type: "p2tr" } | { type: "custom"; scriptPubkeyHex: string; signedInputWeight: number };
|
|
1850
|
+
|
|
1851
|
+
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 };
|
|
1852
|
+
|
|
1781
1853
|
export type CrossChainAddressFamily = "evm" | "solana" | "tron";
|
|
1782
1854
|
|
|
1783
1855
|
export type CrossChainFeeMode = "feesExcluded" | "feesIncluded";
|
|
@@ -1790,6 +1862,8 @@ export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAd
|
|
|
1790
1862
|
|
|
1791
1863
|
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
1864
|
|
|
1865
|
+
export type ExitLeafSelection = { type: "auto" } | { type: "specific"; leafIds: string[] };
|
|
1866
|
+
|
|
1793
1867
|
export type ExternalFrostDerivation = { type: "signingLeaf"; leafId: ExternalTreeNodeId } | { type: "staticDeposit"; index: number } | { type: "htlcPreimage" } | { type: "identity" };
|
|
1794
1868
|
|
|
1795
1869
|
export type ExternalSparkInvoiceKind = "sats" | "tokens";
|
|
@@ -1814,6 +1888,8 @@ export type OptimizationMode = "full" | "singleRound";
|
|
|
1814
1888
|
|
|
1815
1889
|
export type OptimizationOutcome = { type: "completed"; roundsExecuted: number } | { type: "inProgress" };
|
|
1816
1890
|
|
|
1891
|
+
export type Outspend = { type: "unspent" } | { type: "spent"; txid: string; vin: number; status: TxStatus };
|
|
1892
|
+
|
|
1817
1893
|
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
1894
|
|
|
1819
1895
|
export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
|
|
@@ -1850,6 +1926,8 @@ export type SourceAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier
|
|
|
1850
1926
|
|
|
1851
1927
|
export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
|
|
1852
1928
|
|
|
1929
|
+
export type SparkMasterIdentityPublicKey = { type: "set"; publicKey: string } | { type: "unset" };
|
|
1930
|
+
|
|
1853
1931
|
export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
|
|
1854
1932
|
|
|
1855
1933
|
export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionFilter?: ConversionFilter } | { type: "token"; conversionFilter?: ConversionFilter; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[]; conversionFilter?: ConversionFilter };
|
|
@@ -1864,6 +1942,8 @@ export type TransferSignature = { type: "transfer"; signed: ExternalPreparedTran
|
|
|
1864
1942
|
|
|
1865
1943
|
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
1944
|
|
|
1945
|
+
export type UnilateralExitTxKind = "fanOut" | "node" | "refund" | "sweep";
|
|
1946
|
+
|
|
1867
1947
|
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 };
|
|
1868
1948
|
|
|
1869
1949
|
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
|
|
@@ -1884,7 +1964,9 @@ export class BitcoinChainServiceHandle {
|
|
|
1884
1964
|
free(): void;
|
|
1885
1965
|
[Symbol.dispose](): void;
|
|
1886
1966
|
broadcastTransaction(tx: string): Promise<void>;
|
|
1967
|
+
getAddressTxos(address: string): Promise<any>;
|
|
1887
1968
|
getAddressUtxos(address: string): Promise<any>;
|
|
1969
|
+
getOutspend(txid: string, vout: number): Promise<any>;
|
|
1888
1970
|
getTransactionHex(txid: string): Promise<any>;
|
|
1889
1971
|
getTransactionStatus(txid: string): Promise<any>;
|
|
1890
1972
|
recommendedFees(): Promise<any>;
|
|
@@ -1929,23 +2011,35 @@ export class BreezSdk {
|
|
|
1929
2011
|
parse(input: string): Promise<InputType>;
|
|
1930
2012
|
prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
|
|
1931
2013
|
prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
|
|
2014
|
+
prepareUnilateralExit(request: PrepareUnilateralExitRequest): Promise<PrepareUnilateralExitResponse>;
|
|
1932
2015
|
publishSignedLnurlPayPackage(request: PublishSignedLnurlPayPackageRequest): Promise<PublishSignedLnurlPayResponse>;
|
|
1933
2016
|
publishSignedTransferPackage(request: PublishSignedTransferPackageRequest): Promise<PublishSignedTransferPackageResponse>;
|
|
1934
2017
|
receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
|
|
1935
2018
|
recommendedFees(): Promise<RecommendedFees>;
|
|
1936
2019
|
refundDeposit(request: RefundDepositRequest): Promise<RefundDepositResponse>;
|
|
1937
|
-
refundPendingConversions(): Promise<
|
|
2020
|
+
refundPendingConversions(): Promise<RefundPendingConversionsResponse>;
|
|
1938
2021
|
registerLightningAddress(request: RegisterLightningAddressRequest): Promise<LightningAddressInfo>;
|
|
1939
2022
|
registerWebhook(request: RegisterWebhookRequest): Promise<RegisterWebhookResponse>;
|
|
1940
2023
|
removeEventListener(id: string): Promise<boolean>;
|
|
1941
2024
|
sendPayment(request: SendPaymentRequest): Promise<SendPaymentResponse>;
|
|
1942
2025
|
signMessage(request: SignMessageRequest): Promise<SignMessageResponse>;
|
|
1943
2026
|
syncWallet(request: SyncWalletRequest): Promise<SyncWalletResponse>;
|
|
2027
|
+
unilateralExit(request: UnilateralExitRequest, signer: CpfpSigner): Promise<UnilateralExitResponse>;
|
|
1944
2028
|
unregisterWebhook(request: UnregisterWebhookRequest): Promise<void>;
|
|
1945
2029
|
updateContact(request: UpdateContactRequest): Promise<Contact>;
|
|
1946
2030
|
updateUserSettings(request: UpdateUserSettingsRequest): Promise<void>;
|
|
1947
2031
|
}
|
|
1948
2032
|
|
|
2033
|
+
/**
|
|
2034
|
+
* A CPFP signer matching the `CpfpSigner` TypeScript interface.
|
|
2035
|
+
*/
|
|
2036
|
+
export class DefaultCpfpSigner {
|
|
2037
|
+
private constructor();
|
|
2038
|
+
free(): void;
|
|
2039
|
+
[Symbol.dispose](): void;
|
|
2040
|
+
signPsbt(psbt_bytes: Uint8Array): Promise<Uint8Array>;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
1949
2043
|
/**
|
|
1950
2044
|
* A JS handle to a backend's own session store (from `defaultSessionStore`),
|
|
1951
2045
|
* exposing the same `getSession` / `setSession` interface. Wrap it in a JS
|
|
@@ -2041,6 +2135,7 @@ export class ExternalSparkSignerHandle {
|
|
|
2041
2135
|
prepareTransfer(request: ExternalPrepareTransferRequest): Promise<ExternalPreparedTransfer>;
|
|
2042
2136
|
signAuthenticationChallenge(challenge: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
2043
2137
|
signFrost(jobs: ExternalFrostJob[]): Promise<ExternalFrostShareResult[]>;
|
|
2138
|
+
signLeafRefundSpend(leaf_id: ExternalTreeNodeId, sighash: Uint8Array): Promise<SchnorrSignatureBytes>;
|
|
2044
2139
|
signMessage(message: Uint8Array): Promise<EcdsaSignatureBytes>;
|
|
2045
2140
|
signSparkInvoice(request: ExternalSignSparkInvoiceRequest): Promise<ExternalSignedSparkInvoice>;
|
|
2046
2141
|
signStaticDepositRefund(request: ExternalSignStaticDepositRefundRequest): Promise<ExternalFrostSignature>;
|
|
@@ -2365,6 +2460,11 @@ export function newSharedSdkContext(config: WasmSdkContextConfig): Promise<WasmS
|
|
|
2365
2460
|
*/
|
|
2366
2461
|
export function postgresStorage(config: PostgresStorageConfig): WasmStorageConfig;
|
|
2367
2462
|
|
|
2463
|
+
/**
|
|
2464
|
+
* Creates a default CPFP signer backed by a single private key.
|
|
2465
|
+
*/
|
|
2466
|
+
export function singleKeyCpfpSigner(secret_key_bytes: Uint8Array): DefaultCpfpSigner;
|
|
2467
|
+
|
|
2368
2468
|
/**
|
|
2369
2469
|
* Runs automatically when the wasm module is instantiated. Installs the
|
|
2370
2470
|
* panic hook so Rust panics surface as readable `console.error` output
|