@orbinum/sdk 0.3.0 → 0.4.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/README.md +570 -22
- package/dist/index.d.mts +1792 -987
- package/dist/index.d.ts +1792 -987
- package/dist/index.js +2229 -491
- package/dist/index.mjs +2214 -490
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,82 @@
|
|
|
1
1
|
import * as polkadot_api from 'polkadot-api';
|
|
2
2
|
import { PolkadotClient, TxFinalizedPayload, PolkadotSigner } from 'polkadot-api';
|
|
3
|
-
export { PolkadotSigner } from 'polkadot-api';
|
|
3
|
+
export { PolkadotSigner, getSs58AddressInfo } from 'polkadot-api';
|
|
4
|
+
import { getDynamicBuilder } from '@polkadot-api/metadata-builders';
|
|
5
|
+
import { getExtrinsicDecoder } from '@polkadot-api/tx-utils';
|
|
6
|
+
export { AccountId, Blake2256, Keccak256, Storage, u128, u64 } from '@polkadot-api/substrate-bindings';
|
|
7
|
+
export { base58 } from '@scure/base';
|
|
4
8
|
export { getPolkadotSigner } from 'polkadot-api/signer';
|
|
5
|
-
export { getPolkadotSignerFromPjs } from 'polkadot-api/pjs-signer';
|
|
9
|
+
export { SignPayload, SignRaw, connectInjectedExtension, getInjectedExtensions, getPolkadotSignerFromPjs } from 'polkadot-api/pjs-signer';
|
|
6
10
|
|
|
11
|
+
type ChainInfo = {
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
ss58Prefix: number;
|
|
15
|
+
symbol: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
};
|
|
18
|
+
type SystemHealth = {
|
|
19
|
+
peers: number;
|
|
20
|
+
isSyncing: boolean;
|
|
21
|
+
shouldHavePeers: boolean;
|
|
22
|
+
};
|
|
23
|
+
interface EventPhase {
|
|
24
|
+
isApplyExtrinsic: boolean;
|
|
25
|
+
asApplyExtrinsic: {
|
|
26
|
+
eq(n: number): boolean;
|
|
27
|
+
toString(): string;
|
|
28
|
+
toNumber(): number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface EventData extends ArrayLike<{
|
|
32
|
+
toString(): string;
|
|
33
|
+
toJSON(): unknown;
|
|
34
|
+
toHuman(): unknown;
|
|
35
|
+
}> {
|
|
36
|
+
toJSON(): unknown;
|
|
37
|
+
toHuman(): unknown;
|
|
38
|
+
}
|
|
39
|
+
interface EventRecord {
|
|
40
|
+
phase: EventPhase;
|
|
41
|
+
event: {
|
|
42
|
+
section: string;
|
|
43
|
+
method: string;
|
|
44
|
+
data: EventData;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Raw block header as returned by the chain_getBlock JSON-RPC call. */
|
|
48
|
+
interface RawBlockHeader {
|
|
49
|
+
parentHash: string;
|
|
50
|
+
/** Hex-encoded block number, e.g. "0x1a2b". */
|
|
51
|
+
number: string;
|
|
52
|
+
stateRoot: string;
|
|
53
|
+
extrinsicsRoot: string;
|
|
54
|
+
digest: {
|
|
55
|
+
logs: string[];
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Raw block body returned by chain_getBlock. */
|
|
59
|
+
interface RawBlock {
|
|
60
|
+
header: RawBlockHeader;
|
|
61
|
+
/** SCALE-encoded extrinsics as 0x-hex strings. */
|
|
62
|
+
extrinsics: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Enriched block info returned by `SubstrateClient.getBlock()`.
|
|
66
|
+
* Timestamp is extracted from `Timestamp.Now` storage (with a fallback via `timestamp.set` arg).
|
|
67
|
+
* Author is decoded from PreRuntime digest logs using the chain's SS58 prefix.
|
|
68
|
+
*/
|
|
69
|
+
interface BlockInfo {
|
|
70
|
+
header: RawBlockHeader;
|
|
71
|
+
extrinsics: string[];
|
|
72
|
+
/** Unix timestamp in milliseconds, or null if not determinable. */
|
|
73
|
+
timestampMs: number | null;
|
|
74
|
+
/** SS58-encoded block author, or null if not present in digest logs. */
|
|
75
|
+
author: string | null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type DynamicBuilder = ReturnType<typeof getDynamicBuilder>;
|
|
79
|
+
type ExtrinsicDecoder = ReturnType<typeof getExtrinsicDecoder>;
|
|
7
80
|
/**
|
|
8
81
|
* Thin wrapper over polkadot-api (PAPI) that provides:
|
|
9
82
|
* - Raw JSON-RPC calls (custom Orbinum RPCs)
|
|
@@ -13,6 +86,8 @@ export { getPolkadotSignerFromPjs } from 'polkadot-api/pjs-signer';
|
|
|
13
86
|
declare class SubstrateClient {
|
|
14
87
|
private readonly _papi;
|
|
15
88
|
private constructor();
|
|
89
|
+
private _dynamicBuilder;
|
|
90
|
+
private _extDecoder;
|
|
16
91
|
/**
|
|
17
92
|
* Connects to the Orbinum node via WebSocket.
|
|
18
93
|
* Throws if the node does not respond within `timeoutMs`.
|
|
@@ -23,11 +98,55 @@ declare class SubstrateClient {
|
|
|
23
98
|
* (shieldedPool_*, accountMapping_*, privacy_*, etc.).
|
|
24
99
|
*/
|
|
25
100
|
request<T>(method: string, params?: unknown[]): Promise<T>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns basic chain information from the node.
|
|
103
|
+
* Combines `system_name`, `system_chain`, `system_properties`, and `state_getRuntimeVersion`.
|
|
104
|
+
*/
|
|
105
|
+
getChainInfo(): Promise<ChainInfo>;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the node's peer count and sync status.
|
|
108
|
+
*/
|
|
109
|
+
getHealth(): Promise<SystemHealth>;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the node's software version string.
|
|
112
|
+
*/
|
|
113
|
+
getNodeVersion(): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* Returns the genesis hash hex.
|
|
116
|
+
*/
|
|
117
|
+
getGenesisHash(): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the block hash for a given block number.
|
|
120
|
+
* Returns null when the block does not exist or has been pruned.
|
|
121
|
+
*/
|
|
122
|
+
getBlockHash(blockNumber: number): Promise<string | null>;
|
|
123
|
+
/**
|
|
124
|
+
* Fetches a block by hash or number, enriched with timestamp and block author.
|
|
125
|
+
*
|
|
126
|
+
* Uses `chain_getBlock` (works for all non-pruned blocks, unlike PAPI chainHead
|
|
127
|
+
* which only pins recent blocks). Timestamp is read from `Timestamp.Now` storage
|
|
128
|
+
* with a fallback via the `timestamp.set` extrinsic argument. Author is decoded
|
|
129
|
+
* from PreRuntime digest logs using the chain's SS58 prefix.
|
|
130
|
+
*
|
|
131
|
+
* @param hashOrNumber - A `0x`-prefixed block hash or a block number (number or decimal string).
|
|
132
|
+
* @returns `BlockInfo` or `null` if the block is not found.
|
|
133
|
+
*/
|
|
134
|
+
getBlock(hashOrNumber: string | number): Promise<BlockInfo | null>;
|
|
26
135
|
/**
|
|
27
136
|
* Returns the underlying PolkadotClient instance.
|
|
28
|
-
* Use for
|
|
137
|
+
* Use for raw metadata access and advanced SCALE operations.
|
|
29
138
|
*/
|
|
30
139
|
get polkadotClient(): PolkadotClient;
|
|
140
|
+
/**
|
|
141
|
+
* Observable that emits a new entry each time a best-block is reported by the node.
|
|
142
|
+
* Delegates to PAPI's `blocks$`.
|
|
143
|
+
*/
|
|
144
|
+
get blocks$(): PolkadotClient['blocks$'];
|
|
145
|
+
/**
|
|
146
|
+
* Returns the block header for a given tag or block hash.
|
|
147
|
+
* Delegates to PAPI's `getBlockHeader`.
|
|
148
|
+
*/
|
|
149
|
+
getBlockHeader(...args: Parameters<PolkadotClient['getBlockHeader']>): ReturnType<PolkadotClient['getBlockHeader']>;
|
|
31
150
|
/**
|
|
32
151
|
* Returns the PAPI UnsafeApi for dynamic, metadata-driven transaction building.
|
|
33
152
|
* The first access triggers a metadata fetch from the node.
|
|
@@ -66,6 +185,26 @@ declare class SubstrateClient {
|
|
|
66
185
|
signAndSubmit(callData: Uint8Array, signer: PolkadotSigner): Promise<TxFinalizedPayload>;
|
|
67
186
|
/** Closes the WebSocket connection. */
|
|
68
187
|
destroy(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Fetches and decodes all events for a given block hash.
|
|
190
|
+
* Queries `System.Events` storage via SCALE codec built from on-chain metadata.
|
|
191
|
+
*
|
|
192
|
+
* @param blockHash - The `0x`-prefixed block hash string.
|
|
193
|
+
* @returns Array of `EventRecord` or `null` if unavailable.
|
|
194
|
+
*/
|
|
195
|
+
queryBlockEvents(blockHash: string): Promise<EventRecord[] | null>;
|
|
196
|
+
getDynamicBuilder(): Promise<ReturnType<typeof getDynamicBuilder>>;
|
|
197
|
+
getExtrinsicDecoder(): Promise<ExtrinsicDecoder>;
|
|
198
|
+
private static _buildDataProxy;
|
|
199
|
+
/**
|
|
200
|
+
* Extracts the block author (validator/collator) from raw digest log hex strings.
|
|
201
|
+
* Looks for a PreRuntime log (tag byte = 6) and decodes the first 32 bytes of the
|
|
202
|
+
* SCALE-compact payload as an SS58 address using the given prefix.
|
|
203
|
+
*
|
|
204
|
+
* Can be used standalone with raw logs from `chain_getBlock` responses.
|
|
205
|
+
*/
|
|
206
|
+
static extractAuthorFromLogs(logs: string[], ss58Prefix: number): string | null;
|
|
207
|
+
private static _toEventRecords;
|
|
69
208
|
}
|
|
70
209
|
|
|
71
210
|
/**
|
|
@@ -119,11 +258,371 @@ declare class EvmClient {
|
|
|
119
258
|
getTransactionReceipt(txHash: string): Promise<Record<string, unknown> | null>;
|
|
120
259
|
}
|
|
121
260
|
|
|
261
|
+
/** Enriched EVM transaction model for explorer UIs. */
|
|
262
|
+
interface EvmTransaction {
|
|
263
|
+
hash: string;
|
|
264
|
+
blockNumber: number;
|
|
265
|
+
blockHash?: string;
|
|
266
|
+
from: string;
|
|
267
|
+
to: string | null;
|
|
268
|
+
value: string;
|
|
269
|
+
gasUsed: string;
|
|
270
|
+
gasPrice: string;
|
|
271
|
+
nonce: number;
|
|
272
|
+
input: string;
|
|
273
|
+
status: number;
|
|
274
|
+
contractAddress: string | null;
|
|
275
|
+
timestamp: number | null;
|
|
276
|
+
}
|
|
277
|
+
interface EvmLog {
|
|
278
|
+
address: string;
|
|
279
|
+
topics: string[];
|
|
280
|
+
data: string;
|
|
281
|
+
blockNumber: number;
|
|
282
|
+
transactionHash: string;
|
|
283
|
+
logIndex: number;
|
|
284
|
+
}
|
|
285
|
+
interface EvmAddressInfo {
|
|
286
|
+
address: string;
|
|
287
|
+
isContract: boolean;
|
|
288
|
+
balance: string;
|
|
289
|
+
nonce: number;
|
|
290
|
+
codeSize: number;
|
|
291
|
+
code: string;
|
|
292
|
+
recentLogs: EvmLog[];
|
|
293
|
+
}
|
|
294
|
+
interface EvmBlock {
|
|
295
|
+
hash: string;
|
|
296
|
+
number: number;
|
|
297
|
+
timestamp: number;
|
|
298
|
+
transactions: string[];
|
|
299
|
+
gasUsed: string;
|
|
300
|
+
gasLimit: string;
|
|
301
|
+
miner: string;
|
|
302
|
+
parentHash: string;
|
|
303
|
+
}
|
|
304
|
+
interface EvmTxSummary {
|
|
305
|
+
hash: string;
|
|
306
|
+
blockNumber: number;
|
|
307
|
+
timestamp: number | null;
|
|
308
|
+
from: string;
|
|
309
|
+
to: string | null;
|
|
310
|
+
value: string;
|
|
311
|
+
input: string;
|
|
312
|
+
gasUsed: number;
|
|
313
|
+
gasPrice: string;
|
|
314
|
+
status: boolean;
|
|
315
|
+
isContractCreation: boolean;
|
|
316
|
+
contractAddress: string | null;
|
|
317
|
+
}
|
|
318
|
+
interface TokenInfo {
|
|
319
|
+
address: string;
|
|
320
|
+
name: string;
|
|
321
|
+
symbol: string;
|
|
322
|
+
decimals: number;
|
|
323
|
+
totalSupply: string;
|
|
324
|
+
isErc20: boolean;
|
|
325
|
+
}
|
|
326
|
+
interface TokenTransfer {
|
|
327
|
+
transactionHash: string;
|
|
328
|
+
blockNumber: number;
|
|
329
|
+
from: string;
|
|
330
|
+
to: string;
|
|
331
|
+
value: string;
|
|
332
|
+
logIndex: number;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* High-level EVM read-model explorer built on top of EvmClient.
|
|
337
|
+
* Provides typed block/tx/address/token methods for explorer applications.
|
|
338
|
+
*/
|
|
339
|
+
declare class EvmExplorer {
|
|
340
|
+
private readonly evm;
|
|
341
|
+
constructor(evm: EvmClient);
|
|
342
|
+
getLatestBlocks(count?: number): Promise<EvmBlock[]>;
|
|
343
|
+
getBlock(hashOrNumber: string | number): Promise<EvmBlock | null>;
|
|
344
|
+
getBlockTransactions(hashOrNumber: string | number): Promise<EvmTransaction[]>;
|
|
345
|
+
getTransaction(hash: string): Promise<EvmTransaction | null>;
|
|
346
|
+
getTransactionsByAddress(address: string, maxBlocks?: number): Promise<EvmTxSummary[]>;
|
|
347
|
+
getAddressInfo(address: string): Promise<EvmAddressInfo>;
|
|
348
|
+
getBalance(address: string): Promise<string>;
|
|
349
|
+
getNonce(address: string): Promise<number>;
|
|
350
|
+
getIsContract(address: string): Promise<boolean>;
|
|
351
|
+
getTokenInfo(address: string): Promise<TokenInfo | null>;
|
|
352
|
+
getTokenTransfers(address: string, holderAddress?: string): Promise<TokenTransfer[]>;
|
|
353
|
+
getTokenBalance(tokenAddress: string, holderAddress: string): Promise<string>;
|
|
354
|
+
private parseBlock;
|
|
355
|
+
private parseTx;
|
|
356
|
+
private fetchBlock;
|
|
357
|
+
private ethCall;
|
|
358
|
+
private static decodeAbiString;
|
|
359
|
+
private static decodeAbiUint;
|
|
360
|
+
private static hexToDecimalStr;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Configuration for IndexerClient. */
|
|
364
|
+
interface IndexerClientConfig {
|
|
365
|
+
/** Base URL of the indexer REST API (no trailing slash). */
|
|
366
|
+
baseUrl: string;
|
|
367
|
+
/** Request timeout in ms. Default: 10_000. */
|
|
368
|
+
timeoutMs?: number;
|
|
369
|
+
}
|
|
370
|
+
/** Generic paginated result returned by list endpoints. */
|
|
371
|
+
interface PaginatedResult<T> {
|
|
372
|
+
data: T[];
|
|
373
|
+
pagination: {
|
|
374
|
+
page: number;
|
|
375
|
+
limit: number;
|
|
376
|
+
total: number;
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/** A shielded commitment (shield event) stored by the indexer. */
|
|
380
|
+
interface ShieldedCommitment {
|
|
381
|
+
commitmentHex: string;
|
|
382
|
+
blockNumber: number;
|
|
383
|
+
extrinsicIndex: number | null;
|
|
384
|
+
leafIndex: number;
|
|
385
|
+
/** Asset ID as decimal string (e.g. "0"). */
|
|
386
|
+
assetId: string;
|
|
387
|
+
/** SS58 or 0x-prefixed depositor address, null if not tracked. */
|
|
388
|
+
sender: string | null;
|
|
389
|
+
/** 0x-prefixed encrypted memo hex, null if not present. */
|
|
390
|
+
encryptedMemo: string | null;
|
|
391
|
+
timestampMs: number | null;
|
|
392
|
+
}
|
|
393
|
+
/** A spent nullifier stored by the indexer. */
|
|
394
|
+
interface SpentNullifier {
|
|
395
|
+
nullifierHex: string;
|
|
396
|
+
blockNumber: number;
|
|
397
|
+
extrinsicIndex: number | null;
|
|
398
|
+
txType: 'unshield' | 'private_transfer';
|
|
399
|
+
timestampMs: number | null;
|
|
400
|
+
}
|
|
401
|
+
/** A private transfer event stored by the indexer. */
|
|
402
|
+
interface PrivateTransfer {
|
|
403
|
+
/** "{blockNumber}-{extrinsicIndex}" */
|
|
404
|
+
id: string;
|
|
405
|
+
blockNumber: number;
|
|
406
|
+
extrinsicIndex: number | null;
|
|
407
|
+
/** JSON-encoded array of nullifier hex strings. */
|
|
408
|
+
inputNullifiersJson: string;
|
|
409
|
+
/** JSON-encoded array of commitment hex strings. */
|
|
410
|
+
outputCommitmentsJson: string;
|
|
411
|
+
/** JSON-encoded array of leaf index numbers. */
|
|
412
|
+
leafIndicesJson: string;
|
|
413
|
+
timestampMs: number | null;
|
|
414
|
+
}
|
|
415
|
+
/** An unshield event stored by the indexer. */
|
|
416
|
+
interface Unshield {
|
|
417
|
+
/** "{blockNumber}-{extrinsicIndex}" */
|
|
418
|
+
id: string;
|
|
419
|
+
blockNumber: number;
|
|
420
|
+
extrinsicIndex: number | null;
|
|
421
|
+
nullifierHex: string;
|
|
422
|
+
/** Asset ID as decimal string. */
|
|
423
|
+
assetId: string;
|
|
424
|
+
/** Amount as decimal string (bigint-safe). */
|
|
425
|
+
amount: string;
|
|
426
|
+
recipient: string;
|
|
427
|
+
timestampMs: number | null;
|
|
428
|
+
}
|
|
429
|
+
/** A Merkle root checkpoint stored by the indexer. */
|
|
430
|
+
interface MerkleRoot {
|
|
431
|
+
id: number;
|
|
432
|
+
rootHex: string;
|
|
433
|
+
blockNumber: number;
|
|
434
|
+
oldRootHex: string | null;
|
|
435
|
+
treeSize: number;
|
|
436
|
+
timestampMs: number | null;
|
|
437
|
+
}
|
|
438
|
+
/** Response from the nullifier status endpoint. */
|
|
439
|
+
interface NullifierStatusResult {
|
|
440
|
+
nullifier: string;
|
|
441
|
+
spent: boolean;
|
|
442
|
+
txType?: 'unshield' | 'private_transfer';
|
|
443
|
+
blockNumber?: number;
|
|
444
|
+
}
|
|
445
|
+
/** A substrate extrinsic row returned by the address indexer endpoint. */
|
|
446
|
+
interface IndexedExtrinsic {
|
|
447
|
+
id: string;
|
|
448
|
+
blockNumber: number;
|
|
449
|
+
index: number;
|
|
450
|
+
hash: string | null;
|
|
451
|
+
section: string;
|
|
452
|
+
method: string;
|
|
453
|
+
signer: string | null;
|
|
454
|
+
success: boolean;
|
|
455
|
+
feePaid: string | null;
|
|
456
|
+
eventsJson: string;
|
|
457
|
+
argsJson: string;
|
|
458
|
+
timestampMs: number | null;
|
|
459
|
+
}
|
|
460
|
+
/** An indexed EVM transaction returned by explorer endpoints. */
|
|
461
|
+
interface IndexedEvmTx {
|
|
462
|
+
hash: string;
|
|
463
|
+
blockNumber: number;
|
|
464
|
+
fromAddress: string | null;
|
|
465
|
+
toAddress: string | null;
|
|
466
|
+
value: string;
|
|
467
|
+
gasUsed: number | null;
|
|
468
|
+
gasPrice: string | null;
|
|
469
|
+
status: number | null;
|
|
470
|
+
inputData: string | null;
|
|
471
|
+
nonce: number | null;
|
|
472
|
+
transactionIndex: number | null;
|
|
473
|
+
timestampMs: number | null;
|
|
474
|
+
evmBlockHash: string | null;
|
|
475
|
+
}
|
|
476
|
+
/** An indexed block returned by the blocks endpoint. */
|
|
477
|
+
interface IndexedBlock {
|
|
478
|
+
number: number;
|
|
479
|
+
hash: string;
|
|
480
|
+
parentHash: string;
|
|
481
|
+
timestampMs: number | null;
|
|
482
|
+
author: string | null;
|
|
483
|
+
extrinsicCount: number;
|
|
484
|
+
evmTxCount: number;
|
|
485
|
+
evmHash: string | null;
|
|
486
|
+
evmParentHash?: string | null;
|
|
487
|
+
evmMiner?: string | null;
|
|
488
|
+
evmGasUsed?: string | null;
|
|
489
|
+
evmGasLimit?: string | null;
|
|
490
|
+
evmBaseFeePerGas?: string | null;
|
|
491
|
+
}
|
|
492
|
+
/** Aggregated statistics returned by the /stats endpoint. */
|
|
493
|
+
interface IndexerStats {
|
|
494
|
+
blocks: {
|
|
495
|
+
indexed: number;
|
|
496
|
+
latest: number | null;
|
|
497
|
+
latestHash: string | null;
|
|
498
|
+
latestTimestampMs: number | null;
|
|
499
|
+
};
|
|
500
|
+
extrinsics: {
|
|
501
|
+
total: number;
|
|
502
|
+
};
|
|
503
|
+
evm: {
|
|
504
|
+
transactions: number;
|
|
505
|
+
};
|
|
506
|
+
shielded: {
|
|
507
|
+
commitments: number;
|
|
508
|
+
spentNullifiers: number;
|
|
509
|
+
merkleRoot: string | null;
|
|
510
|
+
treeSize: number | null;
|
|
511
|
+
};
|
|
512
|
+
zkVerifier: {
|
|
513
|
+
total: number;
|
|
514
|
+
successful: number;
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* A single shielded activity event tied to an address.
|
|
519
|
+
* The `kind` discriminant identifies whether it is a shield (commitment),
|
|
520
|
+
* unshield, or private transfer event.
|
|
521
|
+
*/
|
|
522
|
+
type ShieldedAddressEvent = ({
|
|
523
|
+
kind: 'commitment';
|
|
524
|
+
} & ShieldedCommitment) | ({
|
|
525
|
+
kind: 'unshield';
|
|
526
|
+
} & Unshield) | ({
|
|
527
|
+
kind: 'transfer';
|
|
528
|
+
} & PrivateTransfer);
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* HTTP client for the Orbinum indexer REST API.
|
|
532
|
+
*
|
|
533
|
+
* All methods throw on network errors.
|
|
534
|
+
* Methods returning a single entity return `null` when the server responds 404.
|
|
535
|
+
*/
|
|
536
|
+
declare class IndexerClient {
|
|
537
|
+
private readonly baseUrl;
|
|
538
|
+
private readonly timeoutMs;
|
|
539
|
+
constructor(config: IndexerClientConfig);
|
|
540
|
+
private _fetchResponse;
|
|
541
|
+
private get;
|
|
542
|
+
private getOrNull;
|
|
543
|
+
private buildQuery;
|
|
544
|
+
/** Returns the total count of shielded commitments. */
|
|
545
|
+
getCommitmentsCount(): Promise<number>;
|
|
546
|
+
/** Returns a paginated list of shielded commitments. */
|
|
547
|
+
getCommitments(params?: {
|
|
548
|
+
page?: number;
|
|
549
|
+
limit?: number;
|
|
550
|
+
sinceLeafIndex?: number;
|
|
551
|
+
}): Promise<PaginatedResult<ShieldedCommitment>>;
|
|
552
|
+
/** Returns a single commitment by its hex string, or null if not found. */
|
|
553
|
+
getCommitmentByHex(hex: string): Promise<ShieldedCommitment | null>;
|
|
554
|
+
/** Returns a paginated list of spent nullifiers. */
|
|
555
|
+
getNullifiers(params?: {
|
|
556
|
+
page?: number;
|
|
557
|
+
limit?: number;
|
|
558
|
+
}): Promise<PaginatedResult<SpentNullifier>>;
|
|
559
|
+
/** Returns the spent/unspent status of a nullifier. */
|
|
560
|
+
getNullifierStatus(hex: string): Promise<NullifierStatusResult>;
|
|
561
|
+
/** Returns a paginated list of private transfer events. */
|
|
562
|
+
getTransfers(params?: {
|
|
563
|
+
page?: number;
|
|
564
|
+
limit?: number;
|
|
565
|
+
}): Promise<PaginatedResult<PrivateTransfer>>;
|
|
566
|
+
/** Returns a paginated list of unshield events. */
|
|
567
|
+
getUnshields(params?: {
|
|
568
|
+
page?: number;
|
|
569
|
+
limit?: number;
|
|
570
|
+
}): Promise<PaginatedResult<Unshield>>;
|
|
571
|
+
/** Returns a paginated list of Merkle root checkpoints. */
|
|
572
|
+
getMerkleRoots(params?: {
|
|
573
|
+
page?: number;
|
|
574
|
+
limit?: number;
|
|
575
|
+
}): Promise<PaginatedResult<MerkleRoot>>;
|
|
576
|
+
/** Returns the latest Merkle root, or null if none exists. */
|
|
577
|
+
getLatestMerkleRoot(): Promise<MerkleRoot | null>;
|
|
578
|
+
/** Returns a paginated list of extrinsics signed by the given address. */
|
|
579
|
+
getAddressExtrinsics(address: string, params?: {
|
|
580
|
+
page?: number;
|
|
581
|
+
limit?: number;
|
|
582
|
+
}): Promise<PaginatedResult<IndexedExtrinsic>>;
|
|
583
|
+
/** Returns a paginated list of EVM transactions filtered by address and/or block number. */
|
|
584
|
+
getEvmTransactions(params?: {
|
|
585
|
+
page?: number;
|
|
586
|
+
limit?: number;
|
|
587
|
+
address?: string;
|
|
588
|
+
blockNumber?: number;
|
|
589
|
+
}): Promise<PaginatedResult<IndexedEvmTx>>;
|
|
590
|
+
/** Returns a single EVM transaction by hash, or null if not found. */
|
|
591
|
+
getEvmTransactionByHash(hash: string): Promise<IndexedEvmTx | null>;
|
|
592
|
+
/** Returns a paginated list of indexed blocks. */
|
|
593
|
+
getBlocks(params?: {
|
|
594
|
+
page?: number;
|
|
595
|
+
limit?: number;
|
|
596
|
+
}): Promise<PaginatedResult<IndexedBlock>>;
|
|
597
|
+
/** Returns a single block by number or hash, or null if not found. */
|
|
598
|
+
getBlock(numberOrHash: string | number): Promise<IndexedBlock | null>;
|
|
599
|
+
/** Returns a paginated list of shielded commitments initiated by an address. */
|
|
600
|
+
getAddressCommitments(address: string, params?: {
|
|
601
|
+
page?: number;
|
|
602
|
+
limit?: number;
|
|
603
|
+
}): Promise<PaginatedResult<ShieldedCommitment>>;
|
|
604
|
+
/**
|
|
605
|
+
* Returns a paginated list of all shielded activity (commitments, unshields,
|
|
606
|
+
* private transfers) associated with the given address.
|
|
607
|
+
* Each item is tagged with a `kind` discriminant.
|
|
608
|
+
*/
|
|
609
|
+
getAddressShieldedActivity(address: string, params?: {
|
|
610
|
+
page?: number;
|
|
611
|
+
limit?: number;
|
|
612
|
+
}): Promise<PaginatedResult<ShieldedAddressEvent>>;
|
|
613
|
+
/** Returns aggregated indexer statistics. */
|
|
614
|
+
getStats(): Promise<IndexerStats>;
|
|
615
|
+
/** Returns true if the indexer health endpoint responds OK. */
|
|
616
|
+
isHealthy(): Promise<boolean>;
|
|
617
|
+
}
|
|
618
|
+
|
|
122
619
|
type OrbinumClientConfig = {
|
|
123
620
|
/** WebSocket URL of the Orbinum node (e.g. "ws://localhost:9944") */
|
|
124
621
|
substrateWs: string;
|
|
125
622
|
/** HTTP URL of the EVM JSON-RPC endpoint (e.g. "http://localhost:9933") */
|
|
126
623
|
evmRpc?: string;
|
|
624
|
+
/** Base URL of the Orbinum indexer REST API (e.g. "https://indexer.orbinum.io") */
|
|
625
|
+
indexerUrl?: string;
|
|
127
626
|
/** Connection timeout in ms. Default: 15_000 */
|
|
128
627
|
connectTimeoutMs?: number;
|
|
129
628
|
};
|
|
@@ -136,32 +635,22 @@ type TxResult = {
|
|
|
136
635
|
/** Dispatch error type string when ok = false. */
|
|
137
636
|
error?: string;
|
|
138
637
|
};
|
|
638
|
+
|
|
139
639
|
type MerkleTreeInfo = {
|
|
140
640
|
root: string;
|
|
141
641
|
treeSize: number;
|
|
142
642
|
depth: number;
|
|
143
643
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
merkleRoot: string;
|
|
147
|
-
commitmentCount: number;
|
|
148
|
-
/** Total native balance locked in the pool (u128 as decimal string). */
|
|
149
|
-
totalBalance: string;
|
|
150
|
-
treeDepth: number;
|
|
151
|
-
};
|
|
152
|
-
type MerkleProof = {
|
|
153
|
-
root: string;
|
|
644
|
+
type ScanCommitment = {
|
|
645
|
+
commitmentHex: string;
|
|
154
646
|
leafIndex: number;
|
|
155
|
-
|
|
156
|
-
};
|
|
157
|
-
type CommitmentMerkleProof = MerkleProof;
|
|
158
|
-
type NullifierStatus = {
|
|
159
|
-
nullifier: string;
|
|
160
|
-
isSpent: boolean;
|
|
647
|
+
encryptedMemo: string | null;
|
|
161
648
|
};
|
|
162
|
-
type
|
|
163
|
-
|
|
164
|
-
|
|
649
|
+
type DecryptedMemo = {
|
|
650
|
+
value: bigint;
|
|
651
|
+
ownerPk: bigint;
|
|
652
|
+
blinding: bigint;
|
|
653
|
+
assetId: bigint;
|
|
165
654
|
};
|
|
166
655
|
type ShieldParams = {
|
|
167
656
|
assetId: number;
|
|
@@ -183,20 +672,20 @@ type UnshieldParams = {
|
|
|
183
672
|
/** SS58 or 0x-prefixed 32-byte address */
|
|
184
673
|
recipientAddress: string;
|
|
185
674
|
};
|
|
186
|
-
type
|
|
675
|
+
type PrivateTransferInput = {
|
|
187
676
|
/** 0x-prefixed nullifier hex */
|
|
188
677
|
nullifier: string;
|
|
189
678
|
/** 0x-prefixed commitment hex */
|
|
190
679
|
commitment: string;
|
|
191
680
|
};
|
|
192
|
-
type
|
|
681
|
+
type PrivateTransferOutput = {
|
|
193
682
|
/** 0x-prefixed commitment hex */
|
|
194
683
|
commitment: string;
|
|
195
684
|
encryptedMemo?: Uint8Array;
|
|
196
685
|
};
|
|
197
686
|
type PrivateTransferParams = {
|
|
198
|
-
inputs:
|
|
199
|
-
outputs:
|
|
687
|
+
inputs: PrivateTransferInput[];
|
|
688
|
+
outputs: PrivateTransferOutput[];
|
|
200
689
|
/** ZK proof bytes */
|
|
201
690
|
proof: Uint8Array;
|
|
202
691
|
/** 0x-prefixed merkle root hex */
|
|
@@ -256,21 +745,82 @@ type ShieldResult = {
|
|
|
256
745
|
txResult: TxResult;
|
|
257
746
|
note: ZkNote;
|
|
258
747
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
748
|
+
/** Parameters for a single item in a shield_batch extrinsic. */
|
|
749
|
+
type ShieldBatchItem = {
|
|
750
|
+
assetId: number;
|
|
751
|
+
amount: bigint;
|
|
752
|
+
/** 0x-prefixed 32-byte commitment hex */
|
|
753
|
+
commitment: string;
|
|
754
|
+
/** Optional encrypted memo bytes. Auto-generates a dummy memo if absent. */
|
|
755
|
+
encryptedMemo?: Uint8Array;
|
|
263
756
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
alias: string | null;
|
|
757
|
+
/** Parameters for shieldedPool.shieldBatch — deposits up to 20 notes in one extrinsic. */
|
|
758
|
+
type ShieldBatchParams = {
|
|
759
|
+
items: ShieldBatchItem[];
|
|
268
760
|
};
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* High-level module for Orbinum shielded-pool operations.
|
|
764
|
+
*
|
|
765
|
+
* Transactions are built via polkadot-api's UnsafeApi (metadata-driven),
|
|
766
|
+
* which means the Orbinum node must be reachable on first use.
|
|
767
|
+
* Signing is delegated to a PolkadotSigner (see polkadot-api/signer).
|
|
768
|
+
*
|
|
769
|
+
* Parameter order matches the Orbinum runtime extrinsics exactly.
|
|
770
|
+
*/
|
|
771
|
+
declare class ShieldedPoolModule {
|
|
772
|
+
private readonly substrate;
|
|
773
|
+
constructor(substrate: SubstrateClient);
|
|
774
|
+
/**
|
|
775
|
+
* Deposits tokens into the shielded pool.
|
|
776
|
+
* Extrinsic: shieldedPool.shield(assetId, amount, commitment, encryptedMemo)
|
|
777
|
+
*/
|
|
778
|
+
shield(params: ShieldParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
779
|
+
/**
|
|
780
|
+
* Build a ZkNote locally and submit shieldedPool.shield in one call.
|
|
781
|
+
*
|
|
782
|
+
* Returns both the on-chain result and the note — **save the note locally**,
|
|
783
|
+
* it cannot be recovered after the fact.
|
|
784
|
+
*
|
|
785
|
+
* @param params.value Amount in planck (required).
|
|
786
|
+
* @param params.assetId Asset ID — default 0 (native ORB-Privacy).
|
|
787
|
+
* @param params.ownerPk BabyJubJub Ax (default 0n).
|
|
788
|
+
* @param params.blinding Random blinding scalar (default BigInt(Date.now())).
|
|
789
|
+
* @param params.spendingKey Secret spending key (default 0n).
|
|
790
|
+
*/
|
|
791
|
+
buildAndShield(params: {
|
|
792
|
+
value: bigint;
|
|
793
|
+
assetId?: number;
|
|
794
|
+
ownerPk?: bigint;
|
|
795
|
+
blinding?: bigint;
|
|
796
|
+
spendingKey?: bigint;
|
|
797
|
+
}, signer: PolkadotSigner): Promise<ShieldResult>;
|
|
798
|
+
/**
|
|
799
|
+
* Withdraws tokens from the shielded pool to a public address.
|
|
800
|
+
* Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)
|
|
801
|
+
*/
|
|
802
|
+
unshield(params: UnshieldParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
803
|
+
/**
|
|
804
|
+
* Performs a private (shielded) transfer between two notes.
|
|
805
|
+
* Extrinsic: shieldedPool.privateTransfer(inputs, outputs, proof, merkleRoot)
|
|
806
|
+
*/
|
|
807
|
+
privateTransfer(params: PrivateTransferParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
808
|
+
/**
|
|
809
|
+
* Deposits multiple notes into the shielded pool in a single extrinsic.
|
|
810
|
+
* Extrinsic: shieldedPool.shieldBatch(operations) — max 20 items.
|
|
811
|
+
*/
|
|
812
|
+
shieldBatch(params: ShieldBatchParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
813
|
+
}
|
|
814
|
+
|
|
269
815
|
/**
|
|
270
816
|
* Signature verification scheme for cross-chain links.
|
|
271
817
|
* Mirrors `SignatureScheme` in pallet-account-mapping.
|
|
272
818
|
*/
|
|
273
|
-
|
|
819
|
+
declare const SignatureScheme: {
|
|
820
|
+
readonly Eip191: "Eip191";
|
|
821
|
+
readonly Ed25519: "Ed25519";
|
|
822
|
+
};
|
|
823
|
+
type SignatureScheme = (typeof SignatureScheme)[keyof typeof SignatureScheme];
|
|
274
824
|
/** A verified public link to an external chain wallet. */
|
|
275
825
|
type ChainLink = {
|
|
276
826
|
chainId: number;
|
|
@@ -320,159 +870,9 @@ type AccountListing = {
|
|
|
320
870
|
/** A supported chain and its signature verification scheme. */
|
|
321
871
|
type SupportedChain = {
|
|
322
872
|
chainId: number;
|
|
323
|
-
scheme: SignatureScheme
|
|
324
|
-
};
|
|
325
|
-
/**
|
|
326
|
-
* Bitmask to convert a SLIP-0044 coin type into an Orbinum ChainId.
|
|
327
|
-
* Example: `SLIP0044_NAMESPACE | 501` = Solana.
|
|
328
|
-
*/
|
|
329
|
-
declare const SLIP0044_NAMESPACE = 2147483648;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Queries the Orbinum shielded-pool Merkle tree via custom RPC methods.
|
|
333
|
-
*/
|
|
334
|
-
declare class MerkleModule {
|
|
335
|
-
private readonly substrate;
|
|
336
|
-
constructor(substrate: SubstrateClient);
|
|
337
|
-
/**
|
|
338
|
-
* Returns the current Merkle tree state: root, number of leaves, and depth.
|
|
339
|
-
*/
|
|
340
|
-
getTreeInfo(): Promise<MerkleTreeInfo>;
|
|
341
|
-
/**
|
|
342
|
-
* Returns the Merkle inclusion proof for a leaf at `leafIndex`.
|
|
343
|
-
*/
|
|
344
|
-
getProof(leafIndex: number): Promise<MerkleProof>;
|
|
345
|
-
/**
|
|
346
|
-
* Returns the Merkle inclusion proof for a given commitment (0x-prefixed hex).
|
|
347
|
-
* Searches the tree for the commitment and returns its proof.
|
|
348
|
-
*/
|
|
349
|
-
getProofByCommitment(commitmentHex: string): Promise<MerkleProof>;
|
|
350
|
-
/**
|
|
351
|
-
* Returns the current Merkle root without fetching the full tree info.
|
|
352
|
-
*/
|
|
353
|
-
getRoot(): Promise<string>;
|
|
354
|
-
/**
|
|
355
|
-
* Returns an array of commitment leaves from index `from` to `to` (inclusive).
|
|
356
|
-
* Defaults to returning all leaves.
|
|
357
|
-
*/
|
|
358
|
-
getLeaves(from?: number, to?: number): Promise<string[]>;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* High-level module for Orbinum shielded-pool operations.
|
|
363
|
-
*
|
|
364
|
-
* Transactions are built via polkadot-api's UnsafeApi (metadata-driven),
|
|
365
|
-
* which means the Orbinum node must be reachable on first use.
|
|
366
|
-
* Signing is delegated to a PolkadotSigner (see polkadot-api/signer).
|
|
367
|
-
*
|
|
368
|
-
* Parameter order matches the Orbinum runtime extrinsics exactly.
|
|
369
|
-
*/
|
|
370
|
-
declare class ShieldedPoolModule {
|
|
371
|
-
private readonly substrate;
|
|
372
|
-
readonly merkle: MerkleModule;
|
|
373
|
-
constructor(substrate: SubstrateClient, merkle: MerkleModule);
|
|
374
|
-
/**
|
|
375
|
-
* Deposits tokens into the shielded pool.
|
|
376
|
-
* Extrinsic: shieldedPool.shield(assetId, amount, commitment, encryptedMemo)
|
|
377
|
-
*/
|
|
378
|
-
shield(params: ShieldParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
379
|
-
/**
|
|
380
|
-
* Build a ZkNote locally and submit shieldedPool.shield in one call.
|
|
381
|
-
*
|
|
382
|
-
* Returns both the on-chain result and the note — **save the note locally**,
|
|
383
|
-
* it cannot be recovered after the fact.
|
|
384
|
-
*
|
|
385
|
-
* @param params.value Amount in planck (required).
|
|
386
|
-
* @param params.assetId Asset ID — default 0 (native ORB-Privacy).
|
|
387
|
-
* @param params.ownerPk BabyJubJub Ax (default 0n).
|
|
388
|
-
* @param params.blinding Random blinding scalar (default BigInt(Date.now())).
|
|
389
|
-
* @param params.spendingKey Secret spending key (default 0n).
|
|
390
|
-
*/
|
|
391
|
-
buildAndShield(params: {
|
|
392
|
-
value: bigint;
|
|
393
|
-
assetId?: number;
|
|
394
|
-
ownerPk?: bigint;
|
|
395
|
-
blinding?: bigint;
|
|
396
|
-
spendingKey?: bigint;
|
|
397
|
-
}, signer: PolkadotSigner): Promise<ShieldResult>;
|
|
398
|
-
/**
|
|
399
|
-
* Withdraws tokens from the shielded pool to a public address.
|
|
400
|
-
* Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)
|
|
401
|
-
*/
|
|
402
|
-
unshield(params: UnshieldParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
403
|
-
/**
|
|
404
|
-
* Performs a private (shielded) transfer between two notes.
|
|
405
|
-
* Extrinsic: shieldedPool.privateTransfer(inputs, outputs, proof, merkleRoot)
|
|
406
|
-
*/
|
|
407
|
-
privateTransfer(params: PrivateTransferParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
408
|
-
/** Returns whether a nullifier has already been spent. */
|
|
409
|
-
isNullifierSpent(nullifierHex: string): Promise<boolean>;
|
|
410
|
-
/** Returns the full nullifier status object. */
|
|
411
|
-
getNullifierStatus(nullifierHex: string): Promise<NullifierStatus>;
|
|
412
|
-
/** Returns the total locked balance in the pool for a given asset. */
|
|
413
|
-
getPoolBalance(assetId: number): Promise<PoolBalance>;
|
|
414
|
-
/**
|
|
415
|
-
* Returns Merkle tree info and pool balance for a given asset in a single call.
|
|
416
|
-
* Convenience wrapper used by both `app` and `privacy-explorer`.
|
|
417
|
-
*/
|
|
418
|
-
getPoolStats(assetId?: number): Promise<{
|
|
419
|
-
merkle: MerkleTreeInfo;
|
|
420
|
-
balance: PoolBalance;
|
|
421
|
-
}>;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
type RawSystemHealth = {
|
|
425
|
-
peers: number;
|
|
426
|
-
isSyncing: boolean;
|
|
427
|
-
shouldHavePeers: boolean;
|
|
873
|
+
scheme: SignatureScheme;
|
|
428
874
|
};
|
|
429
|
-
/**
|
|
430
|
-
* Provides general chain queries: node info, account mapping, address resolution.
|
|
431
|
-
*/
|
|
432
|
-
declare class ChainModule {
|
|
433
|
-
private readonly substrate;
|
|
434
|
-
private readonly evm;
|
|
435
|
-
constructor(substrate: SubstrateClient, evm: EvmClient | null);
|
|
436
|
-
/**
|
|
437
|
-
* Returns basic chain information from the node.
|
|
438
|
-
*/
|
|
439
|
-
getChainInfo(): Promise<ChainInfo>;
|
|
440
|
-
/**
|
|
441
|
-
* Returns the node's peer count and sync status.
|
|
442
|
-
*/
|
|
443
|
-
getHealth(): Promise<RawSystemHealth>;
|
|
444
|
-
/**
|
|
445
|
-
* Returns the node's software version string.
|
|
446
|
-
*/
|
|
447
|
-
getNodeVersion(): Promise<string>;
|
|
448
|
-
/**
|
|
449
|
-
* Returns the genesis hash hex.
|
|
450
|
-
*/
|
|
451
|
-
getGenesisHash(): Promise<string>;
|
|
452
|
-
/**
|
|
453
|
-
* Resolves the full identity (Substrate + EVM addresses, alias) for an account.
|
|
454
|
-
* Accepts an EVM address (0x...) or a Substrate account hex (0x...32bytes).
|
|
455
|
-
*/
|
|
456
|
-
getFullIdentity(address: string): Promise<FullIdentityInfo | null>;
|
|
457
|
-
/**
|
|
458
|
-
* Returns the mapped Substrate account hex for a given EVM address, or null.
|
|
459
|
-
*/
|
|
460
|
-
getMappedAccountByEvm(evmAddress: string): Promise<string | null>;
|
|
461
|
-
/**
|
|
462
|
-
* Returns the alias registered for a Substrate account, or null.
|
|
463
|
-
*/
|
|
464
|
-
getAliasOf(accountHex: string): Promise<string | null>;
|
|
465
|
-
/**
|
|
466
|
-
* Returns estimated EVM chain ID from the EVM RPC endpoint. Requires evmRpc
|
|
467
|
-
* to have been provided in `OrbinumClientConfig`.
|
|
468
|
-
*/
|
|
469
|
-
getEvmChainId(): Promise<number>;
|
|
470
|
-
/**
|
|
471
|
-
* Returns the current EVM block number.
|
|
472
|
-
*/
|
|
473
|
-
getEvmBlockNumber(): Promise<number>;
|
|
474
|
-
}
|
|
475
|
-
|
|
875
|
+
/** Parameters for adding a verified public chain link. */
|
|
476
876
|
type AddChainLinkParams = {
|
|
477
877
|
/** External chain ID. Use SLIP0044_NAMESPACE | coinType for SLIP-0044 chains. */
|
|
478
878
|
chainId: number;
|
|
@@ -481,16 +881,19 @@ type AddChainLinkParams = {
|
|
|
481
881
|
/** Signature over the caller's AccountId32 (64 bytes for Ed25519, 65 for EIP-191). */
|
|
482
882
|
signature: Uint8Array;
|
|
483
883
|
};
|
|
884
|
+
/** Parameters for updating public profile metadata. */
|
|
484
885
|
type SetMetadataParams = {
|
|
485
886
|
displayName?: string | null;
|
|
486
887
|
bio?: string | null;
|
|
487
888
|
avatar?: string | null;
|
|
488
889
|
};
|
|
890
|
+
/** Parameters for listing an alias on the marketplace. */
|
|
489
891
|
type PutOnSaleParams = {
|
|
490
892
|
price: bigint;
|
|
491
893
|
/** If true the sale becomes OTC (whitelist required). */
|
|
492
894
|
isPrivate: boolean;
|
|
493
895
|
};
|
|
896
|
+
/** Parameters for dispatching a call authenticated by a linked external account. */
|
|
494
897
|
type DispatchAsLinkedParams = {
|
|
495
898
|
/** Owner AccountId32 hex (0x-prefixed 64 chars). */
|
|
496
899
|
owner: string;
|
|
@@ -501,6 +904,12 @@ type DispatchAsLinkedParams = {
|
|
|
501
904
|
/** Encoded call bytes (SCALE). */
|
|
502
905
|
callData: Uint8Array;
|
|
503
906
|
};
|
|
907
|
+
/**
|
|
908
|
+
* Bitmask to convert a SLIP-0044 coin type into an Orbinum ChainId.
|
|
909
|
+
* Example: `SLIP0044_NAMESPACE | 501` = Solana.
|
|
910
|
+
*/
|
|
911
|
+
declare const SLIP0044_NAMESPACE = 2147483648;
|
|
912
|
+
|
|
504
913
|
/**
|
|
505
914
|
* Module for Orbinum pallet-account-mapping:
|
|
506
915
|
* - Query on-chain identity data (aliases, chain links, metadata, marketplace)
|
|
@@ -650,18 +1059,100 @@ declare class AccountMappingModule {
|
|
|
650
1059
|
dispatchAsLinkedAccount(params: DispatchAsLinkedParams, signer: PolkadotSigner): Promise<TxResult>;
|
|
651
1060
|
}
|
|
652
1061
|
|
|
1062
|
+
type RpcV2MerkleProof = {
|
|
1063
|
+
path: string[];
|
|
1064
|
+
leafIndex: number;
|
|
1065
|
+
treeDepth: number;
|
|
1066
|
+
};
|
|
1067
|
+
/** Prueba Merkle enriquecida con el `root` actual del árbol. Devuelta por `getMerkleProofByCommitment`. */
|
|
1068
|
+
type PrivacyMerkleProof = RpcV2MerkleProof & {
|
|
1069
|
+
root: string;
|
|
1070
|
+
};
|
|
1071
|
+
type RpcV2NullifierStatus = {
|
|
1072
|
+
nullifier: string;
|
|
1073
|
+
isSpent: boolean;
|
|
1074
|
+
};
|
|
1075
|
+
type RpcV2PoolAssetBalance = {
|
|
1076
|
+
assetId: number;
|
|
1077
|
+
/** Balance serializado como string decimal para preservar `u128`. */
|
|
1078
|
+
balance: string;
|
|
1079
|
+
};
|
|
1080
|
+
type RpcV2PoolStats = {
|
|
1081
|
+
merkleRoot: string;
|
|
1082
|
+
commitmentCount: number;
|
|
1083
|
+
/** Total pool balance serializado como string decimal para preservar `u128`. */
|
|
1084
|
+
totalBalance: string;
|
|
1085
|
+
assetBalances: RpcV2PoolAssetBalance[];
|
|
1086
|
+
treeDepth: number;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
653
1089
|
/**
|
|
654
|
-
*
|
|
1090
|
+
* Typed client for the Orbinum `rpc-v2` endpoints under the `privacy_*` namespace.
|
|
655
1091
|
*/
|
|
656
|
-
declare
|
|
1092
|
+
declare class PrivacyModule {
|
|
1093
|
+
private readonly substrate;
|
|
1094
|
+
constructor(substrate: SubstrateClient);
|
|
1095
|
+
/** Returns the current Merkle tree root. */
|
|
1096
|
+
getMerkleRoot(): Promise<string>;
|
|
1097
|
+
/** Returns the Merkle proof for the given leaf index or commitment hex. */
|
|
1098
|
+
getMerkleProof(leafIndex: number | string): Promise<RpcV2MerkleProof>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Returns the Merkle inclusion proof for a given commitment hex,
|
|
1101
|
+
* bundled with the current Merkle root.
|
|
1102
|
+
*/
|
|
1103
|
+
getMerkleProofByCommitment(commitmentHex: string): Promise<PrivacyMerkleProof>;
|
|
1104
|
+
/** Returns the spend status of a nullifier. */
|
|
1105
|
+
getNullifierStatus(nullifier: string): Promise<RpcV2NullifierStatus>;
|
|
1106
|
+
/** Returns aggregated statistics for the shielded pool from `rpc-v2`. */
|
|
1107
|
+
getPoolStats(): Promise<RpcV2PoolStats>;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/** Public (camelCase) types for `zkVerifier_*` RPC responses. */
|
|
1111
|
+
type ZkVerifierVkHash = {
|
|
1112
|
+
version: number;
|
|
1113
|
+
vkHash: string;
|
|
1114
|
+
/** On-chain verification statistics for this version (if available). */
|
|
1115
|
+
stats?: ZkVerifierVersionStats;
|
|
1116
|
+
};
|
|
1117
|
+
/** Proof verification counts for a specific circuit version. */
|
|
1118
|
+
type ZkVerifierVersionStats = {
|
|
1119
|
+
/** Total proof verification attempts. */
|
|
1120
|
+
total: number;
|
|
1121
|
+
/** Successful verifications. */
|
|
1122
|
+
successful: number;
|
|
1123
|
+
/** Failed verifications. */
|
|
1124
|
+
failed: number;
|
|
1125
|
+
};
|
|
657
1126
|
/**
|
|
658
|
-
*
|
|
1127
|
+
* A version whose VK was removed from storage but whose stats record survived.
|
|
1128
|
+
* The key data is gone; only the usage record remains.
|
|
659
1129
|
*/
|
|
660
|
-
|
|
1130
|
+
type ZkVerifierHistoricalVersion = {
|
|
1131
|
+
version: number;
|
|
1132
|
+
stats: ZkVerifierVersionStats;
|
|
1133
|
+
};
|
|
1134
|
+
type ZkVerifierCircuitVersionInfo = {
|
|
1135
|
+
circuitId: number;
|
|
1136
|
+
activeVersion: number;
|
|
1137
|
+
/** Proof system (e.g. 'Groth16'). */
|
|
1138
|
+
proofSystem: string;
|
|
1139
|
+
supportedVersions: number[];
|
|
1140
|
+
vkHashes: ZkVerifierVkHash[];
|
|
1141
|
+
/** Versions removed from storage that still have stats records. */
|
|
1142
|
+
historicalVersions: ZkVerifierHistoricalVersion[];
|
|
1143
|
+
};
|
|
1144
|
+
|
|
661
1145
|
/**
|
|
662
|
-
*
|
|
1146
|
+
* Typed client for `zkVerifier_*` JSON-RPC endpoints.
|
|
663
1147
|
*/
|
|
664
|
-
declare
|
|
1148
|
+
declare class ZkVerifierModule {
|
|
1149
|
+
private readonly substrate;
|
|
1150
|
+
constructor(substrate: SubstrateClient);
|
|
1151
|
+
/** Returns basic version info for all registered circuits. */
|
|
1152
|
+
getAllCircuitVersions(): Promise<ZkVerifierCircuitVersionInfo[]>;
|
|
1153
|
+
/** Returns version info for a specific circuit, or null if not found. */
|
|
1154
|
+
getCircuitVersionInfo(circuitId: number): Promise<ZkVerifierCircuitVersionInfo | null>;
|
|
1155
|
+
}
|
|
665
1156
|
|
|
666
1157
|
/** EVM transaction request passed to an `EvmSigner` callback. */
|
|
667
1158
|
type EvmTxRequest = {
|
|
@@ -669,14 +1160,43 @@ type EvmTxRequest = {
|
|
|
669
1160
|
data: string;
|
|
670
1161
|
value?: bigint;
|
|
671
1162
|
};
|
|
1163
|
+
/** Callback that signs and submits an EVM transaction, returning the tx hash. */
|
|
1164
|
+
type EvmSigner = (tx: EvmTxRequest) => Promise<string>;
|
|
1165
|
+
type ResolvedAlias = {
|
|
1166
|
+
/** AccountId32 hex of the alias owner (as 0x-prefixed 20-byte EVM address). */
|
|
1167
|
+
owner: string;
|
|
1168
|
+
/** EVM address of the owner, or null if unset. */
|
|
1169
|
+
evmAddress: string | null;
|
|
1170
|
+
};
|
|
1171
|
+
/** Metadata for a known precompile: display name and function selector map. */
|
|
1172
|
+
interface KnownPrecompileInfo {
|
|
1173
|
+
/** Human-readable name, e.g. "ShieldedPool". */
|
|
1174
|
+
name: string;
|
|
1175
|
+
/** Map from 4-byte hex selector (no 0x prefix) to function signature. */
|
|
1176
|
+
functions: Record<string, string>;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
672
1179
|
/**
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
* MetaMask: `(tx) => window.ethereum.request({ method: 'eth_sendTransaction', params: [{ ...tx, from: account }] })`
|
|
676
|
-
* ethers: `(tx) => (await signer.sendTransaction({ to: tx.to, data: tx.data })).hash`
|
|
677
|
-
* viem: `(tx) => walletClient.sendTransaction({ to: tx.to, data: tx.data })`
|
|
1180
|
+
* Converts a Uint8Array or number[] to a 0x-prefixed lowercase hex string.
|
|
678
1181
|
*/
|
|
679
|
-
|
|
1182
|
+
declare function toHex(bytes: Uint8Array | number[]): string;
|
|
1183
|
+
/**
|
|
1184
|
+
* Decodes a hex string (with or without 0x prefix) to Uint8Array.
|
|
1185
|
+
*/
|
|
1186
|
+
declare function fromHex(hex: string): Uint8Array;
|
|
1187
|
+
/**
|
|
1188
|
+
* Ensures a hex string has the 0x prefix.
|
|
1189
|
+
*/
|
|
1190
|
+
declare function ensureHexPrefix(hex: string): string;
|
|
1191
|
+
/**
|
|
1192
|
+
* Converts a 0x-prefixed hex string (as returned by JSON-RPC) to a number.
|
|
1193
|
+
*/
|
|
1194
|
+
declare function hexToNumber(hex: string): number;
|
|
1195
|
+
/**
|
|
1196
|
+
* Converts a 0x-prefixed hex string (as returned by JSON-RPC) to a bigint.
|
|
1197
|
+
*/
|
|
1198
|
+
declare function hexToBigint(hex: string): bigint;
|
|
1199
|
+
|
|
680
1200
|
/**
|
|
681
1201
|
* Bindings for the `ShieldedPoolPrecompile` at address `0x...0801`.
|
|
682
1202
|
*
|
|
@@ -756,12 +1276,6 @@ declare class ShieldedPoolPrecompile {
|
|
|
756
1276
|
estimateUnshieldGas(params: UnshieldParams, from: string): Promise<bigint>;
|
|
757
1277
|
}
|
|
758
1278
|
|
|
759
|
-
type ResolvedAlias = {
|
|
760
|
-
/** AccountId32 hex of the alias owner (as 0x-prefixed 20-byte EVM address). */
|
|
761
|
-
owner: string;
|
|
762
|
-
/** EVM address of the owner, or null if unset. */
|
|
763
|
-
evmAddress: string | null;
|
|
764
|
-
};
|
|
765
1279
|
/**
|
|
766
1280
|
* EVM bindings for `AccountMappingPrecompile` at address `0x...0800`.
|
|
767
1281
|
*
|
|
@@ -890,10 +1404,25 @@ declare class AccountMappingPrecompile {
|
|
|
890
1404
|
/**
|
|
891
1405
|
* Updates the signer's public profile metadata.
|
|
892
1406
|
* Pass `null` for any field to leave it unchanged.
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
1407
|
+
}
|
|
1408
|
+
displayName: string | null,
|
|
1409
|
+
bio: string | null,
|
|
1410
|
+
avatar: string | null,
|
|
1411
|
+
signer: EvmSigner
|
|
1412
|
+
): Promise<string> {
|
|
1413
|
+
const enc = (v: string | null): Uint8Array =>
|
|
1414
|
+
v != null ? new TextEncoder().encode(v) : new Uint8Array(0);
|
|
1415
|
+
const data = encodeHex(
|
|
1416
|
+
AM_SEL.SET_ACCOUNT_METADATA,
|
|
1417
|
+
{ type: 'bytes', value: enc(displayName) },
|
|
1418
|
+
{ type: 'bytes', value: enc(bio) },
|
|
1419
|
+
{ type: 'bytes', value: enc(avatar) }
|
|
1420
|
+
);
|
|
1421
|
+
return signer({ to: this.addr, data });
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// ─── Calldata builders (for custom signing / batching) ─────────────────────
|
|
1425
|
+
|
|
897
1426
|
/** Returns the raw ABI-encoded calldata for `registerAlias`. */
|
|
898
1427
|
buildRegisterAliasCalldata(alias: string): string;
|
|
899
1428
|
/** Returns the raw ABI-encoded calldata for `mapAccount`. */
|
|
@@ -983,9 +1512,9 @@ declare class CryptoPrecompiles {
|
|
|
983
1512
|
* evmRpc: 'http://localhost:9933',
|
|
984
1513
|
* });
|
|
985
1514
|
*
|
|
986
|
-
* // Query Merkle tree
|
|
987
|
-
* const
|
|
988
|
-
* console.log('root:',
|
|
1515
|
+
* // Query Merkle tree stats
|
|
1516
|
+
* const stats = await client.privacy.getPoolStats();
|
|
1517
|
+
* console.log('root:', stats.merkleRoot, 'leaves:', stats.commitmentCount);
|
|
989
1518
|
*
|
|
990
1519
|
* // Shield tokens (with a PolkadotSigner)
|
|
991
1520
|
* const result = await client.shieldedPool.shield(
|
|
@@ -1002,12 +1531,24 @@ declare class OrbinumClient {
|
|
|
1002
1531
|
readonly substrate: SubstrateClient;
|
|
1003
1532
|
/** Raw access to the EVM HTTP JSON-RPC endpoint (if configured). */
|
|
1004
1533
|
readonly evm: EvmClient | null;
|
|
1534
|
+
/**
|
|
1535
|
+
* High-level EVM block and transaction explorer (if `evmRpc` is configured).
|
|
1536
|
+
* Provides enriched queries for blocks, transactions, addresses, and token transfers.
|
|
1537
|
+
*/
|
|
1538
|
+
readonly evmExplorer: EvmExplorer | null;
|
|
1539
|
+
/**
|
|
1540
|
+
* HTTP client for the Orbinum indexer REST API (if `indexerUrl` is configured).
|
|
1541
|
+
* Provides paginated access to indexed blocks, extrinsics, shielded events, and nullifiers.
|
|
1542
|
+
*/
|
|
1543
|
+
readonly indexer: IndexerClient | null;
|
|
1005
1544
|
/** Shielded-pool operations: shield, unshield, privateTransfer, and merkle queries. */
|
|
1006
1545
|
readonly shieldedPool: ShieldedPoolModule;
|
|
1007
|
-
/** General chain queries: node info, identity resolution. */
|
|
1008
|
-
readonly chain: ChainModule;
|
|
1009
1546
|
/** Account mapping: aliases, chain links, metadata, marketplace, and identity extrinsics. */
|
|
1010
1547
|
readonly accountMapping: AccountMappingModule;
|
|
1548
|
+
/** Typed access to Orbinum `privacy_*` RPC endpoints. */
|
|
1549
|
+
readonly privacy: PrivacyModule;
|
|
1550
|
+
/** Typed access to zkVerifier_* RPC endpoints. */
|
|
1551
|
+
readonly zkVerifier: ZkVerifierModule;
|
|
1011
1552
|
/**
|
|
1012
1553
|
* EVM precompiles: shielded pool + account mapping callable from an EVM wallet.
|
|
1013
1554
|
* Only available when `evmRpc` is configured. Methods throw if `evm` is null.
|
|
@@ -1026,14 +1567,84 @@ declare class OrbinumClient {
|
|
|
1026
1567
|
* Throws if the Substrate node is unreachable within `connectTimeoutMs`.
|
|
1027
1568
|
*/
|
|
1028
1569
|
static connect(config: OrbinumClientConfig): Promise<OrbinumClient>;
|
|
1029
|
-
/**
|
|
1030
|
-
* Convenience getter for the Merkle module (shortcut for `shieldedPool.merkle`).
|
|
1031
|
-
*/
|
|
1032
|
-
get merkle(): MerkleModule;
|
|
1033
1570
|
/** Closes the WebSocket connection to the Substrate node. */
|
|
1034
1571
|
destroy(): void;
|
|
1035
1572
|
}
|
|
1036
1573
|
|
|
1574
|
+
type ConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'reconnecting';
|
|
1575
|
+
type StatusChangeEvent = {
|
|
1576
|
+
status: ConnectionStatus;
|
|
1577
|
+
error?: string;
|
|
1578
|
+
};
|
|
1579
|
+
type StatusListener = (event: StatusChangeEvent) => void;
|
|
1580
|
+
interface ClientProviderConfig {
|
|
1581
|
+
substrateWs: string;
|
|
1582
|
+
evmRpc?: string;
|
|
1583
|
+
/** Base URL of the Orbinum indexer REST API (e.g. "https://indexer.orbinum.io") */
|
|
1584
|
+
indexerUrl?: string;
|
|
1585
|
+
connectTimeoutMs?: number;
|
|
1586
|
+
heartbeatIntervalMs?: number;
|
|
1587
|
+
heartbeatTimeoutMs?: number;
|
|
1588
|
+
reconnectBaseMs?: number;
|
|
1589
|
+
reconnectMaxMs?: number;
|
|
1590
|
+
}
|
|
1591
|
+
/**
|
|
1592
|
+
* Manages the lifecycle of an `OrbinumClient` with heartbeat monitoring,
|
|
1593
|
+
* exponential-backoff reconnection, and status event emission.
|
|
1594
|
+
*
|
|
1595
|
+
* Instantiate one per application and use as a singleton.
|
|
1596
|
+
*
|
|
1597
|
+
* @example
|
|
1598
|
+
* ```ts
|
|
1599
|
+
* import { OrbinumClientProvider } from '@orbinum/sdk';
|
|
1600
|
+
*
|
|
1601
|
+
* const provider = new OrbinumClientProvider({
|
|
1602
|
+
* substrateWs: 'ws://localhost:9944',
|
|
1603
|
+
* evmRpc: 'http://localhost:9944',
|
|
1604
|
+
* });
|
|
1605
|
+
* provider.connect();
|
|
1606
|
+
*
|
|
1607
|
+
* const client = await provider.getOrbinumClient();
|
|
1608
|
+
* ```
|
|
1609
|
+
*/
|
|
1610
|
+
declare class OrbinumClientProvider {
|
|
1611
|
+
private readonly config;
|
|
1612
|
+
private readonly connectTimeoutMs;
|
|
1613
|
+
private readonly heartbeatIntervalMs;
|
|
1614
|
+
private readonly heartbeatTimeoutMs;
|
|
1615
|
+
private readonly reconnectBaseMs;
|
|
1616
|
+
private readonly reconnectMaxMs;
|
|
1617
|
+
private _status;
|
|
1618
|
+
private _orbinumClient;
|
|
1619
|
+
private _connectingPromise;
|
|
1620
|
+
private _heartbeatTimer;
|
|
1621
|
+
private _reconnectTimer;
|
|
1622
|
+
private _reconnectAttempt;
|
|
1623
|
+
private _listeners;
|
|
1624
|
+
constructor(config: ClientProviderConfig);
|
|
1625
|
+
get status(): ConnectionStatus;
|
|
1626
|
+
private setStatus;
|
|
1627
|
+
onStatusChange(listener: StatusListener): () => void;
|
|
1628
|
+
connect(): void;
|
|
1629
|
+
reset(): void;
|
|
1630
|
+
private startConnectAttempt;
|
|
1631
|
+
private attemptConnect;
|
|
1632
|
+
private startHeartbeat;
|
|
1633
|
+
private stopHeartbeat;
|
|
1634
|
+
private probe;
|
|
1635
|
+
private scheduleReconnect;
|
|
1636
|
+
private cancelReconnect;
|
|
1637
|
+
private teardownClient;
|
|
1638
|
+
getOrbinumClient(): Promise<OrbinumClient>;
|
|
1639
|
+
tryGetOrbinumClient(): Promise<OrbinumClient | null>;
|
|
1640
|
+
rpcSend<T>(method: string, params?: unknown[]): Promise<T>;
|
|
1641
|
+
evmRpc<T>(method: string, params?: unknown[]): Promise<T>;
|
|
1642
|
+
evmRpcBatch<T extends unknown[]>(calls: Array<{
|
|
1643
|
+
method: string;
|
|
1644
|
+
params?: unknown[];
|
|
1645
|
+
}>): Promise<T>;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1037
1648
|
/**
|
|
1038
1649
|
* Builds ZK notes (commitment + nullifier) and encrypted memos locally.
|
|
1039
1650
|
*
|
|
@@ -1087,13 +1698,7 @@ declare class NoteBuilder {
|
|
|
1087
1698
|
*
|
|
1088
1699
|
* Cipher: ChaCha20-Poly1305 (IETF, 96-bit nonce)
|
|
1089
1700
|
*/
|
|
1090
|
-
|
|
1091
|
-
type DecryptedMemo = {
|
|
1092
|
-
value: bigint;
|
|
1093
|
-
ownerPk: bigint;
|
|
1094
|
-
blinding: bigint;
|
|
1095
|
-
assetId: bigint;
|
|
1096
|
-
};
|
|
1701
|
+
|
|
1097
1702
|
declare const EncryptedMemo: {
|
|
1098
1703
|
/**
|
|
1099
1704
|
* Build and encrypt a memo for a note.
|
|
@@ -1145,12 +1750,6 @@ declare const EncryptedMemo: {
|
|
|
1145
1750
|
* nullifier = Poseidon2(commitment, spendingKey)
|
|
1146
1751
|
*/
|
|
1147
1752
|
|
|
1148
|
-
/** A single commitment record as returned by the indexer. */
|
|
1149
|
-
interface ScanCommitment {
|
|
1150
|
-
commitmentHex: string;
|
|
1151
|
-
leafIndex: number;
|
|
1152
|
-
encryptedMemo: string | null;
|
|
1153
|
-
}
|
|
1154
1753
|
/**
|
|
1155
1754
|
* Attempt to decrypt an on-chain commitment using a viewing key.
|
|
1156
1755
|
*
|
|
@@ -1219,16 +1818,20 @@ declare function deriveOwnerPk(spendingKey: bigint): bigint;
|
|
|
1219
1818
|
* In-memory manager for the user's Orbinum shielded-pool identity.
|
|
1220
1819
|
* Protocol-level module — no UI, no localStorage, no sessionStorage dependencies.
|
|
1221
1820
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1821
|
+
* Create one instance per user session:
|
|
1822
|
+
* const pkm = new PrivacyKeyManager();
|
|
1823
|
+
* await pkm.load(spendingKey);
|
|
1824
|
+
*
|
|
1825
|
+
* The caller (application layer) is responsible for key persistence and session
|
|
1826
|
+
* caching. Each instance holds independent state — safe for multi-wallet use.
|
|
1225
1827
|
*
|
|
1226
1828
|
* Derivation scheme:
|
|
1227
1829
|
* spendingKey (bigint, BN254 scalar)
|
|
1228
1830
|
* └── viewingKey = HKDF-SHA256(spendingKey_bytes, info="orbinum-ivk-v1") → 32 bytes
|
|
1229
1831
|
* └── ownerPk = BabyJubJub Ax from (spendingKey * Base8) → bigint
|
|
1230
1832
|
*/
|
|
1231
|
-
declare
|
|
1833
|
+
declare class PrivacyKeyManager {
|
|
1834
|
+
private _state;
|
|
1232
1835
|
/**
|
|
1233
1836
|
* Load a spending key into the in-memory session.
|
|
1234
1837
|
* Derives viewingKey and ownerPk immediately.
|
|
@@ -1254,7 +1857,7 @@ declare const PrivacyKeyManager: {
|
|
|
1254
1857
|
* Validates the key is in the valid range [1, BN254_R).
|
|
1255
1858
|
*/
|
|
1256
1859
|
importFromHex(hex: string): Promise<void>;
|
|
1257
|
-
}
|
|
1860
|
+
}
|
|
1258
1861
|
|
|
1259
1862
|
/**
|
|
1260
1863
|
* VaultCrypto
|
|
@@ -1302,12 +1905,16 @@ declare function encryptJson(key: CryptoKey, payload: unknown): Promise<{
|
|
|
1302
1905
|
*/
|
|
1303
1906
|
declare function decryptJson(key: CryptoKey, iv: string, ciphertext: string): Promise<unknown>;
|
|
1304
1907
|
|
|
1908
|
+
declare function toBase64(buf: ArrayBuffer | Uint8Array): string;
|
|
1909
|
+
declare function fromBase64(b64: string): Uint8Array;
|
|
1910
|
+
|
|
1305
1911
|
/**
|
|
1306
1912
|
* Contract addresses and function selectors for all Orbinum EVM precompiles.
|
|
1307
1913
|
*
|
|
1308
1914
|
* Selectors are verified against the Rust source in frame/evm/precompile and
|
|
1309
1915
|
* computed as `bytes4(keccak256("<functionName>(<argTypes>)"))`.
|
|
1310
1916
|
*/
|
|
1917
|
+
|
|
1311
1918
|
/** All precompile contract addresses. */
|
|
1312
1919
|
declare const PRECOMPILE_ADDR: {
|
|
1313
1920
|
readonly EC_RECOVER: "0x0000000000000000000000000000000000000001";
|
|
@@ -1322,13 +1929,6 @@ declare const PRECOMPILE_ADDR: {
|
|
|
1322
1929
|
readonly ACCOUNT_MAPPING: "0x0000000000000000000000000000000000000800";
|
|
1323
1930
|
readonly SHIELDED_POOL: "0x0000000000000000000000000000000000000801";
|
|
1324
1931
|
};
|
|
1325
|
-
/** Metadata for a known precompile: display name and function selector map. */
|
|
1326
|
-
interface KnownPrecompileInfo {
|
|
1327
|
-
/** Human-readable name, e.g. "ShieldedPool". */
|
|
1328
|
-
name: string;
|
|
1329
|
-
/** Map from 4-byte hex selector (no 0x prefix) to function signature. */
|
|
1330
|
-
functions: Record<string, string>;
|
|
1331
|
-
}
|
|
1332
1932
|
/**
|
|
1333
1933
|
* Registry of all known Orbinum EVM precompiles, keyed by lowercase address.
|
|
1334
1934
|
* Covers Ethereum standard (EIP), Frontier non-standard, and Orbinum custom precompiles.
|
|
@@ -1341,155 +1941,23 @@ declare const KNOWN_PRECOMPILES: Record<string, KnownPrecompileInfo>;
|
|
|
1341
1941
|
declare function getPrecompileLabel(address: string | null | undefined): string | null;
|
|
1342
1942
|
|
|
1343
1943
|
/**
|
|
1344
|
-
*
|
|
1345
|
-
*/
|
|
1346
|
-
interface FormatOptions {
|
|
1347
|
-
/** On-chain token decimals. Defaults to `18`. */
|
|
1348
|
-
decimals?: number;
|
|
1349
|
-
/** Token symbol appended to the output. Defaults to `'ORB'`. */
|
|
1350
|
-
symbol?: string;
|
|
1351
|
-
/** Whether to append the symbol. Defaults to `true`. */
|
|
1352
|
-
showSymbol?: boolean;
|
|
1353
|
-
/** Maximum number of decimal digits shown in output. Defaults to `6`. */
|
|
1354
|
-
precision?: number;
|
|
1355
|
-
}
|
|
1356
|
-
/**
|
|
1357
|
-
* Formats a raw on-chain token amount to a human-readable string.
|
|
1358
|
-
*
|
|
1359
|
-
* Handles the following input forms:
|
|
1360
|
-
* - `bigint` — raw planck/wei amount.
|
|
1361
|
-
* - `string` — decimal integer, hex (`0x`-prefixed), or already-formatted decimal.
|
|
1362
|
-
* - `number` — interpreted as a plain integer.
|
|
1363
|
-
* - `null` / `undefined` — treated as zero.
|
|
1364
|
-
*
|
|
1365
|
-
* Does NOT depend on `ethers`. Uses pure BigInt arithmetic.
|
|
1366
|
-
*
|
|
1367
|
-
* @example
|
|
1368
|
-
* formatBalance('1000000000000000000') // '1 ORB'
|
|
1369
|
-
* formatBalance(500000000000000000n, { precision: 2 }) // '0.50 ORB'
|
|
1370
|
-
* formatBalance('0x0de0b6b3a7640000', { showSymbol: false }) // '1'
|
|
1371
|
-
* formatBalance(null) // '0 ORB'
|
|
1372
|
-
*/
|
|
1373
|
-
declare function formatBalance(raw: string | bigint | number | null | undefined, options?: FormatOptions | number): string;
|
|
1374
|
-
/**
|
|
1375
|
-
* Convenience wrapper for formatting ORB amounts with 18 decimals.
|
|
1376
|
-
*
|
|
1377
|
-
* @param raw Raw planck amount (string, bigint, number, or null).
|
|
1378
|
-
* @param precision Max decimal digits shown. Defaults to `6`.
|
|
1379
|
-
*
|
|
1380
|
-
* @example
|
|
1381
|
-
* formatORB('1000000000000000000') // '1 ORB'
|
|
1382
|
-
* formatORB(500000000000000000n, 2) // '0.50 ORB'
|
|
1383
|
-
*/
|
|
1384
|
-
declare function formatORB(raw: string | bigint | number | null | undefined, precision?: number): string;
|
|
1385
|
-
|
|
1386
|
-
/**
|
|
1387
|
-
* Serialises a bigint as a 32-byte little-endian Uint8Array.
|
|
1388
|
-
*/
|
|
1389
|
-
declare function bigintTo32Le(n: bigint): Uint8Array;
|
|
1390
|
-
/**
|
|
1391
|
-
* Deserialises a Uint8Array as a little-endian unsigned bigint.
|
|
1392
|
-
*/
|
|
1393
|
-
declare function bytesToBigintLE(bytes: Uint8Array): bigint;
|
|
1394
|
-
/**
|
|
1395
|
-
* Serialises a bigint as a 32-byte big-endian Uint8Array.
|
|
1396
|
-
*/
|
|
1397
|
-
declare function bigintTo32Be(n: bigint): Uint8Array;
|
|
1398
|
-
/**
|
|
1399
|
-
* Serialises a bigint as a 32-element little-endian number[].
|
|
1400
|
-
* Useful when building SCALE-encoded arguments via polkadot-api.
|
|
1401
|
-
*/
|
|
1402
|
-
declare function bigintTo32LeArr(n: bigint): number[];
|
|
1403
|
-
/**
|
|
1404
|
-
* Computes the Merkle path direction bits for a leaf at `leafIndex`
|
|
1405
|
-
* in a binary Merkle tree of `depth` levels.
|
|
1406
|
-
* bit 0 = bottom level (leaf), bit depth-1 = top level (root sibling).
|
|
1407
|
-
*/
|
|
1408
|
-
declare function computePathIndices(leafIndex: number, depth: number): number[];
|
|
1409
|
-
/**
|
|
1410
|
-
* Decodes a little-endian hex string (0x-prefixed or bare) to a bigint.
|
|
1411
|
-
* Equivalent to `bytesToBigintLE(fromHex(hex))`.
|
|
1412
|
-
*/
|
|
1413
|
-
declare function leHexToBigint(hex: string): bigint;
|
|
1414
|
-
|
|
1415
|
-
/**
|
|
1416
|
-
* Normalises an EVM address to lowercase with 0x prefix.
|
|
1417
|
-
*/
|
|
1418
|
-
declare function normalizeEvmAddress(addr: string): string;
|
|
1419
|
-
/**
|
|
1420
|
-
* Returns true if the string looks like an SS58 encoded address
|
|
1421
|
-
* (not a 0x-prefixed hex).
|
|
1422
|
-
*/
|
|
1423
|
-
declare function isSs58(addr: string): boolean;
|
|
1424
|
-
/**
|
|
1425
|
-
* Returns true if the string looks like a 20-byte EVM address.
|
|
1426
|
-
*/
|
|
1427
|
-
declare function isEvmAddress(addr: string): boolean;
|
|
1428
|
-
/**
|
|
1429
|
-
* Pads a 20-byte EVM address to a 32-byte account ID (H256)
|
|
1430
|
-
* by prepending 12 zero bytes (Ethereum-compatible mapping).
|
|
1431
|
-
*/
|
|
1432
|
-
declare function evmAddressToAccountId(evmAddr: string): Uint8Array;
|
|
1433
|
-
/**
|
|
1434
|
-
* Derives the implicit Substrate AccountId32 for an EVM address using the
|
|
1435
|
-
* EeSuffixAddressMapping rule: AccountId32 = H160 ++ [0x00; 12].
|
|
1436
|
-
*
|
|
1437
|
-
* This is the same rule applied by pallet-account-mapping's fallback when
|
|
1438
|
-
* there is no explicit `map_account` entry. Returns 0x-prefixed 64-char hex.
|
|
1439
|
-
*
|
|
1440
|
-
* @param evmAddr 0x-prefixed 20-byte EVM address.
|
|
1441
|
-
*/
|
|
1442
|
-
declare function evmToImplicitSubstrate(evmAddr: string): string;
|
|
1443
|
-
/**
|
|
1444
|
-
* Returns true if the given AccountId32 hex was derived from an EVM address
|
|
1445
|
-
* via the EeSuffixAddressMapping (last 12 bytes are zero).
|
|
1944
|
+
* Decodes calldata for known Orbinum EVM precompiles.
|
|
1446
1945
|
*
|
|
1447
|
-
*
|
|
1946
|
+
* Returns raw decoded values (bigint amounts, hex strings for bytes32).
|
|
1947
|
+
* Callers are responsible for display formatting.
|
|
1448
1948
|
*/
|
|
1449
|
-
|
|
1949
|
+
type DecodedPrecompile = {
|
|
1950
|
+
fnSig: string;
|
|
1951
|
+
args: Record<string, unknown>;
|
|
1952
|
+
};
|
|
1450
1953
|
/**
|
|
1451
|
-
*
|
|
1452
|
-
* created by EeSuffixAddressMapping. Throws if the account is not EVM-derived.
|
|
1954
|
+
* Decodes EVM calldata for a known Orbinum precompile.
|
|
1453
1955
|
*
|
|
1454
|
-
* @param
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
/**
|
|
1458
|
-
* Returns true if `addr` is a valid SS58 substrate address (not EVM).
|
|
1459
|
-
*/
|
|
1460
|
-
declare function isSubstrateAddress(addr: string): boolean;
|
|
1461
|
-
/**
|
|
1462
|
-
* Returns true if `addr` is a Substrate SS58 address derived from an EVM H160
|
|
1463
|
-
* via the EeSuffixAddressMapping rule (last 12 bytes of AccountId are zero).
|
|
1464
|
-
*/
|
|
1465
|
-
declare function isUnifiedAddress(addr: string): boolean;
|
|
1466
|
-
/**
|
|
1467
|
-
* Converts a unified (EVM-derived) Substrate SS58 address to its EVM H160.
|
|
1468
|
-
* Returns null for native Substrate accounts or invalid input.
|
|
1469
|
-
*/
|
|
1470
|
-
declare function substrateToEvm(addr: string): string | null;
|
|
1471
|
-
/**
|
|
1472
|
-
* Converts an EVM H160 address to its Substrate SS58 equivalent
|
|
1473
|
-
* using the EeSuffixAddressMapping rule: AccountId32 = H160 ++ [0x00; 12].
|
|
1474
|
-
* Returns null on invalid input.
|
|
1475
|
-
*/
|
|
1476
|
-
declare function evmToSubstrate(addr: string): string | null;
|
|
1477
|
-
/**
|
|
1478
|
-
* Converts a 32-byte AccountId hex (0x-prefixed or bare) to its SS58 string.
|
|
1479
|
-
* Returns null on invalid input.
|
|
1480
|
-
*/
|
|
1481
|
-
declare function accountIdHexToSs58(hex: string): string | null;
|
|
1482
|
-
/**
|
|
1483
|
-
* Converts a Substrate SS58 address to its AccountId32 as a 0x-prefixed 64-char hex.
|
|
1484
|
-
* Returns null on invalid input.
|
|
1485
|
-
*/
|
|
1486
|
-
declare function substrateSs58ToAccountIdHex(addr: string): string | null;
|
|
1487
|
-
/**
|
|
1488
|
-
* Universal converter: given any raw address string (SS58, 0x-prefixed 64-char
|
|
1489
|
-
* AccountId hex, or EVM H160), returns the AccountId32 hex (0x-prefixed).
|
|
1490
|
-
* Returns null on unrecognised input.
|
|
1956
|
+
* @param address - The precompile contract address (0x-prefixed).
|
|
1957
|
+
* @param input - The transaction input data (0x-prefixed hex).
|
|
1958
|
+
* @returns Decoded `{ fnSig, args }` with raw values, or `null` if unknown.
|
|
1491
1959
|
*/
|
|
1492
|
-
declare function
|
|
1960
|
+
declare function decodePrecompileCalldata(address: string, input: string): DecodedPrecompile | null;
|
|
1493
1961
|
|
|
1494
1962
|
/**
|
|
1495
1963
|
* TypeScript types for events emitted by pallet-shielded-pool.
|
|
@@ -1685,418 +2153,207 @@ type ShieldedPoolEvent = {
|
|
|
1685
2153
|
};
|
|
1686
2154
|
|
|
1687
2155
|
/**
|
|
1688
|
-
* TypeScript types for pallet-
|
|
2156
|
+
* TypeScript types for pallet-zk-verifier extrinsics.
|
|
1689
2157
|
*
|
|
1690
2158
|
* Conventions:
|
|
1691
|
-
* -
|
|
1692
|
-
* -
|
|
1693
|
-
* - AccountId → `string` (SS58 or 0x-prefixed 64-char hex)
|
|
1694
|
-
* - Block numbers → `number`
|
|
1695
|
-
* - Optional fields → `T | null`
|
|
2159
|
+
* - Byte arrays → `number[]` (SCALE-compatible)
|
|
2160
|
+
* - Versions → `number` (u32)
|
|
1696
2161
|
*/
|
|
1697
2162
|
/**
|
|
1698
|
-
*
|
|
1699
|
-
*
|
|
2163
|
+
* On-chain circuit identifier (u32 newtype on-chain).
|
|
2164
|
+
* Use the {@link CircuitId} constant object for named values.
|
|
1700
2165
|
*/
|
|
1701
|
-
type
|
|
2166
|
+
type CircuitId = (typeof CircuitId)[keyof typeof CircuitId];
|
|
1702
2167
|
/**
|
|
1703
|
-
*
|
|
1704
|
-
*
|
|
2168
|
+
* Named constants for all supported ZK circuits.
|
|
2169
|
+
*
|
|
2170
|
+
* | Name | Value | Circuit |
|
|
2171
|
+
* |--------------|-------|---------------------------------|
|
|
2172
|
+
* | Transfer | 1 | 2-in-2-out private transfer |
|
|
2173
|
+
* | Unshield | 2 | Withdrawal from the pool |
|
|
2174
|
+
* | Disclosure | 3 | Selective disclosure |
|
|
2175
|
+
* | PrivateLink | 4 | Private chain-link proof |
|
|
1705
2176
|
*/
|
|
1706
|
-
|
|
2177
|
+
declare const CircuitId: {
|
|
2178
|
+
readonly Transfer: 1;
|
|
2179
|
+
readonly Unshield: 2;
|
|
2180
|
+
readonly Disclosure: 3;
|
|
2181
|
+
readonly PrivateLink: 4;
|
|
2182
|
+
};
|
|
1707
2183
|
/**
|
|
1708
|
-
* A single
|
|
1709
|
-
* Maps to `
|
|
2184
|
+
* A single verification key registration entry used in batch operations.
|
|
2185
|
+
* Maps to `VkEntry` in Rust.
|
|
1710
2186
|
*/
|
|
1711
|
-
type
|
|
1712
|
-
|
|
1713
|
-
|
|
2187
|
+
type VkEntry = {
|
|
2188
|
+
circuitId: CircuitId;
|
|
2189
|
+
/** Circuit version number (u32 on-chain). Versions are independent per circuit. */
|
|
2190
|
+
version: number;
|
|
2191
|
+
/** Serialised Groth16 verification key bytes — max 8 192 bytes. */
|
|
2192
|
+
verificationKey: number[];
|
|
1714
2193
|
};
|
|
1715
2194
|
/**
|
|
1716
|
-
*
|
|
1717
|
-
*
|
|
2195
|
+
* Call index 0 — `register_verification_key` (Root origin)
|
|
2196
|
+
* Registers a Groth16 verification key for a specific circuit and version.
|
|
1718
2197
|
*/
|
|
1719
|
-
type
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
} | {
|
|
1726
|
-
type: 'AssetId';
|
|
1727
|
-
assetId: number;
|
|
1728
|
-
} | {
|
|
1729
|
-
type: 'RecipientIs';
|
|
1730
|
-
recipient: string;
|
|
1731
|
-
} | {
|
|
1732
|
-
type: 'Custom';
|
|
1733
|
-
encoded: number[];
|
|
2198
|
+
type RegisterVerificationKeyArgs = {
|
|
2199
|
+
circuitId: CircuitId;
|
|
2200
|
+
/** Version to associate with this key. */
|
|
2201
|
+
version: number;
|
|
2202
|
+
/** Serialised Groth16 verification key bytes — max 8 192 bytes. */
|
|
2203
|
+
verificationKey: number[];
|
|
1734
2204
|
};
|
|
1735
2205
|
/**
|
|
1736
|
-
*
|
|
1737
|
-
*
|
|
2206
|
+
* Call index 1 — `set_active_version` (Root origin)
|
|
2207
|
+
* Designates a specific version as the active one used for proof verification.
|
|
1738
2208
|
*/
|
|
1739
|
-
type
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
/** Groth16 proof bytes — max 256 bytes. */
|
|
1743
|
-
proof: number[];
|
|
1744
|
-
/** 76-byte public signals: commitment(32) | value(8) | asset_id(4) | owner_hash(32). */
|
|
1745
|
-
publicSignals: DisclosurePublicSignals;
|
|
1746
|
-
/** Optional auditor AccountId. Null = voluntary disclosure. */
|
|
1747
|
-
auditor: string | null;
|
|
2209
|
+
type SetActiveVersionArgs = {
|
|
2210
|
+
circuitId: CircuitId;
|
|
2211
|
+
version: number;
|
|
1748
2212
|
};
|
|
1749
2213
|
/**
|
|
1750
|
-
*
|
|
2214
|
+
* Call index 2 — `remove_verification_key` (Root origin)
|
|
2215
|
+
* Removes a registered verification key.
|
|
2216
|
+
* The currently active version cannot be removed.
|
|
1751
2217
|
*/
|
|
1752
|
-
type
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
/** 32-byte Poseidon commitment (LE). */
|
|
1756
|
-
commitment: Bytes32;
|
|
1757
|
-
/** Encrypted memo bytes — exactly 104 bytes. */
|
|
1758
|
-
encryptedMemo: number[];
|
|
2218
|
+
type RemoveVerificationKeyArgs = {
|
|
2219
|
+
circuitId: CircuitId;
|
|
2220
|
+
version: number;
|
|
1759
2221
|
};
|
|
1760
2222
|
/**
|
|
1761
|
-
* Call index
|
|
1762
|
-
*
|
|
2223
|
+
* Call index 3 — `verify_proof` (Signed origin)
|
|
2224
|
+
* Verifies a single Groth16 proof on-chain for the specified circuit.
|
|
2225
|
+
* Uses the circuit's currently active verification key version.
|
|
1763
2226
|
*/
|
|
1764
|
-
type
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
2227
|
+
type VerifyProofArgs = {
|
|
2228
|
+
circuitId: CircuitId;
|
|
2229
|
+
/** Groth16 proof bytes. */
|
|
2230
|
+
proof: number[];
|
|
2231
|
+
/**
|
|
2232
|
+
* Public inputs as a list of 32-byte field elements (LE).
|
|
2233
|
+
* Number and meaning of inputs depends on the circuit:
|
|
2234
|
+
* - Transfer: [merkle_root, nullifier_0, nullifier_1, commitment_0, commitment_1]
|
|
2235
|
+
* - Unshield: [merkle_root, nullifier, amount_fe, recipient_hash, asset_id_fe]
|
|
2236
|
+
* - Disclosure: [commitment, revealed_value_fe, revealed_asset_id_fe, owner_hash]
|
|
2237
|
+
* - PrivateLink: [commitment, call_hash_fe]
|
|
2238
|
+
*/
|
|
2239
|
+
publicInputs: number[][];
|
|
1771
2240
|
};
|
|
1772
2241
|
/**
|
|
1773
|
-
* Call index
|
|
1774
|
-
*
|
|
2242
|
+
* Call index 4 — `batch_register_verification_keys` (Root origin)
|
|
2243
|
+
* Registers up to 10 verification keys in one extrinsic.
|
|
2244
|
+
* Useful for initial chain setup or coordinated upgrades.
|
|
1775
2245
|
*/
|
|
1776
|
-
type
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
/** Input note consumed by a private transfer. */
|
|
1780
|
-
type PrivateTransferInput = {
|
|
1781
|
-
/** 32-byte Poseidon nullifier (LE). */
|
|
1782
|
-
nullifier: Bytes32;
|
|
1783
|
-
/** 32-byte Poseidon commitment (LE). */
|
|
1784
|
-
commitment: Bytes32;
|
|
2246
|
+
type BatchRegisterVerificationKeysArgs = {
|
|
2247
|
+
/** Up to 10 VK entries. */
|
|
2248
|
+
entries: VkEntry[];
|
|
1785
2249
|
};
|
|
1786
|
-
/**
|
|
1787
|
-
type
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
2250
|
+
/** All pallet-zk-verifier calls as a discriminated union. */
|
|
2251
|
+
type ZkVerifierCall = {
|
|
2252
|
+
type: 'registerVerificationKey';
|
|
2253
|
+
args: RegisterVerificationKeyArgs;
|
|
2254
|
+
} | {
|
|
2255
|
+
type: 'setActiveVersion';
|
|
2256
|
+
args: SetActiveVersionArgs;
|
|
2257
|
+
} | {
|
|
2258
|
+
type: 'removeVerificationKey';
|
|
2259
|
+
args: RemoveVerificationKeyArgs;
|
|
2260
|
+
} | {
|
|
2261
|
+
type: 'verifyProof';
|
|
2262
|
+
args: VerifyProofArgs;
|
|
2263
|
+
} | {
|
|
2264
|
+
type: 'batchRegisterVerificationKeys';
|
|
2265
|
+
args: BatchRegisterVerificationKeysArgs;
|
|
1792
2266
|
};
|
|
2267
|
+
|
|
1793
2268
|
/**
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
2269
|
+
* TypeScript types for events emitted by pallet-zk-verifier.
|
|
2270
|
+
*
|
|
2271
|
+
* Conventions:
|
|
2272
|
+
* - CircuitId → imported from pallet-extrinsics (u32 newtype)
|
|
2273
|
+
* - version → `number` (u32)
|
|
2274
|
+
* - count → `number` (u32)
|
|
1797
2275
|
*/
|
|
1798
|
-
|
|
1799
|
-
/** Groth16 proof bytes — max 512 bytes. */
|
|
1800
|
-
proof: number[];
|
|
1801
|
-
/** 32-byte Merkle root (LE). */
|
|
1802
|
-
merkleRoot: Bytes32;
|
|
1803
|
-
nullifiers: PrivateTransferInput[];
|
|
1804
|
-
outputs: PrivateTransferOutput[];
|
|
1805
|
-
encryptedMemos: number[][];
|
|
1806
|
-
};
|
|
2276
|
+
|
|
1807
2277
|
/**
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
2278
|
+
* Emitted by `register_verification_key()` when a new VK is stored.
|
|
2279
|
+
* Rust variant: `VerificationKeyRegistered { circuit_id, version }`
|
|
1810
2280
|
*/
|
|
1811
|
-
type
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
/** 32-byte Merkle root (LE). */
|
|
1815
|
-
merkleRoot: Bytes32;
|
|
1816
|
-
/** 32-byte nullifier of the spent note (LE). */
|
|
1817
|
-
nullifier: Bytes32;
|
|
1818
|
-
assetId: number;
|
|
1819
|
-
amount: bigint;
|
|
1820
|
-
/** SS58 or 0x-prefixed AccountId of the recipient. */
|
|
1821
|
-
recipient: string;
|
|
2281
|
+
type VerificationKeyRegisteredEvent = {
|
|
2282
|
+
circuitId: CircuitId;
|
|
2283
|
+
version: number;
|
|
1822
2284
|
};
|
|
1823
2285
|
/**
|
|
1824
|
-
*
|
|
1825
|
-
*
|
|
2286
|
+
* Emitted by `set_active_version()` when the active VK version changes.
|
|
2287
|
+
* Rust variant: `ActiveVersionSet { circuit_id, version }`
|
|
1826
2288
|
*/
|
|
1827
|
-
type
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
/** Up to 10 disclosure conditions. */
|
|
1831
|
-
conditions: DisclosureCondition[];
|
|
1832
|
-
/** Minimum blocks between disclosures to the same auditor. Null = no limit. */
|
|
1833
|
-
maxFrequency: number | null;
|
|
1834
|
-
/** Block after which the policy expires. Null = no expiry. */
|
|
1835
|
-
validUntil: number | null;
|
|
2289
|
+
type ActiveVersionSetEvent = {
|
|
2290
|
+
circuitId: CircuitId;
|
|
2291
|
+
version: number;
|
|
1836
2292
|
};
|
|
1837
2293
|
/**
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
2294
|
+
* Emitted by `remove_verification_key()` when a VK is deleted.
|
|
2295
|
+
* Rust variant: `VerificationKeyRemoved { circuit_id, version }`
|
|
1840
2296
|
*/
|
|
1841
|
-
type
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
/** Human-readable request reason — max 256 bytes UTF-8. */
|
|
1845
|
-
reason: string;
|
|
2297
|
+
type VerificationKeyRemovedEvent = {
|
|
2298
|
+
circuitId: CircuitId;
|
|
2299
|
+
version: number;
|
|
1846
2300
|
};
|
|
1847
2301
|
/**
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
2302
|
+
* Emitted by `verify_proof()` when a ZK proof is successfully verified.
|
|
2303
|
+
* Rust variant: `ProofVerified { circuit_id, version }`
|
|
1850
2304
|
*/
|
|
1851
|
-
type
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
/** Groth16 proof bytes — max 256 bytes. */
|
|
1855
|
-
proofBytes: number[];
|
|
1856
|
-
/** 76-byte public signals: commitment(32) | value(8) | asset_id(4) | owner_hash(32). */
|
|
1857
|
-
publicSignals: DisclosurePublicSignals;
|
|
1858
|
-
/** Target auditor AccountId. Null = voluntary public disclosure. */
|
|
1859
|
-
auditor: string | null;
|
|
2305
|
+
type ProofVerifiedEvent = {
|
|
2306
|
+
circuitId: CircuitId;
|
|
2307
|
+
version: number;
|
|
1860
2308
|
};
|
|
1861
2309
|
/**
|
|
1862
|
-
*
|
|
1863
|
-
*
|
|
2310
|
+
* Emitted by `verify_proof()` when ZK proof verification fails.
|
|
2311
|
+
* Rust variant: `ProofVerificationFailed { circuit_id, version }`
|
|
1864
2312
|
*/
|
|
1865
|
-
type
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
/** Rejection reason — max 256 bytes UTF-8. */
|
|
1869
|
-
reason: string;
|
|
2313
|
+
type ProofVerificationFailedEvent = {
|
|
2314
|
+
circuitId: CircuitId;
|
|
2315
|
+
version: number;
|
|
1870
2316
|
};
|
|
1871
2317
|
/**
|
|
1872
|
-
*
|
|
1873
|
-
*
|
|
2318
|
+
* Emitted by `batch_register_verification_keys()` on success.
|
|
2319
|
+
* Rust variant: `BatchVerificationKeysRegistered { count }`
|
|
1874
2320
|
*/
|
|
1875
|
-
type
|
|
1876
|
-
|
|
2321
|
+
type BatchVerificationKeysRegisteredEvent = {
|
|
2322
|
+
/** Number of VK entries registered in the batch. */
|
|
2323
|
+
count: number;
|
|
1877
2324
|
};
|
|
1878
|
-
/**
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
2325
|
+
/** All events emitted by pallet-zk-verifier as a discriminated union. */
|
|
2326
|
+
type ZkVerifierEvent = {
|
|
2327
|
+
type: 'VerificationKeyRegistered';
|
|
2328
|
+
data: VerificationKeyRegisteredEvent;
|
|
2329
|
+
} | {
|
|
2330
|
+
type: 'ActiveVersionSet';
|
|
2331
|
+
data: ActiveVersionSetEvent;
|
|
2332
|
+
} | {
|
|
2333
|
+
type: 'VerificationKeyRemoved';
|
|
2334
|
+
data: VerificationKeyRemovedEvent;
|
|
2335
|
+
} | {
|
|
2336
|
+
type: 'ProofVerified';
|
|
2337
|
+
data: ProofVerifiedEvent;
|
|
2338
|
+
} | {
|
|
2339
|
+
type: 'ProofVerificationFailed';
|
|
2340
|
+
data: ProofVerificationFailedEvent;
|
|
2341
|
+
} | {
|
|
2342
|
+
type: 'BatchVerificationKeysRegistered';
|
|
2343
|
+
data: BatchVerificationKeysRegisteredEvent;
|
|
1891
2344
|
};
|
|
2345
|
+
|
|
1892
2346
|
/**
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
2347
|
+
* TypeScript types for pallet-account-mapping extrinsics.
|
|
2348
|
+
*
|
|
2349
|
+
* Conventions:
|
|
2350
|
+
* - Byte arrays → `number[]` (SCALE-compatible)
|
|
2351
|
+
* - Balances → `bigint`
|
|
2352
|
+
* - AccountId → `string` (SS58 or 0x-prefixed 64-char hex)
|
|
2353
|
+
* - ChainId → `number` (u32, typically a SLIP-0044 coin type)
|
|
2354
|
+
* - Optional → `T | null`
|
|
1895
2355
|
*/
|
|
1896
|
-
type VerifyAssetArgs = {
|
|
1897
|
-
assetId: number;
|
|
1898
|
-
};
|
|
1899
|
-
/**
|
|
1900
|
-
* Call index 11 — `unverify_asset` (Root origin)
|
|
1901
|
-
* Removes the verified status from an asset, disabling new shield operations.
|
|
1902
|
-
*/
|
|
1903
|
-
type UnverifyAssetArgs = {
|
|
1904
|
-
assetId: number;
|
|
1905
|
-
};
|
|
1906
|
-
/**
|
|
1907
|
-
* Call index 14 — `prune_expired_request` (Signed origin)
|
|
1908
|
-
* Cleans up a disclosure request that has passed its expiration block.
|
|
1909
|
-
*/
|
|
1910
|
-
type PruneExpiredRequestArgs = {
|
|
1911
|
-
/** AccountId of the disclosure target. */
|
|
1912
|
-
target: string;
|
|
1913
|
-
/** AccountId of the auditor. */
|
|
1914
|
-
auditor: string;
|
|
1915
|
-
};
|
|
1916
|
-
/**
|
|
1917
|
-
* Call index 15 — `revoke_disclosure_record` (Signed origin)
|
|
1918
|
-
* Allows the note owner to revoke a previously submitted disclosure record.
|
|
1919
|
-
*/
|
|
1920
|
-
type RevokeDisclosureRecordArgs = {
|
|
1921
|
-
/** 32-byte commitment whose disclosure record should be revoked (LE). */
|
|
1922
|
-
commitment: Bytes32;
|
|
1923
|
-
};
|
|
1924
|
-
/** All pallet-shielded-pool calls as a discriminated union. */
|
|
1925
|
-
type ShieldedPoolCall = {
|
|
1926
|
-
type: 'shield';
|
|
1927
|
-
args: ShieldArgs;
|
|
1928
|
-
} | {
|
|
1929
|
-
type: 'shieldBatch';
|
|
1930
|
-
args: ShieldBatchArgs;
|
|
1931
|
-
} | {
|
|
1932
|
-
type: 'privateTransfer';
|
|
1933
|
-
args: PrivateTransferArgs;
|
|
1934
|
-
} | {
|
|
1935
|
-
type: 'unshield';
|
|
1936
|
-
args: UnshieldArgs;
|
|
1937
|
-
} | {
|
|
1938
|
-
type: 'setAuditPolicy';
|
|
1939
|
-
args: SetAuditPolicyArgs;
|
|
1940
|
-
} | {
|
|
1941
|
-
type: 'requestDisclosure';
|
|
1942
|
-
args: RequestDisclosureArgs;
|
|
1943
|
-
} | {
|
|
1944
|
-
type: 'disclose';
|
|
1945
|
-
args: DiscloseArgs;
|
|
1946
|
-
} | {
|
|
1947
|
-
type: 'rejectDisclosure';
|
|
1948
|
-
args: RejectDisclosureArgs;
|
|
1949
|
-
} | {
|
|
1950
|
-
type: 'batchSubmitDisclosureProofs';
|
|
1951
|
-
args: BatchSubmitDisclosureProofsArgs;
|
|
1952
|
-
} | {
|
|
1953
|
-
type: 'registerAsset';
|
|
1954
|
-
args: RegisterAssetArgs;
|
|
1955
|
-
} | {
|
|
1956
|
-
type: 'verifyAsset';
|
|
1957
|
-
args: VerifyAssetArgs;
|
|
1958
|
-
} | {
|
|
1959
|
-
type: 'unverifyAsset';
|
|
1960
|
-
args: UnverifyAssetArgs;
|
|
1961
|
-
} | {
|
|
1962
|
-
type: 'pruneExpiredRequest';
|
|
1963
|
-
args: PruneExpiredRequestArgs;
|
|
1964
|
-
} | {
|
|
1965
|
-
type: 'revokeDisclosureRecord';
|
|
1966
|
-
args: RevokeDisclosureRecordArgs;
|
|
1967
|
-
};
|
|
1968
|
-
|
|
1969
|
-
/**
|
|
1970
|
-
* TypeScript types for pallet-zk-verifier extrinsics.
|
|
1971
|
-
*
|
|
1972
|
-
* Conventions:
|
|
1973
|
-
* - Byte arrays → `number[]` (SCALE-compatible)
|
|
1974
|
-
* - Versions → `number` (u32)
|
|
1975
|
-
*/
|
|
1976
|
-
/**
|
|
1977
|
-
* On-chain circuit identifier (u32 newtype on-chain).
|
|
1978
|
-
* Use the {@link CircuitId} constant object for named values.
|
|
1979
|
-
*/
|
|
1980
|
-
type CircuitId = (typeof CircuitId)[keyof typeof CircuitId];
|
|
1981
|
-
/**
|
|
1982
|
-
* Named constants for all supported ZK circuits.
|
|
1983
|
-
*
|
|
1984
|
-
* | Name | Value | Circuit |
|
|
1985
|
-
* |--------------|-------|---------------------------------|
|
|
1986
|
-
* | Transfer | 1 | 2-in-2-out private transfer |
|
|
1987
|
-
* | Unshield | 2 | Withdrawal from the pool |
|
|
1988
|
-
* | Disclosure | 3 | Selective disclosure |
|
|
1989
|
-
* | PrivateLink | 4 | Private chain-link proof |
|
|
1990
|
-
*/
|
|
1991
|
-
declare const CircuitId: {
|
|
1992
|
-
readonly Transfer: 1;
|
|
1993
|
-
readonly Unshield: 2;
|
|
1994
|
-
readonly Disclosure: 3;
|
|
1995
|
-
readonly PrivateLink: 4;
|
|
1996
|
-
};
|
|
1997
|
-
/**
|
|
1998
|
-
* A single verification key registration entry used in batch operations.
|
|
1999
|
-
* Maps to `VkEntry` in Rust.
|
|
2000
|
-
*/
|
|
2001
|
-
type VkEntry = {
|
|
2002
|
-
circuitId: CircuitId;
|
|
2003
|
-
/** Circuit version number (u32 on-chain). Versions are independent per circuit. */
|
|
2004
|
-
version: number;
|
|
2005
|
-
/** Serialised Groth16 verification key bytes — max 8 192 bytes. */
|
|
2006
|
-
verificationKey: number[];
|
|
2007
|
-
};
|
|
2008
|
-
/**
|
|
2009
|
-
* Call index 0 — `register_verification_key` (Root origin)
|
|
2010
|
-
* Registers a Groth16 verification key for a specific circuit and version.
|
|
2011
|
-
*/
|
|
2012
|
-
type RegisterVerificationKeyArgs = {
|
|
2013
|
-
circuitId: CircuitId;
|
|
2014
|
-
/** Version to associate with this key. */
|
|
2015
|
-
version: number;
|
|
2016
|
-
/** Serialised Groth16 verification key bytes — max 8 192 bytes. */
|
|
2017
|
-
verificationKey: number[];
|
|
2018
|
-
};
|
|
2019
|
-
/**
|
|
2020
|
-
* Call index 1 — `set_active_version` (Root origin)
|
|
2021
|
-
* Designates a specific version as the active one used for proof verification.
|
|
2022
|
-
*/
|
|
2023
|
-
type SetActiveVersionArgs = {
|
|
2024
|
-
circuitId: CircuitId;
|
|
2025
|
-
version: number;
|
|
2026
|
-
};
|
|
2027
|
-
/**
|
|
2028
|
-
* Call index 2 — `remove_verification_key` (Root origin)
|
|
2029
|
-
* Removes a registered verification key.
|
|
2030
|
-
* The currently active version cannot be removed.
|
|
2031
|
-
*/
|
|
2032
|
-
type RemoveVerificationKeyArgs = {
|
|
2033
|
-
circuitId: CircuitId;
|
|
2034
|
-
version: number;
|
|
2035
|
-
};
|
|
2036
|
-
/**
|
|
2037
|
-
* Call index 3 — `verify_proof` (Signed origin)
|
|
2038
|
-
* Verifies a single Groth16 proof on-chain for the specified circuit.
|
|
2039
|
-
* Uses the circuit's currently active verification key version.
|
|
2040
|
-
*/
|
|
2041
|
-
type VerifyProofArgs = {
|
|
2042
|
-
circuitId: CircuitId;
|
|
2043
|
-
/** Groth16 proof bytes. */
|
|
2044
|
-
proof: number[];
|
|
2045
|
-
/**
|
|
2046
|
-
* Public inputs as a list of 32-byte field elements (LE).
|
|
2047
|
-
* Number and meaning of inputs depends on the circuit:
|
|
2048
|
-
* - Transfer: [merkle_root, nullifier_0, nullifier_1, commitment_0, commitment_1]
|
|
2049
|
-
* - Unshield: [merkle_root, nullifier, amount_fe, recipient_hash, asset_id_fe]
|
|
2050
|
-
* - Disclosure: [commitment, revealed_value_fe, revealed_asset_id_fe, owner_hash]
|
|
2051
|
-
* - PrivateLink: [commitment, call_hash_fe]
|
|
2052
|
-
*/
|
|
2053
|
-
publicInputs: number[][];
|
|
2054
|
-
};
|
|
2055
|
-
/**
|
|
2056
|
-
* Call index 4 — `batch_register_verification_keys` (Root origin)
|
|
2057
|
-
* Registers up to 10 verification keys in one extrinsic.
|
|
2058
|
-
* Useful for initial chain setup or coordinated upgrades.
|
|
2059
|
-
*/
|
|
2060
|
-
type BatchRegisterVerificationKeysArgs = {
|
|
2061
|
-
/** Up to 10 VK entries. */
|
|
2062
|
-
entries: VkEntry[];
|
|
2063
|
-
};
|
|
2064
|
-
/** All pallet-zk-verifier calls as a discriminated union. */
|
|
2065
|
-
type ZkVerifierCall = {
|
|
2066
|
-
type: 'registerVerificationKey';
|
|
2067
|
-
args: RegisterVerificationKeyArgs;
|
|
2068
|
-
} | {
|
|
2069
|
-
type: 'setActiveVersion';
|
|
2070
|
-
args: SetActiveVersionArgs;
|
|
2071
|
-
} | {
|
|
2072
|
-
type: 'removeVerificationKey';
|
|
2073
|
-
args: RemoveVerificationKeyArgs;
|
|
2074
|
-
} | {
|
|
2075
|
-
type: 'verifyProof';
|
|
2076
|
-
args: VerifyProofArgs;
|
|
2077
|
-
} | {
|
|
2078
|
-
type: 'batchRegisterVerificationKeys';
|
|
2079
|
-
args: BatchRegisterVerificationKeysArgs;
|
|
2080
|
-
};
|
|
2081
2356
|
|
|
2082
|
-
/**
|
|
2083
|
-
* TypeScript types for pallet-account-mapping extrinsics.
|
|
2084
|
-
*
|
|
2085
|
-
* Conventions:
|
|
2086
|
-
* - Byte arrays → `number[]` (SCALE-compatible)
|
|
2087
|
-
* - Balances → `bigint`
|
|
2088
|
-
* - AccountId → `string` (SS58 or 0x-prefixed 64-char hex)
|
|
2089
|
-
* - ChainId → `number` (u32, typically a SLIP-0044 coin type)
|
|
2090
|
-
* - Optional → `T | null`
|
|
2091
|
-
*/
|
|
2092
|
-
/**
|
|
2093
|
-
* External chain signature scheme.
|
|
2094
|
-
* Maps to `SignatureScheme` enum in pallet-account-mapping.
|
|
2095
|
-
*
|
|
2096
|
-
* - `Eip191` — Ethereum personal_sign (EIP-191 prefix)
|
|
2097
|
-
* - `Ed25519` — Raw Ed25519 signature (Solana, Polkadot, etc.)
|
|
2098
|
-
*/
|
|
2099
|
-
type SignatureScheme = 'Eip191' | 'Ed25519';
|
|
2100
2357
|
/**
|
|
2101
2358
|
* Call index 2 — `register_alias` (Signed origin)
|
|
2102
2359
|
* Registers a human-readable identity alias for the caller's Substrate account.
|
|
@@ -2313,132 +2570,54 @@ type AccountMappingCall = {
|
|
|
2313
2570
|
};
|
|
2314
2571
|
|
|
2315
2572
|
/**
|
|
2316
|
-
* TypeScript types for events emitted by pallet-
|
|
2573
|
+
* TypeScript types for events emitted by pallet-account-mapping.
|
|
2317
2574
|
*
|
|
2318
2575
|
* Conventions:
|
|
2319
|
-
* -
|
|
2320
|
-
* -
|
|
2321
|
-
* -
|
|
2576
|
+
* - AccountId → `string` (SS58)
|
|
2577
|
+
* - H160 → `string` (0x-prefixed 20-byte Ethereum address)
|
|
2578
|
+
* - AliasOf<T> → `string` (bounded string, max configurable)
|
|
2579
|
+
* - ChainId → `number` (SLIP-0044 coin-type u32)
|
|
2580
|
+
* - ExternalAddr → `string` (chain-specific address string)
|
|
2581
|
+
* - BalanceOf<T> → `bigint`
|
|
2582
|
+
* - [u8; 32] → `string` (0x-prefixed hex, for private commitments)
|
|
2583
|
+
* - SignatureScheme → imported from pallet-extrinsics
|
|
2322
2584
|
*/
|
|
2323
2585
|
|
|
2324
2586
|
/**
|
|
2325
|
-
* Emitted
|
|
2326
|
-
* Rust variant: `
|
|
2587
|
+
* Emitted when a Substrate account is mapped to an Ethereum address.
|
|
2588
|
+
* Rust variant: `AccountMapped { account, address }`
|
|
2327
2589
|
*/
|
|
2328
|
-
type
|
|
2329
|
-
|
|
2330
|
-
|
|
2590
|
+
type AccountMappedEvent = {
|
|
2591
|
+
account: string;
|
|
2592
|
+
/** 0x-prefixed 20-byte Ethereum address. */
|
|
2593
|
+
address: string;
|
|
2331
2594
|
};
|
|
2332
2595
|
/**
|
|
2333
|
-
* Emitted
|
|
2334
|
-
* Rust variant: `
|
|
2596
|
+
* Emitted when an existing account mapping is removed.
|
|
2597
|
+
* Rust variant: `AccountUnmapped { account, address }`
|
|
2335
2598
|
*/
|
|
2336
|
-
type
|
|
2337
|
-
|
|
2338
|
-
|
|
2599
|
+
type AccountUnmappedEvent = {
|
|
2600
|
+
account: string;
|
|
2601
|
+
/** 0x-prefixed 20-byte Ethereum address. */
|
|
2602
|
+
address: string;
|
|
2339
2603
|
};
|
|
2340
2604
|
/**
|
|
2341
|
-
* Emitted by `
|
|
2342
|
-
* Rust variant: `
|
|
2605
|
+
* Emitted by `register_alias()` when a new alias is claimed.
|
|
2606
|
+
* Rust variant: `AliasRegistered { account, alias, evm_address }`
|
|
2343
2607
|
*/
|
|
2344
|
-
type
|
|
2345
|
-
|
|
2346
|
-
|
|
2608
|
+
type AliasRegisteredEvent = {
|
|
2609
|
+
account: string;
|
|
2610
|
+
alias: string;
|
|
2611
|
+
/** Optional EVM address linked at registration time. */
|
|
2612
|
+
evmAddress: string | null;
|
|
2347
2613
|
};
|
|
2348
2614
|
/**
|
|
2349
|
-
* Emitted
|
|
2350
|
-
* Rust variant: `
|
|
2615
|
+
* Emitted when an alias is released (burned / expired).
|
|
2616
|
+
* Rust variant: `AliasReleased { account, alias }`
|
|
2351
2617
|
*/
|
|
2352
|
-
type
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
};
|
|
2356
|
-
/**
|
|
2357
|
-
* Emitted by `verify_proof()` when ZK proof verification fails.
|
|
2358
|
-
* Rust variant: `ProofVerificationFailed { circuit_id, version }`
|
|
2359
|
-
*/
|
|
2360
|
-
type ProofVerificationFailedEvent = {
|
|
2361
|
-
circuitId: CircuitId;
|
|
2362
|
-
version: number;
|
|
2363
|
-
};
|
|
2364
|
-
/**
|
|
2365
|
-
* Emitted by `batch_register_verification_keys()` on success.
|
|
2366
|
-
* Rust variant: `BatchVerificationKeysRegistered { count }`
|
|
2367
|
-
*/
|
|
2368
|
-
type BatchVerificationKeysRegisteredEvent = {
|
|
2369
|
-
/** Number of VK entries registered in the batch. */
|
|
2370
|
-
count: number;
|
|
2371
|
-
};
|
|
2372
|
-
/** All events emitted by pallet-zk-verifier as a discriminated union. */
|
|
2373
|
-
type ZkVerifierEvent = {
|
|
2374
|
-
type: 'VerificationKeyRegistered';
|
|
2375
|
-
data: VerificationKeyRegisteredEvent;
|
|
2376
|
-
} | {
|
|
2377
|
-
type: 'ActiveVersionSet';
|
|
2378
|
-
data: ActiveVersionSetEvent;
|
|
2379
|
-
} | {
|
|
2380
|
-
type: 'VerificationKeyRemoved';
|
|
2381
|
-
data: VerificationKeyRemovedEvent;
|
|
2382
|
-
} | {
|
|
2383
|
-
type: 'ProofVerified';
|
|
2384
|
-
data: ProofVerifiedEvent;
|
|
2385
|
-
} | {
|
|
2386
|
-
type: 'ProofVerificationFailed';
|
|
2387
|
-
data: ProofVerificationFailedEvent;
|
|
2388
|
-
} | {
|
|
2389
|
-
type: 'BatchVerificationKeysRegistered';
|
|
2390
|
-
data: BatchVerificationKeysRegisteredEvent;
|
|
2391
|
-
};
|
|
2392
|
-
|
|
2393
|
-
/**
|
|
2394
|
-
* TypeScript types for events emitted by pallet-account-mapping.
|
|
2395
|
-
*
|
|
2396
|
-
* Conventions:
|
|
2397
|
-
* - AccountId → `string` (SS58)
|
|
2398
|
-
* - H160 → `string` (0x-prefixed 20-byte Ethereum address)
|
|
2399
|
-
* - AliasOf<T> → `string` (bounded string, max configurable)
|
|
2400
|
-
* - ChainId → `number` (SLIP-0044 coin-type u32)
|
|
2401
|
-
* - ExternalAddr → `string` (chain-specific address string)
|
|
2402
|
-
* - BalanceOf<T> → `bigint`
|
|
2403
|
-
* - [u8; 32] → `string` (0x-prefixed hex, for private commitments)
|
|
2404
|
-
* - SignatureScheme → imported from pallet-extrinsics
|
|
2405
|
-
*/
|
|
2406
|
-
|
|
2407
|
-
/**
|
|
2408
|
-
* Emitted when a Substrate account is mapped to an Ethereum address.
|
|
2409
|
-
* Rust variant: `AccountMapped { account, address }`
|
|
2410
|
-
*/
|
|
2411
|
-
type AccountMappedEvent = {
|
|
2412
|
-
account: string;
|
|
2413
|
-
/** 0x-prefixed 20-byte Ethereum address. */
|
|
2414
|
-
address: string;
|
|
2415
|
-
};
|
|
2416
|
-
/**
|
|
2417
|
-
* Emitted when an existing account mapping is removed.
|
|
2418
|
-
* Rust variant: `AccountUnmapped { account, address }`
|
|
2419
|
-
*/
|
|
2420
|
-
type AccountUnmappedEvent = {
|
|
2421
|
-
account: string;
|
|
2422
|
-
/** 0x-prefixed 20-byte Ethereum address. */
|
|
2423
|
-
address: string;
|
|
2424
|
-
};
|
|
2425
|
-
/**
|
|
2426
|
-
* Emitted by `register_alias()` when a new alias is claimed.
|
|
2427
|
-
* Rust variant: `AliasRegistered { account, alias, evm_address }`
|
|
2428
|
-
*/
|
|
2429
|
-
type AliasRegisteredEvent = {
|
|
2430
|
-
account: string;
|
|
2431
|
-
alias: string;
|
|
2432
|
-
/** Optional EVM address linked at registration time. */
|
|
2433
|
-
evmAddress: string | null;
|
|
2434
|
-
};
|
|
2435
|
-
/**
|
|
2436
|
-
* Emitted when an alias is released (burned / expired).
|
|
2437
|
-
* Rust variant: `AliasReleased { account, alias }`
|
|
2438
|
-
*/
|
|
2439
|
-
type AliasReleasedEvent = {
|
|
2440
|
-
account: string;
|
|
2441
|
-
alias: string;
|
|
2618
|
+
type AliasReleasedEvent = {
|
|
2619
|
+
account: string;
|
|
2620
|
+
alias: string;
|
|
2442
2621
|
};
|
|
2443
2622
|
/**
|
|
2444
2623
|
* Emitted by `transfer_alias()` when ownership changes hands.
|
|
@@ -2624,135 +2803,761 @@ type AccountMappingEvent = {
|
|
|
2624
2803
|
data: PrivateLinkDispatchExecutedEvent;
|
|
2625
2804
|
};
|
|
2626
2805
|
|
|
2627
|
-
/** Configuration for IndexerClient. */
|
|
2628
|
-
interface IndexerClientConfig {
|
|
2629
|
-
/** Base URL of the indexer REST API (no trailing slash). */
|
|
2630
|
-
baseUrl: string;
|
|
2631
|
-
/** Request timeout in ms. Default: 10_000. */
|
|
2632
|
-
timeoutMs?: number;
|
|
2633
|
-
}
|
|
2634
|
-
/** Generic paginated result returned by list endpoints. */
|
|
2635
|
-
interface PaginatedResult<T> {
|
|
2636
|
-
data: T[];
|
|
2637
|
-
pagination: {
|
|
2638
|
-
page: number;
|
|
2639
|
-
limit: number;
|
|
2640
|
-
total: number;
|
|
2641
|
-
};
|
|
2642
|
-
}
|
|
2643
|
-
/** A shielded commitment (shield event) stored by the indexer. */
|
|
2644
|
-
interface ShieldedCommitment {
|
|
2645
|
-
commitmentHex: string;
|
|
2646
|
-
blockNumber: number;
|
|
2647
|
-
extrinsicIndex: number | null;
|
|
2648
|
-
leafIndex: number;
|
|
2649
|
-
/** Asset ID as decimal string (e.g. "0"). */
|
|
2650
|
-
assetId: string;
|
|
2651
|
-
/** SS58 or 0x-prefixed depositor address, null if not tracked. */
|
|
2652
|
-
sender: string | null;
|
|
2653
|
-
/** 0x-prefixed encrypted memo hex, null if not present. */
|
|
2654
|
-
encryptedMemo: string | null;
|
|
2655
|
-
timestampMs: number | null;
|
|
2656
|
-
}
|
|
2657
|
-
/** A spent nullifier stored by the indexer. */
|
|
2658
|
-
interface SpentNullifier {
|
|
2659
|
-
nullifierHex: string;
|
|
2660
|
-
blockNumber: number;
|
|
2661
|
-
extrinsicIndex: number | null;
|
|
2662
|
-
txType: 'unshield' | 'private_transfer';
|
|
2663
|
-
timestampMs: number | null;
|
|
2664
|
-
}
|
|
2665
|
-
/** A private transfer event stored by the indexer. */
|
|
2666
|
-
interface PrivateTransfer {
|
|
2667
|
-
/** "{blockNumber}-{extrinsicIndex}" */
|
|
2668
|
-
id: string;
|
|
2669
|
-
blockNumber: number;
|
|
2670
|
-
extrinsicIndex: number | null;
|
|
2671
|
-
/** JSON-encoded array of nullifier hex strings. */
|
|
2672
|
-
inputNullifiersJson: string;
|
|
2673
|
-
/** JSON-encoded array of commitment hex strings. */
|
|
2674
|
-
outputCommitmentsJson: string;
|
|
2675
|
-
/** JSON-encoded array of leaf index numbers. */
|
|
2676
|
-
leafIndicesJson: string;
|
|
2677
|
-
timestampMs: number | null;
|
|
2678
|
-
}
|
|
2679
|
-
/** An unshield event stored by the indexer. */
|
|
2680
|
-
interface Unshield {
|
|
2681
|
-
/** "{blockNumber}-{extrinsicIndex}" */
|
|
2682
|
-
id: string;
|
|
2683
|
-
blockNumber: number;
|
|
2684
|
-
extrinsicIndex: number | null;
|
|
2685
|
-
nullifierHex: string;
|
|
2686
|
-
/** Asset ID as decimal string. */
|
|
2687
|
-
assetId: string;
|
|
2688
|
-
/** Amount as decimal string (bigint-safe). */
|
|
2689
|
-
amount: string;
|
|
2690
|
-
recipient: string;
|
|
2691
|
-
timestampMs: number | null;
|
|
2692
|
-
}
|
|
2693
|
-
/** A Merkle root checkpoint stored by the indexer. */
|
|
2694
|
-
interface MerkleRoot {
|
|
2695
|
-
id: number;
|
|
2696
|
-
rootHex: string;
|
|
2697
|
-
blockNumber: number;
|
|
2698
|
-
oldRootHex: string | null;
|
|
2699
|
-
treeSize: number;
|
|
2700
|
-
timestampMs: number | null;
|
|
2701
|
-
}
|
|
2702
|
-
/** Response from the nullifier status endpoint. */
|
|
2703
|
-
interface NullifierStatusResult {
|
|
2704
|
-
nullifier: string;
|
|
2705
|
-
spent: boolean;
|
|
2706
|
-
txType?: 'unshield' | 'private_transfer';
|
|
2707
|
-
blockNumber?: number;
|
|
2708
|
-
}
|
|
2709
2806
|
/**
|
|
2710
|
-
*
|
|
2807
|
+
* TypeScript types for pallet-shielded-pool extrinsics and supporting structures.
|
|
2711
2808
|
*
|
|
2712
|
-
*
|
|
2713
|
-
*
|
|
2809
|
+
* Conventions:
|
|
2810
|
+
* - Fixed/bounded byte arrays → `number[]` (SCALE-compatible)
|
|
2811
|
+
* - Balances (u128) → `bigint`
|
|
2812
|
+
* - AccountId → `string` (SS58 or 0x-prefixed 64-char hex)
|
|
2813
|
+
* - Block numbers → `number`
|
|
2814
|
+
* - Optional fields → `T | null`
|
|
2714
2815
|
*/
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
/**
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2816
|
+
/**
|
|
2817
|
+
* 32-byte SCALE-encoded value (commitment, nullifier, Merkle root, etc.).
|
|
2818
|
+
* Stored as little-endian Poseidon field elements on-chain.
|
|
2819
|
+
*/
|
|
2820
|
+
type Bytes32 = number[];
|
|
2821
|
+
/**
|
|
2822
|
+
* Structured disclosure public signals — exactly 76 bytes:
|
|
2823
|
+
* commitment[0..32] | revealed_value[32..40] | revealed_asset_id[40..44] | owner_hash[44..76]
|
|
2824
|
+
*/
|
|
2825
|
+
type DisclosurePublicSignals = number[];
|
|
2826
|
+
/**
|
|
2827
|
+
* A single auditor entry in an audit policy.
|
|
2828
|
+
* Maps to `Auditor<AccountId>` in Rust.
|
|
2829
|
+
*/
|
|
2830
|
+
type Auditor = {
|
|
2831
|
+
/** SS58 or 0x-prefixed AccountId of the authorized auditor. */
|
|
2832
|
+
account: string;
|
|
2833
|
+
};
|
|
2834
|
+
/**
|
|
2835
|
+
* A condition that must be satisfied before disclosure is permitted.
|
|
2836
|
+
* Maps to `DisclosureCondition` in Rust. Max 10 conditions per policy.
|
|
2837
|
+
*/
|
|
2838
|
+
type DisclosureCondition = {
|
|
2839
|
+
type: 'MinValue';
|
|
2840
|
+
value: bigint;
|
|
2841
|
+
} | {
|
|
2842
|
+
type: 'MaxValue';
|
|
2843
|
+
value: bigint;
|
|
2844
|
+
} | {
|
|
2845
|
+
type: 'AssetId';
|
|
2846
|
+
assetId: number;
|
|
2847
|
+
} | {
|
|
2848
|
+
type: 'RecipientIs';
|
|
2849
|
+
recipient: string;
|
|
2850
|
+
} | {
|
|
2851
|
+
type: 'Custom';
|
|
2852
|
+
encoded: number[];
|
|
2853
|
+
};
|
|
2854
|
+
/**
|
|
2855
|
+
* A single entry in a batch disclosure proof submission.
|
|
2856
|
+
* Maps to `BatchDisclosureSubmission<AccountId>` in Rust.
|
|
2857
|
+
*/
|
|
2858
|
+
type BatchDisclosureSubmission = {
|
|
2859
|
+
/** 32-byte commitment (LE). */
|
|
2860
|
+
commitment: Bytes32;
|
|
2861
|
+
/** Groth16 proof bytes — max 256 bytes. */
|
|
2862
|
+
proof: number[];
|
|
2863
|
+
/** 76-byte public signals: commitment(32) | value(8) | asset_id(4) | owner_hash(32). */
|
|
2864
|
+
publicSignals: DisclosurePublicSignals;
|
|
2865
|
+
/** Optional auditor AccountId. Null = voluntary disclosure. */
|
|
2866
|
+
auditor: string | null;
|
|
2867
|
+
};
|
|
2868
|
+
/**
|
|
2869
|
+
* A single shield operation for use in `shield_batch`.
|
|
2870
|
+
*/
|
|
2871
|
+
type ShieldOperation = {
|
|
2872
|
+
assetId: number;
|
|
2873
|
+
amount: bigint;
|
|
2874
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
2875
|
+
commitment: Bytes32;
|
|
2876
|
+
/** Encrypted memo bytes — exactly 104 bytes. */
|
|
2877
|
+
encryptedMemo: number[];
|
|
2878
|
+
};
|
|
2879
|
+
/**
|
|
2880
|
+
* Call index 0 — `shield` (Signed origin)
|
|
2881
|
+
* Deposits a public token amount into the shielded pool.
|
|
2882
|
+
*/
|
|
2883
|
+
type ShieldArgs = {
|
|
2884
|
+
assetId: number;
|
|
2885
|
+
amount: bigint;
|
|
2886
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
2887
|
+
commitment: Bytes32;
|
|
2888
|
+
/** Encrypted memo — exactly 104 bytes. */
|
|
2889
|
+
encryptedMemo: number[];
|
|
2890
|
+
};
|
|
2891
|
+
/**
|
|
2892
|
+
* Call index 12 — `shield_batch` (Signed origin)
|
|
2893
|
+
* Deposits multiple notes in a single extrinsic — max 20 operations.
|
|
2894
|
+
*/
|
|
2895
|
+
type ShieldBatchArgs = {
|
|
2896
|
+
operations: ShieldOperation[];
|
|
2897
|
+
};
|
|
2898
|
+
/** Input note consumed by a private transfer (SCALE wire format). */
|
|
2899
|
+
type RawTransferInput = {
|
|
2900
|
+
/** 32-byte Poseidon nullifier (LE). */
|
|
2901
|
+
nullifier: Bytes32;
|
|
2902
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
2903
|
+
commitment: Bytes32;
|
|
2904
|
+
};
|
|
2905
|
+
/** Output note created by a private transfer (SCALE wire format). */
|
|
2906
|
+
type RawTransferOutput = {
|
|
2907
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
2908
|
+
commitment: Bytes32;
|
|
2909
|
+
/** Encrypted memo — exactly 104 bytes. */
|
|
2910
|
+
memo: number[];
|
|
2911
|
+
};
|
|
2912
|
+
/**
|
|
2913
|
+
* Call index 1 — `private_transfer` (Signed origin)
|
|
2914
|
+
* Transfers value between notes without revealing sender, recipient or amount.
|
|
2915
|
+
* Accepts 1–2 inputs and 1–2 outputs; total input value must equal total output value.
|
|
2916
|
+
*/
|
|
2917
|
+
type PrivateTransferArgs = {
|
|
2918
|
+
/** Groth16 proof bytes — max 512 bytes. */
|
|
2919
|
+
proof: number[];
|
|
2920
|
+
/** 32-byte Merkle root (LE). */
|
|
2921
|
+
merkleRoot: Bytes32;
|
|
2922
|
+
nullifiers: RawTransferInput[];
|
|
2923
|
+
outputs: RawTransferOutput[];
|
|
2924
|
+
encryptedMemos: number[][];
|
|
2925
|
+
};
|
|
2926
|
+
/**
|
|
2927
|
+
* Call index 2 — `unshield` (Signed origin)
|
|
2928
|
+
* Withdraws a note from the pool to a public account.
|
|
2929
|
+
*/
|
|
2930
|
+
type UnshieldArgs = {
|
|
2931
|
+
/** Groth16 proof bytes — max 512 bytes. */
|
|
2932
|
+
proof: number[];
|
|
2933
|
+
/** 32-byte Merkle root (LE). */
|
|
2934
|
+
merkleRoot: Bytes32;
|
|
2935
|
+
/** 32-byte nullifier of the spent note (LE). */
|
|
2936
|
+
nullifier: Bytes32;
|
|
2937
|
+
assetId: number;
|
|
2938
|
+
amount: bigint;
|
|
2939
|
+
/** SS58 or 0x-prefixed AccountId of the recipient. */
|
|
2940
|
+
recipient: string;
|
|
2941
|
+
};
|
|
2942
|
+
/**
|
|
2943
|
+
* Call index 4 — `set_audit_policy` (Signed origin)
|
|
2944
|
+
* Registers or replaces the caller's audit policy for selective disclosure.
|
|
2945
|
+
*/
|
|
2946
|
+
type SetAuditPolicyArgs = {
|
|
2947
|
+
/** Up to 10 authorized auditors. */
|
|
2948
|
+
auditors: Auditor[];
|
|
2949
|
+
/** Up to 10 disclosure conditions. */
|
|
2950
|
+
conditions: DisclosureCondition[];
|
|
2951
|
+
/** Minimum blocks between disclosures to the same auditor. Null = no limit. */
|
|
2952
|
+
maxFrequency: number | null;
|
|
2953
|
+
/** Block after which the policy expires. Null = no expiry. */
|
|
2954
|
+
validUntil: number | null;
|
|
2955
|
+
};
|
|
2956
|
+
/**
|
|
2957
|
+
* Call index 5 — `request_disclosure` (Signed origin)
|
|
2958
|
+
* Auditor requests selective disclosure from a target account.
|
|
2959
|
+
*/
|
|
2960
|
+
type RequestDisclosureArgs = {
|
|
2961
|
+
/** AccountId of the disclosure target. */
|
|
2962
|
+
target: string;
|
|
2963
|
+
/** Human-readable request reason — max 256 bytes UTF-8. */
|
|
2964
|
+
reason: string;
|
|
2965
|
+
};
|
|
2966
|
+
/**
|
|
2967
|
+
* Call index 6 — `disclose` (Signed origin)
|
|
2968
|
+
* Submit a Groth16 disclosure proof for a commitment.
|
|
2969
|
+
*/
|
|
2970
|
+
type DiscloseArgs = {
|
|
2971
|
+
/** 32-byte note commitment to disclose (LE). */
|
|
2972
|
+
commitment: Bytes32;
|
|
2973
|
+
/** Groth16 proof bytes — max 256 bytes. */
|
|
2974
|
+
proofBytes: number[];
|
|
2975
|
+
/** 76-byte public signals: commitment(32) | value(8) | asset_id(4) | owner_hash(32). */
|
|
2976
|
+
publicSignals: DisclosurePublicSignals;
|
|
2977
|
+
/** Target auditor AccountId. Null = voluntary public disclosure. */
|
|
2978
|
+
auditor: string | null;
|
|
2979
|
+
};
|
|
2980
|
+
/**
|
|
2981
|
+
* Call index 7 — `reject_disclosure` (Signed origin)
|
|
2982
|
+
* Disclosure target rejects a pending request from an auditor.
|
|
2983
|
+
*/
|
|
2984
|
+
type RejectDisclosureArgs = {
|
|
2985
|
+
/** AccountId of the auditor whose request is rejected. */
|
|
2986
|
+
auditor: string;
|
|
2987
|
+
/** Rejection reason — max 256 bytes UTF-8. */
|
|
2988
|
+
reason: string;
|
|
2989
|
+
};
|
|
2990
|
+
/**
|
|
2991
|
+
* Call index 13 — `batch_submit_disclosure_proofs` (Signed origin)
|
|
2992
|
+
* Submit up to 10 disclosure proofs in one extrinsic.
|
|
2993
|
+
*/
|
|
2994
|
+
type BatchSubmitDisclosureProofsArgs = {
|
|
2995
|
+
submissions: BatchDisclosureSubmission[];
|
|
2996
|
+
};
|
|
2997
|
+
/**
|
|
2998
|
+
* Call index 9 — `register_asset` (Root origin)
|
|
2999
|
+
* Registers a new asset in the shielded pool registry.
|
|
3000
|
+
*/
|
|
3001
|
+
type RegisterAssetArgs = {
|
|
3002
|
+
/** Asset name — max 64 bytes UTF-8. */
|
|
3003
|
+
name: string;
|
|
3004
|
+
/** Asset ticker symbol, e.g. "USDT" — max 16 bytes UTF-8. */
|
|
3005
|
+
symbol: string;
|
|
3006
|
+
/** Token decimal precision (e.g. 18 for ORB, 6 for USDT). */
|
|
3007
|
+
decimals: number;
|
|
3008
|
+
/** 20-byte EVM contract address for ERC-20 assets. Null = native asset. */
|
|
3009
|
+
contractAddress: number[] | null;
|
|
3010
|
+
};
|
|
3011
|
+
/**
|
|
3012
|
+
* Call index 10 — `verify_asset` (Root origin)
|
|
3013
|
+
* Marks a registered asset as verified, enabling shielding.
|
|
3014
|
+
*/
|
|
3015
|
+
type VerifyAssetArgs = {
|
|
3016
|
+
assetId: number;
|
|
3017
|
+
};
|
|
3018
|
+
/**
|
|
3019
|
+
* Call index 11 — `unverify_asset` (Root origin)
|
|
3020
|
+
* Removes the verified status from an asset, disabling new shield operations.
|
|
3021
|
+
*/
|
|
3022
|
+
type UnverifyAssetArgs = {
|
|
3023
|
+
assetId: number;
|
|
3024
|
+
};
|
|
3025
|
+
/**
|
|
3026
|
+
* Call index 14 — `prune_expired_request` (Signed origin)
|
|
3027
|
+
* Cleans up a disclosure request that has passed its expiration block.
|
|
3028
|
+
*/
|
|
3029
|
+
type PruneExpiredRequestArgs = {
|
|
3030
|
+
/** AccountId of the disclosure target. */
|
|
3031
|
+
target: string;
|
|
3032
|
+
/** AccountId of the auditor. */
|
|
3033
|
+
auditor: string;
|
|
3034
|
+
};
|
|
3035
|
+
/**
|
|
3036
|
+
* Call index 15 — `revoke_disclosure_record` (Signed origin)
|
|
3037
|
+
* Allows the note owner to revoke a previously submitted disclosure record.
|
|
3038
|
+
*/
|
|
3039
|
+
type RevokeDisclosureRecordArgs = {
|
|
3040
|
+
/** 32-byte commitment whose disclosure record should be revoked (LE). */
|
|
3041
|
+
commitment: Bytes32;
|
|
3042
|
+
};
|
|
3043
|
+
/** All pallet-shielded-pool calls as a discriminated union. */
|
|
3044
|
+
type ShieldedPoolCall = {
|
|
3045
|
+
type: 'shield';
|
|
3046
|
+
args: ShieldArgs;
|
|
3047
|
+
} | {
|
|
3048
|
+
type: 'shieldBatch';
|
|
3049
|
+
args: ShieldBatchArgs;
|
|
3050
|
+
} | {
|
|
3051
|
+
type: 'privateTransfer';
|
|
3052
|
+
args: PrivateTransferArgs;
|
|
3053
|
+
} | {
|
|
3054
|
+
type: 'unshield';
|
|
3055
|
+
args: UnshieldArgs;
|
|
3056
|
+
} | {
|
|
3057
|
+
type: 'setAuditPolicy';
|
|
3058
|
+
args: SetAuditPolicyArgs;
|
|
3059
|
+
} | {
|
|
3060
|
+
type: 'requestDisclosure';
|
|
3061
|
+
args: RequestDisclosureArgs;
|
|
3062
|
+
} | {
|
|
3063
|
+
type: 'disclose';
|
|
3064
|
+
args: DiscloseArgs;
|
|
3065
|
+
} | {
|
|
3066
|
+
type: 'rejectDisclosure';
|
|
3067
|
+
args: RejectDisclosureArgs;
|
|
3068
|
+
} | {
|
|
3069
|
+
type: 'batchSubmitDisclosureProofs';
|
|
3070
|
+
args: BatchSubmitDisclosureProofsArgs;
|
|
3071
|
+
} | {
|
|
3072
|
+
type: 'registerAsset';
|
|
3073
|
+
args: RegisterAssetArgs;
|
|
3074
|
+
} | {
|
|
3075
|
+
type: 'verifyAsset';
|
|
3076
|
+
args: VerifyAssetArgs;
|
|
3077
|
+
} | {
|
|
3078
|
+
type: 'unverifyAsset';
|
|
3079
|
+
args: UnverifyAssetArgs;
|
|
3080
|
+
} | {
|
|
3081
|
+
type: 'pruneExpiredRequest';
|
|
3082
|
+
args: PruneExpiredRequestArgs;
|
|
3083
|
+
} | {
|
|
3084
|
+
type: 'revokeDisclosureRecord';
|
|
3085
|
+
args: RevokeDisclosureRecordArgs;
|
|
3086
|
+
};
|
|
3087
|
+
|
|
3088
|
+
/**
|
|
3089
|
+
* Options for {@link formatBalance}.
|
|
3090
|
+
*/
|
|
3091
|
+
interface FormatOptions {
|
|
3092
|
+
/** On-chain token decimals. Defaults to `18`. */
|
|
3093
|
+
decimals?: number;
|
|
3094
|
+
/** Token symbol appended to the output. Defaults to `'ORB'`. */
|
|
3095
|
+
symbol?: string;
|
|
3096
|
+
/** Whether to append the symbol. Defaults to `true`. */
|
|
3097
|
+
showSymbol?: boolean;
|
|
3098
|
+
/** Maximum number of decimal digits shown in output. Defaults to `6`. */
|
|
3099
|
+
precision?: number;
|
|
3100
|
+
}
|
|
3101
|
+
/**
|
|
3102
|
+
* Formats a raw on-chain token amount to a human-readable string.
|
|
3103
|
+
*
|
|
3104
|
+
* Handles the following input forms:
|
|
3105
|
+
* - `bigint` — raw planck/wei amount.
|
|
3106
|
+
* - `string` — canonical decimal integer, canonical hex (`0x`/`0X`-prefixed), or canonical decimal.
|
|
3107
|
+
* - `number` — converted via `String(number)` and accepted only if it matches one of the
|
|
3108
|
+
* supported canonical numeric formats.
|
|
3109
|
+
* - `null` / `undefined` — treated as zero.
|
|
3110
|
+
*
|
|
3111
|
+
* Rejected string formats return zero instead of being coerced. This includes grouped values
|
|
3112
|
+
* such as `1,000`, scientific notation such as `1e18`, underscored numbers, and explicit plus
|
|
3113
|
+
* signs such as `+1`.
|
|
3114
|
+
*
|
|
3115
|
+
* Does NOT depend on `ethers`. Uses pure BigInt arithmetic.
|
|
3116
|
+
*
|
|
3117
|
+
* @example
|
|
3118
|
+
* formatBalance('1000000000000000000') // '1 ORB'
|
|
3119
|
+
* formatBalance(500000000000000000n, { precision: 2 }) // '0.50 ORB'
|
|
3120
|
+
* formatBalance('0x0de0b6b3a7640000', { showSymbol: false }) // '1'
|
|
3121
|
+
* formatBalance(null) // '0 ORB'
|
|
3122
|
+
*/
|
|
3123
|
+
declare function formatBalance(raw: string | bigint | number | null | undefined, options?: FormatOptions | number): string;
|
|
3124
|
+
/**
|
|
3125
|
+
* Convenience wrapper for formatting ORB amounts with 18 decimals.
|
|
3126
|
+
*
|
|
3127
|
+
* @param raw Raw planck amount (string, bigint, number, or null).
|
|
3128
|
+
* @param precision Max decimal digits shown. Defaults to `6`.
|
|
3129
|
+
*
|
|
3130
|
+
* @example
|
|
3131
|
+
* formatORB('1000000000000000000') // '1 ORB'
|
|
3132
|
+
* formatORB(500000000000000000n, 2) // '0.50 ORB'
|
|
3133
|
+
*/
|
|
3134
|
+
declare function formatORB(raw: string | bigint | number | null | undefined, precision?: number): string;
|
|
3135
|
+
|
|
3136
|
+
/** Truncate a string in the middle with an ellipsis. */
|
|
3137
|
+
declare function truncateMiddle(str: string, start: number, end: number): string;
|
|
3138
|
+
/** Shorten a hash for compact inline display. */
|
|
3139
|
+
declare function shortHash(h: string, start?: number, end?: number): string;
|
|
3140
|
+
|
|
3141
|
+
declare function toTxResult(payload: TxFinalizedPayload): TxResult;
|
|
3142
|
+
|
|
3143
|
+
/**
|
|
3144
|
+
* Serialises a bigint as a 32-byte little-endian Uint8Array.
|
|
3145
|
+
*/
|
|
3146
|
+
declare function bigintTo32Le(n: bigint): Uint8Array;
|
|
3147
|
+
/**
|
|
3148
|
+
* Deserialises a Uint8Array as a little-endian unsigned bigint.
|
|
3149
|
+
*/
|
|
3150
|
+
declare function bytesToBigintLE(bytes: Uint8Array): bigint;
|
|
3151
|
+
/**
|
|
3152
|
+
* Serialises a bigint as a 32-byte big-endian Uint8Array.
|
|
3153
|
+
*/
|
|
3154
|
+
declare function bigintTo32Be(n: bigint): Uint8Array;
|
|
3155
|
+
/**
|
|
3156
|
+
* Serialises a bigint as a 32-element little-endian number[].
|
|
3157
|
+
* Useful when building SCALE-encoded arguments via polkadot-api.
|
|
3158
|
+
*/
|
|
3159
|
+
declare function bigintTo32LeArr(n: bigint): number[];
|
|
3160
|
+
/**
|
|
3161
|
+
* Computes the Merkle path direction bits for a leaf at `leafIndex`
|
|
3162
|
+
* in a binary Merkle tree of `depth` levels.
|
|
3163
|
+
* bit 0 = bottom level (leaf), bit depth-1 = top level (root sibling).
|
|
3164
|
+
*/
|
|
3165
|
+
declare function computePathIndices(leafIndex: number, depth: number): number[];
|
|
3166
|
+
/**
|
|
3167
|
+
* Decodes a little-endian hex string (0x-prefixed or bare) to a bigint.
|
|
3168
|
+
* Equivalent to `bytesToBigintLE(fromHex(hex))`.
|
|
3169
|
+
*/
|
|
3170
|
+
declare function leHexToBigint(hex: string): bigint;
|
|
3171
|
+
|
|
3172
|
+
/**
|
|
3173
|
+
* Normalises an EVM address to lowercase with 0x prefix.
|
|
3174
|
+
*/
|
|
3175
|
+
declare function normalizeEvmAddress(addr: string): string;
|
|
3176
|
+
/**
|
|
3177
|
+
* Returns true if the string looks like an SS58 encoded address
|
|
3178
|
+
* (not a 0x-prefixed hex).
|
|
3179
|
+
*/
|
|
3180
|
+
declare function isSs58(addr: string): boolean;
|
|
3181
|
+
/**
|
|
3182
|
+
* Returns true if the string looks like a 20-byte EVM address.
|
|
3183
|
+
*/
|
|
3184
|
+
declare function isEvmAddress(addr: string): boolean;
|
|
3185
|
+
/**
|
|
3186
|
+
* Pads a 20-byte EVM address to a 32-byte account ID (H256)
|
|
3187
|
+
* by prepending 12 zero bytes (Ethereum-compatible mapping).
|
|
3188
|
+
*/
|
|
3189
|
+
declare function evmAddressToAccountId(evmAddr: string): Uint8Array;
|
|
3190
|
+
/**
|
|
3191
|
+
* Derives the implicit Substrate AccountId32 for an EVM address using the
|
|
3192
|
+
* EeSuffixAddressMapping rule: AccountId32 = H160 ++ [0x00; 12].
|
|
3193
|
+
*
|
|
3194
|
+
* This is the same rule applied by pallet-account-mapping's fallback when
|
|
3195
|
+
* there is no explicit `map_account` entry. Returns 0x-prefixed 64-char hex.
|
|
3196
|
+
*
|
|
3197
|
+
* @param evmAddr 0x-prefixed 20-byte EVM address.
|
|
3198
|
+
*/
|
|
3199
|
+
declare function evmToImplicitSubstrate(evmAddr: string): string;
|
|
3200
|
+
/**
|
|
3201
|
+
* Converts an EVM H160 address to the 32-byte AccountId32 hex used by
|
|
3202
|
+
* pallet-account-mapping (EeSuffixAddressMapping: H160 ++ [0x00; 12]).
|
|
3203
|
+
* Returns null for invalid or non-EVM input.
|
|
3204
|
+
*
|
|
3205
|
+
* @param address 0x-prefixed EVM H160 address (or bare 40-char hex).
|
|
3206
|
+
*/
|
|
3207
|
+
declare function evmToMappedAccountHex(address: string): string | null;
|
|
3208
|
+
/**
|
|
3209
|
+
* Returns true if the given AccountId32 hex was derived from an EVM address
|
|
3210
|
+
* via the EeSuffixAddressMapping (last 12 bytes are zero).
|
|
3211
|
+
*
|
|
3212
|
+
* @param accountHex 0x-prefixed 64-char AccountId32 hex.
|
|
3213
|
+
*/
|
|
3214
|
+
declare function isImplicitEvmAccount(accountHex: string): boolean;
|
|
3215
|
+
/**
|
|
3216
|
+
* Extracts the EVM address (H160) from an implicit Substrate AccountId32
|
|
3217
|
+
* created by EeSuffixAddressMapping. Throws if the account is not EVM-derived.
|
|
3218
|
+
*
|
|
3219
|
+
* @param accountHex 0x-prefixed 64-char AccountId32 hex.
|
|
3220
|
+
*/
|
|
3221
|
+
declare function implicitSubstrateToEvm(accountHex: string): string;
|
|
3222
|
+
/**
|
|
3223
|
+
* Returns true if `addr` is a valid SS58 substrate address (not EVM).
|
|
3224
|
+
*/
|
|
3225
|
+
declare function isSubstrateAddress(addr: string): boolean;
|
|
3226
|
+
/**
|
|
3227
|
+
* Returns true if `addr` is a Substrate SS58 address derived from an EVM H160
|
|
3228
|
+
* via the EeSuffixAddressMapping rule (last 12 bytes of AccountId are zero).
|
|
3229
|
+
*/
|
|
3230
|
+
declare function isUnifiedAddress(addr: string): boolean;
|
|
3231
|
+
/**
|
|
3232
|
+
* Converts a unified (EVM-derived) Substrate SS58 address to its EVM H160.
|
|
3233
|
+
* Returns null for native Substrate accounts or invalid input.
|
|
3234
|
+
*/
|
|
3235
|
+
declare function substrateToEvm(addr: string): string | null;
|
|
3236
|
+
/**
|
|
3237
|
+
* Converts an EVM H160 address to its Substrate SS58 equivalent
|
|
3238
|
+
* using the EeSuffixAddressMapping rule: AccountId32 = H160 ++ [0x00; 12].
|
|
3239
|
+
* Returns null on invalid input.
|
|
3240
|
+
*/
|
|
3241
|
+
declare function evmToSubstrate(addr: string): string | null;
|
|
3242
|
+
/**
|
|
3243
|
+
* Converts a 32-byte AccountId hex (0x-prefixed or bare) to its SS58 string.
|
|
3244
|
+
* Returns null on invalid input.
|
|
3245
|
+
*/
|
|
3246
|
+
declare function accountIdHexToSs58(hex: string): string | null;
|
|
3247
|
+
/**
|
|
3248
|
+
* Converts a Substrate SS58 address to its AccountId32 as a 0x-prefixed 64-char hex.
|
|
3249
|
+
* Returns null on invalid input.
|
|
3250
|
+
*/
|
|
3251
|
+
declare function substrateSs58ToAccountIdHex(addr: string): string | null;
|
|
3252
|
+
/**
|
|
3253
|
+
* Universal converter: given any raw address string (SS58, 0x-prefixed 64-char
|
|
3254
|
+
* AccountId hex, or EVM H160), returns the AccountId32 hex (0x-prefixed).
|
|
3255
|
+
* Returns null on unrecognised input.
|
|
3256
|
+
*/
|
|
3257
|
+
declare function addressToAccountIdHex(addr: string): string | null;
|
|
3258
|
+
|
|
3259
|
+
/**
|
|
3260
|
+
* Utilities for decoding on-chain extrinsic arguments and event data.
|
|
3261
|
+
*
|
|
3262
|
+
* Substrate/PAPI nodes return positional arg keys (`arg0`, `arg1`, …) when
|
|
3263
|
+
* metadata-based decoding is unavailable. These helpers map those positions
|
|
3264
|
+
* to human-readable semantic names for all Orbinum pallets.
|
|
3265
|
+
*/
|
|
3266
|
+
/**
|
|
3267
|
+
* Maps raw extrinsic args (which may use positional keys like `arg0`, `arg1`)
|
|
3268
|
+
* to semantic field names for a given pallet section/method.
|
|
3269
|
+
*
|
|
3270
|
+
* @param section - Pallet name (e.g. `'shieldedPool'`).
|
|
3271
|
+
* @param method - Call name (e.g. `'shield'`).
|
|
3272
|
+
* @param args - Raw args object from the node.
|
|
3273
|
+
* @returns Remapped args with semantic keys, or the original object if unknown.
|
|
3274
|
+
*/
|
|
3275
|
+
declare function mapExtrinsicArgs(section: string, method: string, args: Record<string, unknown>): Record<string, unknown>;
|
|
3276
|
+
/**
|
|
3277
|
+
* Maps raw event data fields (which may use positional keys) to semantic names
|
|
3278
|
+
* for shielded-pool, account-mapping, zk-verifier, evm, ethereum and system events.
|
|
3279
|
+
*
|
|
3280
|
+
* @param method - Event name (e.g. `'shielded'`, `'aliasRegistered'`).
|
|
3281
|
+
* @param data - Raw event data fields.
|
|
3282
|
+
* @returns Remapped data with semantic keys, or the original object if unknown.
|
|
3283
|
+
*/
|
|
3284
|
+
declare function mapZkEventData(method: string, data: Record<string, unknown>): Record<string, unknown>;
|
|
3285
|
+
|
|
3286
|
+
/**
|
|
3287
|
+
* Decoded extrinsic arg shapes — "explorer/read path".
|
|
3288
|
+
*
|
|
3289
|
+
* These interfaces mirror on-chain arg shapes as they appear after JSON
|
|
3290
|
+
* decoding (snake_case keys, string amounts). They are intentionally
|
|
3291
|
+
* different from the call-builder types in shielded-pool/types/pallet-extrinsics.ts
|
|
3292
|
+
* which use camelCase and bigint/Bytes32 for SCALE construction.
|
|
3293
|
+
*/
|
|
3294
|
+
interface DecodedShieldArgs {
|
|
3295
|
+
asset_id: number | string;
|
|
3296
|
+
amount: string;
|
|
3297
|
+
commitment: string;
|
|
3298
|
+
encrypted_memo: string;
|
|
3299
|
+
}
|
|
3300
|
+
interface DecodedShieldBatchOperation {
|
|
3301
|
+
asset_id: number | string;
|
|
3302
|
+
amount: string;
|
|
3303
|
+
commitment: string;
|
|
3304
|
+
encrypted_memo: string;
|
|
3305
|
+
}
|
|
3306
|
+
interface DecodedShieldBatchArgs {
|
|
3307
|
+
operations: DecodedShieldBatchOperation[];
|
|
3308
|
+
}
|
|
3309
|
+
interface DecodedPrivateTransferArgs {
|
|
3310
|
+
proof: string;
|
|
3311
|
+
merkle_root: string;
|
|
3312
|
+
nullifiers: string[];
|
|
3313
|
+
commitments: string[];
|
|
3314
|
+
encrypted_memos: string[];
|
|
3315
|
+
}
|
|
3316
|
+
interface DecodedUnshieldArgs {
|
|
3317
|
+
proof: string;
|
|
3318
|
+
merkle_root: string;
|
|
3319
|
+
nullifier: string;
|
|
3320
|
+
asset_id: number | string;
|
|
3321
|
+
amount: string;
|
|
3322
|
+
recipient: string;
|
|
3323
|
+
}
|
|
3324
|
+
interface DecodedSetAuditPolicyArgs {
|
|
3325
|
+
auditors: string[];
|
|
3326
|
+
conditions: unknown;
|
|
3327
|
+
max_frequency: number;
|
|
3328
|
+
}
|
|
3329
|
+
interface DecodedRequestDisclosureArgs {
|
|
3330
|
+
target: string;
|
|
3331
|
+
reason: string;
|
|
3332
|
+
evidence?: string;
|
|
3333
|
+
}
|
|
3334
|
+
interface DecodedApproveDisclosureArgs {
|
|
3335
|
+
auditor: string;
|
|
3336
|
+
commitment: string;
|
|
3337
|
+
proof: string;
|
|
3338
|
+
public_signals: string[];
|
|
3339
|
+
extra_data: unknown;
|
|
3340
|
+
}
|
|
3341
|
+
interface DecodedRejectDisclosureArgs {
|
|
3342
|
+
auditor: string;
|
|
3343
|
+
reason: string;
|
|
3344
|
+
}
|
|
3345
|
+
interface DecodedSubmitDisclosureArgs {
|
|
3346
|
+
commitment: string;
|
|
3347
|
+
proof: string;
|
|
3348
|
+
public_signals: string[];
|
|
3349
|
+
partial_data: unknown;
|
|
3350
|
+
auditor: string;
|
|
3351
|
+
}
|
|
3352
|
+
interface DecodedBatchSubmitDisclosureArgs {
|
|
3353
|
+
count: number;
|
|
3354
|
+
submissions: DecodedSubmitDisclosureArgs[];
|
|
3355
|
+
}
|
|
3356
|
+
interface DecodedTransferArgs {
|
|
3357
|
+
dest: string;
|
|
3358
|
+
value: string;
|
|
3359
|
+
}
|
|
3360
|
+
type DecodedTransferKeepAliveArgs = DecodedTransferArgs;
|
|
3361
|
+
interface DecodedTransferAllArgs {
|
|
3362
|
+
dest: string;
|
|
3363
|
+
keep_alive: boolean;
|
|
3364
|
+
}
|
|
3365
|
+
interface DecodedBatchArgs {
|
|
3366
|
+
calls: unknown[];
|
|
3367
|
+
}
|
|
3368
|
+
interface DecodedSudoArgs {
|
|
3369
|
+
call: unknown;
|
|
3370
|
+
}
|
|
3371
|
+
interface DecodedRemarkArgs {
|
|
3372
|
+
remark: string;
|
|
3373
|
+
}
|
|
3374
|
+
interface DecodedRegisterAliasArgs {
|
|
3375
|
+
alias: string;
|
|
3376
|
+
}
|
|
3377
|
+
interface DecodedPutAliasForSaleArgs {
|
|
3378
|
+
asking_price: string;
|
|
3379
|
+
sale_type: string;
|
|
3380
|
+
whitelist_count?: number;
|
|
3381
|
+
}
|
|
3382
|
+
interface DecodedSetAccountMetadataArgs {
|
|
3383
|
+
display_name: string;
|
|
3384
|
+
bio: string;
|
|
3385
|
+
avatar: string;
|
|
3386
|
+
}
|
|
3387
|
+
interface DecodedAddChainLinkArgs {
|
|
3388
|
+
chain_id: number | string;
|
|
3389
|
+
target_address: string;
|
|
3390
|
+
signature: string;
|
|
3391
|
+
}
|
|
3392
|
+
interface DecodedRevealPrivateLinkArgs {
|
|
3393
|
+
commitment: string;
|
|
3394
|
+
address: string;
|
|
3395
|
+
blinding: string;
|
|
3396
|
+
signature: string;
|
|
3397
|
+
}
|
|
3398
|
+
interface DecodedDispatchAsPrivateLinkArgs {
|
|
3399
|
+
owner: string;
|
|
3400
|
+
commitment: string;
|
|
3401
|
+
zk_proof: string;
|
|
3402
|
+
inner_call: string;
|
|
3403
|
+
}
|
|
3404
|
+
interface DecodedEthereumTransactArgs {
|
|
3405
|
+
tx_type: string;
|
|
3406
|
+
chain_id?: number;
|
|
3407
|
+
nonce?: number;
|
|
3408
|
+
gas_limit?: number;
|
|
3409
|
+
to: string;
|
|
3410
|
+
value?: string;
|
|
3411
|
+
input: string;
|
|
3412
|
+
}
|
|
3413
|
+
interface DecodedEvmCallArgs {
|
|
3414
|
+
source: string;
|
|
3415
|
+
target: string;
|
|
3416
|
+
input: string;
|
|
3417
|
+
value: string;
|
|
3418
|
+
gas_limit: number;
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
/**
|
|
3422
|
+
* Decoded pallet event data shapes — "explorer/read path".
|
|
3423
|
+
*
|
|
3424
|
+
* These interfaces represent the JSON-decoded form of on-chain events as
|
|
3425
|
+
* they are received via RPC or indexer. They cover all pallets relevant
|
|
3426
|
+
* to the Orbinum explorer: shielded-pool, balances, system, ethereum, evm,
|
|
3427
|
+
* and account-mapping.
|
|
3428
|
+
*
|
|
3429
|
+
* Note: EventRecord itself is exported from @orbinum/sdk via substrate/types.
|
|
3430
|
+
*/
|
|
3431
|
+
interface ShieldedEventData {
|
|
3432
|
+
sender: string;
|
|
3433
|
+
amount: string | null;
|
|
3434
|
+
commitment: string;
|
|
3435
|
+
memo: string;
|
|
3436
|
+
index: number;
|
|
3437
|
+
}
|
|
3438
|
+
interface PrivateTransferEventData {
|
|
3439
|
+
nullifiers: string[];
|
|
3440
|
+
commitments: string[];
|
|
3441
|
+
memos: string[];
|
|
3442
|
+
indices: number[];
|
|
3443
|
+
}
|
|
3444
|
+
interface UnshieldedEventData {
|
|
3445
|
+
nullifier: string;
|
|
3446
|
+
amount: string | null;
|
|
3447
|
+
recipient: string;
|
|
3448
|
+
}
|
|
3449
|
+
interface MerkleRootUpdatedData {
|
|
3450
|
+
old_root: string;
|
|
3451
|
+
new_root: string;
|
|
3452
|
+
size: number;
|
|
3453
|
+
}
|
|
3454
|
+
interface AuditPolicySetData {
|
|
3455
|
+
who: string;
|
|
3456
|
+
auditors: string[];
|
|
3457
|
+
version: number;
|
|
3458
|
+
}
|
|
3459
|
+
interface DisclosureRequestedData {
|
|
3460
|
+
requestor: string;
|
|
3461
|
+
target: string;
|
|
3462
|
+
commitment: string;
|
|
3463
|
+
reason?: string;
|
|
3464
|
+
}
|
|
3465
|
+
interface DisclosureApprovedData {
|
|
3466
|
+
who: string;
|
|
3467
|
+
commitment: string;
|
|
3468
|
+
auditor: string;
|
|
3469
|
+
}
|
|
3470
|
+
interface DisclosureRejectedData {
|
|
3471
|
+
who: string;
|
|
3472
|
+
auditor: string;
|
|
3473
|
+
reason: string;
|
|
3474
|
+
}
|
|
3475
|
+
interface DisclosureSubmittedData {
|
|
3476
|
+
who: string;
|
|
3477
|
+
commitment: string;
|
|
3478
|
+
proof_size: number;
|
|
3479
|
+
auditor: string;
|
|
3480
|
+
}
|
|
3481
|
+
interface DisclosureVerifiedData {
|
|
3482
|
+
who: string;
|
|
3483
|
+
commitment: string;
|
|
3484
|
+
verified: boolean;
|
|
3485
|
+
}
|
|
3486
|
+
interface AuditTrailRecordedData {
|
|
3487
|
+
account: string;
|
|
3488
|
+
auditor: string;
|
|
3489
|
+
commitment: string;
|
|
3490
|
+
trail_hash: string;
|
|
3491
|
+
trail_id: string;
|
|
3492
|
+
}
|
|
3493
|
+
interface TransferEventData {
|
|
3494
|
+
from: string;
|
|
3495
|
+
to: string;
|
|
3496
|
+
amount: string;
|
|
3497
|
+
}
|
|
3498
|
+
interface EndowedEventData {
|
|
3499
|
+
account: string;
|
|
3500
|
+
free_balance: string;
|
|
3501
|
+
}
|
|
3502
|
+
interface ReservedEventData {
|
|
3503
|
+
account: string;
|
|
3504
|
+
amount: string;
|
|
3505
|
+
}
|
|
3506
|
+
interface AliasRegisteredData {
|
|
3507
|
+
who: string;
|
|
3508
|
+
alias: string;
|
|
3509
|
+
}
|
|
3510
|
+
interface AliasTransferredData {
|
|
3511
|
+
from: string;
|
|
3512
|
+
to: string;
|
|
3513
|
+
alias: string;
|
|
3514
|
+
}
|
|
3515
|
+
interface AliasOnSaleData {
|
|
3516
|
+
alias: string;
|
|
3517
|
+
price: string;
|
|
3518
|
+
}
|
|
3519
|
+
interface AliasSoldData {
|
|
3520
|
+
from: string;
|
|
3521
|
+
to: string;
|
|
3522
|
+
alias: string;
|
|
3523
|
+
price: string;
|
|
3524
|
+
}
|
|
3525
|
+
interface AccountMappedData {
|
|
3526
|
+
account: string;
|
|
3527
|
+
address: string;
|
|
3528
|
+
}
|
|
3529
|
+
/** EVM exit reason — either a named variant or a plain string. */
|
|
3530
|
+
type EvmExitReason = string | Record<string, unknown>;
|
|
3531
|
+
interface EvmExecutedData {
|
|
3532
|
+
from: string;
|
|
3533
|
+
to: string;
|
|
3534
|
+
tx_hash: string;
|
|
3535
|
+
exit_reason: EvmExitReason;
|
|
3536
|
+
}
|
|
3537
|
+
interface EthereumExecutedData {
|
|
3538
|
+
from: string;
|
|
3539
|
+
to: string;
|
|
3540
|
+
tx_hash: string;
|
|
3541
|
+
exit_reason: EvmExitReason;
|
|
3542
|
+
}
|
|
3543
|
+
interface DispatchInfo {
|
|
3544
|
+
weight: Record<string, unknown>;
|
|
3545
|
+
class: string;
|
|
3546
|
+
pays_fee: string;
|
|
3547
|
+
}
|
|
3548
|
+
interface DispatchError {
|
|
3549
|
+
module?: {
|
|
3550
|
+
index: number;
|
|
3551
|
+
error: number;
|
|
3552
|
+
};
|
|
3553
|
+
[variant: string]: unknown;
|
|
3554
|
+
}
|
|
3555
|
+
interface ExtrinsicSuccessData {
|
|
3556
|
+
dispatch_info: DispatchInfo;
|
|
3557
|
+
}
|
|
3558
|
+
interface ExtrinsicFailedData {
|
|
3559
|
+
dispatch_error: DispatchError;
|
|
3560
|
+
dispatch_info: DispatchInfo;
|
|
2756
3561
|
}
|
|
2757
3562
|
|
|
2758
|
-
export { type AccountListing, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type AddChainLinkArgs, type AddChainLinkParams, type AddSupportedChainArgs, type AliasFullIdentity, type AliasInfo, type AliasListedForSaleEvent, type AliasRegisteredEvent, type AliasReleasedEvent, type AliasSaleCancelledEvent, type AliasSoldEvent, type AliasTransferredEvent, type AssetRegisteredEvent, type AssetUnverifiedEvent, type AssetVerifiedEvent, type AuditPolicySetEvent, type Auditor, type BatchDisclosureSubmission, type BatchRegisterVerificationKeysArgs, type BatchSubmitDisclosureProofsArgs, type BatchVerificationKeysRegisteredEvent, type BuyAliasArgs, type Bytes32, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent,
|
|
3563
|
+
export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type AddChainLinkArgs, type AddChainLinkParams, type AddSupportedChainArgs, type AliasFullIdentity, type AliasInfo, type AliasListedForSaleEvent, type AliasOnSaleData, type AliasRegisteredData, type AliasRegisteredEvent, type AliasReleasedEvent, type AliasSaleCancelledEvent, type AliasSoldData, type AliasSoldEvent, type AliasTransferredData, type AliasTransferredEvent, type AssetRegisteredEvent, type AssetUnverifiedEvent, type AssetVerifiedEvent, type AuditPolicySetData, type AuditPolicySetEvent, type AuditTrailRecordedData, type Auditor, type BatchDisclosureSubmission, type BatchRegisterVerificationKeysArgs, type BatchSubmitDisclosureProofsArgs, type BatchVerificationKeysRegisteredEvent, type BlockInfo, type BuyAliasArgs, type Bytes32, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, type ClientProviderConfig, type ConnectionStatus, CryptoPrecompiles, type DecodedAddChainLinkArgs, type DecodedApproveDisclosureArgs, type DecodedBatchArgs, type DecodedBatchSubmitDisclosureArgs, type DecodedDispatchAsPrivateLinkArgs, type DecodedEthereumTransactArgs, type DecodedEvmCallArgs, type DecodedPrecompile, type DecodedPrivateTransferArgs, type DecodedPutAliasForSaleArgs, type DecodedRegisterAliasArgs, type DecodedRejectDisclosureArgs, type DecodedRemarkArgs, type DecodedRequestDisclosureArgs, type DecodedRevealPrivateLinkArgs, type DecodedSetAccountMetadataArgs, type DecodedSetAuditPolicyArgs, type DecodedShieldArgs, type DecodedShieldBatchArgs, type DecodedShieldBatchOperation, type DecodedSubmitDisclosureArgs, type DecodedSudoArgs, type DecodedTransferAllArgs, type DecodedTransferArgs, type DecodedTransferKeepAliveArgs, type DecodedUnshieldArgs, type DecryptedMemo, type DiscloseArgs, type DisclosedEvent, type DisclosureApprovedData, type DisclosureCondition, type DisclosurePublicSignals, type DisclosureRecordRevokedEvent, type DisclosureRejectedData, type DisclosureRejectedEvent, type DisclosureRequestExpiredEvent, type DisclosureRequestedData, type DisclosureRequestedEvent, type DisclosureSubmittedData, type DisclosureVerifiedData, type DispatchAsLinkedAccountArgs, type DispatchAsLinkedParams, type DispatchAsPrivateLinkArgs, type DispatchError, type DispatchInfo, type DynamicBuilder, EncryptedMemo, type EndowedEventData, type EthereumExecutedData, type EventData, type EventPhase, type EventRecord, type EvmAddressInfo, type EvmBlock, EvmClient, type EvmExecutedData, type EvmExitReason, EvmExplorer, type EvmLog, type EvmSigner, type EvmTransaction, type EvmTxRequest, type EvmTxSummary, type ExtrinsicDecoder, type ExtrinsicFailedData, type ExtrinsicSuccessData, type FormatOptions, type IndexedBlock, type IndexedEvmTx, type IndexedExtrinsic, IndexerClient, type IndexerClientConfig, type IndexerStats, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRoot, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteInput, type NullifierStatusResult, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, type PaginatedResult, PrivacyKeyManager, type PrivacyMerkleProof, PrivacyModule, type PrivateChainLinkAddedEvent, type PrivateChainLinkRemovedEvent, type PrivateChainLinkRevealedEvent, type PrivateLink, type PrivateLinkDispatchExecutedEvent, type PrivateTransfer, type PrivateTransferArgs, type PrivateTransferEvent, type PrivateTransferEventData, type PrivateTransferInput, type PrivateTransferOutput, type PrivateTransferParams, type ProofVerificationFailedEvent, type ProofVerifiedEvent, type ProxyCallExecutedEvent, type PruneExpiredRequestArgs, type PutAliasOnSaleArgs, type PutOnSaleParams, type RawBlock, type RawBlockHeader, type RawTransferInput, type RawTransferOutput, type RegisterAliasArgs, type RegisterAssetArgs, type RegisterPrivateLinkArgs, type RegisterVerificationKeyArgs, type RejectDisclosureArgs, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type RequestDisclosureArgs, type ReservedEventData, type ResolvedAlias, type RevealPrivateLinkArgs, type RevokeDisclosureRecordArgs, type RpcV2MerkleProof, type RpcV2NullifierStatus, type RpcV2PoolAssetBalance, type RpcV2PoolStats, SLIP0044_NAMESPACE, type ScanCommitment, type SetAccountMetadataArgs, type SetActiveVersionArgs, type SetAuditPolicyArgs, type SetMetadataParams, type ShieldArgs, type ShieldBatchArgs, type ShieldBatchItem, type ShieldBatchParams, type ShieldOperation, type ShieldParams, type ShieldResult, type ShieldedAddressEvent, type ShieldedCommitment, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type SpentNullifier, type StatusChangeEvent, type StatusListener, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TxResult, type Unshield, type UnshieldArgs, type UnshieldParams, type UnshieldedEvent, type UnshieldedEventData, type UnverifyAssetArgs, type VerificationKeyRegisteredEvent, type VerificationKeyRemovedEvent, type VerifyAssetArgs, type VerifyProofArgs, type VkEntry, type ZkNote, type ZkVerifierCall, type ZkVerifierCircuitVersionInfo, type ZkVerifierEvent, type ZkVerifierHistoricalVersion, ZkVerifierModule, type ZkVerifierVersionStats, type ZkVerifierVkHash, accountIdHexToSs58, addressToAccountIdHex, bigintTo32Be, bigintTo32Le, bigintTo32LeArr, bytesToBigintLE, computePathIndices, decodePrecompileCalldata, decryptJson, deriveOwnerPk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveVaultKey, deriveViewingKey, encryptJson, ensureHexPrefix, evmAddressToAccountId, evmToImplicitSubstrate, evmToMappedAccountHex, evmToSubstrate, formatBalance, formatORB, fromBase64, fromHex, getPrecompileLabel, hexToBigint, hexToNumber, implicitSubstrateToEvm, isEvmAddress, isImplicitEvmAccount, isSs58, isSubstrateAddress, isUnifiedAddress, leHexToBigint, mapExtrinsicArgs, mapZkEventData, normalizeEvmAddress, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, vaultReplacer, vaultReviver };
|