@breeztech/breez-sdk-spark 0.14.0 → 0.15.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 +114 -40
- package/bundler/breez_sdk_spark_wasm.js +1 -1
- package/bundler/breez_sdk_spark_wasm_bg.js +118 -104
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
- package/deno/breez_sdk_spark_wasm.d.ts +114 -40
- package/deno/breez_sdk_spark_wasm.js +118 -104
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
- package/nodejs/breez_sdk_spark_wasm.d.ts +114 -40
- package/nodejs/breez_sdk_spark_wasm.js +121 -106
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
- package/nodejs/index.mjs +3 -2
- package/nodejs/mysql-session-manager/index.cjs +26 -8
- package/nodejs/mysql-session-manager/migrations.cjs +40 -3
- package/nodejs/mysql-storage/index.cjs +67 -48
- package/nodejs/mysql-storage/migrations.cjs +220 -85
- package/nodejs/mysql-token-store/index.cjs +133 -68
- package/nodejs/mysql-token-store/migrations.cjs +309 -80
- package/nodejs/mysql-tree-store/index.cjs +76 -41
- package/nodejs/mysql-tree-store/migrations.cjs +254 -71
- package/nodejs/postgres-session-manager/index.cjs +27 -9
- package/nodejs/postgres-session-manager/migrations.cjs +45 -6
- package/nodejs/postgres-storage/index.cjs +81 -62
- package/nodejs/postgres-storage/migrations.cjs +207 -79
- package/nodejs/postgres-token-store/index.cjs +111 -67
- package/nodejs/postgres-token-store/migrations.cjs +153 -61
- package/nodejs/postgres-tree-store/index.cjs +60 -42
- package/nodejs/postgres-tree-store/migrations.cjs +130 -46
- package/package.json +1 -1
- package/ssr/index.js +14 -9
- package/web/breez_sdk_spark_wasm.d.ts +126 -51
- package/web/breez_sdk_spark_wasm.js +118 -104
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
package/breez-sdk-spark.tgz
CHANGED
|
Binary file
|
|
@@ -115,7 +115,7 @@ export interface TokenStore {
|
|
|
115
115
|
listTokensOutputs: () => Promise<WasmTokenOutputsPerStatus[]>;
|
|
116
116
|
getTokenBalances: () => Promise<WasmTokenBalance[]>;
|
|
117
117
|
getTokenOutputs: (filter: WasmGetTokenOutputsFilter) => Promise<WasmTokenOutputsPerStatus>;
|
|
118
|
-
|
|
118
|
+
updateTokenOutputs: (outputsToRemove: [string, number][], outputsToAdd: WasmTokenOutputs | null) => Promise<void>;
|
|
119
119
|
reserveTokenOutputs: (
|
|
120
120
|
tokenIdentifier: string,
|
|
121
121
|
target: WasmReservationTarget,
|
|
@@ -162,6 +162,20 @@ export interface MysqlStorageConfig {
|
|
|
162
162
|
* Timeout in seconds before recycling an idle connection.
|
|
163
163
|
*/
|
|
164
164
|
recycleTimeoutSecs: number;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the SDK should run schema migrations on startup. Set to
|
|
167
|
+
* `false` when the embedding service owns and migrates the database
|
|
168
|
+
* schema. Defaults to `true`.
|
|
169
|
+
*/
|
|
170
|
+
runMigration?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Whether migrations should create database-enforced foreign keys.
|
|
173
|
+
*
|
|
174
|
+
* Use `Disabled` for environments that manage relationships in
|
|
175
|
+
* application code and require schema changes without foreign-key
|
|
176
|
+
* constraints.
|
|
177
|
+
*/
|
|
178
|
+
foreignKeyMode?: MysqlForeignKeyMode;
|
|
165
179
|
}
|
|
166
180
|
|
|
167
181
|
/**
|
|
@@ -184,8 +198,19 @@ export interface PostgresStorageConfig {
|
|
|
184
198
|
* Timeout in seconds before recycling an idle connection.
|
|
185
199
|
*/
|
|
186
200
|
recycleTimeoutSecs: number;
|
|
201
|
+
/**
|
|
202
|
+
* Whether the SDK should run schema migrations on startup. Set to
|
|
203
|
+
* `false` when the embedding service owns and migrates the database
|
|
204
|
+
* schema. Defaults to `true`.
|
|
205
|
+
*/
|
|
206
|
+
runMigration?: boolean;
|
|
187
207
|
}
|
|
188
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Controls whether MySQL migrations create database-enforced foreign keys.
|
|
211
|
+
*/
|
|
212
|
+
export type MysqlForeignKeyMode = "Enforced" | "Disabled";
|
|
213
|
+
|
|
189
214
|
/**
|
|
190
215
|
* Interface for passkey PRF (Pseudo-Random Function) operations.
|
|
191
216
|
*
|
|
@@ -255,6 +280,40 @@ export interface NostrRelayConfig {
|
|
|
255
280
|
timeoutSecs?: number;
|
|
256
281
|
}
|
|
257
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Settings for `newSharedSdkContext`. `network` is required; all other
|
|
285
|
+
* fields are optional.
|
|
286
|
+
*/
|
|
287
|
+
export interface WasmSdkContextConfig {
|
|
288
|
+
/**
|
|
289
|
+
* Network the shared resources target. Used to gate the partner JWT
|
|
290
|
+
* header provider — only constructed on Mainnet.
|
|
291
|
+
*/
|
|
292
|
+
network: Network;
|
|
293
|
+
/**
|
|
294
|
+
* Breez API key. When set together with `network == Mainnet`, the
|
|
295
|
+
* context constructs a shared partner JWT header provider that all
|
|
296
|
+
* SDKs built from this context will attach to their SO requests.
|
|
297
|
+
*/
|
|
298
|
+
apiKey?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Number of gRPC connections per Spark operator. `None` (or `Some(1)`)
|
|
301
|
+
* keeps a single connection per operator (right for most deployments);
|
|
302
|
+
* `Some(n)` opens `n` channels per operator and balances requests.
|
|
303
|
+
*/
|
|
304
|
+
connectionsPerOperator?: number;
|
|
305
|
+
/**
|
|
306
|
+
* PostgreSQL backend configuration. When set, SDKs constructed with
|
|
307
|
+
* this context store their data in PostgreSQL via the shared pool.
|
|
308
|
+
*/
|
|
309
|
+
postgresConfig?: PostgresStorageConfig;
|
|
310
|
+
/**
|
|
311
|
+
* MySQL backend configuration. When set, SDKs constructed with this
|
|
312
|
+
* context store their data in MySQL via the shared pool.
|
|
313
|
+
*/
|
|
314
|
+
mysqlConfig?: MysqlStorageConfig;
|
|
315
|
+
}
|
|
316
|
+
|
|
258
317
|
export interface AddContactRequest {
|
|
259
318
|
name: string;
|
|
260
319
|
paymentIdentifier: string;
|
|
@@ -417,7 +476,8 @@ export interface Config {
|
|
|
417
476
|
useDefaultExternalInputParsers: boolean;
|
|
418
477
|
realTimeSyncServerUrl?: string;
|
|
419
478
|
privateEnabledDefault: boolean;
|
|
420
|
-
|
|
479
|
+
leafOptimizationConfig: LeafOptimizationConfig;
|
|
480
|
+
tokenOptimizationConfig: TokenOptimizationConfig;
|
|
421
481
|
stableBalanceConfig?: StableBalanceConfig;
|
|
422
482
|
/**
|
|
423
483
|
* Maximum number of concurrent transfer claims.
|
|
@@ -428,6 +488,7 @@ export interface Config {
|
|
|
428
488
|
*/
|
|
429
489
|
maxConcurrentClaims: number;
|
|
430
490
|
sparkConfig?: SparkConfig;
|
|
491
|
+
backgroundTasksEnabled: boolean;
|
|
431
492
|
}
|
|
432
493
|
|
|
433
494
|
export interface ConnectRequest {
|
|
@@ -705,6 +766,11 @@ export interface KeySetConfig {
|
|
|
705
766
|
accountNumber?: number;
|
|
706
767
|
}
|
|
707
768
|
|
|
769
|
+
export interface LeafOptimizationConfig {
|
|
770
|
+
autoEnabled: boolean;
|
|
771
|
+
multiplicity: number;
|
|
772
|
+
}
|
|
773
|
+
|
|
708
774
|
export interface LightningAddressDetails {
|
|
709
775
|
address: string;
|
|
710
776
|
payRequest: LnurlPayRequestDetails;
|
|
@@ -861,11 +927,6 @@ export interface MintIssuerTokenRequest {
|
|
|
861
927
|
amount: bigint;
|
|
862
928
|
}
|
|
863
929
|
|
|
864
|
-
export interface OptimizationConfig {
|
|
865
|
-
autoEnabled: boolean;
|
|
866
|
-
multiplicity: number;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
930
|
export interface OptimizationProgress {
|
|
870
931
|
isRunning: boolean;
|
|
871
932
|
currentRound: number;
|
|
@@ -1243,6 +1304,12 @@ export interface TokenMetadata {
|
|
|
1243
1304
|
isFreezable: boolean;
|
|
1244
1305
|
}
|
|
1245
1306
|
|
|
1307
|
+
export interface TokenOptimizationConfig {
|
|
1308
|
+
autoEnabled: boolean;
|
|
1309
|
+
targetOutputCount: number;
|
|
1310
|
+
minOutputsThreshold: number;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1246
1313
|
export interface TxStatus {
|
|
1247
1314
|
confirmed: boolean;
|
|
1248
1315
|
blockHeight?: number;
|
|
@@ -1447,6 +1514,7 @@ export class BreezSdk {
|
|
|
1447
1514
|
receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
|
|
1448
1515
|
recommendedFees(): Promise<RecommendedFees>;
|
|
1449
1516
|
refundDeposit(request: RefundDepositRequest): Promise<RefundDepositResponse>;
|
|
1517
|
+
refundPendingConversions(): Promise<void>;
|
|
1450
1518
|
registerLightningAddress(request: RegisterLightningAddressRequest): Promise<LightningAddressInfo>;
|
|
1451
1519
|
registerWebhook(request: RegisterWebhookRequest): Promise<RegisterWebhookResponse>;
|
|
1452
1520
|
removeEventListener(id: string): Promise<boolean>;
|
|
@@ -1518,7 +1586,8 @@ export class IntoUnderlyingSource {
|
|
|
1518
1586
|
}
|
|
1519
1587
|
|
|
1520
1588
|
/**
|
|
1521
|
-
* A shareable MySQL connection pool. See
|
|
1589
|
+
* A shareable `MySQL` connection pool. See
|
|
1590
|
+
* [`PostgresConnectionPool`](super::postgres_pool::PostgresConnectionPool)
|
|
1522
1591
|
* for sharing semantics and lifecycle.
|
|
1523
1592
|
*/
|
|
1524
1593
|
export class MysqlConnectionPool {
|
|
@@ -1599,56 +1668,42 @@ export class SdkBuilder {
|
|
|
1599
1668
|
withKeySet(config: KeySetConfig): SdkBuilder;
|
|
1600
1669
|
withLnurlClient(lnurl_client: RestClient): SdkBuilder;
|
|
1601
1670
|
/**
|
|
1602
|
-
* **Deprecated.** Call `
|
|
1671
|
+
* **Deprecated.** Call `createMysqlConnectionPool(config)` and
|
|
1672
|
+
* `withMysqlConnectionPool(pool)` instead.
|
|
1603
1673
|
*/
|
|
1604
1674
|
withMysqlBackend(config: MysqlStorageConfig): SdkBuilder;
|
|
1605
1675
|
/**
|
|
1606
1676
|
* Sets a shared `MySQL` connection pool as the backend for all stores.
|
|
1607
|
-
*
|
|
1608
|
-
* `
|
|
1677
|
+
*
|
|
1678
|
+
* If the same builder also receives a `WasmSdkContext` carrying a MySQL
|
|
1679
|
+
* pool, `build()` returns an error — pick one source.
|
|
1609
1680
|
*/
|
|
1610
1681
|
withMysqlConnectionPool(pool: MysqlConnectionPool): SdkBuilder;
|
|
1611
1682
|
withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
|
|
1612
1683
|
/**
|
|
1613
|
-
* **Deprecated.** Call `
|
|
1684
|
+
* **Deprecated.** Call `createPostgresConnectionPool(config)` and
|
|
1685
|
+
* `withPostgresConnectionPool(pool)` instead.
|
|
1614
1686
|
*/
|
|
1615
1687
|
withPostgresBackend(config: PostgresStorageConfig): SdkBuilder;
|
|
1616
1688
|
/**
|
|
1617
|
-
* Sets a shared
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1689
|
+
* Sets a shared Postgres connection pool as the backend for all stores.
|
|
1690
|
+
*
|
|
1691
|
+
* If the same builder also receives a `WasmSdkContext` carrying a
|
|
1692
|
+
* Postgres pool, `build()` returns an error — pick one source.
|
|
1620
1693
|
*/
|
|
1621
1694
|
withPostgresConnectionPool(pool: PostgresConnectionPool): SdkBuilder;
|
|
1622
1695
|
withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
|
|
1623
1696
|
/**
|
|
1624
|
-
*
|
|
1697
|
+
* Threads a shared [`WasmSdkContext`] into the builder.
|
|
1625
1698
|
*
|
|
1626
|
-
*
|
|
1627
|
-
*
|
|
1628
|
-
*
|
|
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.
|
|
1699
|
+
* Construct the context once via `newSharedSdkContext` and pass the same
|
|
1700
|
+
* handle to every `SdkBuilder` whose SDKs should share its resources
|
|
1701
|
+
* (operator gRPC channels, SSP HTTP client, database pool).
|
|
1635
1702
|
*/
|
|
1636
|
-
|
|
1703
|
+
withSharedContext(context: WasmSdkContext): SdkBuilder;
|
|
1637
1704
|
withStorage(storage: Storage): SdkBuilder;
|
|
1638
1705
|
}
|
|
1639
1706
|
|
|
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
|
-
|
|
1652
1707
|
export class TokenIssuer {
|
|
1653
1708
|
private constructor();
|
|
1654
1709
|
free(): void;
|
|
@@ -1662,12 +1717,25 @@ export class TokenIssuer {
|
|
|
1662
1717
|
unfreezeIssuerToken(request: UnfreezeIssuerTokenRequest): Promise<UnfreezeIssuerTokenResponse>;
|
|
1663
1718
|
}
|
|
1664
1719
|
|
|
1720
|
+
/**
|
|
1721
|
+
* Process-shared resources backing one or more `BreezSdk` instances on WASM.
|
|
1722
|
+
*
|
|
1723
|
+
* Construct once via `newSharedSdkContext` and pass the handle to every
|
|
1724
|
+
* `SdkBuilder` whose SDKs should share its operator gRPC channels, SSP HTTP
|
|
1725
|
+
* client, and (optionally) database connection pool.
|
|
1726
|
+
*/
|
|
1727
|
+
export class WasmSdkContext {
|
|
1728
|
+
private constructor();
|
|
1729
|
+
free(): void;
|
|
1730
|
+
[Symbol.dispose](): void;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1665
1733
|
export function connect(request: ConnectRequest): Promise<BreezSdk>;
|
|
1666
1734
|
|
|
1667
1735
|
export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
|
|
1668
1736
|
|
|
1669
1737
|
/**
|
|
1670
|
-
* Creates a shareable MySQL connection pool from the given config.
|
|
1738
|
+
* Creates a shareable `MySQL` connection pool from the given config.
|
|
1671
1739
|
*/
|
|
1672
1740
|
export function createMysqlConnectionPool(config: MysqlStorageConfig): MysqlConnectionPool;
|
|
1673
1741
|
|
|
@@ -1687,6 +1755,7 @@ export function defaultExternalSigner(mnemonic: string, passphrase: string | nul
|
|
|
1687
1755
|
* - `maxPoolSize`: 10
|
|
1688
1756
|
* - `createTimeoutSecs`: 0 (no timeout)
|
|
1689
1757
|
* - `recycleTimeoutSecs`: 10
|
|
1758
|
+
* - `foreignKeyMode`: `Enforced`
|
|
1690
1759
|
*/
|
|
1691
1760
|
export function defaultMysqlStorageConfig(connection_string: string): MysqlStorageConfig;
|
|
1692
1761
|
|
|
@@ -1700,6 +1769,8 @@ export function defaultMysqlStorageConfig(connection_string: string): MysqlStora
|
|
|
1700
1769
|
*/
|
|
1701
1770
|
export function defaultPostgresStorageConfig(connection_string: string): PostgresStorageConfig;
|
|
1702
1771
|
|
|
1772
|
+
export function defaultServerConfig(network: Network): Config;
|
|
1773
|
+
|
|
1703
1774
|
/**
|
|
1704
1775
|
* Creates a default external signer from a mnemonic phrase.
|
|
1705
1776
|
*
|
|
@@ -1720,7 +1791,10 @@ export function initLogging(logger: Logger, filter?: string | null): Promise<voi
|
|
|
1720
1791
|
*/
|
|
1721
1792
|
export function newRestChainService(url: string, network: Network, api_type: ChainApiType, credentials?: Credentials | null): Promise<BitcoinChainService>;
|
|
1722
1793
|
|
|
1723
|
-
|
|
1794
|
+
/**
|
|
1795
|
+
* Constructs a [`WasmSdkContext`] from a `WasmSdkContextConfig`.
|
|
1796
|
+
*/
|
|
1797
|
+
export function newSharedSdkContext(config: WasmSdkContextConfig): Promise<WasmSdkContext>;
|
|
1724
1798
|
|
|
1725
1799
|
/**
|
|
1726
1800
|
* Entry point invoked by JavaScript in a worker.
|
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./breez_sdk_spark_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
BitcoinChainServiceHandle, BreezSdk, DefaultSigner, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, MysqlConnectionPool, Passkey, PostgresConnectionPool, SdkBuilder,
|
|
8
|
+
BitcoinChainServiceHandle, BreezSdk, DefaultSigner, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, MysqlConnectionPool, Passkey, PostgresConnectionPool, SdkBuilder, TokenIssuer, WasmSdkContext, connect, connectWithSigner, createMysqlConnectionPool, createPostgresConnectionPool, defaultConfig, defaultExternalSigner, defaultMysqlStorageConfig, defaultPostgresStorageConfig, defaultServerConfig, getSparkStatus, initLogging, newRestChainService, newSharedSdkContext, task_worker_entry_point
|
|
9
9
|
} from "./breez_sdk_spark_wasm_bg.js";
|