@partylayer/sdk 0.2.5 → 0.2.7
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/README.md +5 -5
- package/dist/index.d.mts +173 -17
- package/dist/index.d.ts +173 -17
- package/dist/index.js +431 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +344 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -18
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
**The
|
|
5
|
+
**The unified SDK for connecting dApps to Canton Network wallets**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@partylayer/sdk)
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
## Overview
|
|
16
16
|
|
|
17
|
-
`@partylayer/sdk` provides a unified interface for connecting your decentralized application (dApp) to multiple Canton Network wallets.
|
|
17
|
+
`@partylayer/sdk` provides a unified interface for connecting your decentralized application (dApp) to multiple Canton Network wallets. It abstracts wallet-specific implementations behind a simple, type-safe API — one integration for every Canton wallet.
|
|
18
18
|
|
|
19
19
|
### Features
|
|
20
20
|
|
|
@@ -270,9 +270,9 @@ import type {
|
|
|
270
270
|
|
|
271
271
|
## Links
|
|
272
272
|
|
|
273
|
-
- [GitHub Repository](https://github.com/
|
|
274
|
-
- [Documentation](https://github.com/
|
|
275
|
-
- [Report Issues](https://github.com/
|
|
273
|
+
- [GitHub Repository](https://github.com/PartyLayer/PartyLayer)
|
|
274
|
+
- [Documentation](https://github.com/PartyLayer/PartyLayer#readme)
|
|
275
|
+
- [Report Issues](https://github.com/PartyLayer/PartyLayer/issues)
|
|
276
276
|
- [Canton Network](https://www.canton.network/)
|
|
277
277
|
|
|
278
278
|
---
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _partylayer_core from '@partylayer/core';
|
|
2
|
+
import { WalletAdapter, NetworkId, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult } from '@partylayer/core';
|
|
3
|
+
export { AdapterConnectResult, AdapterContext, AdapterDetectResult, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, METRICS, MetricName, MetricsPayload, NetworkId, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName } from '@partylayer/core';
|
|
3
4
|
import { RegistryClient, RegistryStatus } from '@partylayer/registry-client';
|
|
4
5
|
export { RegistryStatus } from '@partylayer/registry-client';
|
|
6
|
+
export { CANTON_NETWORKS, CIP0103Account, CIP0103ConnectResult, CIP0103Event, CIP0103EventBus, CIP0103Method, CIP0103Network, CIP0103Provider, CIP0103StatusEvent, CIP0103TxChangedEvent, CIP0103TxStatus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, DiscoveredProvider, JSON_RPC_ERRORS, PartyLayerProvider, PartyLayerProviderOptions, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
|
|
5
7
|
export { BronAdapter, BronAdapterConfig, BronApiConfig, BronAuthConfig } from '@partylayer/adapter-bron';
|
|
6
8
|
export { Cantor8Adapter } from '@partylayer/adapter-cantor8';
|
|
7
9
|
export { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
8
10
|
export { LoopAdapter } from '@partylayer/adapter-loop';
|
|
11
|
+
export { NightlyAdapter } from '@partylayer/adapter-nightly';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Configuration types for PartyLayer SDK
|
|
@@ -16,6 +19,53 @@ export { LoopAdapter } from '@partylayer/adapter-loop';
|
|
|
16
19
|
* This points to the official registry endpoint.
|
|
17
20
|
*/
|
|
18
21
|
declare const DEFAULT_REGISTRY_URL = "https://registry.partylayer.xyz";
|
|
22
|
+
/**
|
|
23
|
+
* Telemetry configuration for opt-in metrics collection
|
|
24
|
+
*
|
|
25
|
+
* @since 0.3.0
|
|
26
|
+
*/
|
|
27
|
+
interface TelemetryConfig {
|
|
28
|
+
/**
|
|
29
|
+
* Enable telemetry collection
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Metrics backend endpoint URL
|
|
35
|
+
* If not provided, metrics are collected but not sent
|
|
36
|
+
*/
|
|
37
|
+
endpoint?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Sampling rate (0.0 to 1.0)
|
|
40
|
+
* @default 1.0 (100% of events)
|
|
41
|
+
*/
|
|
42
|
+
sampleRate?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Application identifier (will be hashed for privacy)
|
|
45
|
+
* Used to calculate Monthly Active dApps (MAD)
|
|
46
|
+
*/
|
|
47
|
+
appId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Include hashed origin in metrics
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
includeOrigin?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Number of events to buffer before sending
|
|
55
|
+
* @default 10
|
|
56
|
+
*/
|
|
57
|
+
batchSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Interval to flush metrics in milliseconds
|
|
60
|
+
* @default 30000 (30 seconds)
|
|
61
|
+
*/
|
|
62
|
+
flushIntervalMs?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Network to include in metrics
|
|
65
|
+
* If not provided, uses the SDK's configured network
|
|
66
|
+
*/
|
|
67
|
+
network?: NetworkId;
|
|
68
|
+
}
|
|
19
69
|
/**
|
|
20
70
|
* Adapter class type (for instantiation)
|
|
21
71
|
*/
|
|
@@ -79,8 +129,17 @@ interface PartyLayerConfig {
|
|
|
79
129
|
crypto?: CryptoAdapter;
|
|
80
130
|
/** Registry public keys for signature verification (ed25519) */
|
|
81
131
|
registryPublicKeys?: string[];
|
|
82
|
-
/**
|
|
83
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Telemetry configuration or adapter
|
|
134
|
+
*
|
|
135
|
+
* Can be either:
|
|
136
|
+
* - TelemetryConfig object for built-in metrics collection
|
|
137
|
+
* - TelemetryAdapter instance for custom telemetry
|
|
138
|
+
*
|
|
139
|
+
* @default undefined (telemetry disabled)
|
|
140
|
+
* @since 0.3.0 - Added TelemetryConfig support
|
|
141
|
+
*/
|
|
142
|
+
telemetry?: TelemetryAdapter | TelemetryConfig;
|
|
84
143
|
/** Logger adapter (optional) */
|
|
85
144
|
logger?: LoggerAdapter;
|
|
86
145
|
/** Application metadata */
|
|
@@ -192,18 +251,6 @@ type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConne
|
|
|
192
251
|
*/
|
|
193
252
|
type EventHandler<T extends PartyLayerEvent = PartyLayerEvent> = (event: T) => void | Promise<void>;
|
|
194
253
|
|
|
195
|
-
/**
|
|
196
|
-
* PartyLayer Client - Public API Implementation
|
|
197
|
-
*
|
|
198
|
-
* This is the main public API for PartyLayer SDK.
|
|
199
|
-
* All dApps should use this API exclusively.
|
|
200
|
-
*
|
|
201
|
-
* References:
|
|
202
|
-
* - Wallet Integration Guide: https://docs.digitalasset.com/integrate/devnet/index.html
|
|
203
|
-
* - Signing transactions from dApps: https://docs.digitalasset.com/integrate/devnet/signing-transactions-from-dapps/index.html
|
|
204
|
-
* - OpenRPC dApp API spec: https://github.com/hyperledger-labs/splice-wallet-kernel/blob/main/api-specs/openrpc-dapp-api.json
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
254
|
/**
|
|
208
255
|
* PartyLayer Client
|
|
209
256
|
*
|
|
@@ -257,6 +304,10 @@ declare class PartyLayerClient {
|
|
|
257
304
|
* Submit a transaction
|
|
258
305
|
*/
|
|
259
306
|
submitTransaction(params: SubmitTransactionParams): Promise<TxReceipt>;
|
|
307
|
+
/**
|
|
308
|
+
* Proxy a JSON Ledger API request through the active wallet adapter
|
|
309
|
+
*/
|
|
310
|
+
ledgerApi(params: LedgerApiParams): Promise<LedgerApiResult>;
|
|
260
311
|
/**
|
|
261
312
|
* Subscribe to events
|
|
262
313
|
*/
|
|
@@ -265,6 +316,23 @@ declare class PartyLayerClient {
|
|
|
265
316
|
* Unsubscribe from events
|
|
266
317
|
*/
|
|
267
318
|
off<T extends PartyLayerEvent>(event: T['type'], handler: EventHandler<T>): void;
|
|
319
|
+
/**
|
|
320
|
+
* Get a CIP-0103 Provider backed by this client.
|
|
321
|
+
*
|
|
322
|
+
* This bridge routes all request() calls through the existing
|
|
323
|
+
* PartyLayerClient methods and maps events to CIP-0103 format.
|
|
324
|
+
*
|
|
325
|
+
* The bridge implements the full CIP-0103 specification:
|
|
326
|
+
* - All 10 mandatory methods including `ledgerApi` (when adapter supports it)
|
|
327
|
+
* - Full transaction lifecycle: pending -> signed -> executed/failed
|
|
328
|
+
* - All CIP-0103 events: statusChanged, accountsChanged, txChanged, connected
|
|
329
|
+
*
|
|
330
|
+
* **Note:** Async wallets (userUrl pattern) are not supported through the
|
|
331
|
+
* bridge. For async wallet support, use `PartyLayerProvider` directly.
|
|
332
|
+
*
|
|
333
|
+
* @returns CIP-0103 compliant Provider
|
|
334
|
+
*/
|
|
335
|
+
asProvider(): _partylayer_core.CIP0103Provider;
|
|
268
336
|
/**
|
|
269
337
|
* Destroy client and cleanup
|
|
270
338
|
*/
|
|
@@ -334,10 +402,98 @@ declare function createPartyLayer(config: PartyLayerConfig): PartyLayerClient;
|
|
|
334
402
|
* - ConsoleAdapter: Console Wallet browser extension
|
|
335
403
|
* - LoopAdapter: 5N Loop mobile/web wallet
|
|
336
404
|
* - Cantor8Adapter: Cantor8 wallet with deep link transport
|
|
405
|
+
* - NightlyAdapter: Nightly multichain wallet with Canton support
|
|
337
406
|
*
|
|
338
407
|
* Note: BronAdapter is NOT included by default because it requires OAuth configuration.
|
|
339
408
|
* To use Bron, install @partylayer/adapter-bron and register it manually.
|
|
340
409
|
*/
|
|
341
410
|
declare function getBuiltinAdapters(): WalletAdapter[];
|
|
342
411
|
|
|
343
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Metrics Telemetry Adapter
|
|
414
|
+
*
|
|
415
|
+
* A privacy-safe telemetry adapter that collects metrics for
|
|
416
|
+
* ecosystem health monitoring and usage reporting.
|
|
417
|
+
*
|
|
418
|
+
* Features:
|
|
419
|
+
* - Opt-in by default (disabled unless explicitly enabled)
|
|
420
|
+
* - Privacy-safe payloads (no PII, hashed identifiers)
|
|
421
|
+
* - Batched sending to reduce network overhead
|
|
422
|
+
* - Configurable sampling rate
|
|
423
|
+
* - Automatic flush on interval or batch size
|
|
424
|
+
*
|
|
425
|
+
* @since 0.3.0
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Metrics Telemetry Adapter
|
|
430
|
+
*
|
|
431
|
+
* Implements TelemetryAdapter interface with metrics-specific functionality.
|
|
432
|
+
*/
|
|
433
|
+
declare class MetricsTelemetryAdapter implements TelemetryAdapter {
|
|
434
|
+
private config;
|
|
435
|
+
private metrics;
|
|
436
|
+
private buffer;
|
|
437
|
+
private flushTimer;
|
|
438
|
+
private appIdHash;
|
|
439
|
+
private originHash;
|
|
440
|
+
private initialized;
|
|
441
|
+
constructor(config: TelemetryConfig);
|
|
442
|
+
/**
|
|
443
|
+
* Initialize async components (hashing)
|
|
444
|
+
*/
|
|
445
|
+
private initialize;
|
|
446
|
+
/**
|
|
447
|
+
* Check if telemetry is enabled
|
|
448
|
+
*/
|
|
449
|
+
isEnabled(): boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Track a named event (TelemetryAdapter interface)
|
|
452
|
+
*/
|
|
453
|
+
track(event: string, properties?: Record<string, unknown>): void;
|
|
454
|
+
/**
|
|
455
|
+
* Track an error (TelemetryAdapter interface)
|
|
456
|
+
*/
|
|
457
|
+
error(error: Error, properties?: Record<string, unknown>): void;
|
|
458
|
+
/**
|
|
459
|
+
* Increment a metric counter
|
|
460
|
+
*/
|
|
461
|
+
increment(metric: string, value?: number): void;
|
|
462
|
+
/**
|
|
463
|
+
* Set a gauge metric value
|
|
464
|
+
*/
|
|
465
|
+
gauge(metric: string, value: number): void;
|
|
466
|
+
/**
|
|
467
|
+
* Buffer an event for batched sending
|
|
468
|
+
*/
|
|
469
|
+
private bufferEvent;
|
|
470
|
+
/**
|
|
471
|
+
* Flush buffered metrics to backend
|
|
472
|
+
*/
|
|
473
|
+
flush(): Promise<void>;
|
|
474
|
+
/**
|
|
475
|
+
* Get current metrics snapshot (for testing/debugging)
|
|
476
|
+
*/
|
|
477
|
+
getMetrics(): Record<string, number>;
|
|
478
|
+
/**
|
|
479
|
+
* Reset all metrics (for testing)
|
|
480
|
+
*/
|
|
481
|
+
reset(): void;
|
|
482
|
+
/**
|
|
483
|
+
* Destroy the adapter (cleanup timers)
|
|
484
|
+
*/
|
|
485
|
+
destroy(): void;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Check if a value is a TelemetryConfig object
|
|
489
|
+
*/
|
|
490
|
+
declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
|
|
491
|
+
/**
|
|
492
|
+
* Create a TelemetryAdapter from config
|
|
493
|
+
*
|
|
494
|
+
* If config is already a TelemetryAdapter, returns it.
|
|
495
|
+
* If config is a TelemetryConfig, creates a MetricsTelemetryAdapter.
|
|
496
|
+
*/
|
|
497
|
+
declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
|
|
498
|
+
|
|
499
|
+
export { type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _partylayer_core from '@partylayer/core';
|
|
2
|
+
import { WalletAdapter, NetworkId, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult } from '@partylayer/core';
|
|
3
|
+
export { AdapterConnectResult, AdapterContext, AdapterDetectResult, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, METRICS, MetricName, MetricsPayload, NetworkId, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName } from '@partylayer/core';
|
|
3
4
|
import { RegistryClient, RegistryStatus } from '@partylayer/registry-client';
|
|
4
5
|
export { RegistryStatus } from '@partylayer/registry-client';
|
|
6
|
+
export { CANTON_NETWORKS, CIP0103Account, CIP0103ConnectResult, CIP0103Event, CIP0103EventBus, CIP0103Method, CIP0103Network, CIP0103Provider, CIP0103StatusEvent, CIP0103TxChangedEvent, CIP0103TxStatus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, DiscoveredProvider, JSON_RPC_ERRORS, PartyLayerProvider, PartyLayerProviderOptions, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
|
|
5
7
|
export { BronAdapter, BronAdapterConfig, BronApiConfig, BronAuthConfig } from '@partylayer/adapter-bron';
|
|
6
8
|
export { Cantor8Adapter } from '@partylayer/adapter-cantor8';
|
|
7
9
|
export { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
8
10
|
export { LoopAdapter } from '@partylayer/adapter-loop';
|
|
11
|
+
export { NightlyAdapter } from '@partylayer/adapter-nightly';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Configuration types for PartyLayer SDK
|
|
@@ -16,6 +19,53 @@ export { LoopAdapter } from '@partylayer/adapter-loop';
|
|
|
16
19
|
* This points to the official registry endpoint.
|
|
17
20
|
*/
|
|
18
21
|
declare const DEFAULT_REGISTRY_URL = "https://registry.partylayer.xyz";
|
|
22
|
+
/**
|
|
23
|
+
* Telemetry configuration for opt-in metrics collection
|
|
24
|
+
*
|
|
25
|
+
* @since 0.3.0
|
|
26
|
+
*/
|
|
27
|
+
interface TelemetryConfig {
|
|
28
|
+
/**
|
|
29
|
+
* Enable telemetry collection
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Metrics backend endpoint URL
|
|
35
|
+
* If not provided, metrics are collected but not sent
|
|
36
|
+
*/
|
|
37
|
+
endpoint?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Sampling rate (0.0 to 1.0)
|
|
40
|
+
* @default 1.0 (100% of events)
|
|
41
|
+
*/
|
|
42
|
+
sampleRate?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Application identifier (will be hashed for privacy)
|
|
45
|
+
* Used to calculate Monthly Active dApps (MAD)
|
|
46
|
+
*/
|
|
47
|
+
appId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Include hashed origin in metrics
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
includeOrigin?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Number of events to buffer before sending
|
|
55
|
+
* @default 10
|
|
56
|
+
*/
|
|
57
|
+
batchSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Interval to flush metrics in milliseconds
|
|
60
|
+
* @default 30000 (30 seconds)
|
|
61
|
+
*/
|
|
62
|
+
flushIntervalMs?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Network to include in metrics
|
|
65
|
+
* If not provided, uses the SDK's configured network
|
|
66
|
+
*/
|
|
67
|
+
network?: NetworkId;
|
|
68
|
+
}
|
|
19
69
|
/**
|
|
20
70
|
* Adapter class type (for instantiation)
|
|
21
71
|
*/
|
|
@@ -79,8 +129,17 @@ interface PartyLayerConfig {
|
|
|
79
129
|
crypto?: CryptoAdapter;
|
|
80
130
|
/** Registry public keys for signature verification (ed25519) */
|
|
81
131
|
registryPublicKeys?: string[];
|
|
82
|
-
/**
|
|
83
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Telemetry configuration or adapter
|
|
134
|
+
*
|
|
135
|
+
* Can be either:
|
|
136
|
+
* - TelemetryConfig object for built-in metrics collection
|
|
137
|
+
* - TelemetryAdapter instance for custom telemetry
|
|
138
|
+
*
|
|
139
|
+
* @default undefined (telemetry disabled)
|
|
140
|
+
* @since 0.3.0 - Added TelemetryConfig support
|
|
141
|
+
*/
|
|
142
|
+
telemetry?: TelemetryAdapter | TelemetryConfig;
|
|
84
143
|
/** Logger adapter (optional) */
|
|
85
144
|
logger?: LoggerAdapter;
|
|
86
145
|
/** Application metadata */
|
|
@@ -192,18 +251,6 @@ type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConne
|
|
|
192
251
|
*/
|
|
193
252
|
type EventHandler<T extends PartyLayerEvent = PartyLayerEvent> = (event: T) => void | Promise<void>;
|
|
194
253
|
|
|
195
|
-
/**
|
|
196
|
-
* PartyLayer Client - Public API Implementation
|
|
197
|
-
*
|
|
198
|
-
* This is the main public API for PartyLayer SDK.
|
|
199
|
-
* All dApps should use this API exclusively.
|
|
200
|
-
*
|
|
201
|
-
* References:
|
|
202
|
-
* - Wallet Integration Guide: https://docs.digitalasset.com/integrate/devnet/index.html
|
|
203
|
-
* - Signing transactions from dApps: https://docs.digitalasset.com/integrate/devnet/signing-transactions-from-dapps/index.html
|
|
204
|
-
* - OpenRPC dApp API spec: https://github.com/hyperledger-labs/splice-wallet-kernel/blob/main/api-specs/openrpc-dapp-api.json
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
254
|
/**
|
|
208
255
|
* PartyLayer Client
|
|
209
256
|
*
|
|
@@ -257,6 +304,10 @@ declare class PartyLayerClient {
|
|
|
257
304
|
* Submit a transaction
|
|
258
305
|
*/
|
|
259
306
|
submitTransaction(params: SubmitTransactionParams): Promise<TxReceipt>;
|
|
307
|
+
/**
|
|
308
|
+
* Proxy a JSON Ledger API request through the active wallet adapter
|
|
309
|
+
*/
|
|
310
|
+
ledgerApi(params: LedgerApiParams): Promise<LedgerApiResult>;
|
|
260
311
|
/**
|
|
261
312
|
* Subscribe to events
|
|
262
313
|
*/
|
|
@@ -265,6 +316,23 @@ declare class PartyLayerClient {
|
|
|
265
316
|
* Unsubscribe from events
|
|
266
317
|
*/
|
|
267
318
|
off<T extends PartyLayerEvent>(event: T['type'], handler: EventHandler<T>): void;
|
|
319
|
+
/**
|
|
320
|
+
* Get a CIP-0103 Provider backed by this client.
|
|
321
|
+
*
|
|
322
|
+
* This bridge routes all request() calls through the existing
|
|
323
|
+
* PartyLayerClient methods and maps events to CIP-0103 format.
|
|
324
|
+
*
|
|
325
|
+
* The bridge implements the full CIP-0103 specification:
|
|
326
|
+
* - All 10 mandatory methods including `ledgerApi` (when adapter supports it)
|
|
327
|
+
* - Full transaction lifecycle: pending -> signed -> executed/failed
|
|
328
|
+
* - All CIP-0103 events: statusChanged, accountsChanged, txChanged, connected
|
|
329
|
+
*
|
|
330
|
+
* **Note:** Async wallets (userUrl pattern) are not supported through the
|
|
331
|
+
* bridge. For async wallet support, use `PartyLayerProvider` directly.
|
|
332
|
+
*
|
|
333
|
+
* @returns CIP-0103 compliant Provider
|
|
334
|
+
*/
|
|
335
|
+
asProvider(): _partylayer_core.CIP0103Provider;
|
|
268
336
|
/**
|
|
269
337
|
* Destroy client and cleanup
|
|
270
338
|
*/
|
|
@@ -334,10 +402,98 @@ declare function createPartyLayer(config: PartyLayerConfig): PartyLayerClient;
|
|
|
334
402
|
* - ConsoleAdapter: Console Wallet browser extension
|
|
335
403
|
* - LoopAdapter: 5N Loop mobile/web wallet
|
|
336
404
|
* - Cantor8Adapter: Cantor8 wallet with deep link transport
|
|
405
|
+
* - NightlyAdapter: Nightly multichain wallet with Canton support
|
|
337
406
|
*
|
|
338
407
|
* Note: BronAdapter is NOT included by default because it requires OAuth configuration.
|
|
339
408
|
* To use Bron, install @partylayer/adapter-bron and register it manually.
|
|
340
409
|
*/
|
|
341
410
|
declare function getBuiltinAdapters(): WalletAdapter[];
|
|
342
411
|
|
|
343
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Metrics Telemetry Adapter
|
|
414
|
+
*
|
|
415
|
+
* A privacy-safe telemetry adapter that collects metrics for
|
|
416
|
+
* ecosystem health monitoring and usage reporting.
|
|
417
|
+
*
|
|
418
|
+
* Features:
|
|
419
|
+
* - Opt-in by default (disabled unless explicitly enabled)
|
|
420
|
+
* - Privacy-safe payloads (no PII, hashed identifiers)
|
|
421
|
+
* - Batched sending to reduce network overhead
|
|
422
|
+
* - Configurable sampling rate
|
|
423
|
+
* - Automatic flush on interval or batch size
|
|
424
|
+
*
|
|
425
|
+
* @since 0.3.0
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Metrics Telemetry Adapter
|
|
430
|
+
*
|
|
431
|
+
* Implements TelemetryAdapter interface with metrics-specific functionality.
|
|
432
|
+
*/
|
|
433
|
+
declare class MetricsTelemetryAdapter implements TelemetryAdapter {
|
|
434
|
+
private config;
|
|
435
|
+
private metrics;
|
|
436
|
+
private buffer;
|
|
437
|
+
private flushTimer;
|
|
438
|
+
private appIdHash;
|
|
439
|
+
private originHash;
|
|
440
|
+
private initialized;
|
|
441
|
+
constructor(config: TelemetryConfig);
|
|
442
|
+
/**
|
|
443
|
+
* Initialize async components (hashing)
|
|
444
|
+
*/
|
|
445
|
+
private initialize;
|
|
446
|
+
/**
|
|
447
|
+
* Check if telemetry is enabled
|
|
448
|
+
*/
|
|
449
|
+
isEnabled(): boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Track a named event (TelemetryAdapter interface)
|
|
452
|
+
*/
|
|
453
|
+
track(event: string, properties?: Record<string, unknown>): void;
|
|
454
|
+
/**
|
|
455
|
+
* Track an error (TelemetryAdapter interface)
|
|
456
|
+
*/
|
|
457
|
+
error(error: Error, properties?: Record<string, unknown>): void;
|
|
458
|
+
/**
|
|
459
|
+
* Increment a metric counter
|
|
460
|
+
*/
|
|
461
|
+
increment(metric: string, value?: number): void;
|
|
462
|
+
/**
|
|
463
|
+
* Set a gauge metric value
|
|
464
|
+
*/
|
|
465
|
+
gauge(metric: string, value: number): void;
|
|
466
|
+
/**
|
|
467
|
+
* Buffer an event for batched sending
|
|
468
|
+
*/
|
|
469
|
+
private bufferEvent;
|
|
470
|
+
/**
|
|
471
|
+
* Flush buffered metrics to backend
|
|
472
|
+
*/
|
|
473
|
+
flush(): Promise<void>;
|
|
474
|
+
/**
|
|
475
|
+
* Get current metrics snapshot (for testing/debugging)
|
|
476
|
+
*/
|
|
477
|
+
getMetrics(): Record<string, number>;
|
|
478
|
+
/**
|
|
479
|
+
* Reset all metrics (for testing)
|
|
480
|
+
*/
|
|
481
|
+
reset(): void;
|
|
482
|
+
/**
|
|
483
|
+
* Destroy the adapter (cleanup timers)
|
|
484
|
+
*/
|
|
485
|
+
destroy(): void;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Check if a value is a TelemetryConfig object
|
|
489
|
+
*/
|
|
490
|
+
declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
|
|
491
|
+
/**
|
|
492
|
+
* Create a TelemetryAdapter from config
|
|
493
|
+
*
|
|
494
|
+
* If config is already a TelemetryAdapter, returns it.
|
|
495
|
+
* If config is a TelemetryConfig, creates a MetricsTelemetryAdapter.
|
|
496
|
+
*/
|
|
497
|
+
declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
|
|
498
|
+
|
|
499
|
+
export { type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
|