@inco/js 0.6.1 → 0.6.9

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.
Files changed (124) hide show
  1. package/dist/cjs/advancedacl/session-key.d.ts +8 -1
  2. package/dist/cjs/advancedacl/session-key.js +55 -21
  3. package/dist/cjs/attestedcompute/attested-compute.js +11 -4
  4. package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +38 -1
  5. package/dist/cjs/attesteddecrypt/attested-decrypt.js +49 -6
  6. package/dist/cjs/attesteddecrypt/types.d.ts +6 -1
  7. package/dist/cjs/attesteddecrypt/types.js +1 -1
  8. package/dist/cjs/attestedreveal/attested-reveal.js +9 -7
  9. package/dist/cjs/binary.d.ts +1 -0
  10. package/dist/cjs/binary.js +6 -2
  11. package/dist/cjs/encryption/encryption.d.ts +17 -22
  12. package/dist/cjs/encryption/encryption.js +34 -16
  13. package/dist/cjs/generated/abis/add-two.d.ts +1 -1
  14. package/dist/cjs/generated/abis/add-two.js +1 -1
  15. package/dist/cjs/generated/abis/lightning-preview.d.ts +48 -106
  16. package/dist/cjs/generated/abis/lightning-preview.js +33 -55
  17. package/dist/cjs/generated/abis/lightning.d.ts +55 -116
  18. package/dist/cjs/generated/abis/lightning.js +33 -66
  19. package/dist/cjs/generated/abis/verifier.d.ts +193 -84
  20. package/dist/cjs/generated/abis/verifier.js +151 -61
  21. package/dist/cjs/generated/es/cosmos_proto/cosmos_pb.js +2 -2
  22. package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +775 -0
  23. package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.js +261 -0
  24. package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +186 -0
  25. package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.js +47 -0
  26. package/dist/cjs/generated/es/inco/fhe/v1/types_pb.js +2 -2
  27. package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +76 -129
  28. package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.js +21 -26
  29. package/dist/cjs/generated/es/inco/kms/lite/v1/types_pb.js +2 -2
  30. package/dist/cjs/generated/lightning.d.ts +0 -32
  31. package/dist/cjs/generated/lightning.js +1 -33
  32. package/dist/cjs/generated/local-node.d.ts +1 -5
  33. package/dist/cjs/generated/local-node.js +2 -6
  34. package/dist/cjs/handle.d.ts +16 -0
  35. package/dist/cjs/handle.js +28 -3
  36. package/dist/cjs/lite/deployments.d.ts +20 -2
  37. package/dist/cjs/lite/deployments.js +1 -1
  38. package/dist/cjs/lite/ecies.d.ts +0 -2
  39. package/dist/cjs/lite/ecies.js +24 -13
  40. package/dist/cjs/lite/hadu.d.ts +3 -23
  41. package/dist/cjs/lite/hadu.js +26 -29
  42. package/dist/cjs/lite/index.d.ts +1 -1
  43. package/dist/cjs/lite/index.js +1 -1
  44. package/dist/cjs/lite/lightning.d.ts +24 -12
  45. package/dist/cjs/lite/lightning.js +62 -27
  46. package/dist/cjs/lite/reencrypt.d.ts +5 -7
  47. package/dist/cjs/lite/reencrypt.js +68 -58
  48. package/dist/cjs/test/mocks.d.ts +12 -0
  49. package/dist/cjs/test/mocks.js +27 -0
  50. package/dist/cjs/viem.d.ts +45 -48
  51. package/dist/esm/advancedacl/session-key.d.ts +8 -1
  52. package/dist/esm/advancedacl/session-key.js +58 -24
  53. package/dist/esm/attestedcompute/attested-compute.js +11 -4
  54. package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +38 -1
  55. package/dist/esm/attesteddecrypt/attested-decrypt.js +51 -8
  56. package/dist/esm/attesteddecrypt/types.d.ts +6 -1
  57. package/dist/esm/attesteddecrypt/types.js +1 -1
  58. package/dist/esm/attestedreveal/attested-reveal.js +9 -7
  59. package/dist/esm/binary.d.ts +1 -0
  60. package/dist/esm/binary.js +5 -2
  61. package/dist/esm/encryption/encryption.d.ts +17 -22
  62. package/dist/esm/encryption/encryption.js +30 -16
  63. package/dist/esm/generated/abis/add-two.d.ts +1 -1
  64. package/dist/esm/generated/abis/add-two.js +1 -1
  65. package/dist/esm/generated/abis/lightning-preview.d.ts +48 -106
  66. package/dist/esm/generated/abis/lightning-preview.js +33 -55
  67. package/dist/esm/generated/abis/lightning.d.ts +55 -116
  68. package/dist/esm/generated/abis/lightning.js +33 -66
  69. package/dist/esm/generated/abis/verifier.d.ts +193 -84
  70. package/dist/esm/generated/abis/verifier.js +151 -61
  71. package/dist/esm/generated/es/cosmos_proto/cosmos_pb.js +2 -2
  72. package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +775 -0
  73. package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.js +258 -0
  74. package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +186 -0
  75. package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.js +44 -0
  76. package/dist/esm/generated/es/inco/fhe/v1/types_pb.js +2 -2
  77. package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +76 -129
  78. package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.js +20 -25
  79. package/dist/esm/generated/es/inco/kms/lite/v1/types_pb.js +2 -2
  80. package/dist/esm/generated/lightning.d.ts +0 -32
  81. package/dist/esm/generated/lightning.js +1 -33
  82. package/dist/esm/generated/local-node.d.ts +1 -5
  83. package/dist/esm/generated/local-node.js +2 -6
  84. package/dist/esm/handle.d.ts +16 -0
  85. package/dist/esm/handle.js +27 -3
  86. package/dist/esm/lite/deployments.d.ts +20 -2
  87. package/dist/esm/lite/deployments.js +1 -1
  88. package/dist/esm/lite/ecies.d.ts +0 -2
  89. package/dist/esm/lite/ecies.js +26 -15
  90. package/dist/esm/lite/hadu.d.ts +3 -23
  91. package/dist/esm/lite/hadu.js +28 -30
  92. package/dist/esm/lite/index.d.ts +1 -1
  93. package/dist/esm/lite/index.js +1 -1
  94. package/dist/esm/lite/lightning.d.ts +24 -12
  95. package/dist/esm/lite/lightning.js +59 -24
  96. package/dist/esm/lite/reencrypt.d.ts +5 -7
  97. package/dist/esm/lite/reencrypt.js +67 -58
  98. package/dist/esm/test/mocks.d.ts +12 -0
  99. package/dist/esm/test/mocks.js +23 -0
  100. package/dist/esm/viem.d.ts +45 -48
  101. package/dist/types/advancedacl/session-key.d.ts +8 -1
  102. package/dist/types/attesteddecrypt/attested-decrypt.d.ts +38 -1
  103. package/dist/types/attesteddecrypt/types.d.ts +6 -1
  104. package/dist/types/binary.d.ts +1 -0
  105. package/dist/types/encryption/encryption.d.ts +17 -22
  106. package/dist/types/generated/abis/add-two.d.ts +1 -1
  107. package/dist/types/generated/abis/lightning-preview.d.ts +48 -106
  108. package/dist/types/generated/abis/lightning.d.ts +55 -116
  109. package/dist/types/generated/abis/verifier.d.ts +193 -84
  110. package/dist/types/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +775 -0
  111. package/dist/types/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +186 -0
  112. package/dist/types/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +76 -129
  113. package/dist/types/generated/lightning.d.ts +0 -32
  114. package/dist/types/generated/local-node.d.ts +1 -5
  115. package/dist/types/handle.d.ts +16 -0
  116. package/dist/types/lite/deployments.d.ts +20 -2
  117. package/dist/types/lite/ecies.d.ts +0 -2
  118. package/dist/types/lite/hadu.d.ts +3 -23
  119. package/dist/types/lite/index.d.ts +1 -1
  120. package/dist/types/lite/lightning.d.ts +24 -12
  121. package/dist/types/lite/reencrypt.d.ts +5 -7
  122. package/dist/types/test/mocks.d.ts +12 -0
  123. package/dist/types/viem.d.ts +45 -48
  124. package/package.json +3 -1
