@zama-fhe/sdk 3.4.0-alpha.8 → 3.4.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/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/ethers/index.cjs +1 -1
- package/dist/cjs/ethers/index.cjs.map +1 -1
- package/dist/cjs/fhevm-relayer.cjs +1 -1
- package/dist/cjs/fhevm-relayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/sdk-events.cjs +2 -0
- package/dist/cjs/sdk-events.cjs.map +1 -0
- package/dist/cjs/token.cjs +1 -1
- package/dist/cjs/token.cjs.map +1 -1
- package/dist/cjs/viem/index.cjs +1 -1
- package/dist/cjs/viem/index.cjs.map +1 -1
- package/dist/esm/{base-signer-Ds8CoYy0.d.ts → base-signer-BvL-jMNO.d.ts} +15 -2
- package/dist/esm/base-signer-YpkEmlp2.js +2 -0
- package/dist/esm/base-signer-YpkEmlp2.js.map +1 -0
- package/dist/esm/chains/index.d.ts +1 -1
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-_RCZVPOe.d.ts → cleartext-CxlICeUh.d.ts} +2 -2
- package/dist/esm/{cleartext-DfX0GUj1.js → cleartext-Qqh5JohW.js} +2 -2
- package/dist/esm/{cleartext-DfX0GUj1.js.map → cleartext-Qqh5JohW.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +53 -5
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/ethers/index.js.map +1 -1
- package/dist/esm/fhevm-relayer-4Zd4QkKq.js +2 -0
- package/dist/esm/fhevm-relayer-4Zd4QkKq.js.map +1 -0
- package/dist/esm/{index-C4Hn6K9c.d.ts → index-DLaQtvYu.d.ts} +213 -400
- package/dist/esm/index-DNofJMCK.d.ts +61 -0
- package/dist/esm/{index-doNE2KoX.d.ts → index-S6_V7aAH.d.ts} +10 -1
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +5 -5
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +143 -9
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/relayer-BWHOLVcG.js +2 -0
- package/dist/esm/relayer-BWHOLVcG.js.map +1 -0
- package/dist/esm/sdk-events-D68bJ5jT.js +2 -0
- package/dist/esm/sdk-events-D68bJ5jT.js.map +1 -0
- package/dist/esm/token-Bn8I7xAu.js +2 -0
- package/dist/esm/token-Bn8I7xAu.js.map +1 -0
- package/dist/esm/{types-Tk8PiPCk.d.ts → types-BEz-VgR_.d.ts} +6 -3
- package/dist/esm/{types-CELdIAFG.d.ts → types-CWPSTRF6.d.ts} +98 -146
- package/dist/esm/{types-DlSUyFe2.d.ts → types-Dr7AmEs1.d.ts} +3 -3
- package/dist/esm/viem/index.d.ts +34 -5
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/viem/index.js.map +1 -1
- package/dist/esm/web/index.d.ts +2 -2
- package/dist/esm/web/index.js +1 -1
- package/package.json +3 -3
- package/dist/cjs/wrappers-registry.cjs +0 -2
- package/dist/cjs/wrappers-registry.cjs.map +0 -1
- package/dist/esm/base-signer-9CqICeQ8.js +0 -2
- package/dist/esm/base-signer-9CqICeQ8.js.map +0 -1
- package/dist/esm/fhevm-relayer-Bb_-KFJA.js +0 -2
- package/dist/esm/fhevm-relayer-Bb_-KFJA.js.map +0 -1
- package/dist/esm/index-9Cn2VKDw.d.ts +0 -329
- package/dist/esm/relayer-DLlyoabr.js +0 -2
- package/dist/esm/relayer-DLlyoabr.js.map +0 -1
- package/dist/esm/token-oxpZ2kAk.js +0 -2
- package/dist/esm/token-oxpZ2kAk.js.map +0 -1
- package/dist/esm/wrappers-registry-B1GuTt5t.js +0 -2
- package/dist/esm/wrappers-registry-B1GuTt5t.js.map +0 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { l as AtLeastOneChain } from "./index-
|
|
2
|
-
import { a as ZamaConfigBase } from "./types-
|
|
1
|
+
import { l as AtLeastOneChain } from "./index-S6_V7aAH.js";
|
|
2
|
+
import { a as ZamaConfigBase } from "./types-CWPSTRF6.js";
|
|
3
3
|
import { EIP1193Provider, PublicClient, WalletClient } from "viem";
|
|
4
4
|
//#region src/viem/types.d.ts
|
|
5
5
|
/** Viem config — pass native viem clients directly. */
|
|
6
6
|
interface ZamaConfigViem<TChains extends AtLeastOneChain = AtLeastOneChain> extends ZamaConfigBase<TChains> {
|
|
7
|
+
/** Viem public client for host-chain reads. */
|
|
7
8
|
publicClient: PublicClient;
|
|
9
|
+
/** Viem wallet client for signing and write transactions. */
|
|
8
10
|
walletClient: WalletClient;
|
|
11
|
+
/** Optional EIP-1193 provider used to observe wallet account/chain changes; omit to disable account-change tracking. */
|
|
9
12
|
ethereum?: EIP1193Provider;
|
|
10
13
|
}
|
|
11
14
|
//#endregion
|
|
12
15
|
export { ZamaConfigViem as t };
|
|
13
|
-
//# sourceMappingURL=types-
|
|
16
|
+
//# sourceMappingURL=types-BEz-VgR_.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as AtLeastOneChain, u as FheChain } from "./index-
|
|
2
|
-
import {
|
|
1
|
+
import { l as AtLeastOneChain, u as FheChain } from "./index-S6_V7aAH.js";
|
|
2
|
+
import { createFhevmClient, setFhevmRuntimeConfig } from "@fhevm/sdk/viem";
|
|
3
3
|
import { Abi, Address, ContractFunctionArgs, ContractFunctionName, ContractFunctionReturnType, Hex } from "viem";
|
|
4
4
|
import { Eip712Like, TypedValue, TypedValue as TypedValue$1 } from "@fhevm/sdk/types";
|
|
5
5
|
import { DecryptValuesParameters } from "@fhevm/sdk/actions/decrypt";
|
|
@@ -23,18 +23,25 @@ type EncryptInput = {
|
|
|
23
23
|
interface EncryptParams {
|
|
24
24
|
/** Typed inputs for encryption. Each value must specify its FHE type. */
|
|
25
25
|
readonly values: readonly EncryptInput[];
|
|
26
|
+
/** Contract the encrypted inputs will be sent to (bound into the input proof). */
|
|
26
27
|
contractAddress: Address;
|
|
28
|
+
/** Address of the user producing the encrypted inputs (bound into the input proof). */
|
|
27
29
|
userAddress: Address;
|
|
28
30
|
}
|
|
29
31
|
/** Result from encryption — contract-ready hex encrypted values and input proof. */
|
|
30
32
|
interface EncryptResult {
|
|
33
|
+
/** Encrypted values, in the same order as the inputs, ready to pass to the contract. */
|
|
31
34
|
readonly encryptedValues: readonly EncryptedValue[];
|
|
35
|
+
/** Zero-knowledge proof authorizing the encrypted values as valid contract inputs. */
|
|
32
36
|
inputProof: Hex;
|
|
33
37
|
}
|
|
34
38
|
/** Result from public decryption. */
|
|
35
39
|
interface DecryptPublicValuesResult {
|
|
40
|
+
/** Decrypted clear-text values keyed by their encrypted value. */
|
|
36
41
|
readonly clearValues: Record<EncryptedValue, ClearValue>;
|
|
42
|
+
/** The clear values ABI-encoded, as passed to on-chain verification. */
|
|
37
43
|
abiEncodedClearValues: Hex;
|
|
44
|
+
/** KMS signature proving the decryption is authentic. */
|
|
38
45
|
decryptionProof: Hex;
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
@@ -45,7 +52,9 @@ interface DecryptPublicValuesResult {
|
|
|
45
52
|
* produces (which is versioned and evolves).
|
|
46
53
|
*/
|
|
47
54
|
type EIP712TypedData = Eip712Like;
|
|
48
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The underlying client returned by `@fhevm/sdk`'s `createFhevmClient`.
|
|
57
|
+
*/
|
|
49
58
|
type FhevmClient = ReturnType<typeof createFhevmClient>;
|
|
50
59
|
/** Per-client `@fhevm/sdk` options (`batchRpcCalls`, `fheEncryptionKey`). */
|
|
51
60
|
type FhevmClientOptions = NonNullable<Parameters<typeof createFhevmClient>[0]["options"]>;
|
|
@@ -96,7 +105,6 @@ type FhevmRuntimeConfig = Parameters<typeof setFhevmRuntimeConfig>[0];
|
|
|
96
105
|
* round-trip (mirrors its `RelayerCommonOptions`). Distinct from
|
|
97
106
|
* {@link RelayerOptions}, which configures a transport once at construction —
|
|
98
107
|
* these are applied per call.
|
|
99
|
-
*
|
|
100
108
|
*/
|
|
101
109
|
interface FhevmRelayerOptions {
|
|
102
110
|
/** Relayer authentication for the chain. Defaulted from the chain's config. */
|
|
@@ -167,7 +175,8 @@ interface FhevmRelayerOptions {
|
|
|
167
175
|
* Single-chain FHE backend contract. Implemented by `FhevmRelayer` (drives
|
|
168
176
|
* `@fhevm/sdk`); translates between the domain shapes above and the engine's API.
|
|
169
177
|
*/
|
|
170
|
-
interface
|
|
178
|
+
interface RelayerSDK extends Pick<FhevmClient, "encryptValue" | "encryptValues" | "decryptPublicValue" | "decryptPublicValues" | "decryptPublicValuesWithSignatures" | "decryptValue" | "decryptValues" | "decryptValuesFromPairs" | "fetchFheEncryptionKeyBytes" | "generateTransportKeyPair" | "serializeTransportKeyPair" | "serializeSignedDecryptionPermit" | "signDecryptionPermit" | "parseTransportKeyPair" | "parseSignedDecryptionPermit"> {
|
|
179
|
+
/** The single FHE-enabled chain this backend instance is bound to. */
|
|
171
180
|
chain: FheChain;
|
|
172
181
|
}
|
|
173
182
|
//#endregion
|
|
@@ -209,6 +218,7 @@ declare const Topics: {
|
|
|
209
218
|
};
|
|
210
219
|
/** Decoded `ConfidentialTransfer` event — an encrypted token transfer. */
|
|
211
220
|
interface ConfidentialTransferEvent {
|
|
221
|
+
/** Event name discriminant. */
|
|
212
222
|
readonly eventName: "ConfidentialTransfer";
|
|
213
223
|
/** Sender address. */
|
|
214
224
|
readonly from: Address;
|
|
@@ -223,6 +233,7 @@ interface ConfidentialTransferEvent {
|
|
|
223
233
|
* handle that lands in `ConfidentialTransfer.encryptedAmount`.
|
|
224
234
|
*/
|
|
225
235
|
interface WrapEvent {
|
|
236
|
+
/** Event name discriminant. */
|
|
226
237
|
readonly eventName: "Wrap";
|
|
227
238
|
/** Receiver of the minted confidential tokens. */
|
|
228
239
|
readonly to: Address;
|
|
@@ -233,6 +244,7 @@ interface WrapEvent {
|
|
|
233
244
|
}
|
|
234
245
|
/** Decoded `UnwrapRequested` event — an unshield request submitted. */
|
|
235
246
|
interface UnwrapRequestedEvent {
|
|
247
|
+
/** Event name discriminant. */
|
|
236
248
|
readonly eventName: "UnwrapRequested";
|
|
237
249
|
/** Address that will receive the unwrapped ERC-20 tokens. */
|
|
238
250
|
readonly receiver: Address;
|
|
@@ -243,6 +255,7 @@ interface UnwrapRequestedEvent {
|
|
|
243
255
|
}
|
|
244
256
|
/** Decoded `UnwrapFinalized` event — an unshield completed on-chain. */
|
|
245
257
|
interface UnwrapFinalizedEvent {
|
|
258
|
+
/** Event name discriminant. */
|
|
246
259
|
readonly eventName: "UnwrapFinalized";
|
|
247
260
|
/** Address receiving the unwrapped ERC-20 tokens. */
|
|
248
261
|
readonly receiver: Address;
|
|
@@ -333,6 +346,7 @@ declare const AclTopics: {
|
|
|
333
346
|
};
|
|
334
347
|
/** Decoded `DelegatedForUserDecryption` event — a delegation was created or renewed. */
|
|
335
348
|
interface DelegatedForUserDecryptionEvent {
|
|
349
|
+
/** Event name discriminant. */
|
|
336
350
|
readonly eventName: "DelegatedForUserDecryption";
|
|
337
351
|
/** Address of the delegator (the account granting access). */
|
|
338
352
|
readonly delegator: Address;
|
|
@@ -349,6 +363,7 @@ interface DelegatedForUserDecryptionEvent {
|
|
|
349
363
|
}
|
|
350
364
|
/** Decoded `RevokedDelegationForUserDecryption` event — a delegation was revoked. */
|
|
351
365
|
interface RevokedDelegationForUserDecryptionEvent {
|
|
366
|
+
/** Event name discriminant. */
|
|
352
367
|
readonly eventName: "RevokedDelegationForUserDecryption";
|
|
353
368
|
/** Address of the delegator. */
|
|
354
369
|
readonly delegator: Address;
|
|
@@ -511,73 +526,109 @@ declare const ZamaSDKEvents: {
|
|
|
511
526
|
};
|
|
512
527
|
/** Union of all SDK event type strings. */
|
|
513
528
|
type ZamaSDKEventType = (typeof ZamaSDKEvents)[keyof typeof ZamaSDKEvents];
|
|
529
|
+
/** Fields present on every SDK event; each concrete event extends this. */
|
|
514
530
|
interface BaseEvent {
|
|
531
|
+
/** Confidential token this event relates to, when the operation targets one. */
|
|
515
532
|
tokenAddress?: Address;
|
|
533
|
+
/** Unix epoch time (milliseconds) at which the event was emitted. */
|
|
516
534
|
timestamp: number;
|
|
517
535
|
/** Shared identifier linking related events in multi-phase operations (e.g. unshield). */
|
|
518
536
|
operationId?: string;
|
|
519
537
|
}
|
|
538
|
+
/** Emitted when an FHE encryption starts. */
|
|
520
539
|
interface EncryptStartEvent extends BaseEvent {
|
|
540
|
+
/** Event type discriminant. */
|
|
521
541
|
type: typeof ZamaSDKEvents.EncryptStart;
|
|
522
542
|
}
|
|
543
|
+
/** Emitted when an FHE encryption completes successfully. */
|
|
523
544
|
interface EncryptEndEvent extends BaseEvent {
|
|
545
|
+
/** Event type discriminant. */
|
|
524
546
|
type: typeof ZamaSDKEvents.EncryptEnd;
|
|
547
|
+
/** Time the encryption took, in milliseconds. */
|
|
525
548
|
durationMs: number;
|
|
526
549
|
}
|
|
550
|
+
/** Emitted when an FHE encryption fails. */
|
|
527
551
|
interface EncryptErrorEvent extends BaseEvent {
|
|
552
|
+
/** Event type discriminant. */
|
|
528
553
|
type: typeof ZamaSDKEvents.EncryptError;
|
|
529
554
|
/** The error that caused the encryption to fail. */
|
|
530
555
|
error: Error;
|
|
556
|
+
/** Time elapsed before the encryption failed, in milliseconds. */
|
|
531
557
|
durationMs: number;
|
|
532
558
|
}
|
|
559
|
+
/** Emitted when an FHE decryption starts. */
|
|
533
560
|
interface DecryptStartEvent extends BaseEvent {
|
|
561
|
+
/** Event type discriminant. */
|
|
534
562
|
type: typeof ZamaSDKEvents.DecryptStart;
|
|
535
563
|
/** Encrypted values being decrypted — correlate with matching DecryptEnd/DecryptError. */
|
|
536
564
|
encryptedValues: EncryptedValue[];
|
|
537
565
|
}
|
|
566
|
+
/** Emitted when an FHE decryption completes successfully. */
|
|
538
567
|
interface DecryptEndEvent extends BaseEvent {
|
|
568
|
+
/** Event type discriminant. */
|
|
539
569
|
type: typeof ZamaSDKEvents.DecryptEnd;
|
|
570
|
+
/** Time the decryption took, in milliseconds. */
|
|
540
571
|
durationMs: number;
|
|
541
572
|
/** Encrypted values that were decrypted. */
|
|
542
573
|
encryptedValues: EncryptedValue[];
|
|
543
574
|
/** Decrypted values keyed by encrypted value — use this to correlate events to specific entries. */
|
|
544
575
|
result: Record<EncryptedValue, ClearValue>;
|
|
545
576
|
}
|
|
577
|
+
/** Emitted when an FHE decryption fails. */
|
|
546
578
|
interface DecryptErrorEvent extends BaseEvent {
|
|
579
|
+
/** Event type discriminant. */
|
|
547
580
|
type: typeof ZamaSDKEvents.DecryptError;
|
|
548
581
|
/** The error that caused the decryption to fail. */
|
|
549
582
|
error: Error;
|
|
583
|
+
/** Time elapsed before the decryption failed, in milliseconds. */
|
|
550
584
|
durationMs: number;
|
|
551
585
|
/** Encrypted values that were being decrypted when the error occurred. */
|
|
552
586
|
encryptedValues: EncryptedValue[];
|
|
553
587
|
}
|
|
588
|
+
/** Emitted when a write operation's transaction fails (before or after submission). */
|
|
554
589
|
interface TransactionErrorEvent extends BaseEvent {
|
|
590
|
+
/** Event type discriminant. */
|
|
555
591
|
type: typeof ZamaSDKEvents.TransactionError;
|
|
556
592
|
/** Which SDK operation failed. */
|
|
557
593
|
operation: TransactionOperation;
|
|
558
594
|
/** The error that caused the transaction to fail. */
|
|
559
595
|
error: Error;
|
|
560
596
|
}
|
|
597
|
+
/** Emitted when a shield transaction has been submitted to the network. */
|
|
561
598
|
interface ShieldSubmittedEvent extends BaseEvent {
|
|
599
|
+
/** Event type discriminant. */
|
|
562
600
|
type: typeof ZamaSDKEvents.ShieldSubmitted;
|
|
601
|
+
/** Hash of the submitted shield transaction. */
|
|
563
602
|
txHash: Hex;
|
|
564
603
|
/** Which execution path was used: single-tx `transferAndCall` or two-tx `approveAndWrap`. */
|
|
565
604
|
shieldPath: ShieldPath;
|
|
566
605
|
}
|
|
606
|
+
/** Emitted when a confidential transfer transaction has been submitted to the network. */
|
|
567
607
|
interface TransferSubmittedEvent extends BaseEvent {
|
|
608
|
+
/** Event type discriminant. */
|
|
568
609
|
type: typeof ZamaSDKEvents.TransferSubmitted;
|
|
610
|
+
/** Hash of the submitted transfer transaction. */
|
|
569
611
|
txHash: Hex;
|
|
570
612
|
}
|
|
613
|
+
/** Emitted when a confidential `transferFrom` transaction has been submitted to the network. */
|
|
571
614
|
interface TransferFromSubmittedEvent extends BaseEvent {
|
|
615
|
+
/** Event type discriminant. */
|
|
572
616
|
type: typeof ZamaSDKEvents.TransferFromSubmitted;
|
|
617
|
+
/** Hash of the submitted transferFrom transaction. */
|
|
573
618
|
txHash: Hex;
|
|
574
619
|
}
|
|
620
|
+
/** Emitted when a set-operator transaction has been submitted to the network. */
|
|
575
621
|
interface SetOperatorSubmittedEvent extends BaseEvent {
|
|
622
|
+
/** Event type discriminant. */
|
|
576
623
|
type: typeof ZamaSDKEvents.SetOperatorSubmitted;
|
|
624
|
+
/** Hash of the submitted setOperator transaction. */
|
|
577
625
|
txHash: Hex;
|
|
578
626
|
}
|
|
627
|
+
/** Emitted when an underlying-ERC-20 approval transaction has been submitted to the network. */
|
|
579
628
|
interface ApproveUnderlyingSubmittedEvent extends BaseEvent {
|
|
629
|
+
/** Event type discriminant. */
|
|
580
630
|
type: typeof ZamaSDKEvents.ApproveUnderlyingSubmitted;
|
|
631
|
+
/** Hash of the submitted approval transaction. */
|
|
581
632
|
txHash: Hex;
|
|
582
633
|
/** Which approval transaction was submitted. */
|
|
583
634
|
step: "reset" | "approve";
|
|
@@ -589,34 +640,56 @@ interface ApproveUnderlyingSubmittedEvent extends BaseEvent {
|
|
|
589
640
|
* how `unwrap` emits its own event rather than reusing the unshield phases.
|
|
590
641
|
*/
|
|
591
642
|
interface WrapSubmittedEvent extends BaseEvent {
|
|
643
|
+
/** Event type discriminant. */
|
|
592
644
|
type: typeof ZamaSDKEvents.WrapSubmitted;
|
|
645
|
+
/** Hash of the submitted wrap transaction. */
|
|
593
646
|
txHash: Hex;
|
|
594
647
|
}
|
|
648
|
+
/** Emitted when an unwrap transaction has been submitted to the network. */
|
|
595
649
|
interface UnwrapSubmittedEvent extends BaseEvent {
|
|
650
|
+
/** Event type discriminant. */
|
|
596
651
|
type: typeof ZamaSDKEvents.UnwrapSubmitted;
|
|
652
|
+
/** Hash of the submitted unwrap transaction. */
|
|
597
653
|
txHash: Hex;
|
|
598
654
|
}
|
|
655
|
+
/** Emitted when a finalize-unwrap transaction has been submitted to the network. */
|
|
599
656
|
interface FinalizeUnwrapSubmittedEvent extends BaseEvent {
|
|
657
|
+
/** Event type discriminant. */
|
|
600
658
|
type: typeof ZamaSDKEvents.FinalizeUnwrapSubmitted;
|
|
659
|
+
/** Hash of the submitted finalizeUnwrap transaction. */
|
|
601
660
|
txHash: Hex;
|
|
602
661
|
}
|
|
662
|
+
/** Emitted when a decryption-delegation transaction has been submitted to the network. */
|
|
603
663
|
interface DelegationSubmittedEvent extends BaseEvent {
|
|
664
|
+
/** Event type discriminant. */
|
|
604
665
|
type: typeof ZamaSDKEvents.DelegationSubmitted;
|
|
666
|
+
/** Hash of the submitted delegation transaction. */
|
|
605
667
|
txHash: Hex;
|
|
606
668
|
}
|
|
669
|
+
/** Emitted when a revoke-delegation transaction has been submitted to the network. */
|
|
607
670
|
interface RevokeDelegationSubmittedEvent extends BaseEvent {
|
|
671
|
+
/** Event type discriminant. */
|
|
608
672
|
type: typeof ZamaSDKEvents.RevokeDelegationSubmitted;
|
|
673
|
+
/** Hash of the submitted revokeDelegation transaction. */
|
|
609
674
|
txHash: Hex;
|
|
610
675
|
}
|
|
676
|
+
/** Emitted when the first phase of an unshield (the unwrap request) has been submitted. */
|
|
611
677
|
interface UnshieldPhase1SubmittedEvent extends BaseEvent {
|
|
678
|
+
/** Event type discriminant. */
|
|
612
679
|
type: typeof ZamaSDKEvents.UnshieldPhase1Submitted;
|
|
680
|
+
/** Hash of the submitted phase-1 transaction. */
|
|
613
681
|
txHash: Hex;
|
|
614
682
|
}
|
|
683
|
+
/** Emitted when the second phase of an unshield (finalization) starts. */
|
|
615
684
|
interface UnshieldPhase2StartedEvent extends BaseEvent {
|
|
685
|
+
/** Event type discriminant. */
|
|
616
686
|
type: typeof ZamaSDKEvents.UnshieldPhase2Started;
|
|
617
687
|
}
|
|
688
|
+
/** Emitted when the second phase of an unshield (finalization) has been submitted. */
|
|
618
689
|
interface UnshieldPhase2SubmittedEvent extends BaseEvent {
|
|
690
|
+
/** Event type discriminant. */
|
|
619
691
|
type: typeof ZamaSDKEvents.UnshieldPhase2Submitted;
|
|
692
|
+
/** Hash of the submitted phase-2 transaction. */
|
|
620
693
|
txHash: Hex;
|
|
621
694
|
}
|
|
622
695
|
/**
|
|
@@ -627,115 +700,8 @@ interface UnshieldPhase2SubmittedEvent extends BaseEvent {
|
|
|
627
700
|
* private keys, permit signatures, or ZK proofs.
|
|
628
701
|
*/
|
|
629
702
|
type ZamaSDKEvent = EncryptStartEvent | EncryptEndEvent | EncryptErrorEvent | DecryptStartEvent | DecryptEndEvent | DecryptErrorEvent | TransactionErrorEvent | ShieldSubmittedEvent | TransferSubmittedEvent | TransferFromSubmittedEvent | SetOperatorSubmittedEvent | ApproveUnderlyingSubmittedEvent | WrapSubmittedEvent | UnwrapSubmittedEvent | FinalizeUnwrapSubmittedEvent | DelegationSubmittedEvent | RevokeDelegationSubmittedEvent | UnshieldPhase1SubmittedEvent | UnshieldPhase2StartedEvent | UnshieldPhase2SubmittedEvent;
|
|
703
|
+
/** Callback invoked with each emitted {@link ZamaSDKEvent}. */
|
|
630
704
|
type ZamaSDKEventListener = (event: ZamaSDKEvent) => void;
|
|
631
|
-
/** Distributive Omit that preserves the discriminated union. */
|
|
632
|
-
type ZamaSDKEventInput = ZamaSDKEvent extends (infer E) ? E extends ZamaSDKEvent ? Omit<E, "timestamp" | "tokenAddress"> : never : never;
|
|
633
|
-
/**
|
|
634
|
-
* Single source of truth for each transaction operation's submitted-event payload.
|
|
635
|
-
*
|
|
636
|
-
* Adding a write op = adding one entry here. `TransactionOperation` is then
|
|
637
|
-
* `keyof typeof transactionOperationMetadata`, so the dispatch table and the
|
|
638
|
-
* operation union cannot drift.
|
|
639
|
-
*
|
|
640
|
-
* The `satisfies` check enforces that every entry produces a valid
|
|
641
|
-
* {@link ZamaSDKEventInput}.
|
|
642
|
-
*/
|
|
643
|
-
declare const transactionOperationMetadata: {
|
|
644
|
-
approveUnderlying: {
|
|
645
|
-
submittedEvent: (txHash: Hex) => {
|
|
646
|
-
type: "approveUnderlying:submitted";
|
|
647
|
-
txHash: `0x${string}`;
|
|
648
|
-
step: "approve";
|
|
649
|
-
};
|
|
650
|
-
};
|
|
651
|
-
"approveUnderlying:reset": {
|
|
652
|
-
submittedEvent: (txHash: Hex) => {
|
|
653
|
-
type: "approveUnderlying:submitted";
|
|
654
|
-
txHash: `0x${string}`;
|
|
655
|
-
step: "reset";
|
|
656
|
-
};
|
|
657
|
-
};
|
|
658
|
-
delegateDecryption: {
|
|
659
|
-
submittedEvent: (txHash: Hex) => {
|
|
660
|
-
type: "delegation:submitted";
|
|
661
|
-
txHash: `0x${string}`;
|
|
662
|
-
};
|
|
663
|
-
};
|
|
664
|
-
finalizeUnwrap: {
|
|
665
|
-
submittedEvent: (txHash: Hex) => {
|
|
666
|
-
type: "finalizeUnwrap:submitted";
|
|
667
|
-
txHash: `0x${string}`;
|
|
668
|
-
};
|
|
669
|
-
};
|
|
670
|
-
revokeDelegation: {
|
|
671
|
-
submittedEvent: (txHash: Hex) => {
|
|
672
|
-
type: "revokeDelegation:submitted";
|
|
673
|
-
txHash: `0x${string}`;
|
|
674
|
-
};
|
|
675
|
-
};
|
|
676
|
-
setOperator: {
|
|
677
|
-
submittedEvent: (txHash: Hex) => {
|
|
678
|
-
type: "setOperator:submitted";
|
|
679
|
-
txHash: `0x${string}`;
|
|
680
|
-
};
|
|
681
|
-
};
|
|
682
|
-
"shield:transferAndCall": {
|
|
683
|
-
submittedEvent: (txHash: Hex) => {
|
|
684
|
-
type: "shield:submitted";
|
|
685
|
-
txHash: `0x${string}`;
|
|
686
|
-
shieldPath: "transferAndCall";
|
|
687
|
-
};
|
|
688
|
-
};
|
|
689
|
-
"shield:approveAndWrap": {
|
|
690
|
-
submittedEvent: (txHash: Hex) => {
|
|
691
|
-
type: "shield:submitted";
|
|
692
|
-
txHash: `0x${string}`;
|
|
693
|
-
shieldPath: "approveAndWrap";
|
|
694
|
-
};
|
|
695
|
-
};
|
|
696
|
-
wrap: {
|
|
697
|
-
submittedEvent: (txHash: Hex) => {
|
|
698
|
-
type: "wrap:submitted";
|
|
699
|
-
txHash: `0x${string}`;
|
|
700
|
-
};
|
|
701
|
-
};
|
|
702
|
-
transfer: {
|
|
703
|
-
submittedEvent: (txHash: Hex) => {
|
|
704
|
-
type: "transfer:submitted";
|
|
705
|
-
txHash: `0x${string}`;
|
|
706
|
-
};
|
|
707
|
-
};
|
|
708
|
-
transferAndCall: {
|
|
709
|
-
submittedEvent: (txHash: Hex) => {
|
|
710
|
-
type: "transfer:submitted";
|
|
711
|
-
txHash: `0x${string}`;
|
|
712
|
-
};
|
|
713
|
-
};
|
|
714
|
-
transferFrom: {
|
|
715
|
-
submittedEvent: (txHash: Hex) => {
|
|
716
|
-
type: "transferFrom:submitted";
|
|
717
|
-
txHash: `0x${string}`;
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
transferFromAndCall: {
|
|
721
|
-
submittedEvent: (txHash: Hex) => {
|
|
722
|
-
type: "transferFrom:submitted";
|
|
723
|
-
txHash: `0x${string}`;
|
|
724
|
-
};
|
|
725
|
-
};
|
|
726
|
-
unwrap: {
|
|
727
|
-
submittedEvent: (txHash: Hex) => {
|
|
728
|
-
type: "unwrap:submitted";
|
|
729
|
-
txHash: `0x${string}`;
|
|
730
|
-
};
|
|
731
|
-
};
|
|
732
|
-
unwrapAll: {
|
|
733
|
-
submittedEvent: (txHash: Hex) => {
|
|
734
|
-
type: "unwrap:submitted";
|
|
735
|
-
txHash: `0x${string}`;
|
|
736
|
-
};
|
|
737
|
-
};
|
|
738
|
-
};
|
|
739
705
|
/**
|
|
740
706
|
* SDK transaction operations that emit submitted/error lifecycle events.
|
|
741
707
|
*
|
|
@@ -743,33 +709,7 @@ declare const transactionOperationMetadata: {
|
|
|
743
709
|
* one (`shield:transferAndCall` vs. `shield:approveAndWrap`), routing both error
|
|
744
710
|
* and success events on a single field — see {@link transactionOperationMetadata}.
|
|
745
711
|
*/
|
|
746
|
-
type TransactionOperation =
|
|
747
|
-
//#endregion
|
|
748
|
-
//#region src/chains/router.d.ts
|
|
749
|
-
/**
|
|
750
|
-
* Multichain router. Owns chain management (chains / chain / switchChain) and
|
|
751
|
-
* hands out the single-chain {@link FhevmRelayerSDK} backend for the currently active
|
|
752
|
-
* chain via {@link ChainRouter.relayer}. Builds one backend per chain from its
|
|
753
|
-
* {@link RelayerConfig}.
|
|
754
|
-
*/
|
|
755
|
-
declare class ChainRouter {
|
|
756
|
-
#private;
|
|
757
|
-
constructor(chains: readonly [FheChain, ...FheChain[]], configs: Readonly<Record<number, RelayerConfig>>);
|
|
758
|
-
get chains(): readonly FheChain[];
|
|
759
|
-
get chain(): FheChain;
|
|
760
|
-
/**
|
|
761
|
-
* Point the router at `chainId`. The active chain follows the wallet even when
|
|
762
|
-
* that chain has no configured backend: the {@link chain} / {@link relayer}
|
|
763
|
-
* getters throw a {@link ConfigurationError} for an unconfigured chain, so an
|
|
764
|
-
* unsupported chain fails loudly at the next operation rather than silently
|
|
765
|
-
* routing to the previously active chain (which would encrypt against, and
|
|
766
|
-
* sign an EIP-712 decryption permit for, the wrong chain's domain and ACL).
|
|
767
|
-
* Switching back to a configured chain restores service.
|
|
768
|
-
*/
|
|
769
|
-
switchChain(chainId: number): void;
|
|
770
|
-
/** The single-chain backend for the currently active chain. */
|
|
771
|
-
get relayer(): FhevmRelayerSDK;
|
|
772
|
-
}
|
|
712
|
+
type TransactionOperation = "approveUnderlying" | "approveUnderlying:reset" | "delegateDecryption" | "finalizeUnwrap" | "revokeDelegation" | "setOperator" | "shield:transferAndCall" | "shield:approveAndWrap" | "wrap" | "transfer" | "transferAndCall" | "transferFrom" | "transferFromAndCall" | "unwrap" | "unwrapAll";
|
|
773
713
|
//#endregion
|
|
774
714
|
//#region src/types/contract.d.ts
|
|
775
715
|
/** ABI type accepted by contract call builders. Supports both typed and untyped ABIs. */
|
|
@@ -820,12 +760,16 @@ interface WriteContractConfig<TAbi extends ContractAbi = ContractAbi, TFunctionN
|
|
|
820
760
|
//#region src/types/signer.d.ts
|
|
821
761
|
/** Snapshot of the connected wallet account at a point in time. */
|
|
822
762
|
interface WalletAccount {
|
|
763
|
+
/** Address of the connected wallet account. */
|
|
823
764
|
address: Address;
|
|
765
|
+
/** Chain ID the wallet is currently connected to. */
|
|
824
766
|
chainId: number;
|
|
825
767
|
}
|
|
826
768
|
/** A wallet account transition emitted by signer adapters. */
|
|
827
769
|
interface WalletAccountChange {
|
|
770
|
+
/** Account before the transition; `undefined` if none was connected. */
|
|
828
771
|
previous?: WalletAccount;
|
|
772
|
+
/** Account after the transition; `undefined` on disconnect. */
|
|
829
773
|
next?: WalletAccount;
|
|
830
774
|
}
|
|
831
775
|
/** Listener for wallet account transitions. */
|
|
@@ -920,7 +864,10 @@ interface GenericProvider {
|
|
|
920
864
|
* structured clone, `MemoryStorage` stores values as-is.
|
|
921
865
|
*/
|
|
922
866
|
interface GenericStorage {
|
|
923
|
-
/**
|
|
867
|
+
/**
|
|
868
|
+
* Retrieve a value by key.
|
|
869
|
+
* @returns The stored value, or `null` if the key does not exist.
|
|
870
|
+
*/
|
|
924
871
|
get<T = unknown>(key: string): Promise<T | null>;
|
|
925
872
|
/** Store a value under the given key, overwriting any existing entry. */
|
|
926
873
|
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
@@ -934,9 +881,13 @@ interface GenericStorage {
|
|
|
934
881
|
* Pass via config to observe operation lifecycle (start, success, error, timeout).
|
|
935
882
|
*/
|
|
936
883
|
interface GenericLogger {
|
|
884
|
+
/** Log at info level. */
|
|
937
885
|
info: (message: string, data?: Record<string, unknown>) => void;
|
|
886
|
+
/** Log at debug level. */
|
|
938
887
|
debug: (message: string, data?: Record<string, unknown>) => void;
|
|
888
|
+
/** Log at warn level. */
|
|
939
889
|
warn: (message: string, data?: Record<string, unknown>) => void;
|
|
890
|
+
/** Log at error level. */
|
|
940
891
|
error: (message: string, data?: Record<string, unknown>) => void;
|
|
941
892
|
}
|
|
942
893
|
//#endregion
|
|
@@ -946,16 +897,17 @@ interface GenericLogger {
|
|
|
946
897
|
* dispatcher calls it once per chain.
|
|
947
898
|
*/
|
|
948
899
|
interface RelayerConfig {
|
|
900
|
+
/** Discriminant identifying the relayer transport (e.g. `"web"`, `"node"`, `"cleartext"`). */
|
|
949
901
|
readonly type: string;
|
|
950
|
-
/** Create a single-chain relayer. */
|
|
951
|
-
readonly createRelayer: (chain: FheChain) => FhevmRelayerSDK;
|
|
952
902
|
}
|
|
953
903
|
/** Web relayer config — drives the FHE backend directly. */
|
|
954
904
|
interface WebRelayerConfig extends RelayerConfig {
|
|
905
|
+
/** Discriminant for the web transport. */
|
|
955
906
|
readonly type: "web";
|
|
956
907
|
}
|
|
957
908
|
/** Cleartext relayer config — drives the FHE backend in cleartext mode. */
|
|
958
909
|
interface CleartextRelayerConfig extends RelayerConfig {
|
|
910
|
+
/** Discriminant for the cleartext transport. */
|
|
959
911
|
readonly type: "cleartext";
|
|
960
912
|
}
|
|
961
913
|
/** Shared options across all adapter paths. */
|
|
@@ -1008,6 +960,7 @@ interface ZamaConfigGeneric<TChains extends AtLeastOneChain = AtLeastOneChain> e
|
|
|
1008
960
|
* `SignerNotConfiguredError` when invoked without a signer.
|
|
1009
961
|
*/
|
|
1010
962
|
signer?: GenericSigner;
|
|
963
|
+
/** Provider for public host-chain reads. */
|
|
1011
964
|
provider: GenericProvider;
|
|
1012
965
|
}
|
|
1013
966
|
declare const zamaConfigBrand: unique symbol;
|
|
@@ -1017,7 +970,6 @@ declare const zamaConfigBrand: unique symbol;
|
|
|
1017
970
|
*/
|
|
1018
971
|
type ZamaConfig = {
|
|
1019
972
|
readonly chains: readonly FheChain[];
|
|
1020
|
-
readonly router: ChainRouter;
|
|
1021
973
|
readonly provider: GenericProvider;
|
|
1022
974
|
readonly signer: GenericSigner | undefined;
|
|
1023
975
|
readonly storage: GenericStorage;
|
|
@@ -1036,5 +988,5 @@ type ZamaConfig = {
|
|
|
1036
988
|
readonly [zamaConfigBrand]: true;
|
|
1037
989
|
};
|
|
1038
990
|
//#endregion
|
|
1039
|
-
export {
|
|
1040
|
-
//# sourceMappingURL=types-
|
|
991
|
+
export { UnshieldOptions as $, EncryptErrorEvent as A, findWrap as At, UnshieldPhase1SubmittedEvent as B, EncryptResult as Bt, ApproveUnderlyingSubmittedEvent as C, decodeRevokedDelegationForUserDecryption as Ct, DecryptStartEvent as D, findDelegatedForUserDecryption as Dt, DecryptErrorEvent as E, decodeWrap as Et, ShieldSubmittedEvent as F, DecryptPublicValuesResult as Ft, ZamaSDKEvent as G, FhevmRuntimeConfig as Gt, UnshieldPhase2SubmittedEvent as H, FhevmClient as Ht, TransactionErrorEvent as I, DecryptValuesParameters as It, ZamaSDKEvents as J, TypedValue$1 as Jt, ZamaSDKEventListener as K, RelayerOptions as Kt, TransactionOperation as L, EIP712TypedData as Lt, FinalizeUnwrapSubmittedEvent as M, TransactionReceipt as Mt, RevokeDelegationSubmittedEvent as N, TransactionResult as Nt, DelegationSubmittedEvent as O, findRevokedDelegationForUserDecryption as Ot, SetOperatorSubmittedEvent as P, ClearValue as Pt, TransferOptions as Q, TransferFromSubmittedEvent as R, EncryptInput as Rt, WriteFunctionName as S, decodeOnChainEvents as St, DecryptEndEvent as T, decodeUnwrapRequested as Tt, UnwrapSubmittedEvent as U, FhevmClientOptions as Ut, UnshieldPhase2StartedEvent as V, EncryptedValue as Vt, WrapSubmittedEvent as W, FhevmRelayerOptions as Wt, ShieldOptions as X, ApprovalStrategy as Y, ShieldPath as Z, ReadContractConfig as _, decodeAclEvent as _t, ZamaConfigBase as a, ACL_TOPICS as at, WriteContractArgs as b, decodeDelegatedForUserDecryption as bt, GenericStorage as c, ConfidentialTransferEvent as ct, WalletAccount as d, RevokedDelegationForUserDecryptionEvent as dt, UnwrapResult as et, WalletAccountChange as f, TOKEN_TOPICS as ft, ReadContractArgs as g, WrapEvent as gt, ContractAbi as h, UnwrapRequestedEvent as ht, ZamaConfig as i, UnshieldCallbacks as it, EncryptStartEvent as j, RawLog as jt, EncryptEndEvent as k, findUnwrapRequested as kt, GenericProvider as l, DelegatedForUserDecryptionEvent as lt, WalletAccountStore as m, UnwrapFinalizedEvent as mt, RelayerConfig as n, ShieldCallbacks as nt, ZamaConfigGeneric as o, AclEvent as ot, WalletAccountListener as p, Topics as pt, ZamaSDKEventType as q, RelayerSDK as qt, WebRelayerConfig as r, TransferCallbacks as rt, GenericLogger as s, AclTopics as st, CleartextRelayerConfig as t, WrapOptions as tt, GenericSigner as u, OnChainEvent as ut, ReadContractReturnType as v, decodeAclEvents as vt, BaseEvent as w, decodeUnwrapFinalized as wt, WriteContractConfig as x, decodeOnChainEvent as xt, ReadFunctionName as y, decodeConfidentialTransfer as yt, TransferSubmittedEvent as z, EncryptParams as zt };
|
|
992
|
+
//# sourceMappingURL=types-CWPSTRF6.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as AtLeastOneChain } from "./index-
|
|
2
|
-
import { a as ZamaConfigBase } from "./types-
|
|
1
|
+
import { l as AtLeastOneChain } from "./index-S6_V7aAH.js";
|
|
2
|
+
import { a as ZamaConfigBase } from "./types-CWPSTRF6.js";
|
|
3
3
|
import { EIP1193Provider } from "viem";
|
|
4
4
|
import { Provider, Signer } from "ethers";
|
|
5
5
|
//#region src/ethers/types.d.ts
|
|
@@ -26,4 +26,4 @@ type ZamaConfigEthers<TChains extends AtLeastOneChain = AtLeastOneChain> = ZamaC
|
|
|
26
26
|
});
|
|
27
27
|
//#endregion
|
|
28
28
|
export { ZamaConfigEthers as t };
|
|
29
|
-
//# sourceMappingURL=types-
|
|
29
|
+
//# sourceMappingURL=types-Dr7AmEs1.d.ts.map
|
package/dist/esm/viem/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as FheChain } from "../index-
|
|
2
|
-
import {
|
|
3
|
-
import { t as BaseSigner } from "../base-signer-
|
|
4
|
-
import { t as ZamaConfigViem } from "../types-
|
|
1
|
+
import { d as FheChainAuth, l as AtLeastOneChain, u as FheChain } from "../index-S6_V7aAH.js";
|
|
2
|
+
import { A as EncryptErrorEvent, B as UnshieldPhase1SubmittedEvent, C as ApproveUnderlyingSubmittedEvent, D as DecryptStartEvent, E as DecryptErrorEvent, F as ShieldSubmittedEvent, G as ZamaSDKEvent, Gt as FhevmRuntimeConfig, H as UnshieldPhase2SubmittedEvent, I as TransactionErrorEvent, J as ZamaSDKEvents, K as ZamaSDKEventListener, L as TransactionOperation, Lt as EIP712TypedData, M as FinalizeUnwrapSubmittedEvent, Mt as TransactionReceipt, N as RevokeDelegationSubmittedEvent, O as DelegationSubmittedEvent, P as SetOperatorSubmittedEvent, Pt as ClearValue, R as TransferFromSubmittedEvent, S as WriteFunctionName, T as DecryptEndEvent, U as UnwrapSubmittedEvent, V as UnshieldPhase2StartedEvent, Vt as EncryptedValue, W as WrapSubmittedEvent, Z as ShieldPath, _ as ReadContractConfig, a as ZamaConfigBase, b as WriteContractArgs, c as GenericStorage, d as WalletAccount, f as WalletAccountChange, g as ReadContractArgs, h as ContractAbi, i as ZamaConfig, j as EncryptStartEvent, jt as RawLog, k as EncryptEndEvent, l as GenericProvider, m as WalletAccountStore, n as RelayerConfig, p as WalletAccountListener, q as ZamaSDKEventType, s as GenericLogger, u as GenericSigner, v as ReadContractReturnType, w as BaseEvent, x as WriteContractConfig, y as ReadFunctionName, z as TransferSubmittedEvent } from "../types-CWPSTRF6.js";
|
|
3
|
+
import { n as MutableWalletAccountStore, t as BaseSigner } from "../base-signer-BvL-jMNO.js";
|
|
4
|
+
import { t as ZamaConfigViem } from "../types-BEz-VgR_.js";
|
|
5
5
|
import { Abi, Address, ContractFunctionArgs, ContractFunctionName, ContractFunctionReturnType, EIP1193Provider, Hex, Hex as Hex$1, PublicClient, WalletClient } from "viem";
|
|
6
6
|
//#region src/viem/config.d.ts
|
|
7
7
|
/** Create a {@link ZamaConfig} from viem clients. */
|
|
@@ -23,13 +23,22 @@ declare function createConfig<const TChains extends readonly [FheChain, ...FheCh
|
|
|
23
23
|
interface ViemSignerConfig {
|
|
24
24
|
/** Wallet client for signing and write operations. */
|
|
25
25
|
walletClient: WalletClient;
|
|
26
|
+
/** Raw EIP-1193 provider enabling wallet lifecycle events; omit for a no-op `subscribe()`. */
|
|
26
27
|
ethereum?: EIP1193Provider;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* {@link GenericSigner} backed by a viem `WalletClient` for EIP-712 signing and
|
|
31
|
+
* write transactions. Pass `ethereum` in {@link ViemSignerConfig} to track
|
|
32
|
+
* wallet lifecycle events.
|
|
33
|
+
*/
|
|
28
34
|
declare class ViemSigner extends BaseSigner {
|
|
29
35
|
#private;
|
|
30
36
|
constructor(config: ViemSignerConfig);
|
|
37
|
+
/** Sign EIP-712 typed data (used for decrypt authorization). */
|
|
31
38
|
signTypedData(typedData: EIP712TypedData): Promise<Hex$1>;
|
|
39
|
+
/** Send a write transaction and return the tx hash. */
|
|
32
40
|
writeContract<const TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable">, const TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>>(config: WriteContractConfig<TAbi, TFunctionName, TArgs>): Promise<Hex$1>;
|
|
41
|
+
/** Unsubscribe from the EIP-1193 provider's wallet lifecycle events. */
|
|
33
42
|
protected onDispose(): void;
|
|
34
43
|
}
|
|
35
44
|
//#endregion
|
|
@@ -55,41 +64,61 @@ interface ViemProviderConfig {
|
|
|
55
64
|
declare class ViemProvider implements GenericProvider {
|
|
56
65
|
#private;
|
|
57
66
|
constructor(config: ViemProviderConfig);
|
|
67
|
+
/** Return the chain ID of the connected network. */
|
|
58
68
|
getChainId(): Promise<number>;
|
|
69
|
+
/** Execute a read-only call and return the decoded result. */
|
|
59
70
|
readContract<const TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "pure" | "view">, const TArgs extends ContractFunctionArgs<TAbi, "pure" | "view", TFunctionName>>(config: ReadContractConfig<TAbi, TFunctionName, TArgs>): Promise<ContractFunctionReturnType<TAbi, "pure" | "view", TFunctionName, TArgs>>;
|
|
71
|
+
/** Wait for a transaction to be mined and return its receipt. */
|
|
60
72
|
waitForTransactionReceipt(hash: Hex$1): Promise<TransactionReceipt>;
|
|
73
|
+
/** Return the latest block timestamp in seconds. */
|
|
61
74
|
getBlockTimestamp(): Promise<bigint>;
|
|
62
75
|
}
|
|
63
76
|
//#endregion
|
|
64
77
|
//#region src/viem/contracts.d.ts
|
|
78
|
+
/** Reads a token's confidential (encrypted) balance handle for `userAddress` via a viem client. */
|
|
65
79
|
declare function readConfidentialBalanceOfContract(client: PublicClient, tokenAddress: Address, userAddress: Address): Promise<`0x${string}`>;
|
|
80
|
+
/** Reads the underlying ERC-20 address wrapped by a confidential wrapper via a viem client. */
|
|
66
81
|
declare function readUnderlyingTokenContract(client: PublicClient, wrapperAddress: Address): Promise<`0x${string}`>;
|
|
82
|
+
/** Reads whether a token implements the given ERC-165 interface id via a viem client. */
|
|
67
83
|
declare function readSupportsInterfaceContract(client: PublicClient, tokenAddress: Address, interfaceId: Address): Promise<boolean>;
|
|
84
|
+
/** Submits a confidential transfer of an encrypted amount to `to` via a viem wallet client. */
|
|
68
85
|
declare function writeConfidentialTransferContract(client: WalletClient, tokenAddress: Address, to: Address, encryptedAmount: EncryptedValue, inputProof: Hex$1): Promise<`0x${string}`>;
|
|
86
|
+
/** Submits an unwrap of an encrypted amount from `from` to `to` on a confidential ERC-20 via a viem wallet client. */
|
|
69
87
|
declare function writeUnwrapContract(client: WalletClient, encryptedErc20: Address, from: Address, to: Address, encryptedAmount: EncryptedValue, inputProof: Hex$1): Promise<`0x${string}`>;
|
|
88
|
+
/** Submits an unwrap of the full encrypted balance from `from` to `to` via a viem wallet client. */
|
|
70
89
|
declare function writeUnwrapFromBalanceContract(client: WalletClient, encryptedErc20: Address, from: Address, to: Address, encryptedBalance: EncryptedValue): Promise<`0x${string}`>;
|
|
90
|
+
/** Finalizes a pending unwrap request with the decrypted amount and decryption proof via a viem wallet client. */
|
|
71
91
|
declare function writeFinalizeUnwrapContract(client: WalletClient, wrapper: Address, unwrapRequestId: EncryptedValue, unwrapAmountCleartext: bigint, decryptionProof: Hex$1): Promise<`0x${string}`>;
|
|
92
|
+
/** Authorizes `operator` on a token, until an optional expiry timestamp, via a viem wallet client. */
|
|
72
93
|
declare function writeSetOperatorContract(client: WalletClient, tokenAddress: Address, operator: Address, until?: number): Promise<`0x${string}`>;
|
|
94
|
+
/** Wraps `amount` of the underlying ERC-20 into confidential tokens credited to `to` via a viem wallet client. */
|
|
73
95
|
declare function writeWrapContract(client: WalletClient, wrapperAddress: Address, to: Address, amount: bigint): Promise<`0x${string}`>;
|
|
96
|
+
/** Reads all underlying/confidential token pairs from a wrappers registry via a viem client. */
|
|
74
97
|
declare function readTokenPairsContract(client: PublicClient, registry: Address): Promise<readonly {
|
|
75
98
|
tokenAddress: `0x${string}`;
|
|
76
99
|
confidentialTokenAddress: `0x${string}`;
|
|
77
100
|
isValid: boolean;
|
|
78
101
|
}[]>;
|
|
102
|
+
/** Reads the number of token pairs in a wrappers registry via a viem client. */
|
|
79
103
|
declare function readTokenPairsLengthContract(client: PublicClient, registry: Address): Promise<bigint>;
|
|
104
|
+
/** Reads a slice of token pairs (`fromIndex` to `toIndex`) from a wrappers registry via a viem client. */
|
|
80
105
|
declare function readTokenPairsSliceContract(client: PublicClient, registry: Address, fromIndex: bigint, toIndex: bigint): Promise<readonly {
|
|
81
106
|
tokenAddress: `0x${string}`;
|
|
82
107
|
confidentialTokenAddress: `0x${string}`;
|
|
83
108
|
isValid: boolean;
|
|
84
109
|
}[]>;
|
|
110
|
+
/** Reads the token pair at `index` from a wrappers registry via a viem client. */
|
|
85
111
|
declare function readTokenPairContract(client: PublicClient, registry: Address, index: bigint): Promise<{
|
|
86
112
|
tokenAddress: `0x${string}`;
|
|
87
113
|
confidentialTokenAddress: `0x${string}`;
|
|
88
114
|
isValid: boolean;
|
|
89
115
|
}>;
|
|
116
|
+
/** Reads the confidential token registered for a given underlying token in a wrappers registry via a viem client. */
|
|
90
117
|
declare function readConfidentialTokenAddressContract(client: PublicClient, registry: Address, tokenAddress: Address): Promise<readonly [boolean, `0x${string}`]>;
|
|
118
|
+
/** Reads the underlying token registered for a given confidential token in a wrappers registry via a viem client. */
|
|
91
119
|
declare function readTokenAddressContract(client: PublicClient, registry: Address, confidentialTokenAddress: Address): Promise<readonly [boolean, `0x${string}`]>;
|
|
120
|
+
/** Reads whether a confidential token is registered and valid in a wrappers registry via a viem client. */
|
|
92
121
|
declare function readIsConfidentialTokenValidContract(client: PublicClient, registry: Address, confidentialTokenAddress: Address): Promise<boolean>;
|
|
93
122
|
//#endregion
|
|
94
|
-
export { type EncryptedValue, type Hex, ViemProvider, type ViemProviderConfig, ViemSigner, type ViemSignerConfig, type ZamaConfigViem, createConfig, readConfidentialBalanceOfContract, readConfidentialTokenAddressContract, readIsConfidentialTokenValidContract, readSupportsInterfaceContract, readTokenAddressContract, readTokenPairContract, readTokenPairsContract, readTokenPairsLengthContract, readTokenPairsSliceContract, readUnderlyingTokenContract, writeConfidentialTransferContract, writeFinalizeUnwrapContract, writeSetOperatorContract, writeUnwrapContract, writeUnwrapFromBalanceContract, writeWrapContract };
|
|
123
|
+
export { type ApproveUnderlyingSubmittedEvent, type AtLeastOneChain, type BaseEvent, BaseSigner, type ClearValue, type ContractAbi, type DecryptEndEvent, type DecryptErrorEvent, type DecryptStartEvent, type DelegationSubmittedEvent, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptStartEvent, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmRuntimeConfig, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type Hex, type MutableWalletAccountStore, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RelayerConfig, type RevokeDelegationSubmittedEvent, type SetOperatorSubmittedEvent, type ShieldPath, type ShieldSubmittedEvent, type TransactionErrorEvent, type TransactionOperation, type TransactionReceipt, type TransferFromSubmittedEvent, type TransferSubmittedEvent, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapSubmittedEvent, ViemProvider, type ViemProviderConfig, ViemSigner, type ViemSignerConfig, type WalletAccount, type WalletAccountChange, type WalletAccountListener, type WalletAccountStore, type WrapSubmittedEvent, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, type ZamaConfig, type ZamaConfigBase, type ZamaConfigViem, type ZamaSDKEvent, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, createConfig, readConfidentialBalanceOfContract, readConfidentialTokenAddressContract, readIsConfidentialTokenValidContract, readSupportsInterfaceContract, readTokenAddressContract, readTokenPairContract, readTokenPairsContract, readTokenPairsLengthContract, readTokenPairsSliceContract, readUnderlyingTokenContract, writeConfidentialTransferContract, writeFinalizeUnwrapContract, writeSetOperatorContract, writeUnwrapContract, writeUnwrapFromBalanceContract, writeWrapContract };
|
|
95
124
|
//# sourceMappingURL=index.d.ts.map
|