@breeztech/breez-sdk-spark 0.13.10-dev → 0.13.12-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.
Files changed (49) hide show
  1. package/breez-sdk-spark.tgz +0 -0
  2. package/bundler/breez_sdk_spark_wasm.d.ts +157 -0
  3. package/bundler/breez_sdk_spark_wasm.js +1 -1
  4. package/bundler/breez_sdk_spark_wasm_bg.js +419 -41
  5. package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
  6. package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +27 -7
  7. package/deno/breez_sdk_spark_wasm.d.ts +157 -0
  8. package/deno/breez_sdk_spark_wasm.js +419 -41
  9. package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
  10. package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +27 -7
  11. package/nodejs/breez_sdk_spark_wasm.d.ts +157 -0
  12. package/nodejs/breez_sdk_spark_wasm.js +428 -41
  13. package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
  14. package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +27 -7
  15. package/nodejs/index.js +56 -0
  16. package/nodejs/index.mjs +9 -0
  17. package/nodejs/mysql-session-manager/errors.cjs +13 -0
  18. package/nodejs/mysql-session-manager/index.cjs +144 -0
  19. package/nodejs/mysql-session-manager/migrations.cjs +102 -0
  20. package/nodejs/mysql-session-manager/package.json +9 -0
  21. package/nodejs/mysql-storage/errors.cjs +19 -0
  22. package/nodejs/mysql-storage/index.cjs +1367 -0
  23. package/nodejs/mysql-storage/migrations.cjs +387 -0
  24. package/nodejs/mysql-storage/package.json +9 -0
  25. package/nodejs/mysql-token-store/errors.cjs +9 -0
  26. package/nodejs/mysql-token-store/index.cjs +980 -0
  27. package/nodejs/mysql-token-store/migrations.cjs +255 -0
  28. package/nodejs/mysql-token-store/package.json +9 -0
  29. package/nodejs/mysql-tree-store/errors.cjs +9 -0
  30. package/nodejs/mysql-tree-store/index.cjs +941 -0
  31. package/nodejs/mysql-tree-store/migrations.cjs +221 -0
  32. package/nodejs/mysql-tree-store/package.json +9 -0
  33. package/nodejs/package.json +5 -0
  34. package/nodejs/postgres-session-manager/errors.cjs +13 -0
  35. package/nodejs/postgres-session-manager/index.cjs +165 -0
  36. package/nodejs/postgres-session-manager/migrations.cjs +126 -0
  37. package/nodejs/postgres-session-manager/package.json +9 -0
  38. package/nodejs/postgres-storage/index.cjs +147 -92
  39. package/nodejs/postgres-storage/migrations.cjs +85 -4
  40. package/nodejs/postgres-token-store/index.cjs +178 -102
  41. package/nodejs/postgres-token-store/migrations.cjs +92 -3
  42. package/nodejs/postgres-tree-store/index.cjs +168 -83
  43. package/nodejs/postgres-tree-store/migrations.cjs +80 -3
  44. package/package.json +1 -1
  45. package/ssr/index.js +53 -0
  46. package/web/breez_sdk_spark_wasm.d.ts +184 -7
  47. package/web/breez_sdk_spark_wasm.js +419 -41
  48. package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
  49. package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +27 -7
