@breeztech/breez-sdk-spark 0.22.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/breez-sdk-spark.tgz +0 -0
- package/bundler/breez_sdk_spark_wasm.d.ts +65 -5
- package/bundler/breez_sdk_spark_wasm_bg.js +66 -27
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/bundler/index.js +15 -2
- package/bundler/package.json +5 -0
- package/bundler/storage/index.js +6 -0
- package/bundler/tree-store/index.js +1518 -0
- package/bundler/tree-store/package.json +12 -0
- package/deno/breez_sdk_spark_wasm.d.ts +65 -5
- package/deno/breez_sdk_spark_wasm.js +66 -27
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/nodejs/breez_sdk_spark_wasm.d.ts +65 -5
- package/nodejs/breez_sdk_spark_wasm.js +66 -27
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/nodejs/index.js +11 -0
- package/nodejs/mysql-storage/index.cjs +9 -1
- package/nodejs/mysql-storage/migrations.cjs +6 -0
- package/nodejs/mysql-tree-store/index.cjs +296 -29
- package/nodejs/mysql-tree-store/migrations.cjs +198 -34
- package/nodejs/package.json +1 -0
- package/nodejs/postgres-storage/index.cjs +9 -1
- package/nodejs/postgres-storage/migrations.cjs +6 -0
- package/nodejs/postgres-tree-store/index.cjs +301 -40
- package/nodejs/postgres-tree-store/migrations.cjs +42 -0
- package/nodejs/storage/index.cjs +14 -3
- package/nodejs/storage/migrations.cjs +6 -0
- package/nodejs/tree-store/errors.cjs +13 -0
- package/nodejs/tree-store/index.cjs +1185 -0
- package/nodejs/tree-store/migrations.cjs +185 -0
- package/nodejs/tree-store/package.json +9 -0
- package/package.json +1 -1
- package/web/breez_sdk_spark_wasm.d.ts +74 -11
- package/web/breez_sdk_spark_wasm.js +66 -27
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +9 -6
- package/web/index.js +15 -2
- package/web/package.json +5 -0
- package/web/storage/index.js +6 -0
- package/web/tree-store/index.js +1518 -0
- package/web/tree-store/package.json +12 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Migration Manager for the Breez SDK Node.js SQLite Tree Store.
|
|
3
|
+
*
|
|
4
|
+
* The store shares the wallet's main SQLite database file. Its `tree` table
|
|
5
|
+
* names are what keep it clear of the main storage's; the `brz_` prefix on top
|
|
6
|
+
* of those is for consistency with the Postgres and MySQL backends. Schema
|
|
7
|
+
* mirrors the Rust `spark-sqlite` tree store (crates/spark-sqlite/src/lib.rs).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// TreeStoreError arrives as a parameter to avoid a circular require.
|
|
11
|
+
class TreeStoreMigrationManager {
|
|
12
|
+
constructor(db, TreeStoreError, logger = null) {
|
|
13
|
+
this.db = db;
|
|
14
|
+
this.TreeStoreError = TreeStoreError;
|
|
15
|
+
this.logger = logger;
|
|
16
|
+
this.migrations = this._getMigrations();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Run all pending migrations, or up to a specific version.
|
|
21
|
+
* @param {number|null} targetVersion - Target version (default: latest)
|
|
22
|
+
*/
|
|
23
|
+
migrate(targetVersion = null) {
|
|
24
|
+
this._ensureMigrationsTable();
|
|
25
|
+
const currentVersion = this._getCurrentVersion();
|
|
26
|
+
targetVersion = targetVersion ?? this.migrations.length;
|
|
27
|
+
|
|
28
|
+
if (currentVersion >= targetVersion) {
|
|
29
|
+
this._log("info", `Tree store is up to date (version ${currentVersion})`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
this._log(
|
|
34
|
+
"info",
|
|
35
|
+
`Migrating tree store from version ${currentVersion} to ${targetVersion}`
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const transaction = this.db.transaction(() => {
|
|
40
|
+
for (let i = currentVersion; i < targetVersion; i++) {
|
|
41
|
+
const migration = this.migrations[i];
|
|
42
|
+
this._log("debug", `Running migration ${i + 1}: ${migration.name}`);
|
|
43
|
+
|
|
44
|
+
if (Array.isArray(migration.sql)) {
|
|
45
|
+
migration.sql.forEach((sql) => this.db.exec(sql));
|
|
46
|
+
} else {
|
|
47
|
+
this.db.exec(migration.sql);
|
|
48
|
+
}
|
|
49
|
+
this._recordVersion(i + 1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
transaction();
|
|
54
|
+
this._log("info", `Tree store migration completed successfully`);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
throw new this.TreeStoreError(
|
|
57
|
+
`Migration failed at version ${currentVersion}: ${error.message}`,
|
|
58
|
+
error
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Create the schema-version ledger if it does not exist. Tracked in a table,
|
|
65
|
+
* not `PRAGMA user_version`, so the store can share the main storage's file.
|
|
66
|
+
*/
|
|
67
|
+
_ensureMigrationsTable() {
|
|
68
|
+
this.db.exec(
|
|
69
|
+
"CREATE TABLE IF NOT EXISTS brz_tree_schema_migrations (version INTEGER PRIMARY KEY)"
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get current schema version (the highest recorded migration).
|
|
75
|
+
*/
|
|
76
|
+
_getCurrentVersion() {
|
|
77
|
+
try {
|
|
78
|
+
const row = this.db
|
|
79
|
+
.prepare(
|
|
80
|
+
"SELECT COALESCE(MAX(version), 0) AS version FROM brz_tree_schema_migrations"
|
|
81
|
+
)
|
|
82
|
+
.get();
|
|
83
|
+
return row.version || 0;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
this._log(
|
|
86
|
+
"warn",
|
|
87
|
+
`Failed to get tree store version, assuming 0: ${error.message}`
|
|
88
|
+
);
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Record a migration as applied.
|
|
95
|
+
*/
|
|
96
|
+
_recordVersion(version) {
|
|
97
|
+
this.db
|
|
98
|
+
.prepare("INSERT INTO brz_tree_schema_migrations (version) VALUES (?)")
|
|
99
|
+
.run(version);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_log(level, message) {
|
|
103
|
+
if (this.logger && typeof this.logger.log === "function") {
|
|
104
|
+
this.logger.log({
|
|
105
|
+
line: message,
|
|
106
|
+
level: level,
|
|
107
|
+
});
|
|
108
|
+
} else if (level === "error") {
|
|
109
|
+
console.error(`[TreeStoreMigrationManager] ${message}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Define all database migrations.
|
|
115
|
+
*
|
|
116
|
+
* Two-table model: `brz_tree_leaves` is the spendable pool (with reservation,
|
|
117
|
+
* missing-from-operators, and timestamp metadata); `brz_tree_ancestors` holds
|
|
118
|
+
* the intermediate exit-chain nodes a leaf walks through, carrying no pool
|
|
119
|
+
* metadata. Each ancestor row is owned by the leaf it belongs to (`leaf_id`
|
|
120
|
+
* is part of its primary key), so a node shared by several leaves' chains
|
|
121
|
+
* stores one row per leaf rather than one deduplicated row. `brz_tree_reservations`,
|
|
122
|
+
* `brz_tree_spent`, and `brz_tree_swap_status` support the reservation,
|
|
123
|
+
* spent-marker, and swap-guard logic.
|
|
124
|
+
*/
|
|
125
|
+
_getMigrations() {
|
|
126
|
+
return [
|
|
127
|
+
{
|
|
128
|
+
name: "Create tree store tables",
|
|
129
|
+
sql: [
|
|
130
|
+
`CREATE TABLE IF NOT EXISTS brz_tree_reservations (
|
|
131
|
+
id TEXT PRIMARY KEY,
|
|
132
|
+
purpose TEXT NOT NULL,
|
|
133
|
+
pending_change_amount INTEGER NOT NULL DEFAULT 0,
|
|
134
|
+
created_at INTEGER NOT NULL
|
|
135
|
+
)`,
|
|
136
|
+
`CREATE TABLE IF NOT EXISTS brz_tree_leaves (
|
|
137
|
+
id TEXT PRIMARY KEY,
|
|
138
|
+
parent_node_id TEXT,
|
|
139
|
+
status TEXT NOT NULL,
|
|
140
|
+
value INTEGER NOT NULL DEFAULT 0,
|
|
141
|
+
verifying_public_key TEXT NOT NULL DEFAULT '',
|
|
142
|
+
signing_public_key TEXT NOT NULL DEFAULT '',
|
|
143
|
+
data TEXT NOT NULL,
|
|
144
|
+
is_missing_from_operators INTEGER NOT NULL DEFAULT 0,
|
|
145
|
+
reservation_id TEXT,
|
|
146
|
+
added_at INTEGER
|
|
147
|
+
)`,
|
|
148
|
+
`CREATE INDEX IF NOT EXISTS brz_idx_tree_leaves_parent ON brz_tree_leaves (parent_node_id)`,
|
|
149
|
+
`CREATE INDEX IF NOT EXISTS brz_idx_tree_leaves_reservation ON brz_tree_leaves (reservation_id)`,
|
|
150
|
+
`CREATE TABLE IF NOT EXISTS brz_tree_ancestors (
|
|
151
|
+
leaf_id TEXT NOT NULL,
|
|
152
|
+
id TEXT NOT NULL,
|
|
153
|
+
parent_node_id TEXT,
|
|
154
|
+
status TEXT NOT NULL,
|
|
155
|
+
value INTEGER NOT NULL DEFAULT 0,
|
|
156
|
+
verifying_public_key TEXT NOT NULL DEFAULT '',
|
|
157
|
+
data TEXT NOT NULL,
|
|
158
|
+
PRIMARY KEY (leaf_id, id)
|
|
159
|
+
)`,
|
|
160
|
+
`CREATE TABLE IF NOT EXISTS brz_tree_spent (
|
|
161
|
+
id TEXT PRIMARY KEY,
|
|
162
|
+
spent_at INTEGER NOT NULL
|
|
163
|
+
)`,
|
|
164
|
+
`CREATE TABLE IF NOT EXISTS brz_tree_swap_status (
|
|
165
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
166
|
+
last_completed_at INTEGER
|
|
167
|
+
)`,
|
|
168
|
+
`INSERT OR IGNORE INTO brz_tree_swap_status (id, last_completed_at) VALUES (1, NULL)`,
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
// Backs the slim-candidate selection query, matching the index
|
|
173
|
+
// `spark-sqlite` creates for the same query.
|
|
174
|
+
name: "Index the slim leaf-candidate columns",
|
|
175
|
+
sql: [
|
|
176
|
+
`CREATE INDEX IF NOT EXISTS brz_idx_tree_leaves_slim
|
|
177
|
+
ON brz_tree_leaves (status, is_missing_from_operators, value)
|
|
178
|
+
WHERE reservation_id IS NULL`,
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
module.exports = { TreeStoreMigrationManager };
|
package/package.json
CHANGED
|
@@ -30,6 +30,14 @@ interface LeavesReservation {
|
|
|
30
30
|
leaves: TreeNode[];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** A leaf together with its ancestor chain, nearest parent first up to the
|
|
34
|
+
* root, so a stored leaf always brings the intermediate nodes its exit chain
|
|
35
|
+
* walks through. */
|
|
36
|
+
interface LeafPedigree {
|
|
37
|
+
leaf: TreeNode;
|
|
38
|
+
ancestors: TreeNode[];
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
type TargetAmounts =
|
|
34
42
|
| { type: 'amountAndFee'; amountSats: number; feeSats: number | null }
|
|
35
43
|
| { type: 'exactDenominations'; denominations: number[] };
|
|
@@ -46,7 +54,10 @@ type LeafSelection =
|
|
|
46
54
|
|
|
47
55
|
export interface TreeStore {
|
|
48
56
|
addLeaves: (leaves: TreeNode[]) => Promise<void>;
|
|
57
|
+
storeAncestors: (pedigrees: LeafPedigree[]) => Promise<void>;
|
|
58
|
+
leavesMissingExitChains: () => Promise<string[]>;
|
|
49
59
|
getLeaves: () => Promise<Leaves>;
|
|
60
|
+
getExitChains: (leafIds: string[]) => Promise<LeafPedigree[]>;
|
|
50
61
|
getAvailableBalance: () => Promise<bigint>;
|
|
51
62
|
getVerifiedLeafKeys: () => Promise<[string, string, string][]>;
|
|
52
63
|
setLeaves: (leaves: TreeNode[], missingLeaves: TreeNode[], refreshStartedAtMs: number) => Promise<void>;
|
|
@@ -650,10 +661,11 @@ export interface ClaimDepositRequest {
|
|
|
650
661
|
txid: string;
|
|
651
662
|
vout: number;
|
|
652
663
|
maxFee?: MaxFee;
|
|
664
|
+
maxInstantFeeBps?: number;
|
|
653
665
|
}
|
|
654
666
|
|
|
655
667
|
export interface ClaimDepositResponse {
|
|
656
|
-
payment
|
|
668
|
+
payment?: Payment;
|
|
657
669
|
}
|
|
658
670
|
|
|
659
671
|
export interface ClaimHtlcPaymentRequest {
|
|
@@ -674,8 +686,10 @@ export interface Config {
|
|
|
674
686
|
network: Network;
|
|
675
687
|
syncIntervalSecs: number;
|
|
676
688
|
maxDepositClaimFee?: MaxFee;
|
|
689
|
+
maxInstantDepositClaimFeeBps?: number;
|
|
677
690
|
lnurlDomain?: string;
|
|
678
691
|
preferSparkOverLightning: boolean;
|
|
692
|
+
exitChainAutoFetchEnabled: boolean;
|
|
679
693
|
externalInputParsers?: ExternalInputParser[];
|
|
680
694
|
useDefaultExternalInputParsers: boolean;
|
|
681
695
|
realTimeSyncServerUrl?: string;
|
|
@@ -789,6 +803,7 @@ export interface CrossChainRoutePair {
|
|
|
789
803
|
decimals: number;
|
|
790
804
|
exactOutEligible: boolean;
|
|
791
805
|
supportedSources: SourceAsset[];
|
|
806
|
+
supportedSourceChains: SourceChain[];
|
|
792
807
|
}
|
|
793
808
|
|
|
794
809
|
export interface CurrencyInfo {
|
|
@@ -809,6 +824,7 @@ export interface DepositInfo {
|
|
|
809
824
|
refundTx?: string;
|
|
810
825
|
refundTxId?: string;
|
|
811
826
|
claimError?: DepositClaimError;
|
|
827
|
+
instantClaimStatus?: InstantClaimStatus;
|
|
812
828
|
}
|
|
813
829
|
|
|
814
830
|
export interface EcdsaSignatureBytes {
|
|
@@ -819,6 +835,10 @@ export interface EventListener {
|
|
|
819
835
|
onEvent: (e: SdkEvent) => void;
|
|
820
836
|
}
|
|
821
837
|
|
|
838
|
+
export interface ExportUnilateralExitStateResponse {
|
|
839
|
+
exitState: string;
|
|
840
|
+
}
|
|
841
|
+
|
|
822
842
|
export interface ExternalBreezSigner {
|
|
823
843
|
derivePublicKey(path: string): Promise<PublicKeyBytes>;
|
|
824
844
|
signEcdsa(message: MessageBytes, path: string): Promise<EcdsaSignatureBytes>;
|
|
@@ -1098,6 +1118,17 @@ export interface IdentifierSignaturePair {
|
|
|
1098
1118
|
signature: ExternalFrostSignatureShare;
|
|
1099
1119
|
}
|
|
1100
1120
|
|
|
1121
|
+
export interface ImportUnilateralExitStateRequest {
|
|
1122
|
+
exitState: string;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export interface ImportUnilateralExitStateResponse {
|
|
1126
|
+
importedLeaves: number;
|
|
1127
|
+
skippedForeignLeaves: number;
|
|
1128
|
+
skippedConflictingLeaves: number;
|
|
1129
|
+
skippedChains: number;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1101
1132
|
export interface IncomingChange {
|
|
1102
1133
|
newState: Record;
|
|
1103
1134
|
oldState?: Record;
|
|
@@ -1345,6 +1376,24 @@ export interface PrepareLnurlPayResponse {
|
|
|
1345
1376
|
feePolicy: FeePolicy;
|
|
1346
1377
|
}
|
|
1347
1378
|
|
|
1379
|
+
export interface PreparePaymentLinkRequest {
|
|
1380
|
+
address: string;
|
|
1381
|
+
route: CrossChainRoutePair;
|
|
1382
|
+
amount: bigint;
|
|
1383
|
+
feePolicy?: FeePolicy;
|
|
1384
|
+
maxSlippageBps?: number;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
export interface PreparePaymentLinkResponse {
|
|
1388
|
+
url: string;
|
|
1389
|
+
amountSats: number;
|
|
1390
|
+
estimatedOut: bigint;
|
|
1391
|
+
asset: string;
|
|
1392
|
+
serviceFeeAmount: bigint;
|
|
1393
|
+
serviceFeeAsset?: string;
|
|
1394
|
+
expiresAt: string;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1348
1397
|
export interface PrepareSendBatchRequest {
|
|
1349
1398
|
recipients: BatchRecipient[];
|
|
1350
1399
|
}
|
|
@@ -1752,6 +1801,8 @@ export interface TransferAuthorization {
|
|
|
1752
1801
|
username: string;
|
|
1753
1802
|
pubkey: string;
|
|
1754
1803
|
signature: string;
|
|
1804
|
+
domain: string;
|
|
1805
|
+
timestamp: number;
|
|
1755
1806
|
}
|
|
1756
1807
|
|
|
1757
1808
|
export interface TurnkeyConfig {
|
|
@@ -1913,7 +1964,7 @@ export type CrossChainProvider = "orchestra" | "boltz";
|
|
|
1913
1964
|
|
|
1914
1965
|
export type CrossChainProviderContext = { type: "orchestra"; quoteId: string; depositAddress: string; depositAmount?: string } | { type: "boltz"; swapId: string; invoice: string; invoiceAmountSats?: number; maxSlippageBps: number };
|
|
1915
1966
|
|
|
1916
|
-
export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAddressDetails } | { type: "receive"; contractAddress?: string };
|
|
1967
|
+
export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAddressDetails } | { type: "receive"; contractAddress?: string } | { type: "paymentLink"; addressDetails: CrossChainAddressDetails };
|
|
1917
1968
|
|
|
1918
1969
|
export type DepositClaimError = { type: "maxDepositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; requiredFeeSats: number; requiredFeeRateSatPerVbyte: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
|
|
1919
1970
|
|
|
@@ -1931,6 +1982,10 @@ export type FeePolicy = "feesExcluded" | "feesIncluded";
|
|
|
1931
1982
|
|
|
1932
1983
|
export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & SilentPaymentAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails) | ({ type: "crossChainAddress" } & CrossChainAddressDetails);
|
|
1933
1984
|
|
|
1985
|
+
export type InstantClaimDeclineReason = { type: "noPlan" } | { type: "feeExceeded"; maxBps: number; quotedBps: number; quotedSats: number } | { type: "submissionFailed" };
|
|
1986
|
+
|
|
1987
|
+
export type InstantClaimStatus = { type: "declined"; reason: InstantClaimDeclineReason } | { type: "submitted"; claimId: string };
|
|
1988
|
+
|
|
1934
1989
|
export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
|
|
1935
1990
|
|
|
1936
1991
|
export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
|
|
@@ -1963,9 +2018,9 @@ export type PublishSignedLnurlPayResponse = { type: "swapCompleted" } | { type:
|
|
|
1963
2018
|
|
|
1964
2019
|
export type PublishSignedTransferPackageResponse = { type: "swapCompleted" } | { type: "paymentSent"; payment: Payment } | { type: "paymentsSent"; payments: Payment[] };
|
|
1965
2020
|
|
|
1966
|
-
export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
|
|
2021
|
+
export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string; receiverIdentityPublicKey?: string };
|
|
1967
2022
|
|
|
1968
|
-
export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] };
|
|
2023
|
+
export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] } | { type: "unilateralExitStateChanged" };
|
|
1969
2024
|
|
|
1970
2025
|
export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
|
|
1971
2026
|
|
|
@@ -1979,6 +2034,8 @@ export type SessionStoreError = { type: "notFound" } | ({ type: "generic" } & st
|
|
|
1979
2034
|
|
|
1980
2035
|
export type SourceAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier: string };
|
|
1981
2036
|
|
|
2037
|
+
export type SourceChain = "spark" | "lightning" | "bitcoin";
|
|
2038
|
+
|
|
1982
2039
|
export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
|
|
1983
2040
|
|
|
1984
2041
|
export type SparkMasterIdentityPublicKey = { type: "set"; publicKey: string } | { type: "unset" };
|
|
@@ -2003,7 +2060,7 @@ export type UnilateralExitTxKind = "fanOut" | "node" | "refund" | "sweep";
|
|
|
2003
2060
|
|
|
2004
2061
|
export type UnsignedTransferPackage = { type: "swap"; prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: number[]; amountSat: number; feeSat: number } | { type: "transfer"; prepareTransfer: ExternalPrepareTransferRequest; amountSat: number; feeSat: number; target: TransferTarget } | { type: "token"; prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: number[]; tokenIdentifier: string; amount: string; fee: string; isSwap: boolean } | { type: "tokenBatch"; prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: number[]; totals: BatchTotal[]; isSwap: boolean };
|
|
2005
2062
|
|
|
2006
|
-
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
|
|
2063
|
+
export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string } | { type: "instantClaim"; status: InstantClaimStatus };
|
|
2007
2064
|
|
|
2008
2065
|
export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
|
|
2009
2066
|
|
|
@@ -2048,6 +2105,7 @@ export class BreezSdk {
|
|
|
2048
2105
|
deleteContact(id: string): Promise<void>;
|
|
2049
2106
|
deleteLightningAddress(): Promise<void>;
|
|
2050
2107
|
disconnect(): Promise<void>;
|
|
2108
|
+
exportUnilateralExitState(): Promise<ExportUnilateralExitStateResponse>;
|
|
2051
2109
|
fetchConversionLimits(request: FetchConversionLimitsRequest): Promise<FetchConversionLimitsResponse>;
|
|
2052
2110
|
getCrossChainRoutes(filter: CrossChainRouteFilter): Promise<CrossChainRoutePair[]>;
|
|
2053
2111
|
getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
|
|
@@ -2056,6 +2114,7 @@ export class BreezSdk {
|
|
|
2056
2114
|
getTokenIssuer(): TokenIssuer;
|
|
2057
2115
|
getTokensMetadata(request: GetTokensMetadataRequest): Promise<GetTokensMetadataResponse>;
|
|
2058
2116
|
getUserSettings(): Promise<UserSettings>;
|
|
2117
|
+
importUnilateralExitState(request: ImportUnilateralExitStateRequest): Promise<ImportUnilateralExitStateResponse>;
|
|
2059
2118
|
listContacts(request: ListContactsRequest): Promise<Contact[]>;
|
|
2060
2119
|
listFiatCurrencies(): Promise<ListFiatCurrenciesResponse>;
|
|
2061
2120
|
listFiatRates(): Promise<ListFiatRatesResponse>;
|
|
@@ -2068,6 +2127,7 @@ export class BreezSdk {
|
|
|
2068
2127
|
optimizeLeaves(request: OptimizeLeavesRequest): Promise<OptimizeLeavesResponse>;
|
|
2069
2128
|
parse(input: string): Promise<InputType>;
|
|
2070
2129
|
prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
|
|
2130
|
+
preparePaymentLink(request: PreparePaymentLinkRequest): Promise<PreparePaymentLinkResponse>;
|
|
2071
2131
|
prepareSendBatch(request: PrepareSendBatchRequest): Promise<PrepareSendBatchResponse>;
|
|
2072
2132
|
prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
|
|
2073
2133
|
prepareUnilateralExit(request: PrepareUnilateralExitRequest): Promise<PrepareUnilateralExitResponse>;
|
|
@@ -2574,6 +2634,7 @@ export interface InitOutput {
|
|
|
2574
2634
|
readonly breezsdk_deleteContact: (a: number, b: number, c: number) => any;
|
|
2575
2635
|
readonly breezsdk_deleteLightningAddress: (a: number) => any;
|
|
2576
2636
|
readonly breezsdk_disconnect: (a: number) => any;
|
|
2637
|
+
readonly breezsdk_exportUnilateralExitState: (a: number) => any;
|
|
2577
2638
|
readonly breezsdk_fetchConversionLimits: (a: number, b: any) => any;
|
|
2578
2639
|
readonly breezsdk_getCrossChainRoutes: (a: number, b: any) => any;
|
|
2579
2640
|
readonly breezsdk_getInfo: (a: number, b: any) => any;
|
|
@@ -2582,6 +2643,7 @@ export interface InitOutput {
|
|
|
2582
2643
|
readonly breezsdk_getTokenIssuer: (a: number) => number;
|
|
2583
2644
|
readonly breezsdk_getTokensMetadata: (a: number, b: any) => any;
|
|
2584
2645
|
readonly breezsdk_getUserSettings: (a: number) => any;
|
|
2646
|
+
readonly breezsdk_importUnilateralExitState: (a: number, b: any) => any;
|
|
2585
2647
|
readonly breezsdk_listContacts: (a: number, b: any) => any;
|
|
2586
2648
|
readonly breezsdk_listFiatCurrencies: (a: number) => any;
|
|
2587
2649
|
readonly breezsdk_listFiatRates: (a: number) => any;
|
|
@@ -2594,6 +2656,7 @@ export interface InitOutput {
|
|
|
2594
2656
|
readonly breezsdk_optimizeLeaves: (a: number, b: any) => any;
|
|
2595
2657
|
readonly breezsdk_parse: (a: number, b: number, c: number) => any;
|
|
2596
2658
|
readonly breezsdk_prepareLnurlPay: (a: number, b: any) => any;
|
|
2659
|
+
readonly breezsdk_preparePaymentLink: (a: number, b: any) => any;
|
|
2597
2660
|
readonly breezsdk_prepareSendBatch: (a: number, b: any) => any;
|
|
2598
2661
|
readonly breezsdk_prepareSendPayment: (a: number, b: any) => any;
|
|
2599
2662
|
readonly breezsdk_prepareUnilateralExit: (a: number, b: any) => any;
|
|
@@ -2719,16 +2782,16 @@ export interface InitOutput {
|
|
|
2719
2782
|
readonly intounderlyingsource_pull: (a: number, b: any) => any;
|
|
2720
2783
|
readonly __wbg_externalbreezsignerhandle_free: (a: number, b: number) => void;
|
|
2721
2784
|
readonly __wbg_defaultsessionstore_free: (a: number, b: number) => void;
|
|
2722
|
-
readonly __wbg_externalsigningsignerhandle_free: (a: number, b: number) => void;
|
|
2723
2785
|
readonly __wbg_externalsparksignerhandle_free: (a: number, b: number) => void;
|
|
2786
|
+
readonly __wbg_externalsigningsignerhandle_free: (a: number, b: number) => void;
|
|
2724
2787
|
readonly __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
|
|
2725
2788
|
readonly signingonlyexternalsigners_breezSigner: (a: number) => number;
|
|
2726
2789
|
readonly signingonlyexternalsigners_sparkSigner: (a: number) => number;
|
|
2727
|
-
readonly
|
|
2728
|
-
readonly
|
|
2729
|
-
readonly
|
|
2730
|
-
readonly
|
|
2731
|
-
readonly
|
|
2790
|
+
readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522: (a: number, b: number, c: any) => [number, number];
|
|
2791
|
+
readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6: (a: number, b: number, c: any) => [number, number];
|
|
2792
|
+
readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7: (a: number, b: number, c: any) => [number, number];
|
|
2793
|
+
readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8: (a: number, b: number, c: any) => [number, number];
|
|
2794
|
+
readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9: (a: number, b: number, c: any) => [number, number];
|
|
2732
2795
|
readonly wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
|
|
2733
2796
|
readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2: (a: number, b: number, c: any) => void;
|
|
2734
2797
|
readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2: (a: number, b: number, c: any) => void;
|