@@ -1,6 +1,24 @@
1
1
  import { Chainish } from '../chain.js';
2
- import { lightningDeployments } from '../generated/lightning.js';
3
2
  export type Address = `0x${string}`;
4
- export type IncoLiteDeployment = (typeof lightningDeployments)[number];
3
+ export type IncoLiteDeployment = {
4
+ active: boolean;
5
+ blockNumber: number;
6
+ chainId: number;
7
+ chainName: string;
8
+ commit: string;
9
+ deployDate: string;
10
+ deployer: string;
11
+ executorAddress: string;
12
+ majorVersion: number;
13
+ name: string;
14
+ pepper: string;
15
+ salt: string;
16
+ version: {
17
+ major: number;
18
+ minor: number;
19
+ patch: number;
20
+ shortSalt: string;
21
+ };
22
+ };
5
23
  export declare function getActiveLightningDeployment(chain: Chainish): IncoLiteDeployment;
6
24
  export declare function getLightningDeployments(chainId: Chainish): readonly IncoLiteDeployment[];
@@ -13,14 +13,12 @@ export declare function decodeSecp256k1PublicKey(pubKeyCompressed: Uint8Array):
13
13
  export declare function decodeSecp256k1PrivateKey(privKey: Uint8Array): Secp256k1Keypair;