@@ -22,8 +22,16 @@ class TreeStoreMigrationManager {
22
22
  /**
23
23
  * Run all pending migrations inside a single transaction with an advisory lock.
24
24
  * @param {import('pg').Pool} pool
25
+ * @param {Buffer|Uint8Array} identity - 33-byte secp256k1 compressed pubkey
26
+ * identifying the tenant. Used to backfill `user_id` columns in the
27
+ * multi-tenant scoping migration. Required.
25
28
  */
26
- async migrate(pool) {
29
+ async migrate(pool, identity) {
30
+ if (!identity || identity.length !== 33) {
31
+ throw new TreeStoreError(
32
+ "tenant identity (33-byte secp256k1 pubkey) is required"
33
+ );
34
+ }
27
35
  const client = await pool.connect();
28
36
  try {
29
37
  await client.query("BEGIN");
@@ -45,7 +53,7 @@ class TreeStoreMigrationManager {
45
53
  );
46
54
  const currentVersion = versionResult.rows[0].version;
47
55
 
48
- const migrations = this._getMigrations();
56
+ const migrations = this._getMigrations(identity);
49
57
 
50
58
  if (currentVersion >= migrations.length) {
51
59
  this._log("info", `Tree store database is up to date (version ${currentVersion})`);
@@ -96,8 +104,16 @@ class TreeStoreMigrationManager {
96
104
 
97
105
  /**
98
106
  * Migrations matching the Rust PostgresTreeStore schema exactly.
107
+ *
108
+ * @param {Buffer|Uint8Array} identity - tenant identity inlined as a hex
109
+ * BYTEA literal in the multi-tenant scoping migration. Safe because the
110
+ * bytes come from a typed secp256k1 pubkey (`[0-9a-f]{66}` after hex
111
+ * encoding) — not user-controlled input.
99
112
  */
100
- _getMigrations() {
113
+ _getMigrations(identity) {
114
+ const idHex = Buffer.from(identity).toString("hex");
115
+ const idLit = `'\\x${idHex}'::bytea`;
116
+
101
117
  return [
102
118
  {
103
119
  name: "Create tree store tables",
@@ -143,6 +159,67 @@ class TreeStoreMigrationManager {
143
159
  `INSERT INTO tree_swap_status (id) VALUES (1) ON CONFLICT DO NOTHING`,
144
160
  ],
145
161
  },
162
+ {
163
+ // Mirrors Rust migration 3 in spark-postgres/src/tree_store.rs.
164
+ // Adds user_id to every tree-store table, backfills with the connecting
165
+ // tenant's identity, and rewrites primary keys / FKs / indexes to lead
166
+ // with user_id. The composite FK uses NO ACTION (the default) instead
167
+ // of the previous single-column ON DELETE SET NULL — PG-only column-list
168
+ // SET NULL is PG15+, and a whole-row SET NULL would null user_id (NOT
169
+ // NULL). cleanupStaleReservations now releases leaves explicitly.
170
+ name: "Multi-tenant scoping: add user_id and rewrite primary keys",
171
+ sql: [
172
+ // Drop the old single-column FK FIRST, before touching the
173
+ // tree_reservations PK it depends on.
174
+ `ALTER TABLE tree_leaves
175
+ DROP CONSTRAINT IF EXISTS tree_leaves_reservation_id_fkey`,
176
+
177
+ // tree_reservations: scope by user_id.
178
+ `ALTER TABLE tree_reservations ADD COLUMN user_id BYTEA`,
179
+ `UPDATE tree_reservations SET user_id = ${idLit}`,
180
+ `ALTER TABLE tree_reservations
181
+ ALTER COLUMN user_id SET NOT NULL,
182
+ DROP CONSTRAINT IF EXISTS tree_reservations_pkey,
183
+ ADD PRIMARY KEY (user_id, id)`,
184
+
185
+ // tree_leaves: add user_id, rekey, and re-add the composite FK.
186
+ `ALTER TABLE tree_leaves ADD COLUMN user_id BYTEA`,
187
+ `UPDATE tree_leaves SET user_id = ${idLit}`,
188
+ `ALTER TABLE tree_leaves
189
+ ALTER COLUMN user_id SET NOT NULL,
190
+ DROP CONSTRAINT IF EXISTS tree_leaves_pkey,
191
+ ADD PRIMARY KEY (user_id, id),
192
+ ADD FOREIGN KEY (user_id, reservation_id)
193
+ REFERENCES tree_reservations(user_id, id)`,
194
+ `DROP INDEX IF EXISTS idx_tree_leaves_available`,
195
+ `DROP INDEX IF EXISTS idx_tree_leaves_reservation`,
196
+ `DROP INDEX IF EXISTS idx_tree_leaves_added_at`,
197
+ `CREATE INDEX idx_tree_leaves_user_available
198
+ ON tree_leaves(user_id, status, is_missing_from_operators)
199
+ WHERE status = 'Available' AND is_missing_from_operators = FALSE`,
200
+ `CREATE INDEX idx_tree_leaves_user_reservation
201
+ ON tree_leaves(user_id, reservation_id)
202
+ WHERE reservation_id IS NOT NULL`,
203
+ `CREATE INDEX idx_tree_leaves_user_added_at ON tree_leaves(user_id, added_at)`,
204
+
205
+ // tree_spent_leaves: scope by user_id.
206
+ `ALTER TABLE tree_spent_leaves ADD COLUMN user_id BYTEA`,
207
+ `UPDATE tree_spent_leaves SET user_id = ${idLit}`,
208
+ `ALTER TABLE tree_spent_leaves
209
+ ALTER COLUMN user_id SET NOT NULL,
210
+ DROP CONSTRAINT IF EXISTS tree_spent_leaves_pkey,
211
+ ADD PRIMARY KEY (user_id, leaf_id)`,
212
+
213
+ // tree_swap_status was a singleton (PK id=1, CHECK id=1). Drop the id
214
+ // column (CASCADE removes both PK and CHECK), then re-key by user_id.
215
+ `ALTER TABLE tree_swap_status DROP COLUMN id CASCADE`,
216
+ `ALTER TABLE tree_swap_status ADD COLUMN user_id BYTEA`,
217
+ `UPDATE tree_swap_status SET user_id = ${idLit}`,
218
+ `ALTER TABLE tree_swap_status
219
+ ALTER COLUMN user_id SET NOT NULL,
220
+ ADD PRIMARY KEY (user_id)`,
221
+ ],
222
+ },
146
223
  ];
147
224
  }
148
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark",
3
- "version": "0.13.10-dev",
3
+ "version": "0.13.12-dev1",
4
4
  "description": "Breez Spark SDK",
5
5
  "repository": "https://github.com/breez/spark-sdk",
6
6
  "author": "Breez <contact@breez.technology> (https://github.com/breez)",
package/ssr/index.js CHANGED
@@ -33,6 +33,16 @@ export function connectWithSigner(...args) {
33
33
  return _module.connectWithSigner(...args);
34
34
  }
35
35
 
36
+ export function createMysqlConnectionPool(...args) {
37
+ if (!_module) _notInitialized('createMysqlConnectionPool');
38
+ return _module.createMysqlConnectionPool(...args);
39
+ }
40
+
41
+ export function createPostgresConnectionPool(...args) {
42
+ if (!_module) _notInitialized('createPostgresConnectionPool');
43
+ return _module.createPostgresConnectionPool(...args);
44
+ }
45
+
36
46
  export function defaultConfig(...args) {
37
47
  if (!_module) _notInitialized('defaultConfig');
38
48
  return _module.defaultConfig(...args);
@@ -43,6 +53,11 @@ export function defaultExternalSigner(...args) {
43
53
  return _module.defaultExternalSigner(...args);
44
54
  }
45
55
 
56
+ export function defaultMysqlStorageConfig(...args) {
57
+ if (!_module) _notInitialized('defaultMysqlStorageConfig');
58
+ return _module.defaultMysqlStorageConfig(...args);
59
+ }
60
+
46
61
  export function defaultPostgresStorageConfig(...args) {
47
62
  if (!_module) _notInitialized('defaultPostgresStorageConfig');
48
63
  return _module.defaultPostgresStorageConfig(...args);
@@ -58,6 +73,16 @@ export function initLogging(...args) {
58
73
  return _module.initLogging(...args);
59
74
  }
60
75
 
76
+ export function newRestChainService(...args) {
77
+ if (!_module) _notInitialized('newRestChainService');
78
+ return _module.newRestChainService(...args);
79
+ }
80
+
81
+ export function newSspConnectionManager(...args) {
82
+ if (!_module) _notInitialized('newSspConnectionManager');
83
+ return _module.newSspConnectionManager(...args);
84
+ }
85
+
61
86
  export function task_worker_entry_point(...args) {
62
87
  if (!_module) _notInitialized('task_worker_entry_point');
63
88
  return _module.task_worker_entry_point(...args);
@@ -68,6 +93,13 @@ export function initSync(...args) {
68
93
  return _module.initSync(...args);
69
94
  }
70
95
 
96
+ export class BitcoinChainServiceHandle {
97
+ constructor(...args) {
98
+ if (!_module) _notInitialized('new BitcoinChainServiceHandle');
99
+ return new _module.BitcoinChainServiceHandle(...args);
100
+ }
101
+ }
102
+
71
103
  export class BreezSdk {
72
104
  constructor(...args) {
73
105
  if (!_module) _notInitialized('new BreezSdk');
@@ -103,6 +135,13 @@ export class IntoUnderlyingSource {
103
135
  }
104
136
  }
105
137
 
138
+ export class MysqlConnectionPool {
139
+ constructor(...args) {
140
+ if (!_module) _notInitialized('new MysqlConnectionPool');
141
+ return new _module.MysqlConnectionPool(...args);
142
+ }
143
+ }
144
+
106
145
  export class Passkey {
107
146
  constructor(...args) {
108
147
  if (!_module) _notInitialized('new Passkey');
@@ -110,6 +149,13 @@ export class Passkey {
110
149
  }
111
150
  }
112
151
 
152
+ export class PostgresConnectionPool {
153
+ constructor(...args) {
154
+ if (!_module) _notInitialized('new PostgresConnectionPool');
155
+ return new _module.PostgresConnectionPool(...args);
156
+ }
157
+ }
158
+
113
159
  export class SdkBuilder {
114
160
  constructor(...args) {
115
161
  if (!_module) _notInitialized('new SdkBuilder');
@@ -117,6 +163,13 @@ export class SdkBuilder {
117
163
  }
118
164
  }
119
165
 
166
+ export class SspConnectionManager {
167
+ constructor(...args) {
168
+ if (!_module) _notInitialized('new SspConnectionManager');
169
+ return new _module.SspConnectionManager(...args);
170
+ }
171
+ }
172
+
120
173
  export class TokenIssuer {
121
174
  constructor(...args) {
122
175
  if (!_module) _notInitialized('new TokenIssuer');
@@ -142,6 +142,28 @@ export interface Wallet {
142
142
  label: string;
143
143
  }
144
144
 
145
+ /**
146
+ * Configuration for MySQL storage connection pool. Targets MySQL 8.0+.
147
+ */
148
+ export interface MysqlStorageConfig {
149
+ /**
150
+ * MySQL connection URL (e.g. `mysql://user:pass@host:3306/dbname`).
151
+ */
152
+ connectionString: string;
153
+ /**
154
+ * Maximum number of connections in the pool.
155
+ */
156
+ maxPoolSize: number;
157
+ /**
158
+ * Timeout in seconds for establishing a new connection (0 = no timeout).
159
+ */
160
+ createTimeoutSecs: number;
161
+ /**
162
+ * Timeout in seconds before recycling an idle connection.
163
+ */
164
+ recycleTimeoutSecs: number;
165
+ }
166
+
145
167
  /**
146
168
  * Configuration for PostgreSQL storage connection pool.
147
169
  */
@@ -1046,6 +1068,16 @@ export interface SendPaymentResponse {
1046
1068
  payment: Payment;
1047
1069
  }
1048
1070
 
1071
+ export interface Session {
1072
+ token: string;
1073
+ expiration: number;
1074
+ }
1075
+
1076
+ export interface SessionManager {
1077
+ getSession: (serviceIdentityKey: string) => Promise<Session>;
1078
+ setSession: (serviceIdentityKey: string, session: Session) => Promise<void>;
1079
+ }
1080
+
1049
1081
  export interface SetLnurlMetadataItem {
1050
1082
  paymentHash: string;
1051
1083
  senderComment?: string;
@@ -1339,6 +1371,8 @@ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: On
1339
1371
 
1340
1372
  export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
1341
1373
 
1374
+ export type SessionManagerError = { type: "notFound" } | ({ type: "generic" } & string);
1375
+
1342
1376
  export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
1343
1377
 
1344
1378
  export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
@@ -1356,6 +1390,25 @@ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimErro
1356
1390
  export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
1357
1391
 
1358
1392
 
1393
+ /**
1394
+ * Rust-built implementation of the JS `BitcoinChainService` interface.
1395
+ *
1396
+ * Returned by factories like [`new_rest_chain_service`]; users see it as a
1397
+ * `BitcoinChainService` and pass it to `withChainService`. Pass the same
1398
+ * instance to multiple `SdkBuilder`s to share a single underlying HTTP
1399
+ * client (and its connection pool) across SDK instances.
1400
+ */
1401
+ export class BitcoinChainServiceHandle {
1402
+ private constructor();
1403
+ free(): void;
1404
+ [Symbol.dispose](): void;
1405
+ broadcastTransaction(tx: string): Promise<void>;
1406
+ getAddressUtxos(address: string): Promise<any>;
1407
+ getTransactionHex(txid: string): Promise<any>;
1408
+ getTransactionStatus(txid: string): Promise<any>;
1409
+ recommendedFees(): Promise<any>;
1410
+ }
1411
+
1359
1412
  export class BreezSdk {
1360
1413
  private constructor();
1361
1414
  free(): void;
@@ -1464,6 +1517,16 @@ export class IntoUnderlyingSource {
1464
1517
  pull(controller: ReadableStreamDefaultController): Promise<any>;
1465
1518
  }
1466
1519
 
1520
+ /**
1521
+ * A shareable MySQL connection pool. See [`PostgresConnectionPool`](super::postgres_pool::PostgresConnectionPool)
1522
+ * for sharing semantics and lifecycle.
1523
+ */
1524
+ export class MysqlConnectionPool {
1525
+ private constructor();
1526
+ free(): void;
1527
+ [Symbol.dispose](): void;
1528
+ }
1529
+
1467
1530
  /**
1468
1531
  * Passkey-based wallet operations using WebAuthn PRF extension.
1469
1532
  *
@@ -1507,6 +1570,22 @@ export class Passkey {
1507
1570
  storeLabel(label: string): Promise<void>;
1508
1571
  }
1509
1572
 
1573
+ /**
1574
+ * A shareable Postgres connection pool.
1575
+ *
1576
+ * Construct via [`create_postgres_connection_pool`] and pass the same handle to multiple
1577
+ * `SdkBuilder`s via `withPostgresConnectionPool` to share connections across SDKs.
1578
+ * Per-tenant scoping is derived from each SDK's seed.
1579
+ *
1580
+ * The pool's lifecycle is controlled by the integrator: it stays alive as
1581
+ * long as any reference is held. `disconnect()` does **not** close the pool.
1582
+ */
1583
+ export class PostgresConnectionPool {
1584
+ private constructor();
1585
+ free(): void;
1586
+ [Symbol.dispose](): void;
1587
+ }
1588
+
1510
1589
  export class SdkBuilder {
1511
1590
  private constructor();
1512
1591
  free(): void;
@@ -1519,12 +1598,57 @@ export class SdkBuilder {
1519
1598
  withFiatService(fiat_service: FiatService): SdkBuilder;
1520
1599
  withKeySet(config: KeySetConfig): SdkBuilder;
1521
1600
  withLnurlClient(lnurl_client: RestClient): SdkBuilder;
1601
+ /**
1602
+ * **Deprecated.** Call `withMysqlConnectionPool(config)` and `withMysqlConnectionPool(pool)` instead.
1603
+ */
1604
+ withMysqlBackend(config: MysqlStorageConfig): SdkBuilder;
1605
+ /**
1606
+ * Sets a shared `MySQL` connection pool as the backend for all stores.
1607
+ * Construct via `createMysqlConnectionPool` and pass the same handle to multiple
1608
+ * `SdkBuilder`s to share connections across SDKs.
1609
+ */
1610
+ withMysqlConnectionPool(pool: MysqlConnectionPool): SdkBuilder;
1522
1611
  withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
1612
+ /**
1613
+ * **Deprecated.** Call `withPostgresConnectionPool(config)` and `withPostgresConnectionPool(pool)` instead.
1614
+ */
1523
1615
  withPostgresBackend(config: PostgresStorageConfig): SdkBuilder;
1616
+ /**
1617
+ * Sets a shared `PostgreSQL` connection pool as the backend for all
1618
+ * stores. Construct via `createPostgresConnectionPool` and pass the same handle
1619
+ * to multiple `SdkBuilder`s to share connections across SDKs.
1620
+ */
1621
+ withPostgresConnectionPool(pool: PostgresConnectionPool): SdkBuilder;
1524
1622
  withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
1623
+ /**
1624
+ * Sets a custom session manager used to persist authentication sessions.
1625
+ *
1626
+ * Provide a shared, persistent implementation (e.g. backed by `PostgreSQL`
1627
+ * or Redis) to let multiple SDK instances share authentication state and
1628
+ * bootstrap quickly. If not set, an in-memory session manager is used.
1629
+ */
1630
+ withSessionManager(session_manager: SessionManager): SdkBuilder;
1631
+ /**
1632
+ * Reuses a shared SSP connection across SDK instances. Pass the same
1633
+ * manager to every `SdkBuilder` whose SSP traffic should share an
1634
+ * underlying HTTP client.
1635
+ */
1636
+ withSspConnectionManager(manager: SspConnectionManager): SdkBuilder;
1525
1637
  withStorage(storage: Storage): SdkBuilder;
1526
1638
  }
1527
1639
 
1640
+ /**
1641
+ * Shared transport for SSP GraphQL traffic across SDK instances.
1642
+ *
1643
+ * All SDK instances built with the same `SspConnectionManager` share a single
1644
+ * underlying HTTP client (and its h2 connection pool) for SSP requests.
1645
+ */
1646
+ export class SspConnectionManager {
1647
+ private constructor();
1648
+ free(): void;
1649
+ [Symbol.dispose](): void;
1650
+ }
1651
+
1528
1652
  export class TokenIssuer {
1529
1653
  private constructor();
1530
1654
  free(): void;
@@ -1542,10 +1666,30 @@ export function connect(request: ConnectRequest): Promise<BreezSdk>;
1542
1666
 
1543
1667
  export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
1544
1668
 
1669
+ /**
1670
+ * Creates a shareable MySQL connection pool from the given config.
1671
+ */
1672
+ export function createMysqlConnectionPool(config: MysqlStorageConfig): MysqlConnectionPool;
1673
+
1674
+ /**
1675
+ * Creates a shareable Postgres connection pool from the given config.
1676
+ */
1677
+ export function createPostgresConnectionPool(config: PostgresStorageConfig): PostgresConnectionPool;
1678
+
1545
1679
  export function defaultConfig(network: Network): Config;
1546
1680
 
1547
1681
  export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
1548
1682
 
1683
+ /**
1684
+ * Creates a default MySQL storage configuration with sensible defaults.
1685
+ *
1686
+ * Default values:
1687
+ * - `maxPoolSize`: 10
1688
+ * - `createTimeoutSecs`: 0 (no timeout)
1689
+ * - `recycleTimeoutSecs`: 10
1690
+ */
1691
+ export function defaultMysqlStorageConfig(connection_string: string): MysqlStorageConfig;
1692
+
1549
1693
  /**
1550
1694
  * Creates a default PostgreSQL storage configuration with sensible defaults.
1551
1695
  *
@@ -1565,6 +1709,19 @@ export function getSparkStatus(): Promise<SparkStatus>;
1565
1709
 
1566
1710
  export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
1567
1711
 
1712
+ /**
1713
+ * Constructs a shareable REST-based Bitcoin chain service.
1714
+ *
1715
+ * Pass the returned chain service to multiple `SdkBuilder`s via
1716
+ * `withChainService` to reuse one HTTP client across SDK instances. All
1717
+ * SDKs sharing the chain service must use the same `network`.
1718
+ *
1719
+ * For one-off, non-shared use, prefer `withRestChainService`.
1720
+ */
1721
+ export function newRestChainService(url: string, network: Network, api_type: ChainApiType, credentials?: Credentials | null): BitcoinChainService;
1722
+
1723
+ export function newSspConnectionManager(user_agent?: string | null): SspConnectionManager;
1724
+
1568
1725
  /**
1569
1726
  * Entry point invoked by JavaScript in a worker.
1570
1727
  */
@@ -1574,11 +1731,19 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
1574
1731
 
1575
1732
  export interface InitOutput {
1576
1733
  readonly memory: WebAssembly.Memory;
1734
+ readonly __wbg_bitcoinchainservicehandle_free: (a: number, b: number) => void;
1577
1735
  readonly __wbg_breezsdk_free: (a: number, b: number) => void;
1578
1736
  readonly __wbg_defaultsigner_free: (a: number, b: number) => void;
1737
+ readonly __wbg_mysqlconnectionpool_free: (a: number, b: number) => void;
1579
1738
  readonly __wbg_passkey_free: (a: number, b: number) => void;
1580
1739
  readonly __wbg_sdkbuilder_free: (a: number, b: number) => void;
1740
+ readonly __wbg_sspconnectionmanager_free: (a: number, b: number) => void;
1581
1741
  readonly __wbg_tokenissuer_free: (a: number, b: number) => void;
1742
+ readonly bitcoinchainservicehandle_broadcastTransaction: (a: number, b: number, c: number) => any;
1743
+ readonly bitcoinchainservicehandle_getAddressUtxos: (a: number, b: number, c: number) => any;
1744
+ readonly bitcoinchainservicehandle_getTransactionHex: (a: number, b: number, c: number) => any;
1745
+ readonly bitcoinchainservicehandle_getTransactionStatus: (a: number, b: number, c: number) => any;
1746
+ readonly bitcoinchainservicehandle_recommendedFees: (a: number) => any;
1582
1747
  readonly breezsdk_addContact: (a: number, b: any) => any;
1583
1748
  readonly breezsdk_addEventListener: (a: number, b: any) => any;
1584
1749
  readonly breezsdk_buyBitcoin: (a: number, b: any) => any;
@@ -1625,9 +1790,11 @@ export interface InitOutput {
1625
1790
  readonly breezsdk_updateUserSettings: (a: number, b: any) => any;
1626
1791
  readonly connect: (a: any) => any;
1627
1792
  readonly connectWithSigner: (a: any, b: any, c: number, d: number) => any;
1793
+ readonly createMysqlConnectionPool: (a: any) => [number, number, number];
1794
+ readonly createPostgresConnectionPool: (a: any) => [number, number, number];
1628
1795
  readonly defaultConfig: (a: any) => any;
1629
1796
  readonly defaultExternalSigner: (a: number, b: number, c: number, d: number, e: any, f: number) => [number, number, number];
1630
- readonly defaultPostgresStorageConfig: (a: number, b: number) => any;
1797
+ readonly defaultMysqlStorageConfig: (a: number, b: number) => any;
1631
1798
  readonly defaultsigner_aggregateFrost: (a: number, b: any) => any;
1632
1799
  readonly defaultsigner_decryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
1633
1800
  readonly defaultsigner_derivePublicKey: (a: number, b: number, c: number) => any;
@@ -1650,6 +1817,8 @@ export interface InitOutput {
1650
1817
  readonly defaultsigner_subtractSecrets: (a: number, b: any, c: any) => any;
1651
1818
  readonly getSparkStatus: () => any;
1652
1819
  readonly initLogging: (a: any, b: number, c: number) => any;
1820
+ readonly newRestChainService: (a: number, b: number, c: any, d: any, e: number) => number;
1821
+ readonly newSspConnectionManager: (a: number, b: number) => number;
1653
1822
  readonly passkey_getWallet: (a: number, b: number, c: number) => any;
1654
1823
  readonly passkey_isAvailable: (a: number) => any;
1655
1824
  readonly passkey_listLabels: (a: number) => any;
@@ -1663,9 +1832,14 @@ export interface InitOutput {
1663
1832
  readonly sdkbuilder_withFiatService: (a: number, b: any) => number;
1664
1833
  readonly sdkbuilder_withKeySet: (a: number, b: any) => number;
1665
1834
  readonly sdkbuilder_withLnurlClient: (a: number, b: any) => number;
1835
+ readonly sdkbuilder_withMysqlBackend: (a: number, b: any) => [number, number, number];
1836
+ readonly sdkbuilder_withMysqlConnectionPool: (a: number, b: number) => number;
1666
1837
  readonly sdkbuilder_withPaymentObserver: (a: number, b: any) => number;
1667
- readonly sdkbuilder_withPostgresBackend: (a: number, b: any) => number;
1838
+ readonly sdkbuilder_withPostgresBackend: (a: number, b: any) => [number, number, number];
1839
+ readonly sdkbuilder_withPostgresConnectionPool: (a: number, b: number) => number;
1668
1840
  readonly sdkbuilder_withRestChainService: (a: number, b: number, c: number, d: any, e: number) => number;
1841
+ readonly sdkbuilder_withSessionManager: (a: number, b: any) => number;
1842
+ readonly sdkbuilder_withSspConnectionManager: (a: number, b: number) => number;
1669
1843
  readonly sdkbuilder_withStorage: (a: number, b: any) => number;
1670
1844
  readonly tokenissuer_burnIssuerToken: (a: number, b: any) => any;
1671
1845
  readonly tokenissuer_createIssuerToken: (a: number, b: any) => any;
@@ -1692,15 +1866,18 @@ export interface InitOutput {
1692
1866
  readonly intounderlyingsink_write: (a: number, b: any) => any;
1693
1867
  readonly intounderlyingsource_cancel: (a: number) => void;
1694
1868
  readonly intounderlyingsource_pull: (a: number, b: any) => any;
1695
- readonly wasm_bindgen__convert__closures_____invoke__h4fc1641481bc1d84: (a: number, b: number, c: any) => [number, number];
1696
- readonly wasm_bindgen__convert__closures_____invoke__h4fc1641481bc1d84_4: (a: number, b: number, c: any) => [number, number];
1697
- readonly wasm_bindgen__convert__closures_____invoke__h4fc1641481bc1d84_5: (a: number, b: number, c: any) => [number, number];
1698
- readonly wasm_bindgen__convert__closures_____invoke__h4fc1641481bc1d84_6: (a: number, b: number, c: any) => [number, number];
1869
+ readonly __wbg_postgresconnectionpool_free: (a: number, b: number) => void;
1870
+ readonly defaultPostgresStorageConfig: (a: number, b: number) => any;
1871
+ readonly wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c: (a: number, b: number, c: any) => [number, number];
1872
+ readonly wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c_4: (a: number, b: number, c: any) => [number, number];
1873
+ readonly wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c_5: (a: number, b: number, c: any) => [number, number];
1874
+ readonly wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c_6: (a: number, b: number, c: any) => [number, number];
1875
+ readonly wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c_7: (a: number, b: number, c: any) => [number, number];
1699
1876
  readonly wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
1700
1877
  readonly wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57: (a: number, b: number, c: any) => void;
1701
1878
  readonly wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_2: (a: number, b: number, c: any) => void;
1702
1879
  readonly wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_3: (a: number, b: number, c: any) => void;
1703
- readonly wasm_bindgen__convert__closures_____invoke__h484cd36e13f37bd7: (a: number, b: number) => void;
1880
+ readonly wasm_bindgen__convert__closures_____invoke__h124479769cd429fd: (a: number, b: number) => void;
1704
1881
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1705
1882
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1706
1883
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;