@orbinum/sdk 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -443
- package/dist/index.d.mts +2005 -845
- package/dist/index.d.ts +2005 -845
- package/dist/index.js +1721 -425
- package/dist/index.mjs +1705 -424
- package/package.json +22 -20
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as polkadot_api from 'polkadot-api';
|
|
2
|
-
import { PolkadotClient, TxFinalizedPayload, PolkadotSigner } from 'polkadot-api';
|
|
2
|
+
import { PolkadotClient, TxFinalizedPayload, PolkadotSigner, TxOptions } from 'polkadot-api';
|
|
3
3
|
export { PolkadotSigner, getSs58AddressInfo } from 'polkadot-api';
|
|
4
4
|
import { getDynamicBuilder } from '@polkadot-api/metadata-builders';
|
|
5
5
|
import { getExtrinsicDecoder } from '@polkadot-api/tx-utils';
|
|
6
|
+
import { ArtifactProvider, ProofResult, DisclosureProofOutput } from '@orbinum/proof-generator';
|
|
7
|
+
export { ArtifactProvider, CircuitType, DisclosureMask as DisclosureFlags, DisclosureProofOutput, ProofResult, WebArtifactProvider, generateDisclosureProof } from '@orbinum/proof-generator';
|
|
6
8
|
export { AccountId, Blake2256, Keccak256, Storage, u128, u64 } from '@polkadot-api/substrate-bindings';
|
|
7
9
|
export { base58 } from '@scure/base';
|
|
8
10
|
export { getPolkadotSigner } from 'polkadot-api/signer';
|
|
@@ -179,6 +181,12 @@ declare class SubstrateClient {
|
|
|
179
181
|
* Events: TxSigned → TxBroadcasted → TxBestBlocksState → TxFinalized
|
|
180
182
|
*/
|
|
181
183
|
submitAndWatch(signedHex: string): ReturnType<PolkadotClient['submitAndWatch']>;
|
|
184
|
+
/**
|
|
185
|
+
* Submits a bare (unsigned) extrinsic hex and waits for finalization.
|
|
186
|
+
* Used for gasless private_transfer and unshield transactions.
|
|
187
|
+
* The bare tx hex is produced by `tx.getBareTx()` from polkadot-api.
|
|
188
|
+
*/
|
|
189
|
+
submitUnsignedAndWatch(bareTxHex: string): Promise<TxFinalizedPayload>;
|
|
182
190
|
/**
|
|
183
191
|
* Convenience: wrap raw call bytes and sign+submit in one step.
|
|
184
192
|
*/
|
|
@@ -213,13 +221,16 @@ declare class SubstrateClient {
|
|
|
213
221
|
*/
|
|
214
222
|
declare class EvmClient {
|
|
215
223
|
private readonly rpcUrl;
|
|
224
|
+
/** @param rpcUrl - HTTP URL of the EVM JSON-RPC endpoint (e.g. `"http://localhost:9933"`). */
|
|
216
225
|
constructor(rpcUrl: string);
|
|
217
226
|
/**
|
|
218
|
-
* Performs a single JSON-RPC call.
|
|
227
|
+
* Performs a single JSON-RPC call and returns the typed result.
|
|
228
|
+
* Throws on HTTP errors, RPC-level errors, or a `null` result.
|
|
219
229
|
*/
|
|
220
230
|
request<T>(method: string, params?: unknown[]): Promise<T>;
|
|
221
231
|
/**
|
|
222
232
|
* Performs multiple JSON-RPC calls in a single HTTP request (batch).
|
|
233
|
+
* Results are returned in the same order as `calls`, as a typed tuple.
|
|
223
234
|
*/
|
|
224
235
|
batchRequest<T extends unknown[]>(calls: Array<{
|
|
225
236
|
method: string;
|
|
@@ -235,100 +246,166 @@ declare class EvmClient {
|
|
|
235
246
|
getTransactionCount(address: string): Promise<number>;
|
|
236
247
|
/** Returns the current gas price in wei. */
|
|
237
248
|
getGasPrice(): Promise<bigint>;
|
|
238
|
-
/**
|
|
239
|
-
* Submits a signed raw transaction. Returns the transaction hash.
|
|
240
|
-
*/
|
|
249
|
+
/** Submits a signed raw transaction. Returns the transaction hash. */
|
|
241
250
|
sendRawTransaction(signedHex: string): Promise<string>;
|
|
242
|
-
/**
|
|
243
|
-
* Executes a read-only call without creating a transaction.
|
|
244
|
-
*/
|
|
251
|
+
/** Executes a read-only call without creating a transaction. Returns the raw ABI-encoded response. */
|
|
245
252
|
call(to: string, data: string, from?: string): Promise<string>;
|
|
246
|
-
/**
|
|
247
|
-
* Estimates the gas for a transaction.
|
|
248
|
-
*/
|
|
253
|
+
/** Estimates the gas required for a transaction. Returns the estimate in wei as a `bigint`. */
|
|
249
254
|
estimateGas(params: {
|
|
250
255
|
from?: string;
|
|
251
256
|
to: string;
|
|
252
257
|
data?: string;
|
|
253
258
|
value?: string;
|
|
254
259
|
}): Promise<bigint>;
|
|
260
|
+
/** Returns a transaction receipt by hash, or `null` if the transaction has not been mined yet. */
|
|
261
|
+
getTransactionReceipt(txHash: string): Promise<Record<string, unknown> | null>;
|
|
255
262
|
/**
|
|
256
|
-
*
|
|
263
|
+
* Polls `eth_getTransactionReceipt` until the transaction is included in a block.
|
|
264
|
+
*
|
|
265
|
+
* @param txHash - The transaction hash to wait for.
|
|
266
|
+
* @param intervalMs - Polling interval in milliseconds (default: 500).
|
|
267
|
+
* @param timeoutMs - Maximum time to wait in milliseconds (default: 60_000).
|
|
268
|
+
* @returns The transaction receipt once mined.
|
|
269
|
+
* @throws If the transaction is not mined within `timeoutMs` or if it reverted (`status == 0x0`).
|
|
257
270
|
*/
|
|
258
|
-
|
|
271
|
+
waitForReceipt(txHash: string, intervalMs?: number, timeoutMs?: number): Promise<Record<string, unknown>>;
|
|
259
272
|
}
|
|
260
273
|
|
|
261
274
|
/** Enriched EVM transaction model for explorer UIs. */
|
|
262
275
|
interface EvmTransaction {
|
|
276
|
+
/** 0x-prefixed transaction hash. */
|
|
263
277
|
hash: string;
|
|
278
|
+
/** Block number in which the transaction was included. */
|
|
264
279
|
blockNumber: number;
|
|
280
|
+
/** 0x-prefixed hash of the containing block. Only present when fetched with block context. */
|
|
265
281
|
blockHash?: string;
|
|
282
|
+
/** Sender address (checksummed or lowercase hex). */
|
|
266
283
|
from: string;
|
|
284
|
+
/** Recipient address, or `null` for contract-creation transactions. */
|
|
267
285
|
to: string | null;
|
|
286
|
+
/** Native token value transferred, as a 0x-prefixed hex string (wei). */
|
|
268
287
|
value: string;
|
|
288
|
+
/** Gas actually consumed by the transaction, as a decimal string. */
|
|
269
289
|
gasUsed: string;
|
|
290
|
+
/** Gas price in wei, as a decimal string. */
|
|
270
291
|
gasPrice: string;
|
|
292
|
+
/** Sender nonce at the time of submission. */
|
|
271
293
|
nonce: number;
|
|
294
|
+
/** ABI-encoded call data (0x-prefixed hex). `'0x'` for plain transfers. */
|
|
272
295
|
input: string;
|
|
296
|
+
/** `1` for success, `0` for revert. */
|
|
273
297
|
status: number;
|
|
298
|
+
/** Deployed contract address for contract-creation transactions; `null` otherwise. */
|
|
274
299
|
contractAddress: string | null;
|
|
300
|
+
/** Unix timestamp (seconds) of the containing block, or `null` if unavailable. */
|
|
275
301
|
timestamp: number | null;
|
|
276
302
|
}
|
|
303
|
+
/** A single EVM event log entry. */
|
|
277
304
|
interface EvmLog {
|
|
305
|
+
/** Address of the contract that emitted the log. */
|
|
278
306
|
address: string;
|
|
307
|
+
/** Indexed event topics; `topics[0]` is the event signature hash. */
|
|
279
308
|
topics: string[];
|
|
309
|
+
/** ABI-encoded non-indexed event data (0x-prefixed hex). */
|
|
280
310
|
data: string;
|
|
311
|
+
/** Block number in which the log was emitted. */
|
|
281
312
|
blockNumber: number;
|
|
313
|
+
/** Hash of the transaction that emitted the log. */
|
|
282
314
|
transactionHash: string;
|
|
315
|
+
/** Position of this log within the block. */
|
|
283
316
|
logIndex: number;
|
|
284
317
|
}
|
|
318
|
+
/** Aggregated on-chain information about an EVM address. */
|
|
285
319
|
interface EvmAddressInfo {
|
|
320
|
+
/** The queried address (as provided, not normalised). */
|
|
286
321
|
address: string;
|
|
322
|
+
/** `true` when the address has deployed bytecode. */
|
|
287
323
|
isContract: boolean;
|
|
324
|
+
/** Native token balance as a 0x-prefixed hex string (wei). */
|
|
288
325
|
balance: string;
|
|
326
|
+
/** Current transaction count (nonce). */
|
|
289
327
|
nonce: number;
|
|
328
|
+
/** Deployed bytecode size in bytes (`0` for EOAs). */
|
|
290
329
|
codeSize: number;
|
|
330
|
+
/** Deployed bytecode (truncated to 100 bytes + ellipsis for display). `'0x'` for EOAs. */
|
|
291
331
|
code: string;
|
|
332
|
+
/** Up to 50 most recent logs emitted by or received by this address. */
|
|
292
333
|
recentLogs: EvmLog[];
|
|
293
334
|
}
|
|
335
|
+
/** EVM block header with transaction hashes (not full tx objects). */
|
|
294
336
|
interface EvmBlock {
|
|
337
|
+
/** 0x-prefixed block hash. */
|
|
295
338
|
hash: string;
|
|
339
|
+
/** Block number. */
|
|
296
340
|
number: number;
|
|
341
|
+
/** Unix timestamp (seconds) from the block header. */
|
|
297
342
|
timestamp: number;
|
|
343
|
+
/** Ordered list of transaction hashes included in the block. */
|
|
298
344
|
transactions: string[];
|
|
345
|
+
/** Actual gas consumed by all transactions, as a decimal string. */
|
|
299
346
|
gasUsed: string;
|
|
347
|
+
/** Block gas limit, as a decimal string. */
|
|
300
348
|
gasLimit: string;
|
|
349
|
+
/** Address of the block author / fee recipient. */
|
|
301
350
|
miner: string;
|
|
351
|
+
/** 0x-prefixed hash of the parent block. */
|
|
302
352
|
parentHash: string;
|
|
303
353
|
}
|
|
354
|
+
/** Lightweight transaction summary used in address and block listing views. */
|
|
304
355
|
interface EvmTxSummary {
|
|
356
|
+
/** 0x-prefixed transaction hash. */
|
|
305
357
|
hash: string;
|
|
358
|
+
/** Block number in which the transaction was included. */
|
|
306
359
|
blockNumber: number;
|
|
360
|
+
/** Unix timestamp (seconds) of the containing block, or `null` if unavailable. */
|
|
307
361
|
timestamp: number | null;
|
|
362
|
+
/** Sender address. */
|
|
308
363
|
from: string;
|
|
364
|
+
/** Recipient address, or `null` for contract-creation transactions. */
|
|
309
365
|
to: string | null;
|
|
366
|
+
/** Native token value transferred, as a 0x-prefixed hex string (wei). */
|
|
310
367
|
value: string;
|
|
368
|
+
/** ABI-encoded call data (0x-prefixed hex). */
|
|
311
369
|
input: string;
|
|
370
|
+
/** Gas actually consumed by the transaction. */
|
|
312
371
|
gasUsed: number;
|
|
372
|
+
/** Gas price in wei, as a 0x-prefixed hex string. */
|
|
313
373
|
gasPrice: string;
|
|
374
|
+
/** `true` when the transaction succeeded (receipt status `0x1`). */
|
|
314
375
|
status: boolean;
|
|
376
|
+
/** `true` when the transaction created a new contract (`to` is `null`). */
|
|
315
377
|
isContractCreation: boolean;
|
|
378
|
+
/** Deployed contract address for contract-creation transactions; `null` otherwise. */
|
|
316
379
|
contractAddress: string | null;
|
|
317
380
|
}
|
|
381
|
+
/** ERC-20 token metadata fetched via ABI calls (`name`, `symbol`, `decimals`, `totalSupply`). */
|
|
318
382
|
interface TokenInfo {
|
|
383
|
+
/** Checksummed contract address (lowercased as returned by the node). */
|
|
319
384
|
address: string;
|
|
385
|
+
/** Token name (decoded from ABI). Empty string when unavailable. */
|
|
320
386
|
name: string;
|
|
387
|
+
/** Token symbol (decoded from ABI). Empty string when unavailable. */
|
|
321
388
|
symbol: string;
|
|
389
|
+
/** Number of decimal places. Defaults to `18` when not readable from the contract. */
|
|
322
390
|
decimals: number;
|
|
391
|
+
/** Total supply as a 0x-prefixed hex string. */
|
|
323
392
|
totalSupply: string;
|
|
393
|
+
/** `true` when the contract exposes a non-zero `totalSupply`, `symbol`, and `decimals`. */
|
|
324
394
|
isErc20: boolean;
|
|
325
395
|
}
|
|
396
|
+
/** A single ERC-20 `Transfer` event decoded from an EVM log. */
|
|
326
397
|
interface TokenTransfer {
|
|
398
|
+
/** Hash of the transaction that emitted the transfer event. */
|
|
327
399
|
transactionHash: string;
|
|
400
|
+
/** Block number in which the transfer was included. */
|
|
328
401
|
blockNumber: number;
|
|
402
|
+
/** Sender address (decoded from `topics[1]`). */
|
|
329
403
|
from: string;
|
|
404
|
+
/** Recipient address (decoded from `topics[2]`). */
|
|
330
405
|
to: string;
|
|
406
|
+
/** Transferred amount as a 0x-prefixed hex string (raw `data` field). */
|
|
331
407
|
value: string;
|
|
408
|
+
/** Position of the log within the block. */
|
|
332
409
|
logIndex: number;
|
|
333
410
|
}
|
|
334
411
|
|
|
@@ -338,25 +415,60 @@ interface TokenTransfer {
|
|
|
338
415
|
*/
|
|
339
416
|
declare class EvmExplorer {
|
|
340
417
|
private readonly evm;
|
|
418
|
+
/** @param evm - Underlying `EvmClient` used for all RPC calls. */
|
|
341
419
|
constructor(evm: EvmClient);
|
|
420
|
+
/** Returns the `count` most recent blocks in descending order (latest first). */
|
|
342
421
|
getLatestBlocks(count?: number): Promise<EvmBlock[]>;
|
|
422
|
+
/** Returns a single block by number or hash, or `null` if not found. */
|
|
343
423
|
getBlock(hashOrNumber: string | number): Promise<EvmBlock | null>;
|
|
424
|
+
/** Returns all transactions in a block (with receipts), or `[]` if the block is not found. */
|
|
344
425
|
getBlockTransactions(hashOrNumber: string | number): Promise<EvmTransaction[]>;
|
|
426
|
+
/** Returns a single transaction with its receipt, or `null` if not found. */
|
|
345
427
|
getTransaction(hash: string): Promise<EvmTransaction | null>;
|
|
428
|
+
/**
|
|
429
|
+
* Returns lightweight summaries of all transactions sent from or to `address`
|
|
430
|
+
* within the last `maxBlocks` blocks, sorted by block number descending.
|
|
431
|
+
*/
|
|
346
432
|
getTransactionsByAddress(address: string, maxBlocks?: number): Promise<EvmTxSummary[]>;
|
|
433
|
+
/**
|
|
434
|
+
* Returns aggregated on-chain data for an EVM address: balance, nonce,
|
|
435
|
+
* bytecode (truncated), and up to 50 recent logs from the last 5 000 blocks.
|
|
436
|
+
*/
|
|
347
437
|
getAddressInfo(address: string): Promise<EvmAddressInfo>;
|
|
438
|
+
/** Returns the native token balance of `address`, formatted as a decimal string (no symbol). */
|
|
348
439
|
getBalance(address: string): Promise<string>;
|
|
440
|
+
/** Returns the current transaction count (nonce) for `address`, or `0` on error. */
|
|
349
441
|
getNonce(address: string): Promise<number>;
|
|
442
|
+
/** Returns `true` when `address` has non-empty deployed bytecode. */
|
|
350
443
|
getIsContract(address: string): Promise<boolean>;
|
|
444
|
+
/**
|
|
445
|
+
* Fetches ERC-20 metadata for a token contract via ABI calls.
|
|
446
|
+
* Returns `null` when the address does not look like an ERC-20 token.
|
|
447
|
+
*/
|
|
351
448
|
getTokenInfo(address: string): Promise<TokenInfo | null>;
|
|
449
|
+
/**
|
|
450
|
+
* Returns ERC-20 `Transfer` events for `address` from the last 5 000 blocks.
|
|
451
|
+
* When `holderAddress` is provided, restricts results to transfers sent or received by that address.
|
|
452
|
+
*/
|
|
352
453
|
getTokenTransfers(address: string, holderAddress?: string): Promise<TokenTransfer[]>;
|
|
454
|
+
/** Returns the raw ERC-20 balance of `holderAddress` for the token at `tokenAddress` (0x-prefixed hex). */
|
|
353
455
|
getTokenBalance(tokenAddress: string, holderAddress: string): Promise<string>;
|
|
456
|
+
/** Maps a raw RPC block object to the public `EvmBlock` shape. */
|
|
354
457
|
private parseBlock;
|
|
458
|
+
/** Maps a raw RPC transaction + optional receipt to the public `EvmTransaction` shape. */
|
|
355
459
|
private parseTx;
|
|
460
|
+
/**
|
|
461
|
+
* Fetches a raw block by number or hash. Accepts a plain integer, a decimal string,
|
|
462
|
+
* or a 0x-prefixed hash. Returns `null` on any RPC error.
|
|
463
|
+
*/
|
|
356
464
|
private fetchBlock;
|
|
465
|
+
/** Executes a read-only `eth_call` and returns the raw hex result, or `null` on error. */
|
|
357
466
|
private ethCall;
|
|
467
|
+
/** Decodes an ABI-encoded `string` return value from a raw 0x-prefixed hex string. */
|
|
358
468
|
private static decodeAbiString;
|
|
469
|
+
/** Decodes an ABI-encoded `uint256` return value to a `bigint`. */
|
|
359
470
|
private static decodeAbiUint;
|
|
471
|
+
/** Converts a 0x-prefixed hex number to its decimal string representation. Returns `'0'` on parse error. */
|
|
360
472
|
private static hexToDecimalStr;
|
|
361
473
|
}
|
|
362
474
|
|
|
@@ -398,18 +510,12 @@ interface SpentNullifier {
|
|
|
398
510
|
txType: 'unshield' | 'private_transfer';
|
|
399
511
|
timestampMs: number | null;
|
|
400
512
|
}
|
|
401
|
-
/**
|
|
402
|
-
interface
|
|
403
|
-
/** "{blockNumber}-{extrinsicIndex}" */
|
|
404
|
-
id: string;
|
|
513
|
+
/** Temporal metadata for a private transfer. No graph data (inputs ↔ outputs) exposed. */
|
|
514
|
+
interface PrivateTransferTimestamp {
|
|
405
515
|
blockNumber: number;
|
|
406
516
|
extrinsicIndex: number | null;
|
|
407
|
-
/**
|
|
408
|
-
|
|
409
|
-
/** JSON-encoded array of commitment hex strings. */
|
|
410
|
-
outputCommitmentsJson: string;
|
|
411
|
-
/** JSON-encoded array of leaf index numbers. */
|
|
412
|
-
leafIndicesJson: string;
|
|
517
|
+
/** Blake2-256 hash of the raw extrinsic, 0x-prefixed. Null if the extrinsic was not decoded. */
|
|
518
|
+
hash: string | null;
|
|
413
519
|
timestampMs: number | null;
|
|
414
520
|
}
|
|
415
521
|
/** An unshield event stored by the indexer. */
|
|
@@ -418,6 +524,8 @@ interface Unshield {
|
|
|
418
524
|
id: string;
|
|
419
525
|
blockNumber: number;
|
|
420
526
|
extrinsicIndex: number | null;
|
|
527
|
+
/** Blake2-256 hash of the raw extrinsic, 0x-prefixed. Null if the extrinsic was not decoded. */
|
|
528
|
+
hash: string | null;
|
|
421
529
|
nullifierHex: string;
|
|
422
530
|
/** Asset ID as decimal string. */
|
|
423
531
|
assetId: string;
|
|
@@ -525,7 +633,24 @@ type ShieldedAddressEvent = ({
|
|
|
525
633
|
kind: 'unshield';
|
|
526
634
|
} & Unshield) | ({
|
|
527
635
|
kind: 'transfer';
|
|
528
|
-
} &
|
|
636
|
+
} & PrivateTransferTimestamp);
|
|
637
|
+
/**
|
|
638
|
+
* Lightweight hint returned by the stealth scan endpoint.
|
|
639
|
+
* Contains only the fields required for a wallet to:
|
|
640
|
+
* 1. Compute ECDH shared secret: ephPkHex × ivsk
|
|
641
|
+
* 2. Attempt ChaCha20-Poly1305 decryption of encryptedMemo
|
|
642
|
+
* Ordered ascending by leafIndex for incremental cursor compatibility.
|
|
643
|
+
*/
|
|
644
|
+
interface StealthScanHint {
|
|
645
|
+
leafIndex: number;
|
|
646
|
+
commitmentHex: string;
|
|
647
|
+
/** Asset ID as decimal string (e.g. "0"). */
|
|
648
|
+
assetId: string;
|
|
649
|
+
/** Ephemeral public key (last 32 bytes of encrypted_memo), 0x-prefixed. null if memo absent. */
|
|
650
|
+
ephPkHex: string | null;
|
|
651
|
+
/** Full 168-byte encrypted memo (0x-prefixed hex). null if not present. */
|
|
652
|
+
encryptedMemo: string | null;
|
|
653
|
+
}
|
|
529
654
|
|
|
530
655
|
/**
|
|
531
656
|
* HTTP client for the Orbinum indexer REST API.
|
|
@@ -539,6 +664,7 @@ declare class IndexerClient {
|
|
|
539
664
|
constructor(config: IndexerClientConfig);
|
|
540
665
|
private _fetchResponse;
|
|
541
666
|
private get;
|
|
667
|
+
private post;
|
|
542
668
|
private getOrNull;
|
|
543
669
|
private buildQuery;
|
|
544
670
|
/** Returns the total count of shielded commitments. */
|
|
@@ -551,6 +677,18 @@ declare class IndexerClient {
|
|
|
551
677
|
}): Promise<PaginatedResult<ShieldedCommitment>>;
|
|
552
678
|
/** Returns a single commitment by its hex string, or null if not found. */
|
|
553
679
|
getCommitmentByHex(hex: string): Promise<ShieldedCommitment | null>;
|
|
680
|
+
/**
|
|
681
|
+
* Returns a paginated list of stealth scan hints ordered ascending by leafIndex.
|
|
682
|
+
* Each hint contains only the fields required for ECDH triage and decryption:
|
|
683
|
+
* leafIndex, commitmentHex, assetId, ephPkHex, encryptedMemo.
|
|
684
|
+
*
|
|
685
|
+
* Use `sinceLeafIndex` for incremental scans (cursor = last seen leafIndex + 1).
|
|
686
|
+
*/
|
|
687
|
+
getScanHints(params?: {
|
|
688
|
+
page?: number;
|
|
689
|
+
limit?: number;
|
|
690
|
+
sinceLeafIndex?: number;
|
|
691
|
+
}): Promise<PaginatedResult<StealthScanHint>>;
|
|
554
692
|
/** Returns a paginated list of spent nullifiers. */
|
|
555
693
|
getNullifiers(params?: {
|
|
556
694
|
page?: number;
|
|
@@ -558,11 +696,26 @@ declare class IndexerClient {
|
|
|
558
696
|
}): Promise<PaginatedResult<SpentNullifier>>;
|
|
559
697
|
/** Returns the spent/unspent status of a nullifier. */
|
|
560
698
|
getNullifierStatus(hex: string): Promise<NullifierStatusResult>;
|
|
561
|
-
/**
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
699
|
+
/**
|
|
700
|
+
* Batch-checks which of the given nullifiers are spent.
|
|
701
|
+
* Returns only the nullifiers that exist in the spent set.
|
|
702
|
+
* Accepts up to 100 nullifiers (0x-prefixed hex).
|
|
703
|
+
*/
|
|
704
|
+
getNullifiersBatch(nullifiers: string[]): Promise<SpentNullifier[]>;
|
|
705
|
+
/**
|
|
706
|
+
* Returns temporal metadata for private transfers that spent any of the given nullifiers.
|
|
707
|
+
* Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
|
|
708
|
+
* between inputs and outputs to prevent graph reconstruction.
|
|
709
|
+
* Accepts up to 50 nullifiers (0x-prefixed hex).
|
|
710
|
+
*/
|
|
711
|
+
getTransfersByNullifiers(nullifiers: string[]): Promise<PrivateTransferTimestamp[]>;
|
|
712
|
+
/**
|
|
713
|
+
* Returns temporal metadata for private transfers that produced any of the given commitments.
|
|
714
|
+
* Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
|
|
715
|
+
* between outputs and inputs to prevent graph reconstruction.
|
|
716
|
+
* Accepts up to 50 commitments (0x-prefixed hex).
|
|
717
|
+
*/
|
|
718
|
+
getTransfersByCommitments(commitments: string[]): Promise<PrivateTransferTimestamp[]>;
|
|
566
719
|
/** Returns a paginated list of unshield events. */
|
|
567
720
|
getUnshields(params?: {
|
|
568
721
|
page?: number;
|
|
@@ -601,6 +754,14 @@ declare class IndexerClient {
|
|
|
601
754
|
page?: number;
|
|
602
755
|
limit?: number;
|
|
603
756
|
}): Promise<PaginatedResult<ShieldedCommitment>>;
|
|
757
|
+
/**
|
|
758
|
+
* Returns a paginated list of unshield events where the given address is the recipient.
|
|
759
|
+
* Accepts a 0x-prefixed EVM address or an SS58 Substrate address.
|
|
760
|
+
*/
|
|
761
|
+
getAddressUnshields(address: string, params?: {
|
|
762
|
+
page?: number;
|
|
763
|
+
limit?: number;
|
|
764
|
+
}): Promise<PaginatedResult<Unshield>>;
|
|
604
765
|
/**
|
|
605
766
|
* Returns a paginated list of all shielded activity (commitments, unshields,
|
|
606
767
|
* private transfers) associated with the given address.
|
|
@@ -616,26 +777,35 @@ declare class IndexerClient {
|
|
|
616
777
|
isHealthy(): Promise<boolean>;
|
|
617
778
|
}
|
|
618
779
|
|
|
780
|
+
/** Configuration passed to `OrbinumClient.connect()`. */
|
|
619
781
|
type OrbinumClientConfig = {
|
|
620
|
-
/** WebSocket URL of the Orbinum node (e.g. "ws://localhost:9944") */
|
|
782
|
+
/** WebSocket URL of the Orbinum Substrate node (e.g. `"ws://localhost:9944"`). */
|
|
621
783
|
substrateWs: string;
|
|
622
|
-
/** HTTP URL of the EVM JSON-RPC endpoint (e.g. "http://localhost:9933") */
|
|
784
|
+
/** HTTP URL of the EVM JSON-RPC endpoint (e.g. `"http://localhost:9933"`). Omit to disable EVM support. */
|
|
623
785
|
evmRpc?: string;
|
|
624
|
-
/** Base URL of the Orbinum indexer REST API (e.g. "https://indexer.orbinum.io") */
|
|
786
|
+
/** Base URL of the Orbinum indexer REST API (e.g. `"https://indexer.orbinum.io"`). Omit to disable indexer support. */
|
|
625
787
|
indexerUrl?: string;
|
|
626
|
-
/**
|
|
788
|
+
/** Timeout for the initial WebSocket handshake in milliseconds. Default: `15_000`. */
|
|
627
789
|
connectTimeoutMs?: number;
|
|
628
790
|
};
|
|
791
|
+
/** Result returned by extrinsic-submitting methods (shield, unshield, transfer, …). */
|
|
629
792
|
type TxResult = {
|
|
793
|
+
/** 0x-prefixed hash of the submitted extrinsic. */
|
|
630
794
|
txHash: string;
|
|
795
|
+
/** 0x-prefixed hash of the block that included the extrinsic. */
|
|
631
796
|
blockHash: string;
|
|
797
|
+
/** Number of the block that included the extrinsic. */
|
|
632
798
|
blockNumber: number;
|
|
633
|
-
/**
|
|
799
|
+
/** `true` when the extrinsic succeeded (no `ExtrinsicFailed` event emitted). */
|
|
634
800
|
ok: boolean;
|
|
635
|
-
/** Dispatch error type string when ok
|
|
801
|
+
/** Dispatch error type string. Only present when `ok` is `false`. */
|
|
636
802
|
error?: string;
|
|
637
803
|
};
|
|
638
804
|
|
|
805
|
+
/** Opciones de transacción compatibles con el UnsafeApi de PAPI (sin asset tipado). */
|
|
806
|
+
type UnsafeTxOptions = TxOptions<void, Record<string, unknown>>;
|
|
807
|
+
declare function toTxResult(payload: TxFinalizedPayload): TxResult;
|
|
808
|
+
|
|
639
809
|
type MerkleTreeInfo = {
|
|
640
810
|
root: string;
|
|
641
811
|
treeSize: number;
|
|
@@ -651,14 +821,16 @@ type DecryptedMemo = {
|
|
|
651
821
|
ownerPk: bigint;
|
|
652
822
|
blinding: bigint;
|
|
653
823
|
assetId: bigint;
|
|
824
|
+
/** Counterparty BabyJubJub Ax coordinate. Zero for shield/unshield notes. */
|
|
825
|
+
counterpartyPk: bigint;
|
|
654
826
|
};
|
|
655
827
|
type ShieldParams = {
|
|
656
828
|
assetId: number;
|
|
657
829
|
amount: bigint;
|
|
658
830
|
/** 0x-prefixed 32-byte commitment hex */
|
|
659
831
|
commitment: string;
|
|
660
|
-
/**
|
|
661
|
-
encryptedMemo
|
|
832
|
+
/** Encrypted memo bytes (168 bytes). Required — notes without valid memos are irrecoverable. */
|
|
833
|
+
encryptedMemo: Uint8Array;
|
|
662
834
|
};
|
|
663
835
|
type UnshieldParams = {
|
|
664
836
|
/** ZK proof bytes */
|
|
@@ -668,9 +840,24 @@ type UnshieldParams = {
|
|
|
668
840
|
/** 0x-prefixed nullifier hex */
|
|
669
841
|
nullifier: string;
|
|
670
842
|
assetId: number;
|
|
843
|
+
/** Net amount recipient receives (planck) */
|
|
671
844
|
amount: bigint;
|
|
672
845
|
/** SS58 or 0x-prefixed 32-byte address */
|
|
673
846
|
recipientAddress: string;
|
|
847
|
+
/** Gasless fee in planck (default 0n; note_value == amount + fee + changeValue in circuit) */
|
|
848
|
+
fee?: bigint;
|
|
849
|
+
/**
|
|
850
|
+
* 0x-prefixed 32-byte change note commitment hex.
|
|
851
|
+
* Pass the value returned by generateUnshieldProof().changeCommitment (converted to hex).
|
|
852
|
+
* Omit or use all-zero hex for total unshield (no change note).
|
|
853
|
+
*/
|
|
854
|
+
changeCommitment?: string;
|
|
855
|
+
/**
|
|
856
|
+
* Encrypted memo for the change note (176 bytes).
|
|
857
|
+
* Required for partial unshield so the change note can be recovered via blockchain scan.
|
|
858
|
+
* Omit for total unshield.
|
|
859
|
+
*/
|
|
860
|
+
changeEncryptedMemo?: Uint8Array;
|
|
674
861
|
};
|
|
675
862
|
type PrivateTransferInput = {
|
|
676
863
|
/** 0x-prefixed nullifier hex */
|
|
@@ -681,7 +868,8 @@ type PrivateTransferInput = {
|
|
|
681
868
|
type PrivateTransferOutput = {
|
|
682
869
|
/** 0x-prefixed commitment hex */
|
|
683
870
|
commitment: string;
|
|
684
|
-
|
|
871
|
+
/** Encrypted memo bytes (168 bytes). Required — notes without valid memos are irrecoverable. */
|
|
872
|
+
encryptedMemo: Uint8Array;
|
|
685
873
|
};
|
|
686
874
|
type PrivateTransferParams = {
|
|
687
875
|
inputs: PrivateTransferInput[];
|
|
@@ -690,6 +878,11 @@ type PrivateTransferParams = {
|
|
|
690
878
|
proof: Uint8Array;
|
|
691
879
|
/** 0x-prefixed merkle root hex */
|
|
692
880
|
merkleRoot: string;
|
|
881
|
+
/** Asset ID being transferred (public input of the proof) */
|
|
882
|
+
assetId: number;
|
|
883
|
+
/** Gasless fee in planck (default 0n; input_sum == output_sum + fee in circuit).
|
|
884
|
+
* The fee is paid to the block author (validator) by the pallet runtime. */
|
|
885
|
+
fee?: bigint;
|
|
693
886
|
};
|
|
694
887
|
/** Input params for NoteBuilder.build(). All fields except value have defaults. */
|
|
695
888
|
type NoteInput = {
|
|
@@ -704,11 +897,20 @@ type NoteInput = {
|
|
|
704
897
|
/** Secret spending key used to derive the nullifier. Default 0n. */
|
|
705
898
|
spendingKey?: bigint;
|
|
706
899
|
/**
|
|
707
|
-
* 32-byte
|
|
708
|
-
* When provided, NoteBuilder.build() will auto-generate the
|
|
900
|
+
* 32-byte LE-encoded packed BJJ viewing public key of the recipient (from their privacy address).
|
|
901
|
+
* When provided, NoteBuilder.build() will auto-generate the 168-byte ECDH-encrypted memo.
|
|
709
902
|
* Omit to skip memo generation (use buildMemo() separately if needed).
|
|
710
903
|
*/
|
|
711
|
-
|
|
904
|
+
viewingPublicKey?: Uint8Array;
|
|
905
|
+
/**
|
|
906
|
+
* BabyJubJub Ax coordinate of the recipient (from their privacy address).
|
|
907
|
+
* Required together with viewingPublicKey to enable stealth address derivation:
|
|
908
|
+
* the commitment will use stealthOwnerPk instead of ownerPk, making each
|
|
909
|
+
* transaction unlinkable even when the same privacy address is reused.
|
|
910
|
+
*/
|
|
911
|
+
recipientOwnerPk?: bigint;
|
|
912
|
+
/** Counterparty BabyJubJub Ax coordinate. Zero for shield/unshield notes. Default 0n. */
|
|
913
|
+
counterpartyPk?: bigint;
|
|
712
914
|
};
|
|
713
915
|
/**
|
|
714
916
|
* Computed ZK note (commitment + nullifier). Built entirely off-chain.
|
|
@@ -735,15 +937,12 @@ type ZkNote = {
|
|
|
735
937
|
/** 0x-prefixed 32-byte little-endian hex nullifier. */
|
|
736
938
|
nullifierHex: string;
|
|
737
939
|
/**
|
|
738
|
-
*
|
|
739
|
-
* Always populated: uses a dummy memo when no
|
|
940
|
+
* 168-byte encrypted memo (ChaCha20-Poly1305 ECDH) as number[] for SCALE encoding.
|
|
941
|
+
* Always populated: uses a dummy memo when no viewingPublicKey is provided.
|
|
740
942
|
*/
|
|
741
943
|
memo: number[];
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
type ShieldResult = {
|
|
745
|
-
txResult: TxResult;
|
|
746
|
-
note: ZkNote;
|
|
944
|
+
/** Counterparty BabyJubJub Ax coordinate. Zero for shield/unshield notes. */
|
|
945
|
+
counterpartyPk: bigint;
|
|
747
946
|
};
|
|
748
947
|
/** Parameters for a single item in a shield_batch extrinsic. */
|
|
749
948
|
type ShieldBatchItem = {
|
|
@@ -751,144 +950,542 @@ type ShieldBatchItem = {
|
|
|
751
950
|
amount: bigint;
|
|
752
951
|
/** 0x-prefixed 32-byte commitment hex */
|
|
753
952
|
commitment: string;
|
|
754
|
-
/**
|
|
755
|
-
encryptedMemo
|
|
953
|
+
/** Encrypted memo bytes (168 bytes). Required — notes without valid memos are irrecoverable. */
|
|
954
|
+
encryptedMemo: Uint8Array;
|
|
756
955
|
};
|
|
757
956
|
/** Parameters for shieldedPool.shieldBatch — deposits up to 20 notes in one extrinsic. */
|
|
758
957
|
type ShieldBatchParams = {
|
|
759
958
|
items: ShieldBatchItem[];
|
|
760
959
|
};
|
|
761
|
-
|
|
762
960
|
/**
|
|
763
|
-
*
|
|
961
|
+
* Parameters for shieldedPool.claimShieldedFees —
|
|
962
|
+
* claims accrued relay fees into the shielded pool.
|
|
764
963
|
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* Signing is delegated to a PolkadotSigner (see polkadot-api/signer).
|
|
768
|
-
*
|
|
769
|
-
* Parameter order matches the Orbinum runtime extrinsics exactly.
|
|
964
|
+
* The relayer must supply a ZK disclosure proof that binds the commitment to the
|
|
965
|
+
* exact amount and asset_id, preventing fee inflation attacks.
|
|
770
966
|
*/
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
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
|
-
}
|
|
967
|
+
type ClaimShieldedFeesParams = {
|
|
968
|
+
/** 0x-prefixed 32-byte commitment hex (Poseidon of value, assetId, ownerPk, blinding) */
|
|
969
|
+
commitment: string;
|
|
970
|
+
/** Amount to claim in planck (must match the circuit's public input) */
|
|
971
|
+
amount: bigint;
|
|
972
|
+
/** Asset ID being claimed */
|
|
973
|
+
assetId: number;
|
|
974
|
+
/** 128-byte Groth16 proof bytes */
|
|
975
|
+
proof: Uint8Array;
|
|
976
|
+
/** 76-byte public signals buffer (commitment || amount_u64_le || assetId_u32_le || owner_hash) */
|
|
977
|
+
publicSignals: Uint8Array;
|
|
978
|
+
/** Encrypted memo bytes (168 bytes). Required — notes without valid memos are irrecoverable. */
|
|
979
|
+
encryptedMemo: Uint8Array;
|
|
980
|
+
};
|
|
814
981
|
|
|
815
982
|
/**
|
|
816
|
-
*
|
|
817
|
-
*
|
|
983
|
+
* TypeScript types for pallet-shielded-pool extrinsics and supporting structures.
|
|
984
|
+
*
|
|
985
|
+
* Conventions:
|
|
986
|
+
* - Fixed/bounded byte arrays → `number[]` (SCALE-compatible)
|
|
987
|
+
* - Balances (u128) → `bigint`
|
|
988
|
+
* - AccountId → `string` (SS58 or 0x-prefixed 64-char hex)
|
|
989
|
+
* - Block numbers → `number`
|
|
990
|
+
* - Optional fields → `T | null`
|
|
818
991
|
*/
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
992
|
+
/**
|
|
993
|
+
* 32-byte SCALE-encoded value (commitment, nullifier, Merkle root, etc.).
|
|
994
|
+
* Stored as little-endian Poseidon field elements on-chain.
|
|
995
|
+
*/
|
|
996
|
+
type Bytes32 = number[];
|
|
997
|
+
/**
|
|
998
|
+
* 176-byte encrypted memo (ChaCha20-Poly1305 ECDH).
|
|
999
|
+
* Layout: nonce(12) || ciphertext(132) || tag(16) || ephPk(32) = 176 bytes.
|
|
1000
|
+
*/
|
|
1001
|
+
type Bytes176 = number[];
|
|
1002
|
+
/**
|
|
1003
|
+
* Disclosure public signals — exactly 256 bytes (ECDH Baby Jubjub layout):
|
|
1004
|
+
* commitment[0..32] | auditor_pk_x[32..64] | auditor_pk_y[64..96]
|
|
1005
|
+
* | epk_x[96..128] | epk_y[128..160] | enc_value[160..192]
|
|
1006
|
+
* | enc_asset_id[192..224] | enc_owner_hash[224..256]
|
|
1007
|
+
*/
|
|
1008
|
+
type DisclosurePublicSignals = number[];
|
|
1009
|
+
/**
|
|
1010
|
+
* ECDH-encrypted note fields stored on-chain after a successful disclosure.
|
|
1011
|
+
* Maps to `EncryptedDisclosureSignals` in Rust.
|
|
1012
|
+
*/
|
|
1013
|
+
type EncryptedDisclosureSignals = {
|
|
1014
|
+
/** Ephemeral public key x-coordinate (Baby Jubjub), 32 bytes LE. */
|
|
1015
|
+
epkX: number[];
|
|
1016
|
+
/** Ephemeral public key y-coordinate (Baby Jubjub), 32 bytes LE. */
|
|
1017
|
+
epkY: number[];
|
|
1018
|
+
/** Encrypted note value (field element LE). 0 if not disclosed. */
|
|
1019
|
+
encValue: number[];
|
|
1020
|
+
/** Encrypted asset ID (field element LE). 0 if not disclosed. */
|
|
1021
|
+
encAssetId: number[];
|
|
1022
|
+
/** Encrypted Poseidon(owner_pubkey) (field element LE). 0 if not disclosed. */
|
|
1023
|
+
encOwnerHash: number[];
|
|
822
1024
|
};
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1025
|
+
/**
|
|
1026
|
+
* Bitmap of which note fields the auditor requires to be disclosed.
|
|
1027
|
+
* Maps to `DisclosureFieldMask` in Rust.
|
|
1028
|
+
*/
|
|
1029
|
+
type DisclosureFieldMask = {
|
|
1030
|
+
/** Must disclose the note value (amount in planck). */
|
|
1031
|
+
value: boolean;
|
|
1032
|
+
/** Must disclose the asset ID. */
|
|
1033
|
+
assetId: boolean;
|
|
1034
|
+
/** Must disclose Poseidon(owner_pubkey). */
|
|
1035
|
+
owner: boolean;
|
|
828
1036
|
};
|
|
829
|
-
/**
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
1037
|
+
/**
|
|
1038
|
+
* A single auditor entry in an audit policy.
|
|
1039
|
+
* Maps to `Auditor<AccountId>` in Rust.
|
|
1040
|
+
*/
|
|
1041
|
+
type Auditor = {
|
|
1042
|
+
/** SS58 or 0x-prefixed AccountId of the authorized auditor. */
|
|
1043
|
+
account: string;
|
|
833
1044
|
};
|
|
834
|
-
/**
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1045
|
+
/**
|
|
1046
|
+
* A condition that must be satisfied before disclosure is permitted.
|
|
1047
|
+
* Maps to `DisclosureCondition` in Rust. Max 10 conditions per policy.
|
|
1048
|
+
* Evaluation is OR — a single satisfied condition is enough.
|
|
1049
|
+
*/
|
|
1050
|
+
type DisclosureCondition = {
|
|
1051
|
+
type: 'Always';
|
|
1052
|
+
} | {
|
|
1053
|
+
type: 'TimeDelay';
|
|
1054
|
+
afterBlock: number;
|
|
1055
|
+
} | {
|
|
1056
|
+
type: 'AmountThreshold';
|
|
1057
|
+
minAmount: bigint;
|
|
839
1058
|
};
|
|
840
|
-
/**
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
1059
|
+
/**
|
|
1060
|
+
* A single entry in a batch disclosure proof submission.
|
|
1061
|
+
* Maps to `BatchDisclosureSubmission<AccountId>` in Rust.
|
|
1062
|
+
*/
|
|
1063
|
+
type BatchDisclosureSubmission = {
|
|
1064
|
+
/** 32-byte commitment (LE). */
|
|
1065
|
+
commitment: Bytes32;
|
|
1066
|
+
/** Groth16 proof bytes — max 256 bytes. */
|
|
1067
|
+
proof: number[];
|
|
1068
|
+
/** 76-byte public signals: commitment(32) | value(8) | asset_id(4) | owner_hash(32). */
|
|
1069
|
+
publicSignals: DisclosurePublicSignals;
|
|
1070
|
+
/** Optional auditor AccountId. Null = voluntary disclosure. */
|
|
1071
|
+
auditor: string | null;
|
|
847
1072
|
};
|
|
848
1073
|
/**
|
|
849
|
-
*
|
|
850
|
-
* Returned by `accountMapping_getFullIdentity` (alias-based lookup).
|
|
1074
|
+
* A single shield operation for use in `shield_batch`.
|
|
851
1075
|
*/
|
|
852
|
-
type
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1076
|
+
type ShieldOperation = {
|
|
1077
|
+
assetId: number;
|
|
1078
|
+
amount: bigint;
|
|
1079
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
1080
|
+
commitment: Bytes32;
|
|
1081
|
+
/** Encrypted memo bytes — exactly 104 bytes. */
|
|
1082
|
+
encryptedMemo: number[];
|
|
857
1083
|
};
|
|
858
|
-
/**
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
1084
|
+
/**
|
|
1085
|
+
* Call index 0 — `shield` (Signed origin)
|
|
1086
|
+
* Deposits a public token amount into the shielded pool.
|
|
1087
|
+
*/
|
|
1088
|
+
type ShieldArgs = {
|
|
1089
|
+
assetId: number;
|
|
1090
|
+
amount: bigint;
|
|
1091
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
1092
|
+
commitment: Bytes32;
|
|
1093
|
+
/** Encrypted memo — exactly 104 bytes. */
|
|
1094
|
+
encryptedMemo: number[];
|
|
864
1095
|
};
|
|
865
|
-
/**
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1096
|
+
/**
|
|
1097
|
+
* Call index 12 — `shield_batch` (Signed origin)
|
|
1098
|
+
* Deposits multiple notes in a single extrinsic — max 20 operations.
|
|
1099
|
+
*/
|
|
1100
|
+
type ShieldBatchArgs = {
|
|
1101
|
+
operations: ShieldOperation[];
|
|
869
1102
|
};
|
|
870
|
-
/**
|
|
871
|
-
type
|
|
872
|
-
|
|
873
|
-
|
|
1103
|
+
/** Input note consumed by a private transfer (SCALE wire format). */
|
|
1104
|
+
type RawTransferInput = {
|
|
1105
|
+
/** 32-byte Poseidon nullifier (LE). */
|
|
1106
|
+
nullifier: Bytes32;
|
|
1107
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
1108
|
+
commitment: Bytes32;
|
|
874
1109
|
};
|
|
875
|
-
/**
|
|
876
|
-
type
|
|
877
|
-
/**
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
|
|
881
|
-
/** Signature over the caller's AccountId32 (64 bytes for Ed25519, 65 for EIP-191). */
|
|
882
|
-
signature: Uint8Array;
|
|
1110
|
+
/** Output note created by a private transfer (SCALE wire format). */
|
|
1111
|
+
type RawTransferOutput = {
|
|
1112
|
+
/** 32-byte Poseidon commitment (LE). */
|
|
1113
|
+
commitment: Bytes32;
|
|
1114
|
+
/** Encrypted memo — exactly 104 bytes. */
|
|
1115
|
+
memo: number[];
|
|
883
1116
|
};
|
|
884
|
-
/**
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1117
|
+
/**
|
|
1118
|
+
* Call index 1 — `private_transfer` (Unsigned/gasless origin)
|
|
1119
|
+
* Transfers value between notes without revealing sender, recipient or amount.
|
|
1120
|
+
* Fee is embedded in the ZK proof: input_sum == output_sum + fee.
|
|
1121
|
+
* The fee is paid to the block author (validator) by the pallet runtime.
|
|
1122
|
+
*/
|
|
1123
|
+
type PrivateTransferArgs = {
|
|
1124
|
+
/** Groth16 proof bytes — max 512 bytes. */
|
|
1125
|
+
proof: number[];
|
|
1126
|
+
/** 32-byte Merkle root (LE). */
|
|
1127
|
+
merkleRoot: Bytes32;
|
|
1128
|
+
nullifiers: RawTransferInput[];
|
|
1129
|
+
outputs: RawTransferOutput[];
|
|
1130
|
+
encryptedMemos: number[][];
|
|
1131
|
+
/** Asset ID being transferred (public input of the proof). */
|
|
1132
|
+
assetId: number;
|
|
1133
|
+
/** Gasless fee in planck. Paid to the block author (validator). */
|
|
1134
|
+
fee: bigint;
|
|
889
1135
|
};
|
|
890
|
-
/**
|
|
891
|
-
|
|
1136
|
+
/**
|
|
1137
|
+
* Call index 2 — `unshield` (Unsigned/gasless origin)
|
|
1138
|
+
* Withdraws a note from the pool to a public account.
|
|
1139
|
+
* Fee is embedded in the ZK proof: note_value == amount + fee + changeValue.
|
|
1140
|
+
*/
|
|
1141
|
+
type UnshieldArgs = {
|
|
1142
|
+
/** Groth16 proof bytes — max 512 bytes. */
|
|
1143
|
+
proof: number[];
|
|
1144
|
+
/** 32-byte Merkle root (LE). */
|
|
1145
|
+
merkleRoot: Bytes32;
|
|
1146
|
+
/** 32-byte nullifier of the spent note (LE). */
|
|
1147
|
+
nullifier: Bytes32;
|
|
1148
|
+
assetId: number;
|
|
1149
|
+
/** Net amount recipient receives (planck). */
|
|
1150
|
+
amount: bigint;
|
|
1151
|
+
/** SS58 or 0x-prefixed AccountId of the recipient. */
|
|
1152
|
+
recipient: string;
|
|
1153
|
+
/** Gasless fee in planck. */
|
|
1154
|
+
fee: bigint;
|
|
1155
|
+
/**
|
|
1156
|
+
* 32-byte change note commitment (LE). All zeros for total unshield.
|
|
1157
|
+
* Must equal NoteCommitment(changeValue, assetId, changeOwnerPk, changeBlinding)
|
|
1158
|
+
* when changeValue > 0 — enforced by the ZK circuit.
|
|
1159
|
+
*/
|
|
1160
|
+
changeCommitment: Bytes32;
|
|
1161
|
+
/**
|
|
1162
|
+
* Encrypted memo for the change note (176 bytes, empty for total unshield).
|
|
1163
|
+
* Enables note recovery via blockchain scan for partial unshield.
|
|
1164
|
+
*/
|
|
1165
|
+
changeEncryptedMemo?: Bytes176;
|
|
1166
|
+
};
|
|
1167
|
+
/**
|
|
1168
|
+
* Call index 4 — `set_audit_policy` (Signed origin)
|
|
1169
|
+
* Registers or replaces the caller's audit policy for selective disclosure.
|
|
1170
|
+
*/
|
|
1171
|
+
type SetAuditPolicyArgs = {
|
|
1172
|
+
/** Up to 10 authorized auditors. */
|
|
1173
|
+
auditors: Auditor[];
|
|
1174
|
+
/** Up to 10 disclosure conditions. */
|
|
1175
|
+
conditions: DisclosureCondition[];
|
|
1176
|
+
/** Minimum blocks between disclosures to the same auditor. Null = no limit. */
|
|
1177
|
+
maxFrequency: number | null;
|
|
1178
|
+
/** Block after which the policy expires. Null = no expiry. */
|
|
1179
|
+
validUntil: number | null;
|
|
1180
|
+
};
|
|
1181
|
+
/**
|
|
1182
|
+
* Call index 5 — `request_disclosure` (Signed origin)
|
|
1183
|
+
* Auditor requests selective disclosure from a target account for a specific commitment.
|
|
1184
|
+
*/
|
|
1185
|
+
type RequestDisclosureArgs = {
|
|
1186
|
+
/** AccountId of the disclosure target. */
|
|
1187
|
+
target: string;
|
|
1188
|
+
/** 32-byte commitment the auditor wants disclosed (LE). */
|
|
1189
|
+
commitment: number[];
|
|
1190
|
+
/** Which note fields must be revealed. */
|
|
1191
|
+
requiredFields: DisclosureFieldMask;
|
|
1192
|
+
/** Human-readable request reason — max 256 bytes UTF-8. */
|
|
1193
|
+
reason: string;
|
|
1194
|
+
/** Auditor's Baby Jubjub public key x-coordinate (32 bytes LE). */
|
|
1195
|
+
auditorBjjPkX: number[];
|
|
1196
|
+
/** Auditor's Baby Jubjub public key y-coordinate (32 bytes LE). */
|
|
1197
|
+
auditorBjjPkY: number[];
|
|
1198
|
+
};
|
|
1199
|
+
/**
|
|
1200
|
+
* Call index 6 — `disclose` (Signed origin)
|
|
1201
|
+
* Submit a Groth16 disclosure proof for a commitment.
|
|
1202
|
+
*/
|
|
1203
|
+
type DiscloseArgs = {
|
|
1204
|
+
/** 32-byte note commitment to disclose (LE). */
|
|
1205
|
+
commitment: Bytes32;
|
|
1206
|
+
/** Groth16 proof bytes — max 128 bytes. */
|
|
1207
|
+
proofBytes: number[];
|
|
1208
|
+
/**
|
|
1209
|
+
* 256-byte public signals (ECDH Baby Jubjub layout):
|
|
1210
|
+
* commitment[0..32] | auditor_pk_x[32..64] | auditor_pk_y[64..96]
|
|
1211
|
+
* | epk_x[96..128] | epk_y[128..160] | enc_value[160..192]
|
|
1212
|
+
* | enc_asset_id[192..224] | enc_owner_hash[224..256]
|
|
1213
|
+
* Use `buildDisclosurePublicSignals()` to construct this.
|
|
1214
|
+
*/
|
|
1215
|
+
publicSignals: DisclosurePublicSignals;
|
|
1216
|
+
/** Auditor AccountId — required (must match the DisclosureRequest). */
|
|
1217
|
+
auditor: string;
|
|
1218
|
+
};
|
|
1219
|
+
/**
|
|
1220
|
+
* Call index 7 — `reject_disclosure` (Signed origin)
|
|
1221
|
+
* Disclosure target rejects a pending request from an auditor for a specific commitment.
|
|
1222
|
+
*/
|
|
1223
|
+
type RejectDisclosureArgs = {
|
|
1224
|
+
/** AccountId of the auditor whose request is rejected. */
|
|
1225
|
+
auditor: string;
|
|
1226
|
+
/** 32-byte commitment of the request being rejected (LE). */
|
|
1227
|
+
commitment: number[];
|
|
1228
|
+
/** Rejection reason — max 256 bytes UTF-8. */
|
|
1229
|
+
reason: string;
|
|
1230
|
+
};
|
|
1231
|
+
/**
|
|
1232
|
+
* Call index 13 — `batch_submit_disclosure_proofs` (Signed origin)
|
|
1233
|
+
* Submit up to 10 disclosure proofs in one extrinsic.
|
|
1234
|
+
*/
|
|
1235
|
+
type BatchSubmitDisclosureProofsArgs = {
|
|
1236
|
+
submissions: BatchDisclosureSubmission[];
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* Call index 9 — `register_asset` (Root origin)
|
|
1240
|
+
* Registers a new asset in the shielded pool registry.
|
|
1241
|
+
*/
|
|
1242
|
+
type RegisterAssetArgs = {
|
|
1243
|
+
/** Asset name — max 64 bytes UTF-8. */
|
|
1244
|
+
name: string;
|
|
1245
|
+
/** Asset ticker symbol, e.g. "USDT" — max 16 bytes UTF-8. */
|
|
1246
|
+
symbol: string;
|
|
1247
|
+
/** Token decimal precision (e.g. 18 for ORB, 6 for USDT). */
|
|
1248
|
+
decimals: number;
|
|
1249
|
+
/** 20-byte EVM contract address for ERC-20 assets. Null = native asset. */
|
|
1250
|
+
contractAddress: number[] | null;
|
|
1251
|
+
};
|
|
1252
|
+
/**
|
|
1253
|
+
* Call index 10 — `verify_asset` (Root origin)
|
|
1254
|
+
* Marks a registered asset as verified, enabling shielding.
|
|
1255
|
+
*/
|
|
1256
|
+
type VerifyAssetArgs = {
|
|
1257
|
+
assetId: number;
|
|
1258
|
+
};
|
|
1259
|
+
/**
|
|
1260
|
+
* Call index 11 — `unverify_asset` (Root origin)
|
|
1261
|
+
* Removes the verified status from an asset, disabling new shield operations.
|
|
1262
|
+
*/
|
|
1263
|
+
type UnverifyAssetArgs = {
|
|
1264
|
+
assetId: number;
|
|
1265
|
+
};
|
|
1266
|
+
/**
|
|
1267
|
+
* Call index 14 — `prune_expired_request` (Signed origin)
|
|
1268
|
+
* Cleans up a disclosure request that has passed its expiration block.
|
|
1269
|
+
*/
|
|
1270
|
+
type PruneExpiredRequestArgs = {
|
|
1271
|
+
/** AccountId of the disclosure target. */
|
|
1272
|
+
target: string;
|
|
1273
|
+
/** AccountId of the auditor. */
|
|
1274
|
+
auditor: string;
|
|
1275
|
+
/** 32-byte commitment of the expired request (LE). */
|
|
1276
|
+
commitment: number[];
|
|
1277
|
+
};
|
|
1278
|
+
/**
|
|
1279
|
+
* Call index 15 — `revoke_disclosure_record` (Signed origin)
|
|
1280
|
+
* Allows the note owner to revoke a previously submitted disclosure record.
|
|
1281
|
+
*/
|
|
1282
|
+
type RevokeDisclosureRecordArgs = {
|
|
1283
|
+
/** 32-byte commitment whose disclosure record should be revoked (LE). */
|
|
1284
|
+
commitment: Bytes32;
|
|
1285
|
+
};
|
|
1286
|
+
/** All pallet-shielded-pool calls as a discriminated union. */
|
|
1287
|
+
type ShieldedPoolCall = {
|
|
1288
|
+
type: 'shield';
|
|
1289
|
+
args: ShieldArgs;
|
|
1290
|
+
} | {
|
|
1291
|
+
type: 'shieldBatch';
|
|
1292
|
+
args: ShieldBatchArgs;
|
|
1293
|
+
} | {
|
|
1294
|
+
type: 'privateTransfer';
|
|
1295
|
+
args: PrivateTransferArgs;
|
|
1296
|
+
} | {
|
|
1297
|
+
type: 'unshield';
|
|
1298
|
+
args: UnshieldArgs;
|
|
1299
|
+
} | {
|
|
1300
|
+
type: 'setAuditPolicy';
|
|
1301
|
+
args: SetAuditPolicyArgs;
|
|
1302
|
+
} | {
|
|
1303
|
+
type: 'requestDisclosure';
|
|
1304
|
+
args: RequestDisclosureArgs;
|
|
1305
|
+
} | {
|
|
1306
|
+
type: 'disclose';
|
|
1307
|
+
args: DiscloseArgs;
|
|
1308
|
+
} | {
|
|
1309
|
+
type: 'rejectDisclosure';
|
|
1310
|
+
args: RejectDisclosureArgs;
|
|
1311
|
+
} | {
|
|
1312
|
+
type: 'batchSubmitDisclosureProofs';
|
|
1313
|
+
args: BatchSubmitDisclosureProofsArgs;
|
|
1314
|
+
} | {
|
|
1315
|
+
type: 'registerAsset';
|
|
1316
|
+
args: RegisterAssetArgs;
|
|
1317
|
+
} | {
|
|
1318
|
+
type: 'verifyAsset';
|
|
1319
|
+
args: VerifyAssetArgs;
|
|
1320
|
+
} | {
|
|
1321
|
+
type: 'unverifyAsset';
|
|
1322
|
+
args: UnverifyAssetArgs;
|
|
1323
|
+
} | {
|
|
1324
|
+
type: 'pruneExpiredRequest';
|
|
1325
|
+
args: PruneExpiredRequestArgs;
|
|
1326
|
+
} | {
|
|
1327
|
+
type: 'revokeDisclosureRecord';
|
|
1328
|
+
args: RevokeDisclosureRecordArgs;
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* High-level module for Orbinum shielded-pool operations.
|
|
1333
|
+
*
|
|
1334
|
+
* Transactions are built via polkadot-api's UnsafeApi (metadata-driven),
|
|
1335
|
+
* which means the Orbinum node must be reachable on first use.
|
|
1336
|
+
* Signing is delegated to a PolkadotSigner (see polkadot-api/signer).
|
|
1337
|
+
*
|
|
1338
|
+
* Parameter order matches the Orbinum runtime extrinsics exactly.
|
|
1339
|
+
*/
|
|
1340
|
+
declare class ShieldedPoolModule {
|
|
1341
|
+
private readonly substrate;
|
|
1342
|
+
constructor(substrate: SubstrateClient);
|
|
1343
|
+
/**
|
|
1344
|
+
* Deposits tokens into the shielded pool.
|
|
1345
|
+
* Extrinsic: shieldedPool.shield(assetId, amount, commitment, encryptedMemo)
|
|
1346
|
+
*
|
|
1347
|
+
* Shield is always a signed (public) transaction — the caller's address
|
|
1348
|
+
* appears on-chain as the depositor.
|
|
1349
|
+
*/
|
|
1350
|
+
shield(params: ShieldParams, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Withdraws tokens from the shielded pool to a public address.
|
|
1353
|
+
* Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
|
|
1354
|
+
* Pass a `signer` to fall back to signed submission (e.g. for testing).
|
|
1355
|
+
* Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee)
|
|
1356
|
+
*/
|
|
1357
|
+
unshield(params: UnshieldParams, signer?: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Performs a private (shielded) transfer between two notes.
|
|
1360
|
+
* Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
|
|
1361
|
+
* Pass a `signer` to fall back to signed submission (e.g. for testing).
|
|
1362
|
+
* Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee)
|
|
1363
|
+
*/
|
|
1364
|
+
privateTransfer(params: PrivateTransferParams, signer?: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1365
|
+
/**
|
|
1366
|
+
* Deposits multiple notes into the shielded pool in a single extrinsic.
|
|
1367
|
+
* Extrinsic: shieldedPool.shieldBatch(operations) — max 20 items.
|
|
1368
|
+
*/
|
|
1369
|
+
shieldBatch(params: ShieldBatchParams, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Claims accrued relay fees into the shielded pool.
|
|
1372
|
+
* This is a SIGNED transaction — the relayer must sign it with their wallet.
|
|
1373
|
+
* Before calling this, generate a ZK disclosure proof with generateFeeClaimProof().
|
|
1374
|
+
*
|
|
1375
|
+
* Extrinsic: shieldedPool.claim_shielded_fees(commitment, amount, asset_id, memo, proof, public_signals)
|
|
1376
|
+
*/
|
|
1377
|
+
claimShieldedFees(params: ClaimShieldedFeesParams, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Requests a selective disclosure from a target account for a specific commitment.
|
|
1380
|
+
* The auditor's Baby Jubjub public key is included so the note owner knows
|
|
1381
|
+
* which key to encrypt to when generating the proof.
|
|
1382
|
+
* Extrinsic: shieldedPool.request_disclosure(target, commitment, required_fields,
|
|
1383
|
+
* reason, auditor_bjj_pk_x, auditor_bjj_pk_y)
|
|
1384
|
+
*/
|
|
1385
|
+
requestDisclosure(params: RequestDisclosureArgs, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Submits a Groth16 ZK disclosure proof for a note commitment.
|
|
1388
|
+
* The proof reveals the selected fields (value, asset_id, owner_hash) on-chain.
|
|
1389
|
+
* Use generateDisclosureProof() + buildDisclosurePublicSignals() before calling this.
|
|
1390
|
+
* Extrinsic: shieldedPool.disclose(commitment, proof_bytes, public_signals, auditor)
|
|
1391
|
+
*/
|
|
1392
|
+
disclose(params: DiscloseArgs, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Rejects a pending disclosure request from an auditor for a specific commitment.
|
|
1395
|
+
* Extrinsic: shieldedPool.reject_disclosure(auditor, commitment, reason)
|
|
1396
|
+
*/
|
|
1397
|
+
rejectDisclosure(params: RejectDisclosureArgs, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1398
|
+
/**
|
|
1399
|
+
* Cleans up a disclosure request that has passed its expiration block.
|
|
1400
|
+
* Permissionless — any account can prune expired requests.
|
|
1401
|
+
* Extrinsic: shieldedPool.prune_expired_request(target, auditor, commitment)
|
|
1402
|
+
*/
|
|
1403
|
+
pruneExpiredRequest(params: PruneExpiredRequestArgs, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Revokes a previously submitted voluntary disclosure record.
|
|
1406
|
+
* Only applies to self-disclosures (auditor = None). Auditor-requested records are permanent.
|
|
1407
|
+
* Extrinsic: shieldedPool.revoke_disclosure_record(commitment)
|
|
1408
|
+
*/
|
|
1409
|
+
revokeDisclosureRecord(params: RevokeDisclosureRecordArgs, signer: PolkadotSigner, txOptions?: UnsafeTxOptions): Promise<TxResult>;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Signature verification scheme for cross-chain links.
|
|
1414
|
+
* Mirrors `SignatureScheme` in pallet-account-mapping.
|
|
1415
|
+
*/
|
|
1416
|
+
declare const SignatureScheme: {
|
|
1417
|
+
readonly Eip191: "Eip191";
|
|
1418
|
+
readonly Ed25519: "Ed25519";
|
|
1419
|
+
};
|
|
1420
|
+
type SignatureScheme = (typeof SignatureScheme)[keyof typeof SignatureScheme];
|
|
1421
|
+
/** A verified public link to an external chain wallet. */
|
|
1422
|
+
type ChainLink = {
|
|
1423
|
+
chainId: number;
|
|
1424
|
+
address: string;
|
|
1425
|
+
};
|
|
1426
|
+
/** A private link: only the Poseidon commitment is stored on-chain. */
|
|
1427
|
+
type PrivateLink = {
|
|
1428
|
+
chainId: number;
|
|
1429
|
+
commitment: string;
|
|
1430
|
+
};
|
|
1431
|
+
/** Public profile metadata set by the account owner. */
|
|
1432
|
+
type AccountMetadata = {
|
|
1433
|
+
displayName: string | null;
|
|
1434
|
+
bio: string | null;
|
|
1435
|
+
avatar: string | null;
|
|
1436
|
+
};
|
|
1437
|
+
/** Identity info by alias: owner, optional EVM address, link count. */
|
|
1438
|
+
type AliasInfo = {
|
|
1439
|
+
/** 0x-prefixed 32-byte AccountId32 hex. */
|
|
1440
|
+
owner: string;
|
|
1441
|
+
/** Normalized EVM address (0x + 40 hex chars), or null. */
|
|
1442
|
+
evmAddress: string | null;
|
|
1443
|
+
chainLinksCount: number;
|
|
1444
|
+
};
|
|
1445
|
+
/**
|
|
1446
|
+
* Full identity for an alias: owner, EVM address, all public chain links, metadata.
|
|
1447
|
+
* Returned by `accountMapping_getFullIdentity` (alias-based lookup).
|
|
1448
|
+
*/
|
|
1449
|
+
type AliasFullIdentity = {
|
|
1450
|
+
owner: string;
|
|
1451
|
+
evmAddress: string | null;
|
|
1452
|
+
chainLinks: ChainLink[];
|
|
1453
|
+
metadata: AccountMetadata | null;
|
|
1454
|
+
};
|
|
1455
|
+
/** Sale listing info for an alias on the marketplace. */
|
|
1456
|
+
type ListingInfo = {
|
|
1457
|
+
price: bigint;
|
|
1458
|
+
/** True if sale is private (whitelist-only). */
|
|
1459
|
+
private: boolean;
|
|
1460
|
+
whitelistCount: number;
|
|
1461
|
+
};
|
|
1462
|
+
/** An alias actively listed for sale with its full info. */
|
|
1463
|
+
type AccountListing = {
|
|
1464
|
+
alias: string;
|
|
1465
|
+
listing: ListingInfo;
|
|
1466
|
+
};
|
|
1467
|
+
/** A supported chain and its signature verification scheme. */
|
|
1468
|
+
type SupportedChain = {
|
|
1469
|
+
chainId: number;
|
|
1470
|
+
scheme: SignatureScheme;
|
|
1471
|
+
};
|
|
1472
|
+
/** Parameters for adding a verified public chain link. */
|
|
1473
|
+
type AddChainLinkParams = {
|
|
1474
|
+
/** External chain ID. Use SLIP0044_NAMESPACE | coinType for SLIP-0044 chains. */
|
|
1475
|
+
chainId: number;
|
|
1476
|
+
/** The external address bytes (e.g. 20 bytes for EVM, 32 for Solana). */
|
|
1477
|
+
address: Uint8Array;
|
|
1478
|
+
/** Signature over the caller's AccountId32 (64 bytes for Ed25519, 65 for EIP-191). */
|
|
1479
|
+
signature: Uint8Array;
|
|
1480
|
+
};
|
|
1481
|
+
/** Parameters for updating public profile metadata. */
|
|
1482
|
+
type SetMetadataParams = {
|
|
1483
|
+
displayName?: string | null;
|
|
1484
|
+
bio?: string | null;
|
|
1485
|
+
avatar?: string | null;
|
|
1486
|
+
};
|
|
1487
|
+
/** Parameters for listing an alias on the marketplace. */
|
|
1488
|
+
type PutOnSaleParams = {
|
|
892
1489
|
price: bigint;
|
|
893
1490
|
/** If true the sale becomes OTC (whitelist required). */
|
|
894
1491
|
isPrivate: boolean;
|
|
@@ -1064,7 +1661,6 @@ type RpcV2MerkleProof = {
|
|
|
1064
1661
|
leafIndex: number;
|
|
1065
1662
|
treeDepth: number;
|
|
1066
1663
|
};
|
|
1067
|
-
/** Prueba Merkle enriquecida con el `root` actual del árbol. Devuelta por `getMerkleProofByCommitment`. */
|
|
1068
1664
|
type PrivacyMerkleProof = RpcV2MerkleProof & {
|
|
1069
1665
|
root: string;
|
|
1070
1666
|
};
|
|
@@ -1074,13 +1670,12 @@ type RpcV2NullifierStatus = {
|
|
|
1074
1670
|
};
|
|
1075
1671
|
type RpcV2PoolAssetBalance = {
|
|
1076
1672
|
assetId: number;
|
|
1077
|
-
/** Balance serializado como string decimal para preservar `u128`. */
|
|
1078
1673
|
balance: string;
|
|
1079
1674
|
};
|
|
1080
1675
|
type RpcV2PoolStats = {
|
|
1081
1676
|
merkleRoot: string;
|
|
1082
1677
|
commitmentCount: number;
|
|
1083
|
-
|
|
1678
|
+
nullifierCount: number;
|
|
1084
1679
|
totalBalance: string;
|
|
1085
1680
|
assetBalances: RpcV2PoolAssetBalance[];
|
|
1086
1681
|
treeDepth: number;
|
|
@@ -1098,7 +1693,11 @@ declare class PrivacyModule {
|
|
|
1098
1693
|
getMerkleProof(leafIndex: number | string): Promise<RpcV2MerkleProof>;
|
|
1099
1694
|
/**
|
|
1100
1695
|
* Returns the Merkle inclusion proof for a given commitment hex,
|
|
1101
|
-
* bundled with the
|
|
1696
|
+
* bundled with the Merkle root.
|
|
1697
|
+
*
|
|
1698
|
+
* Uses `privacy_getMerkleProofByCommitment` which resolves root and proof
|
|
1699
|
+
* under the **same block hash**, guaranteeing that the returned path is
|
|
1700
|
+
* consistent with the returned root.
|
|
1102
1701
|
*/
|
|
1103
1702
|
getMerkleProofByCommitment(commitmentHex: string): Promise<PrivacyMerkleProof>;
|
|
1104
1703
|
/** Returns the spend status of a nullifier. */
|
|
@@ -1154,6 +1753,43 @@ declare class ZkVerifierModule {
|
|
|
1154
1753
|
getCircuitVersionInfo(circuitId: number): Promise<ZkVerifierCircuitVersionInfo | null>;
|
|
1155
1754
|
}
|
|
1156
1755
|
|
|
1756
|
+
/**
|
|
1757
|
+
* Status info for a registered relayer account.
|
|
1758
|
+
*/
|
|
1759
|
+
interface RelayerInfo {
|
|
1760
|
+
/** Whether the account is a registered relayer. */
|
|
1761
|
+
isRelayer: boolean;
|
|
1762
|
+
/** The registered EVM address (0x-prefixed), or null if not registered. */
|
|
1763
|
+
evmAddress: string | null;
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Typed client for `relayer_*` JSON-RPC endpoints.
|
|
1767
|
+
*
|
|
1768
|
+
* Exposes read-only queries for relayer registry and pending fee data.
|
|
1769
|
+
*/
|
|
1770
|
+
declare class RelayerStatusModule {
|
|
1771
|
+
private readonly substrate;
|
|
1772
|
+
constructor(substrate: SubstrateClient);
|
|
1773
|
+
/**
|
|
1774
|
+
* Returns true if the given SS58 address is a registered relayer.
|
|
1775
|
+
*/
|
|
1776
|
+
isRelayer(ss58Address: string): Promise<boolean>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Returns the pending fees (in planck) for the given account and asset.
|
|
1779
|
+
* The node returns the value as a decimal string to avoid u128 overflow.
|
|
1780
|
+
*/
|
|
1781
|
+
pendingFees(ss58Address: string, assetId: number): Promise<bigint>;
|
|
1782
|
+
/**
|
|
1783
|
+
* Returns the registered EVM address (0x-prefixed) for the given account,
|
|
1784
|
+
* or null if the account is not a registered relayer.
|
|
1785
|
+
*/
|
|
1786
|
+
registeredEvmAddress(ss58Address: string): Promise<string | null>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Convenience method: returns relayer registry info for an account.
|
|
1789
|
+
*/
|
|
1790
|
+
getRelayerInfo(ss58Address: string): Promise<RelayerInfo>;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1157
1793
|
/** EVM transaction request passed to an `EvmSigner` callback. */
|
|
1158
1794
|
type EvmTxRequest = {
|
|
1159
1795
|
to: string;
|
|
@@ -1175,27 +1811,70 @@ interface KnownPrecompileInfo {
|
|
|
1175
1811
|
/** Map from 4-byte hex selector (no 0x prefix) to function signature. */
|
|
1176
1812
|
functions: Record<string, string>;
|
|
1177
1813
|
}
|
|
1178
|
-
|
|
1179
1814
|
/**
|
|
1180
|
-
*
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
* Decodes a hex string (with or without 0x prefix) to Uint8Array.
|
|
1815
|
+
* Parameters for `requestDisclosure`.
|
|
1816
|
+
*
|
|
1817
|
+
* The EVM caller of this transaction is treated as the **auditor** on-chain.
|
|
1185
1818
|
*/
|
|
1186
|
-
|
|
1819
|
+
type RequestDisclosureParams = {
|
|
1820
|
+
/** AccountId32 of the note owner (target), as a 0x-prefixed 64-hex-char string. */
|
|
1821
|
+
target: string;
|
|
1822
|
+
/** Note commitment, as a 0x-prefixed 64-hex-char string. */
|
|
1823
|
+
commitment: string;
|
|
1824
|
+
/** Whether to request disclosure of the note value. */
|
|
1825
|
+
disclosedValue: boolean;
|
|
1826
|
+
/** Whether to request disclosure of the asset ID. */
|
|
1827
|
+
disclosedAssetId: boolean;
|
|
1828
|
+
/** Whether to request disclosure of the note owner hash. */
|
|
1829
|
+
disclosedOwner: boolean;
|
|
1830
|
+
/** Human-readable reason (UTF-8, max 256 bytes). */
|
|
1831
|
+
reason: string;
|
|
1832
|
+
/** Auditor's Baby Jubjub public key X coordinate (32 bytes). */
|
|
1833
|
+
auditorBjjPkX: Uint8Array;
|
|
1834
|
+
/** Auditor's Baby Jubjub public key Y coordinate (32 bytes). */
|
|
1835
|
+
auditorBjjPkY: Uint8Array;
|
|
1836
|
+
};
|
|
1187
1837
|
/**
|
|
1188
|
-
*
|
|
1838
|
+
* Parameters for `disclose`.
|
|
1839
|
+
*
|
|
1840
|
+
* The EVM caller of this transaction is treated as the **note owner** on-chain.
|
|
1189
1841
|
*/
|
|
1190
|
-
|
|
1842
|
+
type DiscloseParams = {
|
|
1843
|
+
/** Note commitment, as a 0x-prefixed 64-hex-char string. */
|
|
1844
|
+
commitment: string;
|
|
1845
|
+
/** 128-byte serialised Groth16 proof. */
|
|
1846
|
+
proofBytes: Uint8Array;
|
|
1847
|
+
/** 256-byte ECDH-encrypted disclosure signals from the circuit. */
|
|
1848
|
+
publicSignals: Uint8Array;
|
|
1849
|
+
/** AccountId32 of the auditor, as a 0x-prefixed 64-hex-char string. */
|
|
1850
|
+
auditor: string;
|
|
1851
|
+
};
|
|
1191
1852
|
/**
|
|
1192
|
-
*
|
|
1853
|
+
* Parameters for `rejectDisclosure`.
|
|
1854
|
+
*
|
|
1855
|
+
* The EVM caller of this transaction is treated as the **target** (note owner) on-chain.
|
|
1193
1856
|
*/
|
|
1194
|
-
|
|
1857
|
+
type RejectDisclosureParams = {
|
|
1858
|
+
/** AccountId32 of the auditor who sent the request, as a 0x-prefixed 64-hex-char string. */
|
|
1859
|
+
auditor: string;
|
|
1860
|
+
/** Note commitment, as a 0x-prefixed 64-hex-char string. */
|
|
1861
|
+
commitment: string;
|
|
1862
|
+
/** Human-readable rejection reason (UTF-8, max 256 bytes). */
|
|
1863
|
+
reason: string;
|
|
1864
|
+
};
|
|
1195
1865
|
/**
|
|
1196
|
-
*
|
|
1866
|
+
* Parameters for `pruneExpiredRequest`.
|
|
1867
|
+
*
|
|
1868
|
+
* Permissionless: any EVM caller can prune an expired disclosure request.
|
|
1197
1869
|
*/
|
|
1198
|
-
|
|
1870
|
+
type PruneExpiredRequestParams = {
|
|
1871
|
+
/** AccountId32 of the note owner, as a 0x-prefixed 64-hex-char string. */
|
|
1872
|
+
target: string;
|
|
1873
|
+
/** AccountId32 of the auditor, as a 0x-prefixed 64-hex-char string. */
|
|
1874
|
+
auditor: string;
|
|
1875
|
+
/** Note commitment, as a 0x-prefixed 64-hex-char string. */
|
|
1876
|
+
commitment: string;
|
|
1877
|
+
};
|
|
1199
1878
|
|
|
1200
1879
|
/**
|
|
1201
1880
|
* Bindings for the `ShieldedPoolPrecompile` at address `0x...0801`.
|
|
@@ -1218,22 +1897,27 @@ declare class ShieldedPoolPrecompile {
|
|
|
1218
1897
|
private readonly addr;
|
|
1219
1898
|
constructor(evm: EvmClient);
|
|
1220
1899
|
/**
|
|
1221
|
-
* Returns the ABI-encoded calldata for `shield(uint32,
|
|
1222
|
-
*
|
|
1900
|
+
* Returns the ABI-encoded calldata for `shield(uint32, bytes32, bytes)`.
|
|
1901
|
+
* The token amount must be sent as `msg.value` (the `value` field of the EVM
|
|
1902
|
+
* transaction) — this is what MetaMask and other wallets display to the user.
|
|
1223
1903
|
*/
|
|
1224
1904
|
buildShieldCalldata(params: ShieldParams): string;
|
|
1225
1905
|
/**
|
|
1226
|
-
* Deposits tokens into the shielded pool from
|
|
1906
|
+
* Deposits tokens into the shielded pool from a payable EVM transaction.
|
|
1227
1907
|
*
|
|
1228
|
-
* The
|
|
1229
|
-
*
|
|
1908
|
+
* The token amount is sent as `msg.value` so EVM wallets (MetaMask, etc.) display
|
|
1909
|
+
* the correct amount on the confirmation screen. The precompile dispatches
|
|
1910
|
+
* `shieldedPool.shield` with its own address as origin, so the funds flow:
|
|
1911
|
+
* caller → precompile (via msg.value, handled by EVM)
|
|
1912
|
+
* precompile → pool (via pallet transfer)
|
|
1913
|
+
* This avoids double-deduction while keeping the displayed amount accurate.
|
|
1230
1914
|
*
|
|
1231
1915
|
* Extrinsic: `shieldedPool.shield(assetId, amount, commitment, encryptedMemo)`
|
|
1232
1916
|
*/
|
|
1233
1917
|
shield(params: ShieldParams, signer: EvmSigner): Promise<string>;
|
|
1234
1918
|
/**
|
|
1235
1919
|
* Returns the ABI-encoded calldata for
|
|
1236
|
-
* `privateTransfer(bytes, bytes32, bytes32[], bytes32[], bytes[])`.
|
|
1920
|
+
* `privateTransfer(bytes, bytes32, bytes32[], bytes32[], bytes[], uint32, uint256)`.
|
|
1237
1921
|
*/
|
|
1238
1922
|
buildPrivateTransferCalldata(params: PrivateTransferParams): string;
|
|
1239
1923
|
/**
|
|
@@ -1260,20 +1944,82 @@ declare class ShieldedPoolPrecompile {
|
|
|
1260
1944
|
*
|
|
1261
1945
|
* Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)`
|
|
1262
1946
|
*/
|
|
1263
|
-
unshield(params: UnshieldParams, signer: EvmSigner): Promise<string>;
|
|
1947
|
+
unshield(params: UnshieldParams, signer: EvmSigner): Promise<string>;
|
|
1948
|
+
/**
|
|
1949
|
+
* Estimates the EVM gas for a `shield` call without submitting.
|
|
1950
|
+
* Requires `from` to be set to the actual sender address.
|
|
1951
|
+
*/
|
|
1952
|
+
estimateShieldGas(params: ShieldParams, from: string): Promise<bigint>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Estimates the EVM gas for a `privateTransfer` call.
|
|
1955
|
+
*/
|
|
1956
|
+
estimatePrivateTransferGas(params: PrivateTransferParams, from: string): Promise<bigint>;
|
|
1957
|
+
/**
|
|
1958
|
+
* Estimates the EVM gas for an `unshield` call.
|
|
1959
|
+
*/
|
|
1960
|
+
estimateUnshieldGas(params: UnshieldParams, from: string): Promise<bigint>;
|
|
1961
|
+
/**
|
|
1962
|
+
* Returns the ABI-encoded calldata for
|
|
1963
|
+
* `requestDisclosure(bytes32,bytes32,bool,bool,bool,bytes,bytes32,bytes32)`.
|
|
1964
|
+
*
|
|
1965
|
+
* The **EVM caller** of the resulting transaction is treated as the **auditor**
|
|
1966
|
+
* on-chain. No explicit auditor argument is needed.
|
|
1967
|
+
*/
|
|
1968
|
+
buildRequestDisclosureCalldata(params: RequestDisclosureParams): string;
|
|
1969
|
+
/**
|
|
1970
|
+
* Requests selective disclosure of a specific commitment.
|
|
1971
|
+
*
|
|
1972
|
+
* The EVM caller is recorded as the auditor on-chain. The note owner can
|
|
1973
|
+
* respond with `disclose()` or reject with `rejectDisclosure()`.
|
|
1974
|
+
*
|
|
1975
|
+
* Extrinsic: `shieldedPool.requestDisclosure(target, commitment, requiredFields, reason, bjjPkX, bjjPkY)`
|
|
1976
|
+
*/
|
|
1977
|
+
requestDisclosure(params: RequestDisclosureParams, signer: EvmSigner): Promise<string>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Returns the ABI-encoded calldata for `disclose(bytes32,bytes,bytes,bytes32)`.
|
|
1980
|
+
*
|
|
1981
|
+
* The **EVM caller** is treated as the **note owner** on-chain.
|
|
1982
|
+
* `params.proofBytes` must be exactly 128 bytes; `params.publicSignals` exactly 256 bytes.
|
|
1983
|
+
*/
|
|
1984
|
+
buildDiscloseCalldata(params: DiscloseParams): string;
|
|
1985
|
+
/**
|
|
1986
|
+
* Submits a selective disclosure proof for a commitment.
|
|
1987
|
+
*
|
|
1988
|
+
* The EVM caller is treated as the note owner on-chain. The Groth16 proof is
|
|
1989
|
+
* verified by the runtime; on success the encrypted signals are stored for
|
|
1990
|
+
* the auditor to decrypt off-chain.
|
|
1991
|
+
*
|
|
1992
|
+
* Extrinsic: `shieldedPool.disclose(commitment, proofBytes, publicSignals, auditor)`
|
|
1993
|
+
*/
|
|
1994
|
+
disclose(params: DiscloseParams, signer: EvmSigner): Promise<string>;
|
|
1995
|
+
/**
|
|
1996
|
+
* Returns the ABI-encoded calldata for `rejectDisclosure(bytes32,bytes32,bytes)`.
|
|
1997
|
+
*
|
|
1998
|
+
* The **EVM caller** is treated as the **target** (note owner) on-chain.
|
|
1999
|
+
*/
|
|
2000
|
+
buildRejectDisclosureCalldata(params: RejectDisclosureParams): string;
|
|
1264
2001
|
/**
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
2002
|
+
* Rejects a pending disclosure request.
|
|
2003
|
+
*
|
|
2004
|
+
* The EVM caller is treated as the note owner (target) on-chain.
|
|
2005
|
+
*
|
|
2006
|
+
* Extrinsic: `shieldedPool.rejectDisclosure(auditor, commitment, reason)`
|
|
1267
2007
|
*/
|
|
1268
|
-
|
|
2008
|
+
rejectDisclosure(params: RejectDisclosureParams, signer: EvmSigner): Promise<string>;
|
|
1269
2009
|
/**
|
|
1270
|
-
*
|
|
2010
|
+
* Returns the ABI-encoded calldata for `pruneExpiredRequest(bytes32,bytes32,bytes32)`.
|
|
2011
|
+
*
|
|
2012
|
+
* Permissionless: any EVM caller can prune an expired request.
|
|
1271
2013
|
*/
|
|
1272
|
-
|
|
2014
|
+
buildPruneExpiredRequestCalldata(params: PruneExpiredRequestParams): string;
|
|
1273
2015
|
/**
|
|
1274
|
-
*
|
|
2016
|
+
* Removes an expired disclosure request from storage.
|
|
2017
|
+
*
|
|
2018
|
+
* Permissionless: any EVM account can call this once `expires_at` has passed.
|
|
2019
|
+
*
|
|
2020
|
+
* Extrinsic: `shieldedPool.pruneExpiredRequest(target, auditor, commitment)`
|
|
1275
2021
|
*/
|
|
1276
|
-
|
|
2022
|
+
pruneExpiredRequest(params: PruneExpiredRequestParams, signer: EvmSigner): Promise<string>;
|
|
1277
2023
|
}
|
|
1278
2024
|
|
|
1279
2025
|
/**
|
|
@@ -1527,65 +2273,85 @@ declare class CryptoPrecompiles {
|
|
|
1527
2273
|
* ```
|
|
1528
2274
|
*/
|
|
1529
2275
|
declare class OrbinumClient {
|
|
1530
|
-
/** Raw
|
|
2276
|
+
/** Raw Substrate WebSocket connection — use for custom RPC calls or low-level access. */
|
|
1531
2277
|
readonly substrate: SubstrateClient;
|
|
1532
|
-
/** Raw
|
|
2278
|
+
/** Raw EVM HTTP JSON-RPC client. `null` when `evmRpc` is not configured. */
|
|
1533
2279
|
readonly evm: EvmClient | null;
|
|
1534
2280
|
/**
|
|
1535
|
-
* High-level EVM block and transaction explorer
|
|
2281
|
+
* High-level EVM block and transaction explorer.
|
|
1536
2282
|
* Provides enriched queries for blocks, transactions, addresses, and token transfers.
|
|
2283
|
+
* `null` when `evmRpc` is not configured.
|
|
1537
2284
|
*/
|
|
1538
2285
|
readonly evmExplorer: EvmExplorer | null;
|
|
1539
2286
|
/**
|
|
1540
|
-
* HTTP client for the Orbinum indexer REST API
|
|
2287
|
+
* HTTP client for the Orbinum indexer REST API.
|
|
1541
2288
|
* Provides paginated access to indexed blocks, extrinsics, shielded events, and nullifiers.
|
|
2289
|
+
* `null` when `indexerUrl` is not configured.
|
|
1542
2290
|
*/
|
|
1543
2291
|
readonly indexer: IndexerClient | null;
|
|
1544
|
-
/** Shielded-pool
|
|
2292
|
+
/** Shielded-pool extrinsics and Merkle tree queries (`shield`, `unshield`, `privateTransfer`, …). */
|
|
1545
2293
|
readonly shieldedPool: ShieldedPoolModule;
|
|
1546
|
-
/** Account
|
|
2294
|
+
/** Account-mapping extrinsics: aliases, chain links, metadata, marketplace, and identity. */
|
|
1547
2295
|
readonly accountMapping: AccountMappingModule;
|
|
1548
|
-
/** Typed access to
|
|
2296
|
+
/** Typed access to `privacy_*` custom RPC endpoints. */
|
|
1549
2297
|
readonly privacy: PrivacyModule;
|
|
1550
|
-
/** Typed access to zkVerifier_
|
|
2298
|
+
/** Typed access to `zkVerifier_*` custom RPC endpoints. */
|
|
1551
2299
|
readonly zkVerifier: ZkVerifierModule;
|
|
2300
|
+
/** Typed access to `relayer_*` RPC endpoints (registry lookup and pending fee queries). */
|
|
2301
|
+
readonly relayerStatus: RelayerStatusModule;
|
|
1552
2302
|
/**
|
|
1553
|
-
*
|
|
1554
|
-
*
|
|
2303
|
+
* Precompile modules for interacting with Orbinum contracts from an EVM wallet.
|
|
2304
|
+
* `null` when `evmRpc` is not configured. Methods on each sub-module throw if `evm` is `null`.
|
|
1555
2305
|
*/
|
|
1556
2306
|
readonly precompiles: {
|
|
1557
|
-
/** `ShieldedPoolPrecompile`
|
|
2307
|
+
/** `ShieldedPoolPrecompile` at `0x0801`: shield / unshield / transfer via EVM wallet. */
|
|
1558
2308
|
shieldedPool: ShieldedPoolPrecompile;
|
|
1559
|
-
/** `AccountMappingPrecompile`
|
|
2309
|
+
/** `AccountMappingPrecompile` at `0x0800`: identity management via EVM wallet. */
|
|
1560
2310
|
accountMapping: AccountMappingPrecompile;
|
|
1561
|
-
/**
|
|
2311
|
+
/** Built-in cryptographic precompiles: ECRecover, Keccak-256, Curve25519. */
|
|
1562
2312
|
crypto: CryptoPrecompiles;
|
|
1563
2313
|
} | null;
|
|
2314
|
+
/** @internal Use `OrbinumClient.connect()` to obtain an instance. */
|
|
1564
2315
|
private constructor();
|
|
1565
2316
|
/**
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
2317
|
+
* Creates and connects an `OrbinumClient` from the given configuration.
|
|
2318
|
+
*
|
|
2319
|
+
* Establishes the Substrate WebSocket connection and, if configured, instantiates
|
|
2320
|
+
* the EVM and indexer clients. Throws if the node is unreachable within `connectTimeoutMs`.
|
|
1568
2321
|
*/
|
|
1569
2322
|
static connect(config: OrbinumClientConfig): Promise<OrbinumClient>;
|
|
1570
|
-
/** Closes the WebSocket connection
|
|
2323
|
+
/** Closes the underlying Substrate WebSocket connection and releases all resources. */
|
|
1571
2324
|
destroy(): void;
|
|
1572
2325
|
}
|
|
1573
2326
|
|
|
2327
|
+
/** Lifecycle state of the provider's underlying `OrbinumClient` connection. */
|
|
1574
2328
|
type ConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'reconnecting';
|
|
2329
|
+
/** Payload emitted to every `StatusListener` on each status transition. */
|
|
1575
2330
|
type StatusChangeEvent = {
|
|
2331
|
+
/** The new connection status. */
|
|
1576
2332
|
status: ConnectionStatus;
|
|
2333
|
+
/** Human-readable error description. Only present on `'disconnected'` transitions. */
|
|
1577
2334
|
error?: string;
|
|
1578
2335
|
};
|
|
2336
|
+
/** Callback invoked whenever the provider's `ConnectionStatus` changes. */
|
|
1579
2337
|
type StatusListener = (event: StatusChangeEvent) => void;
|
|
2338
|
+
/** Configuration for `OrbinumClientProvider`. Extends `OrbinumClientConfig` with reconnection and heartbeat tuning. */
|
|
1580
2339
|
interface ClientProviderConfig {
|
|
2340
|
+
/** WebSocket URL of the Orbinum Substrate node (e.g. `"ws://localhost:9944"`). */
|
|
1581
2341
|
substrateWs: string;
|
|
2342
|
+
/** HTTP URL of the EVM JSON-RPC endpoint (e.g. `"http://localhost:9933"`). Omit to disable EVM support. */
|
|
1582
2343
|
evmRpc?: string;
|
|
1583
|
-
/** Base URL of the Orbinum indexer REST API (e.g. "https://indexer.orbinum.io") */
|
|
2344
|
+
/** Base URL of the Orbinum indexer REST API (e.g. `"https://indexer.orbinum.io"`). Omit to disable indexer support. */
|
|
1584
2345
|
indexerUrl?: string;
|
|
2346
|
+
/** Timeout for the initial WebSocket handshake in milliseconds. Default: `8_000`. */
|
|
1585
2347
|
connectTimeoutMs?: number;
|
|
2348
|
+
/** Interval between heartbeat probes in milliseconds. Default: `5_000`. */
|
|
1586
2349
|
heartbeatIntervalMs?: number;
|
|
2350
|
+
/** Maximum time to wait for a heartbeat response before treating the node as unreachable. Default: `4_000`. */
|
|
1587
2351
|
heartbeatTimeoutMs?: number;
|
|
2352
|
+
/** Initial reconnect delay in milliseconds (doubles on each failure). Default: `3_000`. */
|
|
1588
2353
|
reconnectBaseMs?: number;
|
|
2354
|
+
/** Maximum reconnect delay cap in milliseconds. Default: `30_000`. */
|
|
1589
2355
|
reconnectMaxMs?: number;
|
|
1590
2356
|
}
|
|
1591
2357
|
/**
|
|
@@ -1621,24 +2387,78 @@ declare class OrbinumClientProvider {
|
|
|
1621
2387
|
private _reconnectTimer;
|
|
1622
2388
|
private _reconnectAttempt;
|
|
1623
2389
|
private _listeners;
|
|
2390
|
+
/** Creates a new provider with the given configuration. Does not connect automatically — call `connect()` to initiate. */
|
|
1624
2391
|
constructor(config: ClientProviderConfig);
|
|
2392
|
+
/** Current connection status. Reflects the last state set by the provider internals. */
|
|
1625
2393
|
get status(): ConnectionStatus;
|
|
2394
|
+
/** Updates internal status and notifies all registered listeners. Swallows listener exceptions to avoid cascading failures. */
|
|
1626
2395
|
private setStatus;
|
|
2396
|
+
/**
|
|
2397
|
+
* Registers a listener that is called on every status transition.
|
|
2398
|
+
* Returns an unsubscribe function — call it to stop receiving events.
|
|
2399
|
+
*/
|
|
1627
2400
|
onStatusChange(listener: StatusListener): () => void;
|
|
2401
|
+
/**
|
|
2402
|
+
* Initiates the first connection attempt. No-op if the provider is not in `'idle'` state.
|
|
2403
|
+
* Call this once after constructing the provider.
|
|
2404
|
+
*/
|
|
1628
2405
|
connect(): void;
|
|
2406
|
+
/**
|
|
2407
|
+
* Tears down the active client and any pending reconnect timers,
|
|
2408
|
+
* then resets the provider back to `'idle'` so `connect()` can be called again.
|
|
2409
|
+
*/
|
|
1629
2410
|
reset(): void;
|
|
2411
|
+
/** Transitions to `'connecting'`, kicks off `attemptConnect`, and schedules a reconnect if it fails. */
|
|
1630
2412
|
private startConnectAttempt;
|
|
2413
|
+
/**
|
|
2414
|
+
* Performs a single connection attempt race against `connectTimeoutMs`.
|
|
2415
|
+
* On success: stores the client, starts the heartbeat, and returns it.
|
|
2416
|
+
* On failure: destroys any orphaned client and transitions to `'disconnected'`.
|
|
2417
|
+
*/
|
|
1631
2418
|
private attemptConnect;
|
|
2419
|
+
/** Starts the periodic heartbeat loop. Replaces any existing timer. */
|
|
1632
2420
|
private startHeartbeat;
|
|
2421
|
+
/** Clears the heartbeat interval timer if active. */
|
|
1633
2422
|
private stopHeartbeat;
|
|
2423
|
+
/**
|
|
2424
|
+
* Sends a `system_health` RPC ping and waits up to `heartbeatTimeoutMs`.
|
|
2425
|
+
* Returns `true` if the node responds in time, `false` otherwise.
|
|
2426
|
+
*/
|
|
1634
2427
|
private probe;
|
|
2428
|
+
/**
|
|
2429
|
+
* Schedules the next connection attempt using exponential backoff
|
|
2430
|
+
* (capped at `reconnectMaxMs`), then transitions to `'reconnecting'`.
|
|
2431
|
+
*/
|
|
1635
2432
|
private scheduleReconnect;
|
|
2433
|
+
/** Clears any pending reconnect timer without triggering a new attempt. */
|
|
1636
2434
|
private cancelReconnect;
|
|
2435
|
+
/** Stops the heartbeat, destroys the active client, and clears all in-progress promises. */
|
|
1637
2436
|
private teardownClient;
|
|
2437
|
+
/**
|
|
2438
|
+
* Returns the active `OrbinumClient`, or awaits the in-progress connection attempt.
|
|
2439
|
+
* Throws if the provider is `'idle'`, `'disconnected'`, or `'reconnecting'`.
|
|
2440
|
+
*/
|
|
1638
2441
|
getOrbinumClient(): Promise<OrbinumClient>;
|
|
2442
|
+
/**
|
|
2443
|
+
* Same as `getOrbinumClient()` but returns `null` instead of throwing.
|
|
2444
|
+
* Useful in contexts where a missing client is an acceptable no-op.
|
|
2445
|
+
*/
|
|
1639
2446
|
tryGetOrbinumClient(): Promise<OrbinumClient | null>;
|
|
2447
|
+
/**
|
|
2448
|
+
* Sends a single Substrate JSON-RPC request and returns the typed result.
|
|
2449
|
+
* Waits for the client to be ready before dispatching.
|
|
2450
|
+
*/
|
|
1640
2451
|
rpcSend<T>(method: string, params?: unknown[]): Promise<T>;
|
|
2452
|
+
/**
|
|
2453
|
+
* Sends a single EVM JSON-RPC request and returns the typed result.
|
|
2454
|
+
* Throws if `evmRpc` was not configured.
|
|
2455
|
+
*/
|
|
1641
2456
|
evmRpc<T>(method: string, params?: unknown[]): Promise<T>;
|
|
2457
|
+
/**
|
|
2458
|
+
* Sends multiple EVM JSON-RPC calls as a single batch request.
|
|
2459
|
+
* Returns a tuple of typed results in the same order as `calls`.
|
|
2460
|
+
* Throws if `evmRpc` was not configured.
|
|
2461
|
+
*/
|
|
1642
2462
|
evmRpcBatch<T extends unknown[]>(calls: Array<{
|
|
1643
2463
|
method: string;
|
|
1644
2464
|
params?: unknown[];
|
|
@@ -1655,31 +2475,44 @@ declare class OrbinumClientProvider {
|
|
|
1655
2475
|
* nullifier = Poseidon(commitment, spendingKey)
|
|
1656
2476
|
*
|
|
1657
2477
|
* Memo scheme (EncryptedMemo — native TypeScript, no WASM):
|
|
1658
|
-
* ChaCha20-Poly1305 with key
|
|
1659
|
-
* Result: nonce(12) || ciphertext(
|
|
2478
|
+
* ChaCha20-Poly1305 with ECDH ephemeral key — SHA256(sharedSecret || commitment || domain)
|
|
2479
|
+
* Result: nonce(12) || ciphertext(108 + 16 MAC) || ephPk(32) = 168 bytes
|
|
2480
|
+
*
|
|
2481
|
+
* Stealth scheme (when viewingPublicKey + recipientOwnerPk are both provided):
|
|
2482
|
+
* ephSk is generated once and shared between the ECDH memo and the stealth Pk derivation.
|
|
2483
|
+
* The commitment uses stealthOwnerPk instead of the recipient's global ownerPk, making
|
|
2484
|
+
* each transfer unlinkable even when the same privacy address is reused.
|
|
2485
|
+
* stealthOwnerPk = stealthScalar × Base8 + ownerPkPoint
|
|
2486
|
+
* stealthScalar = HKDF(sharedSecret, salt=ownerPk_LE, info="orbinum-stealth-v1") % suborder
|
|
1660
2487
|
*/
|
|
1661
2488
|
declare class NoteBuilder {
|
|
1662
2489
|
/**
|
|
1663
2490
|
* Build a ZkNote from the given inputs.
|
|
1664
2491
|
*
|
|
1665
|
-
* @param input.value
|
|
1666
|
-
* @param input.assetId
|
|
1667
|
-
* @param input.ownerPk
|
|
1668
|
-
* @param input.blinding
|
|
1669
|
-
* @param input.spendingKey
|
|
2492
|
+
* @param input.value Amount in planck (required).
|
|
2493
|
+
* @param input.assetId Asset ID — default 0n (native ORB-Privacy).
|
|
2494
|
+
* @param input.ownerPk Sender's or recipient's global BabyJubJub Ax — default 0n.
|
|
2495
|
+
* @param input.blinding Random scalar — defaults to BigInt(Date.now()).
|
|
2496
|
+
* @param input.spendingKey Secret key for nullifier — default 0n.
|
|
2497
|
+
* @param input.viewingPublicKey Recipient's 32-byte LE packed BJJ ivk. Triggers memo encryption.
|
|
2498
|
+
* @param input.recipientOwnerPk Recipient's global ownerPk. Required with viewingPublicKey
|
|
2499
|
+
* to enable stealth address derivation. Without it, the
|
|
2500
|
+
* commitment uses ownerPk directly (no stealth).
|
|
1670
2501
|
*/
|
|
1671
2502
|
static build(input: NoteInput): Promise<ZkNote>;
|
|
1672
2503
|
/**
|
|
1673
|
-
* Build the
|
|
2504
|
+
* Build the 168-byte ECDH-encrypted memo for a note.
|
|
1674
2505
|
*
|
|
1675
2506
|
* Pure TypeScript implementation — no WASM dependency.
|
|
1676
|
-
* Uses ChaCha20-Poly1305 with
|
|
2507
|
+
* Uses ChaCha20-Poly1305 with ECDH key agreement (BabyJubJub ephemeral keypair).
|
|
1677
2508
|
*
|
|
1678
|
-
* @param note
|
|
1679
|
-
* @param
|
|
1680
|
-
*
|
|
2509
|
+
* @param note The ZkNote whose fields populate the plaintext.
|
|
2510
|
+
* @param recipientIvkPacked 32-byte LE packed BJJ viewing public key of the recipient.
|
|
2511
|
+
* Pass `new Uint8Array(32)` (default) for a public/dummy memo.
|
|
2512
|
+
* @param counterpartyPk 32-byte counterparty BabyJubJub Ax.
|
|
2513
|
+
* Pass `new Uint8Array(32)` (default) for no counterparty.
|
|
1681
2514
|
*/
|
|
1682
|
-
static buildMemo(note: ZkNote,
|
|
2515
|
+
static buildMemo(note: ZkNote, recipientIvkPacked?: Uint8Array, counterpartyPk?: Uint8Array): Uint8Array;
|
|
1683
2516
|
}
|
|
1684
2517
|
|
|
1685
2518
|
/**
|
|
@@ -1687,52 +2520,91 @@ declare class NoteBuilder {
|
|
|
1687
2520
|
*
|
|
1688
2521
|
* Mirrors primitives/encrypted-memo in the node repository; no WASM required.
|
|
1689
2522
|
*
|
|
1690
|
-
* Layout (
|
|
1691
|
-
* nonce(12) || ciphertext(
|
|
2523
|
+
* Layout (176 bytes, ECDH):
|
|
2524
|
+
* nonce(12) || ciphertext+MAC(132) || ephPk_packed(32) = 176
|
|
2525
|
+
*
|
|
2526
|
+
* Plaintext layout (116 bytes):
|
|
2527
|
+
* value_lo(8 LE) || value_hi(8 LE) || owner_pk(32) || blinding(32) || asset_id(4 LE) || counterparty_pk(32)
|
|
1692
2528
|
*
|
|
1693
|
-
*
|
|
1694
|
-
*
|
|
2529
|
+
* value is stored as a 128-bit LE unsigned integer (two uint64 words), supporting
|
|
2530
|
+
* amounts up to ~3.4 × 10^38 planck — well above any realistic token supply.
|
|
1695
2531
|
*
|
|
1696
|
-
*
|
|
1697
|
-
*
|
|
2532
|
+
* v2 key derivation (ECDH):
|
|
2533
|
+
* ephSk = random scalar in [1, BABYJUB_SUBORDER)
|
|
2534
|
+
* ephPk = mulPointEscalar(Base8, ephSk)
|
|
2535
|
+
* sharedPoint = mulPointEscalar(recipientIvk, ephSk) ← or mulPointEscalar(ephPk, ivsk)
|
|
2536
|
+
* sharedSecret = bigintTo32Le(sharedPoint[0]) ← Ax coordinate, 32 bytes LE
|
|
2537
|
+
* key = SHA256(sharedSecret || commitment || "orbinum-note-encryption-v1")
|
|
1698
2538
|
*
|
|
1699
2539
|
* Cipher: ChaCha20-Poly1305 (IETF, 96-bit nonce)
|
|
1700
2540
|
*/
|
|
1701
2541
|
|
|
2542
|
+
/** Memo size: nonce(12) + ciphertext+MAC(132) + ephPk(32) = 176 */
|
|
2543
|
+
declare const ENCRYPTED_MEMO_SIZE: number;
|
|
1702
2544
|
declare const EncryptedMemo: {
|
|
1703
2545
|
/**
|
|
1704
|
-
* Build and encrypt a memo for a note.
|
|
2546
|
+
* Build and encrypt a memo for a note using ECDH (v2, 168 bytes).
|
|
1705
2547
|
*
|
|
1706
|
-
* @param value
|
|
1707
|
-
* @param ownerPk
|
|
1708
|
-
* @param blinding
|
|
1709
|
-
* @param assetId
|
|
1710
|
-
* @param commitment
|
|
1711
|
-
* @param
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
2548
|
+
* @param value Note value in planck.
|
|
2549
|
+
* @param ownerPk 32-byte owner public key (LE).
|
|
2550
|
+
* @param blinding 32-byte blinding scalar (LE).
|
|
2551
|
+
* @param assetId Asset identifier.
|
|
2552
|
+
* @param commitment 32-byte commitment bytes (LE).
|
|
2553
|
+
* @param recipientIvkPacked 32-byte LE-encoded packed BJJ viewing public key
|
|
2554
|
+
* (from PrivacyKeyManager.getViewingPublicKeyPacked() or
|
|
2555
|
+
* decoded from a privacy address).
|
|
2556
|
+
* Pass `new Uint8Array(32)` (all zeros) for a publicly-readable memo.
|
|
2557
|
+
* @param counterpartyPk 32-byte counterparty BJJ Ax. Default: all zeros.
|
|
2558
|
+
* @returns 168-byte encrypted memo: nonce(12) || ciphertext+MAC(124) || ephPk(32).
|
|
1714
2559
|
*/
|
|
1715
|
-
encrypt(value: bigint, ownerPk: Uint8Array, blinding: Uint8Array, assetId: number, commitment: Uint8Array,
|
|
2560
|
+
encrypt(value: bigint, ownerPk: Uint8Array, blinding: Uint8Array, assetId: number, commitment: Uint8Array, recipientIvkPacked: Uint8Array, counterpartyPk?: Uint8Array, ephSkOverride?: Uint8Array): Uint8Array;
|
|
1716
2561
|
/**
|
|
1717
|
-
* Returns a
|
|
1718
|
-
*
|
|
2562
|
+
* Returns a 168-byte public memo encrypted with a zero viewing key.
|
|
2563
|
+
* Decryptable by anyone with `decrypt(memo, commitment, new Uint8Array(32))`.
|
|
2564
|
+
* Convenience alias for `encrypt(..., new Uint8Array(32))`.
|
|
1719
2565
|
*/
|
|
1720
2566
|
encryptPublic(value: bigint, ownerPk: Uint8Array, blinding: Uint8Array, assetId: number, commitment: Uint8Array): Uint8Array;
|
|
1721
2567
|
/**
|
|
1722
|
-
* Returns a
|
|
2568
|
+
* Returns a 168-byte zeroed dummy memo (no information, always valid on-chain).
|
|
1723
2569
|
*/
|
|
1724
2570
|
dummy(): Uint8Array;
|
|
1725
2571
|
/**
|
|
1726
|
-
*
|
|
2572
|
+
* Validates that `bytes` is a properly-sized encrypted memo.
|
|
2573
|
+
* Throws an Error if the length is not ENCRYPTED_MEMO_SIZE (168 bytes).
|
|
2574
|
+
*
|
|
2575
|
+
* Call this at system boundaries (extrinsic builders, precompile encoders)
|
|
2576
|
+
* to catch malformed memos before they reach the chain and fail on-chain.
|
|
2577
|
+
*
|
|
2578
|
+
* @param bytes The memo bytes to validate.
|
|
2579
|
+
* @param context Optional context string included in the error (e.g. 'shield', 'output[0]').
|
|
2580
|
+
*/
|
|
2581
|
+
validate(bytes: Uint8Array, context?: string): void;
|
|
2582
|
+
/**
|
|
2583
|
+
* Decrypt an on-chain EncryptedMemo using the recipient's viewing secret key.
|
|
2584
|
+
* Returns null if decryption fails — wrong key, bad MAC, or malformed memo.
|
|
2585
|
+
* Never throws; safe for scan loops.
|
|
2586
|
+
*
|
|
2587
|
+
* @param memoBytes 168-byte encrypted memo.
|
|
2588
|
+
* @param commitment 32-byte note commitment (LE).
|
|
2589
|
+
* @param viewingSecretKey 32-byte HKDF viewing secret key from deriveViewingSecretKey().
|
|
2590
|
+
*/
|
|
2591
|
+
decrypt(memoBytes: Uint8Array, commitment: Uint8Array, viewingSecretKey: Uint8Array): DecryptedMemo | null;
|
|
2592
|
+
/**
|
|
2593
|
+
* Extract the ECDH shared secret from an encrypted memo using the recipient's viewing secret key.
|
|
1727
2594
|
*
|
|
1728
|
-
*
|
|
2595
|
+
* Used by NoteDecryptor to obtain the shared secret needed for stealth address derivation
|
|
2596
|
+
* without re-running the full decrypt path. Safe to call on any 168-byte memo.
|
|
2597
|
+
*
|
|
2598
|
+
* Returns `new Uint8Array(32)` (all zeros) for public/dummy memos (zero ephPk).
|
|
2599
|
+
* Returns `null` if the memo is malformed or the ephPk is not a valid BJJ point.
|
|
1729
2600
|
* Never throws; safe for scan loops.
|
|
1730
2601
|
*
|
|
1731
|
-
* @param memoBytes
|
|
1732
|
-
* @param
|
|
1733
|
-
* @param recipientVk 32-byte recipient viewing key.
|
|
2602
|
+
* @param memoBytes 168-byte encrypted memo.
|
|
2603
|
+
* @param viewingSecretKey 32-byte HKDF viewing secret key from deriveViewingSecretKey().
|
|
1734
2604
|
*/
|
|
1735
|
-
|
|
2605
|
+
extractSharedSecret(memoBytes: Uint8Array, viewingSecretKey: Uint8Array): Uint8Array | null;
|
|
2606
|
+
/** @internal */
|
|
2607
|
+
_decrypt(memoBytes: Uint8Array, commitment: Uint8Array, viewingSecretKey: Uint8Array): DecryptedMemo | null;
|
|
1736
2608
|
};
|
|
1737
2609
|
|
|
1738
2610
|
/**
|
|
@@ -1751,18 +2623,218 @@ declare const EncryptedMemo: {
|
|
|
1751
2623
|
*/
|
|
1752
2624
|
|
|
1753
2625
|
/**
|
|
1754
|
-
*
|
|
2626
|
+
* Computes the nullifier for a note.
|
|
2627
|
+
* nullifier = Poseidon2(commitment, spendingKey)
|
|
2628
|
+
*
|
|
2629
|
+
* spendingKey must already be in [1, BABYJUB_SUBORDER) as returned by
|
|
2630
|
+
* deriveSpendingKeyFromSignature.
|
|
2631
|
+
*/
|
|
2632
|
+
declare function computeNullifier(commitment: bigint, spendingKey: bigint): bigint;
|
|
2633
|
+
/**
|
|
2634
|
+
* Attempt to decrypt an on-chain commitment using the recipient's viewing secret key.
|
|
1755
2635
|
*
|
|
1756
2636
|
* Returns a fully populated ZkNote if the memo decrypts correctly and the
|
|
1757
2637
|
* recomputed commitment matches the on-chain value.
|
|
1758
2638
|
* Returns null when the note does not belong to this viewer (wrong key, no memo,
|
|
1759
2639
|
* or commitment mismatch).
|
|
1760
2640
|
*
|
|
1761
|
-
* @param commitment
|
|
1762
|
-
* @param
|
|
1763
|
-
* @param spendingKey
|
|
2641
|
+
* @param commitment On-chain commitment record from the indexer.
|
|
2642
|
+
* @param viewingSecretKey 32-byte viewing secret key (from deriveViewingSecretKey / getViewingSecretKey).
|
|
2643
|
+
* @param spendingKey Spending key bigint (for nullifier computation).
|
|
2644
|
+
* @param ownOwnerPk The viewer's global BabyJubJub Ax (ownerPk). Required for stealth detection.
|
|
2645
|
+
* Pass 0n to disable stealth detection (legacy/own-note-only scanning).
|
|
2646
|
+
*/
|
|
2647
|
+
declare function tryDecryptNote(commitment: ScanCommitment, viewingSecretKey: Uint8Array, spendingKey: bigint, ownOwnerPk?: bigint): ZkNote | null;
|
|
2648
|
+
/**
|
|
2649
|
+
* Like tryDecryptNote but also returns a human-readable reason for failure.
|
|
2650
|
+
* Useful for debugging scan issues (wrong key, corrupted memo, commitment mismatch).
|
|
2651
|
+
*/
|
|
2652
|
+
declare function tryDecryptNoteVerbose(commitment: ScanCommitment, viewingSecretKey: Uint8Array, spendingKey: bigint, ownOwnerPk?: bigint): {
|
|
2653
|
+
note: ZkNote | null;
|
|
2654
|
+
reason?: string;
|
|
2655
|
+
};
|
|
2656
|
+
|
|
2657
|
+
/** A single input note for a private transfer. */
|
|
2658
|
+
interface TransferInputNote {
|
|
2659
|
+
nullifier: bigint;
|
|
2660
|
+
/** Note value (planck). */
|
|
2661
|
+
value: bigint;
|
|
2662
|
+
assetId: bigint;
|
|
2663
|
+
ownerPk: bigint;
|
|
2664
|
+
blinding: bigint;
|
|
2665
|
+
spendingKey: bigint;
|
|
2666
|
+
/** Sibling hashes (0x-prefixed, 32-byte LE). */
|
|
2667
|
+
pathSiblings: string[];
|
|
2668
|
+
leafIndex: number;
|
|
2669
|
+
}
|
|
2670
|
+
/** A single output note for a private transfer. */
|
|
2671
|
+
interface TransferOutputNote {
|
|
2672
|
+
/** Commitment as bigint. */
|
|
2673
|
+
commitment: bigint;
|
|
2674
|
+
value: bigint;
|
|
2675
|
+
assetId: bigint;
|
|
2676
|
+
ownerPk: bigint;
|
|
2677
|
+
blinding: bigint;
|
|
2678
|
+
}
|
|
2679
|
+
/**
|
|
2680
|
+
* Inputs required to generate a PrivateTransfer proof.
|
|
2681
|
+
* Supports exactly 2 inputs and 2 recipient outputs (circuit constraint).
|
|
2682
|
+
* The fee is paid to the block author (validator) by the pallet runtime.
|
|
2683
|
+
*/
|
|
2684
|
+
interface PrivateTransferProofInputs {
|
|
2685
|
+
merkleRoot: string;
|
|
2686
|
+
inputs: [TransferInputNote, TransferInputNote];
|
|
2687
|
+
outputs: [TransferOutputNote, TransferOutputNote];
|
|
2688
|
+
/** Gasless fee in planck (default 0n). Must satisfy: input_sum == output_sum + fee */
|
|
2689
|
+
fee?: bigint;
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Generate a Groth16 proof for a PrivateTransfer operation.
|
|
2693
|
+
*/
|
|
2694
|
+
declare function generateTransferProof(params: PrivateTransferProofInputs, options?: {
|
|
2695
|
+
provider?: ArtifactProvider;
|
|
2696
|
+
verbose?: boolean;
|
|
2697
|
+
}): Promise<ProofResult>;
|
|
2698
|
+
|
|
2699
|
+
/**
|
|
2700
|
+
* Selects up to 2 unspent notes that together cover `needed` planck.
|
|
2701
|
+
*
|
|
2702
|
+
* Priority:
|
|
2703
|
+
* 1. A single note whose value >= needed → [note, null] (second input will be a dummy)
|
|
2704
|
+
* 2. The smallest pair whose sum >= needed → [noteA, noteB]
|
|
2705
|
+
* 3. No combination covers needed → null (consolidation via merge required)
|
|
2706
|
+
*
|
|
2707
|
+
* Only unspent notes with value > 0 are considered.
|
|
2708
|
+
*/
|
|
2709
|
+
declare function selectNotes(notes: ZkNote[], needed: bigint): [ZkNote, ZkNote | null] | null;
|
|
2710
|
+
/**
|
|
2711
|
+
* Builds a dummy `TransferInputNote` for use as the second input in a single-note transfer.
|
|
2712
|
+
*
|
|
2713
|
+
* The modified transfer circuit exempts inputs with `value == 0` from Merkle membership,
|
|
2714
|
+
* nullifier derivation, and EdDSA signature checks (Constraints 1–3 are conditional on
|
|
2715
|
+
* `is_dummy[i].out == 0`). Constraint 9 forces the public nullifier to 0 for dummy inputs.
|
|
2716
|
+
*
|
|
2717
|
+
* Security: `IsZero` is a deterministic R1CS gadget — a prover cannot make it return 1
|
|
2718
|
+
* for a non-zero `input_values[i]` without breaking the constraint system.
|
|
2719
|
+
*
|
|
2720
|
+
* @param assetId - Must equal the real input note's assetId (circuit Constraint 7).
|
|
2721
|
+
*/
|
|
2722
|
+
declare function buildDummyTransferInput(assetId: bigint): TransferInputNote;
|
|
2723
|
+
|
|
2724
|
+
/**
|
|
2725
|
+
* Selective disclosure helpers for the Orbinum shielded pool (ECDH Baby Jubjub protocol).
|
|
2726
|
+
*
|
|
2727
|
+
* ## Public signals layout (256 bytes on-chain)
|
|
2728
|
+
* ```
|
|
2729
|
+
* [0..32] commitment — Poseidon4(value, asset_id, owner_pk, blinding) LE
|
|
2730
|
+
* [32..64] auditor_pk_x — Baby Jubjub pk_A.x LE
|
|
2731
|
+
* [64..96] auditor_pk_y — Baby Jubjub pk_A.y LE
|
|
2732
|
+
* [96..128] epk_x — r·G x-coordinate LE
|
|
2733
|
+
* [128..160] epk_y — r·G y-coordinate LE
|
|
2734
|
+
* [160..192] enc_value — masked_value + k0
|
|
2735
|
+
* [192..224] enc_asset_id — masked_asset_id + k1
|
|
2736
|
+
* [224..256] enc_owner_hash — masked_owner_hash + k2
|
|
2737
|
+
* ```
|
|
2738
|
+
*
|
|
2739
|
+
* The runtime verifies the Groth16 proof against the ciphertext.
|
|
2740
|
+
* It never decrypts. Decryption is off-chain with the auditor's BJJ sk.
|
|
2741
|
+
*/
|
|
2742
|
+
|
|
2743
|
+
/**
|
|
2744
|
+
* Derives a Baby Jubjub keypair deterministically from a Substrate signing key.
|
|
2745
|
+
*
|
|
2746
|
+
* ```
|
|
2747
|
+
* bjj_sk = Poseidon(substrate_signing_key) // one-way; does not expose the substrate key
|
|
2748
|
+
* bjj_pk = bjj_sk · G // Baby Jubjub base point
|
|
2749
|
+
* ```
|
|
2750
|
+
*
|
|
2751
|
+
* The `bjj_pk` is registered in `DisclosureRequest` on-chain so the note owner
|
|
2752
|
+
* knows which key to encrypt to.
|
|
2753
|
+
*
|
|
2754
|
+
* @param substrateSigningKey - Raw 32-byte Substrate signing key (sr25519 or ed25519).
|
|
2755
|
+
* @returns `{ sk, pkX, pkY }` — Baby Jubjub secret scalar and public key coordinates.
|
|
2756
|
+
*/
|
|
2757
|
+
declare function deriveBabyJubjubKeypair(substrateSigningKey: Uint8Array): {
|
|
2758
|
+
sk: bigint;
|
|
2759
|
+
pkX: bigint;
|
|
2760
|
+
pkY: bigint;
|
|
2761
|
+
};
|
|
2762
|
+
/**
|
|
2763
|
+
* Packs the 8 public signals into the 256-byte buffer for the `disclose` extrinsic.
|
|
2764
|
+
*
|
|
2765
|
+
* Layout:
|
|
2766
|
+
* ```
|
|
2767
|
+
* [0..32] commitment — 32-byte LE (0x-hex string)
|
|
2768
|
+
* [32..64] auditor_pk_x — 32-byte LE bigint
|
|
2769
|
+
* [64..96] auditor_pk_y — 32-byte LE bigint
|
|
2770
|
+
* [96..128] epk_x — from proofOutput.encryptedData.epkX
|
|
2771
|
+
* [128..160] epk_y — from proofOutput.encryptedData.epkY
|
|
2772
|
+
* [160..192] enc_value — from proofOutput.encryptedData.encValue
|
|
2773
|
+
* [192..224] enc_asset_id — from proofOutput.encryptedData.encAssetId
|
|
2774
|
+
* [224..256] enc_owner_hash — from proofOutput.encryptedData.encOwnerHash
|
|
2775
|
+
* ```
|
|
2776
|
+
*
|
|
2777
|
+
* @param commitment - 0x-prefixed 32-byte hex commitment.
|
|
2778
|
+
* @param auditorPkX - Auditor's Baby Jubjub pk x-coordinate (bigint LE).
|
|
2779
|
+
* @param auditorPkY - Auditor's Baby Jubjub pk y-coordinate (bigint LE).
|
|
2780
|
+
* @param proofOutput - Output of `generateDisclosureProof`.
|
|
2781
|
+
* @returns `number[]` — 256 bytes, SCALE-compatible.
|
|
2782
|
+
*/
|
|
2783
|
+
declare function buildDisclosurePublicSignals(commitment: string, auditorPkX: bigint, auditorPkY: bigint, proofOutput: DisclosureProofOutput): number[];
|
|
2784
|
+
/**
|
|
2785
|
+
* Decrypts encrypted disclosure signals using the auditor's Baby Jubjub secret key.
|
|
2786
|
+
*
|
|
2787
|
+
* ```
|
|
2788
|
+
* shared = sk_A · epk (ECDH — Baby Jubjub scalar mult)
|
|
2789
|
+
* k_i = Poseidon(shared.x, shared.y, i)
|
|
2790
|
+
* plaintext_i = (enc_i - k_i + BN254_R) % BN254_R
|
|
2791
|
+
* ```
|
|
2792
|
+
*
|
|
2793
|
+
* Only the intended auditor (holder of `auditorBjjSk`) can decrypt.
|
|
2794
|
+
* This runs entirely off-chain — the runtime never sees or derives `sk`.
|
|
2795
|
+
*
|
|
2796
|
+
* @param auditorBjjSk - Auditor's Baby Jubjub secret scalar (from `deriveBabyJubjubKeypair`).
|
|
2797
|
+
* @param enc - Encrypted signals from `DisclosureRecord.signals` (as bigints).
|
|
2798
|
+
* @returns `{ value, assetId, ownerHash }` — decrypted field elements.
|
|
2799
|
+
* If a field was not disclosed, its ciphertext is `k_i` and the plaintext decrypts to `0`.
|
|
2800
|
+
*/
|
|
2801
|
+
declare function decryptDisclosureSignals(auditorBjjSk: bigint, enc: {
|
|
2802
|
+
epkX: bigint;
|
|
2803
|
+
epkY: bigint;
|
|
2804
|
+
encValue: bigint;
|
|
2805
|
+
encAssetId: bigint;
|
|
2806
|
+
encOwnerHash: bigint;
|
|
2807
|
+
}): {
|
|
2808
|
+
value: bigint;
|
|
2809
|
+
assetId: bigint;
|
|
2810
|
+
ownerHash: bigint;
|
|
2811
|
+
};
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* BN254 (alt_bn128) scalar field prime.
|
|
2815
|
+
*
|
|
2816
|
+
* Used as the modulus for Poseidon blinding factors: blinding ∈ [1, BN254_R).
|
|
2817
|
+
* A random 32-byte value reduced mod BN254_R gives a uniform blinding factor.
|
|
1764
2818
|
*/
|
|
1765
|
-
declare
|
|
2819
|
+
declare const BN254_R = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
2820
|
+
/**
|
|
2821
|
+
* Baby JubJub prime subgroup order.
|
|
2822
|
+
*
|
|
2823
|
+
* Spending keys (circuit scalars) MUST be in [1, BABYJUB_SUBORDER).
|
|
2824
|
+
* circomlib's BabyPbk uses Num2Bits(253) which asserts sk < 2^253.
|
|
2825
|
+
* BABYJUB_SUBORDER < 2^252 < 2^253 satisfies both the curve arithmetic
|
|
2826
|
+
* requirement and the circuit constraint.
|
|
2827
|
+
*/
|
|
2828
|
+
declare const BABYJUB_SUBORDER = 2736030358979909402780800718157159386076813972158567259200215660948447373041n;
|
|
2829
|
+
|
|
2830
|
+
/**
|
|
2831
|
+
* Generate a cryptographically random Poseidon blinding factor.
|
|
2832
|
+
*
|
|
2833
|
+
* Produces a uniform random value in [1, BN254_R) by reading 32 random bytes
|
|
2834
|
+
* and reducing mod BN254_R. The zero case is mapped to 1 to guarantee the
|
|
2835
|
+
* blinding factor is never zero.
|
|
2836
|
+
*/
|
|
2837
|
+
declare function randomBlinding(): bigint;
|
|
1766
2838
|
|
|
1767
2839
|
/**
|
|
1768
2840
|
* PrivacyKeys
|
|
@@ -1770,40 +2842,83 @@ declare function tryDecryptNote(commitment: ScanCommitment, viewingKey: Uint8Arr
|
|
|
1770
2842
|
* Pure cryptographic derivation functions for the Orbinum shielded pool identity.
|
|
1771
2843
|
* These are protocol-level operations — independent of storage, UI, or session.
|
|
1772
2844
|
*
|
|
1773
|
-
* Derivation scheme:
|
|
1774
|
-
*
|
|
1775
|
-
*
|
|
2845
|
+
* Derivation scheme (ECDH viewing key — v2):
|
|
2846
|
+
* viewingSecretKey (ivsk) = HKDF-SHA256(ikm=spendingKey_bytes, info="orbinum-ivk-v1") → 32 bytes
|
|
2847
|
+
* ivsk_scalar = BigInt(ivsk_BE) % BABYJUB_SUBORDER (clamped to [1, ∞))
|
|
2848
|
+
* viewingPublicKey (ivk) = BJJ_mul(Base8, ivsk_scalar) → packPoint([Ax, Ay]) → 32-byte bigint stored LE
|
|
2849
|
+
* ownerPk = BabyJubJub Ax from (spendingKey * Base8) → bigint
|
|
1776
2850
|
*
|
|
1777
2851
|
* Spending key derivation (from wallet signature):
|
|
1778
|
-
* message
|
|
1779
|
-
* skBytes
|
|
1780
|
-
* spendingKey = BigInt(skBytes_as_big_endian) %
|
|
2852
|
+
* message = "orbinum-spending-key-v1\n${chainId}\n${address.toLowerCase()}"
|
|
2853
|
+
* skBytes = HKDF-SHA256(ikm=sig_bytes, salt=empty, info="orbinum-sk-v1:${chainId}:${address}")
|
|
2854
|
+
* spendingKey = BigInt(skBytes_as_big_endian) % BABYJUB_SUBORDER (if 0 → 1)
|
|
1781
2855
|
*
|
|
1782
|
-
*
|
|
1783
|
-
*
|
|
2856
|
+
* IMPORTANT: must reduce mod BABYJUB_SUBORDER (not BN254_R). circomlib's BabyPbk uses
|
|
2857
|
+
* Num2Bits(253) which asserts spending_key < 2^253. BABYJUB_SUBORDER < 2^252 satisfies
|
|
2858
|
+
* this. BN254_R ≈ 2^254.8 does not — ~34% of values would exceed 2^253 at runtime.
|
|
1784
2859
|
*/
|
|
1785
2860
|
/**
|
|
1786
2861
|
* Returns the message string the user must sign with their wallet to derive
|
|
1787
2862
|
* a deterministic Orbinum spending key.
|
|
1788
2863
|
*/
|
|
1789
2864
|
declare function deriveSpendingKeyMessage(chainId: number, address: string): string;
|
|
2865
|
+
/**
|
|
2866
|
+
* Derives the 32-byte master key bytes from a wallet signature.
|
|
2867
|
+
*
|
|
2868
|
+
* masterBytes = HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-v1:{chainId}:{address}")
|
|
2869
|
+
*
|
|
2870
|
+
* These bytes are the stable root for ALL derived keys:
|
|
2871
|
+
* - spendingKey (circuit scalar) = BigInt(masterBytes) % BABYJUB_SUBORDER
|
|
2872
|
+
* - viewingSecretKey = HKDF(bigintTo32Le(spendingKey), info="orbinum-ivk-v1")
|
|
2873
|
+
* - vaultKey = HKDF(masterBytes, info="orbinum-vault-key-v1")
|
|
2874
|
+
*
|
|
2875
|
+
* Separating masterBytes from the circuit scalar means the viewingSecretKey and
|
|
2876
|
+
* vault key are STABLE across any future change to the modulus — they never
|
|
2877
|
+
* depend on which prime field the circuit uses.
|
|
2878
|
+
*/
|
|
2879
|
+
declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, address: string): Promise<Uint8Array>;
|
|
1790
2880
|
/**
|
|
1791
2881
|
* Derives an Orbinum spending key from a wallet signature.
|
|
1792
2882
|
*
|
|
1793
2883
|
* Uses HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-v1:{chainId}:{address}")
|
|
1794
|
-
* and reduces the resulting 32-byte value modulo
|
|
2884
|
+
* and reduces the resulting 32-byte value modulo BABYJUB_SUBORDER.
|
|
2885
|
+
*
|
|
2886
|
+
* IMPORTANT: viewingSecretKey and vaultKey must be derived from masterBytes (via
|
|
2887
|
+
* deriveMasterKeyBytes), NOT from this spending key scalar. This ensures those
|
|
2888
|
+
* keys remain stable if the circuit's modulus ever changes again.
|
|
1795
2889
|
*
|
|
1796
2890
|
* @param signatureHex 0x-prefixed or bare hex of the wallet signature.
|
|
1797
2891
|
* @param chainId Chain ID used when building the signing message.
|
|
1798
2892
|
* @param address Signer address (EVM or SS58) used in the signing message.
|
|
1799
|
-
* @returns bigint in [1,
|
|
2893
|
+
* @returns bigint in [1, BABYJUB_SUBORDER)
|
|
1800
2894
|
*/
|
|
1801
2895
|
declare function deriveSpendingKeyFromSignature(signatureHex: string, chainId: number, address: string): Promise<bigint>;
|
|
1802
2896
|
/**
|
|
1803
|
-
* Derive a 32-byte viewing key from
|
|
1804
|
-
*
|
|
2897
|
+
* Derive a 32-byte viewing secret key (ivsk) from the spending key.
|
|
2898
|
+
* ivsk = HKDF-SHA256(ikm=bigintTo32Le(spendingKey), info="orbinum-ivk-v1")
|
|
2899
|
+
*
|
|
2900
|
+
* The ivsk is intentionally derived from the already-reduced spending key scalar
|
|
2901
|
+
* (not from masterBytes) so that it stays bound to the specific key identity
|
|
2902
|
+
* loaded in this session. The spendingKey must already be in [1, BABYJUB_SUBORDER).
|
|
2903
|
+
*
|
|
2904
|
+
* SECURITY: This is a symmetric secret — never embed it in a shareable address.
|
|
2905
|
+
* Use deriveViewingPublicKey() to obtain the public component for sharing.
|
|
2906
|
+
*/
|
|
2907
|
+
declare function deriveViewingSecretKey(spendingKey: bigint): Uint8Array;
|
|
2908
|
+
/**
|
|
2909
|
+
* Derive the packed BabyJubJub viewing public key (ivk) from ivsk bytes.
|
|
2910
|
+
*
|
|
2911
|
+
* ivsk_scalar = BigInt(ivsk_bytes_BE) % BABYJUB_SUBORDER (clamped to [1, ∞))
|
|
2912
|
+
* ivk_point = mulPointEscalar(Base8, ivsk_scalar) → [Ax, Ay]
|
|
2913
|
+
* result = bigintTo32Le(packPoint([Ax, Ay])) → 32-byte Uint8Array (LE)
|
|
2914
|
+
*
|
|
2915
|
+
* The packed bigint is stored in little-endian so it is consistent with the
|
|
2916
|
+
* rest of the SDK's 32-byte scalar encoding (bigintTo32Le / bytesToBigintLE).
|
|
2917
|
+
*
|
|
2918
|
+
* @param ivsk 32-byte HKDF output from deriveViewingSecretKey().
|
|
2919
|
+
* @returns 32-byte LE-encoded packed BJJ point (goes in the privacy address).
|
|
1805
2920
|
*/
|
|
1806
|
-
declare function
|
|
2921
|
+
declare function deriveViewingPublicKey(ivsk: Uint8Array): Uint8Array;
|
|
1807
2922
|
/**
|
|
1808
2923
|
* Derive the BabyJubJub Ax (x-coordinate of the public key) from a spending key.
|
|
1809
2924
|
* ownerPk = (spendingKey * BabyJubJub.Base8)[0]
|
|
@@ -1820,58 +2935,111 @@ declare function deriveOwnerPk(spendingKey: bigint): bigint;
|
|
|
1820
2935
|
*
|
|
1821
2936
|
* Create one instance per user session:
|
|
1822
2937
|
* const pkm = new PrivacyKeyManager();
|
|
1823
|
-
* await pkm.load(spendingKey);
|
|
2938
|
+
* await pkm.load(spendingKey, masterBytes);
|
|
1824
2939
|
*
|
|
1825
2940
|
* The caller (application layer) is responsible for key persistence and session
|
|
1826
2941
|
* caching. Each instance holds independent state — safe for multi-wallet use.
|
|
1827
2942
|
*
|
|
1828
|
-
* Derivation scheme:
|
|
1829
|
-
*
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
2943
|
+
* Derivation scheme (from wallet signature):
|
|
2944
|
+
* sig → HKDF → masterBytes (32 bytes, stable root for all derived keys)
|
|
2945
|
+
* ├── spendingKey = BigInt(masterBytes) % BABYJUB_SUBORDER (circuit scalar)
|
|
2946
|
+
* ├── viewingSecretKey = HKDF(bigintTo32Le(spendingKey), info="orbinum-ivk-v1") ← NEVER shared
|
|
2947
|
+
* ├── viewingPublicKey = packPoint(BJJ_mul(Base8, ivsk_scalar)) ← embedded in privacy address
|
|
2948
|
+
* ├── ownerPk = BabyJubJub Ax from (spendingKey × Base8)
|
|
2949
|
+
* └── vaultKey = HKDF(masterBytes, info="orbinum-vault-key-v1") ← stable
|
|
2950
|
+
*
|
|
2951
|
+
* Cache format: "mk:0x{masterBytes_hex}" — storing masterBytes (not the sk scalar)
|
|
2952
|
+
* ensures the vault key remains stable if the circuit modulus ever changes.
|
|
1832
2953
|
*/
|
|
1833
2954
|
declare class PrivacyKeyManager {
|
|
1834
2955
|
private _state;
|
|
1835
2956
|
/**
|
|
1836
|
-
* Load a spending key into the in-memory session.
|
|
1837
|
-
* Derives
|
|
2957
|
+
* Load a spending key and its corresponding master bytes into the in-memory session.
|
|
2958
|
+
* Derives viewingSecretKey, viewingPublicKeyPacked, and ownerPk immediately.
|
|
1838
2959
|
* Replaces any previously loaded key.
|
|
2960
|
+
*
|
|
2961
|
+
* @param spendingKey Circuit scalar: BigInt(masterBytes) % BABYJUB_SUBORDER, clamped to [1, ∞).
|
|
2962
|
+
* @param masterBytes Raw 32-byte HKDF output before modular reduction. Used to derive
|
|
2963
|
+
* the stable vault key (HKDF(masterBytes, info="orbinum-vault-key-v1")).
|
|
1839
2964
|
*/
|
|
1840
|
-
load(spendingKey: bigint): Promise<void>;
|
|
2965
|
+
load(spendingKey: bigint, masterBytes: Uint8Array): Promise<void>;
|
|
1841
2966
|
/** Clear all key material from memory. Call on vault lock / sign-out. */
|
|
1842
2967
|
clear(): void;
|
|
1843
2968
|
/** Returns true if a spending key has been loaded. */
|
|
1844
2969
|
isLoaded(): boolean;
|
|
1845
2970
|
/** Returns the spending key. Throws if not loaded. */
|
|
1846
2971
|
getSpendingKey(): bigint;
|
|
1847
|
-
/**
|
|
1848
|
-
|
|
2972
|
+
/**
|
|
2973
|
+
* Returns the 32-byte viewing secret key (ivsk).
|
|
2974
|
+
* Used internally for decrypting received notes during rescan.
|
|
2975
|
+
* SECURITY: never expose this in addresses or network requests.
|
|
2976
|
+
* Throws if not loaded.
|
|
2977
|
+
*/
|
|
2978
|
+
getViewingSecretKey(): Uint8Array;
|
|
2979
|
+
/**
|
|
2980
|
+
* Returns the 32-byte LE-encoded packed BJJ viewing public key (ivk).
|
|
2981
|
+
* This is the component embedded in the privacy address and passed to senders
|
|
2982
|
+
* so they can encrypt memos only the recipient can decrypt.
|
|
2983
|
+
* Throws if not loaded.
|
|
2984
|
+
*/
|
|
2985
|
+
getViewingPublicKeyPacked(): Uint8Array;
|
|
1849
2986
|
/** Returns the BabyJubJub owner public key (x-coordinate). Throws if not loaded. */
|
|
1850
2987
|
getOwnerPk(): bigint;
|
|
1851
2988
|
/** Returns the spending key as a 32-byte little-endian Uint8Array. Throws if not loaded. */
|
|
1852
2989
|
getSpendingKeyBytes(): Uint8Array;
|
|
1853
|
-
/**
|
|
2990
|
+
/**
|
|
2991
|
+
* Returns the 32-byte master key bytes (pre-modulus HKDF output).
|
|
2992
|
+
* Used to derive the stable vault AES key. Throws if not loaded.
|
|
2993
|
+
*/
|
|
2994
|
+
getMasterBytes(): Uint8Array;
|
|
2995
|
+
/**
|
|
2996
|
+
* Exports the master key bytes as a "mk:0x{hex}" string.
|
|
2997
|
+
* Storing masterBytes (not the sk scalar) ensures the vault key and
|
|
2998
|
+
* rescan can always be reconstructed regardless of any future modulus change.
|
|
2999
|
+
* Throws if not loaded.
|
|
3000
|
+
*/
|
|
1854
3001
|
exportHex(): string;
|
|
1855
3002
|
/**
|
|
1856
|
-
*
|
|
1857
|
-
*
|
|
3003
|
+
* Exports a shareable privacy address encoding the owner public key and
|
|
3004
|
+
* viewing PUBLIC key of the currently loaded identity.
|
|
3005
|
+
*
|
|
3006
|
+
* Format: `orbpriv1:{ownerPk_hex}:{viewingPublicKey_hex}`
|
|
3007
|
+
*
|
|
3008
|
+
* The recipient uses this address so the sender can:
|
|
3009
|
+
* 1. Embed `ownerPk` in the note commitment (Poseidon4 input).
|
|
3010
|
+
* 2. Encrypt the memo via ECDH with the recipient's `viewingPublicKey`.
|
|
3011
|
+
*
|
|
3012
|
+
* SECURITY: Only the viewing PUBLIC key is embedded — the viewing secret key
|
|
3013
|
+
* (used for decryption) is never exported. Holders of this address cannot
|
|
3014
|
+
* decrypt the recipient's notes.
|
|
3015
|
+
*
|
|
3016
|
+
* Throws if no key is loaded.
|
|
3017
|
+
*/
|
|
3018
|
+
encodePrivacyAddress(): string;
|
|
3019
|
+
/**
|
|
3020
|
+
* Decode a privacy address of the form `orbpriv1:{ownerPk_hex}:{viewingPublicKey_hex}`.
|
|
3021
|
+
* Returns `{ ownerPkHex, viewingPublicKeyHex }` on success, or `null` if the input
|
|
3022
|
+
* does not match the expected format.
|
|
3023
|
+
*/
|
|
3024
|
+
static decodePrivacyAddress(address: string): {
|
|
3025
|
+
ownerPkHex: string;
|
|
3026
|
+
viewingPublicKeyHex: string;
|
|
3027
|
+
} | null;
|
|
3028
|
+
/**
|
|
3029
|
+
* Load keys from a cached "mk:0x{masterBytes_hex}" string produced by exportHex().
|
|
3030
|
+
* Throws if the format is invalid or masterBytes length is not 32 bytes.
|
|
1858
3031
|
*/
|
|
1859
3032
|
importFromHex(hex: string): Promise<void>;
|
|
1860
3033
|
}
|
|
1861
3034
|
|
|
1862
3035
|
/**
|
|
1863
|
-
*
|
|
3036
|
+
* VaultJson
|
|
1864
3037
|
*
|
|
1865
|
-
*
|
|
1866
|
-
* Works in browser and Node.js 18+ (both expose the WebCrypto API as `crypto`).
|
|
1867
|
-
* Pure functions — no state, no side effects.
|
|
1868
|
-
*
|
|
1869
|
-
* Key derivation: HKDF-SHA-256(ikm=spendingKeyBytes, salt=empty, info="orbinum-vault-key-v1")
|
|
1870
|
-
* Cipher: AES-GCM 256
|
|
3038
|
+
* BigInt-safe JSON helpers for Orbinum vault payloads.
|
|
1871
3039
|
*
|
|
1872
|
-
* BigInt
|
|
1873
|
-
* `JSON.stringify` never receives a bigint
|
|
1874
|
-
* for
|
|
3040
|
+
* BigInt values are serialised as `{ __bigint: "<decimal string>" }` so that
|
|
3041
|
+
* `JSON.stringify` never receives a native bigint (which it cannot handle).
|
|
3042
|
+
* Use `vaultReplacer` / `vaultReviver` for every vault read/write operation.
|
|
1875
3043
|
*/
|
|
1876
3044
|
/**
|
|
1877
3045
|
* `JSON.stringify` replacer that serialises bigint values as
|
|
@@ -1883,30 +3051,239 @@ declare function vaultReplacer(_key: string, value: unknown): unknown;
|
|
|
1883
3051
|
* back into native bigint values.
|
|
1884
3052
|
*/
|
|
1885
3053
|
declare function vaultReviver(_key: string, value: unknown): unknown;
|
|
3054
|
+
|
|
3055
|
+
/**
|
|
3056
|
+
* VaultCrypto
|
|
3057
|
+
*
|
|
3058
|
+
* WebCrypto-based encryption utilities for protecting Orbinum vault data.
|
|
3059
|
+
* Works in browser and Node.js 18+ (both expose the WebCrypto API as `crypto`).
|
|
3060
|
+
* Pure functions — no state, no side effects.
|
|
3061
|
+
*
|
|
3062
|
+
* Key derivation: HKDF-SHA-256(ikm=masterBytes, salt=empty, info="orbinum-vault-key-v1")
|
|
3063
|
+
* Cipher: AES-GCM 256
|
|
3064
|
+
*/
|
|
1886
3065
|
/**
|
|
1887
|
-
* Derives an AES-GCM-256 CryptoKey from
|
|
1888
|
-
*
|
|
1889
|
-
*
|
|
3066
|
+
* Derives an AES-GCM-256 CryptoKey from master key bytes using HKDF-SHA-256.
|
|
3067
|
+
*
|
|
3068
|
+
* IMPORTANT: pass masterBytes from deriveMasterKeyBytes(), NOT bigintTo32Le(spendingKey).
|
|
3069
|
+
* The vault key must be stable across circuit field changes — it depends only on
|
|
3070
|
+
* the wallet signature, never on the modulus used to reduce the circuit scalar.
|
|
1890
3071
|
*
|
|
1891
|
-
* @param
|
|
3072
|
+
* @param masterBytes 32-byte pre-modulus key material from deriveMasterKeyBytes().
|
|
1892
3073
|
*/
|
|
1893
|
-
declare function deriveVaultKey(
|
|
3074
|
+
declare function deriveVaultKey(masterBytes: Uint8Array): Promise<CryptoKey>;
|
|
1894
3075
|
/**
|
|
1895
3076
|
* Serialises `payload` to JSON (bigint-safe) and encrypts it with AES-GCM.
|
|
1896
3077
|
* Returns base64-encoded `iv` and `ciphertext`.
|
|
1897
3078
|
*/
|
|
1898
|
-
declare function encryptJson(key: CryptoKey, payload: unknown): Promise<{
|
|
1899
|
-
iv: string;
|
|
1900
|
-
ciphertext: string;
|
|
1901
|
-
}>;
|
|
3079
|
+
declare function encryptJson(key: CryptoKey, payload: unknown): Promise<{
|
|
3080
|
+
iv: string;
|
|
3081
|
+
ciphertext: string;
|
|
3082
|
+
}>;
|
|
3083
|
+
/**
|
|
3084
|
+
* Decrypts AES-GCM ciphertext and parses the JSON payload (bigint-safe).
|
|
3085
|
+
* Throws `DOMException` on authentication failure (wrong key or corrupted data).
|
|
3086
|
+
*/
|
|
3087
|
+
declare function decryptJson(key: CryptoKey, iv: string, ciphertext: string): Promise<unknown>;
|
|
3088
|
+
|
|
3089
|
+
/**
|
|
3090
|
+
* Vault protocol types.
|
|
3091
|
+
*
|
|
3092
|
+
* These types define the storage contract for vault note records.
|
|
3093
|
+
* Any backend (IndexedDB, SQLite, remote…) must produce/consume this shape
|
|
3094
|
+
* so that encryptNote / decryptNoteRecord work without modification.
|
|
3095
|
+
*/
|
|
3096
|
+
/** A single encrypted note record as stored in the vault backend. */
|
|
3097
|
+
interface EncryptedNoteRecord {
|
|
3098
|
+
/** Primary key — note commitmentHex */
|
|
3099
|
+
commitmentHex: string;
|
|
3100
|
+
/** AES-GCM IV for this record — base64 */
|
|
3101
|
+
iv: string;
|
|
3102
|
+
/** AES-GCM ciphertext of the full ZkNote JSON — base64 */
|
|
3103
|
+
ciphertext: string;
|
|
3104
|
+
/** Unencrypted nullifierHex for quick spent-check without unlocking */
|
|
3105
|
+
nullifierHex: string;
|
|
3106
|
+
/** Unencrypted assetId (string form of bigint) for filtering */
|
|
3107
|
+
assetId: string;
|
|
3108
|
+
/** Whether the note has already been spent/nullified on-chain. */
|
|
3109
|
+
spent?: boolean;
|
|
3110
|
+
/** When the app marked the note as spent locally, if known. */
|
|
3111
|
+
spentAt?: number | null;
|
|
3112
|
+
updatedAt: number;
|
|
3113
|
+
}
|
|
3114
|
+
/** Partial update applied to a note's spent status without re-encrypting the full payload. */
|
|
3115
|
+
interface NoteStatusUpdate {
|
|
3116
|
+
spent?: boolean;
|
|
3117
|
+
spentAt?: number | null;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
/**
|
|
3121
|
+
* Vault protocol errors.
|
|
3122
|
+
*/
|
|
3123
|
+
/** Thrown when a vault operation is attempted while the vault is locked. */
|
|
3124
|
+
declare class VaultLockedError extends Error {
|
|
3125
|
+
constructor(message?: string);
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
/**
|
|
3129
|
+
* noteOps
|
|
3130
|
+
*
|
|
3131
|
+
* Pure protocol-level operations on vault notes.
|
|
3132
|
+
* No Zustand, no IndexedDB — pure data transformations.
|
|
3133
|
+
*/
|
|
3134
|
+
|
|
3135
|
+
/**
|
|
3136
|
+
* Merges a NoteStatusUpdate into a ZkNote, applying defaults for missing fields.
|
|
3137
|
+
* Returns a new note object — does not mutate the original.
|
|
3138
|
+
*/
|
|
3139
|
+
declare function applyNoteStatus(note: ZkNote, status?: NoteStatusUpdate): ZkNote;
|
|
3140
|
+
/**
|
|
3141
|
+
* Encrypts a ZkNote into an EncryptedNoteRecord using AES-GCM.
|
|
3142
|
+
* The commitmentHex, nullifierHex, and assetId are stored in plaintext
|
|
3143
|
+
* for efficient filtering without requiring vault unlock.
|
|
3144
|
+
*/
|
|
3145
|
+
declare function encryptNote(key: CryptoKey, note: ZkNote): Promise<EncryptedNoteRecord>;
|
|
3146
|
+
/**
|
|
3147
|
+
* Decrypts an EncryptedNoteRecord back into a ZkNote using AES-GCM.
|
|
3148
|
+
* Applies the record's spent/spentAt metadata onto the decrypted note.
|
|
3149
|
+
* Throws DOMException on authentication failure (wrong key or corrupted data).
|
|
3150
|
+
*/
|
|
3151
|
+
declare function decryptNoteRecord(key: CryptoKey, rec: EncryptedNoteRecord): Promise<ZkNote>;
|
|
3152
|
+
|
|
3153
|
+
/**
|
|
3154
|
+
* Inputs required to generate an Unshield proof.
|
|
3155
|
+
*
|
|
3156
|
+
* All BigInt values must be BN254 scalar field elements.
|
|
3157
|
+
* All hex strings must be 0x-prefixed 32-byte little-endian values (as
|
|
3158
|
+
* returned by the node RPC).
|
|
3159
|
+
*/
|
|
3160
|
+
interface UnshieldProofInputs {
|
|
3161
|
+
/** Merkle root (0x-prefixed, 32-byte LE). */
|
|
3162
|
+
merkleRoot: string;
|
|
3163
|
+
/** Nullifier as bigint. */
|
|
3164
|
+
nullifier: bigint;
|
|
3165
|
+
/** Net withdrawal amount (recipient receives this, planck). */
|
|
3166
|
+
amount: bigint;
|
|
3167
|
+
/** Asset ID. */
|
|
3168
|
+
assetId: bigint;
|
|
3169
|
+
/**
|
|
3170
|
+
* Recipient encoded as a BN254 field element.
|
|
3171
|
+
* For Substrate addresses: Poseidon(le32(accountId32)).
|
|
3172
|
+
*/
|
|
3173
|
+
recipient: bigint;
|
|
3174
|
+
/** Note blinding factor. */
|
|
3175
|
+
blinding: bigint;
|
|
3176
|
+
/** Spending key used to derive the nullifier. */
|
|
3177
|
+
spendingKey: bigint;
|
|
3178
|
+
/** Sibling hashes (0x-prefixed, 32-byte LE), one per tree level. */
|
|
3179
|
+
pathSiblings: string[];
|
|
3180
|
+
/** Leaf index of the commitment in the Merkle tree. */
|
|
3181
|
+
leafIndex: number;
|
|
3182
|
+
/** Gasless fee in planck (default 0n). note_value == amount + fee + changeValue in circuit. */
|
|
3183
|
+
fee?: bigint;
|
|
3184
|
+
/**
|
|
3185
|
+
* Value of the change note in planck (default 0n = total unshield).
|
|
3186
|
+
* Must satisfy: note_value == amount + fee + changeValue.
|
|
3187
|
+
*/
|
|
3188
|
+
changeValue?: bigint;
|
|
3189
|
+
/**
|
|
3190
|
+
* Blinding scalar for the change note commitment.
|
|
3191
|
+
* Auto-generated with CSPRNG when changeValue > 0n and not provided.
|
|
3192
|
+
*/
|
|
3193
|
+
changeBlinding?: bigint;
|
|
3194
|
+
/**
|
|
3195
|
+
* BabyJubJub Ax coordinate of the change note owner (default: derived from spendingKey,
|
|
3196
|
+
* i.e. the change stays with the same owner).
|
|
3197
|
+
*/
|
|
3198
|
+
changeOwnerPubkey?: bigint;
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* Result of `generateUnshieldProof`.
|
|
3202
|
+
*
|
|
3203
|
+
* Extends `ProofResult` with the change note commitment, value, blinding, and owner pubkey
|
|
3204
|
+
* so the caller can pass them directly to the `unshield` extrinsic and generate the
|
|
3205
|
+
* encrypted memo for change note recovery.
|
|
3206
|
+
*/
|
|
3207
|
+
interface UnshieldProofResult extends ProofResult {
|
|
3208
|
+
/** Poseidon4(changeValue, assetId, changeOwnerPubkey, changeBlinding). 0n for total unshield. */
|
|
3209
|
+
changeCommitment: bigint;
|
|
3210
|
+
/** Change value used (mirrors inputs.changeValue ?? 0n). */
|
|
3211
|
+
changeValue: bigint;
|
|
3212
|
+
/** Blinding factor for the change note (0n for total unshield). */
|
|
3213
|
+
changeBlinding: bigint;
|
|
3214
|
+
/** Owner pubkey for the change note (derived from spendingKey if not provided). */
|
|
3215
|
+
changeOwnerPubkey: bigint;
|
|
3216
|
+
}
|
|
3217
|
+
/**
|
|
3218
|
+
* Generate a Groth16 proof for an Unshield operation.
|
|
3219
|
+
*
|
|
3220
|
+
* @param inputs - All private and public inputs for the unshield circuit.
|
|
3221
|
+
* @param options.provider - Override the artifact provider (default: CDN).
|
|
3222
|
+
* @param options.verbose - Log proof generation steps to console.
|
|
3223
|
+
*/
|
|
3224
|
+
declare function generateUnshieldProof(inputs: UnshieldProofInputs, options?: {
|
|
3225
|
+
provider?: ArtifactProvider;
|
|
3226
|
+
verbose?: boolean;
|
|
3227
|
+
}): Promise<UnshieldProofResult>;
|
|
3228
|
+
|
|
3229
|
+
/**
|
|
3230
|
+
* Inputs required to generate a fee-claim proof.
|
|
3231
|
+
*
|
|
3232
|
+
* The proof demonstrates that the caller knows the preimage of `commitment`,
|
|
3233
|
+
* specifically that `commitment = Poseidon4(amount, assetId, ownerPubkey, blinding)`.
|
|
3234
|
+
* Both `amount` and `assetId` are revealed as public signals so the pallet can
|
|
3235
|
+
* verify consistency with the extrinsic arguments.
|
|
3236
|
+
*/
|
|
3237
|
+
interface FeeClaimProofInputs {
|
|
3238
|
+
/** Fee amount to claim in planck (must fit in u64). */
|
|
3239
|
+
amount: bigint;
|
|
3240
|
+
/** Asset ID of the fee note. */
|
|
3241
|
+
assetId: bigint;
|
|
3242
|
+
/** Owner public key (BabyJubJub Ax component). */
|
|
3243
|
+
ownerPubkey: bigint;
|
|
3244
|
+
/** Note blinding factor. */
|
|
3245
|
+
blinding: bigint;
|
|
3246
|
+
/** Note commitment as bigint (Poseidon4(amount, assetId, ownerPubkey, blinding)). */
|
|
3247
|
+
commitment: bigint;
|
|
3248
|
+
}
|
|
3249
|
+
/**
|
|
3250
|
+
* Proof output ready to submit with `claim_shielded_fees`.
|
|
3251
|
+
*/
|
|
3252
|
+
interface FeeClaimProofOutput {
|
|
3253
|
+
/** 128-byte compressed Groth16 proof as 0x-prefixed hex. */
|
|
3254
|
+
proof: string;
|
|
3255
|
+
/**
|
|
3256
|
+
* Compact 76-byte public signals as `number[]` (SCALE-compatible).
|
|
3257
|
+
*
|
|
3258
|
+
* Layout: commitment[0..32] | value[32..40] | asset_id[40..44] | owner_hash[44..76]
|
|
3259
|
+
*
|
|
3260
|
+
* Pass directly as the `public_signals` argument of `claim_shielded_fees`.
|
|
3261
|
+
*/
|
|
3262
|
+
publicSignals: number[];
|
|
3263
|
+
}
|
|
3264
|
+
/**
|
|
3265
|
+
* Generate a Groth16 fee-claim proof using the disclosure circuit.
|
|
3266
|
+
*
|
|
3267
|
+
* The resulting proof convinces the pallet that:
|
|
3268
|
+
* 1. The caller knows (amount, assetId, ownerPubkey, blinding) such that
|
|
3269
|
+
* `commitment = Poseidon4(amount, assetId, ownerPubkey, blinding)`.
|
|
3270
|
+
* 2. The revealed `amount` and `assetId` match what will be submitted
|
|
3271
|
+
* on-chain, preventing inflation attacks.
|
|
3272
|
+
*
|
|
3273
|
+
* @param inputs - Note preimage and commitment.
|
|
3274
|
+
* @param options.provider - Override the artifact provider (default: CDN).
|
|
3275
|
+
* @param options.verbose - Log proof generation steps to console.
|
|
3276
|
+
*/
|
|
1902
3277
|
/**
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
3278
|
+
* @deprecated Tech debt — `fees.rs` uses the OLD 76-byte plaintext disclosure layout,
|
|
3279
|
+
* but the disclosure circuit now uses ECDH encryption (256-byte layout).
|
|
3280
|
+
* This function compiles but the resulting proof WILL BE REJECTED by the pallet.
|
|
3281
|
+
* See `frame/shielded-pool/src/operations/fees.rs` comment for resolution options A/B/C.
|
|
1905
3282
|
*/
|
|
1906
|
-
declare function
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
3283
|
+
declare function generateFeeClaimProof(inputs: FeeClaimProofInputs, options?: {
|
|
3284
|
+
provider?: ArtifactProvider;
|
|
3285
|
+
verbose?: boolean;
|
|
3286
|
+
}): Promise<FeeClaimProofOutput>;
|
|
1910
3287
|
|
|
1911
3288
|
/**
|
|
1912
3289
|
* Contract addresses and function selectors for all Orbinum EVM precompiles.
|
|
@@ -1986,14 +3363,21 @@ type ShieldedEvent = {
|
|
|
1986
3363
|
leafIndex: number;
|
|
1987
3364
|
};
|
|
1988
3365
|
/**
|
|
1989
|
-
* Emitted by `private_transfer()
|
|
1990
|
-
* Rust variant: `
|
|
1991
|
-
*
|
|
3366
|
+
* Emitted by `private_transfer()` when input nullifiers are spent.
|
|
3367
|
+
* Rust variant: `NullifiersSpent { nullifiers }`
|
|
3368
|
+
* Emitted independently of CommitmentsInserted to prevent graph correlation.
|
|
1992
3369
|
*/
|
|
1993
|
-
type
|
|
1994
|
-
/** Input nullifiers — max 2. 0x-prefixed 32-byte hex each. */
|
|
3370
|
+
type NullifiersSpentEvent = {
|
|
3371
|
+
/** Input nullifiers consumed — max 2. 0x-prefixed 32-byte hex each. */
|
|
1995
3372
|
nullifiers: string[];
|
|
1996
|
-
|
|
3373
|
+
};
|
|
3374
|
+
/**
|
|
3375
|
+
* Emitted by `private_transfer()` when output commitments are inserted.
|
|
3376
|
+
* Rust variant: `CommitmentsInserted { commitments, encrypted_memos, leaf_indices }`
|
|
3377
|
+
* Emitted independently of NullifiersSpent to prevent graph correlation.
|
|
3378
|
+
*/
|
|
3379
|
+
type CommitmentsInsertedEvent = {
|
|
3380
|
+
/** Output commitments created — max 2. 0x-prefixed 32-byte hex each. */
|
|
1997
3381
|
commitments: string[];
|
|
1998
3382
|
/** Encrypted memos for each output — max 2. */
|
|
1999
3383
|
encryptedMemos: string[];
|
|
@@ -2002,7 +3386,7 @@ type PrivateTransferEvent = {
|
|
|
2002
3386
|
};
|
|
2003
3387
|
/**
|
|
2004
3388
|
* Emitted by `unshield()` when a note is withdrawn to the public chain.
|
|
2005
|
-
* Rust variant: `Unshielded { nullifier, amount, recipient }`
|
|
3389
|
+
* Rust variant: `Unshielded { nullifier, amount, recipient, change_commitment }`
|
|
2006
3390
|
*/
|
|
2007
3391
|
type UnshieldedEvent = {
|
|
2008
3392
|
/** 0x-prefixed 32-byte Poseidon nullifier (LE). */
|
|
@@ -2010,6 +3394,11 @@ type UnshieldedEvent = {
|
|
|
2010
3394
|
amount: bigint;
|
|
2011
3395
|
/** SS58 AccountId of the recipient. */
|
|
2012
3396
|
recipient: string;
|
|
3397
|
+
/**
|
|
3398
|
+
* 0x-prefixed 32-byte change note commitment (LE), or null for total unshield.
|
|
3399
|
+
* When present, the commitment has been inserted into the Merkle tree.
|
|
3400
|
+
*/
|
|
3401
|
+
changeCommitment: string | null;
|
|
2013
3402
|
};
|
|
2014
3403
|
/**
|
|
2015
3404
|
* Emitted after every Merkle tree update (shield / transfer / unshield).
|
|
@@ -2115,8 +3504,11 @@ type ShieldedPoolEvent = {
|
|
|
2115
3504
|
type: 'Shielded';
|
|
2116
3505
|
data: ShieldedEvent;
|
|
2117
3506
|
} | {
|
|
2118
|
-
type: '
|
|
2119
|
-
data:
|
|
3507
|
+
type: 'NullifiersSpent';
|
|
3508
|
+
data: NullifiersSpentEvent;
|
|
3509
|
+
} | {
|
|
3510
|
+
type: 'CommitmentsInserted';
|
|
3511
|
+
data: CommitmentsInsertedEvent;
|
|
2120
3512
|
} | {
|
|
2121
3513
|
type: 'Unshielded';
|
|
2122
3514
|
data: UnshieldedEvent;
|
|
@@ -2501,588 +3893,306 @@ type RevealPrivateLinkArgs = {
|
|
|
2501
3893
|
signature: number[];
|
|
2502
3894
|
};
|
|
2503
3895
|
/**
|
|
2504
|
-
* Call index 17 — `dispatch_as_private_link` (Signed origin, relayer)
|
|
2505
|
-
* Dispatches a RuntimeCall on behalf of an account identified only by a private
|
|
2506
|
-
* link commitment. A Groth16 ZK proof (PRIVATE_LINK circuit) authorises the
|
|
2507
|
-
* dispatch without revealing the external address.
|
|
2508
|
-
*/
|
|
2509
|
-
type DispatchAsPrivateLinkArgs = {
|
|
2510
|
-
/** AccountId on whose behalf to dispatch. */
|
|
2511
|
-
owner: string;
|
|
2512
|
-
/** 32-byte commitment identifying the private link (LE). */
|
|
2513
|
-
commitment: number[];
|
|
2514
|
-
/** Groth16 proof bytes (PRIVATE_LINK circuit). */
|
|
2515
|
-
zkProof: number[];
|
|
2516
|
-
/** SCALE-encoded RuntimeCall to dispatch. */
|
|
2517
|
-
call: number[];
|
|
2518
|
-
};
|
|
2519
|
-
/** All pallet-account-mapping calls as a discriminated union. */
|
|
2520
|
-
type AccountMappingCall = {
|
|
2521
|
-
type: 'mapAccount';
|
|
2522
|
-
} | {
|
|
2523
|
-
type: 'unmapAccount';
|
|
2524
|
-
} | {
|
|
2525
|
-
type: 'registerAlias';
|
|
2526
|
-
args: RegisterAliasArgs;
|
|
2527
|
-
} | {
|
|
2528
|
-
type: 'releaseAlias';
|
|
2529
|
-
} | {
|
|
2530
|
-
type: 'transferAlias';
|
|
2531
|
-
args: TransferAliasArgs;
|
|
2532
|
-
} | {
|
|
2533
|
-
type: 'putAliasOnSale';
|
|
2534
|
-
args: PutAliasOnSaleArgs;
|
|
2535
|
-
} | {
|
|
2536
|
-
type: 'cancelSale';
|
|
2537
|
-
} | {
|
|
2538
|
-
type: 'buyAlias';
|
|
2539
|
-
args: BuyAliasArgs;
|
|
2540
|
-
} | {
|
|
2541
|
-
type: 'addChainLink';
|
|
2542
|
-
args: AddChainLinkArgs;
|
|
2543
|
-
} | {
|
|
2544
|
-
type: 'removeChainLink';
|
|
2545
|
-
args: RemoveChainLinkArgs;
|
|
2546
|
-
} | {
|
|
2547
|
-
type: 'setAccountMetadata';
|
|
2548
|
-
args: SetAccountMetadataArgs;
|
|
2549
|
-
} | {
|
|
2550
|
-
type: 'addSupportedChain';
|
|
2551
|
-
args: AddSupportedChainArgs;
|
|
2552
|
-
} | {
|
|
2553
|
-
type: 'removeSupportedChain';
|
|
2554
|
-
args: RemoveSupportedChainArgs;
|
|
2555
|
-
} | {
|
|
2556
|
-
type: 'dispatchAsLinkedAccount';
|
|
2557
|
-
args: DispatchAsLinkedAccountArgs;
|
|
2558
|
-
} | {
|
|
2559
|
-
type: 'registerPrivateLink';
|
|
2560
|
-
args: RegisterPrivateLinkArgs;
|
|
2561
|
-
} | {
|
|
2562
|
-
type: 'removePrivateLink';
|
|
2563
|
-
args: RemovePrivateLinkArgs;
|
|
2564
|
-
} | {
|
|
2565
|
-
type: 'revealPrivateLink';
|
|
2566
|
-
args: RevealPrivateLinkArgs;
|
|
2567
|
-
} | {
|
|
2568
|
-
type: 'dispatchAsPrivateLink';
|
|
2569
|
-
args: DispatchAsPrivateLinkArgs;
|
|
2570
|
-
};
|
|
2571
|
-
|
|
2572
|
-
/**
|
|
2573
|
-
* TypeScript types for events emitted by pallet-account-mapping.
|
|
2574
|
-
*
|
|
2575
|
-
* Conventions:
|
|
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
|
|
2584
|
-
*/
|
|
2585
|
-
|
|
2586
|
-
/**
|
|
2587
|
-
* Emitted when a Substrate account is mapped to an Ethereum address.
|
|
2588
|
-
* Rust variant: `AccountMapped { account, address }`
|
|
2589
|
-
*/
|
|
2590
|
-
type AccountMappedEvent = {
|
|
2591
|
-
account: string;
|
|
2592
|
-
/** 0x-prefixed 20-byte Ethereum address. */
|
|
2593
|
-
address: string;
|
|
2594
|
-
};
|
|
2595
|
-
/**
|
|
2596
|
-
* Emitted when an existing account mapping is removed.
|
|
2597
|
-
* Rust variant: `AccountUnmapped { account, address }`
|
|
2598
|
-
*/
|
|
2599
|
-
type AccountUnmappedEvent = {
|
|
2600
|
-
account: string;
|
|
2601
|
-
/** 0x-prefixed 20-byte Ethereum address. */
|
|
2602
|
-
address: string;
|
|
2603
|
-
};
|
|
2604
|
-
/**
|
|
2605
|
-
* Emitted by `register_alias()` when a new alias is claimed.
|
|
2606
|
-
* Rust variant: `AliasRegistered { account, alias, evm_address }`
|
|
2607
|
-
*/
|
|
2608
|
-
type AliasRegisteredEvent = {
|
|
2609
|
-
account: string;
|
|
2610
|
-
alias: string;
|
|
2611
|
-
/** Optional EVM address linked at registration time. */
|
|
2612
|
-
evmAddress: string | null;
|
|
2613
|
-
};
|
|
2614
|
-
/**
|
|
2615
|
-
* Emitted when an alias is released (burned / expired).
|
|
2616
|
-
* Rust variant: `AliasReleased { account, alias }`
|
|
2617
|
-
*/
|
|
2618
|
-
type AliasReleasedEvent = {
|
|
2619
|
-
account: string;
|
|
2620
|
-
alias: string;
|
|
2621
|
-
};
|
|
2622
|
-
/**
|
|
2623
|
-
* Emitted by `transfer_alias()` when ownership changes hands.
|
|
2624
|
-
* Rust variant: `AliasTransferred { from, to, alias }`
|
|
2625
|
-
*/
|
|
2626
|
-
type AliasTransferredEvent = {
|
|
2627
|
-
from: string;
|
|
2628
|
-
to: string;
|
|
2629
|
-
alias: string;
|
|
2630
|
-
};
|
|
2631
|
-
/**
|
|
2632
|
-
* Emitted by `put_alias_on_sale()` when an alias is listed on the marketplace.
|
|
2633
|
-
* Rust variant: `AliasListedForSale { seller, alias, price, private }`
|
|
2634
|
-
*/
|
|
2635
|
-
type AliasListedForSaleEvent = {
|
|
2636
|
-
seller: string;
|
|
2637
|
-
alias: string;
|
|
2638
|
-
price: bigint;
|
|
2639
|
-
/** Whether the listing is private (whitelist-only). */
|
|
2640
|
-
private: boolean;
|
|
2641
|
-
};
|
|
2642
|
-
/**
|
|
2643
|
-
* Emitted when an alias listing is cancelled before a sale.
|
|
2644
|
-
* Rust variant: `AliasSaleCancelled { seller, alias }`
|
|
2645
|
-
*/
|
|
2646
|
-
type AliasSaleCancelledEvent = {
|
|
2647
|
-
seller: string;
|
|
2648
|
-
alias: string;
|
|
2649
|
-
};
|
|
2650
|
-
/**
|
|
2651
|
-
* Emitted by `buy_alias()` when an alias is purchased.
|
|
2652
|
-
* Rust variant: `AliasSold { seller, buyer, alias, price }`
|
|
2653
|
-
*/
|
|
2654
|
-
type AliasSoldEvent = {
|
|
2655
|
-
seller: string;
|
|
2656
|
-
buyer: string;
|
|
2657
|
-
alias: string;
|
|
2658
|
-
price: bigint;
|
|
2659
|
-
};
|
|
2660
|
-
/**
|
|
2661
|
-
* Emitted by `add_chain_link()` when an external address is linked.
|
|
2662
|
-
* Rust variant: `ChainLinkAdded { account, chain_id, address }`
|
|
2663
|
-
*/
|
|
2664
|
-
type ChainLinkAddedEvent = {
|
|
2665
|
-
account: string;
|
|
2666
|
-
/** SLIP-0044 coin-type identifying the external chain. */
|
|
2667
|
-
chainId: number;
|
|
2668
|
-
/** Chain-specific address string. */
|
|
2669
|
-
address: string;
|
|
2670
|
-
};
|
|
2671
|
-
/**
|
|
2672
|
-
* Emitted by `remove_chain_link()` when an external address link is removed.
|
|
2673
|
-
* Rust variant: `ChainLinkRemoved { account, chain_id }`
|
|
2674
|
-
*/
|
|
2675
|
-
type ChainLinkRemovedEvent = {
|
|
2676
|
-
account: string;
|
|
2677
|
-
chainId: number;
|
|
2678
|
-
};
|
|
2679
|
-
/**
|
|
2680
|
-
* Emitted by `set_account_metadata()` when an account's metadata is updated.
|
|
2681
|
-
* Rust variant: `MetadataUpdated { account }`
|
|
2682
|
-
*/
|
|
2683
|
-
type MetadataUpdatedEvent = {
|
|
2684
|
-
account: string;
|
|
2685
|
-
};
|
|
2686
|
-
/**
|
|
2687
|
-
* Emitted by `add_supported_chain()` (governance) when a new chain type is whitelisted.
|
|
2688
|
-
* Rust variant: `SupportedChainAdded { chain_id, scheme }`
|
|
2689
|
-
*/
|
|
2690
|
-
type SupportedChainAddedEvent = {
|
|
2691
|
-
chainId: number;
|
|
2692
|
-
scheme: SignatureScheme;
|
|
2693
|
-
};
|
|
2694
|
-
/**
|
|
2695
|
-
* Emitted by `remove_supported_chain()` (governance) when a chain type is removed.
|
|
2696
|
-
* Rust variant: `SupportedChainRemoved { chain_id }`
|
|
2697
|
-
*/
|
|
2698
|
-
type SupportedChainRemovedEvent = {
|
|
2699
|
-
chainId: number;
|
|
2700
|
-
};
|
|
2701
|
-
/**
|
|
2702
|
-
* Emitted after a successful `dispatch_as_linked_account()` call.
|
|
2703
|
-
* Rust variant: `ProxyCallExecuted { owner, chain_id, address }`
|
|
2704
|
-
*/
|
|
2705
|
-
type ProxyCallExecutedEvent = {
|
|
2706
|
-
owner: string;
|
|
2707
|
-
chainId: number;
|
|
2708
|
-
address: string;
|
|
2709
|
-
};
|
|
2710
|
-
/**
|
|
2711
|
-
* Emitted by `register_private_link()` when a private (commitment-based) chain link is added.
|
|
2712
|
-
* Rust variant: `PrivateChainLinkAdded { account, chain_id, commitment }`
|
|
2713
|
-
*/
|
|
2714
|
-
type PrivateChainLinkAddedEvent = {
|
|
2715
|
-
account: string;
|
|
2716
|
-
chainId: number;
|
|
2717
|
-
/** 0x-prefixed 32-byte Poseidon commitment of the private link. */
|
|
2718
|
-
commitment: string;
|
|
2719
|
-
};
|
|
2720
|
-
/**
|
|
2721
|
-
* Emitted by `remove_private_link()` when a private chain link is removed.
|
|
2722
|
-
* Rust variant: `PrivateChainLinkRemoved { account, chain_id, commitment }`
|
|
2723
|
-
*/
|
|
2724
|
-
type PrivateChainLinkRemovedEvent = {
|
|
2725
|
-
account: string;
|
|
2726
|
-
chainId: number;
|
|
2727
|
-
/** 0x-prefixed 32-byte commitment. */
|
|
2728
|
-
commitment: string;
|
|
2729
|
-
};
|
|
2730
|
-
/**
|
|
2731
|
-
* Emitted by `reveal_private_link()` when a private link is publicly revealed.
|
|
2732
|
-
* Rust variant: `PrivateChainLinkRevealed { account, chain_id, address }`
|
|
2733
|
-
*/
|
|
2734
|
-
type PrivateChainLinkRevealedEvent = {
|
|
2735
|
-
account: string;
|
|
2736
|
-
chainId: number;
|
|
2737
|
-
/** The now-revealed external address. */
|
|
2738
|
-
address: string;
|
|
2739
|
-
};
|
|
2740
|
-
/**
|
|
2741
|
-
* Emitted after a successful `dispatch_as_private_link()` call.
|
|
2742
|
-
* Rust variant: `PrivateLinkDispatchExecuted { owner, commitment }`
|
|
3896
|
+
* Call index 17 — `dispatch_as_private_link` (Signed origin, relayer)
|
|
3897
|
+
* Dispatches a RuntimeCall on behalf of an account identified only by a private
|
|
3898
|
+
* link commitment. A Groth16 ZK proof (PRIVATE_LINK circuit) authorises the
|
|
3899
|
+
* dispatch without revealing the external address.
|
|
2743
3900
|
*/
|
|
2744
|
-
type
|
|
3901
|
+
type DispatchAsPrivateLinkArgs = {
|
|
3902
|
+
/** AccountId on whose behalf to dispatch. */
|
|
2745
3903
|
owner: string;
|
|
2746
|
-
/**
|
|
2747
|
-
commitment:
|
|
3904
|
+
/** 32-byte commitment identifying the private link (LE). */
|
|
3905
|
+
commitment: number[];
|
|
3906
|
+
/** Groth16 proof bytes (PRIVATE_LINK circuit). */
|
|
3907
|
+
zkProof: number[];
|
|
3908
|
+
/** SCALE-encoded RuntimeCall to dispatch. */
|
|
3909
|
+
call: number[];
|
|
2748
3910
|
};
|
|
2749
|
-
/** All
|
|
2750
|
-
type
|
|
2751
|
-
type: '
|
|
2752
|
-
data: AccountMappedEvent;
|
|
3911
|
+
/** All pallet-account-mapping calls as a discriminated union. */
|
|
3912
|
+
type AccountMappingCall = {
|
|
3913
|
+
type: 'mapAccount';
|
|
2753
3914
|
} | {
|
|
2754
|
-
type: '
|
|
2755
|
-
data: AccountUnmappedEvent;
|
|
3915
|
+
type: 'unmapAccount';
|
|
2756
3916
|
} | {
|
|
2757
|
-
type: '
|
|
2758
|
-
|
|
3917
|
+
type: 'registerAlias';
|
|
3918
|
+
args: RegisterAliasArgs;
|
|
2759
3919
|
} | {
|
|
2760
|
-
type: '
|
|
2761
|
-
data: AliasReleasedEvent;
|
|
3920
|
+
type: 'releaseAlias';
|
|
2762
3921
|
} | {
|
|
2763
|
-
type: '
|
|
2764
|
-
|
|
3922
|
+
type: 'transferAlias';
|
|
3923
|
+
args: TransferAliasArgs;
|
|
2765
3924
|
} | {
|
|
2766
|
-
type: '
|
|
2767
|
-
|
|
3925
|
+
type: 'putAliasOnSale';
|
|
3926
|
+
args: PutAliasOnSaleArgs;
|
|
2768
3927
|
} | {
|
|
2769
|
-
type: '
|
|
2770
|
-
data: AliasSaleCancelledEvent;
|
|
3928
|
+
type: 'cancelSale';
|
|
2771
3929
|
} | {
|
|
2772
|
-
type: '
|
|
2773
|
-
|
|
3930
|
+
type: 'buyAlias';
|
|
3931
|
+
args: BuyAliasArgs;
|
|
2774
3932
|
} | {
|
|
2775
|
-
type: '
|
|
2776
|
-
|
|
3933
|
+
type: 'addChainLink';
|
|
3934
|
+
args: AddChainLinkArgs;
|
|
2777
3935
|
} | {
|
|
2778
|
-
type: '
|
|
2779
|
-
|
|
3936
|
+
type: 'removeChainLink';
|
|
3937
|
+
args: RemoveChainLinkArgs;
|
|
2780
3938
|
} | {
|
|
2781
|
-
type: '
|
|
2782
|
-
|
|
3939
|
+
type: 'setAccountMetadata';
|
|
3940
|
+
args: SetAccountMetadataArgs;
|
|
2783
3941
|
} | {
|
|
2784
|
-
type: '
|
|
2785
|
-
|
|
3942
|
+
type: 'addSupportedChain';
|
|
3943
|
+
args: AddSupportedChainArgs;
|
|
2786
3944
|
} | {
|
|
2787
|
-
type: '
|
|
2788
|
-
|
|
3945
|
+
type: 'removeSupportedChain';
|
|
3946
|
+
args: RemoveSupportedChainArgs;
|
|
2789
3947
|
} | {
|
|
2790
|
-
type: '
|
|
2791
|
-
|
|
3948
|
+
type: 'dispatchAsLinkedAccount';
|
|
3949
|
+
args: DispatchAsLinkedAccountArgs;
|
|
2792
3950
|
} | {
|
|
2793
|
-
type: '
|
|
2794
|
-
|
|
3951
|
+
type: 'registerPrivateLink';
|
|
3952
|
+
args: RegisterPrivateLinkArgs;
|
|
2795
3953
|
} | {
|
|
2796
|
-
type: '
|
|
2797
|
-
|
|
3954
|
+
type: 'removePrivateLink';
|
|
3955
|
+
args: RemovePrivateLinkArgs;
|
|
2798
3956
|
} | {
|
|
2799
|
-
type: '
|
|
2800
|
-
|
|
3957
|
+
type: 'revealPrivateLink';
|
|
3958
|
+
args: RevealPrivateLinkArgs;
|
|
2801
3959
|
} | {
|
|
2802
|
-
type: '
|
|
2803
|
-
|
|
3960
|
+
type: 'dispatchAsPrivateLink';
|
|
3961
|
+
args: DispatchAsPrivateLinkArgs;
|
|
2804
3962
|
};
|
|
2805
3963
|
|
|
2806
3964
|
/**
|
|
2807
|
-
* TypeScript types for pallet-
|
|
3965
|
+
* TypeScript types for events emitted by pallet-account-mapping.
|
|
2808
3966
|
*
|
|
2809
3967
|
* Conventions:
|
|
2810
|
-
* -
|
|
2811
|
-
* -
|
|
2812
|
-
* -
|
|
2813
|
-
* -
|
|
2814
|
-
* -
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
*
|
|
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]
|
|
3968
|
+
* - AccountId → `string` (SS58)
|
|
3969
|
+
* - H160 → `string` (0x-prefixed 20-byte Ethereum address)
|
|
3970
|
+
* - AliasOf<T> → `string` (bounded string, max configurable)
|
|
3971
|
+
* - ChainId → `number` (SLIP-0044 coin-type u32)
|
|
3972
|
+
* - ExternalAddr → `string` (chain-specific address string)
|
|
3973
|
+
* - BalanceOf<T> → `bigint`
|
|
3974
|
+
* - [u8; 32] → `string` (0x-prefixed hex, for private commitments)
|
|
3975
|
+
* - SignatureScheme → imported from pallet-extrinsics
|
|
2824
3976
|
*/
|
|
2825
|
-
|
|
3977
|
+
|
|
2826
3978
|
/**
|
|
2827
|
-
*
|
|
2828
|
-
*
|
|
3979
|
+
* Emitted when a Substrate account is mapped to an Ethereum address.
|
|
3980
|
+
* Rust variant: `AccountMapped { account, address }`
|
|
2829
3981
|
*/
|
|
2830
|
-
type
|
|
2831
|
-
/** SS58 or 0x-prefixed AccountId of the authorized auditor. */
|
|
3982
|
+
type AccountMappedEvent = {
|
|
2832
3983
|
account: string;
|
|
3984
|
+
/** 0x-prefixed 20-byte Ethereum address. */
|
|
3985
|
+
address: string;
|
|
2833
3986
|
};
|
|
2834
3987
|
/**
|
|
2835
|
-
*
|
|
2836
|
-
*
|
|
3988
|
+
* Emitted when an existing account mapping is removed.
|
|
3989
|
+
* Rust variant: `AccountUnmapped { account, address }`
|
|
2837
3990
|
*/
|
|
2838
|
-
type
|
|
2839
|
-
|
|
2840
|
-
|
|
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[];
|
|
3991
|
+
type AccountUnmappedEvent = {
|
|
3992
|
+
account: string;
|
|
3993
|
+
/** 0x-prefixed 20-byte Ethereum address. */
|
|
3994
|
+
address: string;
|
|
2853
3995
|
};
|
|
2854
3996
|
/**
|
|
2855
|
-
*
|
|
2856
|
-
*
|
|
3997
|
+
* Emitted by `register_alias()` when a new alias is claimed.
|
|
3998
|
+
* Rust variant: `AliasRegistered { account, alias, evm_address }`
|
|
2857
3999
|
*/
|
|
2858
|
-
type
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
/**
|
|
2862
|
-
|
|
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;
|
|
4000
|
+
type AliasRegisteredEvent = {
|
|
4001
|
+
account: string;
|
|
4002
|
+
alias: string;
|
|
4003
|
+
/** Optional EVM address linked at registration time. */
|
|
4004
|
+
evmAddress: string | null;
|
|
2867
4005
|
};
|
|
2868
4006
|
/**
|
|
2869
|
-
*
|
|
4007
|
+
* Emitted when an alias is released (burned / expired).
|
|
4008
|
+
* Rust variant: `AliasReleased { account, alias }`
|
|
2870
4009
|
*/
|
|
2871
|
-
type
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
/** 32-byte Poseidon commitment (LE). */
|
|
2875
|
-
commitment: Bytes32;
|
|
2876
|
-
/** Encrypted memo bytes — exactly 104 bytes. */
|
|
2877
|
-
encryptedMemo: number[];
|
|
4010
|
+
type AliasReleasedEvent = {
|
|
4011
|
+
account: string;
|
|
4012
|
+
alias: string;
|
|
2878
4013
|
};
|
|
2879
4014
|
/**
|
|
2880
|
-
*
|
|
2881
|
-
*
|
|
4015
|
+
* Emitted by `transfer_alias()` when ownership changes hands.
|
|
4016
|
+
* Rust variant: `AliasTransferred { from, to, alias }`
|
|
2882
4017
|
*/
|
|
2883
|
-
type
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
commitment: Bytes32;
|
|
2888
|
-
/** Encrypted memo — exactly 104 bytes. */
|
|
2889
|
-
encryptedMemo: number[];
|
|
4018
|
+
type AliasTransferredEvent = {
|
|
4019
|
+
from: string;
|
|
4020
|
+
to: string;
|
|
4021
|
+
alias: string;
|
|
2890
4022
|
};
|
|
2891
4023
|
/**
|
|
2892
|
-
*
|
|
2893
|
-
*
|
|
4024
|
+
* Emitted by `put_alias_on_sale()` when an alias is listed on the marketplace.
|
|
4025
|
+
* Rust variant: `AliasListedForSale { seller, alias, price, private }`
|
|
2894
4026
|
*/
|
|
2895
|
-
type
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
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[];
|
|
4027
|
+
type AliasListedForSaleEvent = {
|
|
4028
|
+
seller: string;
|
|
4029
|
+
alias: string;
|
|
4030
|
+
price: bigint;
|
|
4031
|
+
/** Whether the listing is private (whitelist-only). */
|
|
4032
|
+
private: boolean;
|
|
2911
4033
|
};
|
|
2912
4034
|
/**
|
|
2913
|
-
*
|
|
2914
|
-
*
|
|
2915
|
-
* Accepts 1–2 inputs and 1–2 outputs; total input value must equal total output value.
|
|
4035
|
+
* Emitted when an alias listing is cancelled before a sale.
|
|
4036
|
+
* Rust variant: `AliasSaleCancelled { seller, alias }`
|
|
2916
4037
|
*/
|
|
2917
|
-
type
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
/** 32-byte Merkle root (LE). */
|
|
2921
|
-
merkleRoot: Bytes32;
|
|
2922
|
-
nullifiers: RawTransferInput[];
|
|
2923
|
-
outputs: RawTransferOutput[];
|
|
2924
|
-
encryptedMemos: number[][];
|
|
4038
|
+
type AliasSaleCancelledEvent = {
|
|
4039
|
+
seller: string;
|
|
4040
|
+
alias: string;
|
|
2925
4041
|
};
|
|
2926
4042
|
/**
|
|
2927
|
-
*
|
|
2928
|
-
*
|
|
4043
|
+
* Emitted by `buy_alias()` when an alias is purchased.
|
|
4044
|
+
* Rust variant: `AliasSold { seller, buyer, alias, price }`
|
|
2929
4045
|
*/
|
|
2930
|
-
type
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
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;
|
|
4046
|
+
type AliasSoldEvent = {
|
|
4047
|
+
seller: string;
|
|
4048
|
+
buyer: string;
|
|
4049
|
+
alias: string;
|
|
4050
|
+
price: bigint;
|
|
2941
4051
|
};
|
|
2942
4052
|
/**
|
|
2943
|
-
*
|
|
2944
|
-
*
|
|
2945
|
-
*/
|
|
2946
|
-
type
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
maxFrequency: number | null;
|
|
2953
|
-
/** Block after which the policy expires. Null = no expiry. */
|
|
2954
|
-
validUntil: number | null;
|
|
4053
|
+
* Emitted by `add_chain_link()` when an external address is linked.
|
|
4054
|
+
* Rust variant: `ChainLinkAdded { account, chain_id, address }`
|
|
4055
|
+
*/
|
|
4056
|
+
type ChainLinkAddedEvent = {
|
|
4057
|
+
account: string;
|
|
4058
|
+
/** SLIP-0044 coin-type identifying the external chain. */
|
|
4059
|
+
chainId: number;
|
|
4060
|
+
/** Chain-specific address string. */
|
|
4061
|
+
address: string;
|
|
2955
4062
|
};
|
|
2956
4063
|
/**
|
|
2957
|
-
*
|
|
2958
|
-
*
|
|
4064
|
+
* Emitted by `remove_chain_link()` when an external address link is removed.
|
|
4065
|
+
* Rust variant: `ChainLinkRemoved { account, chain_id }`
|
|
2959
4066
|
*/
|
|
2960
|
-
type
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
/** Human-readable request reason — max 256 bytes UTF-8. */
|
|
2964
|
-
reason: string;
|
|
4067
|
+
type ChainLinkRemovedEvent = {
|
|
4068
|
+
account: string;
|
|
4069
|
+
chainId: number;
|
|
2965
4070
|
};
|
|
2966
4071
|
/**
|
|
2967
|
-
*
|
|
2968
|
-
*
|
|
4072
|
+
* Emitted by `set_account_metadata()` when an account's metadata is updated.
|
|
4073
|
+
* Rust variant: `MetadataUpdated { account }`
|
|
2969
4074
|
*/
|
|
2970
|
-
type
|
|
2971
|
-
|
|
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;
|
|
4075
|
+
type MetadataUpdatedEvent = {
|
|
4076
|
+
account: string;
|
|
2979
4077
|
};
|
|
2980
4078
|
/**
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
4079
|
+
* Emitted by `add_supported_chain()` (governance) when a new chain type is whitelisted.
|
|
4080
|
+
* Rust variant: `SupportedChainAdded { chain_id, scheme }`
|
|
2983
4081
|
*/
|
|
2984
|
-
type
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
/** Rejection reason — max 256 bytes UTF-8. */
|
|
2988
|
-
reason: string;
|
|
4082
|
+
type SupportedChainAddedEvent = {
|
|
4083
|
+
chainId: number;
|
|
4084
|
+
scheme: SignatureScheme;
|
|
2989
4085
|
};
|
|
2990
4086
|
/**
|
|
2991
|
-
*
|
|
2992
|
-
*
|
|
4087
|
+
* Emitted by `remove_supported_chain()` (governance) when a chain type is removed.
|
|
4088
|
+
* Rust variant: `SupportedChainRemoved { chain_id }`
|
|
2993
4089
|
*/
|
|
2994
|
-
type
|
|
2995
|
-
|
|
4090
|
+
type SupportedChainRemovedEvent = {
|
|
4091
|
+
chainId: number;
|
|
2996
4092
|
};
|
|
2997
4093
|
/**
|
|
2998
|
-
*
|
|
2999
|
-
*
|
|
4094
|
+
* Emitted after a successful `dispatch_as_linked_account()` call.
|
|
4095
|
+
* Rust variant: `ProxyCallExecuted { owner, chain_id, address }`
|
|
3000
4096
|
*/
|
|
3001
|
-
type
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
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;
|
|
4097
|
+
type ProxyCallExecutedEvent = {
|
|
4098
|
+
owner: string;
|
|
4099
|
+
chainId: number;
|
|
4100
|
+
address: string;
|
|
3010
4101
|
};
|
|
3011
4102
|
/**
|
|
3012
|
-
*
|
|
3013
|
-
*
|
|
4103
|
+
* Emitted by `register_private_link()` when a private (commitment-based) chain link is added.
|
|
4104
|
+
* Rust variant: `PrivateChainLinkAdded { account, chain_id, commitment }`
|
|
3014
4105
|
*/
|
|
3015
|
-
type
|
|
3016
|
-
|
|
4106
|
+
type PrivateChainLinkAddedEvent = {
|
|
4107
|
+
account: string;
|
|
4108
|
+
chainId: number;
|
|
4109
|
+
/** 0x-prefixed 32-byte Poseidon commitment of the private link. */
|
|
4110
|
+
commitment: string;
|
|
3017
4111
|
};
|
|
3018
4112
|
/**
|
|
3019
|
-
*
|
|
3020
|
-
*
|
|
4113
|
+
* Emitted by `remove_private_link()` when a private chain link is removed.
|
|
4114
|
+
* Rust variant: `PrivateChainLinkRemoved { account, chain_id, commitment }`
|
|
3021
4115
|
*/
|
|
3022
|
-
type
|
|
3023
|
-
|
|
4116
|
+
type PrivateChainLinkRemovedEvent = {
|
|
4117
|
+
account: string;
|
|
4118
|
+
chainId: number;
|
|
4119
|
+
/** 0x-prefixed 32-byte commitment. */
|
|
4120
|
+
commitment: string;
|
|
3024
4121
|
};
|
|
3025
4122
|
/**
|
|
3026
|
-
*
|
|
3027
|
-
*
|
|
4123
|
+
* Emitted by `reveal_private_link()` when a private link is publicly revealed.
|
|
4124
|
+
* Rust variant: `PrivateChainLinkRevealed { account, chain_id, address }`
|
|
3028
4125
|
*/
|
|
3029
|
-
type
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
/**
|
|
3033
|
-
|
|
4126
|
+
type PrivateChainLinkRevealedEvent = {
|
|
4127
|
+
account: string;
|
|
4128
|
+
chainId: number;
|
|
4129
|
+
/** The now-revealed external address. */
|
|
4130
|
+
address: string;
|
|
3034
4131
|
};
|
|
3035
4132
|
/**
|
|
3036
|
-
*
|
|
3037
|
-
*
|
|
4133
|
+
* Emitted after a successful `dispatch_as_private_link()` call.
|
|
4134
|
+
* Rust variant: `PrivateLinkDispatchExecuted { owner, commitment }`
|
|
3038
4135
|
*/
|
|
3039
|
-
type
|
|
3040
|
-
|
|
3041
|
-
commitment
|
|
4136
|
+
type PrivateLinkDispatchExecutedEvent = {
|
|
4137
|
+
owner: string;
|
|
4138
|
+
/** 0x-prefixed 32-byte commitment of the private link used. */
|
|
4139
|
+
commitment: string;
|
|
3042
4140
|
};
|
|
3043
|
-
/** All pallet-
|
|
3044
|
-
type
|
|
3045
|
-
type: '
|
|
3046
|
-
|
|
4141
|
+
/** All events emitted by pallet-account-mapping as a discriminated union. */
|
|
4142
|
+
type AccountMappingEvent = {
|
|
4143
|
+
type: 'AccountMapped';
|
|
4144
|
+
data: AccountMappedEvent;
|
|
3047
4145
|
} | {
|
|
3048
|
-
type: '
|
|
3049
|
-
|
|
4146
|
+
type: 'AccountUnmapped';
|
|
4147
|
+
data: AccountUnmappedEvent;
|
|
3050
4148
|
} | {
|
|
3051
|
-
type: '
|
|
3052
|
-
|
|
4149
|
+
type: 'AliasRegistered';
|
|
4150
|
+
data: AliasRegisteredEvent;
|
|
3053
4151
|
} | {
|
|
3054
|
-
type: '
|
|
3055
|
-
|
|
4152
|
+
type: 'AliasReleased';
|
|
4153
|
+
data: AliasReleasedEvent;
|
|
3056
4154
|
} | {
|
|
3057
|
-
type: '
|
|
3058
|
-
|
|
4155
|
+
type: 'AliasTransferred';
|
|
4156
|
+
data: AliasTransferredEvent;
|
|
3059
4157
|
} | {
|
|
3060
|
-
type: '
|
|
3061
|
-
|
|
4158
|
+
type: 'AliasListedForSale';
|
|
4159
|
+
data: AliasListedForSaleEvent;
|
|
3062
4160
|
} | {
|
|
3063
|
-
type: '
|
|
3064
|
-
|
|
4161
|
+
type: 'AliasSaleCancelled';
|
|
4162
|
+
data: AliasSaleCancelledEvent;
|
|
3065
4163
|
} | {
|
|
3066
|
-
type: '
|
|
3067
|
-
|
|
4164
|
+
type: 'AliasSold';
|
|
4165
|
+
data: AliasSoldEvent;
|
|
3068
4166
|
} | {
|
|
3069
|
-
type: '
|
|
3070
|
-
|
|
4167
|
+
type: 'ChainLinkAdded';
|
|
4168
|
+
data: ChainLinkAddedEvent;
|
|
3071
4169
|
} | {
|
|
3072
|
-
type: '
|
|
3073
|
-
|
|
4170
|
+
type: 'ChainLinkRemoved';
|
|
4171
|
+
data: ChainLinkRemovedEvent;
|
|
3074
4172
|
} | {
|
|
3075
|
-
type: '
|
|
3076
|
-
|
|
4173
|
+
type: 'MetadataUpdated';
|
|
4174
|
+
data: MetadataUpdatedEvent;
|
|
3077
4175
|
} | {
|
|
3078
|
-
type: '
|
|
3079
|
-
|
|
4176
|
+
type: 'SupportedChainAdded';
|
|
4177
|
+
data: SupportedChainAddedEvent;
|
|
3080
4178
|
} | {
|
|
3081
|
-
type: '
|
|
3082
|
-
|
|
4179
|
+
type: 'SupportedChainRemoved';
|
|
4180
|
+
data: SupportedChainRemovedEvent;
|
|
3083
4181
|
} | {
|
|
3084
|
-
type: '
|
|
3085
|
-
|
|
4182
|
+
type: 'ProxyCallExecuted';
|
|
4183
|
+
data: ProxyCallExecutedEvent;
|
|
4184
|
+
} | {
|
|
4185
|
+
type: 'PrivateChainLinkAdded';
|
|
4186
|
+
data: PrivateChainLinkAddedEvent;
|
|
4187
|
+
} | {
|
|
4188
|
+
type: 'PrivateChainLinkRemoved';
|
|
4189
|
+
data: PrivateChainLinkRemovedEvent;
|
|
4190
|
+
} | {
|
|
4191
|
+
type: 'PrivateChainLinkRevealed';
|
|
4192
|
+
data: PrivateChainLinkRevealedEvent;
|
|
4193
|
+
} | {
|
|
4194
|
+
type: 'PrivateLinkDispatchExecuted';
|
|
4195
|
+
data: PrivateLinkDispatchExecutedEvent;
|
|
3086
4196
|
};
|
|
3087
4197
|
|
|
3088
4198
|
/**
|
|
@@ -3138,7 +4248,73 @@ declare function truncateMiddle(str: string, start: number, end: number): string
|
|
|
3138
4248
|
/** Shorten a hash for compact inline display. */
|
|
3139
4249
|
declare function shortHash(h: string, start?: number, end?: number): string;
|
|
3140
4250
|
|
|
3141
|
-
|
|
4251
|
+
/**
|
|
4252
|
+
* Converts a Uint8Array or number[] to a 0x-prefixed lowercase hex string.
|
|
4253
|
+
*/
|
|
4254
|
+
declare function toHex(bytes: Uint8Array | number[]): string;
|
|
4255
|
+
/**
|
|
4256
|
+
* Decodes a hex string (with or without 0x prefix) to Uint8Array.
|
|
4257
|
+
*/
|
|
4258
|
+
declare function fromHex(hex: string): Uint8Array;
|
|
4259
|
+
/**
|
|
4260
|
+
* Ensures a hex string has the 0x prefix.
|
|
4261
|
+
*/
|
|
4262
|
+
declare function ensureHexPrefix(hex: string): string;
|
|
4263
|
+
/**
|
|
4264
|
+
* Converts a 0x-prefixed hex string (as returned by JSON-RPC) to a number.
|
|
4265
|
+
*/
|
|
4266
|
+
declare function hexToNumber(hex: string): number;
|
|
4267
|
+
/**
|
|
4268
|
+
* Converts a 0x-prefixed hex string (as returned by JSON-RPC) to a bigint.
|
|
4269
|
+
*/
|
|
4270
|
+
declare function hexToBigint(hex: string): bigint;
|
|
4271
|
+
|
|
4272
|
+
declare function toBase64(buf: ArrayBuffer | Uint8Array): string;
|
|
4273
|
+
declare function fromBase64(b64: string): Uint8Array;
|
|
4274
|
+
|
|
4275
|
+
/**
|
|
4276
|
+
* Derive the stealth owner public key (Ax) for a recipient note.
|
|
4277
|
+
*
|
|
4278
|
+
* stealthScalar = HKDF(sharedSecret, salt=ownerPk_LE, info="orbinum-stealth-v1") % suborder
|
|
4279
|
+
* stealthPoint = stealthScalar × Base8 + ownerPkPoint
|
|
4280
|
+
* return stealthPoint[0] (Ax coordinate)
|
|
4281
|
+
*
|
|
4282
|
+
* The sender calls this with sharedSecret from ECDH (EncryptedMemo.encrypt side).
|
|
4283
|
+
* The recipient calls this with sharedSecret from EncryptedMemo.extractSharedSecret.
|
|
4284
|
+
*
|
|
4285
|
+
* @param sharedSecret 32-byte LE Ax of the ECDH shared point.
|
|
4286
|
+
* @param ownerPkBigint Recipient's global ownerPk (BJJ Ax as bigint).
|
|
4287
|
+
* @param ownerPkPoint Recipient's global BJJ point [Ax, Ay]. Must match ownerPkBigint.
|
|
4288
|
+
* @returns Stealth owner public key (Ax bigint). Used as ownerPk in the note commitment.
|
|
4289
|
+
*/
|
|
4290
|
+
declare function deriveStealthOwnerPk(sharedSecret: Uint8Array, ownerPkBigint: bigint, ownerPkPoint: [bigint, bigint]): bigint;
|
|
4291
|
+
/**
|
|
4292
|
+
* Derive the stealth spending key for a received note.
|
|
4293
|
+
*
|
|
4294
|
+
* stealthScalar = HKDF(sharedSecret, salt=ownerPk_LE, info="orbinum-stealth-v1") % suborder
|
|
4295
|
+
* stealthSk = (stealthScalar + spendingKey) % BABYJUB_SUBORDER (|| 1n)
|
|
4296
|
+
*
|
|
4297
|
+
* Security property: BabyPbk(stealthSk).Ax == deriveStealthOwnerPk(sharedSecret, ownerPkBigint, ownerPkPoint)
|
|
4298
|
+
* This means the ZK circuit validates ownership correctly without modification.
|
|
4299
|
+
*
|
|
4300
|
+
* @param sharedSecret 32-byte LE Ax of the ECDH shared point.
|
|
4301
|
+
* @param ownerPkBigint Recipient's global ownerPk (BJJ Ax as bigint) — used as HKDF salt.
|
|
4302
|
+
* @param spendingKey Recipient's global spending key scalar.
|
|
4303
|
+
* @returns Stealth spending key — use as ZkNote.spendingKey for received notes.
|
|
4304
|
+
*/
|
|
4305
|
+
declare function deriveStealthSk(sharedSecret: Uint8Array, ownerPkBigint: bigint, spendingKey: bigint): bigint;
|
|
4306
|
+
|
|
4307
|
+
/**
|
|
4308
|
+
* Recover the BabyJubJub [Ax, Ay] point from an Ax coordinate.
|
|
4309
|
+
*
|
|
4310
|
+
* Uses the standard twisted Edwards curve equation: a*x² + y² = 1 + d*x²*y²
|
|
4311
|
+
* with a=168700, d=168696 (same as @zk-kit/baby-jubjub). Solving for y²:
|
|
4312
|
+
* y² = (1 - a*x²) / (1 - d*x²) mod P
|
|
4313
|
+
*
|
|
4314
|
+
* The square root is computed via Tonelli-Shanks (required since P ≡ 1 mod 4).
|
|
4315
|
+
* Returns the point with the canonical (smaller) y, or null if Ax is not on the curve.
|
|
4316
|
+
*/
|
|
4317
|
+
declare function recoverOwnerPkPoint(ax: bigint): [bigint, bigint] | null;
|
|
3142
4318
|
|
|
3143
4319
|
/**
|
|
3144
4320
|
* Serialises a bigint as a 32-byte little-endian Uint8Array.
|
|
@@ -3321,38 +4497,30 @@ interface DecodedUnshieldArgs {
|
|
|
3321
4497
|
amount: string;
|
|
3322
4498
|
recipient: string;
|
|
3323
4499
|
}
|
|
3324
|
-
interface DecodedSetAuditPolicyArgs {
|
|
3325
|
-
auditors: string[];
|
|
3326
|
-
conditions: unknown;
|
|
3327
|
-
max_frequency: number;
|
|
3328
|
-
}
|
|
3329
4500
|
interface DecodedRequestDisclosureArgs {
|
|
3330
4501
|
target: string;
|
|
3331
|
-
reason: string;
|
|
3332
|
-
evidence?: string;
|
|
3333
|
-
}
|
|
3334
|
-
interface DecodedApproveDisclosureArgs {
|
|
3335
|
-
auditor: string;
|
|
3336
4502
|
commitment: string;
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
4503
|
+
required_fields: {
|
|
4504
|
+
value: boolean;
|
|
4505
|
+
asset_id: boolean;
|
|
4506
|
+
owner: boolean;
|
|
4507
|
+
};
|
|
4508
|
+
reason: string;
|
|
4509
|
+
auditor_bjj_pk_x: string;
|
|
4510
|
+
auditor_bjj_pk_y: string;
|
|
3340
4511
|
}
|
|
3341
4512
|
interface DecodedRejectDisclosureArgs {
|
|
3342
4513
|
auditor: string;
|
|
4514
|
+
commitment: string;
|
|
3343
4515
|
reason: string;
|
|
3344
4516
|
}
|
|
3345
4517
|
interface DecodedSubmitDisclosureArgs {
|
|
3346
4518
|
commitment: string;
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
4519
|
+
proof_bytes: string;
|
|
4520
|
+
/** 256-byte ECDH public signals (hex). */
|
|
4521
|
+
public_signals: string;
|
|
3350
4522
|
auditor: string;
|
|
3351
4523
|
}
|
|
3352
|
-
interface DecodedBatchSubmitDisclosureArgs {
|
|
3353
|
-
count: number;
|
|
3354
|
-
submissions: DecodedSubmitDisclosureArgs[];
|
|
3355
|
-
}
|
|
3356
4524
|
interface DecodedTransferArgs {
|
|
3357
4525
|
dest: string;
|
|
3358
4526
|
value: string;
|
|
@@ -3435,8 +4603,10 @@ interface ShieldedEventData {
|
|
|
3435
4603
|
memo: string;
|
|
3436
4604
|
index: number;
|
|
3437
4605
|
}
|
|
3438
|
-
interface
|
|
4606
|
+
interface NullifiersSpentEventData {
|
|
3439
4607
|
nullifiers: string[];
|
|
4608
|
+
}
|
|
4609
|
+
interface CommitmentsInsertedEventData {
|
|
3440
4610
|
commitments: string[];
|
|
3441
4611
|
memos: string[];
|
|
3442
4612
|
indices: number[];
|
|
@@ -3451,25 +4621,22 @@ interface MerkleRootUpdatedData {
|
|
|
3451
4621
|
new_root: string;
|
|
3452
4622
|
size: number;
|
|
3453
4623
|
}
|
|
3454
|
-
interface AuditPolicySetData {
|
|
3455
|
-
who: string;
|
|
3456
|
-
auditors: string[];
|
|
3457
|
-
version: number;
|
|
3458
|
-
}
|
|
3459
4624
|
interface DisclosureRequestedData {
|
|
3460
|
-
requestor: string;
|
|
3461
4625
|
target: string;
|
|
3462
|
-
commitment: string;
|
|
3463
|
-
reason?: string;
|
|
3464
|
-
}
|
|
3465
|
-
interface DisclosureApprovedData {
|
|
3466
|
-
who: string;
|
|
3467
|
-
commitment: string;
|
|
3468
4626
|
auditor: string;
|
|
4627
|
+
commitment: string;
|
|
4628
|
+
required_fields: {
|
|
4629
|
+
value: boolean;
|
|
4630
|
+
asset_id: boolean;
|
|
4631
|
+
owner: boolean;
|
|
4632
|
+
};
|
|
4633
|
+
auditor_bjj_pk_x: string;
|
|
4634
|
+
auditor_bjj_pk_y: string;
|
|
3469
4635
|
}
|
|
3470
4636
|
interface DisclosureRejectedData {
|
|
3471
|
-
|
|
4637
|
+
target: string;
|
|
3472
4638
|
auditor: string;
|
|
4639
|
+
commitment: string;
|
|
3473
4640
|
reason: string;
|
|
3474
4641
|
}
|
|
3475
4642
|
interface DisclosureSubmittedData {
|
|
@@ -3483,13 +4650,6 @@ interface DisclosureVerifiedData {
|
|
|
3483
4650
|
commitment: string;
|
|
3484
4651
|
verified: boolean;
|
|
3485
4652
|
}
|
|
3486
|
-
interface AuditTrailRecordedData {
|
|
3487
|
-
account: string;
|
|
3488
|
-
auditor: string;
|
|
3489
|
-
commitment: string;
|
|
3490
|
-
trail_hash: string;
|
|
3491
|
-
trail_id: string;
|
|
3492
|
-
}
|
|
3493
4653
|
interface TransferEventData {
|
|
3494
4654
|
from: string;
|
|
3495
4655
|
to: string;
|
|
@@ -3560,4 +4720,4 @@ interface ExtrinsicFailedData {
|
|
|
3560
4720
|
dispatch_info: DispatchInfo;
|
|
3561
4721
|
}
|
|
3562
4722
|
|
|
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
|
|
4723
|
+
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 AuditPolicySetEvent, type Auditor, BABYJUB_SUBORDER, BN254_R, type BatchRegisterVerificationKeysArgs, type BatchVerificationKeysRegisteredEvent, type BlockInfo, type BuyAliasArgs, type Bytes32, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, type ClaimShieldedFeesParams, type ClientProviderConfig, type CommitmentsInsertedEvent, type CommitmentsInsertedEventData, type ConnectionStatus, CryptoPrecompiles, type DecodedAddChainLinkArgs, type DecodedBatchArgs, 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 DecodedShieldArgs, type DecodedShieldBatchArgs, type DecodedShieldBatchOperation, type DecodedSubmitDisclosureArgs, type DecodedSudoArgs, type DecodedTransferAllArgs, type DecodedTransferArgs, type DecodedTransferKeepAliveArgs, type DecodedUnshieldArgs, type DecryptedMemo, type DiscloseArgs, type DiscloseParams, type DisclosedEvent, type DisclosureCondition, type DisclosureFieldMask, 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, ENCRYPTED_MEMO_SIZE, type EncryptedDisclosureSignals, EncryptedMemo, type EncryptedNoteRecord, 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 FeeClaimProofInputs, 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 NoteStatusUpdate, type NullifierStatusResult, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, type PaginatedResult, PrivacyKeyManager, type PrivacyMerkleProof, PrivacyModule, type PrivateChainLinkAddedEvent, type PrivateChainLinkRemovedEvent, type PrivateChainLinkRevealedEvent, type PrivateLink, type PrivateLinkDispatchExecutedEvent, type PrivateTransferArgs, type PrivateTransferInput, type PrivateTransferOutput, type PrivateTransferParams, type PrivateTransferProofInputs, type PrivateTransferTimestamp, type ProofVerificationFailedEvent, type ProofVerifiedEvent, type ProxyCallExecutedEvent, type PruneExpiredRequestArgs, type PruneExpiredRequestParams, type PutAliasOnSaleArgs, type PutOnSaleParams, type RawBlock, type RawBlockHeader, type RawTransferInput, type RawTransferOutput, type RegisterAliasArgs, type RegisterAssetArgs, type RegisterPrivateLinkArgs, type RegisterVerificationKeyArgs, type RejectDisclosureArgs, type RejectDisclosureParams, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type RequestDisclosureArgs, type RequestDisclosureParams, 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 SetMetadataParams, type ShieldArgs, type ShieldBatchArgs, type ShieldBatchItem, type ShieldBatchParams, type ShieldOperation, type ShieldParams, type ShieldedAddressEvent, type ShieldedCommitment, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type SpentNullifier, type StatusChangeEvent, type StatusListener, type StealthScanHint, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TxResult, type UnsafeTxOptions, type Unshield, type UnshieldArgs, type UnshieldParams, type UnshieldProofInputs, type UnshieldedEvent, type UnshieldedEventData, type UnverifyAssetArgs, VaultLockedError, 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, applyNoteStatus, bigintTo32Be, bigintTo32Le, bigintTo32LeArr, buildDisclosurePublicSignals, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, decodePrecompileCalldata, decryptDisclosureSignals, decryptJson, decryptNoteRecord, deriveBabyJubjubKeypair, deriveMasterKeyBytes, deriveOwnerPk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultKey, deriveViewingPublicKey, deriveViewingSecretKey, encryptJson, encryptNote, ensureHexPrefix, evmAddressToAccountId, evmToImplicitSubstrate, evmToMappedAccountHex, evmToSubstrate, formatBalance, formatORB, fromBase64, fromHex, generateFeeClaimProof, generateTransferProof, generateUnshieldProof, getPrecompileLabel, hexToBigint, hexToNumber, implicitSubstrateToEvm, isEvmAddress, isImplicitEvmAccount, isSs58, isSubstrateAddress, isUnifiedAddress, leHexToBigint, mapExtrinsicArgs, mapZkEventData, normalizeEvmAddress, randomBlinding, recoverOwnerPkPoint, selectNotes, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
|