14
14
  export declare function encrypt(pubKeyA: Secp256k1PubKey, plaintext: Uint8Array, privKeyB: Secp256k1Keypair): Promise<Uint8Array>;
15
15
  export type EciesEncryptorArgs = {
16
- scheme: EciesScheme;
17
16
  pubKeyA: Secp256k1PubKey;
18
17
  privKeyB: Secp256k1Keypair;
19
18
  };
20
19
  export declare function getEciesEncryptor({ pubKeyA, privKeyB, }: EciesEncryptorArgs): Encryptor<EciesScheme>;
21
20
  export declare function decrypt(privKeyA: Secp256k1Keypair, ciphertext: Uint8Array): Promise<Uint8Array>;
22
21
  export type EciesDecryptorArgs = {
23
- scheme: EciesScheme;
24
22
  privKeyA: Secp256k1Keypair;
25
23
  };
26
24
  export declare function getEciesDecryptor({ privKeyA, }: EciesDecryptorArgs): Decryptor<EciesScheme>;
@@ -1,24 +1,4 @@
1
- import { Schema } from 'effect';
2
1
  import { PlaintextWithContext } from '../encryption/index.js';
3
- export declare const encryptionEnvelopes: {
4
- readonly none: 0;
5
- readonly hadu: 1;
6
- };
7
- export type NoneEnvelope = (typeof encryptionEnvelopes)['none'];
8
- export type HaduEnvelope = (typeof encryptionEnvelopes)['hadu'];
9
- export declare const EncryptionEnvelope: Schema.SchemaClass<0 | 1, 0 | 1, never>;
10
- export declare const HaduInput: Schema.transform<Schema.SchemaClass<unknown, string, never>, Schema.Struct<{
11
- envelope: Schema.Literal<[1]>;
12
- scheme: Schema.Literal<[0, 1, 2]>;
13
- context: Schema.Struct<{
14
- hostChainId: typeof Schema.BigInt;
15
- aclAddress: Schema.TemplateLiteral<`0x${string}`>;
16
- userAddress: Schema.TemplateLiteral<`0x${string}`>;
17
- contractAddress: Schema.TemplateLiteral<`0x${string}`>;
18
- }>;
19
- plaintext: Schema.brand<Schema.filter<Schema.transformOrFail<Schema.Union<[typeof Schema.String, Schema.refine<object & Uint8Array<ArrayBufferLike>, Schema.Schema<object, object, never>>]>, Schema.TemplateLiteral<`0x${string}`>, never>>, "Bytes32">;
20
- type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
21
- }>>;
22
- export type HaduInput = typeof HaduInput.Type;
23
- export declare function encodeInput({ plaintext, context, }: PlaintextWithContext): string;
24
- export declare function decodeInput(json: string): PlaintextWithContext;
2
+ import { InputPayload } from '../generated/es/inco/covalidator/compute/v1/types_pb.js';
3
+ export declare function encodeInput({ plaintext, context, }: PlaintextWithContext): Uint8Array;
4
+ export declare function decodeInput(input: Uint8Array): InputPayload;
@@ -1,5 +1,5 @@
1
1
  export * from '../generated/abis/lightning.js';
2
- export type { AttestedComputeRequest, AttestedDecryptRequest, KmsService, ReencryptRequest, } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
2
+ export type { AttestedComputeRequest, AttestedDecryptRequest, KmsService, } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
3
3
  export type { HandleWithProof } from '../generated/es/inco/kms/lite/v1/types_pb.js';
4
4
  export * from './attested-compute.js';
5
5
  export * from './attested-decrypt.js';
@@ -1,9 +1,9 @@
1
- import { Account, Chain, Transport, WalletClient } from 'viem';
1
+ import { Account, Chain, PublicClient, Transport, WalletClient } from 'viem';
2
2
  import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
3
3
  import { AttestedComputeOP } from '../attestedcompute/types.js';
4
4
  import { DecryptionAttestation } from '../attesteddecrypt/index.js';
5
5
  import { Address, HexString } from '../binary.js';
6
- import { EciesScheme, PlaintextOf, SupportedFheType } from '../encryption/index.js';
6
+ import { EciesScheme, Encryptor, PlaintextOf, SupportedFheType } from '../encryption/index.js';
7
7
  import { lightningDeployments } from '../generated/lightning.js';
8
8
  import { localNodeLightningConfig } from '../generated/local-node.js';
9
9
  import { LocalNodeEnv } from '../local/index.js';
@@ -26,12 +26,10 @@ export type EncryptionContext = {
26
26
  };
27
27
  export type DeploymentSlice = {
28
28
  executorAddress: string;
29
- eciesPublicKey: string;
30
29
  chainId: number;
31
30
  };
