@obelyzk/sdk 1.0.0 → 1.1.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 +370 -346
- package/bin/bitsage-demo.ts +0 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +16 -6
- package/dist/index.mjs +17 -7
- package/dist/obelysk/index.d.mts +96 -7
- package/dist/obelysk/index.d.ts +96 -7
- package/dist/obelysk/index.js +325 -57
- package/dist/obelysk/index.mjs +313 -55
- package/dist/privacy/index.mjs +1 -1
- package/dist/react/index.mjs +1 -1
- package/package.json +5 -1
package/bin/bitsage-demo.ts
CHANGED
|
File without changes
|
package/dist/index.d.mts
CHANGED
|
@@ -424,8 +424,8 @@ type ProofJobPriority = 'standard' | 'high' | 'critical' | 'emergency';
|
|
|
424
424
|
type ProofJobStatus = 'queued' | 'assigned' | 'generating' | 'completed' | 'failed' | 'cancelled' | 'timeout';
|
|
425
425
|
type ProofType = 'batch_payments' | 'ai_inference' | 'cross_chain_bridge' | 'defi_calculation' | 'game_state' | 'vrf_randomness' | 'kyc_verification' | 'supply_chain' | 'recursive_aggregation' | 'custom';
|
|
426
426
|
interface StwoProverConfig {
|
|
427
|
-
/** Base URL of the STWO prover service */
|
|
428
|
-
baseUrl
|
|
427
|
+
/** Base URL of the STWO prover service (default: https://prover.bitsage.network) */
|
|
428
|
+
baseUrl?: string;
|
|
429
429
|
/** API key for authentication */
|
|
430
430
|
apiKey?: string;
|
|
431
431
|
/** Default GPU tier preference */
|
|
@@ -591,7 +591,7 @@ interface ProofCostEstimate {
|
|
|
591
591
|
declare const DEFAULT_PROVER_CONFIG: Partial<StwoProverConfig>;
|
|
592
592
|
declare class StwoProverClient {
|
|
593
593
|
private config;
|
|
594
|
-
constructor(config
|
|
594
|
+
constructor(config?: Partial<StwoProverConfig>);
|
|
595
595
|
/**
|
|
596
596
|
* Load an ONNX model on the prover server.
|
|
597
597
|
* Must be called before submitting proving jobs for that model.
|
|
@@ -721,7 +721,7 @@ declare class StwoProverClient {
|
|
|
721
721
|
/**
|
|
722
722
|
* Create a new STWO Prover Client
|
|
723
723
|
*/
|
|
724
|
-
declare function createStwoProverClient(config
|
|
724
|
+
declare function createStwoProverClient(config?: Partial<StwoProverConfig>): StwoProverClient;
|
|
725
725
|
interface ZkmlLoadModelRequest {
|
|
726
726
|
/** Path to ONNX model on the prover server filesystem */
|
|
727
727
|
modelPath: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -424,8 +424,8 @@ type ProofJobPriority = 'standard' | 'high' | 'critical' | 'emergency';
|
|
|
424
424
|
type ProofJobStatus = 'queued' | 'assigned' | 'generating' | 'completed' | 'failed' | 'cancelled' | 'timeout';
|
|
425
425
|
type ProofType = 'batch_payments' | 'ai_inference' | 'cross_chain_bridge' | 'defi_calculation' | 'game_state' | 'vrf_randomness' | 'kyc_verification' | 'supply_chain' | 'recursive_aggregation' | 'custom';
|
|
426
426
|
interface StwoProverConfig {
|
|
427
|
-
/** Base URL of the STWO prover service */
|
|
428
|
-
baseUrl
|
|
427
|
+
/** Base URL of the STWO prover service (default: https://prover.bitsage.network) */
|
|
428
|
+
baseUrl?: string;
|
|
429
429
|
/** API key for authentication */
|
|
430
430
|
apiKey?: string;
|
|
431
431
|
/** Default GPU tier preference */
|
|
@@ -591,7 +591,7 @@ interface ProofCostEstimate {
|
|
|
591
591
|
declare const DEFAULT_PROVER_CONFIG: Partial<StwoProverConfig>;
|
|
592
592
|
declare class StwoProverClient {
|
|
593
593
|
private config;
|
|
594
|
-
constructor(config
|
|
594
|
+
constructor(config?: Partial<StwoProverConfig>);
|
|
595
595
|
/**
|
|
596
596
|
* Load an ONNX model on the prover server.
|
|
597
597
|
* Must be called before submitting proving jobs for that model.
|
|
@@ -721,7 +721,7 @@ declare class StwoProverClient {
|
|
|
721
721
|
/**
|
|
722
722
|
* Create a new STWO Prover Client
|
|
723
723
|
*/
|
|
724
|
-
declare function createStwoProverClient(config
|
|
724
|
+
declare function createStwoProverClient(config?: Partial<StwoProverConfig>): StwoProverClient;
|
|
725
725
|
interface ZkmlLoadModelRequest {
|
|
726
726
|
/** Path to ONNX model on the prover server filesystem */
|
|
727
727
|
modelPath: string;
|
package/dist/index.js
CHANGED
|
@@ -6511,18 +6511,28 @@ var StwoProverClient = class {
|
|
|
6511
6511
|
}
|
|
6512
6512
|
};
|
|
6513
6513
|
function createStwoProverClient(config) {
|
|
6514
|
-
return new StwoProverClient(config);
|
|
6514
|
+
return new StwoProverClient(config ?? {});
|
|
6515
6515
|
}
|
|
6516
|
+
StwoProverClient.prototype.listZkmlModels = async function() {
|
|
6517
|
+
const response = await this.fetch("/api/v1/models");
|
|
6518
|
+
return response.map((m) => ({
|
|
6519
|
+
modelId: m.model_id,
|
|
6520
|
+
name: m.name || "",
|
|
6521
|
+
weightCommitment: m.weight_commitment,
|
|
6522
|
+
numLayers: m.num_layers,
|
|
6523
|
+
inputShape: m.input_shape
|
|
6524
|
+
}));
|
|
6525
|
+
};
|
|
6516
6526
|
StwoProverClient.prototype.loadZkmlModel = async function(req) {
|
|
6517
|
-
const
|
|
6527
|
+
const endpoint = req.model_dir ? "/api/v1/models/hf" : "/api/v1/models";
|
|
6528
|
+
const body = req.model_dir ? { model_dir: req.model_dir, description: req.description } : { model_path: req.modelPath, description: req.description };
|
|
6529
|
+
const response = await this.fetch(endpoint, {
|
|
6518
6530
|
method: "POST",
|
|
6519
|
-
body: JSON.stringify(
|
|
6520
|
-
model_path: req.modelPath,
|
|
6521
|
-
description: req.description
|
|
6522
|
-
})
|
|
6531
|
+
body: JSON.stringify(body)
|
|
6523
6532
|
});
|
|
6524
6533
|
return {
|
|
6525
6534
|
modelId: response.model_id,
|
|
6535
|
+
name: response.name || "",
|
|
6526
6536
|
weightCommitment: response.weight_commitment,
|
|
6527
6537
|
numLayers: response.num_layers,
|
|
6528
6538
|
inputShape: response.input_shape
|
package/dist/index.mjs
CHANGED
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
powMod,
|
|
85
85
|
randomScalar,
|
|
86
86
|
subMod
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-CGPFHXUF.mjs";
|
|
88
88
|
|
|
89
89
|
// src/types.ts
|
|
90
90
|
function getMinStake(tier) {
|
|
@@ -590,18 +590,28 @@ var StwoProverClient = class {
|
|
|
590
590
|
}
|
|
591
591
|
};
|
|
592
592
|
function createStwoProverClient(config) {
|
|
593
|
-
return new StwoProverClient(config);
|
|
593
|
+
return new StwoProverClient(config ?? {});
|
|
594
594
|
}
|
|
595
|
+
StwoProverClient.prototype.listZkmlModels = async function() {
|
|
596
|
+
const response = await this.fetch("/api/v1/models");
|
|
597
|
+
return response.map((m) => ({
|
|
598
|
+
modelId: m.model_id,
|
|
599
|
+
name: m.name || "",
|
|
600
|
+
weightCommitment: m.weight_commitment,
|
|
601
|
+
numLayers: m.num_layers,
|
|
602
|
+
inputShape: m.input_shape
|
|
603
|
+
}));
|
|
604
|
+
};
|
|
595
605
|
StwoProverClient.prototype.loadZkmlModel = async function(req) {
|
|
596
|
-
const
|
|
606
|
+
const endpoint = req.model_dir ? "/api/v1/models/hf" : "/api/v1/models";
|
|
607
|
+
const body = req.model_dir ? { model_dir: req.model_dir, description: req.description } : { model_path: req.modelPath, description: req.description };
|
|
608
|
+
const response = await this.fetch(endpoint, {
|
|
597
609
|
method: "POST",
|
|
598
|
-
body: JSON.stringify(
|
|
599
|
-
model_path: req.modelPath,
|
|
600
|
-
description: req.description
|
|
601
|
-
})
|
|
610
|
+
body: JSON.stringify(body)
|
|
602
611
|
});
|
|
603
612
|
return {
|
|
604
613
|
modelId: response.model_id,
|
|
614
|
+
name: response.name || "",
|
|
605
615
|
weightCommitment: response.weight_commitment,
|
|
606
616
|
numLayers: response.num_layers,
|
|
607
617
|
inputShape: response.input_shape
|
package/dist/obelysk/index.d.mts
CHANGED
|
@@ -924,7 +924,14 @@ declare class VM31VaultClient {
|
|
|
924
924
|
private get contractAddress();
|
|
925
925
|
private get relayerUrl();
|
|
926
926
|
private get relayerApiKey();
|
|
927
|
+
/** Cached relayer X25519 public key (fetched on first encrypted submit) */
|
|
928
|
+
private _relayerPubkey;
|
|
927
929
|
private relayerFetch;
|
|
930
|
+
/**
|
|
931
|
+
* Submit a payload to the relayer, encrypted with ECIES.
|
|
932
|
+
* Falls back to plaintext if `encrypt: false` is passed.
|
|
933
|
+
*/
|
|
934
|
+
private relayerSubmit;
|
|
928
935
|
/** Get the current Merkle root of the VM31 commitment tree */
|
|
929
936
|
getMerkleRoot(): Promise<PackedDigest>;
|
|
930
937
|
/** Get the number of leaves in the commitment tree */
|
|
@@ -969,12 +976,24 @@ declare class VM31VaultClient {
|
|
|
969
976
|
version: number;
|
|
970
977
|
algorithm: string;
|
|
971
978
|
}>;
|
|
972
|
-
/**
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
979
|
+
/**
|
|
980
|
+
* Submit a deposit transaction to the relayer.
|
|
981
|
+
* Validates denomination (privacy gap #7) and encrypts with ECIES by default.
|
|
982
|
+
* @param encrypt - Set to false for legacy plaintext mode (default: true)
|
|
983
|
+
*/
|
|
984
|
+
submitDeposit(params: VaultDepositParams, encrypt?: boolean): Promise<VaultSubmitResult>;
|
|
985
|
+
/**
|
|
986
|
+
* Submit a withdrawal transaction to the relayer.
|
|
987
|
+
* Withdrawals are not denomination-restricted.
|
|
988
|
+
* @param encrypt - Set to false for legacy plaintext mode (default: true)
|
|
989
|
+
*/
|
|
990
|
+
submitWithdraw(params: VaultWithdrawParams, encrypt?: boolean): Promise<VaultSubmitResult>;
|
|
991
|
+
/**
|
|
992
|
+
* Submit a private transfer transaction to the relayer.
|
|
993
|
+
* Transfers are not denomination-restricted.
|
|
994
|
+
* @param encrypt - Set to false for legacy plaintext mode (default: true)
|
|
995
|
+
*/
|
|
996
|
+
submitTransfer(params: VaultTransferParams, encrypt?: boolean): Promise<VaultSubmitResult>;
|
|
978
997
|
/** Query batch info from the relayer */
|
|
979
998
|
queryBatch(batchId: string): Promise<VaultBatchInfo>;
|
|
980
999
|
/** Fetch Merkle path for a commitment from the relayer */
|
|
@@ -1342,4 +1361,74 @@ declare class ObelyskClient {
|
|
|
1342
1361
|
requireAccount(): Account;
|
|
1343
1362
|
}
|
|
1344
1363
|
|
|
1345
|
-
|
|
1364
|
+
/**
|
|
1365
|
+
* ECIES Encryption for VM31 Relayer
|
|
1366
|
+
*
|
|
1367
|
+
* X25519 ECDH + HKDF-SHA256 + AES-256-GCM
|
|
1368
|
+
* Compatible with the Obelysk VM31 relayer (Rust: x25519-dalek + aes-gcm + hkdf)
|
|
1369
|
+
*
|
|
1370
|
+
* Uses Web Crypto API (works in Node 20+ and all modern browsers).
|
|
1371
|
+
*/
|
|
1372
|
+
interface ECIESEnvelope {
|
|
1373
|
+
ephemeral_pubkey: string;
|
|
1374
|
+
ciphertext: string;
|
|
1375
|
+
nonce: string;
|
|
1376
|
+
version: number;
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Encrypt a JSON payload for the VM31 relayer using ECIES.
|
|
1380
|
+
*
|
|
1381
|
+
* @param payload - The SubmitRequest object to encrypt
|
|
1382
|
+
* @param relayerPubkeyHex - The relayer's X25519 public key (hex, 64 chars)
|
|
1383
|
+
* @returns ECIES envelope ready to POST to /submit
|
|
1384
|
+
*/
|
|
1385
|
+
declare function eciesEncrypt(payload: unknown, relayerPubkeyHex: string): Promise<ECIESEnvelope>;
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* VM31 Deposit Denomination Whitelists
|
|
1389
|
+
*
|
|
1390
|
+
* Privacy gap #7 mitigation: deposits must use standard denominations
|
|
1391
|
+
* to prevent exact-amount correlation attacks.
|
|
1392
|
+
*
|
|
1393
|
+
* Only deposits are restricted — withdrawals and transfers are unrestricted.
|
|
1394
|
+
*/
|
|
1395
|
+
/** wBTC denominations (8 decimals) */
|
|
1396
|
+
declare const WBTC_DENOMINATIONS: readonly bigint[];
|
|
1397
|
+
/** SAGE denominations (18 decimals) */
|
|
1398
|
+
declare const SAGE_DENOMINATIONS: readonly bigint[];
|
|
1399
|
+
/** ETH denominations (18 decimals) */
|
|
1400
|
+
declare const ETH_DENOMINATIONS: readonly bigint[];
|
|
1401
|
+
/** STRK denominations (18 decimals) */
|
|
1402
|
+
declare const STRK_DENOMINATIONS: readonly bigint[];
|
|
1403
|
+
/** USDC denominations (6 decimals) */
|
|
1404
|
+
declare const USDC_DENOMINATIONS: readonly bigint[];
|
|
1405
|
+
/** All denomination lists by VM31 asset ID */
|
|
1406
|
+
declare const VM31_DENOMINATIONS: Record<number, readonly bigint[]>;
|
|
1407
|
+
/** Denomination lists by token symbol */
|
|
1408
|
+
declare const DENOMINATION_BY_SYMBOL: Record<string, readonly bigint[]>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Validate that a deposit amount is a standard denomination.
|
|
1411
|
+
* Throws if the amount is not in the whitelist.
|
|
1412
|
+
* Unknown assets pass through (forward-compatible).
|
|
1413
|
+
*
|
|
1414
|
+
* @param amount - Amount in base units (e.g., wei, satoshis)
|
|
1415
|
+
* @param assetIdOrSymbol - VM31 asset ID (0-4) or token symbol
|
|
1416
|
+
*/
|
|
1417
|
+
declare function validateDenomination(amount: bigint, assetIdOrSymbol: number | string): void;
|
|
1418
|
+
/**
|
|
1419
|
+
* Split an amount into the fewest standard denominations (greedy, largest first).
|
|
1420
|
+
* Useful for automatically batching a deposit into multiple denomination-safe transactions.
|
|
1421
|
+
*
|
|
1422
|
+
* @returns denominations array and any remainder that can't be represented
|
|
1423
|
+
*/
|
|
1424
|
+
declare function splitIntoDenominations(amount: bigint, assetIdOrSymbol: number | string): {
|
|
1425
|
+
denominations: bigint[];
|
|
1426
|
+
remainder: bigint;
|
|
1427
|
+
};
|
|
1428
|
+
/**
|
|
1429
|
+
* Get valid denominations for an asset.
|
|
1430
|
+
* Returns undefined for unknown assets.
|
|
1431
|
+
*/
|
|
1432
|
+
declare function getDenominations(assetIdOrSymbol: number | string): readonly bigint[] | undefined;
|
|
1433
|
+
|
|
1434
|
+
export { type AssetPair, type BatchStatus, type BridgeConfig, type ClaimFillParams, type ClaimParams, type CommitOrderParams, ConfidentialTransferClient, DARKPOOL_ASSET_IDS, DENOMINATION_BY_SYMBOL, DarkPoolClient, type DarkPoolDepositParams, type DarkPoolOrderData, type DepositParams, type DepositResult, type ECIESEnvelope, ECPoint, ETH_DENOMINATIONS, type EpochInfo, type FundParams, type GpuTier, MAINNET_PRIVACY_POOLS, MAINNET_TOKENS, type OTCOrder, OTCOrderbookClient, type OTCTrade, ObelyskClient, type ObelyskConfig, type ObelyskNetwork, ObelyskPrivacy, OrderSide, OrderStatus, OrderType, type OrderbookConfig, type OrderbookDepth, type OrderbookDepthLevel, type PackedDigest, type PlaceLimitOrderParams, type PlaceMarketOrderParams, type PrivacyNote, PrivacyPoolClient, PrivacyRouterClient, type PrivateAccount, ProverStakingClient, type RelayerInfo, type RevealOrderParams, SAGE_DENOMINATIONS, STRK_DENOMINATIONS, ShieldedSwapClient, type ShieldedSwapParams, type StakingConfig, type Stats24h, type StealthAnnouncement, StealthClient, type StealthMetaAddress, type StealthSendParams, type StealthSpendingProof, TOKEN_DECIMALS, type TradingPair, type TransferParams, USDC_DENOMINATIONS, type VM31AssetId, VM31BridgeClient, VM31VaultClient, VM31_ASSET_IDS, VM31_DENOMINATIONS, type VaultBatchInfo, type VaultDepositParams, type VaultMerklePath, type VaultNote, type VaultSubmitResult, type VaultTransferParams, type VaultWithdrawParams, WBTC_DENOMINATIONS, type WithdrawCTParams, type WithdrawParams, type WithdrawResult, type WorkerStake, commitmentToHash, createAEHint, createEncryptionProof, deriveNullifier, ecAdd, ecMul, eciesEncrypt, elgamalEncrypt, formatAmount, getContracts, getDenominations, getRpcUrl, mod, modInverse, parseAmount, pedersenCommit, randomScalar, splitIntoDenominations, validateDenomination };
|
package/dist/obelysk/index.d.ts
CHANGED
|
@@ -924,7 +924,14 @@ declare class VM31VaultClient {
|
|
|
924
924
|
private get contractAddress();
|
|
925
925
|
private get relayerUrl();
|
|
926
926
|
private get relayerApiKey();
|
|
927
|
+
/** Cached relayer X25519 public key (fetched on first encrypted submit) */
|
|
928
|
+
private _relayerPubkey;
|
|
927
929
|
private relayerFetch;
|
|
930
|
+
/**
|
|
931
|
+
* Submit a payload to the relayer, encrypted with ECIES.
|
|
932
|
+
* Falls back to plaintext if `encrypt: false` is passed.
|
|
933
|
+
*/
|
|
934
|
+
private relayerSubmit;
|
|
928
935
|
/** Get the current Merkle root of the VM31 commitment tree */
|
|
929
936
|
getMerkleRoot(): Promise<PackedDigest>;
|
|
930
937
|
/** Get the number of leaves in the commitment tree */
|
|
@@ -969,12 +976,24 @@ declare class VM31VaultClient {
|
|
|
969
976
|
version: number;
|
|
970
977
|
algorithm: string;
|
|
971
978
|
}>;
|
|
972
|
-
/**
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
979
|
+
/**
|
|
980
|
+
* Submit a deposit transaction to the relayer.
|
|
981
|
+
* Validates denomination (privacy gap #7) and encrypts with ECIES by default.
|
|
982
|
+
* @param encrypt - Set to false for legacy plaintext mode (default: true)
|
|
983
|
+
*/
|
|
984
|
+
submitDeposit(params: VaultDepositParams, encrypt?: boolean): Promise<VaultSubmitResult>;
|
|
985
|
+
/**
|
|
986
|
+
* Submit a withdrawal transaction to the relayer.
|
|
987
|
+
* Withdrawals are not denomination-restricted.
|
|
988
|
+
* @param encrypt - Set to false for legacy plaintext mode (default: true)
|
|
989
|
+
*/
|
|
990
|
+
submitWithdraw(params: VaultWithdrawParams, encrypt?: boolean): Promise<VaultSubmitResult>;
|
|
991
|
+
/**
|
|
992
|
+
* Submit a private transfer transaction to the relayer.
|
|
993
|
+
* Transfers are not denomination-restricted.
|
|
994
|
+
* @param encrypt - Set to false for legacy plaintext mode (default: true)
|
|
995
|
+
*/
|
|
996
|
+
submitTransfer(params: VaultTransferParams, encrypt?: boolean): Promise<VaultSubmitResult>;
|
|
978
997
|
/** Query batch info from the relayer */
|
|
979
998
|
queryBatch(batchId: string): Promise<VaultBatchInfo>;
|
|
980
999
|
/** Fetch Merkle path for a commitment from the relayer */
|
|
@@ -1342,4 +1361,74 @@ declare class ObelyskClient {
|
|
|
1342
1361
|
requireAccount(): Account;
|
|
1343
1362
|
}
|
|
1344
1363
|
|
|
1345
|
-
|
|
1364
|
+
/**
|
|
1365
|
+
* ECIES Encryption for VM31 Relayer
|
|
1366
|
+
*
|
|
1367
|
+
* X25519 ECDH + HKDF-SHA256 + AES-256-GCM
|
|
1368
|
+
* Compatible with the Obelysk VM31 relayer (Rust: x25519-dalek + aes-gcm + hkdf)
|
|
1369
|
+
*
|
|
1370
|
+
* Uses Web Crypto API (works in Node 20+ and all modern browsers).
|
|
1371
|
+
*/
|
|
1372
|
+
interface ECIESEnvelope {
|
|
1373
|
+
ephemeral_pubkey: string;
|
|
1374
|
+
ciphertext: string;
|
|
1375
|
+
nonce: string;
|
|
1376
|
+
version: number;
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Encrypt a JSON payload for the VM31 relayer using ECIES.
|
|
1380
|
+
*
|
|
1381
|
+
* @param payload - The SubmitRequest object to encrypt
|
|
1382
|
+
* @param relayerPubkeyHex - The relayer's X25519 public key (hex, 64 chars)
|
|
1383
|
+
* @returns ECIES envelope ready to POST to /submit
|
|
1384
|
+
*/
|
|
1385
|
+
declare function eciesEncrypt(payload: unknown, relayerPubkeyHex: string): Promise<ECIESEnvelope>;
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* VM31 Deposit Denomination Whitelists
|
|
1389
|
+
*
|
|
1390
|
+
* Privacy gap #7 mitigation: deposits must use standard denominations
|
|
1391
|
+
* to prevent exact-amount correlation attacks.
|
|
1392
|
+
*
|
|
1393
|
+
* Only deposits are restricted — withdrawals and transfers are unrestricted.
|
|
1394
|
+
*/
|
|
1395
|
+
/** wBTC denominations (8 decimals) */
|
|
1396
|
+
declare const WBTC_DENOMINATIONS: readonly bigint[];
|
|
1397
|
+
/** SAGE denominations (18 decimals) */
|
|
1398
|
+
declare const SAGE_DENOMINATIONS: readonly bigint[];
|
|
1399
|
+
/** ETH denominations (18 decimals) */
|
|
1400
|
+
declare const ETH_DENOMINATIONS: readonly bigint[];
|
|
1401
|
+
/** STRK denominations (18 decimals) */
|
|
1402
|
+
declare const STRK_DENOMINATIONS: readonly bigint[];
|
|
1403
|
+
/** USDC denominations (6 decimals) */
|
|
1404
|
+
declare const USDC_DENOMINATIONS: readonly bigint[];
|
|
1405
|
+
/** All denomination lists by VM31 asset ID */
|
|
1406
|
+
declare const VM31_DENOMINATIONS: Record<number, readonly bigint[]>;
|
|
1407
|
+
/** Denomination lists by token symbol */
|
|
1408
|
+
declare const DENOMINATION_BY_SYMBOL: Record<string, readonly bigint[]>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Validate that a deposit amount is a standard denomination.
|
|
1411
|
+
* Throws if the amount is not in the whitelist.
|
|
1412
|
+
* Unknown assets pass through (forward-compatible).
|
|
1413
|
+
*
|
|
1414
|
+
* @param amount - Amount in base units (e.g., wei, satoshis)
|
|
1415
|
+
* @param assetIdOrSymbol - VM31 asset ID (0-4) or token symbol
|
|
1416
|
+
*/
|
|
1417
|
+
declare function validateDenomination(amount: bigint, assetIdOrSymbol: number | string): void;
|
|
1418
|
+
/**
|
|
1419
|
+
* Split an amount into the fewest standard denominations (greedy, largest first).
|
|
1420
|
+
* Useful for automatically batching a deposit into multiple denomination-safe transactions.
|
|
1421
|
+
*
|
|
1422
|
+
* @returns denominations array and any remainder that can't be represented
|
|
1423
|
+
*/
|
|
1424
|
+
declare function splitIntoDenominations(amount: bigint, assetIdOrSymbol: number | string): {
|
|
1425
|
+
denominations: bigint[];
|
|
1426
|
+
remainder: bigint;
|
|
1427
|
+
};
|
|
1428
|
+
/**
|
|
1429
|
+
* Get valid denominations for an asset.
|
|
1430
|
+
* Returns undefined for unknown assets.
|
|
1431
|
+
*/
|
|
1432
|
+
declare function getDenominations(assetIdOrSymbol: number | string): readonly bigint[] | undefined;
|
|
1433
|
+
|
|
1434
|
+
export { type AssetPair, type BatchStatus, type BridgeConfig, type ClaimFillParams, type ClaimParams, type CommitOrderParams, ConfidentialTransferClient, DARKPOOL_ASSET_IDS, DENOMINATION_BY_SYMBOL, DarkPoolClient, type DarkPoolDepositParams, type DarkPoolOrderData, type DepositParams, type DepositResult, type ECIESEnvelope, ECPoint, ETH_DENOMINATIONS, type EpochInfo, type FundParams, type GpuTier, MAINNET_PRIVACY_POOLS, MAINNET_TOKENS, type OTCOrder, OTCOrderbookClient, type OTCTrade, ObelyskClient, type ObelyskConfig, type ObelyskNetwork, ObelyskPrivacy, OrderSide, OrderStatus, OrderType, type OrderbookConfig, type OrderbookDepth, type OrderbookDepthLevel, type PackedDigest, type PlaceLimitOrderParams, type PlaceMarketOrderParams, type PrivacyNote, PrivacyPoolClient, PrivacyRouterClient, type PrivateAccount, ProverStakingClient, type RelayerInfo, type RevealOrderParams, SAGE_DENOMINATIONS, STRK_DENOMINATIONS, ShieldedSwapClient, type ShieldedSwapParams, type StakingConfig, type Stats24h, type StealthAnnouncement, StealthClient, type StealthMetaAddress, type StealthSendParams, type StealthSpendingProof, TOKEN_DECIMALS, type TradingPair, type TransferParams, USDC_DENOMINATIONS, type VM31AssetId, VM31BridgeClient, VM31VaultClient, VM31_ASSET_IDS, VM31_DENOMINATIONS, type VaultBatchInfo, type VaultDepositParams, type VaultMerklePath, type VaultNote, type VaultSubmitResult, type VaultTransferParams, type VaultWithdrawParams, WBTC_DENOMINATIONS, type WithdrawCTParams, type WithdrawParams, type WithdrawResult, type WorkerStake, commitmentToHash, createAEHint, createEncryptionProof, deriveNullifier, ecAdd, ecMul, eciesEncrypt, elgamalEncrypt, formatAmount, getContracts, getDenominations, getRpcUrl, mod, modInverse, parseAmount, pedersenCommit, randomScalar, splitIntoDenominations, validateDenomination };
|