@inco/js 0.1.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 (93) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +50 -0
  3. package/dist/binary.d.ts +17 -0
  4. package/dist/chain.d.ts +22 -0
  5. package/dist/encryption/encryption.d.ts +118 -0
  6. package/dist/encryption/index.d.ts +1 -0
  7. package/dist/fhevm/fhe-environment.d.ts +9 -0
  8. package/dist/fhevm/fhevm.d.ts +41 -0
  9. package/dist/fhevm/index.cjs +87 -0
  10. package/dist/fhevm/index.d.ts +1 -0
  11. package/dist/fhevm/index.mjs +83 -0
  12. package/dist/fhevm/reencrypt.d.ts +20 -0
  13. package/dist/fhevm/tfhe.d.ts +74 -0
  14. package/dist/fhevm/types.d.ts +3 -0
  15. package/dist/generated/abis/inco-fhevm.d.ts +8698 -0
  16. package/dist/generated/abis/inco-lite.d.ts +21794 -0
  17. package/dist/generated/es/cosmos/ics23/v1/proofs_pb.d.ts +593 -0
  18. package/dist/generated/es/cosmos/msg/v1/msg_pb.d.ts +29 -0
  19. package/dist/generated/es/cosmos_proto/cosmos_pb.d.ts +174 -0
  20. package/dist/generated/es/google/api/annotations_pb.d.ts +13 -0
  21. package/dist/generated/es/google/api/http_pb.d.ts +440 -0
  22. package/dist/generated/es/inco/fhe/v1/events_pb.d.ts +79 -0
  23. package/dist/generated/es/inco/fhe/v1/genesis_pb.d.ts +252 -0
  24. package/dist/generated/es/inco/fhe/v1/query_pb.d.ts +569 -0
  25. package/dist/generated/es/inco/fhe/v1/tx_pb.d.ts +494 -0
  26. package/dist/generated/es/inco/fhe/v1/types_pb.d.ts +419 -0
  27. package/dist/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +181 -0
  28. package/dist/generated/es/inco/kms/lite/v1/types_pb.d.ts +212 -0
  29. package/dist/generated/es/inco/preflight/v1/genesis_pb.d.ts +56 -0
  30. package/dist/generated/es/inco/preflight/v1/query_pb.d.ts +100 -0
  31. package/dist/generated/es/inco/preflight/v1/tx_pb.d.ts +193 -0
  32. package/dist/generated/es/inco/preflight/v1/types_pb.d.ts +144 -0
  33. package/dist/generated/es/kms/base_pb.d.ts +765 -0
  34. package/dist/generated/es/sf/ethereum/type/v2/type_pb.d.ts +1736 -0
  35. package/dist/generated/fhe-environments.d.ts +14 -0
  36. package/dist/generated/inco-lite.d.ts +61 -0
  37. package/dist/generated/ts/amino/amino.d.ts +1 -0
  38. package/dist/generated/ts/cometbft/abci/v1/types.d.ts +597 -0
  39. package/dist/generated/ts/cometbft/crypto/v1/keys.d.ts +27 -0
  40. package/dist/generated/ts/cometbft/crypto/v1/proof.d.ts +60 -0
  41. package/dist/generated/ts/cometbft/types/v1/params.d.ts +179 -0
  42. package/dist/generated/ts/cometbft/types/v1/validator.d.ts +61 -0
  43. package/dist/generated/ts/cosmos/app/v1alpha1/module.d.ts +104 -0
  44. package/dist/generated/ts/cosmos/msg/v1/msg.d.ts +1 -0
  45. package/dist/generated/ts/cosmos_proto/cosmos.d.ts +80 -0
  46. package/dist/generated/ts/gogoproto/gogo.d.ts +1 -0
  47. package/dist/generated/ts/google/api/annotations.d.ts +1 -0
  48. package/dist/generated/ts/google/api/http.d.ts +371 -0
  49. package/dist/generated/ts/google/protobuf/descriptor.d.ts +1228 -0
  50. package/dist/generated/ts/google/protobuf/duration.d.ts +99 -0
  51. package/dist/generated/ts/google/protobuf/timestamp.d.ts +128 -0
  52. package/dist/generated/ts/google/protobuf/wrappers.d.ts +111 -0
  53. package/dist/generated/ts/inco/abci/v1/types.d.ts +35 -0
  54. package/dist/generated/ts/inco/fhe/module/v1/module.d.ts +31 -0
  55. package/dist/generated/ts/inco/fhe/v1/events.d.ts +66 -0
  56. package/dist/generated/ts/inco/fhe/v1/genesis.d.ts +117 -0
  57. package/dist/generated/ts/inco/fhe/v1/query.d.ts +366 -0
  58. package/dist/generated/ts/inco/fhe/v1/tx.d.ts +409 -0
  59. package/dist/generated/ts/inco/fhe/v1/types.d.ts +225 -0
  60. package/dist/generated/ts/inco/originchain/module/v1/module.d.ts +30 -0
  61. package/dist/generated/ts/inco/originchain/v1/abci.d.ts +80 -0
  62. package/dist/generated/ts/inco/originchain/v1/events.d.ts +60 -0
  63. package/dist/generated/ts/inco/originchain/v1/genesis.d.ts +28 -0
  64. package/dist/generated/ts/inco/originchain/v1/query.d.ts +116 -0
  65. package/dist/generated/ts/inco/originchain/v1/tx.d.ts +89 -0
  66. package/dist/generated/ts/inco/originchain/v1/types.d.ts +58 -0
  67. package/dist/generated/ts/inco/preflight/module/v1/module.d.ts +31 -0
  68. package/dist/generated/ts/inco/preflight/v1/genesis.d.ts +41 -0
  69. package/dist/generated/ts/inco/preflight/v1/query.d.ts +93 -0
  70. package/dist/generated/ts/inco/preflight/v1/tx.d.ts +187 -0
  71. package/dist/generated/ts/inco/preflight/v1/types.d.ts +84 -0
  72. package/dist/handle.d.ts +41 -0
  73. package/dist/index.cjs +22952 -0
  74. package/dist/index.d.ts +4 -0
  75. package/dist/index.mjs +24026 -0
  76. package/dist/l1/client.d.ts +35 -0
  77. package/dist/l1/index.d.ts +2 -0
  78. package/dist/l1/preflight.d.ts +20 -0
  79. package/dist/lite/deployments.d.ts +6 -0
  80. package/dist/lite/ecies.d.ts +26 -0
  81. package/dist/lite/hadu.d.ts +24 -0
  82. package/dist/lite/index.cjs +54911 -0
  83. package/dist/lite/index.d.ts +6 -0
  84. package/dist/lite/index.mjs +73891 -0
  85. package/dist/lite/reencrypt.d.ts +23 -0
  86. package/dist/reencryption/eip712.d.ts +29 -0
  87. package/dist/reencryption/index.cjs +22675 -0
  88. package/dist/reencryption/index.d.ts +2 -0
  89. package/dist/reencryption/index.mjs +22671 -0
  90. package/dist/reencryption/types.d.ts +24 -0
  91. package/dist/schema.d.ts +4 -0
  92. package/dist/viem.d.ts +385 -0
  93. package/package.json +92 -0
