@nihilium/client-sdk 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{browser.esm-kreqNYRZ-CV3K9CfO-DeSbuL7e.js → browser.esm-kreqNYRZ-CV3K9CfO-DA35K2mr.js} +1 -1
- package/dist/{browser.esm-kreqNYRZ-BLoDyLFh.js → browser.esm-kreqNYRZ-CVeNVlwI.js} +18 -17
- package/dist/index-DCjxkCyO.js +48914 -0
- package/dist/{index-DFD-0QrS-BD9Z8naZ.js → index-DFD-0QrS-Ctk7QymM.js} +15 -14
- package/dist/{index-DFD-0QrS-DqRwsoRk-DaSQ-uF-.js → index-DFD-0QrS-Jw1FnMaR-D_K_-juK.js} +118 -118
- package/dist/{index-C3cHMpbE-BjZqbn-8.js → index-ToaS6unp-DgCzjWB-.js} +97 -96
- package/dist/index.d.ts +1616 -1631
- package/dist/index.mjs +35 -38
- package/dist/types-B5eO7zCS.js +78196 -0
- package/dist/types.d.ts +989 -0
- package/dist/types.mjs +29 -0
- package/package.json +5 -1
- package/dist/index-78RSe_cY.js +0 -126823
package/dist/index.d.ts
CHANGED
|
@@ -1,1358 +1,792 @@
|
|
|
1
1
|
import * as poseidonLite from 'poseidon-lite';
|
|
2
2
|
|
|
3
|
-
/** Field is not always over prime: for example, Fp2 has ORDER(q)=p^m. */
|
|
4
|
-
interface IField<T> {
|
|
5
|
-
ORDER: bigint;
|
|
6
|
-
isLE: boolean;
|
|
7
|
-
BYTES: number;
|
|
8
|
-
BITS: number;
|
|
9
|
-
MASK: bigint;
|
|
10
|
-
ZERO: T;
|
|
11
|
-
ONE: T;
|
|
12
|
-
create: (num: T) => T;
|
|
13
|
-
isValid: (num: T) => boolean;
|
|
14
|
-
is0: (num: T) => boolean;
|
|
15
|
-
neg(num: T): T;
|
|
16
|
-
inv(num: T): T;
|
|
17
|
-
sqrt(num: T): T;
|
|
18
|
-
sqr(num: T): T;
|
|
19
|
-
eql(lhs: T, rhs: T): boolean;
|
|
20
|
-
add(lhs: T, rhs: T): T;
|
|
21
|
-
sub(lhs: T, rhs: T): T;
|
|
22
|
-
mul(lhs: T, rhs: T | bigint): T;
|
|
23
|
-
pow(lhs: T, power: bigint): T;
|
|
24
|
-
div(lhs: T, rhs: T | bigint): T;
|
|
25
|
-
addN(lhs: T, rhs: T): T;
|
|
26
|
-
subN(lhs: T, rhs: T): T;
|
|
27
|
-
mulN(lhs: T, rhs: T | bigint): T;
|
|
28
|
-
sqrN(num: T): T;
|
|
29
|
-
isOdd?(num: T): boolean;
|
|
30
|
-
pow(lhs: T, power: bigint): T;
|
|
31
|
-
invertBatch: (lst: T[]) => T[];
|
|
32
|
-
toBytes(num: T): Uint8Array;
|
|
33
|
-
fromBytes(bytes: Uint8Array): T;
|
|
34
|
-
cmov(a: T, b: T, c: boolean): T;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
3
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @module
|
|
4
|
+
* A [[HexString]] whose length is even, which ensures it is a valid
|
|
5
|
+
* representation of binary data.
|
|
41
6
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
type AffinePoint$1<T> = {
|
|
45
|
-
x: T;
|
|
46
|
-
y: T;
|
|
47
|
-
} & {
|
|
48
|
-
z?: never;
|
|
49
|
-
t?: never;
|
|
50
|
-
};
|
|
51
|
-
interface Group$1<T extends Group$1<T>> {
|
|
52
|
-
double(): T;
|
|
53
|
-
negate(): T;
|
|
54
|
-
add(other: T): T;
|
|
55
|
-
subtract(other: T): T;
|
|
56
|
-
equals(other: T): boolean;
|
|
57
|
-
multiply(scalar: bigint): T;
|
|
58
|
-
}
|
|
59
|
-
type GroupConstructor$1<T> = {
|
|
60
|
-
BASE: T;
|
|
61
|
-
ZERO: T;
|
|
62
|
-
};
|
|
7
|
+
type DataHexString = string;
|
|
63
8
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
9
|
+
* A string which is prefixed with ``0x`` and followed by any number
|
|
10
|
+
* of case-agnostic hexadecimal characters.
|
|
11
|
+
*
|
|
12
|
+
* It must match the regular expression ``/0x[0-9A-Fa-f]*\/``.
|
|
66
13
|
*/
|
|
67
|
-
type
|
|
68
|
-
Fp: IField<T>;
|
|
69
|
-
n: bigint;
|
|
70
|
-
nBitLength?: number;
|
|
71
|
-
nByteLength?: number;
|
|
72
|
-
h: bigint;
|
|
73
|
-
hEff?: bigint;
|
|
74
|
-
Gx: T;
|
|
75
|
-
Gy: T;
|
|
76
|
-
allowInfinityPoint?: boolean;
|
|
77
|
-
};
|
|
78
|
-
|
|
14
|
+
type HexString$1 = string;
|
|
79
15
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @module
|
|
16
|
+
* An object that can be used to represent binary data.
|
|
82
17
|
*/
|
|
83
|
-
|
|
84
|
-
type Hex$1 = Uint8Array | string;
|
|
85
|
-
type FHash = (message: Uint8Array | string) => Uint8Array;
|
|
18
|
+
type BytesLike = DataHexString | Uint8Array;
|
|
86
19
|
|
|
87
20
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
21
|
+
* Addresses are a fundamental part of interacting with Ethereum. They
|
|
22
|
+
* represent the global identity of Externally Owned Accounts (accounts
|
|
23
|
+
* backed by a private key) and contracts.
|
|
24
|
+
*
|
|
25
|
+
* The Ethereum Naming Service (ENS) provides an interconnected ecosystem
|
|
26
|
+
* of contracts, standards and libraries which enable looking up an
|
|
27
|
+
* address for an ENS name.
|
|
28
|
+
*
|
|
29
|
+
* These functions help convert between various formats, validate
|
|
30
|
+
* addresses and safely resolve ENS names.
|
|
31
|
+
*
|
|
32
|
+
* @_section: api/address:Addresses [about-addresses]
|
|
91
33
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
106
|
-
prehash?: FHash;
|
|
107
|
-
mapToCurve?: (scalar: bigint[]) => AffinePoint$1<bigint>;
|
|
108
|
-
};
|
|
109
|
-
type CurveTypeWithLength = Readonly<CurveType & {
|
|
110
|
-
nByteLength: number;
|
|
111
|
-
nBitLength: number;
|
|
112
|
-
}>;
|
|
113
|
-
declare function validateOpts(curve: CurveType): CurveTypeWithLength;
|
|
114
|
-
/** Instance of Extended Point with coordinates in X, Y, Z, T. */
|
|
115
|
-
interface ExtPointType$1 extends Group$1<ExtPointType$1> {
|
|
116
|
-
readonly ex: bigint;
|
|
117
|
-
readonly ey: bigint;
|
|
118
|
-
readonly ez: bigint;
|
|
119
|
-
readonly et: bigint;
|
|
120
|
-
get x(): bigint;
|
|
121
|
-
get y(): bigint;
|
|
122
|
-
assertValidity(): void;
|
|
123
|
-
multiply(scalar: bigint): ExtPointType$1;
|
|
124
|
-
multiplyUnsafe(scalar: bigint): ExtPointType$1;
|
|
125
|
-
isSmallOrder(): boolean;
|
|
126
|
-
isTorsionFree(): boolean;
|
|
127
|
-
clearCofactor(): ExtPointType$1;
|
|
128
|
-
toAffine(iz?: bigint): AffinePoint$1<bigint>;
|
|
129
|
-
toRawBytes(isCompressed?: boolean): Uint8Array;
|
|
130
|
-
toHex(isCompressed?: boolean): string;
|
|
131
|
-
_setWindowSize(windowSize: number): void;
|
|
132
|
-
}
|
|
133
|
-
/** Static methods of Extended Point with coordinates in X, Y, Z, T. */
|
|
134
|
-
interface ExtPointConstructor$1 extends GroupConstructor$1<ExtPointType$1> {
|
|
135
|
-
new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType$1;
|
|
136
|
-
fromAffine(p: AffinePoint$1<bigint>): ExtPointType$1;
|
|
137
|
-
fromHex(hex: Hex$1): ExtPointType$1;
|
|
138
|
-
fromPrivateKey(privateKey: Hex$1): ExtPointType$1;
|
|
139
|
-
msm(points: ExtPointType$1[], scalars: bigint[]): ExtPointType$1;
|
|
34
|
+
/**
|
|
35
|
+
* An interface for objects which have an address, and can
|
|
36
|
+
* resolve it asyncronously.
|
|
37
|
+
*
|
|
38
|
+
* This allows objects such as [[Signer]] or [[Contract]] to
|
|
39
|
+
* be used most places an address can be, for example getting
|
|
40
|
+
* the [balance](Provider-getBalance).
|
|
41
|
+
*/
|
|
42
|
+
interface Addressable {
|
|
43
|
+
/**
|
|
44
|
+
* Get the object address.
|
|
45
|
+
*/
|
|
46
|
+
getAddress(): Promise<string>;
|
|
140
47
|
}
|
|
141
48
|
/**
|
|
142
|
-
*
|
|
143
|
-
* Main methods: `getPublicKey(priv)`, `sign(msg, priv)`, `verify(sig, msg, pub)`.
|
|
49
|
+
* Anything that can be used to return or resolve an address.
|
|
144
50
|
*/
|
|
145
|
-
type
|
|
146
|
-
CURVE: ReturnType<typeof validateOpts>;
|
|
147
|
-
getPublicKey: (privateKey: Hex$1) => Uint8Array;
|
|
148
|
-
sign: (message: Hex$1, privateKey: Hex$1, options?: {
|
|
149
|
-
context?: Hex$1;
|
|
150
|
-
}) => Uint8Array;
|
|
151
|
-
verify: (sig: Hex$1, message: Hex$1, publicKey: Hex$1, options?: {
|
|
152
|
-
context?: Hex$1;
|
|
153
|
-
zip215: boolean;
|
|
154
|
-
}) => boolean;
|
|
155
|
-
ExtendedPoint: ExtPointConstructor$1;
|
|
156
|
-
utils: {
|
|
157
|
-
randomPrivateKey: () => Uint8Array;
|
|
158
|
-
getExtendedPublicKey: (key: Hex$1) => {
|
|
159
|
-
head: Uint8Array;
|
|
160
|
-
prefix: Uint8Array;
|
|
161
|
-
scalar: bigint;
|
|
162
|
-
point: ExtPointType$1;
|
|
163
|
-
pointBytes: Uint8Array;
|
|
164
|
-
};
|
|
165
|
-
precompute: (windowSize?: number, point?: ExtPointType$1) => ExtPointType$1;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
type SnarkBigInt$1 = bigint;
|
|
170
|
-
type PrivKey$1 = bigint;
|
|
171
|
-
type PubKey$1 = ExtPointType$1;
|
|
172
|
-
type BabyJubAffinePoint$1 = AffinePoint$1<bigint>;
|
|
173
|
-
type BabyJubExtPoint$1 = ExtPointType$1;
|
|
174
|
-
declare const babyJubNoble: CurveFn;
|
|
51
|
+
type AddressLike = string | Promise<string> | Addressable;
|
|
175
52
|
/**
|
|
176
|
-
*
|
|
53
|
+
* An interface for any object which can resolve an ENS name.
|
|
177
54
|
*/
|
|
178
|
-
interface
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
export { SNARK_FIELD_SIZE$1 as SNARK_FIELD_SIZE, babyJub$1 as babyJub, index_d$1_babyJubNoble as babyJubNoble };
|
|
188
|
-
export type { BabyJubAffinePoint$1 as BabyJubAffinePoint, BabyJubExtPoint$1 as BabyJubExtPoint, Keypair$1 as Keypair, PrivKey$1 as PrivKey, PubKey$1 as PubKey, SnarkBigInt$1 as SnarkBigInt };
|
|
55
|
+
interface NameResolver {
|
|
56
|
+
/**
|
|
57
|
+
* Resolve to the address for the ENS %%name%%.
|
|
58
|
+
*
|
|
59
|
+
* Resolves to ``null`` if the name is unconfigued. Use
|
|
60
|
+
* [[resolveAddress]] (passing this object as %%resolver%%) to
|
|
61
|
+
* throw for names that are unconfigured.
|
|
62
|
+
*/
|
|
63
|
+
resolveName(name: string): Promise<null | string>;
|
|
189
64
|
}
|
|
190
65
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
66
|
+
/**
|
|
67
|
+
* A SignatureLike
|
|
68
|
+
*
|
|
69
|
+
* @_docloc: api/crypto:Signing
|
|
70
|
+
*/
|
|
71
|
+
type SignatureLike = Signature | string | {
|
|
72
|
+
r: string;
|
|
73
|
+
s: string;
|
|
74
|
+
v: BigNumberish;
|
|
75
|
+
yParity?: 0 | 1;
|
|
76
|
+
yParityAndS?: string;
|
|
77
|
+
} | {
|
|
78
|
+
r: string;
|
|
79
|
+
yParityAndS: string;
|
|
80
|
+
yParity?: 0 | 1;
|
|
81
|
+
s?: string;
|
|
82
|
+
v?: number;
|
|
83
|
+
} | {
|
|
84
|
+
r: string;
|
|
85
|
+
s: string;
|
|
86
|
+
yParity: 0 | 1;
|
|
87
|
+
v?: BigNumberish;
|
|
88
|
+
yParityAndS?: string;
|
|
199
89
|
};
|
|
200
|
-
interface Group<T extends Group<T>> {
|
|
201
|
-
double(): T;
|
|
202
|
-
negate(): T;
|
|
203
|
-
add(other: T): T;
|
|
204
|
-
subtract(other: T): T;
|
|
205
|
-
equals(other: T): boolean;
|
|
206
|
-
multiply(scalar: bigint): T;
|
|
207
|
-
}
|
|
208
|
-
type GroupConstructor<T> = {
|
|
209
|
-
BASE: T;
|
|
210
|
-
ZERO: T;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
type Hex = Uint8Array | string;
|
|
214
|
-
|
|
215
|
-
interface ExtPointType extends Group<ExtPointType> {
|
|
216
|
-
readonly ex: bigint;
|
|
217
|
-
readonly ey: bigint;
|
|
218
|
-
readonly ez: bigint;
|
|
219
|
-
readonly et: bigint;
|
|
220
|
-
get x(): bigint;
|
|
221
|
-
get y(): bigint;
|
|
222
|
-
assertValidity(): void;
|
|
223
|
-
multiply(scalar: bigint): ExtPointType;
|
|
224
|
-
multiplyUnsafe(scalar: bigint): ExtPointType;
|
|
225
|
-
isSmallOrder(): boolean;
|
|
226
|
-
isTorsionFree(): boolean;
|
|
227
|
-
clearCofactor(): ExtPointType;
|
|
228
|
-
toAffine(iz?: bigint): AffinePoint<bigint>;
|
|
229
|
-
toRawBytes(isCompressed?: boolean): Uint8Array;
|
|
230
|
-
toHex(isCompressed?: boolean): string;
|
|
231
|
-
}
|
|
232
|
-
interface ExtPointConstructor extends GroupConstructor<ExtPointType> {
|
|
233
|
-
new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType;
|
|
234
|
-
fromAffine(p: AffinePoint<bigint>): ExtPointType;
|
|
235
|
-
fromHex(hex: Hex): ExtPointType;
|
|
236
|
-
fromPrivateKey(privateKey: Hex): ExtPointType;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
type SnarkBigInt = bigint;
|
|
240
|
-
type PrivKey = bigint;
|
|
241
|
-
type PubKey = ExtPointType;
|
|
242
|
-
type BabyJubAffinePoint = AffinePoint<bigint>;
|
|
243
|
-
type BabyJubExtPoint = ExtPointType;
|
|
244
90
|
/**
|
|
245
|
-
*
|
|
91
|
+
* A Signature @TODO
|
|
92
|
+
*
|
|
93
|
+
*
|
|
94
|
+
* @_docloc: api/crypto:Signing
|
|
246
95
|
*/
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
96
|
+
declare class Signature {
|
|
97
|
+
#private;
|
|
98
|
+
/**
|
|
99
|
+
* The ``r`` value for a signature.
|
|
100
|
+
*
|
|
101
|
+
* This represents the ``x`` coordinate of a "reference" or
|
|
102
|
+
* challenge point, from which the ``y`` can be computed.
|
|
103
|
+
*/
|
|
104
|
+
get r(): string;
|
|
105
|
+
set r(value: BytesLike);
|
|
106
|
+
/**
|
|
107
|
+
* The ``s`` value for a signature.
|
|
108
|
+
*/
|
|
109
|
+
get s(): string;
|
|
110
|
+
set s(_value: BytesLike);
|
|
111
|
+
/**
|
|
112
|
+
* The ``v`` value for a signature.
|
|
113
|
+
*
|
|
114
|
+
* Since a given ``x`` value for ``r`` has two possible values for
|
|
115
|
+
* its correspondin ``y``, the ``v`` indicates which of the two ``y``
|
|
116
|
+
* values to use.
|
|
117
|
+
*
|
|
118
|
+
* It is normalized to the values ``27`` or ``28`` for legacy
|
|
119
|
+
* purposes.
|
|
120
|
+
*/
|
|
121
|
+
get v(): 27 | 28;
|
|
122
|
+
set v(value: BigNumberish);
|
|
123
|
+
/**
|
|
124
|
+
* The EIP-155 ``v`` for legacy transactions. For non-legacy
|
|
125
|
+
* transactions, this value is ``null``.
|
|
126
|
+
*/
|
|
127
|
+
get networkV(): null | bigint;
|
|
128
|
+
/**
|
|
129
|
+
* The chain ID for EIP-155 legacy transactions. For non-legacy
|
|
130
|
+
* transactions, this value is ``null``.
|
|
131
|
+
*/
|
|
132
|
+
get legacyChainId(): null | bigint;
|
|
133
|
+
/**
|
|
134
|
+
* The ``yParity`` for the signature.
|
|
135
|
+
*
|
|
136
|
+
* See ``v`` for more details on how this value is used.
|
|
137
|
+
*/
|
|
138
|
+
get yParity(): 0 | 1;
|
|
139
|
+
/**
|
|
140
|
+
* The [[link-eip-2098]] compact representation of the ``yParity``
|
|
141
|
+
* and ``s`` compacted into a single ``bytes32``.
|
|
142
|
+
*/
|
|
143
|
+
get yParityAndS(): string;
|
|
144
|
+
/**
|
|
145
|
+
* The [[link-eip-2098]] compact representation.
|
|
146
|
+
*/
|
|
147
|
+
get compactSerialized(): string;
|
|
148
|
+
/**
|
|
149
|
+
* The serialized representation.
|
|
150
|
+
*/
|
|
151
|
+
get serialized(): string;
|
|
152
|
+
/**
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
constructor(guard: any, r: string, s: string, v: 27 | 28);
|
|
156
|
+
/**
|
|
157
|
+
* Returns a new identical [[Signature]].
|
|
158
|
+
*/
|
|
159
|
+
clone(): Signature;
|
|
160
|
+
/**
|
|
161
|
+
* Returns a representation that is compatible with ``JSON.stringify``.
|
|
162
|
+
*/
|
|
163
|
+
toJSON(): any;
|
|
164
|
+
/**
|
|
165
|
+
* Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
|
|
166
|
+
*
|
|
167
|
+
* @example:
|
|
168
|
+
* Signature.getChainId(45)
|
|
169
|
+
* //_result:
|
|
170
|
+
*
|
|
171
|
+
* Signature.getChainId(46)
|
|
172
|
+
* //_result:
|
|
173
|
+
*/
|
|
174
|
+
static getChainId(v: BigNumberish): bigint;
|
|
175
|
+
/**
|
|
176
|
+
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
|
|
177
|
+
*
|
|
178
|
+
* Legacy transactions which use [[link-eip-155]] hijack the ``v``
|
|
179
|
+
* property to include the chain ID.
|
|
180
|
+
*
|
|
181
|
+
* @example:
|
|
182
|
+
* Signature.getChainIdV(5, 27)
|
|
183
|
+
* //_result:
|
|
184
|
+
*
|
|
185
|
+
* Signature.getChainIdV(5, 28)
|
|
186
|
+
* //_result:
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint;
|
|
190
|
+
/**
|
|
191
|
+
* Compute the normalized legacy transaction ``v`` from a ``yParirty``,
|
|
192
|
+
* a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
|
|
193
|
+
*
|
|
194
|
+
* @example:
|
|
195
|
+
* // The values 0 and 1 imply v is actually yParity
|
|
196
|
+
* Signature.getNormalizedV(0)
|
|
197
|
+
* //_result:
|
|
198
|
+
*
|
|
199
|
+
* // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
|
|
200
|
+
* Signature.getNormalizedV(27)
|
|
201
|
+
* //_result:
|
|
202
|
+
*
|
|
203
|
+
* // Legacy EIP-155 transaction (i.e. >= 35)
|
|
204
|
+
* Signature.getNormalizedV(46)
|
|
205
|
+
* //_result:
|
|
206
|
+
*
|
|
207
|
+
* // Invalid values throw
|
|
208
|
+
* Signature.getNormalizedV(5)
|
|
209
|
+
* //_error:
|
|
210
|
+
*/
|
|
211
|
+
static getNormalizedV(v: BigNumberish): 27 | 28;
|
|
212
|
+
/**
|
|
213
|
+
* Creates a new [[Signature]].
|
|
214
|
+
*
|
|
215
|
+
* If no %%sig%% is provided, a new [[Signature]] is created
|
|
216
|
+
* with default values.
|
|
217
|
+
*
|
|
218
|
+
* If %%sig%% is a string, it is parsed.
|
|
219
|
+
*/
|
|
220
|
+
static from(sig?: SignatureLike): Signature;
|
|
250
221
|
}
|
|
251
|
-
declare const SNARK_FIELD_SIZE: SnarkBigInt;
|
|
252
|
-
declare const babyJub: ExtPointConstructor;
|
|
253
|
-
|
|
254
|
-
declare const stringifyBigInts: (obj: object) => any;
|
|
255
|
-
declare const unstringifyBigInts: (obj: object) => any;
|
|
256
222
|
|
|
257
|
-
declare function createNobleBlakeHash(data: Buffer): Buffer<ArrayBuffer>;
|
|
258
|
-
declare function generateRandom248BitNumber(): bigint;
|
|
259
|
-
declare function generateRandom240BitNumber(): bigint;
|
|
260
|
-
declare function shrinkToBits(number: bigint, bits: number): bigint;
|
|
261
|
-
/**
|
|
262
|
-
* Split a very large number into chunks of 32 bits each.
|
|
263
|
-
* @param {BigInt} number - A BigInt representing the large number.
|
|
264
|
-
* @returns {Array<BigInt>} - An array of chunks (BigInts).
|
|
265
|
-
*/
|
|
266
|
-
declare function splitLargeNumber(number: bigint, size?: bigint): any[];
|
|
267
|
-
/**
|
|
268
|
-
* Combine chunks of 32 bits each into the original large number.
|
|
269
|
-
* @param {Array<BigInt>} chunks - An array of chunks (BigInts).
|
|
270
|
-
* @param {BigInt} size - The size of each chunk in bits.
|
|
271
|
-
* @returns {BigInt} - The combined large number.
|
|
272
|
-
*/
|
|
273
|
-
declare function combineChunksWithCarry(chunks: bigint[], size?: bigint): bigint;
|
|
274
|
-
declare function pruneBuffer(buff: Buffer): Buffer<ArrayBufferLike>;
|
|
275
|
-
declare function stringToCurve(mimc: any, string: string): any;
|
|
276
|
-
declare function prv2pub(prv: Buffer): ExtPointType;
|
|
277
|
-
declare function ffEncodedToBigInt(babyJub: any, encoded: bigint): any;
|
|
278
|
-
/**
|
|
279
|
-
* An internal function which formats a random private key to be compatible
|
|
280
|
-
* with the BabyJub curve. This is the format which should be passed into the
|
|
281
|
-
* PubKey and other circuits.
|
|
282
|
-
*/
|
|
283
|
-
declare function formatPrivKeyForBabyJub(privKey: bigint): any;
|
|
284
|
-
/**
|
|
285
|
-
* Function to use when you have just the scalar value of the private key
|
|
286
|
-
* and you need to convert it to the public key (Ax, Ay)
|
|
287
|
-
*/
|
|
288
|
-
declare function privateScalarToPubKey(p: bigint): [bigint, bigint];
|
|
289
|
-
/**
|
|
290
|
-
* Convert a BigInt to a Buffer
|
|
291
|
-
*/
|
|
292
|
-
declare const bigInt2Buffer: (i: BigInt) => Buffer;
|
|
293
|
-
declare const hexString2Buffer: (i: string) => Buffer;
|
|
294
|
-
declare const buffer2HexString: (i: Buffer) => string;
|
|
295
|
-
declare const uint8ArrayToHex: (uint8Array: Uint8Array | any) => string;
|
|
296
|
-
/**
|
|
297
|
-
* Convert an EC extended point into an array of two bigints
|
|
298
|
-
*/
|
|
299
|
-
declare function toBigIntArray(point: BabyJubExtPoint): [bigint, bigint];
|
|
300
223
|
/**
|
|
301
|
-
*
|
|
224
|
+
* Any type that can be used where a numeric value is needed.
|
|
302
225
|
*/
|
|
303
|
-
|
|
304
|
-
declare function combineTwoPublicKeys(pubKey1: bigint[], pubKey2: bigint[]): bigint[];
|
|
305
|
-
declare function combineTwoPublicKeysPlain(pubKey1: bigint[], pubKey2: bigint[]): bigint[];
|
|
226
|
+
type Numeric = number | bigint;
|
|
306
227
|
/**
|
|
307
|
-
*
|
|
228
|
+
* Any type that can be used where a big number is needed.
|
|
308
229
|
*/
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
declare function coordinatesToExtPointBigint(x: bigint, y: bigint): BabyJubExtPoint;
|
|
312
|
-
declare function portableArgon2(data: Buffer, options?: {
|
|
313
|
-
memory: number;
|
|
314
|
-
iterations: number;
|
|
315
|
-
parallelism: number;
|
|
316
|
-
}): Buffer;
|
|
230
|
+
type BigNumberish = string | Numeric;
|
|
231
|
+
|
|
317
232
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* In Node.js, it uses require('crypto').randomBytes if available.
|
|
322
|
-
* @param length Number of random bytes to generate.
|
|
323
|
-
* @returns Uint8Array of random bytes.
|
|
233
|
+
* A **TransactionLike** is an object which is appropriate as a loose
|
|
234
|
+
* input for many operations which will populate missing properties of
|
|
235
|
+
* a transaction.
|
|
324
236
|
*/
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
237
|
+
interface TransactionLike<A = string> {
|
|
238
|
+
/**
|
|
239
|
+
* The type.
|
|
240
|
+
*/
|
|
241
|
+
type?: null | number;
|
|
242
|
+
/**
|
|
243
|
+
* The recipient address or ``null`` for an ``init`` transaction.
|
|
244
|
+
*/
|
|
245
|
+
to?: null | A;
|
|
246
|
+
/**
|
|
247
|
+
* The sender.
|
|
248
|
+
*/
|
|
249
|
+
from?: null | A;
|
|
250
|
+
/**
|
|
251
|
+
* The nonce.
|
|
252
|
+
*/
|
|
253
|
+
nonce?: null | number;
|
|
254
|
+
/**
|
|
255
|
+
* The maximum amount of gas that can be used.
|
|
256
|
+
*/
|
|
257
|
+
gasLimit?: null | BigNumberish;
|
|
258
|
+
/**
|
|
259
|
+
* The gas price for legacy and berlin transactions.
|
|
260
|
+
*/
|
|
261
|
+
gasPrice?: null | BigNumberish;
|
|
262
|
+
/**
|
|
263
|
+
* The maximum priority fee per gas for london transactions.
|
|
264
|
+
*/
|
|
265
|
+
maxPriorityFeePerGas?: null | BigNumberish;
|
|
266
|
+
/**
|
|
267
|
+
* The maximum total fee per gas for london transactions.
|
|
268
|
+
*/
|
|
269
|
+
maxFeePerGas?: null | BigNumberish;
|
|
270
|
+
/**
|
|
271
|
+
* The data.
|
|
272
|
+
*/
|
|
273
|
+
data?: null | string;
|
|
274
|
+
/**
|
|
275
|
+
* The value (in wei) to send.
|
|
276
|
+
*/
|
|
277
|
+
value?: null | BigNumberish;
|
|
278
|
+
/**
|
|
279
|
+
* The chain ID the transaction is valid on.
|
|
280
|
+
*/
|
|
281
|
+
chainId?: null | BigNumberish;
|
|
282
|
+
/**
|
|
283
|
+
* The transaction hash.
|
|
284
|
+
*/
|
|
285
|
+
hash?: null | string;
|
|
286
|
+
/**
|
|
287
|
+
* The signature provided by the sender.
|
|
288
|
+
*/
|
|
289
|
+
signature?: null | SignatureLike;
|
|
290
|
+
/**
|
|
291
|
+
* The access list for berlin and london transactions.
|
|
292
|
+
*/
|
|
293
|
+
accessList?: null | AccessListish;
|
|
294
|
+
/**
|
|
295
|
+
* The maximum fee per blob gas (see [[link-eip-4844]]).
|
|
296
|
+
*/
|
|
297
|
+
maxFeePerBlobGas?: null | BigNumberish;
|
|
298
|
+
/**
|
|
299
|
+
* The versioned hashes (see [[link-eip-4844]]).
|
|
300
|
+
*/
|
|
301
|
+
blobVersionedHashes?: null | Array<string>;
|
|
302
|
+
/**
|
|
303
|
+
* The blobs (if any) attached to this transaction (see [[link-eip-4844]]).
|
|
304
|
+
*/
|
|
305
|
+
blobs?: null | Array<BlobLike>;
|
|
306
|
+
/**
|
|
307
|
+
* An external library for computing the KZG commitments and
|
|
308
|
+
* proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]).
|
|
309
|
+
*
|
|
310
|
+
* This is generally ``null``, unless you are creating BLOb
|
|
311
|
+
* transactions.
|
|
312
|
+
*/
|
|
313
|
+
kzg?: null | KzgLibraryLike;
|
|
314
|
+
/**
|
|
315
|
+
* The [[link-eip-7702]] authorizations (if any).
|
|
316
|
+
*/
|
|
317
|
+
authorizationList?: null | Array<Authorization>;
|
|
318
|
+
}
|
|
349
319
|
/**
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* Example usage:
|
|
354
|
-
*
|
|
355
|
-
* ```typescript
|
|
356
|
-
* const wasm_tester = require('circom_tester').wasm;
|
|
357
|
-
*
|
|
358
|
-
* /// the circuit is loaded only once and it is available for use across multiple test cases.
|
|
359
|
-
* const circuit = await wasm_tester(path.resolve("./circuit/path"));
|
|
360
|
-
* const witness = await circuit.calculateWitness(inputsObject);
|
|
361
|
-
* await circuit.checkConstraints(witness);
|
|
362
|
-
* await circuit.loadSymbols();
|
|
320
|
+
* A BLOb object that can be passed for [[link-eip-4844]]
|
|
321
|
+
* transactions.
|
|
363
322
|
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* const singalName = 'main.out'
|
|
367
|
-
* const signalValue = getSignalByName(circuit, witness, SignalName)
|
|
368
|
-
* ```
|
|
323
|
+
* It may have had its commitment and proof already provided
|
|
324
|
+
* or rely on an attached [[KzgLibrary]] to compute them.
|
|
369
325
|
*/
|
|
370
|
-
|
|
326
|
+
type BlobLike = BytesLike | {
|
|
327
|
+
data: BytesLike;
|
|
328
|
+
proof: BytesLike;
|
|
329
|
+
commitment: BytesLike;
|
|
330
|
+
};
|
|
371
331
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* @param key - The encryption key as a BigInt
|
|
375
|
-
* @returns The encrypted value as a hex string
|
|
332
|
+
* A KZG Library with the necessary functions to compute
|
|
333
|
+
* BLOb commitments and proofs.
|
|
376
334
|
*/
|
|
377
|
-
|
|
335
|
+
interface KzgLibrary {
|
|
336
|
+
blobToKzgCommitment: (blob: Uint8Array) => Uint8Array;
|
|
337
|
+
computeBlobKzgProof: (blob: Uint8Array, commitment: Uint8Array) => Uint8Array;
|
|
338
|
+
}
|
|
378
339
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
340
|
+
* A KZG Library with any of the various API configurations.
|
|
341
|
+
* As the library is still experimental and the API is not
|
|
342
|
+
* stable, depending on the version used the method names and
|
|
343
|
+
* signatures are still in flux.
|
|
344
|
+
*
|
|
345
|
+
* This allows any of the versions to be passed into Transaction
|
|
346
|
+
* while providing a stable external API.
|
|
383
347
|
*/
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
x: string;
|
|
391
|
-
y: string;
|
|
392
|
-
};
|
|
348
|
+
type KzgLibraryLike = KzgLibrary | {
|
|
349
|
+
blobToKZGCommitment: (blob: string) => string;
|
|
350
|
+
computeBlobKZGProof: (blob: string, commitment: string) => string;
|
|
351
|
+
} | {
|
|
352
|
+
blobToKzgCommitment: (blob: string) => string | Uint8Array;
|
|
353
|
+
computeBlobProof: (blob: string, commitment: string) => string | Uint8Array;
|
|
393
354
|
};
|
|
394
|
-
|
|
395
|
-
x: string;
|
|
396
|
-
y: string;
|
|
397
|
-
}, recipientPrivKey: PrivKey): bigint;
|
|
398
|
-
/**
|
|
399
|
-
* Returns a BabyJub-compatible random value. We create it by first generating
|
|
400
|
-
* a random value (initially 256 bits large) modulo the snark field size as
|
|
401
|
-
* described in EIP197. This results in a key size of roughly 253 bits and no
|
|
402
|
-
* more than 254 bits. To prevent modulo bias, we then use this efficient
|
|
403
|
-
* algorithm:
|
|
404
|
-
* http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/crypt/arc4random_uniform.c
|
|
405
|
-
* @return A BabyJub-compatible random value.
|
|
406
|
-
* @see {@link https://github.com/privacy-scaling-explorations/maci/blob/master/crypto/ts/index.ts}
|
|
407
|
-
*/
|
|
408
|
-
declare function genRandomBabyJubValue(): bigint;
|
|
409
|
-
declare function genSmallRandomBabyJubValue(): bigint;
|
|
355
|
+
|
|
410
356
|
/**
|
|
411
|
-
*
|
|
357
|
+
* Each state-changing operation on Ethereum requires a transaction.
|
|
358
|
+
*
|
|
359
|
+
* @_section api/transaction:Transactions [about-transactions]
|
|
412
360
|
*/
|
|
413
|
-
|
|
361
|
+
|
|
414
362
|
/**
|
|
415
|
-
*
|
|
363
|
+
* A single [[AccessList]] entry of storage keys (slots) for an address.
|
|
416
364
|
*/
|
|
417
|
-
|
|
365
|
+
type AccessListEntry = {
|
|
366
|
+
address: string;
|
|
367
|
+
storageKeys: Array<string>;
|
|
368
|
+
};
|
|
418
369
|
/**
|
|
419
|
-
*
|
|
420
|
-
* @return A public key associated with the private key
|
|
370
|
+
* An ordered collection of [[AccessList]] entries.
|
|
421
371
|
*/
|
|
422
|
-
|
|
423
|
-
declare function genKeypair(scalar?: bigint): Keypair;
|
|
372
|
+
type AccessList = Array<AccessListEntry>;
|
|
424
373
|
/**
|
|
425
|
-
*
|
|
426
|
-
* may decrypt it.
|
|
427
|
-
* @param pubKey The recepient's public key
|
|
428
|
-
* @param encodedMessage A plaintext encoded as a BabyJub curve point (optional)
|
|
429
|
-
* @param randomVal A random value y used along with the private key to generate the ciphertext (optional)
|
|
374
|
+
* Any ethers-supported access list structure.
|
|
430
375
|
*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
encrypted_message: ExtPointType;
|
|
376
|
+
type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
|
|
377
|
+
interface Authorization {
|
|
378
|
+
address: string;
|
|
435
379
|
nonce: bigint;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
ephemeralKey: ExtPointType;
|
|
445
|
-
encryptedMessage: ExtPointType;
|
|
446
|
-
};
|
|
447
|
-
declare function HEAddAll(empheralKeys1: ExtPointType[], empheralKeys2: ExtPointType[], encryptedMessages1: ExtPointType[], encryptedMessages2: ExtPointType[]): {
|
|
448
|
-
ephemeralKeys: ExtPointType[];
|
|
449
|
-
encryptedMessages: ExtPointType[];
|
|
450
|
-
};
|
|
451
|
-
declare function encrypt_s(message: BabyJubExtPoint, public_key: PubKey, nonce?: bigint): {
|
|
452
|
-
ephemeral_key: ExtPointType;
|
|
453
|
-
encrypted_message: ExtPointType;
|
|
380
|
+
chainId: bigint;
|
|
381
|
+
signature: Signature;
|
|
382
|
+
}
|
|
383
|
+
type AuthorizationLike = {
|
|
384
|
+
address: string;
|
|
385
|
+
nonce: BigNumberish;
|
|
386
|
+
chainId: BigNumberish;
|
|
387
|
+
signature: SignatureLike;
|
|
454
388
|
};
|
|
455
389
|
|
|
456
|
-
/** Canonical uint256 secret material (0x00abc and 0xabc are the same integer). */
|
|
457
|
-
declare function normalizeSigningKeyMaterial(hexKey: string): bigint;
|
|
458
|
-
/**
|
|
459
|
-
* Raw secret bytes for EdDSA (@zk-kit/eddsa-poseidon) from canonical integer hex.
|
|
460
|
-
* Leading zero nybbles in the env string are not preserved as extra bytes.
|
|
461
|
-
*/
|
|
462
|
-
declare function hexToSkBuffer(hexKey: string): Buffer;
|
|
463
390
|
/**
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
* used in `genPubKey` / `HEDecrypt` / `encrypt`.
|
|
391
|
+
* A **ContractRunner** is a generic interface which defines an object
|
|
392
|
+
* capable of interacting with a Contract on the network.
|
|
467
393
|
*
|
|
468
|
-
*
|
|
469
|
-
*/
|
|
470
|
-
declare function deriveHEKeyScalar(hexKey: string): bigint;
|
|
471
|
-
/**
|
|
472
|
-
* Derive the HE public key `[x, y]` from a raw private key hex string.
|
|
473
|
-
* Equivalent to `genPubKey(BigInt(hexKey))` but accepts a hex string and
|
|
474
|
-
* returns affine coordinates rather than an ExtPointType.
|
|
394
|
+
* The more operations supported, the more utility it is capable of.
|
|
475
395
|
*
|
|
476
|
-
*
|
|
396
|
+
* The most common ContractRunners are [Providers](Provider) which enable
|
|
397
|
+
* read-only access and [Signers](Signer) which enable write-access.
|
|
477
398
|
*/
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Derive the scalar used inside the EdDSA signing key derivation (Schnorr PoK).
|
|
481
|
-
* Matches `@zk-kit/eddsa-poseidon.deriveSecretScalar`.
|
|
482
|
-
*
|
|
483
|
-
* @param hexKey 0x-prefixed private key hex string
|
|
484
|
-
*/
|
|
485
|
-
declare function deriveSigningKeyScalar(hexKey: string): Promise<bigint>;
|
|
486
|
-
/**
|
|
487
|
-
* Derive the EdDSA signing public key `[x, y]` from a raw private key hex string.
|
|
488
|
-
* Matches `@zk-kit/eddsa-poseidon.derivePublicKey` used by the Processor and circuits.
|
|
489
|
-
*
|
|
490
|
-
* @param hexKey 0x-prefixed private key hex string
|
|
491
|
-
*/
|
|
492
|
-
declare function deriveSigningPublicKey(hexKey: string): Promise<[bigint, bigint]>;
|
|
493
|
-
|
|
494
|
-
type tools_d_BabyJubAffinePoint = BabyJubAffinePoint;
|
|
495
|
-
type tools_d_BabyJubExtPoint = BabyJubExtPoint;
|
|
496
|
-
declare const tools_d_HEAdd: typeof HEAdd;
|
|
497
|
-
declare const tools_d_HEAddAll: typeof HEAddAll;
|
|
498
|
-
declare const tools_d_HEDecrypt: typeof HEDecrypt;
|
|
499
|
-
declare const tools_d_HEDecryptExternalSolver: typeof HEDecryptExternalSolver;
|
|
500
|
-
declare const tools_d_HEDecryptSync: typeof HEDecryptSync;
|
|
501
|
-
declare const tools_d_HEEncrypt: typeof HEEncrypt;
|
|
502
|
-
declare const tools_d_HEEncryptFromPoint: typeof HEEncryptFromPoint;
|
|
503
|
-
type tools_d_Keypair = Keypair;
|
|
504
|
-
type tools_d_PrivKey = PrivKey;
|
|
505
|
-
type tools_d_PubKey = PubKey;
|
|
506
|
-
declare const tools_d_SNARK_FIELD_SIZE: typeof SNARK_FIELD_SIZE;
|
|
507
|
-
declare const tools_d_SimpelElgamalDecrypt: typeof SimpelElgamalDecrypt;
|
|
508
|
-
declare const tools_d_SimpelElgamalEncrypt: typeof SimpelElgamalEncrypt;
|
|
509
|
-
declare const tools_d_babyJub: typeof babyJub;
|
|
510
|
-
declare const tools_d_bigInt2Buffer: typeof bigInt2Buffer;
|
|
511
|
-
declare const tools_d_buffer2HexString: typeof buffer2HexString;
|
|
512
|
-
declare const tools_d_bufferToBigInt: typeof bufferToBigInt;
|
|
513
|
-
declare const tools_d_combineChunksWithCarry: typeof combineChunksWithCarry;
|
|
514
|
-
declare const tools_d_combineTwoPublicKeys: typeof combineTwoPublicKeys;
|
|
515
|
-
declare const tools_d_combineTwoPublicKeysPlain: typeof combineTwoPublicKeysPlain;
|
|
516
|
-
declare const tools_d_coordinatesToExtPoint: typeof coordinatesToExtPoint;
|
|
517
|
-
declare const tools_d_coordinatesToExtPointBigint: typeof coordinatesToExtPointBigint;
|
|
518
|
-
declare const tools_d_createNobleBlakeHash: typeof createNobleBlakeHash;
|
|
519
|
-
declare const tools_d_decrypt: typeof decrypt;
|
|
520
|
-
declare const tools_d_decryptAESBigInt: typeof decryptAESBigInt;
|
|
521
|
-
declare const tools_d_decryptECCBabyJub: typeof decryptECCBabyJub;
|
|
522
|
-
declare const tools_d_deriveHEKeyScalar: typeof deriveHEKeyScalar;
|
|
523
|
-
declare const tools_d_deriveHEPublicKey: typeof deriveHEPublicKey;
|
|
524
|
-
declare const tools_d_deriveSigningKeyScalar: typeof deriveSigningKeyScalar;
|
|
525
|
-
declare const tools_d_deriveSigningPublicKey: typeof deriveSigningPublicKey;
|
|
526
|
-
declare const tools_d_encrypt: typeof encrypt;
|
|
527
|
-
declare const tools_d_encryptAESBigInt: typeof encryptAESBigInt;
|
|
528
|
-
declare const tools_d_encryptECCBabyJub: typeof encryptECCBabyJub;
|
|
529
|
-
declare const tools_d_encrypt_s: typeof encrypt_s;
|
|
530
|
-
declare const tools_d_ffEncodedToBigInt: typeof ffEncodedToBigInt;
|
|
531
|
-
declare const tools_d_formatPrivKeyForBabyJub: typeof formatPrivKeyForBabyJub;
|
|
532
|
-
declare const tools_d_fromBytesLE: typeof fromBytesLE;
|
|
533
|
-
declare const tools_d_genKeypair: typeof genKeypair;
|
|
534
|
-
declare const tools_d_genPrivKey: typeof genPrivKey;
|
|
535
|
-
declare const tools_d_genPubKey: typeof genPubKey;
|
|
536
|
-
declare const tools_d_genRandomBabyJubValue: typeof genRandomBabyJubValue;
|
|
537
|
-
declare const tools_d_genRandomSalt: typeof genRandomSalt;
|
|
538
|
-
declare const tools_d_genSmallRandomBabyJubValue: typeof genSmallRandomBabyJubValue;
|
|
539
|
-
declare const tools_d_generateNonces: typeof generateNonces;
|
|
540
|
-
declare const tools_d_generateRandom240BitNumber: typeof generateRandom240BitNumber;
|
|
541
|
-
declare const tools_d_generateRandom248BitNumber: typeof generateRandom248BitNumber;
|
|
542
|
-
declare const tools_d_getSignalByName: typeof getSignalByName;
|
|
543
|
-
declare const tools_d_hashCypherText: typeof hashCypherText;
|
|
544
|
-
declare const tools_d_hashExtPoints: typeof hashExtPoints;
|
|
545
|
-
declare const tools_d_hexString2Buffer: typeof hexString2Buffer;
|
|
546
|
-
declare const tools_d_hexToSkBuffer: typeof hexToSkBuffer;
|
|
547
|
-
declare const tools_d_normalizeSigningKeyMaterial: typeof normalizeSigningKeyMaterial;
|
|
548
|
-
declare const tools_d_portableArgon2: typeof portableArgon2;
|
|
549
|
-
declare const tools_d_portableRandomBytes: typeof portableRandomBytes;
|
|
550
|
-
declare const tools_d_privateScalarToPubKey: typeof privateScalarToPubKey;
|
|
551
|
-
declare const tools_d_pruneBuffer: typeof pruneBuffer;
|
|
552
|
-
declare const tools_d_pruneTo32Bits: typeof pruneTo32Bits;
|
|
553
|
-
declare const tools_d_pruneTo64Bits: typeof pruneTo64Bits;
|
|
554
|
-
declare const tools_d_prv2pub: typeof prv2pub;
|
|
555
|
-
declare const tools_d_shrinkToBits: typeof shrinkToBits;
|
|
556
|
-
declare const tools_d_splitLargeNumber: typeof splitLargeNumber;
|
|
557
|
-
declare const tools_d_stringToCurve: typeof stringToCurve;
|
|
558
|
-
declare const tools_d_stringifyBigInts: typeof stringifyBigInts;
|
|
559
|
-
declare const tools_d_toBigIntArray: typeof toBigIntArray;
|
|
560
|
-
declare const tools_d_toBytesLE: typeof toBytesLE;
|
|
561
|
-
declare const tools_d_toStringArray: typeof toStringArray;
|
|
562
|
-
declare const tools_d_uint8ArrayToHex: typeof uint8ArrayToHex;
|
|
563
|
-
declare const tools_d_unstringifyBigInts: typeof unstringifyBigInts;
|
|
564
|
-
declare namespace tools_d {
|
|
565
|
-
export { tools_d_HEAdd as HEAdd, tools_d_HEAddAll as HEAddAll, tools_d_HEDecrypt as HEDecrypt, tools_d_HEDecryptExternalSolver as HEDecryptExternalSolver, tools_d_HEDecryptSync as HEDecryptSync, tools_d_HEEncrypt as HEEncrypt, tools_d_HEEncryptFromPoint as HEEncryptFromPoint, tools_d_SNARK_FIELD_SIZE as SNARK_FIELD_SIZE, tools_d_SimpelElgamalDecrypt as SimpelElgamalDecrypt, tools_d_SimpelElgamalEncrypt as SimpelElgamalEncrypt, tools_d_babyJub as babyJub, tools_d_bigInt2Buffer as bigInt2Buffer, tools_d_buffer2HexString as buffer2HexString, tools_d_bufferToBigInt as bufferToBigInt, tools_d_combineChunksWithCarry as combineChunksWithCarry, tools_d_combineTwoPublicKeys as combineTwoPublicKeys, tools_d_combineTwoPublicKeysPlain as combineTwoPublicKeysPlain, tools_d_coordinatesToExtPoint as coordinatesToExtPoint, tools_d_coordinatesToExtPointBigint as coordinatesToExtPointBigint, tools_d_createNobleBlakeHash as createNobleBlakeHash, tools_d_decrypt as decrypt, tools_d_decryptAESBigInt as decryptAESBigInt, tools_d_decryptECCBabyJub as decryptECCBabyJub, tools_d_deriveHEKeyScalar as deriveHEKeyScalar, tools_d_deriveHEPublicKey as deriveHEPublicKey, tools_d_deriveSigningKeyScalar as deriveSigningKeyScalar, tools_d_deriveSigningPublicKey as deriveSigningPublicKey, tools_d_encrypt as encrypt, tools_d_encryptAESBigInt as encryptAESBigInt, tools_d_encryptECCBabyJub as encryptECCBabyJub, tools_d_encrypt_s as encrypt_s, tools_d_ffEncodedToBigInt as ffEncodedToBigInt, tools_d_formatPrivKeyForBabyJub as formatPrivKeyForBabyJub, tools_d_fromBytesLE as fromBytesLE, tools_d_genKeypair as genKeypair, tools_d_genPrivKey as genPrivKey, tools_d_genPubKey as genPubKey, tools_d_genRandomBabyJubValue as genRandomBabyJubValue, tools_d_genRandomSalt as genRandomSalt, tools_d_genSmallRandomBabyJubValue as genSmallRandomBabyJubValue, tools_d_generateNonces as generateNonces, tools_d_generateRandom240BitNumber as generateRandom240BitNumber, tools_d_generateRandom248BitNumber as generateRandom248BitNumber, tools_d_getSignalByName as getSignalByName, tools_d_hashCypherText as hashCypherText, tools_d_hashExtPoints as hashExtPoints, tools_d_hexString2Buffer as hexString2Buffer, tools_d_hexToSkBuffer as hexToSkBuffer, tools_d_normalizeSigningKeyMaterial as normalizeSigningKeyMaterial, tools_d_portableArgon2 as portableArgon2, tools_d_portableRandomBytes as portableRandomBytes, poseidonLite as poseidonTools, tools_d_privateScalarToPubKey as privateScalarToPubKey, tools_d_pruneBuffer as pruneBuffer, tools_d_pruneTo32Bits as pruneTo32Bits, tools_d_pruneTo64Bits as pruneTo64Bits, tools_d_prv2pub as prv2pub, tools_d_shrinkToBits as shrinkToBits, tools_d_splitLargeNumber as splitLargeNumber, tools_d_stringToCurve as stringToCurve, tools_d_stringifyBigInts as stringifyBigInts, tools_d_toBigIntArray as toBigIntArray, tools_d_toBytesLE as toBytesLE, tools_d_toStringArray as toStringArray, tools_d_uint8ArrayToHex as uint8ArrayToHex, tools_d_unstringifyBigInts as unstringifyBigInts };
|
|
566
|
-
export type { tools_d_BabyJubAffinePoint as BabyJubAffinePoint, tools_d_BabyJubExtPoint as BabyJubExtPoint, tools_d_Keypair as Keypair, tools_d_PrivKey as PrivKey, tools_d_PubKey as PubKey };
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* A [[HexString]] whose length is even, which ensures it is a valid
|
|
571
|
-
* representation of binary data.
|
|
572
|
-
*/
|
|
573
|
-
type DataHexString = string;
|
|
574
|
-
/**
|
|
575
|
-
* A string which is prefixed with ``0x`` and followed by any number
|
|
576
|
-
* of case-agnostic hexadecimal characters.
|
|
577
|
-
*
|
|
578
|
-
* It must match the regular expression ``/0x[0-9A-Fa-f]*\/``.
|
|
579
|
-
*/
|
|
580
|
-
type HexString$1 = string;
|
|
581
|
-
/**
|
|
582
|
-
* An object that can be used to represent binary data.
|
|
583
|
-
*/
|
|
584
|
-
type BytesLike = DataHexString | Uint8Array;
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Addresses are a fundamental part of interacting with Ethereum. They
|
|
588
|
-
* represent the global identity of Externally Owned Accounts (accounts
|
|
589
|
-
* backed by a private key) and contracts.
|
|
590
|
-
*
|
|
591
|
-
* The Ethereum Naming Service (ENS) provides an interconnected ecosystem
|
|
592
|
-
* of contracts, standards and libraries which enable looking up an
|
|
593
|
-
* address for an ENS name.
|
|
594
|
-
*
|
|
595
|
-
* These functions help convert between various formats, validate
|
|
596
|
-
* addresses and safely resolve ENS names.
|
|
597
|
-
*
|
|
598
|
-
* @_section: api/address:Addresses [about-addresses]
|
|
599
|
-
*/
|
|
600
|
-
/**
|
|
601
|
-
* An interface for objects which have an address, and can
|
|
602
|
-
* resolve it asyncronously.
|
|
603
|
-
*
|
|
604
|
-
* This allows objects such as [[Signer]] or [[Contract]] to
|
|
605
|
-
* be used most places an address can be, for example getting
|
|
606
|
-
* the [balance](Provider-getBalance).
|
|
607
|
-
*/
|
|
608
|
-
interface Addressable {
|
|
399
|
+
interface ContractRunner {
|
|
609
400
|
/**
|
|
610
|
-
*
|
|
401
|
+
* The provider used for necessary state querying operations.
|
|
402
|
+
*
|
|
403
|
+
* This can also point to the **ContractRunner** itself, in the
|
|
404
|
+
* case of an [[AbstractProvider]].
|
|
611
405
|
*/
|
|
612
|
-
|
|
406
|
+
provider: null | Provider;
|
|
407
|
+
/**
|
|
408
|
+
* Required to estimate gas.
|
|
409
|
+
*/
|
|
410
|
+
estimateGas?: (tx: TransactionRequest) => Promise<bigint>;
|
|
411
|
+
/**
|
|
412
|
+
* Required for pure, view or static calls to contracts.
|
|
413
|
+
*/
|
|
414
|
+
call?: (tx: TransactionRequest) => Promise<string>;
|
|
415
|
+
/**
|
|
416
|
+
* Required to support ENS names
|
|
417
|
+
*/
|
|
418
|
+
resolveName?: (name: string) => Promise<null | string>;
|
|
419
|
+
/**
|
|
420
|
+
* Required for state mutating calls
|
|
421
|
+
*/
|
|
422
|
+
sendTransaction?: (tx: TransactionRequest) => Promise<TransactionResponse>;
|
|
613
423
|
}
|
|
424
|
+
|
|
614
425
|
/**
|
|
615
|
-
*
|
|
616
|
-
*/
|
|
617
|
-
type AddressLike = string | Promise<string> | Addressable;
|
|
618
|
-
/**
|
|
619
|
-
* An interface for any object which can resolve an ENS name.
|
|
426
|
+
* A **NetworkPlugin** provides additional functionality on a [[Network]].
|
|
620
427
|
*/
|
|
621
|
-
|
|
428
|
+
declare class NetworkPlugin {
|
|
622
429
|
/**
|
|
623
|
-
*
|
|
430
|
+
* The name of the plugin.
|
|
624
431
|
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
* throw for names that are unconfigured.
|
|
432
|
+
* It is recommended to use reverse-domain-notation, which permits
|
|
433
|
+
* unique names with a known authority as well as hierarchal entries.
|
|
628
434
|
*/
|
|
629
|
-
|
|
435
|
+
readonly name: string;
|
|
436
|
+
/**
|
|
437
|
+
* Creates a new **NetworkPlugin**.
|
|
438
|
+
*/
|
|
439
|
+
constructor(name: string);
|
|
440
|
+
/**
|
|
441
|
+
* Creates a copy of this plugin.
|
|
442
|
+
*/
|
|
443
|
+
clone(): NetworkPlugin;
|
|
630
444
|
}
|
|
631
445
|
|
|
632
446
|
/**
|
|
633
|
-
* A
|
|
447
|
+
* A **Network** encapsulates the various properties required to
|
|
448
|
+
* interact with a specific chain.
|
|
634
449
|
*
|
|
635
|
-
* @
|
|
450
|
+
* @_subsection: api/providers:Networks [networks]
|
|
636
451
|
*/
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
r: string;
|
|
651
|
-
s: string;
|
|
652
|
-
yParity: 0 | 1;
|
|
653
|
-
v?: BigNumberish;
|
|
654
|
-
yParityAndS?: string;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* A Networkish can be used to allude to a Network, by specifing:
|
|
455
|
+
* - a [[Network]] object
|
|
456
|
+
* - a well-known (or registered) network name
|
|
457
|
+
* - a well-known (or registered) chain ID
|
|
458
|
+
* - an object with sufficient details to describe a network
|
|
459
|
+
*/
|
|
460
|
+
type Networkish = Network | number | bigint | string | {
|
|
461
|
+
name?: string;
|
|
462
|
+
chainId?: number;
|
|
463
|
+
ensAddress?: string;
|
|
464
|
+
ensNetwork?: number;
|
|
655
465
|
};
|
|
656
466
|
/**
|
|
657
|
-
* A
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
* @_docloc: api/crypto:Signing
|
|
467
|
+
* A **Network** provides access to a chain's properties and allows
|
|
468
|
+
* for plug-ins to extend functionality.
|
|
661
469
|
*/
|
|
662
|
-
declare class
|
|
470
|
+
declare class Network {
|
|
663
471
|
#private;
|
|
664
472
|
/**
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
* This represents the ``x`` coordinate of a "reference" or
|
|
668
|
-
* challenge point, from which the ``y`` can be computed.
|
|
473
|
+
* Creates a new **Network** for %%name%% and %%chainId%%.
|
|
669
474
|
*/
|
|
670
|
-
|
|
671
|
-
set r(value: BytesLike);
|
|
475
|
+
constructor(name: string, chainId: BigNumberish);
|
|
672
476
|
/**
|
|
673
|
-
*
|
|
477
|
+
* Returns a JSON-compatible representation of a Network.
|
|
674
478
|
*/
|
|
675
|
-
|
|
676
|
-
set s(_value: BytesLike);
|
|
479
|
+
toJSON(): any;
|
|
677
480
|
/**
|
|
678
|
-
* The
|
|
679
|
-
*
|
|
680
|
-
* Since a given ``x`` value for ``r`` has two possible values for
|
|
681
|
-
* its correspondin ``y``, the ``v`` indicates which of the two ``y``
|
|
682
|
-
* values to use.
|
|
481
|
+
* The network common name.
|
|
683
482
|
*
|
|
684
|
-
*
|
|
685
|
-
*
|
|
483
|
+
* This is the canonical name, as networks migh have multiple
|
|
484
|
+
* names.
|
|
686
485
|
*/
|
|
687
|
-
get
|
|
688
|
-
set
|
|
486
|
+
get name(): string;
|
|
487
|
+
set name(value: string);
|
|
689
488
|
/**
|
|
690
|
-
* The
|
|
691
|
-
* transactions, this value is ``null``.
|
|
489
|
+
* The network chain ID.
|
|
692
490
|
*/
|
|
693
|
-
get
|
|
694
|
-
|
|
695
|
-
* The chain ID for EIP-155 legacy transactions. For non-legacy
|
|
696
|
-
* transactions, this value is ``null``.
|
|
697
|
-
*/
|
|
698
|
-
get legacyChainId(): null | bigint;
|
|
491
|
+
get chainId(): bigint;
|
|
492
|
+
set chainId(value: BigNumberish);
|
|
699
493
|
/**
|
|
700
|
-
*
|
|
494
|
+
* Returns true if %%other%% matches this network. Any chain ID
|
|
495
|
+
* must match, and if no chain ID is present, the name must match.
|
|
701
496
|
*
|
|
702
|
-
*
|
|
703
|
-
|
|
704
|
-
get yParity(): 0 | 1;
|
|
705
|
-
/**
|
|
706
|
-
* The [[link-eip-2098]] compact representation of the ``yParity``
|
|
707
|
-
* and ``s`` compacted into a single ``bytes32``.
|
|
708
|
-
*/
|
|
709
|
-
get yParityAndS(): string;
|
|
710
|
-
/**
|
|
711
|
-
* The [[link-eip-2098]] compact representation.
|
|
497
|
+
* This method does not currently check for additional properties,
|
|
498
|
+
* such as ENS address or plug-in compatibility.
|
|
712
499
|
*/
|
|
713
|
-
|
|
500
|
+
matches(other: Networkish): boolean;
|
|
714
501
|
/**
|
|
715
|
-
*
|
|
502
|
+
* Returns the list of plugins currently attached to this Network.
|
|
716
503
|
*/
|
|
717
|
-
get
|
|
504
|
+
get plugins(): Array<NetworkPlugin>;
|
|
718
505
|
/**
|
|
719
|
-
*
|
|
506
|
+
* Attach a new %%plugin%% to this Network. The network name
|
|
507
|
+
* must be unique, excluding any fragment.
|
|
720
508
|
*/
|
|
721
|
-
|
|
509
|
+
attachPlugin(plugin: NetworkPlugin): this;
|
|
722
510
|
/**
|
|
723
|
-
*
|
|
511
|
+
* Return the plugin, if any, matching %%name%% exactly. Plugins
|
|
512
|
+
* with fragments will not be returned unless %%name%% includes
|
|
513
|
+
* a fragment.
|
|
724
514
|
*/
|
|
725
|
-
|
|
515
|
+
getPlugin<T extends NetworkPlugin = NetworkPlugin>(name: string): null | T;
|
|
726
516
|
/**
|
|
727
|
-
*
|
|
517
|
+
* Gets a list of all plugins that match %%name%%, with otr without
|
|
518
|
+
* a fragment.
|
|
728
519
|
*/
|
|
729
|
-
|
|
520
|
+
getPlugins<T extends NetworkPlugin = NetworkPlugin>(basename: string): Array<T>;
|
|
730
521
|
/**
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
* @example:
|
|
734
|
-
* Signature.getChainId(45)
|
|
735
|
-
* //_result:
|
|
736
|
-
*
|
|
737
|
-
* Signature.getChainId(46)
|
|
738
|
-
* //_result:
|
|
522
|
+
* Create a copy of this Network.
|
|
739
523
|
*/
|
|
740
|
-
|
|
524
|
+
clone(): Network;
|
|
741
525
|
/**
|
|
742
|
-
* Compute the
|
|
743
|
-
*
|
|
744
|
-
* Legacy transactions which use [[link-eip-155]] hijack the ``v``
|
|
745
|
-
* property to include the chain ID.
|
|
746
|
-
*
|
|
747
|
-
* @example:
|
|
748
|
-
* Signature.getChainIdV(5, 27)
|
|
749
|
-
* //_result:
|
|
750
|
-
*
|
|
751
|
-
* Signature.getChainIdV(5, 28)
|
|
752
|
-
* //_result:
|
|
526
|
+
* Compute the intrinsic gas required for a transaction.
|
|
753
527
|
*
|
|
528
|
+
* A GasCostPlugin can be attached to override the default
|
|
529
|
+
* values.
|
|
754
530
|
*/
|
|
755
|
-
|
|
531
|
+
computeIntrinsicGas(tx: TransactionLike): number;
|
|
756
532
|
/**
|
|
757
|
-
*
|
|
758
|
-
* a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
|
|
759
|
-
*
|
|
760
|
-
* @example:
|
|
761
|
-
* // The values 0 and 1 imply v is actually yParity
|
|
762
|
-
* Signature.getNormalizedV(0)
|
|
763
|
-
* //_result:
|
|
764
|
-
*
|
|
765
|
-
* // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
|
|
766
|
-
* Signature.getNormalizedV(27)
|
|
767
|
-
* //_result:
|
|
768
|
-
*
|
|
769
|
-
* // Legacy EIP-155 transaction (i.e. >= 35)
|
|
770
|
-
* Signature.getNormalizedV(46)
|
|
771
|
-
* //_result:
|
|
772
|
-
*
|
|
773
|
-
* // Invalid values throw
|
|
774
|
-
* Signature.getNormalizedV(5)
|
|
775
|
-
* //_error:
|
|
533
|
+
* Returns a new Network for the %%network%% name or chainId.
|
|
776
534
|
*/
|
|
777
|
-
static
|
|
535
|
+
static from(network?: Networkish): Network;
|
|
778
536
|
/**
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
* If no %%sig%% is provided, a new [[Signature]] is created
|
|
782
|
-
* with default values.
|
|
783
|
-
*
|
|
784
|
-
* If %%sig%% is a string, it is parsed.
|
|
537
|
+
* Register %%nameOrChainId%% with a function which returns
|
|
538
|
+
* an instance of a Network representing that chain.
|
|
785
539
|
*/
|
|
786
|
-
static
|
|
540
|
+
static register(nameOrChainId: string | number | bigint, networkFunc: () => Network): void;
|
|
787
541
|
}
|
|
788
542
|
|
|
789
543
|
/**
|
|
790
|
-
*
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
* Any type that can be used where a big number is needed.
|
|
544
|
+
* About provider formatting?
|
|
545
|
+
*
|
|
546
|
+
* @_section: api/providers/formatting:Formatting [provider-formatting]
|
|
795
547
|
*/
|
|
796
|
-
type BigNumberish = string | Numeric;
|
|
797
548
|
|
|
798
549
|
/**
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
* a transaction.
|
|
550
|
+
* a **BlockParams** encodes the minimal required properties for a
|
|
551
|
+
* formatted block.
|
|
802
552
|
*/
|
|
803
|
-
interface
|
|
553
|
+
interface BlockParams {
|
|
804
554
|
/**
|
|
805
|
-
* The
|
|
555
|
+
* The block hash.
|
|
806
556
|
*/
|
|
807
|
-
|
|
557
|
+
hash?: null | string;
|
|
808
558
|
/**
|
|
809
|
-
* The
|
|
559
|
+
* The block number.
|
|
810
560
|
*/
|
|
811
|
-
|
|
561
|
+
number: number;
|
|
812
562
|
/**
|
|
813
|
-
* The
|
|
563
|
+
* The timestamp for this block, which is the number of seconds
|
|
564
|
+
* since epoch that this block was included.
|
|
814
565
|
*/
|
|
815
|
-
|
|
566
|
+
timestamp: number;
|
|
816
567
|
/**
|
|
817
|
-
* The
|
|
568
|
+
* The hash of the previous block in the blockchain. The genesis block
|
|
569
|
+
* has the parentHash of the [[ZeroHash]].
|
|
818
570
|
*/
|
|
819
|
-
|
|
571
|
+
parentHash: string;
|
|
820
572
|
/**
|
|
821
|
-
* The
|
|
573
|
+
* The hash tree root of the parent beacon block for the given
|
|
574
|
+
* execution block. See [[link-eip-4788]].
|
|
822
575
|
*/
|
|
823
|
-
|
|
576
|
+
parentBeaconBlockRoot?: null | string;
|
|
824
577
|
/**
|
|
825
|
-
*
|
|
578
|
+
* A random sequence provided during the mining process for
|
|
579
|
+
* proof-of-work networks.
|
|
826
580
|
*/
|
|
827
|
-
|
|
581
|
+
nonce: string;
|
|
828
582
|
/**
|
|
829
|
-
*
|
|
583
|
+
* For proof-of-work networks, the difficulty target is used to
|
|
584
|
+
* adjust the difficulty in mining to ensure an expected block rate.
|
|
830
585
|
*/
|
|
831
|
-
|
|
586
|
+
difficulty: bigint;
|
|
832
587
|
/**
|
|
833
|
-
* The maximum
|
|
588
|
+
* The maximum amount of gas a block can consume.
|
|
834
589
|
*/
|
|
835
|
-
|
|
590
|
+
gasLimit: bigint;
|
|
836
591
|
/**
|
|
837
|
-
* The
|
|
592
|
+
* The amount of gas a block consumed.
|
|
838
593
|
*/
|
|
839
|
-
|
|
594
|
+
gasUsed: bigint;
|
|
840
595
|
/**
|
|
841
|
-
* The
|
|
596
|
+
* The total amount of BLOb gas consumed by transactions within
|
|
597
|
+
* the block. See [[link-eip4844].
|
|
842
598
|
*/
|
|
843
|
-
|
|
599
|
+
blobGasUsed?: null | bigint;
|
|
844
600
|
/**
|
|
845
|
-
* The
|
|
601
|
+
* The running total of BLOb gas consumed in excess of the target
|
|
602
|
+
* prior to the block. See [[link-eip-4844]].
|
|
846
603
|
*/
|
|
847
|
-
|
|
604
|
+
excessBlobGas?: null | bigint;
|
|
848
605
|
/**
|
|
849
|
-
* The
|
|
606
|
+
* The miner (or author) of a block.
|
|
850
607
|
*/
|
|
851
|
-
|
|
608
|
+
miner: string;
|
|
852
609
|
/**
|
|
853
|
-
* The
|
|
610
|
+
* The latest RANDAO mix of the post beacon state of
|
|
611
|
+
* the previous block.
|
|
854
612
|
*/
|
|
855
|
-
|
|
613
|
+
prevRandao?: null | string;
|
|
856
614
|
/**
|
|
857
|
-
*
|
|
615
|
+
* Additional data the miner choose to include.
|
|
858
616
|
*/
|
|
859
|
-
|
|
617
|
+
extraData: string;
|
|
860
618
|
/**
|
|
861
|
-
* The
|
|
619
|
+
* The protocol-defined base fee per gas in an [[link-eip-1559]]
|
|
620
|
+
* block.
|
|
862
621
|
*/
|
|
863
|
-
|
|
622
|
+
baseFeePerGas: null | bigint;
|
|
864
623
|
/**
|
|
865
|
-
* The
|
|
624
|
+
* The root hash for the global state after applying changes
|
|
625
|
+
* in this block.
|
|
866
626
|
*/
|
|
867
|
-
|
|
627
|
+
stateRoot?: null | string;
|
|
868
628
|
/**
|
|
869
|
-
* The
|
|
629
|
+
* The hash of the transaction receipts trie.
|
|
870
630
|
*/
|
|
871
|
-
|
|
631
|
+
receiptsRoot?: null | string;
|
|
872
632
|
/**
|
|
873
|
-
*
|
|
874
|
-
* proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]).
|
|
875
|
-
*
|
|
876
|
-
* This is generally ``null``, unless you are creating BLOb
|
|
877
|
-
* transactions.
|
|
633
|
+
* The list of transactions in the block.
|
|
878
634
|
*/
|
|
879
|
-
|
|
635
|
+
transactions: ReadonlyArray<string | TransactionResponseParams>;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* a **LogParams** encodes the minimal required properties for a
|
|
639
|
+
* formatted log.
|
|
640
|
+
*/
|
|
641
|
+
interface LogParams {
|
|
880
642
|
/**
|
|
881
|
-
* The
|
|
643
|
+
* The transaction hash for the transaxction the log occurred in.
|
|
882
644
|
*/
|
|
883
|
-
|
|
645
|
+
transactionHash: string;
|
|
646
|
+
/**
|
|
647
|
+
* The block hash of the block that included the transaction for this
|
|
648
|
+
* log.
|
|
649
|
+
*/
|
|
650
|
+
blockHash: string;
|
|
651
|
+
/**
|
|
652
|
+
* The block number of the block that included the transaction for this
|
|
653
|
+
* log.
|
|
654
|
+
*/
|
|
655
|
+
blockNumber: number;
|
|
656
|
+
/**
|
|
657
|
+
* Whether this log was removed due to the transaction it was included
|
|
658
|
+
* in being removed dur to an orphaned block.
|
|
659
|
+
*/
|
|
660
|
+
removed: boolean;
|
|
661
|
+
/**
|
|
662
|
+
* The address of the contract that emitted this log.
|
|
663
|
+
*/
|
|
664
|
+
address: string;
|
|
665
|
+
/**
|
|
666
|
+
* The data emitted with this log.
|
|
667
|
+
*/
|
|
668
|
+
data: string;
|
|
669
|
+
/**
|
|
670
|
+
* The topics emitted with this log.
|
|
671
|
+
*/
|
|
672
|
+
topics: ReadonlyArray<string>;
|
|
673
|
+
/**
|
|
674
|
+
* The index of this log.
|
|
675
|
+
*/
|
|
676
|
+
index: number;
|
|
677
|
+
/**
|
|
678
|
+
* The transaction index of this log.
|
|
679
|
+
*/
|
|
680
|
+
transactionIndex: number;
|
|
884
681
|
}
|
|
885
682
|
/**
|
|
886
|
-
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
* It may have had its commitment and proof already provided
|
|
890
|
-
* or rely on an attached [[KzgLibrary]] to compute them.
|
|
683
|
+
* a **TransactionReceiptParams** encodes the minimal required properties
|
|
684
|
+
* for a formatted transaction receipt.
|
|
891
685
|
*/
|
|
892
|
-
|
|
893
|
-
data: BytesLike;
|
|
894
|
-
proof: BytesLike;
|
|
895
|
-
commitment: BytesLike;
|
|
896
|
-
};
|
|
897
|
-
/**
|
|
898
|
-
* A KZG Library with the necessary functions to compute
|
|
899
|
-
* BLOb commitments and proofs.
|
|
900
|
-
*/
|
|
901
|
-
interface KzgLibrary {
|
|
902
|
-
blobToKzgCommitment: (blob: Uint8Array) => Uint8Array;
|
|
903
|
-
computeBlobKzgProof: (blob: Uint8Array, commitment: Uint8Array) => Uint8Array;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* A KZG Library with any of the various API configurations.
|
|
907
|
-
* As the library is still experimental and the API is not
|
|
908
|
-
* stable, depending on the version used the method names and
|
|
909
|
-
* signatures are still in flux.
|
|
910
|
-
*
|
|
911
|
-
* This allows any of the versions to be passed into Transaction
|
|
912
|
-
* while providing a stable external API.
|
|
913
|
-
*/
|
|
914
|
-
type KzgLibraryLike = KzgLibrary | {
|
|
915
|
-
blobToKZGCommitment: (blob: string) => string;
|
|
916
|
-
computeBlobKZGProof: (blob: string, commitment: string) => string;
|
|
917
|
-
} | {
|
|
918
|
-
blobToKzgCommitment: (blob: string) => string | Uint8Array;
|
|
919
|
-
computeBlobProof: (blob: string, commitment: string) => string | Uint8Array;
|
|
920
|
-
};
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Each state-changing operation on Ethereum requires a transaction.
|
|
924
|
-
*
|
|
925
|
-
* @_section api/transaction:Transactions [about-transactions]
|
|
926
|
-
*/
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* A single [[AccessList]] entry of storage keys (slots) for an address.
|
|
930
|
-
*/
|
|
931
|
-
type AccessListEntry = {
|
|
932
|
-
address: string;
|
|
933
|
-
storageKeys: Array<string>;
|
|
934
|
-
};
|
|
935
|
-
/**
|
|
936
|
-
* An ordered collection of [[AccessList]] entries.
|
|
937
|
-
*/
|
|
938
|
-
type AccessList = Array<AccessListEntry>;
|
|
939
|
-
/**
|
|
940
|
-
* Any ethers-supported access list structure.
|
|
941
|
-
*/
|
|
942
|
-
type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
|
|
943
|
-
interface Authorization {
|
|
944
|
-
address: string;
|
|
945
|
-
nonce: bigint;
|
|
946
|
-
chainId: bigint;
|
|
947
|
-
signature: Signature;
|
|
948
|
-
}
|
|
949
|
-
type AuthorizationLike = {
|
|
950
|
-
address: string;
|
|
951
|
-
nonce: BigNumberish;
|
|
952
|
-
chainId: BigNumberish;
|
|
953
|
-
signature: SignatureLike;
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
/**
|
|
957
|
-
* A **ContractRunner** is a generic interface which defines an object
|
|
958
|
-
* capable of interacting with a Contract on the network.
|
|
959
|
-
*
|
|
960
|
-
* The more operations supported, the more utility it is capable of.
|
|
961
|
-
*
|
|
962
|
-
* The most common ContractRunners are [Providers](Provider) which enable
|
|
963
|
-
* read-only access and [Signers](Signer) which enable write-access.
|
|
964
|
-
*/
|
|
965
|
-
interface ContractRunner {
|
|
966
|
-
/**
|
|
967
|
-
* The provider used for necessary state querying operations.
|
|
968
|
-
*
|
|
969
|
-
* This can also point to the **ContractRunner** itself, in the
|
|
970
|
-
* case of an [[AbstractProvider]].
|
|
971
|
-
*/
|
|
972
|
-
provider: null | Provider;
|
|
973
|
-
/**
|
|
974
|
-
* Required to estimate gas.
|
|
975
|
-
*/
|
|
976
|
-
estimateGas?: (tx: TransactionRequest) => Promise<bigint>;
|
|
977
|
-
/**
|
|
978
|
-
* Required for pure, view or static calls to contracts.
|
|
979
|
-
*/
|
|
980
|
-
call?: (tx: TransactionRequest) => Promise<string>;
|
|
686
|
+
interface TransactionReceiptParams {
|
|
981
687
|
/**
|
|
982
|
-
*
|
|
688
|
+
* The target of the transaction. If null, the transaction was trying
|
|
689
|
+
* to deploy a transaction with the ``data`` as the initi=code.
|
|
983
690
|
*/
|
|
984
|
-
|
|
691
|
+
to: null | string;
|
|
985
692
|
/**
|
|
986
|
-
*
|
|
693
|
+
* The sender of the transaction.
|
|
987
694
|
*/
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
/**
|
|
992
|
-
* A **NetworkPlugin** provides additional functionality on a [[Network]].
|
|
993
|
-
*/
|
|
994
|
-
declare class NetworkPlugin {
|
|
695
|
+
from: string;
|
|
995
696
|
/**
|
|
996
|
-
*
|
|
997
|
-
*
|
|
998
|
-
*
|
|
999
|
-
* unique names with a known authority as well as hierarchal entries.
|
|
697
|
+
* If the transaction was directly deploying a contract, the [[to]]
|
|
698
|
+
* will be null, the ``data`` will be initcode and if successful, this
|
|
699
|
+
* will be the address of the contract deployed.
|
|
1000
700
|
*/
|
|
1001
|
-
|
|
701
|
+
contractAddress: null | string;
|
|
1002
702
|
/**
|
|
1003
|
-
*
|
|
703
|
+
* The transaction hash.
|
|
1004
704
|
*/
|
|
1005
|
-
|
|
705
|
+
hash: string;
|
|
1006
706
|
/**
|
|
1007
|
-
*
|
|
707
|
+
* The transaction index.
|
|
1008
708
|
*/
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
/**
|
|
1013
|
-
* A **Network** encapsulates the various properties required to
|
|
1014
|
-
* interact with a specific chain.
|
|
1015
|
-
*
|
|
1016
|
-
* @_subsection: api/providers:Networks [networks]
|
|
1017
|
-
*/
|
|
1018
|
-
|
|
1019
|
-
/**
|
|
1020
|
-
* A Networkish can be used to allude to a Network, by specifing:
|
|
1021
|
-
* - a [[Network]] object
|
|
1022
|
-
* - a well-known (or registered) network name
|
|
1023
|
-
* - a well-known (or registered) chain ID
|
|
1024
|
-
* - an object with sufficient details to describe a network
|
|
1025
|
-
*/
|
|
1026
|
-
type Networkish = Network | number | bigint | string | {
|
|
1027
|
-
name?: string;
|
|
1028
|
-
chainId?: number;
|
|
1029
|
-
ensAddress?: string;
|
|
1030
|
-
ensNetwork?: number;
|
|
1031
|
-
};
|
|
1032
|
-
/**
|
|
1033
|
-
* A **Network** provides access to a chain's properties and allows
|
|
1034
|
-
* for plug-ins to extend functionality.
|
|
1035
|
-
*/
|
|
1036
|
-
declare class Network {
|
|
1037
|
-
#private;
|
|
709
|
+
index: number;
|
|
1038
710
|
/**
|
|
1039
|
-
*
|
|
711
|
+
* The block hash of the block that included this transaction.
|
|
1040
712
|
*/
|
|
1041
|
-
|
|
713
|
+
blockHash: string;
|
|
1042
714
|
/**
|
|
1043
|
-
*
|
|
715
|
+
* The block number of the block that included this transaction.
|
|
1044
716
|
*/
|
|
1045
|
-
|
|
717
|
+
blockNumber: number;
|
|
1046
718
|
/**
|
|
1047
|
-
* The
|
|
1048
|
-
*
|
|
1049
|
-
* This is the canonical name, as networks migh have multiple
|
|
1050
|
-
* names.
|
|
719
|
+
* The bloom filter for the logs emitted during execution of this
|
|
720
|
+
* transaction.
|
|
1051
721
|
*/
|
|
1052
|
-
|
|
1053
|
-
set name(value: string);
|
|
722
|
+
logsBloom: string;
|
|
1054
723
|
/**
|
|
1055
|
-
* The
|
|
724
|
+
* The logs emitted during the execution of this transaction.
|
|
1056
725
|
*/
|
|
1057
|
-
|
|
1058
|
-
set chainId(value: BigNumberish);
|
|
726
|
+
logs: ReadonlyArray<LogParams>;
|
|
1059
727
|
/**
|
|
1060
|
-
*
|
|
1061
|
-
* must match, and if no chain ID is present, the name must match.
|
|
1062
|
-
*
|
|
1063
|
-
* This method does not currently check for additional properties,
|
|
1064
|
-
* such as ENS address or plug-in compatibility.
|
|
728
|
+
* The amount of gas consumed executing this transaciton.
|
|
1065
729
|
*/
|
|
1066
|
-
|
|
730
|
+
gasUsed: bigint;
|
|
1067
731
|
/**
|
|
1068
|
-
*
|
|
732
|
+
* The amount of BLOb gas used. See [[link-eip-4844]].
|
|
1069
733
|
*/
|
|
1070
|
-
|
|
734
|
+
blobGasUsed?: null | bigint;
|
|
1071
735
|
/**
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
736
|
+
* The total amount of gas consumed during the entire block up to
|
|
737
|
+
* and including this transaction.
|
|
1074
738
|
*/
|
|
1075
|
-
|
|
739
|
+
cumulativeGasUsed: bigint;
|
|
1076
740
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
* with fragments will not be returned unless %%name%% includes
|
|
1079
|
-
* a fragment.
|
|
741
|
+
* The actual gas price per gas charged for this transaction.
|
|
1080
742
|
*/
|
|
1081
|
-
|
|
743
|
+
gasPrice?: null | bigint;
|
|
1082
744
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
* a fragment.
|
|
745
|
+
* The actual BLOb gas price that was charged. See [[link-eip-4844]].
|
|
1085
746
|
*/
|
|
1086
|
-
|
|
747
|
+
blobGasPrice?: null | bigint;
|
|
1087
748
|
/**
|
|
1088
|
-
*
|
|
749
|
+
* The actual gas price per gas charged for this transaction.
|
|
1089
750
|
*/
|
|
1090
|
-
|
|
751
|
+
effectiveGasPrice?: null | bigint;
|
|
1091
752
|
/**
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1094
|
-
* A GasCostPlugin can be attached to override the default
|
|
1095
|
-
* values.
|
|
753
|
+
* The [[link-eip-2718]] envelope type.
|
|
1096
754
|
*/
|
|
1097
|
-
|
|
755
|
+
type: number;
|
|
1098
756
|
/**
|
|
1099
|
-
*
|
|
757
|
+
* The status of the transaction execution. If ``1`` then the
|
|
758
|
+
* the transaction returned success, if ``0`` then the transaction
|
|
759
|
+
* was reverted. For pre-byzantium blocks, this is usually null, but
|
|
760
|
+
* some nodes may have backfilled this data.
|
|
1100
761
|
*/
|
|
1101
|
-
|
|
762
|
+
status: null | number;
|
|
1102
763
|
/**
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
764
|
+
* The root of this transaction in a pre-bazatium block. In
|
|
765
|
+
* post-byzantium blocks this is null.
|
|
1105
766
|
*/
|
|
1106
|
-
|
|
767
|
+
root: null | string;
|
|
1107
768
|
}
|
|
1108
|
-
|
|
1109
|
-
/**
|
|
1110
|
-
* About provider formatting?
|
|
1111
|
-
*
|
|
1112
|
-
* @_section: api/providers/formatting:Formatting [provider-formatting]
|
|
1113
|
-
*/
|
|
1114
|
-
|
|
1115
769
|
/**
|
|
1116
|
-
* a **
|
|
1117
|
-
* formatted
|
|
770
|
+
* a **TransactionResponseParams** encodes the minimal required properties
|
|
771
|
+
* for a formatted transaction response.
|
|
1118
772
|
*/
|
|
1119
|
-
interface
|
|
773
|
+
interface TransactionResponseParams {
|
|
1120
774
|
/**
|
|
1121
|
-
* The block
|
|
775
|
+
* The block number of the block that included this transaction.
|
|
1122
776
|
*/
|
|
1123
|
-
|
|
777
|
+
blockNumber: null | number;
|
|
1124
778
|
/**
|
|
1125
|
-
* The block
|
|
779
|
+
* The block hash of the block that included this transaction.
|
|
1126
780
|
*/
|
|
1127
|
-
|
|
781
|
+
blockHash: null | string;
|
|
1128
782
|
/**
|
|
1129
|
-
* The
|
|
1130
|
-
* since epoch that this block was included.
|
|
783
|
+
* The transaction hash.
|
|
1131
784
|
*/
|
|
1132
|
-
|
|
785
|
+
hash: string;
|
|
1133
786
|
/**
|
|
1134
|
-
* The
|
|
1135
|
-
* has the parentHash of the [[ZeroHash]].
|
|
787
|
+
* The transaction index.
|
|
1136
788
|
*/
|
|
1137
|
-
|
|
1138
|
-
/**
|
|
1139
|
-
* The hash tree root of the parent beacon block for the given
|
|
1140
|
-
* execution block. See [[link-eip-4788]].
|
|
1141
|
-
*/
|
|
1142
|
-
parentBeaconBlockRoot?: null | string;
|
|
1143
|
-
/**
|
|
1144
|
-
* A random sequence provided during the mining process for
|
|
1145
|
-
* proof-of-work networks.
|
|
1146
|
-
*/
|
|
1147
|
-
nonce: string;
|
|
1148
|
-
/**
|
|
1149
|
-
* For proof-of-work networks, the difficulty target is used to
|
|
1150
|
-
* adjust the difficulty in mining to ensure an expected block rate.
|
|
1151
|
-
*/
|
|
1152
|
-
difficulty: bigint;
|
|
1153
|
-
/**
|
|
1154
|
-
* The maximum amount of gas a block can consume.
|
|
1155
|
-
*/
|
|
1156
|
-
gasLimit: bigint;
|
|
1157
|
-
/**
|
|
1158
|
-
* The amount of gas a block consumed.
|
|
1159
|
-
*/
|
|
1160
|
-
gasUsed: bigint;
|
|
1161
|
-
/**
|
|
1162
|
-
* The total amount of BLOb gas consumed by transactions within
|
|
1163
|
-
* the block. See [[link-eip4844].
|
|
1164
|
-
*/
|
|
1165
|
-
blobGasUsed?: null | bigint;
|
|
1166
|
-
/**
|
|
1167
|
-
* The running total of BLOb gas consumed in excess of the target
|
|
1168
|
-
* prior to the block. See [[link-eip-4844]].
|
|
1169
|
-
*/
|
|
1170
|
-
excessBlobGas?: null | bigint;
|
|
1171
|
-
/**
|
|
1172
|
-
* The miner (or author) of a block.
|
|
1173
|
-
*/
|
|
1174
|
-
miner: string;
|
|
1175
|
-
/**
|
|
1176
|
-
* The latest RANDAO mix of the post beacon state of
|
|
1177
|
-
* the previous block.
|
|
1178
|
-
*/
|
|
1179
|
-
prevRandao?: null | string;
|
|
1180
|
-
/**
|
|
1181
|
-
* Additional data the miner choose to include.
|
|
1182
|
-
*/
|
|
1183
|
-
extraData: string;
|
|
1184
|
-
/**
|
|
1185
|
-
* The protocol-defined base fee per gas in an [[link-eip-1559]]
|
|
1186
|
-
* block.
|
|
1187
|
-
*/
|
|
1188
|
-
baseFeePerGas: null | bigint;
|
|
1189
|
-
/**
|
|
1190
|
-
* The root hash for the global state after applying changes
|
|
1191
|
-
* in this block.
|
|
1192
|
-
*/
|
|
1193
|
-
stateRoot?: null | string;
|
|
1194
|
-
/**
|
|
1195
|
-
* The hash of the transaction receipts trie.
|
|
1196
|
-
*/
|
|
1197
|
-
receiptsRoot?: null | string;
|
|
1198
|
-
/**
|
|
1199
|
-
* The list of transactions in the block.
|
|
1200
|
-
*/
|
|
1201
|
-
transactions: ReadonlyArray<string | TransactionResponseParams>;
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* a **LogParams** encodes the minimal required properties for a
|
|
1205
|
-
* formatted log.
|
|
1206
|
-
*/
|
|
1207
|
-
interface LogParams {
|
|
1208
|
-
/**
|
|
1209
|
-
* The transaction hash for the transaxction the log occurred in.
|
|
1210
|
-
*/
|
|
1211
|
-
transactionHash: string;
|
|
1212
|
-
/**
|
|
1213
|
-
* The block hash of the block that included the transaction for this
|
|
1214
|
-
* log.
|
|
1215
|
-
*/
|
|
1216
|
-
blockHash: string;
|
|
1217
|
-
/**
|
|
1218
|
-
* The block number of the block that included the transaction for this
|
|
1219
|
-
* log.
|
|
1220
|
-
*/
|
|
1221
|
-
blockNumber: number;
|
|
1222
|
-
/**
|
|
1223
|
-
* Whether this log was removed due to the transaction it was included
|
|
1224
|
-
* in being removed dur to an orphaned block.
|
|
1225
|
-
*/
|
|
1226
|
-
removed: boolean;
|
|
1227
|
-
/**
|
|
1228
|
-
* The address of the contract that emitted this log.
|
|
1229
|
-
*/
|
|
1230
|
-
address: string;
|
|
1231
|
-
/**
|
|
1232
|
-
* The data emitted with this log.
|
|
1233
|
-
*/
|
|
1234
|
-
data: string;
|
|
1235
|
-
/**
|
|
1236
|
-
* The topics emitted with this log.
|
|
1237
|
-
*/
|
|
1238
|
-
topics: ReadonlyArray<string>;
|
|
1239
|
-
/**
|
|
1240
|
-
* The index of this log.
|
|
1241
|
-
*/
|
|
1242
|
-
index: number;
|
|
1243
|
-
/**
|
|
1244
|
-
* The transaction index of this log.
|
|
1245
|
-
*/
|
|
1246
|
-
transactionIndex: number;
|
|
1247
|
-
}
|
|
1248
|
-
/**
|
|
1249
|
-
* a **TransactionReceiptParams** encodes the minimal required properties
|
|
1250
|
-
* for a formatted transaction receipt.
|
|
1251
|
-
*/
|
|
1252
|
-
interface TransactionReceiptParams {
|
|
1253
|
-
/**
|
|
1254
|
-
* The target of the transaction. If null, the transaction was trying
|
|
1255
|
-
* to deploy a transaction with the ``data`` as the initi=code.
|
|
1256
|
-
*/
|
|
1257
|
-
to: null | string;
|
|
1258
|
-
/**
|
|
1259
|
-
* The sender of the transaction.
|
|
1260
|
-
*/
|
|
1261
|
-
from: string;
|
|
1262
|
-
/**
|
|
1263
|
-
* If the transaction was directly deploying a contract, the [[to]]
|
|
1264
|
-
* will be null, the ``data`` will be initcode and if successful, this
|
|
1265
|
-
* will be the address of the contract deployed.
|
|
1266
|
-
*/
|
|
1267
|
-
contractAddress: null | string;
|
|
1268
|
-
/**
|
|
1269
|
-
* The transaction hash.
|
|
1270
|
-
*/
|
|
1271
|
-
hash: string;
|
|
1272
|
-
/**
|
|
1273
|
-
* The transaction index.
|
|
1274
|
-
*/
|
|
1275
|
-
index: number;
|
|
1276
|
-
/**
|
|
1277
|
-
* The block hash of the block that included this transaction.
|
|
1278
|
-
*/
|
|
1279
|
-
blockHash: string;
|
|
1280
|
-
/**
|
|
1281
|
-
* The block number of the block that included this transaction.
|
|
1282
|
-
*/
|
|
1283
|
-
blockNumber: number;
|
|
1284
|
-
/**
|
|
1285
|
-
* The bloom filter for the logs emitted during execution of this
|
|
1286
|
-
* transaction.
|
|
1287
|
-
*/
|
|
1288
|
-
logsBloom: string;
|
|
1289
|
-
/**
|
|
1290
|
-
* The logs emitted during the execution of this transaction.
|
|
1291
|
-
*/
|
|
1292
|
-
logs: ReadonlyArray<LogParams>;
|
|
1293
|
-
/**
|
|
1294
|
-
* The amount of gas consumed executing this transaciton.
|
|
1295
|
-
*/
|
|
1296
|
-
gasUsed: bigint;
|
|
1297
|
-
/**
|
|
1298
|
-
* The amount of BLOb gas used. See [[link-eip-4844]].
|
|
1299
|
-
*/
|
|
1300
|
-
blobGasUsed?: null | bigint;
|
|
1301
|
-
/**
|
|
1302
|
-
* The total amount of gas consumed during the entire block up to
|
|
1303
|
-
* and including this transaction.
|
|
1304
|
-
*/
|
|
1305
|
-
cumulativeGasUsed: bigint;
|
|
1306
|
-
/**
|
|
1307
|
-
* The actual gas price per gas charged for this transaction.
|
|
1308
|
-
*/
|
|
1309
|
-
gasPrice?: null | bigint;
|
|
1310
|
-
/**
|
|
1311
|
-
* The actual BLOb gas price that was charged. See [[link-eip-4844]].
|
|
1312
|
-
*/
|
|
1313
|
-
blobGasPrice?: null | bigint;
|
|
1314
|
-
/**
|
|
1315
|
-
* The actual gas price per gas charged for this transaction.
|
|
1316
|
-
*/
|
|
1317
|
-
effectiveGasPrice?: null | bigint;
|
|
1318
|
-
/**
|
|
1319
|
-
* The [[link-eip-2718]] envelope type.
|
|
1320
|
-
*/
|
|
1321
|
-
type: number;
|
|
1322
|
-
/**
|
|
1323
|
-
* The status of the transaction execution. If ``1`` then the
|
|
1324
|
-
* the transaction returned success, if ``0`` then the transaction
|
|
1325
|
-
* was reverted. For pre-byzantium blocks, this is usually null, but
|
|
1326
|
-
* some nodes may have backfilled this data.
|
|
1327
|
-
*/
|
|
1328
|
-
status: null | number;
|
|
1329
|
-
/**
|
|
1330
|
-
* The root of this transaction in a pre-bazatium block. In
|
|
1331
|
-
* post-byzantium blocks this is null.
|
|
1332
|
-
*/
|
|
1333
|
-
root: null | string;
|
|
1334
|
-
}
|
|
1335
|
-
/**
|
|
1336
|
-
* a **TransactionResponseParams** encodes the minimal required properties
|
|
1337
|
-
* for a formatted transaction response.
|
|
1338
|
-
*/
|
|
1339
|
-
interface TransactionResponseParams {
|
|
1340
|
-
/**
|
|
1341
|
-
* The block number of the block that included this transaction.
|
|
1342
|
-
*/
|
|
1343
|
-
blockNumber: null | number;
|
|
1344
|
-
/**
|
|
1345
|
-
* The block hash of the block that included this transaction.
|
|
1346
|
-
*/
|
|
1347
|
-
blockHash: null | string;
|
|
1348
|
-
/**
|
|
1349
|
-
* The transaction hash.
|
|
1350
|
-
*/
|
|
1351
|
-
hash: string;
|
|
1352
|
-
/**
|
|
1353
|
-
* The transaction index.
|
|
1354
|
-
*/
|
|
1355
|
-
index: number;
|
|
789
|
+
index: number;
|
|
1356
790
|
/**
|
|
1357
791
|
* The [[link-eip-2718]] transaction type.
|
|
1358
792
|
*/
|
|
@@ -4999,52 +4433,6 @@ declare type TreeSlice = {
|
|
|
4999
4433
|
elements: Element[];
|
|
5000
4434
|
};
|
|
5001
4435
|
|
|
5002
|
-
declare function toPaddedHex(bn: bigint, length?: number): string;
|
|
5003
|
-
declare const ZERO = 7507787612525723758659662260399184323980001748885802124580171315331567144978n;
|
|
5004
|
-
declare const ZERO_KECCAK = "0x937759b0c00d3bc82439e3acdb505be98d7bca79f508bb77a8bfafc2666260a6";
|
|
5005
|
-
/**
|
|
5006
|
-
* The the MimC tree hash function,
|
|
5007
|
-
* If wanting to hash a single value set right to 0n
|
|
5008
|
-
* @param left
|
|
5009
|
-
* @param right
|
|
5010
|
-
* @returns
|
|
5011
|
-
*/
|
|
5012
|
-
declare var treeHasher: (left: any, right: any) => any;
|
|
5013
|
-
/**
|
|
5014
|
-
* Creates a merkle tree with the mimc hash function from circomlibjs
|
|
5015
|
-
* @param depth
|
|
5016
|
-
* @param leaves
|
|
5017
|
-
* @returns
|
|
5018
|
-
*/
|
|
5019
|
-
declare var keccakTreeHasher: (left: any, right: any) => any;
|
|
5020
|
-
declare function createMimcMerkelTree(depth: number, leaves: string[]): Promise<MerkleTree>;
|
|
5021
|
-
declare function createKeccakMerkelTree(depth: number, leaves: string[]): Promise<MerkleTree>;
|
|
5022
|
-
declare function createKeccakMerkelTreeSync(depth: number, leaves: string[]): MerkleTree;
|
|
5023
|
-
declare function signDataInsertRequestJWT(data: HexString$1[], global_tree_index: number, inserted_at: number, secret: Signer): Promise<string>;
|
|
5024
|
-
|
|
5025
|
-
declare const utils_d_ZERO: typeof ZERO;
|
|
5026
|
-
declare const utils_d_ZERO_KECCAK: typeof ZERO_KECCAK;
|
|
5027
|
-
declare const utils_d_createKeccakMerkelTree: typeof createKeccakMerkelTree;
|
|
5028
|
-
declare const utils_d_createKeccakMerkelTreeSync: typeof createKeccakMerkelTreeSync;
|
|
5029
|
-
declare const utils_d_createMimcMerkelTree: typeof createMimcMerkelTree;
|
|
5030
|
-
declare const utils_d_keccakTreeHasher: typeof keccakTreeHasher;
|
|
5031
|
-
declare const utils_d_signDataInsertRequestJWT: typeof signDataInsertRequestJWT;
|
|
5032
|
-
declare const utils_d_toPaddedHex: typeof toPaddedHex;
|
|
5033
|
-
declare const utils_d_treeHasher: typeof treeHasher;
|
|
5034
|
-
declare namespace utils_d {
|
|
5035
|
-
export {
|
|
5036
|
-
utils_d_ZERO as ZERO,
|
|
5037
|
-
utils_d_ZERO_KECCAK as ZERO_KECCAK,
|
|
5038
|
-
utils_d_createKeccakMerkelTree as createKeccakMerkelTree,
|
|
5039
|
-
utils_d_createKeccakMerkelTreeSync as createKeccakMerkelTreeSync,
|
|
5040
|
-
utils_d_createMimcMerkelTree as createMimcMerkelTree,
|
|
5041
|
-
utils_d_keccakTreeHasher as keccakTreeHasher,
|
|
5042
|
-
utils_d_signDataInsertRequestJWT as signDataInsertRequestJWT,
|
|
5043
|
-
utils_d_toPaddedHex as toPaddedHex,
|
|
5044
|
-
utils_d_treeHasher as treeHasher,
|
|
5045
|
-
};
|
|
5046
|
-
}
|
|
5047
|
-
|
|
5048
4436
|
interface ProofResult {
|
|
5049
4437
|
globalProof: ProofPath;
|
|
5050
4438
|
localProof: ProofPath;
|
|
@@ -5149,16 +4537,6 @@ type CompiledProof = {
|
|
|
5149
4537
|
validate_action: UnsealProofAction;
|
|
5150
4538
|
};
|
|
5151
4539
|
|
|
5152
|
-
type types_d$2_CompiledProof = CompiledProof;
|
|
5153
|
-
type types_d$2_Proof = Proof;
|
|
5154
|
-
type types_d$2_UnsealConditionProof = UnsealConditionProof;
|
|
5155
|
-
declare const types_d$2_UnsealConditionProof: typeof UnsealConditionProof;
|
|
5156
|
-
type types_d$2_UnsealConditionProofData = UnsealConditionProofData;
|
|
5157
|
-
declare namespace types_d$2 {
|
|
5158
|
-
export { types_d$2_UnsealConditionProof as UnsealConditionProof };
|
|
5159
|
-
export type { types_d$2_CompiledProof as CompiledProof, types_d$2_Proof as Proof, types_d$2_UnsealConditionProofData as UnsealConditionProofData };
|
|
5160
|
-
}
|
|
5161
|
-
|
|
5162
4540
|
declare abstract class ProofLibraryType {
|
|
5163
4541
|
standard: {
|
|
5164
4542
|
[key: string]: UnsealConditionProof;
|
|
@@ -5342,30 +4720,6 @@ declare abstract class UnsealConditionModule {
|
|
|
5342
4720
|
}, current_proof_depth: number, fork?: boolean): CompiledModule;
|
|
5343
4721
|
}
|
|
5344
4722
|
|
|
5345
|
-
type types_d$1_CompiledModule = CompiledModule;
|
|
5346
|
-
type types_d$1_IO = IO;
|
|
5347
|
-
type types_d$1_IOMap = IOMap;
|
|
5348
|
-
type types_d$1_IOType = IOType;
|
|
5349
|
-
type types_d$1_ModuleEdge = ModuleEdge;
|
|
5350
|
-
declare const types_d$1_ModuleEdge: typeof ModuleEdge;
|
|
5351
|
-
type types_d$1_ModuleEdgeInput = ModuleEdgeInput;
|
|
5352
|
-
declare const types_d$1_ModuleEdgeInput: typeof ModuleEdgeInput;
|
|
5353
|
-
type types_d$1_ModuleNode = ModuleNode;
|
|
5354
|
-
declare const types_d$1_ModuleNode: typeof ModuleNode;
|
|
5355
|
-
type types_d$1_ModuleOutput = ModuleOutput;
|
|
5356
|
-
type types_d$1_ModuleOutputMap = ModuleOutputMap;
|
|
5357
|
-
type types_d$1_ModuleProof = ModuleProof;
|
|
5358
|
-
type types_d$1_SignalEdge = SignalEdge;
|
|
5359
|
-
declare const types_d$1_SignalEdge: typeof SignalEdge;
|
|
5360
|
-
type types_d$1_UnsealConditionModule = UnsealConditionModule;
|
|
5361
|
-
declare const types_d$1_UnsealConditionModule: typeof UnsealConditionModule;
|
|
5362
|
-
type types_d$1_WrappedProof = WrappedProof;
|
|
5363
|
-
declare const types_d$1_WrappedProof: typeof WrappedProof;
|
|
5364
|
-
declare namespace types_d$1 {
|
|
5365
|
-
export { types_d$1_ModuleEdge as ModuleEdge, types_d$1_ModuleEdgeInput as ModuleEdgeInput, types_d$1_ModuleNode as ModuleNode, types_d$1_SignalEdge as SignalEdge, types_d$1_UnsealConditionModule as UnsealConditionModule, types_d$1_WrappedProof as WrappedProof };
|
|
5366
|
-
export type { types_d$1_CompiledModule as CompiledModule, types_d$1_IO as IO, types_d$1_IOMap as IOMap, types_d$1_IOType as IOType, types_d$1_ModuleOutput as ModuleOutput, types_d$1_ModuleOutputMap as ModuleOutputMap, types_d$1_ModuleProof as ModuleProof };
|
|
5367
|
-
}
|
|
5368
|
-
|
|
5369
4723
|
/**
|
|
5370
4724
|
* Simplest possible proof collection.
|
|
5371
4725
|
* Just proofs that a value is reference on chain.
|
|
@@ -5782,34 +5136,6 @@ declare class AddressMapWithDefault implements AddressMap {
|
|
|
5782
5136
|
getAddress(key: string): string;
|
|
5783
5137
|
}
|
|
5784
5138
|
|
|
5785
|
-
type types_d_AddressMap = AddressMap;
|
|
5786
|
-
type types_d_AddressMapWithDefault = AddressMapWithDefault;
|
|
5787
|
-
declare const types_d_AddressMapWithDefault: typeof AddressMapWithDefault;
|
|
5788
|
-
type types_d_BasicAddressMap = BasicAddressMap;
|
|
5789
|
-
declare const types_d_BasicAddressMap: typeof BasicAddressMap;
|
|
5790
|
-
type types_d_ChangedCallback = ChangedCallback;
|
|
5791
|
-
type types_d_ChangedType = ChangedType;
|
|
5792
|
-
declare const types_d_ChangedType: typeof ChangedType;
|
|
5793
|
-
type types_d_CollectionDataStream = CollectionDataStream;
|
|
5794
|
-
declare const types_d_CollectionDataStream: typeof CollectionDataStream;
|
|
5795
|
-
type types_d_CollectionEdge = CollectionEdge;
|
|
5796
|
-
declare const types_d_CollectionEdge: typeof CollectionEdge;
|
|
5797
|
-
type types_d_CollectionEdgeInput = CollectionEdgeInput;
|
|
5798
|
-
declare const types_d_CollectionEdgeInput: typeof CollectionEdgeInput;
|
|
5799
|
-
type types_d_CollectionNode = CollectionNode;
|
|
5800
|
-
declare const types_d_CollectionNode: typeof CollectionNode;
|
|
5801
|
-
type types_d_CompiledCollectionExport = CompiledCollectionExport;
|
|
5802
|
-
type types_d_DataStreamInput = DataStreamInput;
|
|
5803
|
-
type types_d_RequiredUserInput = RequiredUserInput;
|
|
5804
|
-
type types_d_UnsealConditionsProofPathDescriptor = UnsealConditionsProofPathDescriptor;
|
|
5805
|
-
declare const types_d_UnsealConditionsProofPathDescriptor: typeof UnsealConditionsProofPathDescriptor;
|
|
5806
|
-
declare const types_d_import_collectionedge_from_json: typeof import_collectionedge_from_json;
|
|
5807
|
-
declare const types_d_import_collectionnode_from_json: typeof import_collectionnode_from_json;
|
|
5808
|
-
declare namespace types_d {
|
|
5809
|
-
export { types_d_AddressMapWithDefault as AddressMapWithDefault, types_d_BasicAddressMap as BasicAddressMap, types_d_ChangedType as ChangedType, types_d_CollectionDataStream as CollectionDataStream, types_d_CollectionEdge as CollectionEdge, types_d_CollectionEdgeInput as CollectionEdgeInput, types_d_CollectionNode as CollectionNode, types_d_UnsealConditionsProofPathDescriptor as UnsealConditionsProofPathDescriptor, types_d_import_collectionedge_from_json as import_collectionedge_from_json, types_d_import_collectionnode_from_json as import_collectionnode_from_json };
|
|
5810
|
-
export type { types_d_AddressMap as AddressMap, types_d_ChangedCallback as ChangedCallback, types_d_CompiledCollectionExport as CompiledCollectionExport, types_d_DataStreamInput as DataStreamInput, types_d_RequiredUserInput as RequiredUserInput };
|
|
5811
|
-
}
|
|
5812
|
-
|
|
5813
5139
|
type HexString = string;
|
|
5814
5140
|
type PaymentProof = string;
|
|
5815
5141
|
type OpeningCondition = {
|
|
@@ -5902,246 +5228,1038 @@ declare enum ProcessorStatus {
|
|
|
5902
5228
|
ERROR = -99
|
|
5903
5229
|
}
|
|
5904
5230
|
/**
|
|
5905
|
-
* Throwaway packages are local to the client during the sealing phase.
|
|
5906
|
-
* After the sealing phase is done, the throwaway packages/values are removed to secure unlinkability.
|
|
5231
|
+
* Throwaway packages are local to the client during the sealing phase.
|
|
5232
|
+
* After the sealing phase is done, the throwaway packages/values are removed to secure unlinkability.
|
|
5233
|
+
*/
|
|
5234
|
+
type SecretThrowawayPackage = {};
|
|
5235
|
+
/**
|
|
5236
|
+
* This is an abstract type for all public packages.
|
|
5237
|
+
* Packages marked as public can be shared externally to watch for events that relate to
|
|
5238
|
+
* initiation of the revealing phase. Can be sent to centralized services to notify them of events.
|
|
5239
|
+
*
|
|
5240
|
+
*/
|
|
5241
|
+
type PublicPackage = {};
|
|
5242
|
+
/**
|
|
5243
|
+
* This is an abstract type for all hidden packages.
|
|
5244
|
+
* This meant to be stored behind a password, here might live potentially linkable information.
|
|
5245
|
+
* There is no direct purpose for this package YET.
|
|
5246
|
+
*/
|
|
5247
|
+
type HiddenPackage = {};
|
|
5248
|
+
/**
|
|
5249
|
+
* This is an abstract type for all local private packages.
|
|
5250
|
+
* It is meant to be stored with the client to generate reveal proofs.
|
|
5251
|
+
* Packages marked as private can be used to initiate the revealing phase
|
|
5252
|
+
*/
|
|
5253
|
+
type PrivatePackage = {};
|
|
5254
|
+
type StaticCircuitInput = {
|
|
5255
|
+
circuit_id: HexString;
|
|
5256
|
+
inputfield_name: string;
|
|
5257
|
+
value: HexString;
|
|
5258
|
+
};
|
|
5259
|
+
type ChainedCircuitInput = {
|
|
5260
|
+
source_circuit_id: HexString;
|
|
5261
|
+
source_circuit_index: number;
|
|
5262
|
+
target_circuit_id: HexString;
|
|
5263
|
+
outputfield_index: number;
|
|
5264
|
+
inputfield_name: string;
|
|
5265
|
+
};
|
|
5266
|
+
type RevealCondition = {
|
|
5267
|
+
address: HexString;
|
|
5268
|
+
circuit_id: HexString;
|
|
5269
|
+
static_inputs: StaticCircuitInput[];
|
|
5270
|
+
chained_inputs: ChainedCircuitInput[];
|
|
5271
|
+
random_value: HexString;
|
|
5272
|
+
proof: any;
|
|
5273
|
+
public_signals: any;
|
|
5274
|
+
};
|
|
5275
|
+
/**
|
|
5276
|
+
* This is an abstract type for all reveal condition request packages.
|
|
5277
|
+
* The request packages will be signed separately if the processor supports the address and circuit.
|
|
5278
|
+
*
|
|
5279
|
+
*/
|
|
5280
|
+
type RevealConditionRequest = {
|
|
5281
|
+
address: HexString;
|
|
5282
|
+
circuit_id: HexString;
|
|
5283
|
+
hashed_input_fields: HexString;
|
|
5284
|
+
random_value: HexString;
|
|
5285
|
+
proof: any;
|
|
5286
|
+
public_signals: any;
|
|
5287
|
+
};
|
|
5288
|
+
type UnsealRevealConditionRequest = {
|
|
5289
|
+
proof: HexString;
|
|
5290
|
+
commitment: HexString;
|
|
5291
|
+
public_signals: HexString[];
|
|
5292
|
+
};
|
|
5293
|
+
type RevealConditionRequestResponse = {
|
|
5294
|
+
address: HexString;
|
|
5295
|
+
circuit_id: HexString;
|
|
5296
|
+
hashed_input_fields: HexString;
|
|
5297
|
+
random_value: HexString;
|
|
5298
|
+
signature_S: HexString;
|
|
5299
|
+
signature_R8x: HexString;
|
|
5300
|
+
signature_R8y: HexString;
|
|
5301
|
+
};
|
|
5302
|
+
type SingleSealRequest = {
|
|
5303
|
+
address: HexString;
|
|
5304
|
+
circuit_id: HexString;
|
|
5305
|
+
hashed_reveal_value_preimage: HexString;
|
|
5306
|
+
hashed_unseal_condition_root: HexString;
|
|
5307
|
+
hashed_metadata_root: HexString;
|
|
5308
|
+
require_proof: boolean;
|
|
5309
|
+
};
|
|
5310
|
+
type SingleSealRequestResponse = {
|
|
5311
|
+
address: HexString;
|
|
5312
|
+
circuit_id: HexString;
|
|
5313
|
+
cyphertexts: [
|
|
5314
|
+
HexString,
|
|
5315
|
+
HexString,
|
|
5316
|
+
HexString,
|
|
5317
|
+
HexString,
|
|
5318
|
+
HexString,
|
|
5319
|
+
HexString,
|
|
5320
|
+
HexString,
|
|
5321
|
+
HexString,
|
|
5322
|
+
HexString,
|
|
5323
|
+
HexString,
|
|
5324
|
+
HexString,
|
|
5325
|
+
HexString,
|
|
5326
|
+
HexString,
|
|
5327
|
+
HexString,
|
|
5328
|
+
HexString,
|
|
5329
|
+
HexString
|
|
5330
|
+
];
|
|
5331
|
+
empheral_keys: [
|
|
5332
|
+
HexString,
|
|
5333
|
+
HexString,
|
|
5334
|
+
HexString,
|
|
5335
|
+
HexString,
|
|
5336
|
+
HexString,
|
|
5337
|
+
HexString,
|
|
5338
|
+
HexString,
|
|
5339
|
+
HexString,
|
|
5340
|
+
HexString,
|
|
5341
|
+
HexString,
|
|
5342
|
+
HexString,
|
|
5343
|
+
HexString,
|
|
5344
|
+
HexString,
|
|
5345
|
+
HexString,
|
|
5346
|
+
HexString,
|
|
5347
|
+
HexString
|
|
5348
|
+
];
|
|
5349
|
+
signature_S: HexString;
|
|
5350
|
+
signature_R8x: HexString;
|
|
5351
|
+
signature_R8y: HexString;
|
|
5352
|
+
new_public_key: [HexString, HexString];
|
|
5353
|
+
severed_commitment_random_value: HexString;
|
|
5354
|
+
proof: HexString;
|
|
5355
|
+
public_signals: HexString[];
|
|
5356
|
+
hashed_unseal_condition_root: HexString;
|
|
5357
|
+
hashed_metadata_root: HexString;
|
|
5358
|
+
};
|
|
5359
|
+
type SingleUnsealRequest = {
|
|
5360
|
+
address: HexString;
|
|
5361
|
+
circuit_id: HexString;
|
|
5362
|
+
public_key: [HexString, HexString];
|
|
5363
|
+
signature_S: HexString;
|
|
5364
|
+
signature_R8x: HexString;
|
|
5365
|
+
signature_R8y: HexString;
|
|
5366
|
+
proof: HexString;
|
|
5367
|
+
public_signals: HexString[][];
|
|
5368
|
+
proofs: HexString[];
|
|
5369
|
+
empheral_keys: HexString[];
|
|
5370
|
+
cyphertexts: HexString[];
|
|
5371
|
+
data_stream_address: HexString;
|
|
5372
|
+
unseal_proof_actions: UnsealProofAction[];
|
|
5373
|
+
unseal_root_proof: ProofPath;
|
|
5374
|
+
};
|
|
5375
|
+
type SingleSealStoragePackage$1 = {
|
|
5376
|
+
private_package: SingleShareSealPrivatePackage;
|
|
5377
|
+
public_package: SingleShareSealPublicPackage;
|
|
5378
|
+
hidden_package: SingleShareSealHiddenPackage;
|
|
5379
|
+
};
|
|
5380
|
+
type ECCEncryptedMessage = {
|
|
5381
|
+
ciphertextHex: HexString;
|
|
5382
|
+
R: {
|
|
5383
|
+
x: HexString;
|
|
5384
|
+
y: HexString;
|
|
5385
|
+
};
|
|
5386
|
+
};
|
|
5387
|
+
type UnsealConditionTemplateExport = {
|
|
5388
|
+
name: string;
|
|
5389
|
+
description: string;
|
|
5390
|
+
unseal_proof_actions: UnsealProofAction[][];
|
|
5391
|
+
user_inputs: RequiredUserInput[][];
|
|
5392
|
+
used_input_mapping: {
|
|
5393
|
+
[key: string]: string;
|
|
5394
|
+
};
|
|
5395
|
+
compiled_collection: CompiledCollectionExport;
|
|
5396
|
+
collection_id: string;
|
|
5397
|
+
};
|
|
5398
|
+
type SingleShareSealPrivatePackage = PrivatePackage & {
|
|
5399
|
+
cyphertexts: HexString[];
|
|
5400
|
+
empheral_keys: HexString[];
|
|
5401
|
+
proof: any;
|
|
5402
|
+
public_signals: any;
|
|
5403
|
+
public_key_he: [HexString, HexString];
|
|
5404
|
+
public_verification_key: [HexString, HexString];
|
|
5405
|
+
encrypted_secret: ECCEncryptedMessage;
|
|
5406
|
+
reveal_value: HexString;
|
|
5407
|
+
unseal_condition_root: HexString;
|
|
5408
|
+
metadata_root: HexString;
|
|
5409
|
+
unseal_template: UnsealConditionTemplateExport;
|
|
5410
|
+
proving_hints: any;
|
|
5411
|
+
unseal_collection_id: string;
|
|
5412
|
+
};
|
|
5413
|
+
type SingleShareSealPublicPackage = PublicPackage & {
|
|
5414
|
+
reveal_value: HexString;
|
|
5415
|
+
address: HexString;
|
|
5416
|
+
circuit_id: HexString;
|
|
5417
|
+
data_stream_ids: HexString[];
|
|
5418
|
+
proof: any;
|
|
5419
|
+
public_signals: any;
|
|
5420
|
+
data_stream_urls: string[];
|
|
5421
|
+
processor_url: string;
|
|
5422
|
+
};
|
|
5423
|
+
type SingleShareSealHiddenPackage = HiddenPackage & {};
|
|
5424
|
+
type ThrowAwayShamirSecret = {
|
|
5425
|
+
shamir_secret: bigint;
|
|
5426
|
+
secret_ecc_scalar: bigint;
|
|
5427
|
+
ecc_public_key: [bigint, bigint];
|
|
5428
|
+
};
|
|
5429
|
+
|
|
5430
|
+
declare const from_json: (json_object: UnsealConditionTemplateExport, proof_library: ProofLibraryType, module_library: ModuleLibraryType) => UnsealConditionTemplate;
|
|
5431
|
+
declare class UnsealConditionTemplate {
|
|
5432
|
+
name: string;
|
|
5433
|
+
collection_id: string;
|
|
5434
|
+
description: string;
|
|
5435
|
+
proof_library: ProofLibraryType;
|
|
5436
|
+
module_library: ModuleLibraryType;
|
|
5437
|
+
compiled_collection: CompiledCollectionExport;
|
|
5438
|
+
user_inputs: RequiredUserInput[][];
|
|
5439
|
+
unsealProofActions: UnsealProofAction[][];
|
|
5440
|
+
data_streams: DataStreamInput[][];
|
|
5441
|
+
modules: UnsealConditionModule[];
|
|
5442
|
+
used_input_mapping: {
|
|
5443
|
+
[key: string]: any;
|
|
5444
|
+
};
|
|
5445
|
+
private proofs_cache;
|
|
5446
|
+
constructor(name: string, description: string, proof_library: ProofLibraryType, module_library: ModuleLibraryType, compiled_collection: CompiledCollectionExport);
|
|
5447
|
+
export_compiled_to_json(): UnsealConditionTemplateExport;
|
|
5448
|
+
isCompiled(): boolean;
|
|
5449
|
+
private getInputFromMapping;
|
|
5450
|
+
compile(input_mapping: {
|
|
5451
|
+
[key: string]: bigint;
|
|
5452
|
+
}, data_stream_mapping: {
|
|
5453
|
+
[key: string]: string;
|
|
5454
|
+
}, optimize?: boolean): void;
|
|
5455
|
+
address_to_proof(address: string): UnsealConditionProof;
|
|
5456
|
+
/**
|
|
5457
|
+
* Converts V1 unseal proof actions (2D output references via output_proof_index + output_signal_index)
|
|
5458
|
+
* into V2 actions (flat output list with bitmask-based pruning at each chain_proof_verify).
|
|
5459
|
+
*
|
|
5460
|
+
* At each chain_proof_verify:
|
|
5461
|
+
* 1. Append the new proof's outputs to the flat list
|
|
5462
|
+
* 2. Look forward to find which flat entries are still referenced
|
|
5463
|
+
* 3. Build a bitmask (1=keep, 0=remove) over the entire flat list
|
|
5464
|
+
* 4. Prune dead entries
|
|
5465
|
+
*
|
|
5466
|
+
* PASS_SIGNAL and VALIDATE_DATA_ROOT actions are converted from 2D (proof_index, signal_index)
|
|
5467
|
+
* to flat indices into the current output list.
|
|
5468
|
+
*/
|
|
5469
|
+
optimize(unseal_proof_actions: UnsealProofAction[]): UnsealProofAction[];
|
|
5470
|
+
/**
|
|
5471
|
+
* Scans actions from startIdx onward to find which flat list entries
|
|
5472
|
+
* are referenced by future PASS_SIGNAL and VALIDATE_DATA_ROOT actions.
|
|
5473
|
+
* Returns the set of flat indices that are still needed.
|
|
5474
|
+
*/
|
|
5475
|
+
private collectFutureReferences;
|
|
5476
|
+
/**
|
|
5477
|
+
* Finds an UnsealConditionProof by its on-chain verifier address.
|
|
5478
|
+
* Searches through compiled modules to match the verifier_address
|
|
5479
|
+
* in PREPARE_NEXT_PROOF actions to the corresponding proof.
|
|
5480
|
+
*/
|
|
5481
|
+
private getProofByVerifierAddress;
|
|
5482
|
+
getAllDataStreams(): string[];
|
|
5483
|
+
getUnsealProofActions(): UnsealProofAction[][];
|
|
5484
|
+
getExpectedInputs(): string[];
|
|
5485
|
+
getUnsealRootForProof(proof_index: number): Promise<ProofPath>;
|
|
5486
|
+
getUnsealRoot(): Promise<string>;
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5489
|
+
declare class UnsealConditionCollection {
|
|
5490
|
+
nodes: {
|
|
5491
|
+
[key: string]: CollectionNode;
|
|
5492
|
+
};
|
|
5493
|
+
edges: {
|
|
5494
|
+
[key: string]: CollectionEdge;
|
|
5495
|
+
};
|
|
5496
|
+
comments: {
|
|
5497
|
+
[key: string]: string;
|
|
5498
|
+
};
|
|
5499
|
+
data_streams: CollectionDataStream[];
|
|
5500
|
+
name: string;
|
|
5501
|
+
description: string;
|
|
5502
|
+
starting_node: CollectionNode | undefined;
|
|
5503
|
+
proofLibrary: ProofLibraryType;
|
|
5504
|
+
moduleLibrary: ModuleLibraryType;
|
|
5505
|
+
forks: {
|
|
5506
|
+
[key: string]: string[];
|
|
5507
|
+
};
|
|
5508
|
+
fork_list: string[];
|
|
5509
|
+
private node_to_fork_map;
|
|
5510
|
+
private index_counter;
|
|
5511
|
+
changed_callback: ChangedCallback;
|
|
5512
|
+
constructor(name: string, description: string, proofLibrary: ProofLibraryType, moduleLibrary: ModuleLibraryType, changed_callback?: ChangedCallback);
|
|
5513
|
+
visual_forks(): string[];
|
|
5514
|
+
visual_edges_all(): string[][];
|
|
5515
|
+
visual_edges(fork_id: string): string[];
|
|
5516
|
+
comment(id: string, comment: string): void;
|
|
5517
|
+
add_data_stream(datastream_id: string, from_node_id: string, field_name: string): void;
|
|
5518
|
+
remove_data_stream(datastream_id: string): void;
|
|
5519
|
+
get_data_stream(datastream_id: string): CollectionDataStream | undefined;
|
|
5520
|
+
sort_fork_list(): void;
|
|
5521
|
+
add_node(module: UnsealConditionModule, fork_from_node_id?: string): string;
|
|
5522
|
+
move_node(node_id: string, new_fork_from_node_id: string, at_position?: number): CollectionEdge[];
|
|
5523
|
+
remove_node(node_id: string): void;
|
|
5524
|
+
remove_edge(edge_id: string): void;
|
|
5525
|
+
all_nodes_for_fork(fork_id: string): {
|
|
5526
|
+
nodes: string[];
|
|
5527
|
+
forking: string[];
|
|
5528
|
+
};
|
|
5529
|
+
validate_edge(source_node_id: string | undefined, target_node_id: string | undefined, mapping: [string, any], input_type: CollectionEdgeInput): boolean;
|
|
5530
|
+
add_edge(source_node_id: string | undefined, target_node_id: string | undefined, mapping: [string, any], input_type: CollectionEdgeInput): void;
|
|
5531
|
+
export_to_json(): any;
|
|
5532
|
+
import_from_json(data: any): void;
|
|
5533
|
+
getEdgesToNode(node_id: string): CollectionEdge[];
|
|
5534
|
+
getEdgesFromNode(node_id: string): CollectionEdge[];
|
|
5535
|
+
getCollectionId(): string;
|
|
5536
|
+
generateProofCode(fork_nr: number): string;
|
|
5537
|
+
createTemplate(address_map: AddressMap): UnsealConditionTemplate;
|
|
5538
|
+
createTemplatePerFork(address_map: AddressMap, sorted_nodes: string[], forking: string[]): {
|
|
5539
|
+
compiled_modules: CompiledModule[];
|
|
5540
|
+
user_inputs: RequiredUserInput[];
|
|
5541
|
+
data_stream_inputs: DataStreamInput[];
|
|
5542
|
+
};
|
|
5543
|
+
}
|
|
5544
|
+
|
|
5545
|
+
/** Field is not always over prime: for example, Fp2 has ORDER(q)=p^m. */
|
|
5546
|
+
interface IField<T> {
|
|
5547
|
+
ORDER: bigint;
|
|
5548
|
+
isLE: boolean;
|
|
5549
|
+
BYTES: number;
|
|
5550
|
+
BITS: number;
|
|
5551
|
+
MASK: bigint;
|
|
5552
|
+
ZERO: T;
|
|
5553
|
+
ONE: T;
|
|
5554
|
+
create: (num: T) => T;
|
|
5555
|
+
isValid: (num: T) => boolean;
|
|
5556
|
+
is0: (num: T) => boolean;
|
|
5557
|
+
neg(num: T): T;
|
|
5558
|
+
inv(num: T): T;
|
|
5559
|
+
sqrt(num: T): T;
|
|
5560
|
+
sqr(num: T): T;
|
|
5561
|
+
eql(lhs: T, rhs: T): boolean;
|
|
5562
|
+
add(lhs: T, rhs: T): T;
|
|
5563
|
+
sub(lhs: T, rhs: T): T;
|
|
5564
|
+
mul(lhs: T, rhs: T | bigint): T;
|
|
5565
|
+
pow(lhs: T, power: bigint): T;
|
|
5566
|
+
div(lhs: T, rhs: T | bigint): T;
|
|
5567
|
+
addN(lhs: T, rhs: T): T;
|
|
5568
|
+
subN(lhs: T, rhs: T): T;
|
|
5569
|
+
mulN(lhs: T, rhs: T | bigint): T;
|
|
5570
|
+
sqrN(num: T): T;
|
|
5571
|
+
isOdd?(num: T): boolean;
|
|
5572
|
+
pow(lhs: T, power: bigint): T;
|
|
5573
|
+
invertBatch: (lst: T[]) => T[];
|
|
5574
|
+
toBytes(num: T): Uint8Array;
|
|
5575
|
+
fromBytes(bytes: Uint8Array): T;
|
|
5576
|
+
cmov(a: T, b: T, c: boolean): T;
|
|
5577
|
+
}
|
|
5578
|
+
|
|
5579
|
+
/**
|
|
5580
|
+
* Methods for elliptic curve multiplication by scalars.
|
|
5581
|
+
* Contains wNAF, pippenger
|
|
5582
|
+
* @module
|
|
5583
|
+
*/
|
|
5584
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5585
|
+
|
|
5586
|
+
type AffinePoint$1<T> = {
|
|
5587
|
+
x: T;
|
|
5588
|
+
y: T;
|
|
5589
|
+
} & {
|
|
5590
|
+
z?: never;
|
|
5591
|
+
t?: never;
|
|
5592
|
+
};
|
|
5593
|
+
interface Group$1<T extends Group$1<T>> {
|
|
5594
|
+
double(): T;
|
|
5595
|
+
negate(): T;
|
|
5596
|
+
add(other: T): T;
|
|
5597
|
+
subtract(other: T): T;
|
|
5598
|
+
equals(other: T): boolean;
|
|
5599
|
+
multiply(scalar: bigint): T;
|
|
5600
|
+
}
|
|
5601
|
+
type GroupConstructor$1<T> = {
|
|
5602
|
+
BASE: T;
|
|
5603
|
+
ZERO: T;
|
|
5604
|
+
};
|
|
5605
|
+
/**
|
|
5606
|
+
* Generic BasicCurve interface: works even for polynomial fields (BLS): P, n, h would be ok.
|
|
5607
|
+
* Though generator can be different (Fp2 / Fp6 for BLS).
|
|
5608
|
+
*/
|
|
5609
|
+
type BasicCurve<T> = {
|
|
5610
|
+
Fp: IField<T>;
|
|
5611
|
+
n: bigint;
|
|
5612
|
+
nBitLength?: number;
|
|
5613
|
+
nByteLength?: number;
|
|
5614
|
+
h: bigint;
|
|
5615
|
+
hEff?: bigint;
|
|
5616
|
+
Gx: T;
|
|
5617
|
+
Gy: T;
|
|
5618
|
+
allowInfinityPoint?: boolean;
|
|
5619
|
+
};
|
|
5620
|
+
|
|
5621
|
+
/**
|
|
5622
|
+
* Hex, bytes and number utilities.
|
|
5623
|
+
* @module
|
|
5624
|
+
*/
|
|
5625
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5626
|
+
type Hex$1 = Uint8Array | string;
|
|
5627
|
+
type FHash = (message: Uint8Array | string) => Uint8Array;
|
|
5628
|
+
|
|
5629
|
+
/**
|
|
5630
|
+
* Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y².
|
|
5631
|
+
* For design rationale of types / exports, see weierstrass module documentation.
|
|
5632
|
+
* @module
|
|
5633
|
+
*/
|
|
5634
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5635
|
+
|
|
5636
|
+
/** Edwards curves must declare params a & d. */
|
|
5637
|
+
type CurveType = BasicCurve<bigint> & {
|
|
5638
|
+
a: bigint;
|
|
5639
|
+
d: bigint;
|
|
5640
|
+
hash: FHash;
|
|
5641
|
+
randomBytes: (bytesLength?: number) => Uint8Array;
|
|
5642
|
+
adjustScalarBytes?: (bytes: Uint8Array) => Uint8Array;
|
|
5643
|
+
domain?: (data: Uint8Array, ctx: Uint8Array, phflag: boolean) => Uint8Array;
|
|
5644
|
+
uvRatio?: (u: bigint, v: bigint) => {
|
|
5645
|
+
isValid: boolean;
|
|
5646
|
+
value: bigint;
|
|
5647
|
+
};
|
|
5648
|
+
prehash?: FHash;
|
|
5649
|
+
mapToCurve?: (scalar: bigint[]) => AffinePoint$1<bigint>;
|
|
5650
|
+
};
|
|
5651
|
+
type CurveTypeWithLength = Readonly<CurveType & {
|
|
5652
|
+
nByteLength: number;
|
|
5653
|
+
nBitLength: number;
|
|
5654
|
+
}>;
|
|
5655
|
+
declare function validateOpts(curve: CurveType): CurveTypeWithLength;
|
|
5656
|
+
/** Instance of Extended Point with coordinates in X, Y, Z, T. */
|
|
5657
|
+
interface ExtPointType$1 extends Group$1<ExtPointType$1> {
|
|
5658
|
+
readonly ex: bigint;
|
|
5659
|
+
readonly ey: bigint;
|
|
5660
|
+
readonly ez: bigint;
|
|
5661
|
+
readonly et: bigint;
|
|
5662
|
+
get x(): bigint;
|
|
5663
|
+
get y(): bigint;
|
|
5664
|
+
assertValidity(): void;
|
|
5665
|
+
multiply(scalar: bigint): ExtPointType$1;
|
|
5666
|
+
multiplyUnsafe(scalar: bigint): ExtPointType$1;
|
|
5667
|
+
isSmallOrder(): boolean;
|
|
5668
|
+
isTorsionFree(): boolean;
|
|
5669
|
+
clearCofactor(): ExtPointType$1;
|
|
5670
|
+
toAffine(iz?: bigint): AffinePoint$1<bigint>;
|
|
5671
|
+
toRawBytes(isCompressed?: boolean): Uint8Array;
|
|
5672
|
+
toHex(isCompressed?: boolean): string;
|
|
5673
|
+
_setWindowSize(windowSize: number): void;
|
|
5674
|
+
}
|
|
5675
|
+
/** Static methods of Extended Point with coordinates in X, Y, Z, T. */
|
|
5676
|
+
interface ExtPointConstructor$1 extends GroupConstructor$1<ExtPointType$1> {
|
|
5677
|
+
new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType$1;
|
|
5678
|
+
fromAffine(p: AffinePoint$1<bigint>): ExtPointType$1;
|
|
5679
|
+
fromHex(hex: Hex$1): ExtPointType$1;
|
|
5680
|
+
fromPrivateKey(privateKey: Hex$1): ExtPointType$1;
|
|
5681
|
+
msm(points: ExtPointType$1[], scalars: bigint[]): ExtPointType$1;
|
|
5682
|
+
}
|
|
5683
|
+
/**
|
|
5684
|
+
* Edwards Curve interface.
|
|
5685
|
+
* Main methods: `getPublicKey(priv)`, `sign(msg, priv)`, `verify(sig, msg, pub)`.
|
|
5686
|
+
*/
|
|
5687
|
+
type CurveFn = {
|
|
5688
|
+
CURVE: ReturnType<typeof validateOpts>;
|
|
5689
|
+
getPublicKey: (privateKey: Hex$1) => Uint8Array;
|
|
5690
|
+
sign: (message: Hex$1, privateKey: Hex$1, options?: {
|
|
5691
|
+
context?: Hex$1;
|
|
5692
|
+
}) => Uint8Array;
|
|
5693
|
+
verify: (sig: Hex$1, message: Hex$1, publicKey: Hex$1, options?: {
|
|
5694
|
+
context?: Hex$1;
|
|
5695
|
+
zip215: boolean;
|
|
5696
|
+
}) => boolean;
|
|
5697
|
+
ExtendedPoint: ExtPointConstructor$1;
|
|
5698
|
+
utils: {
|
|
5699
|
+
randomPrivateKey: () => Uint8Array;
|
|
5700
|
+
getExtendedPublicKey: (key: Hex$1) => {
|
|
5701
|
+
head: Uint8Array;
|
|
5702
|
+
prefix: Uint8Array;
|
|
5703
|
+
scalar: bigint;
|
|
5704
|
+
point: ExtPointType$1;
|
|
5705
|
+
pointBytes: Uint8Array;
|
|
5706
|
+
};
|
|
5707
|
+
precompute: (windowSize?: number, point?: ExtPointType$1) => ExtPointType$1;
|
|
5708
|
+
};
|
|
5709
|
+
};
|
|
5710
|
+
|
|
5711
|
+
type SnarkBigInt$1 = bigint;
|
|
5712
|
+
type PrivKey$1 = bigint;
|
|
5713
|
+
type PubKey$1 = ExtPointType$1;
|
|
5714
|
+
type BabyJubAffinePoint$1 = AffinePoint$1<bigint>;
|
|
5715
|
+
type BabyJubExtPoint$1 = ExtPointType$1;
|
|
5716
|
+
declare const babyJubNoble: CurveFn;
|
|
5717
|
+
/**
|
|
5718
|
+
* A private key and a public key
|
|
5719
|
+
*/
|
|
5720
|
+
interface Keypair$1 {
|
|
5721
|
+
privKey: PrivKey$1;
|
|
5722
|
+
pubKey: PubKey$1;
|
|
5723
|
+
}
|
|
5724
|
+
declare const SNARK_FIELD_SIZE$1: SnarkBigInt$1;
|
|
5725
|
+
declare const babyJub$1: ExtPointConstructor$1;
|
|
5726
|
+
|
|
5727
|
+
/**
|
|
5728
|
+
* Public type surface — the single flat namespace for all Nihilium domain types.
|
|
5729
|
+
*
|
|
5730
|
+
* Re-exports every protocol / proof / module / collection declaration so consumers can
|
|
5731
|
+
* reach them as `types.X` instead of the old nested `nhsdk.protocolTypes.X` /
|
|
5732
|
+
* `nhsdk.CollectionTypes.X`. These modules mix type aliases with the classes, enums and
|
|
5733
|
+
* functions they describe (e.g. BasicAddressMap, UnsealConditionCollection, the enums), so
|
|
5734
|
+
* this barrel intentionally carries values too — it is emitted as real JS, not types-only.
|
|
5735
|
+
*
|
|
5736
|
+
* Flattening is collision-free (verified: 76 unique names across these modules).
|
|
5737
|
+
*/
|
|
5738
|
+
|
|
5739
|
+
type public_d_AddressMap = AddressMap;
|
|
5740
|
+
type public_d_AddressMapWithDefault = AddressMapWithDefault;
|
|
5741
|
+
declare const public_d_AddressMapWithDefault: typeof AddressMapWithDefault;
|
|
5742
|
+
type public_d_BasicAddressMap = BasicAddressMap;
|
|
5743
|
+
declare const public_d_BasicAddressMap: typeof BasicAddressMap;
|
|
5744
|
+
type public_d_ChainedCircuitInput = ChainedCircuitInput;
|
|
5745
|
+
type public_d_ChangedCallback = ChangedCallback;
|
|
5746
|
+
type public_d_ChangedType = ChangedType;
|
|
5747
|
+
declare const public_d_ChangedType: typeof ChangedType;
|
|
5748
|
+
type public_d_ClientProcessorSealingPhase = ClientProcessorSealingPhase;
|
|
5749
|
+
declare const public_d_ClientProcessorSealingPhase: typeof ClientProcessorSealingPhase;
|
|
5750
|
+
type public_d_CollectionDataStream = CollectionDataStream;
|
|
5751
|
+
declare const public_d_CollectionDataStream: typeof CollectionDataStream;
|
|
5752
|
+
type public_d_CollectionEdge = CollectionEdge;
|
|
5753
|
+
declare const public_d_CollectionEdge: typeof CollectionEdge;
|
|
5754
|
+
type public_d_CollectionEdgeInput = CollectionEdgeInput;
|
|
5755
|
+
declare const public_d_CollectionEdgeInput: typeof CollectionEdgeInput;
|
|
5756
|
+
type public_d_CollectionNode = CollectionNode;
|
|
5757
|
+
declare const public_d_CollectionNode: typeof CollectionNode;
|
|
5758
|
+
type public_d_CompiledCollectionExport = CompiledCollectionExport;
|
|
5759
|
+
type public_d_CompiledModule = CompiledModule;
|
|
5760
|
+
type public_d_CompiledProof = CompiledProof;
|
|
5761
|
+
type public_d_DataStreamInput = DataStreamInput;
|
|
5762
|
+
type public_d_DualLatestGlobalLeafProofResult = DualLatestGlobalLeafProofResult;
|
|
5763
|
+
type public_d_DualProofResult = DualProofResult;
|
|
5764
|
+
type public_d_ECCEncryptedMessage = ECCEncryptedMessage;
|
|
5765
|
+
type public_d_HexString = HexString;
|
|
5766
|
+
type public_d_HiddenPackage = HiddenPackage;
|
|
5767
|
+
type public_d_IClientSingleShareSealingProcess = IClientSingleShareSealingProcess;
|
|
5768
|
+
type public_d_IClientSingleShareUnsealingProcess = IClientSingleShareUnsealingProcess;
|
|
5769
|
+
type public_d_IDataStream = IDataStream;
|
|
5770
|
+
type public_d_IDualDataStream = IDualDataStream;
|
|
5771
|
+
type public_d_IO = IO;
|
|
5772
|
+
type public_d_IOMap = IOMap;
|
|
5773
|
+
type public_d_IOType = IOType;
|
|
5774
|
+
type public_d_LatestGlobalLeafProofResult = LatestGlobalLeafProofResult;
|
|
5775
|
+
type public_d_ModuleEdge = ModuleEdge;
|
|
5776
|
+
declare const public_d_ModuleEdge: typeof ModuleEdge;
|
|
5777
|
+
type public_d_ModuleEdgeInput = ModuleEdgeInput;
|
|
5778
|
+
declare const public_d_ModuleEdgeInput: typeof ModuleEdgeInput;
|
|
5779
|
+
type public_d_ModuleNode = ModuleNode;
|
|
5780
|
+
declare const public_d_ModuleNode: typeof ModuleNode;
|
|
5781
|
+
type public_d_ModuleOutput = ModuleOutput;
|
|
5782
|
+
type public_d_ModuleOutputMap = ModuleOutputMap;
|
|
5783
|
+
type public_d_ModuleProof = ModuleProof;
|
|
5784
|
+
type public_d_OpeningCondition = OpeningCondition;
|
|
5785
|
+
declare const public_d_PROTOCOL_DATA_STREAM_PATHS: typeof PROTOCOL_DATA_STREAM_PATHS;
|
|
5786
|
+
declare const public_d_PROTOCOL_PROCESSOR_PATHS: typeof PROTOCOL_PROCESSOR_PATHS;
|
|
5787
|
+
type public_d_PaymentProof = PaymentProof;
|
|
5788
|
+
type public_d_PrivatePackage = PrivatePackage;
|
|
5789
|
+
type public_d_ProcessorEndpoint = ProcessorEndpoint;
|
|
5790
|
+
type public_d_ProcessorStatus = ProcessorStatus;
|
|
5791
|
+
declare const public_d_ProcessorStatus: typeof ProcessorStatus;
|
|
5792
|
+
type public_d_Proof = Proof;
|
|
5793
|
+
type public_d_ProofResult = ProofResult;
|
|
5794
|
+
type public_d_PublicPackage = PublicPackage;
|
|
5795
|
+
type public_d_RequestPackageStageOne = RequestPackageStageOne;
|
|
5796
|
+
type public_d_RequestPackageStageTwo = RequestPackageStageTwo;
|
|
5797
|
+
type public_d_RequiredUserInput = RequiredUserInput;
|
|
5798
|
+
type public_d_RevealCondition = RevealCondition;
|
|
5799
|
+
type public_d_RevealConditionRequest = RevealConditionRequest;
|
|
5800
|
+
type public_d_RevealConditionRequestResponse = RevealConditionRequestResponse;
|
|
5801
|
+
type public_d_RevealConditions = RevealConditions;
|
|
5802
|
+
declare const public_d_RevealConditions: typeof RevealConditions;
|
|
5803
|
+
type public_d_SecretThrowawayPackage = SecretThrowawayPackage;
|
|
5804
|
+
type public_d_SignalEdge = SignalEdge;
|
|
5805
|
+
declare const public_d_SignalEdge: typeof SignalEdge;
|
|
5806
|
+
type public_d_SingleSealRequest = SingleSealRequest;
|
|
5807
|
+
type public_d_SingleSealRequestResponse = SingleSealRequestResponse;
|
|
5808
|
+
type public_d_SingleSealUnsealRequestResponse = SingleSealUnsealRequestResponse;
|
|
5809
|
+
type public_d_SingleShareSealHiddenPackage = SingleShareSealHiddenPackage;
|
|
5810
|
+
type public_d_SingleShareSealPrivatePackage = SingleShareSealPrivatePackage;
|
|
5811
|
+
type public_d_SingleShareSealPublicPackage = SingleShareSealPublicPackage;
|
|
5812
|
+
type public_d_SingleUnsealRequest = SingleUnsealRequest;
|
|
5813
|
+
type public_d_StaticCircuitInput = StaticCircuitInput;
|
|
5814
|
+
type public_d_ThrowAwayShamirSecret = ThrowAwayShamirSecret;
|
|
5815
|
+
type public_d_UnsealConditionCollection = UnsealConditionCollection;
|
|
5816
|
+
declare const public_d_UnsealConditionCollection: typeof UnsealConditionCollection;
|
|
5817
|
+
type public_d_UnsealConditionModule = UnsealConditionModule;
|
|
5818
|
+
declare const public_d_UnsealConditionModule: typeof UnsealConditionModule;
|
|
5819
|
+
type public_d_UnsealConditionProof = UnsealConditionProof;
|
|
5820
|
+
declare const public_d_UnsealConditionProof: typeof UnsealConditionProof;
|
|
5821
|
+
type public_d_UnsealConditionProofData = UnsealConditionProofData;
|
|
5822
|
+
type public_d_UnsealConditionTemplate = UnsealConditionTemplate;
|
|
5823
|
+
declare const public_d_UnsealConditionTemplate: typeof UnsealConditionTemplate;
|
|
5824
|
+
type public_d_UnsealConditionTemplateExport = UnsealConditionTemplateExport;
|
|
5825
|
+
type public_d_UnsealConditionsProofPathDescriptor = UnsealConditionsProofPathDescriptor;
|
|
5826
|
+
declare const public_d_UnsealConditionsProofPathDescriptor: typeof UnsealConditionsProofPathDescriptor;
|
|
5827
|
+
type public_d_UnsealRevealConditionRequest = UnsealRevealConditionRequest;
|
|
5828
|
+
type public_d_UnsealingStatus = UnsealingStatus;
|
|
5829
|
+
declare const public_d_UnsealingStatus: typeof UnsealingStatus;
|
|
5830
|
+
type public_d_WrappedProof = WrappedProof;
|
|
5831
|
+
declare const public_d_WrappedProof: typeof WrappedProof;
|
|
5832
|
+
declare const public_d_babyJubNoble: typeof babyJubNoble;
|
|
5833
|
+
declare const public_d_from_json: typeof from_json;
|
|
5834
|
+
declare const public_d_import_collectionedge_from_json: typeof import_collectionedge_from_json;
|
|
5835
|
+
declare const public_d_import_collectionnode_from_json: typeof import_collectionnode_from_json;
|
|
5836
|
+
declare namespace public_d {
|
|
5837
|
+
export { public_d_AddressMapWithDefault as AddressMapWithDefault, public_d_BasicAddressMap as BasicAddressMap, public_d_ChangedType as ChangedType, public_d_ClientProcessorSealingPhase as ClientProcessorSealingPhase, public_d_CollectionDataStream as CollectionDataStream, public_d_CollectionEdge as CollectionEdge, public_d_CollectionEdgeInput as CollectionEdgeInput, public_d_CollectionNode as CollectionNode, public_d_ModuleEdge as ModuleEdge, public_d_ModuleEdgeInput as ModuleEdgeInput, public_d_ModuleNode as ModuleNode, public_d_PROTOCOL_DATA_STREAM_PATHS as PROTOCOL_DATA_STREAM_PATHS, public_d_PROTOCOL_PROCESSOR_PATHS as PROTOCOL_PROCESSOR_PATHS, public_d_ProcessorStatus as ProcessorStatus, public_d_RevealConditions as RevealConditions, SNARK_FIELD_SIZE$1 as SNARK_FIELD_SIZE, public_d_SignalEdge as SignalEdge, public_d_UnsealConditionCollection as UnsealConditionCollection, public_d_UnsealConditionModule as UnsealConditionModule, public_d_UnsealConditionProof as UnsealConditionProof, public_d_UnsealConditionTemplate as UnsealConditionTemplate, public_d_UnsealConditionsProofPathDescriptor as UnsealConditionsProofPathDescriptor, public_d_UnsealingStatus as UnsealingStatus, public_d_WrappedProof as WrappedProof, babyJub$1 as babyJub, public_d_babyJubNoble as babyJubNoble, public_d_from_json as from_json, public_d_import_collectionedge_from_json as import_collectionedge_from_json, public_d_import_collectionnode_from_json as import_collectionnode_from_json };
|
|
5838
|
+
export type { public_d_AddressMap as AddressMap, BabyJubAffinePoint$1 as BabyJubAffinePoint, BabyJubExtPoint$1 as BabyJubExtPoint, public_d_ChainedCircuitInput as ChainedCircuitInput, public_d_ChangedCallback as ChangedCallback, public_d_CompiledCollectionExport as CompiledCollectionExport, public_d_CompiledModule as CompiledModule, public_d_CompiledProof as CompiledProof, public_d_DataStreamInput as DataStreamInput, public_d_DualLatestGlobalLeafProofResult as DualLatestGlobalLeafProofResult, public_d_DualProofResult as DualProofResult, public_d_ECCEncryptedMessage as ECCEncryptedMessage, public_d_HexString as HexString, public_d_HiddenPackage as HiddenPackage, public_d_IClientSingleShareSealingProcess as IClientSingleShareSealingProcess, public_d_IClientSingleShareUnsealingProcess as IClientSingleShareUnsealingProcess, public_d_IDataStream as IDataStream, public_d_IDualDataStream as IDualDataStream, public_d_IO as IO, public_d_IOMap as IOMap, public_d_IOType as IOType, Keypair$1 as Keypair, public_d_LatestGlobalLeafProofResult as LatestGlobalLeafProofResult, public_d_ModuleOutput as ModuleOutput, public_d_ModuleOutputMap as ModuleOutputMap, public_d_ModuleProof as ModuleProof, public_d_OpeningCondition as OpeningCondition, public_d_PaymentProof as PaymentProof, PrivKey$1 as PrivKey, public_d_PrivatePackage as PrivatePackage, public_d_ProcessorEndpoint as ProcessorEndpoint, public_d_Proof as Proof, public_d_ProofResult as ProofResult, PubKey$1 as PubKey, public_d_PublicPackage as PublicPackage, public_d_RequestPackageStageOne as RequestPackageStageOne, public_d_RequestPackageStageTwo as RequestPackageStageTwo, public_d_RequiredUserInput as RequiredUserInput, public_d_RevealCondition as RevealCondition, public_d_RevealConditionRequest as RevealConditionRequest, public_d_RevealConditionRequestResponse as RevealConditionRequestResponse, public_d_SecretThrowawayPackage as SecretThrowawayPackage, public_d_SingleSealRequest as SingleSealRequest, public_d_SingleSealRequestResponse as SingleSealRequestResponse, SingleSealStoragePackage$1 as SingleSealStoragePackage, public_d_SingleSealUnsealRequestResponse as SingleSealUnsealRequestResponse, public_d_SingleShareSealHiddenPackage as SingleShareSealHiddenPackage, public_d_SingleShareSealPrivatePackage as SingleShareSealPrivatePackage, public_d_SingleShareSealPublicPackage as SingleShareSealPublicPackage, public_d_SingleUnsealRequest as SingleUnsealRequest, SnarkBigInt$1 as SnarkBigInt, public_d_StaticCircuitInput as StaticCircuitInput, public_d_ThrowAwayShamirSecret as ThrowAwayShamirSecret, public_d_UnsealConditionProofData as UnsealConditionProofData, public_d_UnsealConditionTemplateExport as UnsealConditionTemplateExport, public_d_UnsealRevealConditionRequest as UnsealRevealConditionRequest };
|
|
5839
|
+
}
|
|
5840
|
+
|
|
5841
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5842
|
+
|
|
5843
|
+
type AffinePoint<T> = {
|
|
5844
|
+
x: T;
|
|
5845
|
+
y: T;
|
|
5846
|
+
} & {
|
|
5847
|
+
z?: never;
|
|
5848
|
+
t?: never;
|
|
5849
|
+
};
|
|
5850
|
+
interface Group<T extends Group<T>> {
|
|
5851
|
+
double(): T;
|
|
5852
|
+
negate(): T;
|
|
5853
|
+
add(other: T): T;
|
|
5854
|
+
subtract(other: T): T;
|
|
5855
|
+
equals(other: T): boolean;
|
|
5856
|
+
multiply(scalar: bigint): T;
|
|
5857
|
+
}
|
|
5858
|
+
type GroupConstructor<T> = {
|
|
5859
|
+
BASE: T;
|
|
5860
|
+
ZERO: T;
|
|
5861
|
+
};
|
|
5862
|
+
|
|
5863
|
+
type Hex = Uint8Array | string;
|
|
5864
|
+
|
|
5865
|
+
interface ExtPointType extends Group<ExtPointType> {
|
|
5866
|
+
readonly ex: bigint;
|
|
5867
|
+
readonly ey: bigint;
|
|
5868
|
+
readonly ez: bigint;
|
|
5869
|
+
readonly et: bigint;
|
|
5870
|
+
get x(): bigint;
|
|
5871
|
+
get y(): bigint;
|
|
5872
|
+
assertValidity(): void;
|
|
5873
|
+
multiply(scalar: bigint): ExtPointType;
|
|
5874
|
+
multiplyUnsafe(scalar: bigint): ExtPointType;
|
|
5875
|
+
isSmallOrder(): boolean;
|
|
5876
|
+
isTorsionFree(): boolean;
|
|
5877
|
+
clearCofactor(): ExtPointType;
|
|
5878
|
+
toAffine(iz?: bigint): AffinePoint<bigint>;
|
|
5879
|
+
toRawBytes(isCompressed?: boolean): Uint8Array;
|
|
5880
|
+
toHex(isCompressed?: boolean): string;
|
|
5881
|
+
}
|
|
5882
|
+
interface ExtPointConstructor extends GroupConstructor<ExtPointType> {
|
|
5883
|
+
new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType;
|
|
5884
|
+
fromAffine(p: AffinePoint<bigint>): ExtPointType;
|
|
5885
|
+
fromHex(hex: Hex): ExtPointType;
|
|
5886
|
+
fromPrivateKey(privateKey: Hex): ExtPointType;
|
|
5887
|
+
}
|
|
5888
|
+
|
|
5889
|
+
type SnarkBigInt = bigint;
|
|
5890
|
+
type PrivKey = bigint;
|
|
5891
|
+
type PubKey = ExtPointType;
|
|
5892
|
+
type BabyJubAffinePoint = AffinePoint<bigint>;
|
|
5893
|
+
type BabyJubExtPoint = ExtPointType;
|
|
5894
|
+
/**
|
|
5895
|
+
* A private key and a public key
|
|
5896
|
+
*/
|
|
5897
|
+
interface Keypair {
|
|
5898
|
+
privKey: PrivKey;
|
|
5899
|
+
pubKey: PubKey;
|
|
5900
|
+
}
|
|
5901
|
+
declare const SNARK_FIELD_SIZE: SnarkBigInt;
|
|
5902
|
+
declare const babyJub: ExtPointConstructor;
|
|
5903
|
+
|
|
5904
|
+
declare const stringifyBigInts: (obj: object) => any;
|
|
5905
|
+
declare const unstringifyBigInts: (obj: object) => any;
|
|
5906
|
+
|
|
5907
|
+
declare function createNobleBlakeHash(data: Buffer): Buffer<ArrayBuffer>;
|
|
5908
|
+
declare function generateRandom248BitNumber(): bigint;
|
|
5909
|
+
declare function generateRandom240BitNumber(): bigint;
|
|
5910
|
+
declare function shrinkToBits(number: bigint, bits: number): bigint;
|
|
5911
|
+
/**
|
|
5912
|
+
* Split a very large number into chunks of 32 bits each.
|
|
5913
|
+
* @param {BigInt} number - A BigInt representing the large number.
|
|
5914
|
+
* @returns {Array<BigInt>} - An array of chunks (BigInts).
|
|
5915
|
+
*/
|
|
5916
|
+
declare function splitLargeNumber(number: bigint, size?: bigint): any[];
|
|
5917
|
+
/**
|
|
5918
|
+
* Combine chunks of 32 bits each into the original large number.
|
|
5919
|
+
* @param {Array<BigInt>} chunks - An array of chunks (BigInts).
|
|
5920
|
+
* @param {BigInt} size - The size of each chunk in bits.
|
|
5921
|
+
* @returns {BigInt} - The combined large number.
|
|
5922
|
+
*/
|
|
5923
|
+
declare function combineChunksWithCarry(chunks: bigint[], size?: bigint): bigint;
|
|
5924
|
+
declare function pruneBuffer(buff: Buffer): Buffer<ArrayBufferLike>;
|
|
5925
|
+
declare function stringToCurve(mimc: any, string: string): any;
|
|
5926
|
+
declare function prv2pub(prv: Buffer): ExtPointType;
|
|
5927
|
+
declare function ffEncodedToBigInt(babyJub: any, encoded: bigint): any;
|
|
5928
|
+
/**
|
|
5929
|
+
* An internal function which formats a random private key to be compatible
|
|
5930
|
+
* with the BabyJub curve. This is the format which should be passed into the
|
|
5931
|
+
* PubKey and other circuits.
|
|
5932
|
+
*/
|
|
5933
|
+
declare function formatPrivKeyForBabyJub(privKey: bigint): any;
|
|
5934
|
+
/**
|
|
5935
|
+
* Function to use when you have just the scalar value of the private key
|
|
5936
|
+
* and you need to convert it to the public key (Ax, Ay)
|
|
5937
|
+
*/
|
|
5938
|
+
declare function privateScalarToPubKey(p: bigint): [bigint, bigint];
|
|
5939
|
+
/**
|
|
5940
|
+
* Convert a BigInt to a Buffer
|
|
5941
|
+
*/
|
|
5942
|
+
declare const bigInt2Buffer: (i: BigInt) => Buffer;
|
|
5943
|
+
declare const hexString2Buffer: (i: string) => Buffer;
|
|
5944
|
+
declare const buffer2HexString: (i: Buffer) => string;
|
|
5945
|
+
declare const uint8ArrayToHex: (uint8Array: Uint8Array | any) => string;
|
|
5946
|
+
/**
|
|
5947
|
+
* Convert an EC extended point into an array of two bigints
|
|
5948
|
+
*/
|
|
5949
|
+
declare function toBigIntArray(point: BabyJubExtPoint): [bigint, bigint];
|
|
5950
|
+
/**
|
|
5951
|
+
* Convert an EC extended point into an array of two strings
|
|
5952
|
+
*/
|
|
5953
|
+
declare function toStringArray(point: BabyJubExtPoint): [string, string];
|
|
5954
|
+
declare function combineTwoPublicKeys(pubKey1: bigint[], pubKey2: bigint[]): bigint[];
|
|
5955
|
+
declare function combineTwoPublicKeysPlain(pubKey1: bigint[], pubKey2: bigint[]): bigint[];
|
|
5956
|
+
/**
|
|
5957
|
+
* Convert two strings x and y into an EC extended point
|
|
5958
|
+
*/
|
|
5959
|
+
declare function coordinatesToExtPoint(x: string, y: string): BabyJubExtPoint;
|
|
5960
|
+
declare const bufferToBigInt: (buf: Buffer | Uint8Array) => bigint;
|
|
5961
|
+
declare function coordinatesToExtPointBigint(x: bigint, y: bigint): BabyJubExtPoint;
|
|
5962
|
+
declare function portableArgon2(data: Buffer, options?: {
|
|
5963
|
+
memory: number;
|
|
5964
|
+
iterations: number;
|
|
5965
|
+
parallelism: number;
|
|
5966
|
+
}): Buffer;
|
|
5967
|
+
/**
|
|
5968
|
+
* Returns a Uint8Array of cryptographically secure random bytes.
|
|
5969
|
+
* This function works in both browser and Node.js environments.
|
|
5970
|
+
* In browsers, it uses window.crypto.getRandomValues.
|
|
5971
|
+
* In Node.js, it uses require('crypto').randomBytes if available.
|
|
5972
|
+
* @param length Number of random bytes to generate.
|
|
5973
|
+
* @returns Uint8Array of random bytes.
|
|
5974
|
+
*/
|
|
5975
|
+
declare function portableRandomBytes(length: number): Buffer;
|
|
5976
|
+
declare function generateNonces(): bigint[];
|
|
5977
|
+
declare function HEEncryptFromPoint(message: bigint, pubKey: ExtPointType, nonces?: bigint[], exportNonces?: boolean): {
|
|
5978
|
+
ephemeral_keys: ExtPointType[];
|
|
5979
|
+
encrypted_messages: ExtPointType[];
|
|
5980
|
+
nonces: bigint[];
|
|
5981
|
+
};
|
|
5982
|
+
declare function SimpelElgamalEncrypt(message: bigint, pubKey: PubKey, bitSize?: number): {
|
|
5983
|
+
ephemeral_key: string;
|
|
5984
|
+
encrypted_message: string;
|
|
5985
|
+
};
|
|
5986
|
+
declare function SimpelElgamalDecrypt(encrypted_message: string, ephemeral_key: string, privKey: PrivKey): bigint;
|
|
5987
|
+
declare function HEEncrypt(message: bigint, pubKey: bigint[], nonces?: bigint[], exportNonces?: boolean): {
|
|
5988
|
+
ephemeral_keys: ExtPointType[];
|
|
5989
|
+
encrypted_messages: ExtPointType[];
|
|
5990
|
+
nonces: bigint[];
|
|
5991
|
+
};
|
|
5992
|
+
declare function HEDecryptExternalSolver(privKey: bigint, cypherTexts: bigint[], ephemeralKeys: bigint[], solve: (base_x: bigint, base_y: bigint, encoded_x: bigint, encoded_y: bigint) => bigint): Promise<bigint>;
|
|
5993
|
+
declare function HEDecrypt(privKey: bigint, cypherTexts: bigint[], ephemeralKeys: bigint[]): Promise<bigint>;
|
|
5994
|
+
declare function HEDecryptSync(privKey: bigint, cypherTexts: bigint[], ephemeralKeys: bigint[]): bigint;
|
|
5995
|
+
declare const hashExtPoints: (extPoints: ExtPointType[]) => bigint;
|
|
5996
|
+
declare const hashCypherText: (message: bigint[], ephemeralKey: bigint[], relatedPublicKey: bigint[], preimage_hash: any, random_value: bigint, unseal_condition_root_hash: any, metadata_root_commit: any) => bigint;
|
|
5997
|
+
declare function pruneTo64Bits(originalValue: bigint): bigint;
|
|
5998
|
+
declare function pruneTo32Bits(bigInt253Bit: bigint): bigint;
|
|
5999
|
+
/**
|
|
6000
|
+
* - Returns a signal value similar to the "callGetSignalByName" function from the "circom-helper" package.
|
|
6001
|
+
* - This function depends on the "circom_tester" package.
|
|
6002
|
+
*
|
|
6003
|
+
* Example usage:
|
|
6004
|
+
*
|
|
6005
|
+
* ```typescript
|
|
6006
|
+
* const wasm_tester = require('circom_tester').wasm;
|
|
6007
|
+
*
|
|
6008
|
+
* /// the circuit is loaded only once and it is available for use across multiple test cases.
|
|
6009
|
+
* const circuit = await wasm_tester(path.resolve("./circuit/path"));
|
|
6010
|
+
* const witness = await circuit.calculateWitness(inputsObject);
|
|
6011
|
+
* await circuit.checkConstraints(witness);
|
|
6012
|
+
* await circuit.loadSymbols();
|
|
6013
|
+
*
|
|
6014
|
+
* /// You can check signal names by printing "circuit.symbols".
|
|
6015
|
+
* /// You will mostly need circuit inputs and outputs.
|
|
6016
|
+
* const singalName = 'main.out'
|
|
6017
|
+
* const signalValue = getSignalByName(circuit, witness, SignalName)
|
|
6018
|
+
* ```
|
|
6019
|
+
*/
|
|
6020
|
+
declare const getSignalByName: (circuit: any, witness: any, signalName: string) => any;
|
|
6021
|
+
/**
|
|
6022
|
+
* Encrypts a BigInt value using AES-256-CBC encryption
|
|
6023
|
+
* @param value - The BigInt value to encrypt
|
|
6024
|
+
* @param key - The encryption key as a BigInt
|
|
6025
|
+
* @returns The encrypted value as a hex string
|
|
6026
|
+
*/
|
|
6027
|
+
declare function encryptAESBigInt(value: bigint, key: bigint): string;
|
|
6028
|
+
/**
|
|
6029
|
+
* Decrypts a hex string back to a BigInt value using AES-256-CBC decryption
|
|
6030
|
+
* @param encryptedHex - The encrypted value as a hex string
|
|
6031
|
+
* @param key - The decryption key as a BigInt
|
|
6032
|
+
* @returns The decrypted BigInt value
|
|
6033
|
+
*/
|
|
6034
|
+
declare function decryptAESBigInt(encryptedHex: string, key: bigint): bigint;
|
|
6035
|
+
declare function toBytesLE(bn: bigint, length?: number): Uint8Array;
|
|
6036
|
+
declare function fromBytesLE(bytes: Uint8Array): bigint;
|
|
6037
|
+
declare function encryptECCBabyJub(message: bigint, recipientPubKey: PubKey, nonce?: bigint | undefined, emperalKey?: ExtPointType | undefined): {
|
|
6038
|
+
ciphertextHex: string;
|
|
6039
|
+
R: {
|
|
6040
|
+
x: string;
|
|
6041
|
+
y: string;
|
|
6042
|
+
};
|
|
6043
|
+
};
|
|
6044
|
+
declare function decryptECCBabyJub(ciphertextHex: string, RHex: {
|
|
6045
|
+
x: string;
|
|
6046
|
+
y: string;
|
|
6047
|
+
}, recipientPrivKey: PrivKey): bigint;
|
|
6048
|
+
/**
|
|
6049
|
+
* Returns a BabyJub-compatible random value. We create it by first generating
|
|
6050
|
+
* a random value (initially 256 bits large) modulo the snark field size as
|
|
6051
|
+
* described in EIP197. This results in a key size of roughly 253 bits and no
|
|
6052
|
+
* more than 254 bits. To prevent modulo bias, we then use this efficient
|
|
6053
|
+
* algorithm:
|
|
6054
|
+
* http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/crypt/arc4random_uniform.c
|
|
6055
|
+
* @return A BabyJub-compatible random value.
|
|
6056
|
+
* @see {@link https://github.com/privacy-scaling-explorations/maci/blob/master/crypto/ts/index.ts}
|
|
5907
6057
|
*/
|
|
5908
|
-
|
|
6058
|
+
declare function genRandomBabyJubValue(): bigint;
|
|
6059
|
+
declare function genSmallRandomBabyJubValue(): bigint;
|
|
5909
6060
|
/**
|
|
5910
|
-
*
|
|
5911
|
-
* Packages marked as public can be shared externally to watch for events that relate to
|
|
5912
|
-
* initiation of the revealing phase. Can be sent to centralized services to notify them of events.
|
|
5913
|
-
*
|
|
6061
|
+
* @return A BabyJub-compatible private key.
|
|
5914
6062
|
*/
|
|
5915
|
-
|
|
6063
|
+
declare const genPrivKey: () => PrivKey;
|
|
5916
6064
|
/**
|
|
5917
|
-
*
|
|
5918
|
-
* This meant to be stored behind a password, here might live potentially linkable information.
|
|
5919
|
-
* There is no direct purpose for this package YET.
|
|
6065
|
+
* @return A BabyJub-compatible salt.
|
|
5920
6066
|
*/
|
|
5921
|
-
|
|
6067
|
+
declare const genRandomSalt: () => PrivKey;
|
|
5922
6068
|
/**
|
|
5923
|
-
*
|
|
5924
|
-
*
|
|
5925
|
-
* Packages marked as private can be used to initiate the revealing phase
|
|
6069
|
+
* @param privKey A private key generated using genPrivKey()
|
|
6070
|
+
* @return A public key associated with the private key
|
|
5926
6071
|
*/
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
circuit_id: HexString;
|
|
5930
|
-
inputfield_name: string;
|
|
5931
|
-
value: HexString;
|
|
5932
|
-
};
|
|
5933
|
-
type ChainedCircuitInput = {
|
|
5934
|
-
source_circuit_id: HexString;
|
|
5935
|
-
source_circuit_index: number;
|
|
5936
|
-
target_circuit_id: HexString;
|
|
5937
|
-
outputfield_index: number;
|
|
5938
|
-
inputfield_name: string;
|
|
5939
|
-
};
|
|
5940
|
-
type RevealCondition = {
|
|
5941
|
-
address: HexString;
|
|
5942
|
-
circuit_id: HexString;
|
|
5943
|
-
static_inputs: StaticCircuitInput[];
|
|
5944
|
-
chained_inputs: ChainedCircuitInput[];
|
|
5945
|
-
random_value: HexString;
|
|
5946
|
-
proof: any;
|
|
5947
|
-
public_signals: any;
|
|
5948
|
-
};
|
|
6072
|
+
declare function genPubKey(privKey: PrivKey): PubKey;
|
|
6073
|
+
declare function genKeypair(scalar?: bigint): Keypair;
|
|
5949
6074
|
/**
|
|
5950
|
-
*
|
|
5951
|
-
*
|
|
5952
|
-
*
|
|
6075
|
+
* Encrypts a plaintext such that only the owner of the specified public key
|
|
6076
|
+
* may decrypt it.
|
|
6077
|
+
* @param pubKey The recepient's public key
|
|
6078
|
+
* @param encodedMessage A plaintext encoded as a BabyJub curve point (optional)
|
|
6079
|
+
* @param randomVal A random value y used along with the private key to generate the ciphertext (optional)
|
|
5953
6080
|
*/
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
proof: any;
|
|
5960
|
-
public_signals: any;
|
|
5961
|
-
};
|
|
5962
|
-
type UnsealRevealConditionRequest = {
|
|
5963
|
-
proof: HexString;
|
|
5964
|
-
commitment: HexString;
|
|
5965
|
-
public_signals: HexString[];
|
|
5966
|
-
};
|
|
5967
|
-
type RevealConditionRequestResponse = {
|
|
5968
|
-
address: HexString;
|
|
5969
|
-
circuit_id: HexString;
|
|
5970
|
-
hashed_input_fields: HexString;
|
|
5971
|
-
random_value: HexString;
|
|
5972
|
-
signature_S: HexString;
|
|
5973
|
-
signature_R8x: HexString;
|
|
5974
|
-
signature_R8y: HexString;
|
|
5975
|
-
};
|
|
5976
|
-
type SingleSealRequest = {
|
|
5977
|
-
address: HexString;
|
|
5978
|
-
circuit_id: HexString;
|
|
5979
|
-
hashed_reveal_value_preimage: HexString;
|
|
5980
|
-
hashed_unseal_condition_root: HexString;
|
|
5981
|
-
hashed_metadata_root: HexString;
|
|
5982
|
-
require_proof: boolean;
|
|
5983
|
-
};
|
|
5984
|
-
type SingleSealRequestResponse = {
|
|
5985
|
-
address: HexString;
|
|
5986
|
-
circuit_id: HexString;
|
|
5987
|
-
cyphertexts: [
|
|
5988
|
-
HexString,
|
|
5989
|
-
HexString,
|
|
5990
|
-
HexString,
|
|
5991
|
-
HexString,
|
|
5992
|
-
HexString,
|
|
5993
|
-
HexString,
|
|
5994
|
-
HexString,
|
|
5995
|
-
HexString,
|
|
5996
|
-
HexString,
|
|
5997
|
-
HexString,
|
|
5998
|
-
HexString,
|
|
5999
|
-
HexString,
|
|
6000
|
-
HexString,
|
|
6001
|
-
HexString,
|
|
6002
|
-
HexString,
|
|
6003
|
-
HexString
|
|
6004
|
-
];
|
|
6005
|
-
empheral_keys: [
|
|
6006
|
-
HexString,
|
|
6007
|
-
HexString,
|
|
6008
|
-
HexString,
|
|
6009
|
-
HexString,
|
|
6010
|
-
HexString,
|
|
6011
|
-
HexString,
|
|
6012
|
-
HexString,
|
|
6013
|
-
HexString,
|
|
6014
|
-
HexString,
|
|
6015
|
-
HexString,
|
|
6016
|
-
HexString,
|
|
6017
|
-
HexString,
|
|
6018
|
-
HexString,
|
|
6019
|
-
HexString,
|
|
6020
|
-
HexString,
|
|
6021
|
-
HexString
|
|
6022
|
-
];
|
|
6023
|
-
signature_S: HexString;
|
|
6024
|
-
signature_R8x: HexString;
|
|
6025
|
-
signature_R8y: HexString;
|
|
6026
|
-
new_public_key: [HexString, HexString];
|
|
6027
|
-
severed_commitment_random_value: HexString;
|
|
6028
|
-
proof: HexString;
|
|
6029
|
-
public_signals: HexString[];
|
|
6030
|
-
hashed_unseal_condition_root: HexString;
|
|
6031
|
-
hashed_metadata_root: HexString;
|
|
6032
|
-
};
|
|
6033
|
-
type SingleUnsealRequest = {
|
|
6034
|
-
address: HexString;
|
|
6035
|
-
circuit_id: HexString;
|
|
6036
|
-
public_key: [HexString, HexString];
|
|
6037
|
-
signature_S: HexString;
|
|
6038
|
-
signature_R8x: HexString;
|
|
6039
|
-
signature_R8y: HexString;
|
|
6040
|
-
proof: HexString;
|
|
6041
|
-
public_signals: HexString[][];
|
|
6042
|
-
proofs: HexString[];
|
|
6043
|
-
empheral_keys: HexString[];
|
|
6044
|
-
cyphertexts: HexString[];
|
|
6045
|
-
data_stream_address: HexString;
|
|
6046
|
-
unseal_proof_actions: UnsealProofAction[];
|
|
6047
|
-
unseal_root_proof: ProofPath;
|
|
6048
|
-
};
|
|
6049
|
-
type SingleSealStoragePackage$1 = {
|
|
6050
|
-
private_package: SingleShareSealPrivatePackage;
|
|
6051
|
-
public_package: SingleShareSealPublicPackage;
|
|
6052
|
-
hidden_package: SingleShareSealHiddenPackage;
|
|
6053
|
-
};
|
|
6054
|
-
type ECCEncryptedMessage = {
|
|
6055
|
-
ciphertextHex: HexString;
|
|
6056
|
-
R: {
|
|
6057
|
-
x: HexString;
|
|
6058
|
-
y: HexString;
|
|
6059
|
-
};
|
|
6060
|
-
};
|
|
6061
|
-
type UnsealConditionTemplateExport = {
|
|
6062
|
-
name: string;
|
|
6063
|
-
description: string;
|
|
6064
|
-
unseal_proof_actions: UnsealProofAction[][];
|
|
6065
|
-
user_inputs: RequiredUserInput[][];
|
|
6066
|
-
used_input_mapping: {
|
|
6067
|
-
[key: string]: string;
|
|
6068
|
-
};
|
|
6069
|
-
compiled_collection: CompiledCollectionExport;
|
|
6070
|
-
collection_id: string;
|
|
6081
|
+
declare function encrypt(pubKey: PubKey, encodedMessage: BabyJubExtPoint, randomVal?: bigint): {
|
|
6082
|
+
message: ExtPointType;
|
|
6083
|
+
ephemeral_key: ExtPointType;
|
|
6084
|
+
encrypted_message: ExtPointType;
|
|
6085
|
+
nonce: bigint;
|
|
6071
6086
|
};
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
unseal_condition_root: HexString;
|
|
6082
|
-
metadata_root: HexString;
|
|
6083
|
-
unseal_template: UnsealConditionTemplateExport;
|
|
6084
|
-
proving_hints: any;
|
|
6085
|
-
unseal_collection_id: string;
|
|
6087
|
+
/**
|
|
6088
|
+
* Decrypts a ciphertext using a private key.
|
|
6089
|
+
* @param privKey The private key
|
|
6090
|
+
* @param ciphertext The ciphertext to decrypt
|
|
6091
|
+
*/
|
|
6092
|
+
declare function decrypt(privKey: PrivKey, ephemeral_key: BabyJubExtPoint, encrypted_message: BabyJubExtPoint): BabyJubExtPoint;
|
|
6093
|
+
declare function HEAdd(empheralKey1: ExtPointType, empheralKey2: ExtPointType, encryptedMessage1: ExtPointType, encryptedMessage2: ExtPointType): {
|
|
6094
|
+
ephemeralKey: ExtPointType;
|
|
6095
|
+
encryptedMessage: ExtPointType;
|
|
6086
6096
|
};
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
circuit_id: HexString;
|
|
6091
|
-
data_stream_ids: HexString[];
|
|
6092
|
-
proof: any;
|
|
6093
|
-
public_signals: any;
|
|
6094
|
-
data_stream_urls: string[];
|
|
6095
|
-
processor_url: string;
|
|
6097
|
+
declare function HEAddAll(empheralKeys1: ExtPointType[], empheralKeys2: ExtPointType[], encryptedMessages1: ExtPointType[], encryptedMessages2: ExtPointType[]): {
|
|
6098
|
+
ephemeralKeys: ExtPointType[];
|
|
6099
|
+
encryptedMessages: ExtPointType[];
|
|
6096
6100
|
};
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
secret_ecc_scalar: bigint;
|
|
6101
|
-
ecc_public_key: [bigint, bigint];
|
|
6101
|
+
declare function encrypt_s(message: BabyJubExtPoint, public_key: PubKey, nonce?: bigint): {
|
|
6102
|
+
ephemeral_key: ExtPointType;
|
|
6103
|
+
encrypted_message: ExtPointType;
|
|
6102
6104
|
};
|
|
6103
6105
|
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6106
|
+
/** Canonical uint256 secret material (0x00abc and 0xabc are the same integer). */
|
|
6107
|
+
declare function normalizeSigningKeyMaterial(hexKey: string): bigint;
|
|
6108
|
+
/**
|
|
6109
|
+
* Raw secret bytes for EdDSA (@zk-kit/eddsa-poseidon) from canonical integer hex.
|
|
6110
|
+
* Leading zero nybbles in the env string are not preserved as extra bytes.
|
|
6111
|
+
*/
|
|
6112
|
+
declare function hexToSkBuffer(hexKey: string): Buffer;
|
|
6113
|
+
/**
|
|
6114
|
+
* Derive the scalar used inside the HE (ElGamal) key derivation.
|
|
6115
|
+
* This is `formatPrivKeyForBabyJub(BigInt(hexKey))` and matches the scalar
|
|
6116
|
+
* used in `genPubKey` / `HEDecrypt` / `encrypt`.
|
|
6117
|
+
*
|
|
6118
|
+
* @param hexKey 0x-prefixed 32-byte private key hex string
|
|
6119
|
+
*/
|
|
6120
|
+
declare function deriveHEKeyScalar(hexKey: string): bigint;
|
|
6121
|
+
/**
|
|
6122
|
+
* Derive the HE public key `[x, y]` from a raw private key hex string.
|
|
6123
|
+
* Equivalent to `genPubKey(BigInt(hexKey))` but accepts a hex string and
|
|
6124
|
+
* returns affine coordinates rather than an ExtPointType.
|
|
6125
|
+
*
|
|
6126
|
+
* @param hexKey 0x-prefixed 32-byte private key hex string
|
|
6127
|
+
*/
|
|
6128
|
+
declare function deriveHEPublicKey(hexKey: string): [bigint, bigint];
|
|
6129
|
+
/**
|
|
6130
|
+
* Derive the scalar used inside the EdDSA signing key derivation (Schnorr PoK).
|
|
6131
|
+
* Matches `@zk-kit/eddsa-poseidon.deriveSecretScalar`.
|
|
6132
|
+
*
|
|
6133
|
+
* @param hexKey 0x-prefixed private key hex string
|
|
6134
|
+
*/
|
|
6135
|
+
declare function deriveSigningKeyScalar(hexKey: string): Promise<bigint>;
|
|
6136
|
+
/**
|
|
6137
|
+
* Derive the EdDSA signing public key `[x, y]` from a raw private key hex string.
|
|
6138
|
+
* Matches `@zk-kit/eddsa-poseidon.derivePublicKey` used by the Processor and circuits.
|
|
6139
|
+
*
|
|
6140
|
+
* @param hexKey 0x-prefixed private key hex string
|
|
6141
|
+
*/
|
|
6142
|
+
declare function deriveSigningPublicKey(hexKey: string): Promise<[bigint, bigint]>;
|
|
6143
|
+
|
|
6144
|
+
type tools_d_BabyJubAffinePoint = BabyJubAffinePoint;
|
|
6145
|
+
type tools_d_BabyJubExtPoint = BabyJubExtPoint;
|
|
6146
|
+
declare const tools_d_HEAdd: typeof HEAdd;
|
|
6147
|
+
declare const tools_d_HEAddAll: typeof HEAddAll;
|
|
6148
|
+
declare const tools_d_HEDecrypt: typeof HEDecrypt;
|
|
6149
|
+
declare const tools_d_HEDecryptExternalSolver: typeof HEDecryptExternalSolver;
|
|
6150
|
+
declare const tools_d_HEDecryptSync: typeof HEDecryptSync;
|
|
6151
|
+
declare const tools_d_HEEncrypt: typeof HEEncrypt;
|
|
6152
|
+
declare const tools_d_HEEncryptFromPoint: typeof HEEncryptFromPoint;
|
|
6153
|
+
type tools_d_Keypair = Keypair;
|
|
6154
|
+
type tools_d_PrivKey = PrivKey;
|
|
6155
|
+
type tools_d_PubKey = PubKey;
|
|
6156
|
+
declare const tools_d_SNARK_FIELD_SIZE: typeof SNARK_FIELD_SIZE;
|
|
6157
|
+
declare const tools_d_SimpelElgamalDecrypt: typeof SimpelElgamalDecrypt;
|
|
6158
|
+
declare const tools_d_SimpelElgamalEncrypt: typeof SimpelElgamalEncrypt;
|
|
6159
|
+
declare const tools_d_babyJub: typeof babyJub;
|
|
6160
|
+
declare const tools_d_bigInt2Buffer: typeof bigInt2Buffer;
|
|
6161
|
+
declare const tools_d_buffer2HexString: typeof buffer2HexString;
|
|
6162
|
+
declare const tools_d_bufferToBigInt: typeof bufferToBigInt;
|
|
6163
|
+
declare const tools_d_combineChunksWithCarry: typeof combineChunksWithCarry;
|
|
6164
|
+
declare const tools_d_combineTwoPublicKeys: typeof combineTwoPublicKeys;
|
|
6165
|
+
declare const tools_d_combineTwoPublicKeysPlain: typeof combineTwoPublicKeysPlain;
|
|
6166
|
+
declare const tools_d_coordinatesToExtPoint: typeof coordinatesToExtPoint;
|
|
6167
|
+
declare const tools_d_coordinatesToExtPointBigint: typeof coordinatesToExtPointBigint;
|
|
6168
|
+
declare const tools_d_createNobleBlakeHash: typeof createNobleBlakeHash;
|
|
6169
|
+
declare const tools_d_decrypt: typeof decrypt;
|
|
6170
|
+
declare const tools_d_decryptAESBigInt: typeof decryptAESBigInt;
|
|
6171
|
+
declare const tools_d_decryptECCBabyJub: typeof decryptECCBabyJub;
|
|
6172
|
+
declare const tools_d_deriveHEKeyScalar: typeof deriveHEKeyScalar;
|
|
6173
|
+
declare const tools_d_deriveHEPublicKey: typeof deriveHEPublicKey;
|
|
6174
|
+
declare const tools_d_deriveSigningKeyScalar: typeof deriveSigningKeyScalar;
|
|
6175
|
+
declare const tools_d_deriveSigningPublicKey: typeof deriveSigningPublicKey;
|
|
6176
|
+
declare const tools_d_encrypt: typeof encrypt;
|
|
6177
|
+
declare const tools_d_encryptAESBigInt: typeof encryptAESBigInt;
|
|
6178
|
+
declare const tools_d_encryptECCBabyJub: typeof encryptECCBabyJub;
|
|
6179
|
+
declare const tools_d_encrypt_s: typeof encrypt_s;
|
|
6180
|
+
declare const tools_d_ffEncodedToBigInt: typeof ffEncodedToBigInt;
|
|
6181
|
+
declare const tools_d_formatPrivKeyForBabyJub: typeof formatPrivKeyForBabyJub;
|
|
6182
|
+
declare const tools_d_fromBytesLE: typeof fromBytesLE;
|
|
6183
|
+
declare const tools_d_genKeypair: typeof genKeypair;
|
|
6184
|
+
declare const tools_d_genPrivKey: typeof genPrivKey;
|
|
6185
|
+
declare const tools_d_genPubKey: typeof genPubKey;
|
|
6186
|
+
declare const tools_d_genRandomBabyJubValue: typeof genRandomBabyJubValue;
|
|
6187
|
+
declare const tools_d_genRandomSalt: typeof genRandomSalt;
|
|
6188
|
+
declare const tools_d_genSmallRandomBabyJubValue: typeof genSmallRandomBabyJubValue;
|
|
6189
|
+
declare const tools_d_generateNonces: typeof generateNonces;
|
|
6190
|
+
declare const tools_d_generateRandom240BitNumber: typeof generateRandom240BitNumber;
|
|
6191
|
+
declare const tools_d_generateRandom248BitNumber: typeof generateRandom248BitNumber;
|
|
6192
|
+
declare const tools_d_getSignalByName: typeof getSignalByName;
|
|
6193
|
+
declare const tools_d_hashCypherText: typeof hashCypherText;
|
|
6194
|
+
declare const tools_d_hashExtPoints: typeof hashExtPoints;
|
|
6195
|
+
declare const tools_d_hexString2Buffer: typeof hexString2Buffer;
|
|
6196
|
+
declare const tools_d_hexToSkBuffer: typeof hexToSkBuffer;
|
|
6197
|
+
declare const tools_d_normalizeSigningKeyMaterial: typeof normalizeSigningKeyMaterial;
|
|
6198
|
+
declare const tools_d_portableArgon2: typeof portableArgon2;
|
|
6199
|
+
declare const tools_d_portableRandomBytes: typeof portableRandomBytes;
|
|
6200
|
+
declare const tools_d_privateScalarToPubKey: typeof privateScalarToPubKey;
|
|
6201
|
+
declare const tools_d_pruneBuffer: typeof pruneBuffer;
|
|
6202
|
+
declare const tools_d_pruneTo32Bits: typeof pruneTo32Bits;
|
|
6203
|
+
declare const tools_d_pruneTo64Bits: typeof pruneTo64Bits;
|
|
6204
|
+
declare const tools_d_prv2pub: typeof prv2pub;
|
|
6205
|
+
declare const tools_d_shrinkToBits: typeof shrinkToBits;
|
|
6206
|
+
declare const tools_d_splitLargeNumber: typeof splitLargeNumber;
|
|
6207
|
+
declare const tools_d_stringToCurve: typeof stringToCurve;
|
|
6208
|
+
declare const tools_d_stringifyBigInts: typeof stringifyBigInts;
|
|
6209
|
+
declare const tools_d_toBigIntArray: typeof toBigIntArray;
|
|
6210
|
+
declare const tools_d_toBytesLE: typeof toBytesLE;
|
|
6211
|
+
declare const tools_d_toStringArray: typeof toStringArray;
|
|
6212
|
+
declare const tools_d_uint8ArrayToHex: typeof uint8ArrayToHex;
|
|
6213
|
+
declare const tools_d_unstringifyBigInts: typeof unstringifyBigInts;
|
|
6214
|
+
declare namespace tools_d {
|
|
6215
|
+
export { tools_d_HEAdd as HEAdd, tools_d_HEAddAll as HEAddAll, tools_d_HEDecrypt as HEDecrypt, tools_d_HEDecryptExternalSolver as HEDecryptExternalSolver, tools_d_HEDecryptSync as HEDecryptSync, tools_d_HEEncrypt as HEEncrypt, tools_d_HEEncryptFromPoint as HEEncryptFromPoint, tools_d_SNARK_FIELD_SIZE as SNARK_FIELD_SIZE, tools_d_SimpelElgamalDecrypt as SimpelElgamalDecrypt, tools_d_SimpelElgamalEncrypt as SimpelElgamalEncrypt, tools_d_babyJub as babyJub, tools_d_bigInt2Buffer as bigInt2Buffer, tools_d_buffer2HexString as buffer2HexString, tools_d_bufferToBigInt as bufferToBigInt, tools_d_combineChunksWithCarry as combineChunksWithCarry, tools_d_combineTwoPublicKeys as combineTwoPublicKeys, tools_d_combineTwoPublicKeysPlain as combineTwoPublicKeysPlain, tools_d_coordinatesToExtPoint as coordinatesToExtPoint, tools_d_coordinatesToExtPointBigint as coordinatesToExtPointBigint, tools_d_createNobleBlakeHash as createNobleBlakeHash, tools_d_decrypt as decrypt, tools_d_decryptAESBigInt as decryptAESBigInt, tools_d_decryptECCBabyJub as decryptECCBabyJub, tools_d_deriveHEKeyScalar as deriveHEKeyScalar, tools_d_deriveHEPublicKey as deriveHEPublicKey, tools_d_deriveSigningKeyScalar as deriveSigningKeyScalar, tools_d_deriveSigningPublicKey as deriveSigningPublicKey, tools_d_encrypt as encrypt, tools_d_encryptAESBigInt as encryptAESBigInt, tools_d_encryptECCBabyJub as encryptECCBabyJub, tools_d_encrypt_s as encrypt_s, tools_d_ffEncodedToBigInt as ffEncodedToBigInt, tools_d_formatPrivKeyForBabyJub as formatPrivKeyForBabyJub, tools_d_fromBytesLE as fromBytesLE, tools_d_genKeypair as genKeypair, tools_d_genPrivKey as genPrivKey, tools_d_genPubKey as genPubKey, tools_d_genRandomBabyJubValue as genRandomBabyJubValue, tools_d_genRandomSalt as genRandomSalt, tools_d_genSmallRandomBabyJubValue as genSmallRandomBabyJubValue, tools_d_generateNonces as generateNonces, tools_d_generateRandom240BitNumber as generateRandom240BitNumber, tools_d_generateRandom248BitNumber as generateRandom248BitNumber, tools_d_getSignalByName as getSignalByName, tools_d_hashCypherText as hashCypherText, tools_d_hashExtPoints as hashExtPoints, tools_d_hexString2Buffer as hexString2Buffer, tools_d_hexToSkBuffer as hexToSkBuffer, tools_d_normalizeSigningKeyMaterial as normalizeSigningKeyMaterial, tools_d_portableArgon2 as portableArgon2, tools_d_portableRandomBytes as portableRandomBytes, poseidonLite as poseidonTools, tools_d_privateScalarToPubKey as privateScalarToPubKey, tools_d_pruneBuffer as pruneBuffer, tools_d_pruneTo32Bits as pruneTo32Bits, tools_d_pruneTo64Bits as pruneTo64Bits, tools_d_prv2pub as prv2pub, tools_d_shrinkToBits as shrinkToBits, tools_d_splitLargeNumber as splitLargeNumber, tools_d_stringToCurve as stringToCurve, tools_d_stringifyBigInts as stringifyBigInts, tools_d_toBigIntArray as toBigIntArray, tools_d_toBytesLE as toBytesLE, tools_d_toStringArray as toStringArray, tools_d_uint8ArrayToHex as uint8ArrayToHex, tools_d_unstringifyBigInts as unstringifyBigInts };
|
|
6216
|
+
export type { tools_d_BabyJubAffinePoint as BabyJubAffinePoint, tools_d_BabyJubExtPoint as BabyJubExtPoint, tools_d_Keypair as Keypair, tools_d_PrivKey as PrivKey, tools_d_PubKey as PubKey };
|
|
6217
|
+
}
|
|
6218
|
+
|
|
6219
|
+
declare function toPaddedHex(bn: bigint, length?: number): string;
|
|
6220
|
+
declare const ZERO = 7507787612525723758659662260399184323980001748885802124580171315331567144978n;
|
|
6221
|
+
declare const ZERO_KECCAK = "0x937759b0c00d3bc82439e3acdb505be98d7bca79f508bb77a8bfafc2666260a6";
|
|
6222
|
+
/**
|
|
6223
|
+
* The the MimC tree hash function,
|
|
6224
|
+
* If wanting to hash a single value set right to 0n
|
|
6225
|
+
* @param left
|
|
6226
|
+
* @param right
|
|
6227
|
+
* @returns
|
|
6228
|
+
*/
|
|
6229
|
+
declare var treeHasher: (left: any, right: any) => any;
|
|
6230
|
+
/**
|
|
6231
|
+
* Creates a merkle tree with the mimc hash function from circomlibjs
|
|
6232
|
+
* @param depth
|
|
6233
|
+
* @param leaves
|
|
6234
|
+
* @returns
|
|
6235
|
+
*/
|
|
6236
|
+
declare var keccakTreeHasher: (left: any, right: any) => any;
|
|
6237
|
+
declare function createMimcMerkelTree(depth: number, leaves: string[]): Promise<MerkleTree>;
|
|
6238
|
+
declare function createKeccakMerkelTree(depth: number, leaves: string[]): Promise<MerkleTree>;
|
|
6239
|
+
declare function createKeccakMerkelTreeSync(depth: number, leaves: string[]): MerkleTree;
|
|
6240
|
+
declare function signDataInsertRequestJWT(data: HexString$1[], global_tree_index: number, inserted_at: number, secret: Signer): Promise<string>;
|
|
6241
|
+
|
|
6242
|
+
declare const utils_d_ZERO: typeof ZERO;
|
|
6243
|
+
declare const utils_d_ZERO_KECCAK: typeof ZERO_KECCAK;
|
|
6244
|
+
declare const utils_d_createKeccakMerkelTree: typeof createKeccakMerkelTree;
|
|
6245
|
+
declare const utils_d_createKeccakMerkelTreeSync: typeof createKeccakMerkelTreeSync;
|
|
6246
|
+
declare const utils_d_createMimcMerkelTree: typeof createMimcMerkelTree;
|
|
6247
|
+
declare const utils_d_keccakTreeHasher: typeof keccakTreeHasher;
|
|
6248
|
+
declare const utils_d_signDataInsertRequestJWT: typeof signDataInsertRequestJWT;
|
|
6249
|
+
declare const utils_d_toPaddedHex: typeof toPaddedHex;
|
|
6250
|
+
declare const utils_d_treeHasher: typeof treeHasher;
|
|
6251
|
+
declare namespace utils_d {
|
|
6252
|
+
export {
|
|
6253
|
+
utils_d_ZERO as ZERO,
|
|
6254
|
+
utils_d_ZERO_KECCAK as ZERO_KECCAK,
|
|
6255
|
+
utils_d_createKeccakMerkelTree as createKeccakMerkelTree,
|
|
6256
|
+
utils_d_createKeccakMerkelTreeSync as createKeccakMerkelTreeSync,
|
|
6257
|
+
utils_d_createMimcMerkelTree as createMimcMerkelTree,
|
|
6258
|
+
utils_d_keccakTreeHasher as keccakTreeHasher,
|
|
6259
|
+
utils_d_signDataInsertRequestJWT as signDataInsertRequestJWT,
|
|
6260
|
+
utils_d_toPaddedHex as toPaddedHex,
|
|
6261
|
+
utils_d_treeHasher as treeHasher,
|
|
6262
|
+
};
|
|
6145
6263
|
}
|
|
6146
6264
|
|
|
6147
6265
|
/**
|
|
@@ -6179,75 +6297,6 @@ declare var deployedProtocolContracts: {
|
|
|
6179
6297
|
};
|
|
6180
6298
|
declare function toAddressMap(networkId: number): AddressMap;
|
|
6181
6299
|
|
|
6182
|
-
declare const from_json: (json_object: UnsealConditionTemplateExport, proof_library: ProofLibraryType, module_library: ModuleLibraryType) => UnsealConditionTemplate;
|
|
6183
|
-
declare class UnsealConditionTemplate {
|
|
6184
|
-
name: string;
|
|
6185
|
-
collection_id: string;
|
|
6186
|
-
description: string;
|
|
6187
|
-
proof_library: ProofLibraryType;
|
|
6188
|
-
module_library: ModuleLibraryType;
|
|
6189
|
-
compiled_collection: CompiledCollectionExport;
|
|
6190
|
-
user_inputs: RequiredUserInput[][];
|
|
6191
|
-
unsealProofActions: UnsealProofAction[][];
|
|
6192
|
-
data_streams: DataStreamInput[][];
|
|
6193
|
-
modules: UnsealConditionModule[];
|
|
6194
|
-
used_input_mapping: {
|
|
6195
|
-
[key: string]: any;
|
|
6196
|
-
};
|
|
6197
|
-
private proofs_cache;
|
|
6198
|
-
constructor(name: string, description: string, proof_library: ProofLibraryType, module_library: ModuleLibraryType, compiled_collection: CompiledCollectionExport);
|
|
6199
|
-
export_compiled_to_json(): UnsealConditionTemplateExport;
|
|
6200
|
-
isCompiled(): boolean;
|
|
6201
|
-
private getInputFromMapping;
|
|
6202
|
-
compile(input_mapping: {
|
|
6203
|
-
[key: string]: bigint;
|
|
6204
|
-
}, data_stream_mapping: {
|
|
6205
|
-
[key: string]: string;
|
|
6206
|
-
}, optimize?: boolean): void;
|
|
6207
|
-
address_to_proof(address: string): UnsealConditionProof;
|
|
6208
|
-
/**
|
|
6209
|
-
* Converts V1 unseal proof actions (2D output references via output_proof_index + output_signal_index)
|
|
6210
|
-
* into V2 actions (flat output list with bitmask-based pruning at each chain_proof_verify).
|
|
6211
|
-
*
|
|
6212
|
-
* At each chain_proof_verify:
|
|
6213
|
-
* 1. Append the new proof's outputs to the flat list
|
|
6214
|
-
* 2. Look forward to find which flat entries are still referenced
|
|
6215
|
-
* 3. Build a bitmask (1=keep, 0=remove) over the entire flat list
|
|
6216
|
-
* 4. Prune dead entries
|
|
6217
|
-
*
|
|
6218
|
-
* PASS_SIGNAL and VALIDATE_DATA_ROOT actions are converted from 2D (proof_index, signal_index)
|
|
6219
|
-
* to flat indices into the current output list.
|
|
6220
|
-
*/
|
|
6221
|
-
optimize(unseal_proof_actions: UnsealProofAction[]): UnsealProofAction[];
|
|
6222
|
-
/**
|
|
6223
|
-
* Scans actions from startIdx onward to find which flat list entries
|
|
6224
|
-
* are referenced by future PASS_SIGNAL and VALIDATE_DATA_ROOT actions.
|
|
6225
|
-
* Returns the set of flat indices that are still needed.
|
|
6226
|
-
*/
|
|
6227
|
-
private collectFutureReferences;
|
|
6228
|
-
/**
|
|
6229
|
-
* Finds an UnsealConditionProof by its on-chain verifier address.
|
|
6230
|
-
* Searches through compiled modules to match the verifier_address
|
|
6231
|
-
* in PREPARE_NEXT_PROOF actions to the corresponding proof.
|
|
6232
|
-
*/
|
|
6233
|
-
private getProofByVerifierAddress;
|
|
6234
|
-
getAllDataStreams(): string[];
|
|
6235
|
-
getUnsealProofActions(): UnsealProofAction[][];
|
|
6236
|
-
getExpectedInputs(): string[];
|
|
6237
|
-
getUnsealRootForProof(proof_index: number): Promise<ProofPath>;
|
|
6238
|
-
getUnsealRoot(): Promise<string>;
|
|
6239
|
-
}
|
|
6240
|
-
|
|
6241
|
-
type UnsealConditionTemplate_d_UnsealConditionTemplate = UnsealConditionTemplate;
|
|
6242
|
-
declare const UnsealConditionTemplate_d_UnsealConditionTemplate: typeof UnsealConditionTemplate;
|
|
6243
|
-
declare const UnsealConditionTemplate_d_from_json: typeof from_json;
|
|
6244
|
-
declare namespace UnsealConditionTemplate_d {
|
|
6245
|
-
export {
|
|
6246
|
-
UnsealConditionTemplate_d_UnsealConditionTemplate as UnsealConditionTemplate,
|
|
6247
|
-
UnsealConditionTemplate_d_from_json as from_json,
|
|
6248
|
-
};
|
|
6249
|
-
}
|
|
6250
|
-
|
|
6251
6300
|
interface PaymentProvider {
|
|
6252
6301
|
/**
|
|
6253
6302
|
* Returns a Bearer token string authorising a seal request.
|
|
@@ -6319,70 +6368,6 @@ declare class ClientSingleShareSealingProcess implements IClientSingleShareSeali
|
|
|
6319
6368
|
get_reveal_conditions(): RevealConditionRequest[];
|
|
6320
6369
|
}
|
|
6321
6370
|
|
|
6322
|
-
declare class UnsealConditionCollection {
|
|
6323
|
-
nodes: {
|
|
6324
|
-
[key: string]: CollectionNode;
|
|
6325
|
-
};
|
|
6326
|
-
edges: {
|
|
6327
|
-
[key: string]: CollectionEdge;
|
|
6328
|
-
};
|
|
6329
|
-
comments: {
|
|
6330
|
-
[key: string]: string;
|
|
6331
|
-
};
|
|
6332
|
-
data_streams: CollectionDataStream[];
|
|
6333
|
-
name: string;
|
|
6334
|
-
description: string;
|
|
6335
|
-
starting_node: CollectionNode | undefined;
|
|
6336
|
-
proofLibrary: ProofLibraryType;
|
|
6337
|
-
moduleLibrary: ModuleLibraryType;
|
|
6338
|
-
forks: {
|
|
6339
|
-
[key: string]: string[];
|
|
6340
|
-
};
|
|
6341
|
-
fork_list: string[];
|
|
6342
|
-
private node_to_fork_map;
|
|
6343
|
-
private index_counter;
|
|
6344
|
-
changed_callback: ChangedCallback;
|
|
6345
|
-
constructor(name: string, description: string, proofLibrary: ProofLibraryType, moduleLibrary: ModuleLibraryType, changed_callback?: ChangedCallback);
|
|
6346
|
-
visual_forks(): string[];
|
|
6347
|
-
visual_edges_all(): string[][];
|
|
6348
|
-
visual_edges(fork_id: string): string[];
|
|
6349
|
-
comment(id: string, comment: string): void;
|
|
6350
|
-
add_data_stream(datastream_id: string, from_node_id: string, field_name: string): void;
|
|
6351
|
-
remove_data_stream(datastream_id: string): void;
|
|
6352
|
-
get_data_stream(datastream_id: string): CollectionDataStream | undefined;
|
|
6353
|
-
sort_fork_list(): void;
|
|
6354
|
-
add_node(module: UnsealConditionModule, fork_from_node_id?: string): string;
|
|
6355
|
-
move_node(node_id: string, new_fork_from_node_id: string, at_position?: number): CollectionEdge[];
|
|
6356
|
-
remove_node(node_id: string): void;
|
|
6357
|
-
remove_edge(edge_id: string): void;
|
|
6358
|
-
all_nodes_for_fork(fork_id: string): {
|
|
6359
|
-
nodes: string[];
|
|
6360
|
-
forking: string[];
|
|
6361
|
-
};
|
|
6362
|
-
validate_edge(source_node_id: string | undefined, target_node_id: string | undefined, mapping: [string, any], input_type: CollectionEdgeInput): boolean;
|
|
6363
|
-
add_edge(source_node_id: string | undefined, target_node_id: string | undefined, mapping: [string, any], input_type: CollectionEdgeInput): void;
|
|
6364
|
-
export_to_json(): any;
|
|
6365
|
-
import_from_json(data: any): void;
|
|
6366
|
-
getEdgesToNode(node_id: string): CollectionEdge[];
|
|
6367
|
-
getEdgesFromNode(node_id: string): CollectionEdge[];
|
|
6368
|
-
getCollectionId(): string;
|
|
6369
|
-
generateProofCode(fork_nr: number): string;
|
|
6370
|
-
createTemplate(address_map: AddressMap): UnsealConditionTemplate;
|
|
6371
|
-
createTemplatePerFork(address_map: AddressMap, sorted_nodes: string[], forking: string[]): {
|
|
6372
|
-
compiled_modules: CompiledModule[];
|
|
6373
|
-
user_inputs: RequiredUserInput[];
|
|
6374
|
-
data_stream_inputs: DataStreamInput[];
|
|
6375
|
-
};
|
|
6376
|
-
}
|
|
6377
|
-
|
|
6378
|
-
type UnsealConditionCollection_d_UnsealConditionCollection = UnsealConditionCollection;
|
|
6379
|
-
declare const UnsealConditionCollection_d_UnsealConditionCollection: typeof UnsealConditionCollection;
|
|
6380
|
-
declare namespace UnsealConditionCollection_d {
|
|
6381
|
-
export {
|
|
6382
|
-
UnsealConditionCollection_d_UnsealConditionCollection as UnsealConditionCollection,
|
|
6383
|
-
};
|
|
6384
|
-
}
|
|
6385
|
-
|
|
6386
6371
|
type UnsealingState = {
|
|
6387
6372
|
phase: UnsealingStatus;
|
|
6388
6373
|
seal: SingleSealStoragePackage$1;
|
|
@@ -7043,7 +7028,7 @@ declare const index_browser_d_proofLibrary: typeof proofLibrary;
|
|
|
7043
7028
|
declare const index_browser_d_standardProofs: typeof standardProofs;
|
|
7044
7029
|
declare const index_browser_d_toAddressMap: typeof toAddressMap;
|
|
7045
7030
|
declare namespace index_browser_d {
|
|
7046
|
-
export { index_browser_d_ChainedProofWrapper as ChainedProofWrapper, index_browser_d_ClientSingleShareSealingProcess as ClientSingleShareSealingProcess, index_browser_d_ClientSingleShareUnsealingProcess as ClientSingleShareUnsealingProcess,
|
|
7031
|
+
export { index_browser_d_ChainedProofWrapper as ChainedProofWrapper, index_browser_d_ClientSingleShareSealingProcess as ClientSingleShareSealingProcess, index_browser_d_ClientSingleShareUnsealingProcess as ClientSingleShareUnsealingProcess, index_browser_d_DataStream as DataStream, index_browser_d_DataStreamClient as DataStreamClient, index_browser_d_EmpheralMerkleTreeWrapper as EmpheralMerkleTreeWrapper, index_browser_d_ModuleLibraryType as ModuleLibraryType, index_browser_d_NETWORK_IDS as NETWORK_IDS, index_browser_d_NihiliumPaymentProvider as NihiliumPaymentProvider, index_browser_d_NihiliumPaymentProviderClientAPIKEY_DO_NOT_USE as NihiliumPaymentProviderClientAPIKEY_DO_NOT_USE, index_browser_d_Persistence as Persistence, index_browser_d_Processor as Processor, index_browser_d_ProofLibraryType as ProofLibraryType, index_browser_d_StandardModuleLibrary as StandardModuleLibrary, index_browser_d_StandardProofLibrary as StandardProofLibrary, from_json as collection_from_json, index_browser_d_createRevealOnlyCollection as createRevealOnlyCollection, tools_d as cryptoTools, index_browser_d_deployedProtocolContracts as deployedProtocolContracts, index_browser_d_moduleLibrary as moduleLibrary, index_browser_d_precompute as precompute, index_browser_d_proofLibrary as proofLibrary, index_d as standardModules, index_browser_d_standardProofs as standardProofs, index_browser_d_toAddressMap as toAddressMap, public_d as types, utils_d as utils };
|
|
7047
7032
|
export type { index_browser_d_DualLatestGlobalLeafProofResult as DualLatestGlobalLeafProofResult, index_browser_d_DualProofResult as DualProofResult, index_browser_d_IDataStream as IDataStream, index_browser_d_IDualDataStream as IDualDataStream, index_browser_d_LatestGlobalLeafProofResult as LatestGlobalLeafProofResult, index_browser_d_ProofResult as ProofResult };
|
|
7048
7033
|
}
|
|
7049
7034
|
|
|
@@ -7075,5 +7060,5 @@ declare function getDefaultSealingProcess(chainId?: number): Promise<ClientSingl
|
|
|
7075
7060
|
declare function getDefaultUnsealingProcess(seal: SingleSealStoragePackage$1, chainId?: number): Promise<ClientSingleShareUnsealingProcess>;
|
|
7076
7061
|
declare function preload_circuits(): Promise<void>;
|
|
7077
7062
|
|
|
7078
|
-
export { ChainedProofWrapper, ClientSingleShareSealingProcess, ClientSingleShareUnsealingProcess,
|
|
7063
|
+
export { ChainedProofWrapper, ClientSingleShareSealingProcess, ClientSingleShareUnsealingProcess, DataStream, DataStreamClient, EmpheralMerkleTreeWrapper, ModuleLibraryType, NETWORK_IDS, NihiliumPaymentProvider, NihiliumPaymentProviderClientAPIKEY_DO_NOT_USE, Persistence, Processor, ProofLibraryType, StandardModuleLibrary, StandardProofLibrary, check_if_reveal_value_is_published, from_json as collection_from_json, createRevealOnlyCollection, cryptoTools, deployedProtocolContracts, getDefaultSealingProcess, getDefaultUnsealingProcess, getFullDatastreams, getFullProcessors, getProcessorEndpoint, moduleLibrary, index_browser_d as nhsdk, precompute, preload_circuits, proofLibrary, setApiEndpoint, index_d as standardModules, standardProofs, toAddressMap, public_d as types, utils_d as utils };
|
|
7079
7064
|
export type { DualLatestGlobalLeafProofResult, DualProofResult, IDataStream, IDualDataStream, LatestGlobalLeafProofResult, ProofResult, SingleSealStoragePackage };
|