@movebridge/core 0.1.0 → 0.2.1
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/index.d.mts +275 -67
- package/dist/index.d.ts +275 -67
- package/dist/index.js +610 -160
- package/dist/index.mjs +610 -160
- package/package.json +52 -52
- package/LICENSE +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -37,7 +37,11 @@ interface Transaction {
|
|
|
37
37
|
hash: string;
|
|
38
38
|
sender: string;
|
|
39
39
|
sequenceNumber: string;
|
|
40
|
-
payload:
|
|
40
|
+
payload: {
|
|
41
|
+
function: string;
|
|
42
|
+
typeArguments: string[];
|
|
43
|
+
functionArguments: unknown[];
|
|
44
|
+
};
|
|
41
45
|
timestamp: string;
|
|
42
46
|
}
|
|
43
47
|
/** Transaction response after confirmation */
|
|
@@ -48,12 +52,14 @@ interface TransactionResponse {
|
|
|
48
52
|
gasUsed: string;
|
|
49
53
|
events: ContractEvent[];
|
|
50
54
|
}
|
|
51
|
-
/** Transaction payload for entry functions */
|
|
55
|
+
/** Transaction payload for entry functions (AIP-62 compatible) */
|
|
52
56
|
interface TransactionPayload {
|
|
53
|
-
|
|
57
|
+
/** Entry function identifier: address::module::function */
|
|
54
58
|
function: string;
|
|
59
|
+
/** Type arguments for generic functions */
|
|
55
60
|
typeArguments: string[];
|
|
56
|
-
arguments
|
|
61
|
+
/** Function arguments */
|
|
62
|
+
functionArguments: unknown[];
|
|
57
63
|
}
|
|
58
64
|
/** Signed transaction ready for submission */
|
|
59
65
|
interface SignedTransaction {
|
|
@@ -97,9 +103,20 @@ interface ContractOptions {
|
|
|
97
103
|
address: string;
|
|
98
104
|
module: string;
|
|
99
105
|
}
|
|
100
|
-
/** Event subscription configuration */
|
|
106
|
+
/** Event subscription configuration (new format) */
|
|
101
107
|
interface EventSubscription {
|
|
108
|
+
/** Account address to watch for events */
|
|
109
|
+
accountAddress: string;
|
|
110
|
+
/** Event type (e.g., '0x1::coin::DepositEvent') */
|
|
111
|
+
eventType: string;
|
|
112
|
+
/** Callback function when events are received */
|
|
113
|
+
callback: (event: ContractEvent) => void;
|
|
114
|
+
}
|
|
115
|
+
/** Legacy event subscription (backward compatible) */
|
|
116
|
+
interface LegacyEventSubscription$1 {
|
|
117
|
+
/** Event handle in format: 0xADDRESS::module::EventType */
|
|
102
118
|
eventHandle: string;
|
|
119
|
+
/** Callback function when events are received */
|
|
103
120
|
callback: (event: ContractEvent) => void;
|
|
104
121
|
}
|
|
105
122
|
|
|
@@ -109,6 +126,20 @@ interface EventSubscription {
|
|
|
109
126
|
* Uses Aptos Wallet Standard (AIP-62) for wallet interactions
|
|
110
127
|
*/
|
|
111
128
|
|
|
129
|
+
/**
|
|
130
|
+
* AIP-62 Transaction Payload format
|
|
131
|
+
*/
|
|
132
|
+
interface AIP62TransactionPayload {
|
|
133
|
+
payload: {
|
|
134
|
+
function: string;
|
|
135
|
+
typeArguments: string[];
|
|
136
|
+
functionArguments: unknown[];
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Unified wallet adapter interface
|
|
141
|
+
* Abstracts different wallet implementations into a common interface
|
|
142
|
+
*/
|
|
112
143
|
interface UnifiedWalletAdapter {
|
|
113
144
|
name: string;
|
|
114
145
|
icon: string;
|
|
@@ -117,16 +148,38 @@ interface UnifiedWalletAdapter {
|
|
|
117
148
|
publicKey: string;
|
|
118
149
|
}>;
|
|
119
150
|
disconnect(): Promise<void>;
|
|
120
|
-
signAndSubmitTransaction(payload:
|
|
151
|
+
signAndSubmitTransaction(payload: AIP62TransactionPayload): Promise<{
|
|
121
152
|
hash: string;
|
|
122
153
|
}>;
|
|
123
|
-
signTransaction(payload:
|
|
154
|
+
signTransaction(payload: AIP62TransactionPayload): Promise<Uint8Array>;
|
|
124
155
|
onAccountChange(cb: (account: {
|
|
125
156
|
address: string;
|
|
126
157
|
publicKey: string;
|
|
127
158
|
} | null) => void): void;
|
|
128
159
|
onNetworkChange(cb: (network: string) => void): void;
|
|
129
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Wallet Manager
|
|
163
|
+
* Manages wallet detection, connection, and state
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const walletManager = new WalletManager();
|
|
168
|
+
*
|
|
169
|
+
* // Detect available wallets
|
|
170
|
+
* const wallets = walletManager.detectWallets();
|
|
171
|
+
*
|
|
172
|
+
* // Connect to a wallet
|
|
173
|
+
* await walletManager.connect('razor');
|
|
174
|
+
*
|
|
175
|
+
* // Get current state
|
|
176
|
+
* const state = walletManager.getState();
|
|
177
|
+
* console.log(state.address);
|
|
178
|
+
*
|
|
179
|
+
* // Disconnect
|
|
180
|
+
* await walletManager.disconnect();
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
130
183
|
declare class WalletManager extends EventEmitter<WalletEvents> {
|
|
131
184
|
private state;
|
|
132
185
|
private currentWallet;
|
|
@@ -134,18 +187,50 @@ declare class WalletManager extends EventEmitter<WalletEvents> {
|
|
|
134
187
|
private standardWallets;
|
|
135
188
|
private detectedWallets;
|
|
136
189
|
private unsubscribe;
|
|
190
|
+
/**
|
|
191
|
+
* Detects available wallets using AIP-62 standard
|
|
192
|
+
* @returns Array of detected wallet types
|
|
193
|
+
*/
|
|
137
194
|
detectWallets(): WalletType[];
|
|
195
|
+
/**
|
|
196
|
+
* Gets detailed wallet information for UI display
|
|
197
|
+
* @returns Array of wallet info objects
|
|
198
|
+
*/
|
|
138
199
|
getWalletInfo(): Array<{
|
|
139
200
|
type: WalletType;
|
|
140
201
|
name: string;
|
|
141
202
|
icon: string;
|
|
142
203
|
}>;
|
|
204
|
+
/**
|
|
205
|
+
* Connects to a wallet
|
|
206
|
+
* @param wallet - Wallet type to connect to
|
|
207
|
+
* @throws MovementError if wallet not found or connection fails
|
|
208
|
+
*/
|
|
143
209
|
connect(wallet: WalletType): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Disconnects from the current wallet
|
|
212
|
+
*/
|
|
144
213
|
disconnect(): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Gets the current wallet state
|
|
216
|
+
*/
|
|
145
217
|
getState(): WalletState;
|
|
218
|
+
/**
|
|
219
|
+
* Gets the currently connected wallet type
|
|
220
|
+
*/
|
|
146
221
|
getWallet(): WalletType | null;
|
|
222
|
+
/**
|
|
223
|
+
* Gets the wallet adapter for direct access
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
147
226
|
getAdapter(): UnifiedWalletAdapter | null;
|
|
227
|
+
/**
|
|
228
|
+
* Attempts to auto-connect to the last used wallet
|
|
229
|
+
*/
|
|
148
230
|
autoConnect(): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Cleans up resources
|
|
233
|
+
*/
|
|
149
234
|
destroy(): void;
|
|
150
235
|
private setupEventListeners;
|
|
151
236
|
private saveLastWallet;
|
|
@@ -155,7 +240,7 @@ declare class WalletManager extends EventEmitter<WalletEvents> {
|
|
|
155
240
|
|
|
156
241
|
/**
|
|
157
242
|
* @movebridge/core - Transaction Builder
|
|
158
|
-
* Constructs, signs, and submits transactions
|
|
243
|
+
* Constructs, signs, and submits transactions using AIP-62 wallet standard
|
|
159
244
|
*/
|
|
160
245
|
|
|
161
246
|
/**
|
|
@@ -164,22 +249,19 @@ declare class WalletManager extends EventEmitter<WalletEvents> {
|
|
|
164
249
|
*
|
|
165
250
|
* @example
|
|
166
251
|
* ```typescript
|
|
167
|
-
* // Transfer tokens
|
|
168
|
-
* const
|
|
252
|
+
* // Transfer tokens using aptos_account::transfer (recommended)
|
|
253
|
+
* const hash = await movement.transaction.transfer({
|
|
169
254
|
* to: '0x123...',
|
|
170
|
-
* amount: '1000000',
|
|
255
|
+
* amount: '1000000', // in octas
|
|
171
256
|
* });
|
|
172
257
|
*
|
|
173
|
-
* // Build custom transaction
|
|
174
|
-
* const
|
|
175
|
-
* function: '0x1::
|
|
176
|
-
* typeArguments: [
|
|
258
|
+
* // Build and submit custom transaction
|
|
259
|
+
* const payload = await movement.transaction.build({
|
|
260
|
+
* function: '0x1::aptos_account::transfer',
|
|
261
|
+
* typeArguments: [],
|
|
177
262
|
* arguments: ['0x123...', '1000000'],
|
|
178
263
|
* });
|
|
179
|
-
*
|
|
180
|
-
* // Sign and submit
|
|
181
|
-
* const signed = await movement.transaction.sign(tx);
|
|
182
|
-
* const hash = await movement.transaction.submit(signed);
|
|
264
|
+
* const hash = await movement.transaction.signAndSubmit(payload);
|
|
183
265
|
* ```
|
|
184
266
|
*/
|
|
185
267
|
declare class TransactionBuilder {
|
|
@@ -188,50 +270,51 @@ declare class TransactionBuilder {
|
|
|
188
270
|
constructor(aptosClient: Aptos, walletManager: WalletManager);
|
|
189
271
|
/**
|
|
190
272
|
* Builds a transfer transaction payload
|
|
273
|
+
* Uses 0x1::aptos_account::transfer which handles account creation
|
|
191
274
|
* @param options - Transfer options
|
|
192
|
-
* @returns Transaction payload
|
|
275
|
+
* @returns Transaction payload ready for signing
|
|
193
276
|
*/
|
|
194
277
|
transfer(options: TransferOptions): Promise<TransactionPayload>;
|
|
195
278
|
/**
|
|
196
279
|
* Builds a generic transaction payload
|
|
197
|
-
* @param options - Build options
|
|
198
|
-
* @returns Transaction payload
|
|
280
|
+
* @param options - Build options with function, typeArguments, and arguments
|
|
281
|
+
* @returns Transaction payload ready for signing
|
|
199
282
|
*/
|
|
200
283
|
build(options: BuildOptions): Promise<TransactionPayload>;
|
|
201
|
-
/**
|
|
202
|
-
* Signs a transaction payload
|
|
203
|
-
* @param payload - Transaction payload to sign
|
|
204
|
-
* @returns Signed transaction
|
|
205
|
-
* @throws MovementError with code WALLET_NOT_CONNECTED if no wallet is connected
|
|
206
|
-
*/
|
|
207
|
-
sign(payload: TransactionPayload): Promise<SignedTransaction>;
|
|
208
|
-
/**
|
|
209
|
-
* Submits a signed transaction to the network
|
|
210
|
-
* @param signed - Signed transaction
|
|
211
|
-
* @returns Transaction hash
|
|
212
|
-
*/
|
|
213
|
-
submit(signed: SignedTransaction): Promise<string>;
|
|
214
284
|
/**
|
|
215
285
|
* Signs and submits a transaction in one step
|
|
286
|
+
* This is the recommended method for most use cases
|
|
216
287
|
* @param payload - Transaction payload
|
|
217
288
|
* @returns Transaction hash
|
|
289
|
+
* @throws MovementError with code WALLET_NOT_CONNECTED if no wallet connected
|
|
290
|
+
* @throws MovementError with code TRANSACTION_FAILED if submission fails
|
|
291
|
+
*
|
|
292
|
+
* Note: Transaction failures do NOT affect wallet connection state.
|
|
293
|
+
* The wallet remains connected even if a transaction fails.
|
|
218
294
|
*/
|
|
219
295
|
signAndSubmit(payload: TransactionPayload): Promise<string>;
|
|
220
296
|
/**
|
|
221
297
|
* Simulates a transaction without submitting
|
|
298
|
+
* Useful for gas estimation and checking if transaction will succeed
|
|
222
299
|
* @param payload - Transaction payload
|
|
223
|
-
* @returns Simulation result with gas estimate
|
|
300
|
+
* @returns Simulation result with success status and gas estimate
|
|
224
301
|
*/
|
|
225
302
|
simulate(payload: TransactionPayload): Promise<{
|
|
226
303
|
success: boolean;
|
|
227
304
|
gasUsed: string;
|
|
228
305
|
vmStatus: string;
|
|
229
306
|
}>;
|
|
307
|
+
/**
|
|
308
|
+
* Convenience method: Transfer and wait for confirmation
|
|
309
|
+
* @param options - Transfer options
|
|
310
|
+
* @returns Transaction hash
|
|
311
|
+
*/
|
|
312
|
+
transferAndSubmit(options: TransferOptions): Promise<string>;
|
|
230
313
|
}
|
|
231
314
|
|
|
232
315
|
/**
|
|
233
316
|
* @movebridge/core - Contract Interface
|
|
234
|
-
* Simplified interface for
|
|
317
|
+
* Simplified interface for Move module interactions
|
|
235
318
|
*/
|
|
236
319
|
|
|
237
320
|
/**
|
|
@@ -241,15 +324,15 @@ declare class TransactionBuilder {
|
|
|
241
324
|
* @example
|
|
242
325
|
* ```typescript
|
|
243
326
|
* const contract = movement.contract({
|
|
244
|
-
* address: '
|
|
245
|
-
* module: '
|
|
327
|
+
* address: '0x1',
|
|
328
|
+
* module: 'coin',
|
|
246
329
|
* });
|
|
247
330
|
*
|
|
248
|
-
* // Read (view function)
|
|
249
|
-
* const
|
|
331
|
+
* // Read (view function) - no wallet needed
|
|
332
|
+
* const balance = await contract.view('balance', ['0x123...'], ['0x1::aptos_coin::AptosCoin']);
|
|
250
333
|
*
|
|
251
|
-
* // Write (entry function)
|
|
252
|
-
* const txHash = await contract.call('
|
|
334
|
+
* // Write (entry function) - requires connected wallet
|
|
335
|
+
* const txHash = await contract.call('transfer', ['0x456...', '1000000'], ['0x1::aptos_coin::AptosCoin']);
|
|
253
336
|
* ```
|
|
254
337
|
*/
|
|
255
338
|
declare class ContractInterface {
|
|
@@ -262,33 +345,67 @@ declare class ContractInterface {
|
|
|
262
345
|
constructor(aptosClient: Aptos, walletManager: WalletManager, options: ContractOptions);
|
|
263
346
|
/**
|
|
264
347
|
* Calls a view function (read-only)
|
|
348
|
+
* View functions don't require a wallet connection
|
|
349
|
+
*
|
|
265
350
|
* @param functionName - Name of the view function
|
|
266
351
|
* @param args - Function arguments
|
|
267
|
-
* @param typeArgs - Type arguments
|
|
352
|
+
* @param typeArgs - Type arguments for generic functions
|
|
268
353
|
* @returns Function result
|
|
269
354
|
* @throws MovementError with code VIEW_FUNCTION_FAILED if call fails
|
|
270
|
-
|
|
271
|
-
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```typescript
|
|
358
|
+
* // Get coin balance
|
|
359
|
+
* const balance = await contract.view('balance', [address], ['0x1::aptos_coin::AptosCoin']);
|
|
360
|
+
*
|
|
361
|
+
* // Check if account exists
|
|
362
|
+
* const exists = await contract.view('exists_at', [address]);
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
view<T = unknown>(functionName: string, args?: unknown[], typeArgs?: string[]): Promise<T>;
|
|
272
366
|
/**
|
|
273
367
|
* Calls an entry function (write operation)
|
|
368
|
+
* Requires a connected wallet
|
|
369
|
+
*
|
|
274
370
|
* @param functionName - Name of the entry function
|
|
275
371
|
* @param args - Function arguments
|
|
276
|
-
* @param typeArgs - Type arguments
|
|
372
|
+
* @param typeArgs - Type arguments for generic functions
|
|
277
373
|
* @returns Transaction hash
|
|
278
|
-
* @throws MovementError with code WALLET_NOT_CONNECTED if no wallet
|
|
374
|
+
* @throws MovementError with code WALLET_NOT_CONNECTED if no wallet connected
|
|
279
375
|
* @throws MovementError with code TRANSACTION_FAILED if transaction fails
|
|
280
|
-
|
|
281
|
-
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```typescript
|
|
379
|
+
* // Transfer coins
|
|
380
|
+
* const txHash = await contract.call('transfer', [recipient, amount], ['0x1::aptos_coin::AptosCoin']);
|
|
381
|
+
*
|
|
382
|
+
* // Call a custom function
|
|
383
|
+
* const txHash = await contract.call('increment', []);
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
call(functionName: string, args?: unknown[], typeArgs?: string[]): Promise<string>;
|
|
282
387
|
/**
|
|
283
388
|
* Checks if a resource exists at the contract address
|
|
284
|
-
* @param resourceType - Full resource type
|
|
389
|
+
* @param resourceType - Full resource type
|
|
285
390
|
* @returns true if resource exists
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```typescript
|
|
394
|
+
* const hasCoin = await contract.hasResource('0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>');
|
|
395
|
+
* ```
|
|
286
396
|
*/
|
|
287
397
|
hasResource(resourceType: string): Promise<boolean>;
|
|
288
398
|
/**
|
|
289
399
|
* Gets a resource from the contract address
|
|
290
400
|
* @param resourceType - Full resource type
|
|
291
401
|
* @returns Resource data or null if not found
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* const coinStore = await contract.getResource<{ coin: { value: string } }>(
|
|
406
|
+
* '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>'
|
|
407
|
+
* );
|
|
408
|
+
* ```
|
|
292
409
|
*/
|
|
293
410
|
getResource<T = unknown>(resourceType: string): Promise<T | null>;
|
|
294
411
|
/**
|
|
@@ -301,25 +418,46 @@ declare class ContractInterface {
|
|
|
301
418
|
|
|
302
419
|
/**
|
|
303
420
|
* @movebridge/core - Event Listener
|
|
304
|
-
* Subscribes to and handles
|
|
421
|
+
* Subscribes to and handles blockchain events via polling
|
|
305
422
|
*/
|
|
306
423
|
|
|
424
|
+
/**
|
|
425
|
+
* Event subscription configuration
|
|
426
|
+
*/
|
|
427
|
+
interface EventSubscriptionConfig {
|
|
428
|
+
/** Account address to watch for events */
|
|
429
|
+
accountAddress: string;
|
|
430
|
+
/** Event type (e.g., '0x1::coin::DepositEvent') */
|
|
431
|
+
eventType: string;
|
|
432
|
+
/** Callback function when events are received */
|
|
433
|
+
callback: (event: ContractEvent) => void;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Legacy event subscription (for backward compatibility)
|
|
437
|
+
*/
|
|
438
|
+
interface LegacyEventSubscription {
|
|
439
|
+
/** Event handle in format: 0xADDRESS::module::EventType */
|
|
440
|
+
eventHandle: string;
|
|
441
|
+
/** Callback function when events are received */
|
|
442
|
+
callback: (event: ContractEvent) => void;
|
|
443
|
+
}
|
|
307
444
|
/**
|
|
308
445
|
* Event Listener
|
|
309
|
-
* Manages event subscriptions and polling
|
|
446
|
+
* Manages event subscriptions and polling for blockchain events
|
|
310
447
|
*
|
|
311
448
|
* @example
|
|
312
449
|
* ```typescript
|
|
313
|
-
* // Subscribe to events
|
|
314
|
-
* const
|
|
315
|
-
*
|
|
450
|
+
* // Subscribe to deposit events for an account
|
|
451
|
+
* const subId = movement.events.subscribe({
|
|
452
|
+
* accountAddress: '0x123...',
|
|
453
|
+
* eventType: '0x1::coin::DepositEvent',
|
|
316
454
|
* callback: (event) => {
|
|
317
|
-
* console.log('
|
|
455
|
+
* console.log('Deposit received:', event.data);
|
|
318
456
|
* },
|
|
319
457
|
* });
|
|
320
458
|
*
|
|
321
|
-
* // Unsubscribe
|
|
322
|
-
* movement.events.unsubscribe(
|
|
459
|
+
* // Unsubscribe when done
|
|
460
|
+
* movement.events.unsubscribe(subId);
|
|
323
461
|
* ```
|
|
324
462
|
*/
|
|
325
463
|
declare class EventListener {
|
|
@@ -331,12 +469,40 @@ declare class EventListener {
|
|
|
331
469
|
pollIntervalMs?: number;
|
|
332
470
|
});
|
|
333
471
|
/**
|
|
334
|
-
* Subscribes to
|
|
472
|
+
* Subscribes to blockchain events
|
|
473
|
+
* Supports both new format (accountAddress + eventType) and legacy format (eventHandle)
|
|
474
|
+
*
|
|
335
475
|
* @param subscription - Subscription configuration
|
|
336
|
-
* @returns Subscription ID
|
|
337
|
-
*
|
|
338
|
-
|
|
339
|
-
|
|
476
|
+
* @returns Subscription ID for unsubscribing
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* // New format (recommended)
|
|
481
|
+
* const subId = events.subscribe({
|
|
482
|
+
* accountAddress: '0x1',
|
|
483
|
+
* eventType: '0x1::coin::DepositEvent',
|
|
484
|
+
* callback: (event) => console.log(event),
|
|
485
|
+
* });
|
|
486
|
+
*
|
|
487
|
+
* // Legacy format (backward compatible)
|
|
488
|
+
* const subId = events.subscribe({
|
|
489
|
+
* eventHandle: '0x1::coin::DepositEvent',
|
|
490
|
+
* callback: (event) => console.log(event),
|
|
491
|
+
* });
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
494
|
+
subscribe(subscription: EventSubscriptionConfig | LegacyEventSubscription): string;
|
|
495
|
+
/**
|
|
496
|
+
* Parses a legacy event handle into account address and event type
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
private parseEventHandle;
|
|
500
|
+
/**
|
|
501
|
+
* Validates event type format
|
|
502
|
+
* Expected format: address::module::EventType
|
|
503
|
+
* @internal
|
|
504
|
+
*/
|
|
505
|
+
private isValidEventType;
|
|
340
506
|
/**
|
|
341
507
|
* Unsubscribes from events
|
|
342
508
|
* @param subscriptionId - Subscription ID to remove
|
|
@@ -358,10 +524,52 @@ declare class EventListener {
|
|
|
358
524
|
*/
|
|
359
525
|
hasSubscription(subscriptionId: string): boolean;
|
|
360
526
|
/**
|
|
361
|
-
* Polls for new events
|
|
362
|
-
* @
|
|
527
|
+
* Polls for new events for a subscription
|
|
528
|
+
* @internal
|
|
363
529
|
*/
|
|
364
530
|
private pollEvents;
|
|
531
|
+
/**
|
|
532
|
+
* Fetches events from the blockchain
|
|
533
|
+
* Handles different API response formats and fallback methods
|
|
534
|
+
* @internal
|
|
535
|
+
*/
|
|
536
|
+
private fetchEvents;
|
|
537
|
+
/**
|
|
538
|
+
* Fetches events using the event handle API
|
|
539
|
+
* @internal
|
|
540
|
+
*/
|
|
541
|
+
private fetchEventsViaEventHandle;
|
|
542
|
+
/**
|
|
543
|
+
* Fetches events by checking account resources
|
|
544
|
+
* This is a fallback method when indexer is not available
|
|
545
|
+
* @internal
|
|
546
|
+
*/
|
|
547
|
+
private fetchEventsViaResources;
|
|
548
|
+
/**
|
|
549
|
+
* Gets the fullnode URL from the Aptos client config
|
|
550
|
+
* @internal
|
|
551
|
+
*/
|
|
552
|
+
private getFullnodeUrl;
|
|
553
|
+
/**
|
|
554
|
+
* Sorts events by sequence number in ascending order
|
|
555
|
+
* @internal
|
|
556
|
+
*/
|
|
557
|
+
private sortEventsBySequence;
|
|
558
|
+
/**
|
|
559
|
+
* Parses sequence number from various formats
|
|
560
|
+
* @internal
|
|
561
|
+
*/
|
|
562
|
+
private parseSequenceNumber;
|
|
563
|
+
/**
|
|
564
|
+
* Normalizes event data to a consistent format
|
|
565
|
+
* @internal
|
|
566
|
+
*/
|
|
567
|
+
private normalizeEventData;
|
|
568
|
+
/**
|
|
569
|
+
* Safely invokes a callback without letting errors propagate
|
|
570
|
+
* @internal
|
|
571
|
+
*/
|
|
572
|
+
private safeInvokeCallback;
|
|
365
573
|
}
|
|
366
574
|
|
|
367
575
|
/**
|
|
@@ -599,4 +807,4 @@ declare function isMovementError(error: unknown): error is MovementError;
|
|
|
599
807
|
*/
|
|
600
808
|
declare function wrapError(error: unknown, code: ErrorCode, context?: string): MovementError;
|
|
601
809
|
|
|
602
|
-
export { type BuildOptions, type ContractEvent, ContractInterface, type ContractOptions, DEFAULT_COIN_TYPE, type ErrorCode, type ErrorDetails, Errors, EventListener, type EventSubscription, Movement, type MovementConfig, MovementError, NETWORK_CONFIG, type NetworkConfig, type NetworkType, type ResolvedConfig, type Resource, type SignedTransaction, type Transaction, TransactionBuilder, type TransactionPayload, type TransactionResponse, type TransferOptions, type WalletEvents, WalletManager, type WalletState, type WalletType, getExplorerAccountUrl, getExplorerTxUrl, isMovementError, isValidAddress, isValidEventHandle, resolveConfig, wrapError };
|
|
810
|
+
export { type BuildOptions, type ContractEvent, ContractInterface, type ContractOptions, DEFAULT_COIN_TYPE, type ErrorCode, type ErrorDetails, Errors, EventListener, type EventSubscription, type EventSubscriptionConfig, type LegacyEventSubscription$1 as LegacyEventSubscription, Movement, type MovementConfig, MovementError, NETWORK_CONFIG, type NetworkConfig, type NetworkType, type ResolvedConfig, type Resource, type SignedTransaction, type Transaction, TransactionBuilder, type TransactionPayload, type TransactionResponse, type TransferOptions, type WalletEvents, WalletManager, type WalletState, type WalletType, getExplorerAccountUrl, getExplorerTxUrl, isMovementError, isValidAddress, isValidEventHandle, resolveConfig, wrapError };
|