@explorins/pers-sdk 2.1.11 → 2.1.15
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/dist/business/api/business-membership-api.d.ts +2 -2
- package/dist/chunks/{index-B-g2JPVK.cjs → index-CGaKfZNU.cjs} +279 -1
- package/dist/chunks/index-CGaKfZNU.cjs.map +1 -0
- package/dist/chunks/{index-CKm_V5XE.js → index-DgTEdUgC.js} +277 -2
- package/dist/chunks/index-DgTEdUgC.js.map +1 -0
- package/dist/chunks/{pers-sdk-CJo4CCTG.js → pers-sdk-BiP7UMJ3.js} +1695 -180
- package/dist/chunks/pers-sdk-BiP7UMJ3.js.map +1 -0
- package/dist/chunks/{pers-sdk-Bheg5mKX.cjs → pers-sdk-Cv7hM1I7.cjs} +1701 -180
- package/dist/chunks/pers-sdk-Cv7hM1I7.cjs.map +1 -0
- package/dist/chunks/tenant-manager-BUiFM33X.cjs +157 -0
- package/dist/chunks/tenant-manager-BUiFM33X.cjs.map +1 -0
- package/dist/chunks/tenant-manager-Bbj0bKoo.js +155 -0
- package/dist/chunks/tenant-manager-Bbj0bKoo.js.map +1 -0
- package/dist/chunks/{transaction-request.builder-DGTxGvc3.js → transaction-request.builder-C3C19kCx.js} +23 -2
- package/dist/chunks/{transaction-request.builder-DGTxGvc3.js.map → transaction-request.builder-C3C19kCx.js.map} +1 -1
- package/dist/chunks/{transaction-request.builder-Bjxi0C9F.cjs → transaction-request.builder-CW3Wwdi3.cjs} +23 -1
- package/dist/chunks/{transaction-request.builder-Bjxi0C9F.cjs.map → transaction-request.builder-CW3Wwdi3.cjs.map} +1 -1
- package/dist/chunks/{web3-chain-service-D68-0WaW.cjs → web3-chain-service-DcLiy3m2.cjs} +7 -7
- package/dist/chunks/{web3-chain-service-D68-0WaW.cjs.map → web3-chain-service-DcLiy3m2.cjs.map} +1 -1
- package/dist/chunks/{web3-chain-service-DuvxmKSj.js → web3-chain-service-nGntR60S.js} +3 -3
- package/dist/chunks/{web3-chain-service-DuvxmKSj.js.map → web3-chain-service-nGntR60S.js.map} +1 -1
- package/dist/chunks/{web3-manager-C_cFaMCm.cjs → web3-manager-B0OyjqJR.cjs} +89 -93
- package/dist/chunks/web3-manager-B0OyjqJR.cjs.map +1 -0
- package/dist/chunks/{web3-manager-OExwBWB7.js → web3-manager-Bnsvcz3Q.js} +89 -93
- package/dist/chunks/web3-manager-Bnsvcz3Q.js.map +1 -0
- package/dist/core/events/event-emitter.d.ts.map +1 -1
- package/dist/core/pers-config.d.ts +19 -0
- package/dist/core/pers-config.d.ts.map +1 -1
- package/dist/core.cjs +17 -14
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +5 -5
- package/dist/events/index.d.ts +13 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/pers-events-client.d.ts +143 -0
- package/dist/events/pers-events-client.d.ts.map +1 -0
- package/dist/events/types.d.ts +37 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/index.cjs +41 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/managers/events-manager.d.ts +179 -0
- package/dist/managers/events-manager.d.ts.map +1 -0
- package/dist/managers/index.d.ts +2 -0
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/managers/tenant-manager.d.ts +42 -1
- package/dist/managers/tenant-manager.d.ts.map +1 -1
- package/dist/managers/web3-manager.d.ts +12 -14
- package/dist/managers/web3-manager.d.ts.map +1 -1
- package/dist/managers/webhook-manager.d.ts +237 -0
- package/dist/managers/webhook-manager.d.ts.map +1 -0
- package/dist/node.cjs +4 -3
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +4 -3
- package/dist/node.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/pers-sdk.d.ts +110 -1
- package/dist/pers-sdk.d.ts.map +1 -1
- package/dist/transaction/index.d.ts +1 -1
- package/dist/transaction/index.d.ts.map +1 -1
- package/dist/transaction/models/transaction-request.builder.d.ts +16 -0
- package/dist/transaction/models/transaction-request.builder.d.ts.map +1 -1
- package/dist/transaction.cjs +2 -1
- package/dist/transaction.cjs.map +1 -1
- package/dist/transaction.js +1 -1
- package/dist/web3/application/web3-application.service.d.ts +6 -3
- package/dist/web3/application/web3-application.service.d.ts.map +1 -1
- package/dist/web3/domain/services/metadata-domain.service.d.ts +4 -2
- package/dist/web3/domain/services/metadata-domain.service.d.ts.map +1 -1
- package/dist/web3/domain/services/token-domain.service.d.ts +7 -3
- package/dist/web3/domain/services/token-domain.service.d.ts.map +1 -1
- package/dist/web3/infrastructure/api/ipfs-api.d.ts +22 -9
- package/dist/web3/infrastructure/api/ipfs-api.d.ts.map +1 -1
- package/dist/web3/utils/explorer.utils.d.ts +3 -3
- package/dist/web3/utils/explorer.utils.d.ts.map +1 -1
- package/dist/web3-chain/api/web3-chain-api.d.ts +3 -2
- package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -1
- package/dist/web3-chain/index.d.ts +0 -1
- package/dist/web3-chain/index.d.ts.map +1 -1
- package/dist/web3-chain/models/index.d.ts +5 -23
- package/dist/web3-chain/models/index.d.ts.map +1 -1
- package/dist/web3-chain/services/web3-chain-service.d.ts +2 -2
- package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -1
- package/dist/web3-chain.cjs +8 -14
- package/dist/web3-chain.cjs.map +1 -1
- package/dist/web3-chain.js +3 -16
- package/dist/web3-chain.js.map +1 -1
- package/dist/web3-manager.cjs +7 -4
- package/dist/web3-manager.cjs.map +1 -1
- package/dist/web3-manager.js +7 -4
- package/dist/web3-manager.js.map +1 -1
- package/dist/web3.cjs +7 -4
- package/dist/web3.cjs.map +1 -1
- package/dist/web3.js +7 -4
- package/dist/web3.js.map +1 -1
- package/dist/webhook/api/index.d.ts +2 -0
- package/dist/webhook/api/index.d.ts.map +1 -0
- package/dist/webhook/api/webhook-api.d.ts +73 -0
- package/dist/webhook/api/webhook-api.d.ts.map +1 -0
- package/dist/webhook/index.d.ts +35 -0
- package/dist/webhook/index.d.ts.map +1 -0
- package/dist/webhook/models/index.d.ts +58 -0
- package/dist/webhook/models/index.d.ts.map +1 -0
- package/dist/webhook/services/index.d.ts +2 -0
- package/dist/webhook/services/index.d.ts.map +1 -0
- package/dist/webhook/services/webhook-service.d.ts +98 -0
- package/dist/webhook/services/webhook-service.d.ts.map +1 -0
- package/package.json +3 -2
- package/dist/chunks/index-B-g2JPVK.cjs.map +0 -1
- package/dist/chunks/index-B6-bbNnd.cjs +0 -281
- package/dist/chunks/index-B6-bbNnd.cjs.map +0 -1
- package/dist/chunks/index-CKm_V5XE.js.map +0 -1
- package/dist/chunks/index-DBLskLuH.js +0 -277
- package/dist/chunks/index-DBLskLuH.js.map +0 -1
- package/dist/chunks/pers-sdk-Bheg5mKX.cjs.map +0 -1
- package/dist/chunks/pers-sdk-CJo4CCTG.js.map +0 -1
- package/dist/chunks/web3-manager-C_cFaMCm.cjs.map +0 -1
- package/dist/chunks/web3-manager-OExwBWB7.js.map +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PERS Events Client
|
|
3
|
+
*
|
|
4
|
+
* Lightweight WebSocket client for real-time blockchain event streaming.
|
|
5
|
+
* Connects to the PERS WS Relay server to receive events for user's wallets.
|
|
6
|
+
*
|
|
7
|
+
* ## v1.2.0 Subscription Model
|
|
8
|
+
*
|
|
9
|
+
* JWT is used for authentication only. After connecting, you must explicitly
|
|
10
|
+
* subscribe to wallets (user SDK) or chains (admin dashboard).
|
|
11
|
+
*
|
|
12
|
+
* @example User SDK - Subscribe to specific wallets
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const client = new PersEventsClient({
|
|
15
|
+
* wsUrl: 'wss://events.pers.ninja',
|
|
16
|
+
* autoReconnect: true
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* await client.connect(jwtToken);
|
|
20
|
+
*
|
|
21
|
+
* // Subscribe to user's wallets
|
|
22
|
+
* await client.subscribeWallets([
|
|
23
|
+
* { address: '0x123...', chainId: 39123 }
|
|
24
|
+
* ]);
|
|
25
|
+
*
|
|
26
|
+
* client.on('Transfer', (event) => {
|
|
27
|
+
* console.log(`Received ${event.data.value} tokens`);
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Admin Dashboard - Subscribe to all events on chains
|
|
32
|
+
* ```typescript
|
|
33
|
+
* await client.connect(adminJwtToken);
|
|
34
|
+
*
|
|
35
|
+
* // Subscribe to all events on specific chains
|
|
36
|
+
* await client.subscribeChains([39123, 137]);
|
|
37
|
+
*
|
|
38
|
+
* client.on('*', (event) => {
|
|
39
|
+
* console.log(`Chain ${event.chainId}: ${event.type}`);
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
import type { EventsClientConfig, ConnectionState, BlockchainEventType, BlockchainEventHandler, BlockchainEventUnsubscribe, WalletInfo, SubscribedPayload } from './types';
|
|
44
|
+
export declare class PersEventsClient {
|
|
45
|
+
private ws;
|
|
46
|
+
private config;
|
|
47
|
+
private state;
|
|
48
|
+
private reconnectAttempts;
|
|
49
|
+
private reconnectTimeout;
|
|
50
|
+
private token;
|
|
51
|
+
private handlers;
|
|
52
|
+
private stateHandlers;
|
|
53
|
+
private connectionInfo;
|
|
54
|
+
private subscriptionState;
|
|
55
|
+
private pendingSubscription;
|
|
56
|
+
private savedSubscriptions;
|
|
57
|
+
constructor(config: EventsClientConfig);
|
|
58
|
+
/**
|
|
59
|
+
* Connect to the WS relay server
|
|
60
|
+
* @param token - JWT token for authentication (wallets no longer required in JWT)
|
|
61
|
+
*/
|
|
62
|
+
connect(token: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Disconnect from the server
|
|
65
|
+
*/
|
|
66
|
+
disconnect(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Subscribe to wallet events (User SDK)
|
|
69
|
+
*
|
|
70
|
+
* Receives events only for the specified wallet addresses.
|
|
71
|
+
* Can be called multiple times to add more wallets.
|
|
72
|
+
*
|
|
73
|
+
* @param wallets - Array of wallet info (address + chainId)
|
|
74
|
+
* @returns Promise that resolves when subscription is confirmed
|
|
75
|
+
*/
|
|
76
|
+
subscribeWallets(wallets: WalletInfo[]): Promise<SubscribedPayload>;
|
|
77
|
+
/**
|
|
78
|
+
* Subscribe to chain events (Admin Dashboard)
|
|
79
|
+
*
|
|
80
|
+
* Receives ALL events on the specified chains.
|
|
81
|
+
* Use for admin dashboards that need to monitor all activity.
|
|
82
|
+
*
|
|
83
|
+
* @param chains - Array of chain IDs to subscribe to
|
|
84
|
+
* @returns Promise that resolves when subscription is confirmed
|
|
85
|
+
*/
|
|
86
|
+
subscribeChains(chains: number[]): Promise<SubscribedPayload>;
|
|
87
|
+
/**
|
|
88
|
+
* Unsubscribe from wallet events
|
|
89
|
+
*
|
|
90
|
+
* @param wallets - Array of wallet info to unsubscribe from
|
|
91
|
+
* @returns Promise that resolves when unsubscription is confirmed
|
|
92
|
+
*/
|
|
93
|
+
unsubscribeWallets(wallets: WalletInfo[]): Promise<SubscribedPayload>;
|
|
94
|
+
/**
|
|
95
|
+
* Unsubscribe from chain events
|
|
96
|
+
*
|
|
97
|
+
* @param chains - Array of chain IDs to unsubscribe from
|
|
98
|
+
* @returns Promise that resolves when unsubscription is confirmed
|
|
99
|
+
*/
|
|
100
|
+
unsubscribeChains(chains: number[]): Promise<SubscribedPayload>;
|
|
101
|
+
/**
|
|
102
|
+
* Get current subscription state
|
|
103
|
+
*/
|
|
104
|
+
getSubscriptionState(): SubscribedPayload;
|
|
105
|
+
/**
|
|
106
|
+
* Subscribe to blockchain events
|
|
107
|
+
* @param eventType - Event type to listen for, or '*' for all events
|
|
108
|
+
* @param handler - Event handler function
|
|
109
|
+
* @returns Unsubscribe function
|
|
110
|
+
*/
|
|
111
|
+
on(eventType: BlockchainEventType | '*', handler: BlockchainEventHandler): BlockchainEventUnsubscribe;
|
|
112
|
+
/**
|
|
113
|
+
* Subscribe to connection state changes
|
|
114
|
+
*/
|
|
115
|
+
onStateChange(handler: (state: ConnectionState) => void): BlockchainEventUnsubscribe;
|
|
116
|
+
/**
|
|
117
|
+
* Get current connection state
|
|
118
|
+
*/
|
|
119
|
+
getState(): ConnectionState;
|
|
120
|
+
/**
|
|
121
|
+
* Get connection info (userId, initial wallets, activeChains)
|
|
122
|
+
*/
|
|
123
|
+
getConnectionInfo(): {
|
|
124
|
+
userId: string;
|
|
125
|
+
wallets: WalletInfo[];
|
|
126
|
+
activeChains: number[];
|
|
127
|
+
} | null;
|
|
128
|
+
private sendSubscription;
|
|
129
|
+
private handleMessage;
|
|
130
|
+
private sendPong;
|
|
131
|
+
private restoreSubscriptions;
|
|
132
|
+
private routeEvent;
|
|
133
|
+
private handleDisconnect;
|
|
134
|
+
private attemptReconnect;
|
|
135
|
+
private cleanup;
|
|
136
|
+
private setState;
|
|
137
|
+
private log;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Create a PERS Events client instance
|
|
141
|
+
*/
|
|
142
|
+
export declare function createPersEventsClient(config: EventsClientConfig): PersEventsClient;
|
|
143
|
+
//# sourceMappingURL=pers-events-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pers-events-client.d.ts","sourceRoot":"","sources":["../../src/events/pers-events-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAEf,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAE1B,UAAU,EACV,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAWjB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,MAAM,CAAoG;IAClH,OAAO,CAAC,KAAK,CAAmC;IAChD,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,gBAAgB,CAA8C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gBAAgB;IAkCxB,OAAO,CAAC,OAAO;IAiBf,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,GAAG;CAKZ;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAEnF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PERS Events Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for real-time blockchain event streaming.
|
|
5
|
+
* Re-exports types from @explorins/pers-shared for type consistency.
|
|
6
|
+
*
|
|
7
|
+
* @version 1.2.0 - Client-side subscription model
|
|
8
|
+
*/
|
|
9
|
+
export type { WalletInfo, WSClientMessageBase, SubscribeMessage, UnsubscribeMessage, PongMessage, WSClientMessage, ConnectedPayload, SubscribedPayload, UnsubscribedPayload, ErrorPayload, BlockchainEventType, BlockchainEvent, WSServerMessageConnected, WSServerMessageSubscribed, WSServerMessageUnsubscribed, WSServerMessageEvent, WSServerMessageError, WSServerMessagePing, WSServerMessage, } from '@explorins/pers-shared';
|
|
10
|
+
export { isServerMessage, isConnectedMessage, isEventMessage, isSubscribedMessage, isErrorMessage, } from '@explorins/pers-shared';
|
|
11
|
+
export type { BlockchainEventHandler, BlockchainEventUnsubscribe, EventConnectionState, } from '@explorins/web3-types';
|
|
12
|
+
export type { EventConnectionState as ConnectionState } from '@explorins/web3-types';
|
|
13
|
+
export type { WalletInfo as WalletTarget } from '@explorins/pers-shared';
|
|
14
|
+
/**
|
|
15
|
+
* Events client configuration
|
|
16
|
+
*/
|
|
17
|
+
export interface EventsClientConfig {
|
|
18
|
+
/** WS Relay server URL (wss://...) */
|
|
19
|
+
wsUrl: string;
|
|
20
|
+
/** Reconnect on disconnect */
|
|
21
|
+
autoReconnect?: boolean;
|
|
22
|
+
/** Max reconnect attempts (default: 10) */
|
|
23
|
+
maxReconnectAttempts?: number;
|
|
24
|
+
/** Reconnect delay in ms (default: 1000) */
|
|
25
|
+
reconnectDelay?: number;
|
|
26
|
+
/** Connection timeout in ms (default: 30000) */
|
|
27
|
+
connectionTimeout?: number;
|
|
28
|
+
/** Debug logging */
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
/** Token refresh callback for reconnection (optional) */
|
|
31
|
+
tokenRefresher?: () => Promise<string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Current subscription state (alias for SubscribedPayload)
|
|
35
|
+
*/
|
|
36
|
+
export type { SubscribedPayload as SubscriptionState } from '@explorins/pers-shared';
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/events/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAEV,UAAU,EAGV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,eAAe,EAGf,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,oBAAoB,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGrF,YAAY,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2CAA2C;IAC3C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC;AAED;;GAEG;AACH,YAAY,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persSdk = require('./chunks/pers-sdk-
|
|
3
|
+
var persSdk = require('./chunks/pers-sdk-Cv7hM1I7.cjs');
|
|
4
4
|
var persShared = require('@explorins/pers-shared');
|
|
5
5
|
var environment = require('./chunks/environment-C73snhIJ.cjs');
|
|
6
|
-
var index = require('./chunks/index-
|
|
7
|
-
var
|
|
6
|
+
var index = require('./chunks/index-CGaKfZNU.cjs');
|
|
7
|
+
var tenantManager = require('./chunks/tenant-manager-BUiFM33X.cjs');
|
|
8
8
|
var paginationUtils = require('./chunks/pagination-utils-B2jRHMSO.cjs');
|
|
9
9
|
var businessMembershipService = require('./chunks/business-membership-service-BfHzIQlc.cjs');
|
|
10
|
-
var transactionRequest_builder = require('./chunks/transaction-request.builder-
|
|
10
|
+
var transactionRequest_builder = require('./chunks/transaction-request.builder-CW3Wwdi3.cjs');
|
|
11
11
|
var analyticsService = require('./chunks/analytics-service-CF9AsMQH.cjs');
|
|
12
12
|
var campaign = require('./campaign.cjs');
|
|
13
13
|
var donation = require('./donation.cjs');
|
|
@@ -50,6 +50,7 @@ exports.LocalStorageTokenStorage = persSdk.LocalStorageTokenStorage;
|
|
|
50
50
|
exports.MemoryTokenStorage = persSdk.MemoryTokenStorage;
|
|
51
51
|
exports.PersApiClient = persSdk.PersApiClient;
|
|
52
52
|
exports.PersEventEmitter = persSdk.PersEventEmitter;
|
|
53
|
+
exports.PersEventsClient = persSdk.PersEventsClient;
|
|
53
54
|
exports.PersSDK = persSdk.PersSDK;
|
|
54
55
|
exports.PurchaseManager = persSdk.PurchaseManager;
|
|
55
56
|
exports.RedemptionManager = persSdk.RedemptionManager;
|
|
@@ -57,14 +58,19 @@ exports.SDK_NAME = persSdk.SDK_NAME;
|
|
|
57
58
|
exports.SDK_USER_AGENT = persSdk.SDK_USER_AGENT;
|
|
58
59
|
exports.SDK_VERSION = persSdk.SDK_VERSION;
|
|
59
60
|
exports.StaticJwtAuthProvider = persSdk.StaticJwtAuthProvider;
|
|
60
|
-
exports.TenantManager = persSdk.TenantManager;
|
|
61
61
|
exports.TokenManager = persSdk.TokenManager;
|
|
62
62
|
exports.TransactionManager = persSdk.TransactionManager;
|
|
63
63
|
exports.TriggerSourceManager = persSdk.TriggerSourceManager;
|
|
64
64
|
exports.UserManager = persSdk.UserManager;
|
|
65
65
|
exports.UserStatusManager = persSdk.UserStatusManager;
|
|
66
|
+
exports.WalletEventsManager = persSdk.WalletEventsManager;
|
|
66
67
|
exports.WebDPoPCryptoProvider = persSdk.WebDPoPCryptoProvider;
|
|
68
|
+
exports.WebhookApi = persSdk.WebhookApi;
|
|
69
|
+
exports.WebhookManager = persSdk.WebhookManager;
|
|
70
|
+
exports.WebhookService = persSdk.WebhookService;
|
|
67
71
|
exports.buildApiRoot = persSdk.buildApiRoot;
|
|
72
|
+
exports.buildWalletEventsWsUrl = persSdk.buildWalletEventsWsUrl;
|
|
73
|
+
exports.createPersEventsClient = persSdk.createPersEventsClient;
|
|
68
74
|
exports.createPersSDK = persSdk.createPersSDK;
|
|
69
75
|
exports.mergeWithDefaults = persSdk.mergeWithDefaults;
|
|
70
76
|
Object.defineProperty(exports, "AccountOwnerType", {
|
|
@@ -79,6 +85,26 @@ Object.defineProperty(exports, "VALID_USER_RELATIONS", {
|
|
|
79
85
|
enumerable: true,
|
|
80
86
|
get: function () { return persShared.VALID_USER_RELATIONS; }
|
|
81
87
|
});
|
|
88
|
+
Object.defineProperty(exports, "isConnectedMessage", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return persShared.isConnectedMessage; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "isErrorMessage", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return persShared.isErrorMessage; }
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "isEventMessage", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return persShared.isEventMessage; }
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "isServerMessage", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return persShared.isServerMessage; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "isSubscribedMessage", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return persShared.isSubscribedMessage; }
|
|
107
|
+
});
|
|
82
108
|
Object.defineProperty(exports, "isValidUserRelation", {
|
|
83
109
|
enumerable: true,
|
|
84
110
|
get: function () { return persShared.isValidUserRelation; }
|
|
@@ -87,17 +113,18 @@ exports.IndexedDBTokenStorage = environment.IndexedDBTokenStorage;
|
|
|
87
113
|
exports.detectEnvironment = environment.detectEnvironment;
|
|
88
114
|
exports.environment = environment.environment;
|
|
89
115
|
exports.warnIfProblematicEnvironment = environment.warnIfProblematicEnvironment;
|
|
116
|
+
exports.ApiErrorDetector = index.ApiErrorDetector;
|
|
117
|
+
exports.AuthenticationError = index.AuthenticationError;
|
|
90
118
|
exports.CacheService = index.CacheService;
|
|
91
119
|
exports.CacheTTL = index.CacheTTL;
|
|
120
|
+
exports.ErrorUtils = index.ErrorUtils;
|
|
121
|
+
exports.LogoutRequired = index.LogoutRequired;
|
|
122
|
+
exports.NetworkError = index.NetworkError;
|
|
123
|
+
exports.PersApiError = index.PersApiError;
|
|
124
|
+
exports.ProviderTokenRefreshNeeded = index.ProviderTokenRefreshNeeded;
|
|
125
|
+
exports.TokenRefreshNeeded = index.TokenRefreshNeeded;
|
|
92
126
|
exports.globalCacheService = index.globalCacheService;
|
|
93
|
-
exports.
|
|
94
|
-
exports.AuthenticationError = index$1.AuthenticationError;
|
|
95
|
-
exports.ErrorUtils = index$1.ErrorUtils;
|
|
96
|
-
exports.LogoutRequired = index$1.LogoutRequired;
|
|
97
|
-
exports.NetworkError = index$1.NetworkError;
|
|
98
|
-
exports.PersApiError = index$1.PersApiError;
|
|
99
|
-
exports.ProviderTokenRefreshNeeded = index$1.ProviderTokenRefreshNeeded;
|
|
100
|
-
exports.TokenRefreshNeeded = index$1.TokenRefreshNeeded;
|
|
127
|
+
exports.TenantManager = tenantManager.TenantManager;
|
|
101
128
|
exports.buildPaginationParams = paginationUtils.buildPaginationParams;
|
|
102
129
|
exports.extractData = paginationUtils.extractData;
|
|
103
130
|
exports.extractPagination = paginationUtils.extractPagination;
|
|
@@ -121,6 +148,7 @@ exports.buildTransferRequest = transactionRequest_builder.buildTransferRequest;
|
|
|
121
148
|
exports.extractDeadlineFromSigningData = transactionRequest_builder.extractDeadlineFromSigningData;
|
|
122
149
|
exports.getSigningUrl = transactionRequest_builder.getSigningUrl;
|
|
123
150
|
exports.needsExternalSigning = transactionRequest_builder.needsExternalSigning;
|
|
151
|
+
exports.needsSubmission = transactionRequest_builder.needsSubmission;
|
|
124
152
|
exports.AnalyticsApi = analyticsService.AnalyticsApi;
|
|
125
153
|
exports.AnalyticsService = analyticsService.AnalyticsService;
|
|
126
154
|
exports.CampaignApi = campaign.CampaignApi;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export * from './user';
|
|
|
20
20
|
export * from './user-status';
|
|
21
21
|
export * from './api-key';
|
|
22
22
|
export * from './trigger-source';
|
|
23
|
+
export * from './webhook';
|
|
24
|
+
export * from './events';
|
|
23
25
|
export type { CampaignClaimFilters, CampaignClaimQueryOptions } from './campaign';
|
|
24
26
|
export type { TransactionQueryOptions } from './transaction';
|
|
25
27
|
export type { RedemptionRedeemFilters, RedemptionRedeemQueryOptions } from './redemption';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,QAAQ,CAAA;AAGtB,cAAc,YAAY,CAAC;AAG3B,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAG3B,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,QAAQ,CAAC;AAGvB,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC;AAGvB,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAG1B,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,QAAQ,CAAA;AAGtB,cAAc,YAAY,CAAC;AAG3B,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAG3B,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,QAAQ,CAAC;AAGvB,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC;AAGvB,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAG1B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC;AAIzB,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAClF,YAAY,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC1F,YAAY,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASrD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGpD,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { b as AUTH_STORAGE_KEYS, v as AnalyticsManager,
|
|
1
|
+
export { b as AUTH_STORAGE_KEYS, v as AnalyticsManager, H as ApiKeyApi, u as ApiKeyManager, l as AuthApi, q as AuthManager, n as AuthService, A as AuthStatus, a as AuthTokenManager, B as BusinessManager, C as CampaignManager, h as DEFAULT_PERS_CONFIG, d as DPOP_STORAGE_KEYS, o as DPoPManager, D as DefaultAuthProvider, w as DonationManager, E as FileApi, F as FileManager, G as FileService, L as LocalStorageTokenStorage, M as MemoryTokenStorage, g as PersApiClient, p as PersEventEmitter, K as PersEventsClient, P as PersSDK, t as PurchaseManager, R as RedemptionManager, S as SDK_NAME, f as SDK_USER_AGENT, e as SDK_VERSION, k as StaticJwtAuthProvider, T as TokenManager, s as TransactionManager, x as TriggerSourceManager, U as UserManager, r as UserStatusManager, z as WalletEventsManager, W as WebDPoPCryptoProvider, I as WebhookApi, y as WebhookManager, J as WebhookService, i as buildApiRoot, j as buildWalletEventsWsUrl, N as createPersEventsClient, c as createPersSDK, m as mergeWithDefaults } from './chunks/pers-sdk-BiP7UMJ3.js';
|
|
2
2
|
export * from '@explorins/pers-shared';
|
|
3
|
-
export { AccountOwnerType, SortOrder, VALID_USER_RELATIONS, isValidUserRelation } from '@explorins/pers-shared';
|
|
3
|
+
export { AccountOwnerType, SortOrder, VALID_USER_RELATIONS, isConnectedMessage, isErrorMessage, isEventMessage, isServerMessage, isSubscribedMessage, isValidUserRelation } from '@explorins/pers-shared';
|
|
4
4
|
export { I as IndexedDBTokenStorage, d as detectEnvironment, e as environment, w as warnIfProblematicEnvironment } from './chunks/environment-CKVwRAEL.js';
|
|
5
|
-
export { a as CacheService, C as CacheTTL, g as globalCacheService } from './chunks/index-
|
|
6
|
-
export {
|
|
5
|
+
export { c as ApiErrorDetector, A as AuthenticationError, a as CacheService, C as CacheTTL, E as ErrorUtils, L as LogoutRequired, N as NetworkError, b as PersApiError, P as ProviderTokenRefreshNeeded, T as TokenRefreshNeeded, g as globalCacheService } from './chunks/index-DgTEdUgC.js';
|
|
6
|
+
export { T as TenantManager } from './chunks/tenant-manager-Bbj0bKoo.js';
|
|
7
7
|
export { b as buildPaginationParams, e as extractData, a as extractPagination, f as fetchAllPages, i as isPaginatedResponse, n as normalizeToPaginated } from './chunks/pagination-utils-9vQ-Npkr.js';
|
|
8
8
|
export { B as BusinessApi, a as BusinessMembershipApi, c as BusinessMembershipService, b as BusinessService } from './chunks/business-membership-service-CFa-TI39.js';
|
|
9
|
-
export { C as ClientTransactionType, T as TransactionApi, a as TransactionService, c as buildBurnRequest, b as buildMintRequest, f as buildPOSBurnRequest, e as buildPOSTransferRequest, i as buildPendingTransactionData, g as buildSubmissionRequest, d as buildTransferRequest, h as extractDeadlineFromSigningData,
|
|
9
|
+
export { C as ClientTransactionType, T as TransactionApi, a as TransactionService, c as buildBurnRequest, b as buildMintRequest, f as buildPOSBurnRequest, e as buildPOSTransferRequest, i as buildPendingTransactionData, g as buildSubmissionRequest, d as buildTransferRequest, h as extractDeadlineFromSigningData, k as getSigningUrl, n as needsExternalSigning, j as needsSubmission } from './chunks/transaction-request.builder-C3C19kCx.js';
|
|
10
10
|
export { A as AnalyticsApi, a as AnalyticsService } from './chunks/analytics-service-vm7B7LhS.js';
|
|
11
11
|
export { CampaignApi, CampaignService } from './campaign.js';
|
|
12
12
|
export { DonationApi, DonationService } from './donation.js';
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet Events Manager - Real-time blockchain events for user's wallets
|
|
3
|
+
*
|
|
4
|
+
* Provides automatic connection management and event routing integrated
|
|
5
|
+
* with the SDK's authentication flow and event system.
|
|
6
|
+
*
|
|
7
|
+
* Events are routed through the SDK's PersEventEmitter, so you can either:
|
|
8
|
+
* 1. Subscribe via `sdk.walletEvents.on()` for wallet-specific handling
|
|
9
|
+
* 2. Subscribe via `sdk.events.subscribe()` for unified event stream
|
|
10
|
+
*
|
|
11
|
+
* ## v1.2.0 - Subscription Model
|
|
12
|
+
*
|
|
13
|
+
* After connecting, you must explicitly subscribe to wallets or chains:
|
|
14
|
+
* - User SDK: `subscribeWallets([{ address, chainId }])`
|
|
15
|
+
* - Admin Dashboard: `subscribeChains([chainId1, chainId2])`
|
|
16
|
+
*
|
|
17
|
+
* For convenience, use `sdk.connectWalletEvents()` which auto-subscribes
|
|
18
|
+
* based on auth type.
|
|
19
|
+
*
|
|
20
|
+
* @example Manual subscription
|
|
21
|
+
* ```typescript
|
|
22
|
+
* await sdk.walletEvents.connect();
|
|
23
|
+
* await sdk.walletEvents.subscribeWallets([
|
|
24
|
+
* { address: user.wallets[0].address, chainId: 39123 }
|
|
25
|
+
* ]);
|
|
26
|
+
*
|
|
27
|
+
* sdk.walletEvents.on('Transfer', (event) => {
|
|
28
|
+
* console.log(`Received ${event.data.value} tokens`);
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example Auto-subscription (recommended)
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Auto-subscribes based on auth type (user/business/admin)
|
|
35
|
+
* await sdk.connectWalletEvents();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import type { PersApiClient } from '../core/pers-api-client';
|
|
39
|
+
import type { PersEventEmitter } from '../core/events';
|
|
40
|
+
import type { BlockchainEventType, BlockchainEventHandler, BlockchainEventUnsubscribe, ConnectionState, WalletInfo, SubscribedPayload } from '../events/types';
|
|
41
|
+
export interface WalletEventsConfig {
|
|
42
|
+
/** WS Relay server URL. If not provided, uses environment default. */
|
|
43
|
+
wsUrl?: string;
|
|
44
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
45
|
+
autoReconnect?: boolean;
|
|
46
|
+
/** Connection timeout in ms (default: 30000) */
|
|
47
|
+
connectionTimeout?: number;
|
|
48
|
+
/** Debug logging (default: false) */
|
|
49
|
+
debug?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Wallet Events Manager - Manages real-time blockchain event subscriptions
|
|
53
|
+
*
|
|
54
|
+
* Low-level WS client wrapper. For auto-subscription based on auth type,
|
|
55
|
+
* use `sdk.connectWalletEvents()` which handles subscription automatically.
|
|
56
|
+
*/
|
|
57
|
+
export declare class WalletEventsManager {
|
|
58
|
+
private apiClient;
|
|
59
|
+
private eventEmitter;
|
|
60
|
+
private client;
|
|
61
|
+
private config;
|
|
62
|
+
private pendingHandlers;
|
|
63
|
+
private unsubscribes;
|
|
64
|
+
constructor(apiClient: PersApiClient, eventEmitter: PersEventEmitter, config?: WalletEventsConfig);
|
|
65
|
+
/**
|
|
66
|
+
* Connect to real-time wallet events
|
|
67
|
+
*
|
|
68
|
+
* Establishes WebSocket connection to the WS relay server.
|
|
69
|
+
* After connecting, call subscribeWallets() or subscribeChains() to start
|
|
70
|
+
* receiving events.
|
|
71
|
+
*
|
|
72
|
+
* For auto-subscription, use `sdk.connectWalletEvents()` instead.
|
|
73
|
+
*/
|
|
74
|
+
connect(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Disconnect from real-time events
|
|
77
|
+
*/
|
|
78
|
+
disconnect(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Subscribe to wallet events
|
|
81
|
+
*
|
|
82
|
+
* Receives events only for the specified wallet addresses.
|
|
83
|
+
* Use this for user-facing SDK where you want to monitor specific wallets.
|
|
84
|
+
*
|
|
85
|
+
* @param wallets - Array of wallet info (address + chainId)
|
|
86
|
+
* @returns Promise that resolves when subscription is confirmed
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* await sdk.walletEvents.connect();
|
|
91
|
+
* await sdk.walletEvents.subscribeWallets([
|
|
92
|
+
* { address: '0x123...', chainId: 39123 }
|
|
93
|
+
* ]);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
subscribeWallets(wallets: WalletInfo[]): Promise<SubscribedPayload>;
|
|
97
|
+
/**
|
|
98
|
+
* Subscribe to chain events (Admin Dashboard)
|
|
99
|
+
*
|
|
100
|
+
* Receives ALL events on the specified chains.
|
|
101
|
+
* Use for admin dashboards that need to monitor all activity.
|
|
102
|
+
*
|
|
103
|
+
* @param chains - Array of chain IDs to subscribe to
|
|
104
|
+
* @returns Promise that resolves when subscription is confirmed
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* await sdk.walletEvents.connect();
|
|
109
|
+
* await sdk.walletEvents.subscribeChains([39123, 137]);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
subscribeChains(chains: number[]): Promise<SubscribedPayload>;
|
|
113
|
+
/**
|
|
114
|
+
* Unsubscribe from wallet events
|
|
115
|
+
*
|
|
116
|
+
* @param wallets - Array of wallet info to unsubscribe from
|
|
117
|
+
* @returns Promise that resolves when unsubscription is confirmed
|
|
118
|
+
*/
|
|
119
|
+
unsubscribeWallets(wallets: WalletInfo[]): Promise<SubscribedPayload>;
|
|
120
|
+
/**
|
|
121
|
+
* Unsubscribe from chain events
|
|
122
|
+
*
|
|
123
|
+
* @param chains - Array of chain IDs to unsubscribe from
|
|
124
|
+
* @returns Promise that resolves when unsubscription is confirmed
|
|
125
|
+
*/
|
|
126
|
+
unsubscribeChains(chains: number[]): Promise<SubscribedPayload>;
|
|
127
|
+
/**
|
|
128
|
+
* Get current subscription state
|
|
129
|
+
*/
|
|
130
|
+
getSubscriptionState(): SubscribedPayload;
|
|
131
|
+
/**
|
|
132
|
+
* Subscribe to blockchain events
|
|
133
|
+
*
|
|
134
|
+
* @param eventType - Event type ('Transfer', 'Approval', etc.) or '*' for all
|
|
135
|
+
* @param handler - Callback function when event is received
|
|
136
|
+
* @returns Unsubscribe function
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const unsub = sdk.walletEvents.on('Transfer', (event) => {
|
|
141
|
+
* console.log(`Transfer: ${event.data.from} -> ${event.data.to}`);
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* // Later: stop listening
|
|
145
|
+
* unsub();
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
on(eventType: BlockchainEventType | '*', handler: BlockchainEventHandler): BlockchainEventUnsubscribe;
|
|
149
|
+
/**
|
|
150
|
+
* Subscribe to connection state changes
|
|
151
|
+
*/
|
|
152
|
+
onStateChange(handler: (state: ConnectionState) => void): BlockchainEventUnsubscribe;
|
|
153
|
+
/**
|
|
154
|
+
* Get current connection state
|
|
155
|
+
*/
|
|
156
|
+
getState(): ConnectionState;
|
|
157
|
+
/**
|
|
158
|
+
* Check if connected
|
|
159
|
+
*/
|
|
160
|
+
isConnected(): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Get connection info (wallets, active chains)
|
|
163
|
+
*/
|
|
164
|
+
getConnectionInfo(): {
|
|
165
|
+
userId: string;
|
|
166
|
+
wallets: WalletInfo[];
|
|
167
|
+
activeChains: number[];
|
|
168
|
+
} | null | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Build a descriptive message for blockchain events
|
|
171
|
+
* Neutral tone - frontend will handle user-facing presentation
|
|
172
|
+
*/
|
|
173
|
+
private buildUserMessage;
|
|
174
|
+
/**
|
|
175
|
+
* Route blockchain event to PersEventEmitter for unified event stream
|
|
176
|
+
*/
|
|
177
|
+
private emitToPersEvents;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=events-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-manager.d.ts","sourceRoot":"","sources":["../../src/managers/events-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAEV,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,UAAU,EACV,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;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AAgB;CAiBzB"}
|
package/dist/managers/index.d.ts
CHANGED
|
@@ -19,4 +19,6 @@ export { ApiKeyManager } from './api-key-manager';
|
|
|
19
19
|
export { AnalyticsManager } from './analytics-manager';
|
|
20
20
|
export { DonationManager } from './donation-manager';
|
|
21
21
|
export { TriggerSourceManager } from './trigger-source-manager';
|
|
22
|
+
export { WebhookManager } from './webhook-manager';
|
|
23
|
+
export { WalletEventsManager, type WalletEventsConfig } from './events-manager';
|
|
22
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -8,10 +8,13 @@ import type { TenantPublicDTO, TenantClientConfigDTO, AdminDTO, AdminCreateReque
|
|
|
8
8
|
*
|
|
9
9
|
* Provides a simplified API for common tenant management tasks while maintaining
|
|
10
10
|
* access to the full tenant SDK for advanced use cases.
|
|
11
|
+
*
|
|
12
|
+
* Also provides chain-agnostic IPFS URL resolution using tenant configuration.
|
|
11
13
|
*/
|
|
12
14
|
export declare class TenantManager {
|
|
13
15
|
private apiClient;
|
|
14
16
|
private tenantService;
|
|
17
|
+
private cache;
|
|
15
18
|
constructor(apiClient: PersApiClient);
|
|
16
19
|
/**
|
|
17
20
|
* Get current tenant information
|
|
@@ -26,11 +29,45 @@ export declare class TenantManager {
|
|
|
26
29
|
*/
|
|
27
30
|
getLoginToken(): Promise<string>;
|
|
28
31
|
/**
|
|
29
|
-
* Get tenant client configuration
|
|
32
|
+
* Get tenant client configuration (cached)
|
|
30
33
|
*
|
|
31
34
|
* @returns Promise resolving to client config
|
|
32
35
|
*/
|
|
33
36
|
getClientConfig(): Promise<TenantClientConfigDTO>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve IPFS URL to HTTPS URL using tenant's configured gateway.
|
|
39
|
+
*
|
|
40
|
+
* This is chain-agnostic - IPFS gateway is configured at the tenant level,
|
|
41
|
+
* not per-chain. Use this for resolving any ipfs:// URLs (images, metadata, etc.).
|
|
42
|
+
*
|
|
43
|
+
* @param url - URL to resolve (can be ipfs:// or https://)
|
|
44
|
+
* @returns Resolved HTTPS URL
|
|
45
|
+
* @throws Error if tenant's ipfsGatewayDomain is not configured
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const imageUrl = await sdk.tenant.resolveIPFSUrl('ipfs://QmXxx.../image.png');
|
|
50
|
+
* // Returns: 'https://pers.mypinata.cloud/ipfs/QmXxx.../image.png'
|
|
51
|
+
*
|
|
52
|
+
* // Non-IPFS URLs pass through unchanged
|
|
53
|
+
* const httpUrl = await sdk.tenant.resolveIPFSUrl('https://example.com/image.png');
|
|
54
|
+
* // Returns: 'https://example.com/image.png'
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
resolveIPFSUrl(url: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Get IPFS gateway domain from tenant configuration (cached).
|
|
60
|
+
*
|
|
61
|
+
* @returns IPFS gateway domain (e.g., 'pers.mypinata.cloud')
|
|
62
|
+
* @throws Error if ipfsGatewayDomain is not configured for this tenant
|
|
63
|
+
*/
|
|
64
|
+
getIpfsGatewayDomain(): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Get Google API key from tenant configuration (cached).
|
|
67
|
+
*
|
|
68
|
+
* @returns Google API key or undefined if not configured
|
|
69
|
+
*/
|
|
70
|
+
getGoogleApiKey(): Promise<string | undefined>;
|
|
34
71
|
/**
|
|
35
72
|
* Admin: Update tenant data
|
|
36
73
|
*
|
|
@@ -66,5 +103,9 @@ export declare class TenantManager {
|
|
|
66
103
|
* @returns TenantService instance
|
|
67
104
|
*/
|
|
68
105
|
getTenantService(): TenantService;
|
|
106
|
+
/**
|
|
107
|
+
* Clear tenant cache (useful after config changes)
|
|
108
|
+
*/
|
|
109
|
+
clearCache(): void;
|
|
69
110
|
}
|
|
70
111
|
//# sourceMappingURL=tenant-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-manager.d.ts","sourceRoot":"","sources":["../../src/managers/tenant-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAa,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"tenant-manager.d.ts","sourceRoot":"","sources":["../../src/managers/tenant-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAa,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAEV,eAAe,EACf,qBAAqB,EACr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