@obelyzk/sdk 0.5.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -1
- package/dist/obelysk/index.d.mts +868 -1
- package/dist/obelysk/index.d.ts +868 -1
- package/dist/obelysk/index.js +1613 -2
- package/dist/obelysk/index.mjs +1597 -2
- package/dist/privacy/index.mjs +1 -1
- package/dist/react/index.mjs +1 -1
- package/package.json +1 -1
package/dist/obelysk/index.d.mts
CHANGED
|
@@ -150,6 +150,41 @@ interface EpochInfo {
|
|
|
150
150
|
phase: 'Commit' | 'Reveal' | 'Settle' | 'Closed';
|
|
151
151
|
blocksRemaining: number;
|
|
152
152
|
}
|
|
153
|
+
interface ClaimFillParams {
|
|
154
|
+
orderId: bigint;
|
|
155
|
+
receiveCipher: {
|
|
156
|
+
c1: {
|
|
157
|
+
x: bigint;
|
|
158
|
+
y: bigint;
|
|
159
|
+
};
|
|
160
|
+
c2: {
|
|
161
|
+
x: bigint;
|
|
162
|
+
y: bigint;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
receiveHint: bigint;
|
|
166
|
+
receiveProof: {
|
|
167
|
+
commitment: bigint;
|
|
168
|
+
challenge: bigint;
|
|
169
|
+
response: bigint;
|
|
170
|
+
};
|
|
171
|
+
spendCipher: {
|
|
172
|
+
c1: {
|
|
173
|
+
x: bigint;
|
|
174
|
+
y: bigint;
|
|
175
|
+
};
|
|
176
|
+
c2: {
|
|
177
|
+
x: bigint;
|
|
178
|
+
y: bigint;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
spendHint: bigint;
|
|
182
|
+
spendProof: {
|
|
183
|
+
commitment: bigint;
|
|
184
|
+
challenge: bigint;
|
|
185
|
+
response: bigint;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
153
188
|
declare class DarkPoolClient {
|
|
154
189
|
private readonly obelysk;
|
|
155
190
|
constructor(obelysk: ObelyskClient);
|
|
@@ -210,6 +245,72 @@ declare class DarkPoolClient {
|
|
|
210
245
|
}): Promise<{
|
|
211
246
|
txHash: string;
|
|
212
247
|
}>;
|
|
248
|
+
/** Cancel an order before reveal. */
|
|
249
|
+
cancelOrder(orderId: bigint): Promise<string>;
|
|
250
|
+
/** Claim fills after epoch settlement. */
|
|
251
|
+
claimFill(params: {
|
|
252
|
+
orderId: bigint;
|
|
253
|
+
receiveCipher: {
|
|
254
|
+
c1: {
|
|
255
|
+
x: bigint;
|
|
256
|
+
y: bigint;
|
|
257
|
+
};
|
|
258
|
+
c2: {
|
|
259
|
+
x: bigint;
|
|
260
|
+
y: bigint;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
receiveHint: bigint;
|
|
264
|
+
receiveProof: {
|
|
265
|
+
commitment: bigint;
|
|
266
|
+
challenge: bigint;
|
|
267
|
+
response: bigint;
|
|
268
|
+
};
|
|
269
|
+
spendCipher: {
|
|
270
|
+
c1: {
|
|
271
|
+
x: bigint;
|
|
272
|
+
y: bigint;
|
|
273
|
+
};
|
|
274
|
+
c2: {
|
|
275
|
+
x: bigint;
|
|
276
|
+
y: bigint;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
spendHint: bigint;
|
|
280
|
+
spendProof: {
|
|
281
|
+
commitment: bigint;
|
|
282
|
+
challenge: bigint;
|
|
283
|
+
response: bigint;
|
|
284
|
+
};
|
|
285
|
+
}): Promise<string>;
|
|
286
|
+
/** Register your ElGamal public key with the DarkPool. */
|
|
287
|
+
registerPubkey(pubkey: {
|
|
288
|
+
x: bigint;
|
|
289
|
+
y: bigint;
|
|
290
|
+
}): Promise<string>;
|
|
291
|
+
/** Get the result of a settled epoch. */
|
|
292
|
+
getEpochResult(epochId: number): Promise<{
|
|
293
|
+
settled: boolean;
|
|
294
|
+
clearingPrices: string[];
|
|
295
|
+
} | null>;
|
|
296
|
+
/** Check if an order has been claimed. */
|
|
297
|
+
isOrderClaimed(orderId: bigint): Promise<boolean>;
|
|
298
|
+
/** Get a trader's registered public key. */
|
|
299
|
+
getTraderPubkey(address: string): Promise<{
|
|
300
|
+
x: bigint;
|
|
301
|
+
y: bigint;
|
|
302
|
+
} | null>;
|
|
303
|
+
/** Get encrypted balance for a trader and asset. */
|
|
304
|
+
getEncryptedBalance(address: string, assetId: string): Promise<{
|
|
305
|
+
c1: {
|
|
306
|
+
x: bigint;
|
|
307
|
+
y: bigint;
|
|
308
|
+
};
|
|
309
|
+
c2: {
|
|
310
|
+
x: bigint;
|
|
311
|
+
y: bigint;
|
|
312
|
+
};
|
|
313
|
+
} | null>;
|
|
213
314
|
}
|
|
214
315
|
|
|
215
316
|
interface StealthSendParams {
|
|
@@ -230,6 +331,30 @@ interface StealthMetaAddress {
|
|
|
230
331
|
y: bigint;
|
|
231
332
|
};
|
|
232
333
|
}
|
|
334
|
+
interface StealthSpendingProof {
|
|
335
|
+
commitment: bigint;
|
|
336
|
+
challenge: bigint;
|
|
337
|
+
response: bigint;
|
|
338
|
+
stealthPubkey: {
|
|
339
|
+
x: bigint;
|
|
340
|
+
y: bigint;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
interface StealthAnnouncement {
|
|
344
|
+
ephemeralPubkey: {
|
|
345
|
+
x: bigint;
|
|
346
|
+
y: bigint;
|
|
347
|
+
};
|
|
348
|
+
stealthAddress: string;
|
|
349
|
+
viewTag: string;
|
|
350
|
+
token: string;
|
|
351
|
+
amount: bigint;
|
|
352
|
+
}
|
|
353
|
+
interface ClaimParams {
|
|
354
|
+
announcementIndex: number;
|
|
355
|
+
spendingProof: StealthSpendingProof;
|
|
356
|
+
recipient: string;
|
|
357
|
+
}
|
|
233
358
|
declare class StealthClient {
|
|
234
359
|
private readonly obelysk;
|
|
235
360
|
constructor(obelysk: ObelyskClient);
|
|
@@ -280,6 +405,64 @@ declare class StealthClient {
|
|
|
280
405
|
}): Promise<{
|
|
281
406
|
txHash: string;
|
|
282
407
|
}>;
|
|
408
|
+
/** Claim a stealth payment. */
|
|
409
|
+
claim(params: {
|
|
410
|
+
announcementIndex: number;
|
|
411
|
+
spendingProof: {
|
|
412
|
+
commitment: bigint;
|
|
413
|
+
challenge: bigint;
|
|
414
|
+
response: bigint;
|
|
415
|
+
stealthPubkey: {
|
|
416
|
+
x: bigint;
|
|
417
|
+
y: bigint;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
recipient: string;
|
|
421
|
+
}): Promise<string>;
|
|
422
|
+
/** Batch claim multiple stealth payments. */
|
|
423
|
+
batchClaim(params: {
|
|
424
|
+
announcementIndices: number[];
|
|
425
|
+
spendingProofs: Array<{
|
|
426
|
+
commitment: bigint;
|
|
427
|
+
challenge: bigint;
|
|
428
|
+
response: bigint;
|
|
429
|
+
stealthPubkey: {
|
|
430
|
+
x: bigint;
|
|
431
|
+
y: bigint;
|
|
432
|
+
};
|
|
433
|
+
}>;
|
|
434
|
+
recipient: string;
|
|
435
|
+
}): Promise<string>;
|
|
436
|
+
/** Update your stealth meta-address. */
|
|
437
|
+
updateMetaAddress(spendPubKey: {
|
|
438
|
+
x: bigint;
|
|
439
|
+
y: bigint;
|
|
440
|
+
}, viewPubKey: {
|
|
441
|
+
x: bigint;
|
|
442
|
+
y: bigint;
|
|
443
|
+
}): Promise<string>;
|
|
444
|
+
/** Get a specific announcement by index. */
|
|
445
|
+
getAnnouncement(index: number): Promise<{
|
|
446
|
+
ephemeralPubkey: {
|
|
447
|
+
x: bigint;
|
|
448
|
+
y: bigint;
|
|
449
|
+
};
|
|
450
|
+
stealthAddress: string;
|
|
451
|
+
viewTag: string;
|
|
452
|
+
token: string;
|
|
453
|
+
amount: bigint;
|
|
454
|
+
} | null>;
|
|
455
|
+
/** Get announcements in a range. */
|
|
456
|
+
getAnnouncementsRange(start: number, end: number): Promise<Array<{
|
|
457
|
+
ephemeralPubkey: {
|
|
458
|
+
x: bigint;
|
|
459
|
+
y: bigint;
|
|
460
|
+
};
|
|
461
|
+
stealthAddress: string;
|
|
462
|
+
viewTag: string;
|
|
463
|
+
token: string;
|
|
464
|
+
amount: bigint;
|
|
465
|
+
}>>;
|
|
283
466
|
}
|
|
284
467
|
|
|
285
468
|
/** Modular reduction (always positive) */
|
|
@@ -326,6 +509,22 @@ interface TransferParams {
|
|
|
326
509
|
/** Token symbol */
|
|
327
510
|
token: string;
|
|
328
511
|
}
|
|
512
|
+
interface FundParams {
|
|
513
|
+
assetId: number;
|
|
514
|
+
amount: bigint;
|
|
515
|
+
encryptionRandomness: bigint;
|
|
516
|
+
aeHint: bigint;
|
|
517
|
+
}
|
|
518
|
+
interface WithdrawCTParams {
|
|
519
|
+
to: string;
|
|
520
|
+
assetId: number;
|
|
521
|
+
amount: bigint;
|
|
522
|
+
proof: {
|
|
523
|
+
commitment: bigint;
|
|
524
|
+
challenge: bigint;
|
|
525
|
+
response: bigint;
|
|
526
|
+
};
|
|
527
|
+
}
|
|
329
528
|
declare class ConfidentialTransferClient {
|
|
330
529
|
private readonly obelysk;
|
|
331
530
|
constructor(obelysk: ObelyskClient);
|
|
@@ -345,6 +544,44 @@ declare class ConfidentialTransferClient {
|
|
|
345
544
|
c1: ECPoint;
|
|
346
545
|
c2: ECPoint;
|
|
347
546
|
} | null>;
|
|
547
|
+
/** Register an ElGamal public key for confidential transfers. */
|
|
548
|
+
register(publicKey: {
|
|
549
|
+
x: bigint;
|
|
550
|
+
y: bigint;
|
|
551
|
+
}): Promise<string>;
|
|
552
|
+
/** Fund: deposit public tokens into encrypted balance. */
|
|
553
|
+
fund(params: {
|
|
554
|
+
assetId: number;
|
|
555
|
+
amount: bigint;
|
|
556
|
+
encryptionRandomness: bigint;
|
|
557
|
+
aeHint: bigint;
|
|
558
|
+
}): Promise<string>;
|
|
559
|
+
/** Fund another account's encrypted balance. */
|
|
560
|
+
fundFor(params: {
|
|
561
|
+
account: string;
|
|
562
|
+
assetId: number;
|
|
563
|
+
amount: bigint;
|
|
564
|
+
encryptionRandomness: bigint;
|
|
565
|
+
aeHint: bigint;
|
|
566
|
+
}): Promise<string>;
|
|
567
|
+
/** Rollover: claim pending incoming transfers into your balance. */
|
|
568
|
+
rollover(assetId: number): Promise<string>;
|
|
569
|
+
/** Withdraw: convert encrypted balance back to public tokens. */
|
|
570
|
+
withdraw(params: {
|
|
571
|
+
to: string;
|
|
572
|
+
assetId: number;
|
|
573
|
+
amount: bigint;
|
|
574
|
+
proof: {
|
|
575
|
+
commitment: bigint;
|
|
576
|
+
challenge: bigint;
|
|
577
|
+
response: bigint;
|
|
578
|
+
};
|
|
579
|
+
}): Promise<string>;
|
|
580
|
+
/** Get a registered public key. */
|
|
581
|
+
getPublicKey(address: string): Promise<{
|
|
582
|
+
x: bigint;
|
|
583
|
+
y: bigint;
|
|
584
|
+
} | null>;
|
|
348
585
|
}
|
|
349
586
|
|
|
350
587
|
type GpuTier = 'Consumer' | 'Professional' | 'DataCenter' | 'H100';
|
|
@@ -466,6 +703,96 @@ declare class PrivacyRouterClient {
|
|
|
466
703
|
isLeanIMTActive(): Promise<boolean>;
|
|
467
704
|
/** Get pending audit/disclosure request count. */
|
|
468
705
|
getPendingRequestCount(): Promise<number>;
|
|
706
|
+
/** Register an account with the privacy router. */
|
|
707
|
+
registerAccount(publicKey: {
|
|
708
|
+
x: bigint;
|
|
709
|
+
y: bigint;
|
|
710
|
+
}): Promise<string>;
|
|
711
|
+
/** Deposit tokens into encrypted balance. */
|
|
712
|
+
deposit(params: {
|
|
713
|
+
amount: bigint;
|
|
714
|
+
encryptedAmount: {
|
|
715
|
+
c1: {
|
|
716
|
+
x: bigint;
|
|
717
|
+
y: bigint;
|
|
718
|
+
};
|
|
719
|
+
c2: {
|
|
720
|
+
x: bigint;
|
|
721
|
+
y: bigint;
|
|
722
|
+
};
|
|
723
|
+
};
|
|
724
|
+
proof: {
|
|
725
|
+
commitment: bigint;
|
|
726
|
+
challenge: bigint;
|
|
727
|
+
response: bigint;
|
|
728
|
+
};
|
|
729
|
+
}): Promise<string>;
|
|
730
|
+
/** Withdraw from encrypted balance to public. */
|
|
731
|
+
withdraw(params: {
|
|
732
|
+
amount: bigint;
|
|
733
|
+
encryptedDelta: {
|
|
734
|
+
c1: {
|
|
735
|
+
x: bigint;
|
|
736
|
+
y: bigint;
|
|
737
|
+
};
|
|
738
|
+
c2: {
|
|
739
|
+
x: bigint;
|
|
740
|
+
y: bigint;
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
proof: {
|
|
744
|
+
commitment: bigint;
|
|
745
|
+
challenge: bigint;
|
|
746
|
+
response: bigint;
|
|
747
|
+
};
|
|
748
|
+
rangeProofData?: string[];
|
|
749
|
+
}): Promise<string>;
|
|
750
|
+
/** Private transfer between accounts. */
|
|
751
|
+
privateTransfer(params: {
|
|
752
|
+
to: string;
|
|
753
|
+
senderCipher: {
|
|
754
|
+
c1: {
|
|
755
|
+
x: bigint;
|
|
756
|
+
y: bigint;
|
|
757
|
+
};
|
|
758
|
+
c2: {
|
|
759
|
+
x: bigint;
|
|
760
|
+
y: bigint;
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
receiverCipher: {
|
|
764
|
+
c1: {
|
|
765
|
+
x: bigint;
|
|
766
|
+
y: bigint;
|
|
767
|
+
};
|
|
768
|
+
c2: {
|
|
769
|
+
x: bigint;
|
|
770
|
+
y: bigint;
|
|
771
|
+
};
|
|
772
|
+
};
|
|
773
|
+
proof: {
|
|
774
|
+
commitment: bigint;
|
|
775
|
+
challenge: bigint;
|
|
776
|
+
response: bigint;
|
|
777
|
+
};
|
|
778
|
+
senderAeHint: bigint;
|
|
779
|
+
receiverAeHint: bigint;
|
|
780
|
+
}): Promise<string>;
|
|
781
|
+
/** Request disclosure of a nullifier (audit). */
|
|
782
|
+
requestDisclosure(nullifier: string, reason: string): Promise<string>;
|
|
783
|
+
/** Ragequit: emergency withdrawal with proof. */
|
|
784
|
+
ragequit(proof: string[]): Promise<string>;
|
|
785
|
+
/** Get the nullifier tree state. */
|
|
786
|
+
getNullifierTreeState(): Promise<{
|
|
787
|
+
root: string;
|
|
788
|
+
size: number;
|
|
789
|
+
}>;
|
|
790
|
+
/** Get account balance hints (for O(1) decryption). */
|
|
791
|
+
getAccountHints(address: string): Promise<{
|
|
792
|
+
balanceHint: bigint;
|
|
793
|
+
pendingInHint: bigint;
|
|
794
|
+
pendingOutHint: bigint;
|
|
795
|
+
} | null>;
|
|
469
796
|
}
|
|
470
797
|
|
|
471
798
|
/**
|
|
@@ -476,6 +803,18 @@ declare class PrivacyRouterClient {
|
|
|
476
803
|
* privacy pool → swap → re-deposit flow.
|
|
477
804
|
*/
|
|
478
805
|
|
|
806
|
+
interface ShieldedSwapParams {
|
|
807
|
+
tokenIn: string;
|
|
808
|
+
tokenOut: string;
|
|
809
|
+
amountIn: bigint;
|
|
810
|
+
minAmountOut: bigint;
|
|
811
|
+
nullifier: string;
|
|
812
|
+
merkleRoot: string;
|
|
813
|
+
merkleProof: string[];
|
|
814
|
+
newCommitment: string;
|
|
815
|
+
encryptedAmount: bigint;
|
|
816
|
+
proof: string;
|
|
817
|
+
}
|
|
479
818
|
declare class ShieldedSwapClient {
|
|
480
819
|
private readonly obelysk;
|
|
481
820
|
constructor(obelysk: ObelyskClient);
|
|
@@ -493,6 +832,452 @@ declare class ShieldedSwapClient {
|
|
|
493
832
|
} | null>;
|
|
494
833
|
/** Get contract owner. */
|
|
495
834
|
getOwner(): Promise<string>;
|
|
835
|
+
/**
|
|
836
|
+
* Execute a shielded swap (privacy pool -> AMM -> re-deposit).
|
|
837
|
+
* This is the full privacy-preserving swap flow.
|
|
838
|
+
*/
|
|
839
|
+
shieldedSwap(params: ShieldedSwapParams): Promise<string>;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* VM31 UTXO Privacy Vault Client
|
|
844
|
+
*
|
|
845
|
+
* Wraps both on-chain VM31Pool contract reads and the VM31 relayer HTTP API
|
|
846
|
+
* for transaction submission. The VM31 system uses Poseidon2-M31 hashing
|
|
847
|
+
* with a UTXO model for confidential token transfers.
|
|
848
|
+
*
|
|
849
|
+
* On-chain reads go through `callContract()` to the VM31Pool.
|
|
850
|
+
* Transaction submissions (deposit/withdraw/transfer) go through the
|
|
851
|
+
* VM31 relayer HTTP API, which batches and proves transactions.
|
|
852
|
+
*/
|
|
853
|
+
|
|
854
|
+
interface PackedDigest {
|
|
855
|
+
lo: string;
|
|
856
|
+
hi: string;
|
|
857
|
+
}
|
|
858
|
+
type VM31AssetId = number;
|
|
859
|
+
type BatchStatus = 'queued' | 'proving' | 'confirmed' | 'finalized' | 'error';
|
|
860
|
+
interface VaultNote {
|
|
861
|
+
owner_pubkey: [number, number, number, number];
|
|
862
|
+
asset_id: number;
|
|
863
|
+
amount_lo: number;
|
|
864
|
+
amount_hi: number;
|
|
865
|
+
blinding: [number, number, number, number];
|
|
866
|
+
}
|
|
867
|
+
interface VaultMerklePath {
|
|
868
|
+
siblings: number[][];
|
|
869
|
+
index: number;
|
|
870
|
+
}
|
|
871
|
+
interface VaultDepositParams {
|
|
872
|
+
amount: bigint;
|
|
873
|
+
assetId: number;
|
|
874
|
+
recipientPubkey: [number, number, number, number];
|
|
875
|
+
recipientViewingKey: [number, number, number, number];
|
|
876
|
+
}
|
|
877
|
+
interface VaultWithdrawParams {
|
|
878
|
+
amount: bigint;
|
|
879
|
+
assetId: number;
|
|
880
|
+
note: VaultNote;
|
|
881
|
+
spendingKey: [number, number, number, number];
|
|
882
|
+
merklePath: VaultMerklePath;
|
|
883
|
+
merkleRoot: number[];
|
|
884
|
+
withdrawalBinding: number[];
|
|
885
|
+
bindingSalt?: number[];
|
|
886
|
+
}
|
|
887
|
+
interface VaultTransferParams {
|
|
888
|
+
amount: bigint;
|
|
889
|
+
assetId: number;
|
|
890
|
+
recipientPubkey: [number, number, number, number];
|
|
891
|
+
recipientViewingKey: [number, number, number, number];
|
|
892
|
+
senderViewingKey: [number, number, number, number];
|
|
893
|
+
inputNotes: Array<{
|
|
894
|
+
note: VaultNote;
|
|
895
|
+
spendingKey: [number, number, number, number];
|
|
896
|
+
merklePath: VaultMerklePath;
|
|
897
|
+
}>;
|
|
898
|
+
merkleRoot: number[];
|
|
899
|
+
}
|
|
900
|
+
interface VaultSubmitResult {
|
|
901
|
+
status: 'queued' | 'batch_triggered' | 'duplicate';
|
|
902
|
+
batchId?: string;
|
|
903
|
+
queuePosition?: number;
|
|
904
|
+
idempotencyKey?: string;
|
|
905
|
+
}
|
|
906
|
+
interface VaultBatchInfo {
|
|
907
|
+
id: string;
|
|
908
|
+
status: BatchStatus;
|
|
909
|
+
txCount: number;
|
|
910
|
+
proofHash?: string;
|
|
911
|
+
batchIdOnchain?: string;
|
|
912
|
+
txHash?: string;
|
|
913
|
+
createdAt?: string;
|
|
914
|
+
error?: string;
|
|
915
|
+
}
|
|
916
|
+
interface RelayerInfo {
|
|
917
|
+
pendingTransactions: number;
|
|
918
|
+
batchMaxSize: number;
|
|
919
|
+
batchTimeoutSecs: number;
|
|
920
|
+
}
|
|
921
|
+
declare class VM31VaultClient {
|
|
922
|
+
private readonly obelysk;
|
|
923
|
+
constructor(obelysk: ObelyskClient);
|
|
924
|
+
private get contractAddress();
|
|
925
|
+
private get relayerUrl();
|
|
926
|
+
private get relayerApiKey();
|
|
927
|
+
/** Cached relayer X25519 public key (fetched on first encrypted submit) */
|
|
928
|
+
private _relayerPubkey;
|
|
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;
|
|
935
|
+
/** Get the current Merkle root of the VM31 commitment tree */
|
|
936
|
+
getMerkleRoot(): Promise<PackedDigest>;
|
|
937
|
+
/** Get the number of leaves in the commitment tree */
|
|
938
|
+
getTreeSize(): Promise<number>;
|
|
939
|
+
/** Check if a nullifier has been spent */
|
|
940
|
+
isNullifierSpent(nullifier: PackedDigest): Promise<boolean>;
|
|
941
|
+
/** Check if a Merkle root is known (valid historical root) */
|
|
942
|
+
isKnownRoot(root: PackedDigest): Promise<boolean>;
|
|
943
|
+
/** Get the total balance of an asset held in the pool */
|
|
944
|
+
getAssetBalance(assetId: number): Promise<bigint>;
|
|
945
|
+
/** Get on-chain batch status (0=NONE, 1=SUBMITTED, 2=FINALIZED, 3=CANCELLED) */
|
|
946
|
+
getBatchStatus(batchId: string): Promise<number>;
|
|
947
|
+
/** Get the currently active batch ID */
|
|
948
|
+
getActiveBatchId(): Promise<string>;
|
|
949
|
+
/** Get total transaction count in a batch */
|
|
950
|
+
getBatchTotalTxs(batchId: string): Promise<number>;
|
|
951
|
+
/** Get number of processed transactions in a batch */
|
|
952
|
+
getBatchProcessedCount(batchId: string): Promise<number>;
|
|
953
|
+
/** Get the ERC-20 token address for a VM31 asset ID */
|
|
954
|
+
getAssetToken(assetId: number): Promise<string>;
|
|
955
|
+
/** Get the VM31 asset ID for a given ERC-20 token address */
|
|
956
|
+
getTokenAsset(tokenAddress: string): Promise<number>;
|
|
957
|
+
/** Check if the VM31Pool contract is paused */
|
|
958
|
+
isPaused(): Promise<boolean>;
|
|
959
|
+
/** Get the contract owner address */
|
|
960
|
+
getOwner(): Promise<string>;
|
|
961
|
+
/** Get the authorized relayer address */
|
|
962
|
+
getRelayer(): Promise<string>;
|
|
963
|
+
/** Get batch timeout in blocks */
|
|
964
|
+
getBatchTimeoutBlocks(): Promise<number>;
|
|
965
|
+
/** Check relayer health (no auth required) */
|
|
966
|
+
getRelayerHealth(): Promise<{
|
|
967
|
+
status: string;
|
|
968
|
+
version: string;
|
|
969
|
+
service: string;
|
|
970
|
+
}>;
|
|
971
|
+
/** Get relayer queue status */
|
|
972
|
+
getRelayerStatus(): Promise<RelayerInfo>;
|
|
973
|
+
/** Get the relayer's public encryption key */
|
|
974
|
+
getRelayerPublicKey(): Promise<{
|
|
975
|
+
publicKey: string;
|
|
976
|
+
version: number;
|
|
977
|
+
algorithm: string;
|
|
978
|
+
}>;
|
|
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>;
|
|
997
|
+
/** Query batch info from the relayer */
|
|
998
|
+
queryBatch(batchId: string): Promise<VaultBatchInfo>;
|
|
999
|
+
/** Fetch Merkle path for a commitment from the relayer */
|
|
1000
|
+
fetchMerklePath(commitment: string): Promise<{
|
|
1001
|
+
commitment: string;
|
|
1002
|
+
merklePath: VaultMerklePath | null;
|
|
1003
|
+
merkleRoot: number[] | null;
|
|
1004
|
+
batchId: string | null;
|
|
1005
|
+
createdAt?: string;
|
|
1006
|
+
status?: string;
|
|
1007
|
+
}>;
|
|
1008
|
+
/** Force the relayer to prove the current batch immediately */
|
|
1009
|
+
forceProve(): Promise<{
|
|
1010
|
+
status: string;
|
|
1011
|
+
batchId?: string;
|
|
1012
|
+
}>;
|
|
1013
|
+
/** Encode a bigint amount into M31 lo/hi pair (31-bit limbs) */
|
|
1014
|
+
static encodeAmountM31(amount: bigint): {
|
|
1015
|
+
lo: number;
|
|
1016
|
+
hi: number;
|
|
1017
|
+
};
|
|
1018
|
+
/** Decode an M31 lo/hi pair back into a bigint amount */
|
|
1019
|
+
static decodeAmountM31(lo: number, hi: number): bigint;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* VM31 Confidential Bridge Client
|
|
1024
|
+
*
|
|
1025
|
+
* Read-only views into the VM31Bridge contract, which facilitates
|
|
1026
|
+
* bridging between the VM31 UTXO pool and the ElGamal-based
|
|
1027
|
+
* ConfidentialTransfer system.
|
|
1028
|
+
*/
|
|
1029
|
+
|
|
1030
|
+
interface AssetPair {
|
|
1031
|
+
vm31AssetId: string;
|
|
1032
|
+
confidentialAssetId: string;
|
|
1033
|
+
}
|
|
1034
|
+
interface BridgeConfig {
|
|
1035
|
+
relayer: string;
|
|
1036
|
+
vm31Pool: string;
|
|
1037
|
+
confidentialTransfer: string;
|
|
1038
|
+
}
|
|
1039
|
+
declare class VM31BridgeClient {
|
|
1040
|
+
private readonly obelysk;
|
|
1041
|
+
constructor(obelysk: ObelyskClient);
|
|
1042
|
+
private get contractAddress();
|
|
1043
|
+
/** Get the authorized relayer address */
|
|
1044
|
+
getRelayer(): Promise<string>;
|
|
1045
|
+
/** Get the VM31Pool contract address */
|
|
1046
|
+
getVM31Pool(): Promise<string>;
|
|
1047
|
+
/** Get the ConfidentialTransfer contract address */
|
|
1048
|
+
getConfidentialTransfer(): Promise<string>;
|
|
1049
|
+
/** Get the asset pair mapping for a given token address */
|
|
1050
|
+
getAssetPair(tokenAddress: string): Promise<AssetPair | null>;
|
|
1051
|
+
/** Check if a bridge key has already been processed */
|
|
1052
|
+
isBridgeKeyProcessed(bridgeKey: string): Promise<boolean>;
|
|
1053
|
+
/** Compute a bridge key from withdrawal parameters */
|
|
1054
|
+
computeBridgeKey(params: {
|
|
1055
|
+
batchId: string;
|
|
1056
|
+
withdrawalIdx: number;
|
|
1057
|
+
payoutRecipient: string;
|
|
1058
|
+
creditRecipient: string;
|
|
1059
|
+
token: string;
|
|
1060
|
+
amount: bigint;
|
|
1061
|
+
}): Promise<string>;
|
|
1062
|
+
/** Get full bridge configuration (relayer, vm31Pool, confidentialTransfer) */
|
|
1063
|
+
getConfig(): Promise<BridgeConfig>;
|
|
1064
|
+
/** Get pending upgrade info, if any */
|
|
1065
|
+
getPendingUpgrade(): Promise<{
|
|
1066
|
+
classHash: string;
|
|
1067
|
+
scheduledAt: number;
|
|
1068
|
+
} | null>;
|
|
1069
|
+
/** Check if the bridge contract is paused */
|
|
1070
|
+
isPaused(): Promise<boolean>;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* OTC Orderbook Client
|
|
1075
|
+
*
|
|
1076
|
+
* On-chain limit/market order book for peer-to-peer token trading.
|
|
1077
|
+
* Supports limit orders, market orders, batch operations, and
|
|
1078
|
+
* real-time orderbook depth queries.
|
|
1079
|
+
*/
|
|
1080
|
+
|
|
1081
|
+
declare enum OrderSide {
|
|
1082
|
+
Buy = 0,
|
|
1083
|
+
Sell = 1
|
|
1084
|
+
}
|
|
1085
|
+
declare enum OrderType {
|
|
1086
|
+
Limit = 0,
|
|
1087
|
+
Market = 1
|
|
1088
|
+
}
|
|
1089
|
+
declare enum OrderStatus {
|
|
1090
|
+
Open = 0,
|
|
1091
|
+
PartialFill = 1,
|
|
1092
|
+
Filled = 2,
|
|
1093
|
+
Cancelled = 3,
|
|
1094
|
+
Expired = 4
|
|
1095
|
+
}
|
|
1096
|
+
interface TradingPair {
|
|
1097
|
+
baseToken: string;
|
|
1098
|
+
quoteToken: string;
|
|
1099
|
+
minOrderSize: bigint;
|
|
1100
|
+
tickSize: bigint;
|
|
1101
|
+
isActive: boolean;
|
|
1102
|
+
}
|
|
1103
|
+
interface OTCOrder {
|
|
1104
|
+
orderId: bigint;
|
|
1105
|
+
maker: string;
|
|
1106
|
+
pairId: number;
|
|
1107
|
+
side: OrderSide;
|
|
1108
|
+
orderType: OrderType;
|
|
1109
|
+
price: bigint;
|
|
1110
|
+
remaining: bigint;
|
|
1111
|
+
amount: bigint;
|
|
1112
|
+
status: OrderStatus;
|
|
1113
|
+
createdAt: number;
|
|
1114
|
+
expiresAt: number;
|
|
1115
|
+
}
|
|
1116
|
+
interface OTCTrade {
|
|
1117
|
+
tradeId: bigint;
|
|
1118
|
+
makerOrderId: bigint;
|
|
1119
|
+
takerOrderId: bigint;
|
|
1120
|
+
maker: string;
|
|
1121
|
+
taker: string;
|
|
1122
|
+
price: bigint;
|
|
1123
|
+
amount: bigint;
|
|
1124
|
+
quoteAmount: bigint;
|
|
1125
|
+
executedAt: number;
|
|
1126
|
+
}
|
|
1127
|
+
interface OrderbookConfig {
|
|
1128
|
+
makerFeeBps: number;
|
|
1129
|
+
takerFeeBps: number;
|
|
1130
|
+
defaultExpirySecs: number;
|
|
1131
|
+
maxOrdersPerUser: number;
|
|
1132
|
+
paused: boolean;
|
|
1133
|
+
}
|
|
1134
|
+
interface PlaceLimitOrderParams {
|
|
1135
|
+
pairId: number;
|
|
1136
|
+
side: OrderSide;
|
|
1137
|
+
price: bigint;
|
|
1138
|
+
amount: bigint;
|
|
1139
|
+
/** Seconds until expiry. 0 or undefined uses the contract default. */
|
|
1140
|
+
expiresIn?: number;
|
|
1141
|
+
}
|
|
1142
|
+
interface PlaceMarketOrderParams {
|
|
1143
|
+
pairId: number;
|
|
1144
|
+
side: OrderSide;
|
|
1145
|
+
amount: bigint;
|
|
1146
|
+
}
|
|
1147
|
+
interface OrderbookDepthLevel {
|
|
1148
|
+
price: bigint;
|
|
1149
|
+
totalAmount: bigint;
|
|
1150
|
+
orderCount: number;
|
|
1151
|
+
}
|
|
1152
|
+
interface OrderbookDepth {
|
|
1153
|
+
bids: OrderbookDepthLevel[];
|
|
1154
|
+
asks: OrderbookDepthLevel[];
|
|
1155
|
+
}
|
|
1156
|
+
interface Stats24h {
|
|
1157
|
+
volume: bigint;
|
|
1158
|
+
high: bigint;
|
|
1159
|
+
low: bigint;
|
|
1160
|
+
tradeCount: bigint;
|
|
1161
|
+
}
|
|
1162
|
+
declare class OTCOrderbookClient {
|
|
1163
|
+
private readonly obelysk;
|
|
1164
|
+
constructor(obelysk: ObelyskClient);
|
|
1165
|
+
private get contractAddress();
|
|
1166
|
+
/**
|
|
1167
|
+
* Place a limit order on the orderbook.
|
|
1168
|
+
*
|
|
1169
|
+
* The contract handles internal matching against resting orders.
|
|
1170
|
+
* Returns the transaction hash.
|
|
1171
|
+
*/
|
|
1172
|
+
placeLimitOrder(params: PlaceLimitOrderParams): Promise<string>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Place a market order that fills immediately against resting liquidity.
|
|
1175
|
+
* Returns the transaction hash.
|
|
1176
|
+
*/
|
|
1177
|
+
placeMarketOrder(params: PlaceMarketOrderParams): Promise<string>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Cancel a single order by ID.
|
|
1180
|
+
* Only the maker can cancel their own order.
|
|
1181
|
+
*/
|
|
1182
|
+
cancelOrder(orderId: bigint): Promise<string>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Cancel all open orders for the caller.
|
|
1185
|
+
*/
|
|
1186
|
+
cancelAllOrders(): Promise<string>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Place multiple limit orders in a single transaction.
|
|
1189
|
+
*
|
|
1190
|
+
* Cairo expects an array of (u8, OrderSide, u256, u256, u64) tuples.
|
|
1191
|
+
* Calldata: [length, ...flattened orders].
|
|
1192
|
+
*/
|
|
1193
|
+
batchPlaceOrders(orders: PlaceLimitOrderParams[]): Promise<string>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Cancel multiple orders in a single transaction.
|
|
1196
|
+
*
|
|
1197
|
+
* Calldata: [length, ...flattened u256 order IDs].
|
|
1198
|
+
*/
|
|
1199
|
+
batchCancelOrders(orderIds: bigint[]): Promise<string>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Get a single order by ID.
|
|
1202
|
+
*/
|
|
1203
|
+
getOrder(orderId: bigint): Promise<OTCOrder>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Get all order IDs belonging to a user.
|
|
1206
|
+
*/
|
|
1207
|
+
getUserOrders(user: string): Promise<bigint[]>;
|
|
1208
|
+
/**
|
|
1209
|
+
* Get the best (highest) bid price for a trading pair.
|
|
1210
|
+
*/
|
|
1211
|
+
getBestBid(pairId: number): Promise<bigint>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Get the best (lowest) ask price for a trading pair.
|
|
1214
|
+
*/
|
|
1215
|
+
getBestAsk(pairId: number): Promise<bigint>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Get the bid-ask spread for a trading pair.
|
|
1218
|
+
*/
|
|
1219
|
+
getSpread(pairId: number): Promise<bigint>;
|
|
1220
|
+
/**
|
|
1221
|
+
* Get trading pair configuration.
|
|
1222
|
+
*/
|
|
1223
|
+
getPair(pairId: number): Promise<TradingPair>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Get the orderbook configuration (fees, limits, pause state).
|
|
1226
|
+
*/
|
|
1227
|
+
getConfig(): Promise<OrderbookConfig>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Get aggregate orderbook statistics.
|
|
1230
|
+
*/
|
|
1231
|
+
getStats(): Promise<{
|
|
1232
|
+
orderCount: bigint;
|
|
1233
|
+
tradeCount: bigint;
|
|
1234
|
+
totalVolume: bigint;
|
|
1235
|
+
totalFees: bigint;
|
|
1236
|
+
}>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Get total number of orders ever placed.
|
|
1239
|
+
*/
|
|
1240
|
+
getOrderCount(): Promise<bigint>;
|
|
1241
|
+
/**
|
|
1242
|
+
* Get total number of trades executed.
|
|
1243
|
+
*/
|
|
1244
|
+
getTradeCount(): Promise<bigint>;
|
|
1245
|
+
/**
|
|
1246
|
+
* Get the time-weighted average price for a trading pair.
|
|
1247
|
+
*/
|
|
1248
|
+
getTwap(pairId: number): Promise<bigint>;
|
|
1249
|
+
/**
|
|
1250
|
+
* Get 24-hour rolling statistics for a trading pair.
|
|
1251
|
+
*/
|
|
1252
|
+
get24hStats(pairId: number): Promise<Stats24h>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Get the most recent trade for a trading pair.
|
|
1255
|
+
*/
|
|
1256
|
+
getLastTrade(pairId: number): Promise<{
|
|
1257
|
+
price: bigint;
|
|
1258
|
+
amount: bigint;
|
|
1259
|
+
timestamp: number;
|
|
1260
|
+
}>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Get the orderbook depth (price levels) for a trading pair.
|
|
1263
|
+
*
|
|
1264
|
+
* Returns up to `maxLevels` aggregated price levels for both
|
|
1265
|
+
* bids and asks. Each level contains price, total amount, and
|
|
1266
|
+
* number of orders at that price.
|
|
1267
|
+
*/
|
|
1268
|
+
getOrderbookDepth(pairId: number, maxLevels: number): Promise<OrderbookDepth>;
|
|
1269
|
+
/**
|
|
1270
|
+
* Get active orders for a trading pair with pagination.
|
|
1271
|
+
*/
|
|
1272
|
+
getActiveOrders(pairId: number, offset: number, limit: number): Promise<OTCOrder[]>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Get trade history for a trading pair with pagination.
|
|
1275
|
+
*/
|
|
1276
|
+
getTradeHistory(pairId: number, offset: number, limit: number): Promise<OTCTrade[]>;
|
|
1277
|
+
/**
|
|
1278
|
+
* Get the contract owner address.
|
|
1279
|
+
*/
|
|
1280
|
+
getOwner(): Promise<string>;
|
|
496
1281
|
}
|
|
497
1282
|
|
|
498
1283
|
/**
|
|
@@ -532,6 +1317,10 @@ interface ObelyskConfig {
|
|
|
532
1317
|
rpcUrl?: string;
|
|
533
1318
|
/** Optional privacy key pair (hex private key). If omitted, generated fresh. */
|
|
534
1319
|
privacyPrivateKey?: string;
|
|
1320
|
+
/** VM31 relayer URL (default: https://relay.bitsage.network:3080) */
|
|
1321
|
+
relayerUrl?: string;
|
|
1322
|
+
/** VM31 relayer API key */
|
|
1323
|
+
relayerApiKey?: string;
|
|
535
1324
|
}
|
|
536
1325
|
declare class ObelyskClient {
|
|
537
1326
|
readonly network: ObelyskNetwork;
|
|
@@ -541,6 +1330,8 @@ declare class ObelyskClient {
|
|
|
541
1330
|
readonly contracts: Record<string, string>;
|
|
542
1331
|
readonly tokens: Record<string, string>;
|
|
543
1332
|
readonly privacyPools: Record<string, string>;
|
|
1333
|
+
readonly relayerUrl?: string;
|
|
1334
|
+
readonly relayerApiKey?: string;
|
|
544
1335
|
/** Privacy Pool operations (deposit/withdraw shielded tokens) */
|
|
545
1336
|
readonly privacyPool: PrivacyPoolClient;
|
|
546
1337
|
/** DarkPool batch auction trading */
|
|
@@ -555,6 +1346,12 @@ declare class ObelyskClient {
|
|
|
555
1346
|
readonly router: PrivacyRouterClient;
|
|
556
1347
|
/** Shielded swap router (privacy-preserving AMM swaps) */
|
|
557
1348
|
readonly swap: ShieldedSwapClient;
|
|
1349
|
+
/** VM31 UTXO privacy vault (deposits/withdrawals/transfers via relayer) */
|
|
1350
|
+
readonly vm31: VM31VaultClient;
|
|
1351
|
+
/** VM31 confidential bridge (bridge VM31 withdrawals to encrypted balances) */
|
|
1352
|
+
readonly bridge: VM31BridgeClient;
|
|
1353
|
+
/** OTC orderbook (limit/market orders, trade history) */
|
|
1354
|
+
readonly otc: OTCOrderbookClient;
|
|
558
1355
|
constructor(config: ObelyskConfig);
|
|
559
1356
|
/** Get token address by symbol */
|
|
560
1357
|
getTokenAddress(symbol: string): string;
|
|
@@ -564,4 +1361,74 @@ declare class ObelyskClient {
|
|
|
564
1361
|
requireAccount(): Account;
|
|
565
1362
|
}
|
|
566
1363
|
|
|
567
|
-
|
|
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 };
|