@@ -0,0 +1,187 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { type CallOptions, ChannelCredentials, Client, type ClientOptions, type ClientUnaryCall, type handleUnaryCall, Metadata, type ServiceError, type UntypedServiceImplementation } from "@grpc/grpc-js";
3
+ import { InputContext, Params } from "./types";
4
+ export declare const protobufPackage = "inco.preflight.v1";
5
+ /** MsgRegisterInput the Msg/RegisterInput request type. */
6
+ export interface MsgRegisterInput {
7
+ /**
8
+ * signer is the bech32-encoded address of the signer of the Msg. It doesn't
9
+ * necessarily have to be the owner of the input. In practice, it will one of
10
+ * the following:
11
+ * - the owner of the input (if the end-user interacts with the Inco L1
12
+ * directly)
13
+ * - a Paymaster that facilitates the interaction between the end-user and
14
+ * the Inco L1, usually by paying for the gas fees. The Paymaster is
15
+ * expected to be run by one or more of the covalidators.
16
+ */
17
+ signer: string;
18
+ /** ciphertext is the input encrypted by the end-user. It contains the zkpok. */
19
+ ciphertext: Uint8Array;
20
+ /** context is the context with which the input is registered. */
21
+ context: InputContext | undefined;
22
+ /**
23
+ * The prehandle depends on the hash of the ciphertext, and three separate
24
+ * 1-byte cleartext metadata values in positions 29, 30, and 31 of the 32-byte
25
+ * handle respectively:
26
+ * - the handle index (since ciphertexts are now a list-shaped container),
27
+ * - the handle type
28
+ * - the handle version (currently always 0)
29
+ * We could take these 3 bytes of metadata to produce the handle, but since
30
+ * the client need to compute the prehandle anyway we might as well just have
31
+ * them submit the finished value, we will still hash in the context
32
+ * preserving the fallback mechanism security guarantees.
33
+ */
34
+ prehandle: Uint8Array;
35
+ }
36
+ /** MsgRegisterInputResponse the Msg/RegisterInput response type. */
37
+ export interface MsgRegisterInputResponse {
38
+ /** handle refers to a unique identifier for the ciphertext. */
39
+ handle: Uint8Array;
40
+ }
41
+ /** MsgRegisterFallback the Msg/RegisterFallback request type. */
42
+ export interface MsgRegisterFallback {
43
+ /** handle refers to a unique identifier for the ciphertext. */
44
+ handle: Uint8Array;
45
+ /**
46
+ * covalidator is the covalidator's bech32-encoded address. This address is
47
+ * checked against the list of covalidators, which lives in the x/fhe
48
+ * params.
49
+ */
50
+ covalidator: string;
51
+ }
52
+ /** MsgRegisterFallbackResponse the Msg/RegisterFallback response type. */
53
+ export interface MsgRegisterFallbackResponse {
54
+ }
55
+ /** MsgUpdateParams the Msg/UpdateParams request type. */
56
+ export interface MsgUpdateParams {
57
+ /**
58
+ * params is the new parameters for the x/preflight module.
59
+ *
60
+ * Note: all fields must be set.
61
+ */
62
+ params: Params | undefined;
63
+ /**
64
+ * authority is the bech32-encoded address of the authority of the Msg. It
65
+ * defaults to the governance module.
66
+ */
67
+ authority: string;
68
+ }
69
+ /** MsgUpdateParamsResponse the Msg/UpdateParams response type. */
70
+ export interface MsgUpdateParamsResponse {
71
+ }
72
+ export declare const MsgRegisterInput: MessageFns<MsgRegisterInput>;
73
+ export declare const MsgRegisterInputResponse: MessageFns<MsgRegisterInputResponse>;
74
+ export declare const MsgRegisterFallback: MessageFns<MsgRegisterFallback>;
75
+ export declare const MsgRegisterFallbackResponse: MessageFns<MsgRegisterFallbackResponse>;
76
+ export declare const MsgUpdateParams: MessageFns<MsgUpdateParams>;
77
+ export declare const MsgUpdateParamsResponse: MessageFns<MsgUpdateParamsResponse>;
78
+ /** Msg is the message service for the x/preflight module. */
79
+ export type MsgService = typeof MsgService;
80
+ export declare const MsgService: {
81
+ /**
82
+ * RegisterInput registers a handle to a ciphertext and associated context
83
+ * for the Preflight schemes.
84
+ */
85
+ readonly registerInput: {
86
+ readonly path: "/inco.preflight.v1.Msg/RegisterInput";
87
+ readonly requestStream: false;
88
+ readonly responseStream: false;
89
+ readonly requestSerialize: (value: MsgRegisterInput) => Buffer<ArrayBuffer>;
90
+ readonly requestDeserialize: (value: Buffer) => MsgRegisterInput;
91
+ readonly responseSerialize: (value: MsgRegisterInputResponse) => Buffer<ArrayBuffer>;
92
+ readonly responseDeserialize: (value: Buffer) => MsgRegisterInputResponse;
93
+ };
94
+ /**
95
+ * RegisterFallback registers a handle to a fallback value if it has not
96
+ * been registered. It can only be called by the covalidators.
97
+ */
98
+ readonly registerFallback: {
99
+ readonly path: "/inco.preflight.v1.Msg/RegisterFallback";
100
+ readonly requestStream: false;
101
+ readonly responseStream: false;
102
+ readonly requestSerialize: (value: MsgRegisterFallback) => Buffer<ArrayBuffer>;
103
+ readonly requestDeserialize: (value: Buffer) => MsgRegisterFallback;
104
+ readonly responseSerialize: (value: MsgRegisterFallbackResponse) => Buffer<ArrayBuffer>;
105
+ readonly responseDeserialize: (value: Buffer) => MsgRegisterFallbackResponse;
106
+ };
107
+ /**
108
+ * UpdateParams updates the parameters of the x/preflight module. It can only
109
+ * be called by the x/preflight's authority, which defaults to the governance
110
+ * module.
111
+ */
112
+ readonly updateParams: {
113
+ readonly path: "/inco.preflight.v1.Msg/UpdateParams";
114
+ readonly requestStream: false;
115
+ readonly responseStream: false;
116
+ readonly requestSerialize: (value: MsgUpdateParams) => Buffer<ArrayBuffer>;
117
+ readonly requestDeserialize: (value: Buffer) => MsgUpdateParams;
118
+ readonly responseSerialize: (value: MsgUpdateParamsResponse) => Buffer<ArrayBuffer>;
119
+ readonly responseDeserialize: (value: Buffer) => MsgUpdateParamsResponse;
120
+ };
121
+ };
122
+ export interface MsgServer extends UntypedServiceImplementation {
123
+ /**
124
+ * RegisterInput registers a handle to a ciphertext and associated context
125
+ * for the Preflight schemes.
126
+ */
127
+ registerInput: handleUnaryCall<MsgRegisterInput, MsgRegisterInputResponse>;
128
+ /**
129
+ * RegisterFallback registers a handle to a fallback value if it has not
130
+ * been registered. It can only be called by the covalidators.
131
+ */
132
+ registerFallback: handleUnaryCall<MsgRegisterFallback, MsgRegisterFallbackResponse>;
133
+ /**
134
+ * UpdateParams updates the parameters of the x/preflight module. It can only
135
+ * be called by the x/preflight's authority, which defaults to the governance
136
+ * module.
137
+ */
138
+ updateParams: handleUnaryCall<MsgUpdateParams, MsgUpdateParamsResponse>;
139
+ }
140
+ export interface MsgClient extends Client {
141
+ /**
142
+ * RegisterInput registers a handle to a ciphertext and associated context
143
+ * for the Preflight schemes.
144
+ */
145
+ registerInput(request: MsgRegisterInput, callback: (error: ServiceError | null, response: MsgRegisterInputResponse) => void): ClientUnaryCall;
146
+ registerInput(request: MsgRegisterInput, metadata: Metadata, callback: (error: ServiceError | null, response: MsgRegisterInputResponse) => void): ClientUnaryCall;
147
+ registerInput(request: MsgRegisterInput, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: MsgRegisterInputResponse) => void): ClientUnaryCall;
148
+ /**
149
+ * RegisterFallback registers a handle to a fallback value if it has not
150
+ * been registered. It can only be called by the covalidators.
151
+ */
152
+ registerFallback(request: MsgRegisterFallback, callback: (error: ServiceError | null, response: MsgRegisterFallbackResponse) => void): ClientUnaryCall;
153
+ registerFallback(request: MsgRegisterFallback, metadata: Metadata, callback: (error: ServiceError | null, response: MsgRegisterFallbackResponse) => void): ClientUnaryCall;
154
+ registerFallback(request: MsgRegisterFallback, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: MsgRegisterFallbackResponse) => void): ClientUnaryCall;
155
+ /**
156
+ * UpdateParams updates the parameters of the x/preflight module. It can only
157
+ * be called by the x/preflight's authority, which defaults to the governance
158
+ * module.
159
+ */
160
+ updateParams(request: MsgUpdateParams, callback: (error: ServiceError | null, response: MsgUpdateParamsResponse) => void): ClientUnaryCall;
161
+ updateParams(request: MsgUpdateParams, metadata: Metadata, callback: (error: ServiceError | null, response: MsgUpdateParamsResponse) => void): ClientUnaryCall;
162
+ updateParams(request: MsgUpdateParams, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: MsgUpdateParamsResponse) => void): ClientUnaryCall;
163
+ }
164
+ export declare const MsgClient: {
165
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): MsgClient;
166
+ service: typeof MsgService;
167
+ serviceName: string;
168
+ };
169
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
170
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
171
+ [K in keyof T]?: DeepPartial<T[K]>;
172
+ } : Partial<T>;
173
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
174
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
175
+ [K in keyof P]: Exact<P[K], I[K]>;
176
+ } & {
177
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
178
+ };
179
+ export interface MessageFns<T> {
180
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
181
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
182
+ fromJSON(object: any): T;
183
+ toJSON(message: T): unknown;
184
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
185
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
186
+ }
187
+ export {};
@@ -0,0 +1,84 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "inco.preflight.v1";
3
+ /**
4
+ * InputRegistration is the message that is stored on-chain in the inputs
5
+ * registry.
6
+ */
7
+ export interface InputRegistration {
8
+ /**
9
+ * inputted_at is the Inco L1 block height at which the input was registered.
10
+ * It is used for pruning purposes.
11
+ */
12
+ inputtedAt: number;
13
+ ciphertextRegistration?: CiphertextRegistration | undefined;
14
+ fallbackRegistration?: FallbackRegistration | undefined;
15
+ }
16
+ /**
17
+ * CiphertextRegistration is the registration of an input encrypted by the
18
+ * end-user.
19
+ */
20
+ export interface CiphertextRegistration {
21
+ /** ciphertext is the input encrypted by the end-user. */
22
+ ciphertext: Uint8Array;
23
+ /** context is the context in which the input was registered. */
24
+ context: InputContext | undefined;
25
+ }
26
+ /** InputContext is the context in which the input was registered. */
27
+ export interface InputContext {
28
+ /**
29
+ * host_chain_id is the chain ID of the host chain. Refer to the x/hostchain
30
+ * module for a specification of the chain ID.
31
+ */
32
+ hostChainId: string;
33
+ /**
34
+ * keyset_id is the keyset that the input was encrypted under. Refer
35
+ * to the x/fhe module for a specification of the keysets.
36
+ */
37
+ keysetId: string;
38
+ /**
39
+ * contract_addr is the address of the contract that the input is intended
40
+ * for. This is a hex-encoded, non-prefixed Ethereum address (20 bytes).
41
+ */
42
+ contractAddr: string;
43
+ /**
44
+ * owner_addr is the address of the owner of the input. This is a hex-encoded,
45
+ * non-prefixed Ethereum address (20 bytes).
46
+ */
47
+ ownerAddr: string;
48
+ }
49
+ /** FallbackRegistration is the registration of an input by a covalidator. */
50
+ export interface FallbackRegistration {
51
+ }
52
+ /** Params defines the parameters for the x/preflight module. */
53
+ export interface Params {
54
+ /**
55
+ * blocks_to_keep_inputs is the number of blocks to keep inputs registrations
56
+ * in state. After this number of blocks, the input registration will be
57
+ * pruned from state, but still accessible via an archive node.
58
+ */
59
+ blocksToKeepInputs: number;
60
+ }
61
+ export declare const InputRegistration: MessageFns<InputRegistration>;
62
+ export declare const CiphertextRegistration: MessageFns<CiphertextRegistration>;
63
+ export declare const InputContext: MessageFns<InputContext>;
64
+ export declare const FallbackRegistration: MessageFns<FallbackRegistration>;
65
+ export declare const Params: MessageFns<Params>;
66
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
67
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
68
+ [K in keyof T]?: DeepPartial<T[K]>;
69
+ } : Partial<T>;
70
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
71
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
72
+ [K in keyof P]: Exact<P[K], I[K]>;
73
+ } & {
74
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
75
+ };
76
+ export interface MessageFns<T> {
77
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
78
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
79
+ fromJSON(object: any): T;
80
+ toJSON(message: T): unknown;
81
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
82
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
83
+ }
84
+ export {};
@@ -0,0 +1,41 @@
1
+ import { Schema } from 'effect';
2
+ import { HexString } from './binary';
3
+ export declare const HANDLE_VERSION = 0;
4
+ export declare const handleTypes: Readonly<{
5
+ ebool: 0;
6
+ euint4: 1;
7
+ euint8: 2;
8
+ euint16: 3;
9
+ euint32: 4;
10
+ euint64: 5;
11
+ euint128: 6;
12
+ euint160: 7;
13
+ euint256: 8;
14
+ ebytes64: 9;
15
+ ebytes128: 10;
16
+ ebytes256: 11;
17
+ }>;
18
+ export declare const HandleTypeName: Schema.SchemaClass<"ebool" | "euint4" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "euint160" | "euint256" | "ebytes64" | "ebytes128" | "ebytes256", "ebool" | "euint4" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "euint160" | "euint256" | "ebytes64" | "ebytes128" | "ebytes256", never>;
19
+ export type HandleTypeName = typeof HandleTypeName.Type;
20
+ export type HandleTypes = typeof handleTypes;
21
+ export type FheType = HandleTypes[keyof HandleTypes];
22
+ export declare function isFheType(value: number): value is FheType;
23
+ export declare const InputContext: Schema.Struct<{
24
+ hostChainId: typeof Schema.BigInt;
25
+ aclAddress: Schema.TemplateLiteral<`0x${string}`>;
26
+ userAddress: Schema.TemplateLiteral<`0x${string}`>;
27
+ contractAddress: Schema.TemplateLiteral<`0x${string}`>;
28
+ }>;
29
+ export type InputContext = typeof InputContext.Type;
30
+ export type Handle = HexString;
31
+ export declare function getHandleType(handle: HexString): FheType;
32
+ export declare function computePrehandle({ ciphertext, indexHandle, handleType, handleVersion, }: {
33
+ ciphertext: Uint8Array;
34
+ indexHandle: number;
35
+ handleType: FheType;
36
+ handleVersion: number;
37
+ }): Buffer;
38
+ export declare function computeHandle({ prehandle, context }: {
39
+ prehandle: Uint8Array;
40
+ context: InputContext;
41
+ }): Buffer;