32
31
  export type CustomConfig = {
33
32
  executorAddress: string;
34
- eciesPublicKey: string;
35
33
  chainId: number;
36
34
  covalidatorUrl: string;
37
35
  hostChainRpcUrl?: string;
@@ -46,16 +44,14 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
46
44
  private readonly _deployment;
47
45
  readonly covalidatorUrl: string;
48
46
  readonly executorAddress: Address;
49
- readonly eciesPublicKey: HexString;
50
47
  readonly chainId: bigint;
51
- private readonly encryptor;
52
48
  private readonly ephemeralKeypair;
53
49
  private readonly kmsClient;
54
50
  private constructor();
55
51
  /**
56
52
  * Get a Lightning instance bound to the latest Lightning deployment for the Base Sepolia testnet.
57
53
  */
58
- static baseSepoliaTestnet(): Lightning<Deployment>;
54
+ static baseSepoliaTestnet(): Promise<Lightning<Deployment>>;
59
55
  /**
60
56
  * Get a Lightning instance bound to our canonical Anvil-based test node and test Covalidator node
61
57
  *
@@ -71,7 +67,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
71
67
  * corresponding Pepper.
72
68
  *
73
69
  */
74
- static localNode(env?: LocalNodeEnv | LocalNodePepper): Lightning<CustomDeployment>;
70
+ static localNode(env?: LocalNodeEnv | LocalNodePepper): Promise<Lightning<CustomDeployment>>;
75
71
  /**
76
72
  * Get a Lightning instance bound to a local node from a file containing a LocalNodeEnv environment .
77
73
  *
@@ -83,14 +79,15 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
83
79
  *
84
80
  * @param id this is an object containing either the pair of name and chainId or the executorAddress and chainId
85
81
  */
86
- static at(id: DeploymentId): Lightning<Deployment>;
82
+ static at(id: DeploymentId): Promise<Lightning<Deployment>>;
87
83
  /**
88
84
  * Get a Lightning deployment for a local or custom node
89
85
  *
90
86
  * @param config this is an object containing the executorAddress, eciesPublicKey, chainId and covalidatorUrl.
91
87
  * additional fields past will be made available as part of the `deployment` property.
92
88
  */
93
- static custom<T extends CustomConfig>(config: T): Lightning<DeploymentSlice & T>;
89
+ static custom<T extends CustomConfig>(config: T): Promise<Lightning<DeploymentSlice & T>>;
90
+ static getEciesPublicKey(client: PublicClient, executorAddress: Address): Promise<HexString>;
94
91
  /**
95
92
  * Get the latest deployment for a given pepper, which usually denotes a family of deployments distinct from their
96
93
  * version such as 'devnet', 'testnet', 'mainnet', etc.
@@ -107,7 +104,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
107
104
  * @param pepper the pepper to use to filter the deployments
108
105
  * @param chainId the chainId to use to filter the deployments
109
106
  */
110
- static latest<P extends Pepper>(pepper: P, chainId: ChainId): Lightning<Deployment>;
107
+ static latest<P extends Pepper>(pepper: P, chainId: ChainId): Promise<Lightning<Deployment>>;
111
108
  get deployment(): T;
112
109
  /**
113
110
  * Encrypt a value using the public ECIES key of the Lightning deployment.
@@ -116,7 +113,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
116
113
  * @param accountAddress the address of the account interacting with the dapp contract, normally an Externally Owned Account (EOA)
117
114
  * @param dappAddress the address of the dapp contract that interacts with the Inco Lightning contract or library
118
115
  */
119
- encrypt<T extends SupportedNativeType>(value: T, { accountAddress, dappAddress }: EncryptionContext): Promise<HexString>;
116
+ encrypt<T extends SupportedNativeType>(value: T, { accountAddress, dappAddress }: EncryptionContext, encryptor: Encryptor<EciesScheme>): Promise<HexString>;
120
117
  /**
121
118
  * Obtain a reencryptor for a particular Externally Owned Account (EOA) to request decrypted values.
122
119
  * The account associated with the walletClient must have permissions to decrypt the handle or ciphertext passed
@@ -125,6 +122,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
125
122
  * @param walletClient the wallet client to use for signing the reencrypt request.
126
123
  */
127
124
  getReencryptor(walletClient: WalletClient<Transport, Chain, Account>): Promise<Reencryptor<EciesScheme>>;
125
+ getEncryptor(eciesPubkey: HexString): Encryptor<EciesScheme>;
128
126
  /**
129
127
  * Grants a session key allowance voucher for secure reencryption operations.
130
128
  *
@@ -245,6 +243,20 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
245
243
  * @returns A promise that resolves to a compute attestation.
246
244
  */
247
245
  attestedCompute(ephemeralKeypair: Secp256k1Keypair, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, allowanceVoucherWithSig: AllowanceVoucherWithSig, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EciesScheme, SupportedFheType>>;
246
+ /**
247
+ * Get an decryption of publicly revealed handles.
248
+ *
249
+ * @param handles - The handles to decrypt
250
+ * @param backoffConfig - The backoff configuration for the attested decrypt request
251
+ * @returns The decryption attestations
252
+ *
253
+ * @example
254
+ * ```typescript
255
+ * const response = await lightning.attestedReveal([handle1, handle2]);
256
+ * const { plaintext, covalidatorSignature } = response[0];
257
+ * ```
258
+ */
259
+ attestedReveal(handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
248
260
  /**
249
261
  * Get the GRPC endpoint for the covalidator that services this deployment.
250
262
  */
@@ -1,10 +1,9 @@
1
1
  import { Client } from '@connectrpc/connect';
2
- import { Account, Chain, Hex, Transport, WalletClient } from 'viem';
2
+ import { Account, Chain, Transport, WalletClient } from 'viem';
3
3
  import { SupportedChain } from '../chain.js';
4
4
  import { EciesScheme, PlaintextOf, SupportedFheType } from '../encryption/encryption.js';
5
- import { KmsService, ReencryptResponse } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
5
+ import { AttestedDecryptResponse, DecryptionAttestation as DecryptionAttestationProto, KmsService } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
6
6
  import { Handle } from '../handle.js';
7
- import type { EIP712 } from '../reencryption/eip712.js';
8
7
  import type { Reencryptor, ReencryptorArgs } from '../reencryption/types.js';
9
8
  import { Secp256k1Keypair } from './ecies.js';
10
9
  export interface IncoLiteReencryptorArgs extends ReencryptorArgs {
@@ -12,12 +11,11 @@ export interface IncoLiteReencryptorArgs extends ReencryptorArgs {
12
11
  kmsConnectRpcEndpointOrClient?: string | Client<typeof KmsService>;
13
12
  ephemeralKeypair?: Secp256k1Keypair;
14
13
  }
15
- export declare function reencryptEIP712(chainId: bigint, ephemeralPubKey: Uint8Array): EIP712<{
16
- publicKey: Hex;
17
- }>;
18
14
  export declare function incoLiteReencryptor({ kmsConnectRpcEndpointOrClient, chainId, walletClient, ephemeralKeypair, }: IncoLiteReencryptorArgs): Promise<Reencryptor<EciesScheme>>;
19
15
  export declare function getKmsClient(kmsConnectRpcEndpointOrClient: string | Client<typeof KmsService>): Client<typeof KmsService>;
20
- export declare function decryptGrpcResponse<T extends SupportedFheType>(response: ReencryptResponse, ephemeralKeypair: Secp256k1Keypair, handle: Handle): Promise<PlaintextOf<1, T>>;
16
+ export declare function decryptGrpcResponse<T extends SupportedFheType>(response: AttestedDecryptResponse, ephemeralKeypair: Secp256k1Keypair, handle: Handle): Promise<PlaintextOf<1, T>>;
17
+ export declare function decryptGrpcDecryptionAttestation(attestation: DecryptionAttestationProto, reencryptKeypair: Secp256k1Keypair): Promise<DecryptionAttestationProto>;
18
+ export declare function decryptGrpcDecryptResponse(response: AttestedDecryptResponse, reencryptKeypair: Secp256k1Keypair): Promise<AttestedDecryptResponse>;
21
19
  export declare function defaultCovalidatorGrpc(chain: SupportedChain): string;
22
20
  export declare function lightningDevnetCovalidatorGrpc(chain: SupportedChain): string;
23
21
  export declare function lightningTestnetCovalidatorGrpc(chain: SupportedChain): string;
@@ -0,0 +1,12 @@
1
+ import { Account, Chain, Transport, WalletClient } from 'viem';
2
+ import { vi } from 'vitest';
3
+ import { KmsClient } from '../kms/client.js';
4
+ interface MinimalKmsClient {
5
+ attestedCompute: ReturnType<typeof vi.fn>;
6
+ attestedDecrypt: ReturnType<typeof vi.fn>;
7
+ key: ReturnType<typeof vi.fn>;
8
+ reencrypt: ReturnType<typeof vi.fn>;
9
+ }
10
+ export declare function createMockKmsClient(): MinimalKmsClient & KmsClient;
11
+ export declare function createTestWalletClient(): WalletClient<Transport, Chain, Account>;
12
+ export {};
@@ -30,7 +30,7 @@ export declare const chains: {
30
30
  experimental_preconfirmationTime?: number | undefined | undefined;
31
31
  rpcUrls: {
32
32
  readonly default: {
33
- readonly http: readonly ["https://sepolia.drpc.org"];
33
+ readonly http: readonly ["https://11155111.rpc.thirdweb.com"];
34
34
  };
35
35
  };
36
36
  sourceId?: number | undefined | undefined;
@@ -116,7 +116,7 @@ export declare const chains: {
116
116
  formatters: {
117
117
  readonly block: {
118
118
  exclude: [] | undefined;
119
- format: (args: import("viem/chains").OpStackRpcBlock) => {
119
+ format: (args: import("viem/chains").OpStackRpcBlock, action?: string | undefined) => {
120
120
  baseFeePerGas: bigint | null;
121
121
  blobGasUsed: bigint;
122
122
  difficulty: bigint;
@@ -126,7 +126,7 @@ export declare const chains: {
126
126
  gasUsed: bigint;
127
127
  hash: `0x${string}` | null;
128
128
  logsBloom: `0x${string}` | null;
129
- miner: import("abitype").Address;
129
+ miner: import("viem").Address;
130
130
  mixHash: import("viem").Hash;
131
131
  nonce: `0x${string}` | null;
132
132
  number: bigint | null;
@@ -149,17 +149,17 @@ export declare const chains: {
149
149
  };
150
150
  readonly transaction: {
151
151
  exclude: [] | undefined;
152
- format: (args: import("viem/chains").OpStackRpcTransaction) => ({
152
+ format: (args: import("viem/chains").OpStackRpcTransaction, action?: string | undefined) => ({
153
153
  blockHash: `0x${string}` | null;
154
154
  blockNumber: bigint | null;
155
- from: import("abitype").Address;
155
+ from: import("viem").Address;
156
156
  gas: bigint;
157
157
  hash: import("viem").Hash;
158
158
  input: import("viem").Hex;
159
159
  nonce: number;
160
160
  r: import("viem").Hex;
161
161
  s: import("viem").Hex;
162
- to: import("abitype").Address | null;
162
+ to: import("viem").Address | null;
163
163
  transactionIndex: number | null;
164
164
  typeHex: import("viem").Hex | null;
165
165
  v: bigint;
@@ -179,8 +179,8 @@ export declare const chains: {
179
179
  v: bigint;
180
180
  value: bigint;
181
181
  gas: bigint;
182
- to: import("abitype").Address | null;
183
- from: import("abitype").Address;
182
+ to: import("viem").Address | null;
183
+ from: import("viem").Address;
184
184
  nonce: number;
185
185
  blockHash: `0x${string}` | null;
186
186
  blockNumber: bigint | null;
@@ -204,14 +204,14 @@ export declare const chains: {
204
204
  } | {
205
205
  blockHash: `0x${string}` | null;
206
206
  blockNumber: bigint | null;
207
- from: import("abitype").Address;
207
+ from: import("viem").Address;
208
208
  gas: bigint;
209
209
  hash: import("viem").Hash;
210
210
  input: import("viem").Hex;
211
211
  nonce: number;
212
212
  r: import("viem").Hex;
213
213
  s: import("viem").Hex;
214
- to: import("abitype").Address | null;
214
+ to: import("viem").Address | null;
215
215
  transactionIndex: number | null;
216
216
  typeHex: import("viem").Hex | null;
217
217
  v: bigint;
@@ -232,14 +232,14 @@ export declare const chains: {
232
232
  } | {
233
233
  blockHash: `0x${string}` | null;
234
234
  blockNumber: bigint | null;
235
- from: import("abitype").Address;
235
+ from: import("viem").Address;
236
236
  gas: bigint;
237
237
  hash: import("viem").Hash;
238
238
  input: import("viem").Hex;
239
239
  nonce: number;
240
240
  r: import("viem").Hex;
241
241
  s: import("viem").Hex;
242
- to: import("abitype").Address | null;
242
+ to: import("viem").Address | null;
243
243
  transactionIndex: number | null;
244
244
  typeHex: import("viem").Hex | null;
245
245
  v: bigint;
@@ -260,14 +260,14 @@ export declare const chains: {
260
260
  } | {
261
261
  blockHash: `0x${string}` | null;
262
262
  blockNumber: bigint | null;
263
- from: import("abitype").Address;
263
+ from: import("viem").Address;
264
264
  gas: bigint;
265
265
  hash: import("viem").Hash;
266
266
  input: import("viem").Hex;
267
267
  nonce: number;
268
268
  r: import("viem").Hex;
269
269
  s: import("viem").Hex;
270
- to: import("abitype").Address | null;
270
+ to: import("viem").Address | null;
271
271
  transactionIndex: number | null;
272
272
  typeHex: import("viem").Hex | null;
273
273
  v: bigint;
@@ -288,14 +288,14 @@ export declare const chains: {
288
288
  } | {
289
289
  blockHash: `0x${string}` | null;
290
290
  blockNumber: bigint | null;
291
- from: import("abitype").Address;
291
+ from: import("viem").Address;
292
292
  gas: bigint;
293
293
  hash: import("viem").Hash;
294
294
  input: import("viem").Hex;
295
295
  nonce: number;
296
296
  r: import("viem").Hex;
297
297
  s: import("viem").Hex;
298
- to: import("abitype").Address | null;
298
+ to: import("viem").Address | null;
299
299
  transactionIndex: number | null;
300
300
  typeHex: import("viem").Hex | null;
301
301
  v: bigint;
@@ -318,21 +318,21 @@ export declare const chains: {
318
318
  };
319
319
  readonly transactionReceipt: {
320
320
  exclude: [] | undefined;
321
- format: (args: import("viem/chains").OpStackRpcTransactionReceipt) => {
321
+ format: (args: import("viem/chains").OpStackRpcTransactionReceipt, action?: string | undefined) => {
322
322
  blobGasPrice?: bigint | undefined;
323
323
  blobGasUsed?: bigint | undefined;
324
324
  blockHash: import("viem").Hash;
325
325
  blockNumber: bigint;
326
- contractAddress: import("abitype").Address | null | undefined;
326
+ contractAddress: import("viem").Address | null | undefined;
327
327
  cumulativeGasUsed: bigint;
328
328
  effectiveGasPrice: bigint;
329
- from: import("abitype").Address;
329
+ from: import("viem").Address;
330
330
  gasUsed: bigint;
331
331
  logs: import("viem").Log<bigint, number, false>[];
332
332
  logsBloom: import("viem").Hex;
333
333
  root?: `0x${string}` | undefined;
334
334
  status: "success" | "reverted";
335
- to: import("abitype").Address | null;
335
+ to: import("viem").Address | null;
336
336
  transactionHash: import("viem").Hash;
337
337
  transactionIndex: number;
338
338
  type: import("viem").TransactionType;
@@ -392,15 +392,12 @@ export declare const chains: {
392
392
  };
393
393
  };
394
394
  blockTime?: number | undefined | undefined;
395
- contracts?: {
396
- [x: string]: import("viem").ChainContract | {
397
- [sourceId: number]: import("viem").ChainContract | undefined;
398
- } | undefined;
399
- ensRegistry?: import("viem").ChainContract | undefined;
400
- ensUniversalResolver?: import("viem").ChainContract | undefined;
401
- multicall3?: import("viem").ChainContract | undefined;
402
- erc6492Verifier?: import("viem").ChainContract | undefined;
403
- } | undefined;
395
+ contracts: {
396
+ readonly multicall3: {
397
+ readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
398
+ readonly blockCreated: 0;
399
+ };
400
+ };
404
401
  ensTlds?: readonly string[] | undefined;
405
402
  id: 9746;
406
403
  name: "Plasma Testnet";
@@ -546,7 +543,7 @@ export declare const chains: {
546
543
  formatters: {
547
544
  readonly block: {
548
545
  exclude: [] | undefined;
549
- format: (args: import("viem/chains").OpStackRpcBlock) => {
546
+ format: (args: import("viem/chains").OpStackRpcBlock, action?: string | undefined) => {
550
547
  baseFeePerGas: bigint | null;
551
548
  blobGasUsed: bigint;
552
549
  difficulty: bigint;
@@ -556,7 +553,7 @@ export declare const chains: {
556
553
  gasUsed: bigint;
557
554
  hash: `0x${string}` | null;
558
555
  logsBloom: `0x${string}` | null;
559
- miner: import("abitype").Address;
556
+ miner: import("viem").Address;
560
557
  mixHash: import("viem").Hash;
561
558
  nonce: `0x${string}` | null;
562
559
  number: bigint | null;
@@ -579,17 +576,17 @@ export declare const chains: {
579
576
  };
580
577
  readonly transaction: {
581
578
  exclude: [] | undefined;
582
- format: (args: import("viem/chains").OpStackRpcTransaction) => ({
579
+ format: (args: import("viem/chains").OpStackRpcTransaction, action?: string | undefined) => ({
583
580
  blockHash: `0x${string}` | null;
584
581
  blockNumber: bigint | null;
585
- from: import("abitype").Address;
582
+ from: import("viem").Address;
586
583
  gas: bigint;
587
584
  hash: import("viem").Hash;
588
585
  input: import("viem").Hex;
589
586
  nonce: number;
590
587
  r: import("viem").Hex;
591
588
  s: import("viem").Hex;
592
- to: import("abitype").Address | null;
589
+ to: import("viem").Address | null;
593
590
  transactionIndex: number | null;
594
591
  typeHex: import("viem").Hex | null;
595
592
  v: bigint;
@@ -609,8 +606,8 @@ export declare const chains: {
609
606
  v: bigint;
610
607
  value: bigint;
611
608
  gas: bigint;
612
- to: import("abitype").Address | null;
613
- from: import("abitype").Address;
609
+ to: import("viem").Address | null;
610
+ from: import("viem").Address;
614
611
  nonce: number;
615
612
  blockHash: `0x${string}` | null;
616
613
  blockNumber: bigint | null;
@@ -634,14 +631,14 @@ export declare const chains: {
634
631
  } | {
635
632
  blockHash: `0x${string}` | null;
636
633
  blockNumber: bigint | null;
637
- from: import("abitype").Address;
634
+ from: import("viem").Address;
638
635
  gas: bigint;
639
636
  hash: import("viem").Hash;
640
637
  input: import("viem").Hex;
641
638
  nonce: number;
642
639
  r: import("viem").Hex;
643
640
  s: import("viem").Hex;
644
- to: import("abitype").Address | null;
641
+ to: import("viem").Address | null;
645
642
  transactionIndex: number | null;
646
643
  typeHex: import("viem").Hex | null;
647
644
  v: bigint;
@@ -662,14 +659,14 @@ export declare const chains: {
662
659
  } | {
663
660
  blockHash: `0x${string}` | null;
664
661
  blockNumber: bigint | null;
665
- from: import("abitype").Address;
662
+ from: import("viem").Address;
666
663
  gas: bigint;
667
664
  hash: import("viem").Hash;
668
665
  input: import("viem").Hex;
669
666
  nonce: number;
670
667
  r: import("viem").Hex;
671
668
  s: import("viem").Hex;
672
- to: import("abitype").Address | null;
669
+ to: import("viem").Address | null;
673
670
  transactionIndex: number | null;
674
671
  typeHex: import("viem").Hex | null;
675
672
  v: bigint;
@@ -690,14 +687,14 @@ export declare const chains: {
690
687
  } | {
691
688
  blockHash: `0x${string}` | null;
692
689
  blockNumber: bigint | null;
693
- from: import("abitype").Address;
690
+ from: import("viem").Address;
694
691
  gas: bigint;
695
692
  hash: import("viem").Hash;
696
693
  input: import("viem").Hex;
697
694
  nonce: number;
698
695
  r: import("viem").Hex;
699
696
  s: import("viem").Hex;
700
- to: import("abitype").Address | null;
697
+ to: import("viem").Address | null;
701
698
  transactionIndex: number | null;
702
699
  typeHex: import("viem").Hex | null;
703
700
  v: bigint;
@@ -718,14 +715,14 @@ export declare const chains: {
718
715
  } | {
719
716
  blockHash: `0x${string}` | null;
720
717
  blockNumber: bigint | null;
721
- from: import("abitype").Address;
718
+ from: import("viem").Address;
722
719
  gas: bigint;
723
720
  hash: import("viem").Hash;
724
721
  input: import("viem").Hex;
725
722
  nonce: number;
726
723
  r: import("viem").Hex;
727
724
  s: import("viem").Hex;
728
- to: import("abitype").Address | null;
725
+ to: import("viem").Address | null;
729
726
  transactionIndex: number | null;
730
727
  typeHex: import("viem").Hex | null;
731
728
  v: bigint;
@@ -748,21 +745,21 @@ export declare const chains: {
748
745
  };
749
746
  readonly transactionReceipt: {
750
747
  exclude: [] | undefined;
751
- format: (args: import("viem/chains").OpStackRpcTransactionReceipt) => {
748
+ format: (args: import("viem/chains").OpStackRpcTransactionReceipt, action?: string | undefined) => {
752
749
  blobGasPrice?: bigint | undefined;
753
750
  blobGasUsed?: bigint | undefined;
754
751
  blockHash: import("viem").Hash;
755
752
  blockNumber: bigint;
756
- contractAddress: import("abitype").Address | null | undefined;
753
+ contractAddress: import("viem").Address | null | undefined;
757
754
  cumulativeGasUsed: bigint;
758
755
  effectiveGasPrice: bigint;
759
- from: import("abitype").Address;
756
+ from: import("viem").Address;
760
757
  gasUsed: bigint;
761
758
  logs: import("viem").Log<bigint, number, false>[];
762
759
  logsBloom: import("viem").Hex;
763
760
  root?: `0x${string}` | undefined;
764
761
  status: "success" | "reverted";
765
- to: import("abitype").Address | null;
762
+ to: import("viem").Address | null;
766
763
  transactionHash: import("viem").Hash;
767
764
  transactionIndex: number;
768
765
  type: import("viem").TransactionType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inco/js",
3
- "version": "0.6.1",
3
+ "version": "0.6.9",
4
4
  "repository": "https://github.com/Inco-fhevm/inco-monorepo",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -94,10 +94,12 @@
94
94
  "@types/elliptic": "^6.4.18",
95
95
  "ecies-geth": "^1.7.5",
96
96
  "effect": "^3.17.13",
97
+ "elliptic": "^6.6.1",
97
98
  "sha3": "^2.1.4",
98
99
  "viem": "^2.23.6"
99
100
  },
100
101
  "devDependencies": {
102
+ "@inco/pega": "0.0.0",
101
103
  "@bufbuild/protoc-gen-es": "^2.2.2",
102
104
  "@typescript-eslint/parser": "^8.35.1",
103
105
  "@vitest/coverage-istanbul": "3.1.1",