@0xio/sdk 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -33
- package/README.md +105 -250
- package/dist/index.d.ts +279 -188
- package/dist/index.esm.js +524 -325
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +533 -324
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +533 -324
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 0xio SDK
|
|
2
|
+
* 0xio SDK: Wallet Transport Adapter Interface
|
|
3
3
|
*
|
|
4
4
|
* Implement WalletTransportAdapter to add support for a new wallet without
|
|
5
5
|
* touching any core SDK code. Drop the adapter file in src/supports/ and
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
|
-
* Outbound request
|
|
20
|
+
* Outbound request: the SDK passes this to adapter.postRequest() for every
|
|
21
21
|
* outbound wallet call. Adapters translate this into their wallet-specific wire format.
|
|
22
22
|
*/
|
|
23
23
|
interface AdapterRequest {
|
|
@@ -63,8 +63,8 @@ interface AdapterIncomingMessage {
|
|
|
63
63
|
* - How to send requests (postRequest)
|
|
64
64
|
* - How to receive responses and events (listen)
|
|
65
65
|
*
|
|
66
|
-
* Everything else
|
|
67
|
-
* event routing
|
|
66
|
+
* Everything else (request lifecycle, timeouts, retries, rate limiting,
|
|
67
|
+
* event routing) is handled by the SDK core and does not change per wallet.
|
|
68
68
|
*
|
|
69
69
|
* @example Minimal adapter for a hypothetical wallet
|
|
70
70
|
* ```typescript
|
|
@@ -103,7 +103,7 @@ interface WalletTransportAdapter {
|
|
|
103
103
|
detect(): boolean;
|
|
104
104
|
/**
|
|
105
105
|
* Send a request to the wallet.
|
|
106
|
-
* Called once per outbound request
|
|
106
|
+
* Called once per outbound request: translate AdapterRequest into your
|
|
107
107
|
* wallet's wire format and post it (window.postMessage, direct API call, etc.).
|
|
108
108
|
*/
|
|
109
109
|
postRequest(request: AdapterRequest): void;
|
|
@@ -120,7 +120,7 @@ interface WalletTransportAdapter {
|
|
|
120
120
|
*
|
|
121
121
|
* @param handler Callback for responses and push events
|
|
122
122
|
* @param options SDK-level options, e.g. additional trusted parent origins
|
|
123
|
-
* @returns A teardown function
|
|
123
|
+
* @returns A teardown function. The SDK calls it on cleanup()
|
|
124
124
|
*/
|
|
125
125
|
listen(handler: (msg: AdapterIncomingMessage) => void, options?: {
|
|
126
126
|
trustedParentOrigins?: string[];
|
|
@@ -162,16 +162,21 @@ interface NetworkInfo {
|
|
|
162
162
|
}
|
|
163
163
|
interface TransactionData {
|
|
164
164
|
readonly to: string;
|
|
165
|
-
/**
|
|
166
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Raw amount in micro-OCT (1 OCT = 1000000), passed to the wallet unchanged. This is what
|
|
167
|
+
* the wallet and the RFC-O-1 provider expect. Prefer `amountOct` when you think in OCT.
|
|
168
|
+
*/
|
|
169
|
+
readonly amount?: string | number;
|
|
170
|
+
/** Amount in OCT. The SDK converts it to raw units exactly (at most 6 decimals). Use this or `amount`, not both. */
|
|
171
|
+
readonly amountOct?: string | number;
|
|
167
172
|
readonly message?: string;
|
|
168
173
|
readonly feeLevel?: 1 | 3;
|
|
169
174
|
readonly isPrivate?: boolean;
|
|
170
175
|
}
|
|
171
176
|
/**
|
|
172
|
-
* Contract method arguments
|
|
177
|
+
* Contract method arguments: flat array of AML-compatible values.
|
|
173
178
|
* Supports primitives and base64-encoded binary data (e.g. FHE ciphers, proofs).
|
|
174
|
-
* Use `[arg1, arg2]
|
|
179
|
+
* Use `[arg1, arg2]`, not `[[arg1, arg2]]`: flat, not nested.
|
|
175
180
|
*/
|
|
176
181
|
type ContractParam = string | number | boolean;
|
|
177
182
|
type ContractParams = ReadonlyArray<ContractParam>;
|
|
@@ -181,16 +186,18 @@ interface ContractCallData {
|
|
|
181
186
|
/** Contract method name (e.g. 'swap', 'open_private_account') */
|
|
182
187
|
readonly method: string;
|
|
183
188
|
/**
|
|
184
|
-
* Method arguments
|
|
189
|
+
* Method arguments: flat primitives, not array-wrapped.
|
|
185
190
|
* For FHE/PVAC operations, encode binary data as base64 strings:
|
|
186
191
|
* `[base64(pvacPubkey), base64(zeroCipher), base64(zeroProof)]`
|
|
187
192
|
*/
|
|
188
193
|
readonly params: ContractParams;
|
|
189
194
|
/**
|
|
190
|
-
* Native
|
|
191
|
-
*
|
|
195
|
+
* Native value to attach, in raw micro-OCT (1 OCT = 1000000), passed to the wallet unchanged.
|
|
196
|
+
* Omit or set '0' for calls that transfer nothing. Prefer `amountOct` when you think in OCT.
|
|
192
197
|
*/
|
|
193
198
|
readonly amount?: string | number;
|
|
199
|
+
/** Value to attach in OCT. The SDK converts it to raw units exactly. Use this or `amount`, not both. */
|
|
200
|
+
readonly amountOct?: string | number;
|
|
194
201
|
/**
|
|
195
202
|
* Operation units / gas limit (default: 10000).
|
|
196
203
|
* Higher values for complex contract operations.
|
|
@@ -203,7 +210,7 @@ interface ContractViewCallData {
|
|
|
203
210
|
readonly contract: string;
|
|
204
211
|
/** Contract method name (e.g. 'balance_of', 'get_active_bin', 'is_paused') */
|
|
205
212
|
readonly method: string;
|
|
206
|
-
/** Method arguments
|
|
213
|
+
/** Method arguments: flat primitives, not array-wrapped */
|
|
207
214
|
readonly params: ContractParams;
|
|
208
215
|
/** Caller address for view context (defaults to connected wallet) */
|
|
209
216
|
readonly caller?: string;
|
|
@@ -221,8 +228,16 @@ interface SignedTransaction {
|
|
|
221
228
|
}
|
|
222
229
|
type TransactionFinality = 'pending' | 'confirmed' | 'rejected' | 'dropped';
|
|
223
230
|
interface TransactionResult {
|
|
224
|
-
|
|
225
|
-
readonly
|
|
231
|
+
/** RFC-O-1 canonical hash field */
|
|
232
|
+
readonly hash?: string;
|
|
233
|
+
/** RFC-O-1 canonical accepted field */
|
|
234
|
+
readonly accepted?: boolean;
|
|
235
|
+
/** RFC-O-1 status field */
|
|
236
|
+
readonly status?: TransactionFinality;
|
|
237
|
+
/** @deprecated Use hash */
|
|
238
|
+
readonly txHash?: string;
|
|
239
|
+
/** @deprecated Use accepted */
|
|
240
|
+
readonly success?: boolean;
|
|
226
241
|
readonly finality?: TransactionFinality;
|
|
227
242
|
readonly message?: string;
|
|
228
243
|
readonly explorerUrl?: string;
|
|
@@ -237,7 +252,7 @@ interface Transaction {
|
|
|
237
252
|
readonly hash: string;
|
|
238
253
|
readonly from: string;
|
|
239
254
|
readonly to: string;
|
|
240
|
-
/** Amount in OCT as returned by the node (
|
|
255
|
+
/** Amount in raw micro-OCT as returned by the node (string or number depending on the wallet version). */
|
|
241
256
|
readonly amount: string | number;
|
|
242
257
|
/** Fee in OCT as returned by the node (may be string or number depending on extension version). */
|
|
243
258
|
readonly fee: string | number;
|
|
@@ -257,11 +272,14 @@ interface ConnectionInfo {
|
|
|
257
272
|
permissions?: Permission[];
|
|
258
273
|
}
|
|
259
274
|
interface ConnectOptions {
|
|
275
|
+
/** RFC-O-1 canonical field name */
|
|
276
|
+
readonly permissions?: Permission[];
|
|
277
|
+
/** @deprecated Use permissions */
|
|
260
278
|
readonly requestPermissions?: Permission[];
|
|
261
279
|
readonly networkId?: string;
|
|
262
280
|
}
|
|
263
|
-
type Permission = 'read_address' | 'read_balance' | 'send_transactions' | 'sign_messages' | 'view_private_balance' | 'private_transfers';
|
|
264
|
-
type WalletEventType = 'connect' | 'disconnect' | 'accountChanged' | 'balanceChanged' | 'networkChanged' | 'transactionConfirmed' | 'error' | 'extensionLocked' | 'extensionUnlocked';
|
|
281
|
+
type Permission = 'accounts' | 'public_transactions' | 'contract_views' | 'private_balance_read' | 'private_proofs' | 'private_claims' | 'read_address' | 'read_balance' | 'read_public_key' | 'send_transactions' | 'sign_messages' | 'contract_calls' | 'view_private_balance' | 'view_encrypted_balance' | 'private_transfers' | 'encrypt_balance' | 'decrypt_balance' | 'stealth_scan' | 'stealth_claim';
|
|
282
|
+
type WalletEventType = 'connect' | 'disconnect' | 'accountChanged' | 'balanceChanged' | 'networkChanged' | 'transactionConfirmed' | 'transactionFailed' | 'permissionsChanged' | 'message' | 'error' | 'extensionLocked' | 'extensionUnlocked';
|
|
265
283
|
interface WalletEvent<T = any> {
|
|
266
284
|
readonly type: WalletEventType;
|
|
267
285
|
readonly data: T;
|
|
@@ -320,7 +338,16 @@ declare enum ErrorCode {
|
|
|
320
338
|
INVALID_SIGNATURE = "INVALID_SIGNATURE",
|
|
321
339
|
DUPLICATE_TRANSACTION = "DUPLICATE_TRANSACTION",
|
|
322
340
|
NONCE_TOO_FAR = "NONCE_TOO_FAR",
|
|
323
|
-
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
341
|
+
INTERNAL_ERROR = "INTERNAL_ERROR",
|
|
342
|
+
NOT_CONNECTED = "NOT_CONNECTED",
|
|
343
|
+
INVALID_PARAMS = "INVALID_PARAMS",
|
|
344
|
+
METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED",
|
|
345
|
+
NOT_AVAILABLE = "NOT_AVAILABLE",
|
|
346
|
+
PRIVATE_PROOF_FAILED = "PRIVATE_PROOF_FAILED",
|
|
347
|
+
PRIVATE_TRANSFER_FAILED = "PRIVATE_TRANSFER_FAILED",
|
|
348
|
+
CONTRACT_CALL_FAILED = "CONTRACT_CALL_FAILED",
|
|
349
|
+
SIGN_FAILED = "SIGN_FAILED",
|
|
350
|
+
RECIPIENT_NOT_REGISTERED = "RECIPIENT_NOT_REGISTERED"
|
|
324
351
|
}
|
|
325
352
|
declare class ZeroXIOWalletError extends Error {
|
|
326
353
|
readonly code: ErrorCode;
|
|
@@ -334,12 +361,21 @@ interface PrivateBalanceInfo {
|
|
|
334
361
|
}
|
|
335
362
|
interface PrivateTransferData {
|
|
336
363
|
readonly to: string;
|
|
337
|
-
/** Amount in OCT. Accepts string or number
|
|
364
|
+
/** Amount in OCT. Accepts string or number. Use string for amounts above 9 billion OCT to avoid JS number precision loss. */
|
|
338
365
|
readonly amount: string | number;
|
|
366
|
+
/** Exact amount in raw micro-OCT. When set, it is what the wallet uses; `amount` is then display only. */
|
|
367
|
+
readonly amountRaw?: string;
|
|
368
|
+
/** Not carried by the wallet today; private transfers have no memo on-chain. */
|
|
339
369
|
readonly message?: string;
|
|
340
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* A claimable stealth output as the wallet returns it. The 0xio extension fills `id` and
|
|
373
|
+
* `amount` (raw micro-OCT) from the node; the other fields depend on the wallet.
|
|
374
|
+
*/
|
|
341
375
|
interface PendingPrivateTransfer {
|
|
342
376
|
readonly id: string;
|
|
377
|
+
/** Raw micro-OCT, when the wallet exposes the amount. */
|
|
378
|
+
readonly amount?: number | string;
|
|
343
379
|
readonly from: string;
|
|
344
380
|
readonly encryptedAmount: string;
|
|
345
381
|
readonly message?: string;
|
|
@@ -355,6 +391,12 @@ interface SDKConfig {
|
|
|
355
391
|
readonly requiredPermissions?: Permission[];
|
|
356
392
|
readonly networkId?: string;
|
|
357
393
|
readonly debug?: boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Exact origins allowed as parent iframe bridge (e.g. 'https://app.example.com').
|
|
396
|
+
* When set, only these origins (plus tauri://) are trusted: implicit localhost trust
|
|
397
|
+
* is disabled. Leave unset for development (all localhost trusted by default).
|
|
398
|
+
*/
|
|
399
|
+
readonly trustedParentOrigins?: string[];
|
|
358
400
|
/**
|
|
359
401
|
* Custom wallet transport adapter.
|
|
360
402
|
* Defaults to ZeroXIOAdapter (0xio extension postMessage protocol).
|
|
@@ -384,55 +426,20 @@ interface ExtensionResponse<T = any> {
|
|
|
384
426
|
readonly timestamp: number;
|
|
385
427
|
}
|
|
386
428
|
|
|
387
|
-
/**
|
|
388
|
-
* 0xio Wallet SDK - Event System
|
|
389
|
-
* Type-safe event emitter for wallet events
|
|
390
|
-
*/
|
|
391
|
-
|
|
392
429
|
type EventListener<T = any> = (event: WalletEvent<T>) => void;
|
|
393
430
|
declare class EventEmitter {
|
|
394
431
|
private listeners;
|
|
395
|
-
|
|
396
|
-
constructor(debug?: boolean);
|
|
397
|
-
/**
|
|
398
|
-
* Add event listener
|
|
399
|
-
*/
|
|
432
|
+
constructor(_debug?: boolean);
|
|
400
433
|
on<T = any>(eventType: WalletEventType, listener: EventListener<T>): void;
|
|
401
|
-
/**
|
|
402
|
-
* Remove event listener
|
|
403
|
-
*/
|
|
404
434
|
off<T = any>(eventType: WalletEventType, listener: EventListener<T>): void;
|
|
405
|
-
/**
|
|
406
|
-
* Add one-time event listener
|
|
407
|
-
*/
|
|
408
435
|
once<T = any>(eventType: WalletEventType, listener: EventListener<T>): void;
|
|
409
|
-
/**
|
|
410
|
-
* Emit event to all listeners
|
|
411
|
-
*/
|
|
412
436
|
emit<T = any>(eventType: WalletEventType, data: T): void;
|
|
413
|
-
/**
|
|
414
|
-
* Remove all listeners for a specific event type
|
|
415
|
-
*/
|
|
416
437
|
removeAllListeners(eventType?: WalletEventType): void;
|
|
417
|
-
/**
|
|
418
|
-
* Get number of listeners for an event type
|
|
419
|
-
*/
|
|
420
438
|
listenerCount(eventType: WalletEventType): number;
|
|
421
|
-
/**
|
|
422
|
-
* Get all event types that have listeners
|
|
423
|
-
*/
|
|
424
439
|
eventTypes(): WalletEventType[];
|
|
425
|
-
/**
|
|
426
|
-
* Check if there are any listeners for an event type
|
|
427
|
-
*/
|
|
428
440
|
hasListeners(eventType: WalletEventType): boolean;
|
|
429
441
|
}
|
|
430
442
|
|
|
431
|
-
/**
|
|
432
|
-
* 0xio Wallet SDK - Main Wallet Class
|
|
433
|
-
* Primary interface for DApp developers to interact with 0xio Wallet
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
443
|
declare class ZeroXIOWallet extends EventEmitter {
|
|
437
444
|
private communicator;
|
|
438
445
|
private config;
|
|
@@ -442,18 +449,8 @@ declare class ZeroXIOWallet extends EventEmitter {
|
|
|
442
449
|
private _sessionVersion;
|
|
443
450
|
private logger;
|
|
444
451
|
constructor(config: SDKConfig);
|
|
445
|
-
/**
|
|
446
|
-
* Initialize the SDK
|
|
447
|
-
* Must be called before using any other methods
|
|
448
|
-
*/
|
|
449
452
|
initialize(): Promise<boolean>;
|
|
450
|
-
/**
|
|
451
|
-
* Check if SDK is initialized
|
|
452
|
-
*/
|
|
453
453
|
isReady(): boolean;
|
|
454
|
-
/**
|
|
455
|
-
* Connect to wallet
|
|
456
|
-
*/
|
|
457
454
|
connect(options?: ConnectOptions): Promise<ConnectEvent>;
|
|
458
455
|
/**
|
|
459
456
|
* Disconnect from wallet
|
|
@@ -472,8 +469,8 @@ declare class ZeroXIOWallet extends EventEmitter {
|
|
|
472
469
|
*/
|
|
473
470
|
getConnectionStatus(): Promise<ConnectionInfo>;
|
|
474
471
|
/**
|
|
475
|
-
* Switch the extension's active network (e.g. 'mainnet'
|
|
476
|
-
* Works silently
|
|
472
|
+
* Switch the extension's active network (e.g. 'mainnet' to 'devnet').
|
|
473
|
+
* Works silently: no popup, no user confirmation needed.
|
|
477
474
|
* The extension broadcasts 'networkChanged' event to all connected dApps.
|
|
478
475
|
*/
|
|
479
476
|
switchNetwork(networkId: string): Promise<{
|
|
@@ -484,22 +481,27 @@ declare class ZeroXIOWallet extends EventEmitter {
|
|
|
484
481
|
* Get the extension's current network ID ('mainnet' or 'devnet')
|
|
485
482
|
*/
|
|
486
483
|
getNetworkId(): string | null;
|
|
487
|
-
/**
|
|
488
|
-
* Get current wallet address
|
|
489
|
-
*/
|
|
490
484
|
getAddress(): string | null;
|
|
491
485
|
/**
|
|
492
|
-
*
|
|
486
|
+
* The connected account's Ed25519 public key (base64). Served from the session when the
|
|
487
|
+
* wallet reported it at connect, otherwise asked from the wallet.
|
|
493
488
|
*/
|
|
489
|
+
getPublicKey(): Promise<string>;
|
|
494
490
|
getBalance(forceRefresh?: boolean): Promise<Balance>;
|
|
491
|
+
getNetworkInfo(): Promise<NetworkInfo>;
|
|
492
|
+
sendTransaction(txData: TransactionData): Promise<TransactionResult>;
|
|
495
493
|
/**
|
|
496
|
-
*
|
|
494
|
+
* Sign a transaction without broadcasting it (RFC-O-1 octra_signTransaction).
|
|
495
|
+
* Returns the signed transaction object for manual submission via submitTransaction().
|
|
497
496
|
*/
|
|
498
|
-
|
|
497
|
+
signTransaction(txData: TransactionData): Promise<{
|
|
498
|
+
signedTx: any;
|
|
499
|
+
}>;
|
|
499
500
|
/**
|
|
500
|
-
*
|
|
501
|
+
* Broadcast a pre-signed transaction (RFC-O-1 octra_submitTransaction).
|
|
502
|
+
* Use after signTransaction() to submit the signed tx to the network.
|
|
501
503
|
*/
|
|
502
|
-
|
|
504
|
+
submitTransaction(signedTx: any): Promise<TransactionResult>;
|
|
503
505
|
/**
|
|
504
506
|
* Call a smart contract method (state-changing).
|
|
505
507
|
* The extension builds, signs, and submits the transaction via octra_submit.
|
|
@@ -518,16 +520,17 @@ declare class ZeroXIOWallet extends EventEmitter {
|
|
|
518
520
|
* Get transaction history
|
|
519
521
|
*/
|
|
520
522
|
getTransactionHistory(page?: number, limit?: number): Promise<TransactionHistory>;
|
|
521
|
-
/**
|
|
522
|
-
* Get private balance information
|
|
523
|
-
*/
|
|
524
523
|
getPrivateBalanceInfo(): Promise<PrivateBalanceInfo>;
|
|
525
524
|
/**
|
|
526
|
-
* Encrypt public balance to private
|
|
525
|
+
* Encrypt public balance to private.
|
|
526
|
+
* @deprecated The 0xio extension does not serve this through the bridge (it answers
|
|
527
|
+
* NOT_AVAILABLE); users encrypt from the extension's Privacy screen.
|
|
527
528
|
*/
|
|
528
529
|
encryptBalance(amount: string | number): Promise<TransactionResult>;
|
|
529
530
|
/**
|
|
530
|
-
* Decrypt private balance to public
|
|
531
|
+
* Decrypt private balance to public.
|
|
532
|
+
* @deprecated The 0xio extension does not serve this through the bridge (it answers
|
|
533
|
+
* NOT_AVAILABLE); users decrypt from the extension's Privacy screen.
|
|
531
534
|
*/
|
|
532
535
|
decryptBalance(amount: string | number): Promise<TransactionResult>;
|
|
533
536
|
/**
|
|
@@ -551,15 +554,121 @@ declare class ZeroXIOWallet extends EventEmitter {
|
|
|
551
554
|
*/
|
|
552
555
|
claimPrivateTransfer(transferId: string): Promise<TransactionResult>;
|
|
553
556
|
/**
|
|
554
|
-
*
|
|
555
|
-
*
|
|
557
|
+
* Send any wallet method + params through the bridge. Escape hatch for
|
|
558
|
+
* primitives that don't have a typed helper yet (no SDK upgrade needed).
|
|
559
|
+
* @since 2.8.0
|
|
560
|
+
*/
|
|
561
|
+
request<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
|
|
562
|
+
/**
|
|
563
|
+
* Read-only node RPC through the wallet. Only the wallet's allow-listed public methods work
|
|
564
|
+
* (octra_balance, octra_transaction, contract_call and similar); writes are refused.
|
|
565
|
+
* @since 2.8.0
|
|
566
|
+
*/
|
|
567
|
+
rpcCall<T = unknown>(method: string, params?: unknown[]): Promise<T>;
|
|
568
|
+
/**
|
|
569
|
+
* Feature-detect which private capabilities the connected wallet supports.
|
|
570
|
+
* Lets a dapp render the correct UI (or fail closed) before any action.
|
|
571
|
+
* @since 2.8.0
|
|
572
|
+
*/
|
|
573
|
+
getPrivateCapabilities(): Promise<{
|
|
574
|
+
wallet: string;
|
|
575
|
+
version: string;
|
|
576
|
+
supports: Record<string, boolean>;
|
|
577
|
+
methods: string[];
|
|
578
|
+
required_permissions?: Record<string, string[]>;
|
|
579
|
+
}>;
|
|
580
|
+
/** Read-only contract view (no approval popup). @since 2.8.0 */
|
|
581
|
+
callContractView(params: {
|
|
582
|
+
contract: string;
|
|
583
|
+
method: string;
|
|
584
|
+
params?: unknown[];
|
|
585
|
+
caller?: string;
|
|
586
|
+
}): Promise<unknown>;
|
|
587
|
+
/** Encrypt a raw integer value to a contract-ready ciphertext (keys stay in wallet). @since 2.8.0 */
|
|
588
|
+
encryptValue(params: {
|
|
589
|
+
value_raw: string;
|
|
590
|
+
token?: string;
|
|
591
|
+
owner?: string;
|
|
592
|
+
asset?: string;
|
|
593
|
+
}): Promise<{
|
|
594
|
+
cipher: string;
|
|
595
|
+
commitment?: string;
|
|
596
|
+
encoding?: string;
|
|
597
|
+
}>;
|
|
598
|
+
/** Decrypt a ciphertext to a raw integer value. @since 2.8.0 */
|
|
599
|
+
decryptValue(params: {
|
|
600
|
+
cipher: string;
|
|
601
|
+
token?: string;
|
|
602
|
+
owner?: string;
|
|
603
|
+
}): Promise<{
|
|
604
|
+
value_raw: string;
|
|
605
|
+
display?: string;
|
|
606
|
+
decimals?: number;
|
|
607
|
+
}>;
|
|
608
|
+
/** Zero proof for a ciphertext (proves it encrypts the given value, default 0). @since 2.8.0 */
|
|
609
|
+
makeZeroProof(params: {
|
|
610
|
+
cipher: string;
|
|
611
|
+
value_raw?: string;
|
|
612
|
+
token?: string;
|
|
613
|
+
owner?: string;
|
|
614
|
+
}): Promise<{
|
|
615
|
+
proof: string;
|
|
616
|
+
commitment?: string;
|
|
617
|
+
blinding?: string;
|
|
618
|
+
encoding?: string;
|
|
619
|
+
}>;
|
|
620
|
+
/** Range proof for a ciphertext. @since 2.8.0 */
|
|
621
|
+
makeRangeProof(params: {
|
|
622
|
+
cipher: string;
|
|
623
|
+
value_raw: string;
|
|
624
|
+
token?: string;
|
|
625
|
+
owner?: string;
|
|
626
|
+
range?: {
|
|
627
|
+
min_raw: string;
|
|
628
|
+
max_raw: string;
|
|
629
|
+
};
|
|
630
|
+
}): Promise<{
|
|
631
|
+
proof: string;
|
|
632
|
+
encoding?: string;
|
|
633
|
+
}>;
|
|
634
|
+
/** Private OCT + private token balances (decrypted inside the wallet). @since 2.8.0 */
|
|
635
|
+
getPrivateBalance(params?: {
|
|
636
|
+
address?: string;
|
|
637
|
+
assets?: string[];
|
|
638
|
+
tokens?: string[];
|
|
639
|
+
include_claimable?: boolean;
|
|
640
|
+
}): Promise<unknown>;
|
|
641
|
+
/** Register a receive/view public key so an address can receive private transfers. @since 2.8.0 */
|
|
642
|
+
registerPrivateViewKey(params: {
|
|
643
|
+
address: string;
|
|
644
|
+
}): Promise<unknown>;
|
|
645
|
+
/** Submit an ordered multi-step public contract flow under one approval. @since 2.8.0 */
|
|
646
|
+
sendContractTransactionSequence(params: {
|
|
647
|
+
sequence_id?: string;
|
|
648
|
+
transactions: Array<{
|
|
649
|
+
contract: string;
|
|
650
|
+
method: string;
|
|
651
|
+
params?: unknown[];
|
|
652
|
+
amount?: string;
|
|
653
|
+
ou?: string;
|
|
654
|
+
}>;
|
|
655
|
+
}): Promise<unknown>;
|
|
656
|
+
/**
|
|
657
|
+
* Sign an arbitrary message with the wallet's private key.
|
|
658
|
+
* The user will be prompted to approve the signature request in the extension.
|
|
659
|
+
*
|
|
660
|
+
* The wallet does not sign the raw message: it signs the 0xio Signed Message framing
|
|
661
|
+
* (`"Octra Signed Message:\n" + byteLength + "\n" + message`) so a signed message can never be a
|
|
662
|
+
* transaction pre-image. Verify with `verifyMessage(message, signature, publicKey)`, or check an
|
|
663
|
+
* Ed25519 signature against `getSignedMessageBytes(message)` with your own library.
|
|
664
|
+
*
|
|
556
665
|
* @param message - The message to sign (non-empty string)
|
|
557
666
|
* @returns Promise resolving to the base64-encoded Ed25519 signature
|
|
558
667
|
* @throws ZeroXIOWalletError with code SIGNATURE_FAILED if signing fails
|
|
559
668
|
* @example
|
|
560
669
|
* ```typescript
|
|
561
670
|
* const signature = await wallet.signMessage('Hello, 0xio!');
|
|
562
|
-
*
|
|
671
|
+
* const ok = await verifyMessage('Hello, 0xio!', signature, await wallet.getPublicKey());
|
|
563
672
|
* ```
|
|
564
673
|
*/
|
|
565
674
|
signMessage(message: string): Promise<string>;
|
|
@@ -569,55 +678,33 @@ declare class ZeroXIOWallet extends EventEmitter {
|
|
|
569
678
|
* to the calling service and a one-time nonce, preventing cross-service replay attacks.
|
|
570
679
|
*
|
|
571
680
|
* @param service - Identifies the relying service (e.g. 'MyDApp' or 'api.mydapp.com')
|
|
572
|
-
* @param nonce - Unique one-time value
|
|
681
|
+
* @param nonce - Unique one-time value. Use a server-generated UUID or challenge
|
|
573
682
|
* @returns Promise resolving to the base64-encoded Ed25519 signature
|
|
574
683
|
*/
|
|
575
684
|
signAuthMessage(service: string, nonce: string): Promise<string>;
|
|
576
685
|
private ensureInitialized;
|
|
577
686
|
private ensureConnected;
|
|
578
687
|
private setupExtensionEventListeners;
|
|
579
|
-
/**
|
|
580
|
-
* Handle account changed event from extension
|
|
581
|
-
*/
|
|
582
688
|
private handleAccountChanged;
|
|
583
|
-
/**
|
|
584
|
-
* Handle network changed event from extension
|
|
585
|
-
*/
|
|
586
689
|
private handleNetworkChanged;
|
|
587
|
-
/**
|
|
588
|
-
* Handle balance changed event from extension
|
|
589
|
-
*/
|
|
590
690
|
private handleBalanceChanged;
|
|
591
|
-
/**
|
|
592
|
-
* Handle extension locked event
|
|
593
|
-
*/
|
|
594
691
|
private handleExtensionLocked;
|
|
595
|
-
/**
|
|
596
|
-
* Handle extension unlocked event
|
|
597
|
-
*/
|
|
598
692
|
private handleExtensionUnlocked;
|
|
693
|
+
private handleTransactionConfirmed;
|
|
599
694
|
/**
|
|
600
|
-
*
|
|
695
|
+
* The wallet takes raw micro-OCT. `amount` passes through unchanged (what every existing
|
|
696
|
+
* dapp sends today); `amountOct` is converted exactly. Never both.
|
|
601
697
|
*/
|
|
602
|
-
private
|
|
698
|
+
private resolveRawAmount;
|
|
603
699
|
/**
|
|
604
|
-
*
|
|
700
|
+
* Reject numeric amounts that cannot be represented exactly in micro-OCT.
|
|
701
|
+
* e.g. 0.1 + 0.2 = 0.30000000000000004: the extension would sign the wrong value.
|
|
702
|
+
* String amounts bypass this check (caller is responsible for correctness).
|
|
605
703
|
*/
|
|
704
|
+
private assertExactOCTAmount;
|
|
606
705
|
cleanup(): void;
|
|
607
706
|
}
|
|
608
707
|
|
|
609
|
-
/**
|
|
610
|
-
* 0xio Wallet SDK - Extension Communication Module
|
|
611
|
-
*
|
|
612
|
-
* @fileoverview Manages secure communication between the SDK and browser extension.
|
|
613
|
-
* Implements message passing, request/response handling, rate limiting, and origin validation
|
|
614
|
-
* to ensure secure wallet interactions.
|
|
615
|
-
*
|
|
616
|
-
* @module communication
|
|
617
|
-
* @version 2.7.0
|
|
618
|
-
* @license MIT
|
|
619
|
-
*/
|
|
620
|
-
|
|
621
708
|
declare class ExtensionCommunicator extends EventEmitter {
|
|
622
709
|
private pendingRequests;
|
|
623
710
|
private isInitialized;
|
|
@@ -626,7 +713,7 @@ declare class ExtensionCommunicator extends EventEmitter {
|
|
|
626
713
|
private isExtensionAvailableState;
|
|
627
714
|
private trustedOrigins;
|
|
628
715
|
private _parentOrigin;
|
|
629
|
-
/** Pluggable transport
|
|
716
|
+
/** Pluggable transport, defaults to the 0xio postMessage protocol. */
|
|
630
717
|
private adapter;
|
|
631
718
|
/** Teardown fn returned by adapter.listen() */
|
|
632
719
|
private _adapterTeardown;
|
|
@@ -634,14 +721,14 @@ declare class ExtensionCommunicator extends EventEmitter {
|
|
|
634
721
|
private _adapterReadyTeardown;
|
|
635
722
|
/**
|
|
636
723
|
* Set when a trusted walletReady has been received from window.parent.
|
|
637
|
-
* The polling fallback must
|
|
724
|
+
* The polling fallback must not clear this flag.
|
|
638
725
|
*/
|
|
639
726
|
private _parentTrusted;
|
|
640
727
|
/** walletReady postMessage listener stored for cleanup */
|
|
641
728
|
private _walletReadyMessageListener;
|
|
642
729
|
/**
|
|
643
730
|
* In-flight interactive request lock.
|
|
644
|
-
* Methods that open approval popups are serialized
|
|
731
|
+
* Methods that open approval popups are serialized: only one at a time.
|
|
645
732
|
*/
|
|
646
733
|
private _interactiveInFlight;
|
|
647
734
|
private readonly MAX_CONCURRENT_REQUESTS;
|
|
@@ -653,6 +740,8 @@ declare class ExtensionCommunicator extends EventEmitter {
|
|
|
653
740
|
initialize(): Promise<boolean>;
|
|
654
741
|
isExtensionAvailable(): boolean;
|
|
655
742
|
private static readonly NO_RETRY_METHODS;
|
|
743
|
+
private static readonly LONG_COMPUTE_METHODS;
|
|
744
|
+
private static readonly PROOF_METHODS;
|
|
656
745
|
private static readonly INTERACTIVE_METHODS;
|
|
657
746
|
sendRequest<T = any>(method: string, params?: any, timeout?: number): Promise<T>;
|
|
658
747
|
sendRequestWithRetry<T = any>(method: string, params?: any, maxRetries?: number, timeout?: number): Promise<T>;
|
|
@@ -672,7 +761,7 @@ declare class ExtensionCommunicator extends EventEmitter {
|
|
|
672
761
|
private getExtensionDiagnostics;
|
|
673
762
|
/**
|
|
674
763
|
* Clean up SDK resources.
|
|
675
|
-
* After cleanup() the instance is terminal
|
|
764
|
+
* After cleanup() the instance is terminal: do not call initialize() again.
|
|
676
765
|
* Construct a new instance instead.
|
|
677
766
|
*/
|
|
678
767
|
cleanup(): void;
|
|
@@ -697,7 +786,7 @@ declare class ExtensionCommunicator extends EventEmitter {
|
|
|
697
786
|
* window.postMessage({ source: '0xio-sdk-bridge', response: { id, success, data, error }, sessionNonce })
|
|
698
787
|
* window.postMessage({ source: '0xio-sdk-bridge', event: { type, data } })
|
|
699
788
|
*
|
|
700
|
-
*
|
|
789
|
+
* Session nonce validation: injected.ts broadcasts the nonce received from the
|
|
701
790
|
* isolated content script. Once set, any '0xio-sdk-bridge' response with a missing or
|
|
702
791
|
* mismatched nonce is rejected, preventing response injection by malicious page scripts.
|
|
703
792
|
*/
|
|
@@ -715,7 +804,7 @@ declare const ZeroXIOAdapter: WalletTransportAdapter;
|
|
|
715
804
|
*
|
|
716
805
|
* Targets any wallet that exposes `window.octra` per the RFC-O-1 specification:
|
|
717
806
|
* window.octra.isOctra === true
|
|
718
|
-
* window.octra.request({ method, params })
|
|
807
|
+
* window.octra.request({ method, params }) returns Promise<unknown>
|
|
719
808
|
* window.octra.on(event, listener) / removeListener(event, listener)
|
|
720
809
|
*
|
|
721
810
|
* This adapter translates the SDK's internal method names into RFC-O-1 method
|
|
@@ -730,7 +819,7 @@ declare function createOctraProviderAdapter(): WalletTransportAdapter;
|
|
|
730
819
|
declare const OctraProviderAdapter: WalletTransportAdapter;
|
|
731
820
|
|
|
732
821
|
/**
|
|
733
|
-
* 0xio SDK
|
|
822
|
+
* 0xio SDK: Wallet Adapter Registry
|
|
734
823
|
*
|
|
735
824
|
* Add new wallet adapters here. Detection order determines which wallet takes
|
|
736
825
|
* priority when multiple wallets are installed at the same time.
|
|
@@ -749,6 +838,19 @@ declare function detectWalletAdapter(): WalletTransportAdapter | null;
|
|
|
749
838
|
/** Returns all registered adapter instances. */
|
|
750
839
|
declare function getAllAdapters(): WalletTransportAdapter[];
|
|
751
840
|
|
|
841
|
+
/** Scope names the 0xio wallet enforces. Any other name is dropped at connect. */
|
|
842
|
+
declare const WALLET_PERMISSIONS: readonly ["accounts", "public_transactions", "contract_calls", "contract_views", "private_balance_read", "private_proofs", "private_transfers", "private_claims"];
|
|
843
|
+
type WalletPermission = (typeof WALLET_PERMISSIONS)[number];
|
|
844
|
+
/** Older SDK permission names and the wallet scope each one means. */
|
|
845
|
+
declare const LEGACY_PERMISSION_MAP: Record<string, WalletPermission>;
|
|
846
|
+
/** Translate any mix of old and new names into the wallet's scope names, without duplicates. */
|
|
847
|
+
declare function toWalletPermissions(perms: readonly string[] | undefined): WalletPermission[];
|
|
848
|
+
/**
|
|
849
|
+
* The granted wallet scopes plus every requested old name they satisfy, so a dapp that checks
|
|
850
|
+
* for the name it asked for (for example 'read_balance') keeps seeing it.
|
|
851
|
+
*/
|
|
852
|
+
declare function withLegacyAliases(granted: readonly string[] | undefined, requested: readonly string[] | undefined): Permission[];
|
|
853
|
+
|
|
752
854
|
/**
|
|
753
855
|
* Network configuration for 0xio SDK
|
|
754
856
|
*/
|
|
@@ -761,12 +863,12 @@ declare const NETWORKS: Readonly<Record<string, Readonly<NetworkInfo>>>;
|
|
|
761
863
|
declare const DEFAULT_NETWORK_ID = "mainnet";
|
|
762
864
|
/**
|
|
763
865
|
* Get network configuration by ID.
|
|
764
|
-
* Returns a frozen copy
|
|
866
|
+
* Returns a frozen copy, so callers cannot mutate SDK-internal state.
|
|
765
867
|
*/
|
|
766
868
|
declare function getNetworkConfig(networkId?: string): NetworkInfo;
|
|
767
869
|
/**
|
|
768
870
|
* Get all available networks.
|
|
769
|
-
* Returns frozen copies
|
|
871
|
+
* Returns frozen copies, so callers cannot mutate SDK-internal state.
|
|
770
872
|
*/
|
|
771
873
|
declare function getAllNetworks(): NetworkInfo[];
|
|
772
874
|
/**
|
|
@@ -776,32 +878,18 @@ declare function isValidNetworkId(networkId: string): boolean;
|
|
|
776
878
|
|
|
777
879
|
/**
|
|
778
880
|
* Default balance structure.
|
|
779
|
-
* Accepts a numeric total or undefined
|
|
881
|
+
* Accepts a numeric total or undefined. Never pass a Balance object here.
|
|
780
882
|
*/
|
|
781
883
|
declare function createDefaultBalance(total?: number): Balance;
|
|
782
|
-
/**
|
|
783
|
-
* SDK Configuration constants
|
|
784
|
-
*/
|
|
785
884
|
declare const SDK_CONFIG: {
|
|
786
|
-
readonly version: "2.
|
|
885
|
+
readonly version: "2.8.0";
|
|
787
886
|
readonly defaultNetworkId: "mainnet";
|
|
788
887
|
readonly communicationTimeout: 30000;
|
|
789
888
|
readonly retryAttempts: 3;
|
|
790
889
|
readonly retryDelay: 1000;
|
|
791
890
|
};
|
|
792
|
-
/**
|
|
793
|
-
* Get default network configuration
|
|
794
|
-
*/
|
|
795
891
|
declare function getDefaultNetwork(): NetworkInfo;
|
|
796
892
|
|
|
797
|
-
/**
|
|
798
|
-
* 0xio Wallet SDK - Utilities
|
|
799
|
-
* Helper functions for validation, formatting, and common operations
|
|
800
|
-
*/
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Validate wallet address for Octra blockchain
|
|
804
|
-
*/
|
|
805
893
|
declare function isValidAddress(address: string): boolean;
|
|
806
894
|
/**
|
|
807
895
|
* Validate transaction amount.
|
|
@@ -809,70 +897,33 @@ declare function isValidAddress(address: string): boolean;
|
|
|
809
897
|
* String amounts avoid JS number precision loss for very large values.
|
|
810
898
|
*/
|
|
811
899
|
declare function isValidAmount(amount: string | number): boolean;
|
|
812
|
-
/**
|
|
813
|
-
* Validate transaction message
|
|
814
|
-
*/
|
|
815
900
|
declare function isValidMessage(message: string): boolean;
|
|
816
|
-
/**
|
|
817
|
-
* Validate fee level
|
|
818
|
-
*/
|
|
819
901
|
declare function isValidFeeLevel(feeLevel: number): boolean;
|
|
820
902
|
/**
|
|
821
903
|
* Derive the canonical Octra address from a base64-encoded Ed25519 public key.
|
|
822
|
-
* Algorithm: SHA-256
|
|
904
|
+
* Algorithm: SHA-256 of the pubkey bytes, base58-encoded, with "oct" prepended
|
|
823
905
|
* Source of truth: ocho-push-server/src/index.ts#deriveAddressFromPubkey
|
|
824
906
|
*/
|
|
825
907
|
declare function deriveOctraAddress(publicKeyBase64: string): Promise<string>;
|
|
826
|
-
/**
|
|
827
|
-
* Format OCT amount for display
|
|
828
|
-
*/
|
|
829
908
|
declare function formatOCT(amount: number | string, decimals?: number): string;
|
|
830
|
-
/**
|
|
831
|
-
* Format address for display (truncated)
|
|
832
|
-
*/
|
|
833
909
|
declare function formatAddress(address: string, prefixLength?: number, suffixLength?: number): string;
|
|
834
|
-
/**
|
|
835
|
-
* Format timestamp for display
|
|
836
|
-
*/
|
|
837
910
|
declare function formatTimestamp(timestamp: number): string;
|
|
838
|
-
/**
|
|
839
|
-
* Format transaction hash for display
|
|
840
|
-
*/
|
|
841
911
|
declare function formatTxHash(hash: string, length?: number): string;
|
|
842
|
-
/**
|
|
843
|
-
* Convert OCT to micro OCT (for network transmission)
|
|
844
|
-
*/
|
|
845
912
|
declare function toMicroOCT(amount: number): string;
|
|
846
913
|
/**
|
|
847
|
-
*
|
|
914
|
+
* Exact OCT to raw micro-OCT conversion using string arithmetic (no float rounding).
|
|
915
|
+
* Accepts up to 6 decimals; anything else is rejected.
|
|
848
916
|
*/
|
|
917
|
+
declare function octToMicro(amount: string | number): string;
|
|
849
918
|
declare function fromMicroOCT(microAmount: string | number): number;
|
|
850
|
-
/**
|
|
851
|
-
* Create standardized error messages
|
|
852
|
-
*/
|
|
853
919
|
declare function createErrorMessage(code: ErrorCode, context?: string): string;
|
|
854
|
-
/**
|
|
855
|
-
* Check if error is a specific type
|
|
856
|
-
*/
|
|
857
920
|
declare function isErrorType(error: any, code: ErrorCode): boolean;
|
|
858
|
-
/**
|
|
859
|
-
* Create a promise that resolves after a delay
|
|
860
|
-
*/
|
|
861
921
|
declare function delay(ms: number): Promise<void>;
|
|
862
|
-
/**
|
|
863
|
-
* Check if running in browser environment
|
|
864
|
-
*/
|
|
865
922
|
declare function isBrowser(): boolean;
|
|
866
|
-
/**
|
|
867
|
-
* Check if browser supports required features
|
|
868
|
-
*/
|
|
869
923
|
declare function checkBrowserSupport(): {
|
|
870
924
|
supported: boolean;
|
|
871
925
|
missingFeatures: string[];
|
|
872
926
|
};
|
|
873
|
-
/**
|
|
874
|
-
* Generate mock data for development/testing
|
|
875
|
-
*/
|
|
876
927
|
declare function generateMockData(): {
|
|
877
928
|
address: string;
|
|
878
929
|
balance: {
|
|
@@ -893,9 +944,6 @@ declare function generateMockData(): {
|
|
|
893
944
|
isTestnet: boolean;
|
|
894
945
|
};
|
|
895
946
|
};
|
|
896
|
-
/**
|
|
897
|
-
* Create development logger
|
|
898
|
-
*/
|
|
899
947
|
declare function createLogger(prefix: string, debug: boolean): {
|
|
900
948
|
log: (...args: any[]) => void;
|
|
901
949
|
warn: (...args: any[]) => void;
|
|
@@ -906,7 +954,50 @@ declare function createLogger(prefix: string, debug: boolean): {
|
|
|
906
954
|
groupEnd: () => void;
|
|
907
955
|
};
|
|
908
956
|
|
|
909
|
-
|
|
957
|
+
/**
|
|
958
|
+
* 0xio Signed Message standard (v1).
|
|
959
|
+
*
|
|
960
|
+
* `wallet.signMessage(message)` never signs the raw message. The wallet frames it first so a signed
|
|
961
|
+
* "message" can never collide with a transaction pre-image (a transaction is canonical JSON that
|
|
962
|
+
* begins with '{'). The framing is:
|
|
963
|
+
*
|
|
964
|
+
* "Octra Signed Message:\n" + utf8ByteLength(message) + "\n" + message
|
|
965
|
+
*
|
|
966
|
+
* signed as an Ed25519 detached signature over the UTF-8 bytes of that string. The leading 'O'
|
|
967
|
+
* guarantees the signed bytes never begin with '{', so a personal-message signature can never be a
|
|
968
|
+
* valid transaction. Any verifier MUST reconstruct the same bytes: use `getSignedMessageBytes()`
|
|
969
|
+
* with any Ed25519 library, or `verifyMessage()` for a batteries-included check.
|
|
970
|
+
*/
|
|
971
|
+
/** Fixed prefix tag for the 0xio Signed Message scheme. */
|
|
972
|
+
declare const SIGNED_MESSAGE_PREFIX = "Octra Signed Message:";
|
|
973
|
+
/** Scheme version, bumped if the framing ever changes so verifiers can detect it. */
|
|
974
|
+
declare const SIGNED_MESSAGE_VERSION = 1;
|
|
975
|
+
/**
|
|
976
|
+
* The exact bytes that `wallet.signMessage(message)` produces a signature over. Verify a 0xio
|
|
977
|
+
* message signature by checking an Ed25519 signature against these bytes with the signer's public
|
|
978
|
+
* key. Zero-dependency - bring your own Ed25519 verifier, or use `verifyMessage`.
|
|
979
|
+
*/
|
|
980
|
+
declare function getSignedMessageBytes(message: string): Uint8Array;
|
|
981
|
+
/**
|
|
982
|
+
* Reconstruct the auth message that `wallet.signAuthMessage(service, nonce)` signs. A relying
|
|
983
|
+
* service verifies an auth signature with `verifyMessage(buildAuthMessage(service, nonce, origin),
|
|
984
|
+
* signature, publicKey)`, where `origin` is the caller's page origin.
|
|
985
|
+
*/
|
|
986
|
+
declare function buildAuthMessage(service: string, nonce: string, origin: string): string;
|
|
987
|
+
/**
|
|
988
|
+
* Verify a 0xio message signature produced by `wallet.signMessage`.
|
|
989
|
+
*
|
|
990
|
+
* @param message The original message passed to `wallet.signMessage`.
|
|
991
|
+
* @param signature Base64 Ed25519 signature returned by `wallet.signMessage`.
|
|
992
|
+
* @param publicKey Base64 Ed25519 public key of the signer (from `wallet.getPublicKey()`).
|
|
993
|
+
* @returns Whether the signature is valid for this message and key.
|
|
994
|
+
*
|
|
995
|
+
* Uses the Web Crypto Ed25519 primitive (Node 18+, Chrome 137+, Safari 17+, Firefox 129+). In an
|
|
996
|
+
* environment without it, verify `getSignedMessageBytes(message)` with your own Ed25519 library.
|
|
997
|
+
*/
|
|
998
|
+
declare function verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
|
|
999
|
+
|
|
1000
|
+
declare const SDK_VERSION = "2.8.0";
|
|
910
1001
|
declare const MIN_EXTENSION_VERSION = "2.0.1";
|
|
911
1002
|
declare const MIN_EXTENSION_VERSION_DEVNET = "2.2.1";
|
|
912
1003
|
declare const SUPPORTED_EXTENSION_VERSIONS = "^2.0.1";
|
|
@@ -923,5 +1014,5 @@ declare function checkSDKCompatibility(): {
|
|
|
923
1014
|
recommendations: string[];
|
|
924
1015
|
};
|
|
925
1016
|
|
|
926
|
-
export { DEFAULT_NETWORK_ID, ErrorCode, EventEmitter, ExtensionCommunicator, MIN_EXTENSION_VERSION, MIN_EXTENSION_VERSION_DEVNET, NETWORKS, OctraProviderAdapter, SDK_CONFIG, SDK_VERSION, SUPPORTED_EXTENSION_VERSIONS, ZeroXIOAdapter, ZeroXIOWallet, ZeroXIOWalletError, checkBrowserSupport, checkSDKCompatibility, createDefaultBalance, createErrorMessage, createLogger, createOctraProviderAdapter, createZeroXIOAdapter, createZeroXIOWallet, delay, deriveOctraAddress, detectWalletAdapter, formatAddress, formatOCT, formatTimestamp, formatTxHash, formatOCT as formatZeroXIO, fromMicroOCT, fromMicroOCT as fromMicroZeroXIO, generateMockData, getAllAdapters, getAllNetworks, getDefaultNetwork, getNetworkConfig, isBrowser, isErrorType, isValidAddress, isValidAmount, isValidFeeLevel, isValidMessage, isValidNetworkId, toMicroOCT, toMicroOCT as toMicroZeroXIO };
|
|
927
|
-
export type { AccountChangedEvent, AdapterIncomingMessage, AdapterRequest, Balance, BalanceChangedEvent, ConnectEvent, ConnectOptions, ConnectionInfo, ContractCallData, ContractParam, ContractParams, ContractViewCallData, DisconnectEvent, ErrorEvent, ExtensionRequest, ExtensionResponse, NetworkChangedEvent, NetworkInfo, PendingPrivateTransfer, Permission, PrivateBalanceInfo, PrivateTransferData, SDKConfig, SignedTransaction, Transaction, TransactionConfirmedEvent, TransactionData, TransactionFinality, TransactionHistory, TransactionResult, WalletAddress, WalletEvent, WalletEventType, WalletTransportAdapter };
|
|
1017
|
+
export { DEFAULT_NETWORK_ID, ErrorCode, EventEmitter, ExtensionCommunicator, LEGACY_PERMISSION_MAP, MIN_EXTENSION_VERSION, MIN_EXTENSION_VERSION_DEVNET, NETWORKS, OctraProviderAdapter, SDK_CONFIG, SDK_VERSION, SIGNED_MESSAGE_PREFIX, SIGNED_MESSAGE_VERSION, SUPPORTED_EXTENSION_VERSIONS, WALLET_PERMISSIONS, ZeroXIOAdapter, ZeroXIOWallet, ZeroXIOWalletError, buildAuthMessage, checkBrowserSupport, checkSDKCompatibility, createDefaultBalance, createErrorMessage, createLogger, createOctraProviderAdapter, createZeroXIOAdapter, createZeroXIOWallet, delay, deriveOctraAddress, detectWalletAdapter, formatAddress, formatOCT, formatTimestamp, formatTxHash, formatOCT as formatZeroXIO, fromMicroOCT, fromMicroOCT as fromMicroZeroXIO, generateMockData, getAllAdapters, getAllNetworks, getDefaultNetwork, getNetworkConfig, getSignedMessageBytes, isBrowser, isErrorType, isValidAddress, isValidAmount, isValidFeeLevel, isValidMessage, isValidNetworkId, octToMicro, toMicroOCT, toMicroOCT as toMicroZeroXIO, toWalletPermissions, verifyMessage, withLegacyAliases };
|
|
1018
|
+
export type { AccountChangedEvent, AdapterIncomingMessage, AdapterRequest, Balance, BalanceChangedEvent, ConnectEvent, ConnectOptions, ConnectionInfo, ContractCallData, ContractParam, ContractParams, ContractViewCallData, DisconnectEvent, ErrorEvent, ExtensionRequest, ExtensionResponse, NetworkChangedEvent, NetworkInfo, PendingPrivateTransfer, Permission, PrivateBalanceInfo, PrivateTransferData, SDKConfig, SignedTransaction, Transaction, TransactionConfirmedEvent, TransactionData, TransactionFinality, TransactionHistory, TransactionResult, WalletAddress, WalletEvent, WalletEventType, WalletPermission, WalletTransportAdapter };
|