o1js-pack 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.husky/pre-commit +0 -0
- package/README.md +8 -2
- package/build/src/index.d.ts +5 -5
- package/build/src/index.js +5 -5
- package/build/src/index.js.map +1 -1
- package/build/src/lib/PackingPlant.d.ts +132 -132
- package/build/src/lib/PackingPlant.js +190 -190
- package/build/src/lib/packed-types/PackedBool.d.ts +85 -85
- package/build/src/lib/packed-types/PackedBool.js +49 -49
- package/build/src/lib/packed-types/PackedBool.test.d.ts +1 -1
- package/build/src/lib/packed-types/PackedBool.test.js +75 -75
- package/build/src/lib/packed-types/PackedString.d.ts +181 -181
- package/build/src/lib/packed-types/PackedString.js +127 -127
- package/build/src/lib/packed-types/PackedString.test.d.ts +1 -1
- package/build/src/lib/packed-types/PackedString.test.js +100 -100
- package/build/src/lib/packed-types/PackedUInt32.d.ts +85 -85
- package/build/src/lib/packed-types/PackedUInt32.js +49 -49
- package/build/src/lib/packed-types/PackedUInt32.test.d.ts +1 -1
- package/build/src/lib/packed-types/PackedUInt32.test.js +83 -83
- package/examples/smart_contract/election/README.md +3 -0
- package/examples/smart_contract/election/contract.ts +79 -0
- package/examples/smart_contract/election/run.ts +98 -0
- package/examples/zk_program/age_gate/README.md +7 -0
- package/examples/zk_program/age_gate/circuit.ts +75 -0
- package/examples/zk_program/age_gate/non-packed-circuit.ts +68 -0
- package/examples/zk_program/age_gate/non-packed-run.ts +36 -0
- package/examples/zk_program/age_gate/run.ts +35 -0
- package/package.json +1 -1
@@ -1,76 +1,76 @@
|
|
1
|
-
import { Bool, Provable } from 'o1js';
|
2
|
-
import { PackedBoolFactory } from './PackedBool';
|
3
|
-
describe('PackedBool', () => {
|
4
|
-
const booleans = new Array(127).fill([true, false]).flat();
|
5
|
-
const bools = booleans.map((x) => Bool(x));
|
6
|
-
class PackedBool extends PackedBoolFactory() {
|
7
|
-
}
|
8
|
-
describe('Outside of the circuit', () => {
|
9
|
-
it('#fromBooleans', () => {
|
10
|
-
const myPackedBool = PackedBool.fromBooleans(booleans);
|
11
|
-
expect(myPackedBool.toBooleans()).toMatchObject(booleans);
|
12
|
-
});
|
13
|
-
it('#pack and #unPack', () => {
|
14
|
-
const packed = PackedBool.pack(bools);
|
15
|
-
const unpacked = PackedBool.unpack(packed);
|
16
|
-
expect(unpacked.length).toBe(bools.length);
|
17
|
-
expect(unpacked).toMatchObject(bools);
|
18
|
-
});
|
19
|
-
});
|
20
|
-
describe('Provable Properties', () => {
|
21
|
-
it('#sizeInFields', () => {
|
22
|
-
class one extends PackedBoolFactory(1) {
|
23
|
-
}
|
24
|
-
class two_five_four extends PackedBoolFactory(254) {
|
25
|
-
}
|
26
|
-
expect(one.sizeInFields()).toBe(1);
|
27
|
-
expect(two_five_four.sizeInFields()).toBe(1);
|
28
|
-
});
|
29
|
-
});
|
30
|
-
describe('Defensive Cases', () => {
|
31
|
-
it('throws for input >= 255 bools', () => {
|
32
|
-
expect(() => PackedBoolFactory(254)).not.toThrow();
|
33
|
-
expect(() => PackedBoolFactory(255)).toThrow();
|
34
|
-
});
|
35
|
-
it('initalizes with more input than allowed', () => {
|
36
|
-
const tooMany = [...booleans].concat(false);
|
37
|
-
expect(() => {
|
38
|
-
PackedBool.fromBooleans(tooMany);
|
39
|
-
}).toThrow();
|
40
|
-
});
|
41
|
-
it('initalizes with less input than specified', () => {
|
42
|
-
const booleans = [true, false];
|
43
|
-
const pad = new Array(252);
|
44
|
-
pad.fill(false);
|
45
|
-
const expected = booleans.concat(pad);
|
46
|
-
expect(PackedBool.fromBooleans(booleans).toBooleans()).toMatchObject(expected);
|
47
|
-
});
|
48
|
-
});
|
49
|
-
describe('In the circuit', () => {
|
50
|
-
const outsidePackedBool = PackedBool.fromBooleans(booleans);
|
51
|
-
it('Initializes', () => {
|
52
|
-
expect(() => {
|
53
|
-
Provable.runAndCheck(() => {
|
54
|
-
const packedBool = new PackedBool(outsidePackedBool.packed);
|
55
|
-
PackedBool.check({ packed: packedBool.packed });
|
56
|
-
});
|
57
|
-
}).not.toThrow();
|
58
|
-
});
|
59
|
-
it('#assertEquals', () => {
|
60
|
-
expect(() => {
|
61
|
-
Provable.runAndCheck(() => {
|
62
|
-
const packedBool = new PackedBool(outsidePackedBool.packed);
|
63
|
-
packedBool.assertEquals(outsidePackedBool);
|
64
|
-
});
|
65
|
-
}).not.toThrow();
|
66
|
-
expect(() => {
|
67
|
-
Provable.runAndCheck(() => {
|
68
|
-
const fakePacked = outsidePackedBool.packed.add(32);
|
69
|
-
const packedBool = new PackedBool(fakePacked);
|
70
|
-
packedBool.assertEquals(outsidePackedBool);
|
71
|
-
});
|
72
|
-
}).toThrow();
|
73
|
-
});
|
74
|
-
});
|
75
|
-
});
|
1
|
+
import { Bool, Provable } from 'o1js';
|
2
|
+
import { PackedBoolFactory } from './PackedBool';
|
3
|
+
describe('PackedBool', () => {
|
4
|
+
const booleans = new Array(127).fill([true, false]).flat();
|
5
|
+
const bools = booleans.map((x) => Bool(x));
|
6
|
+
class PackedBool extends PackedBoolFactory() {
|
7
|
+
}
|
8
|
+
describe('Outside of the circuit', () => {
|
9
|
+
it('#fromBooleans', () => {
|
10
|
+
const myPackedBool = PackedBool.fromBooleans(booleans);
|
11
|
+
expect(myPackedBool.toBooleans()).toMatchObject(booleans);
|
12
|
+
});
|
13
|
+
it('#pack and #unPack', () => {
|
14
|
+
const packed = PackedBool.pack(bools);
|
15
|
+
const unpacked = PackedBool.unpack(packed);
|
16
|
+
expect(unpacked.length).toBe(bools.length);
|
17
|
+
expect(unpacked).toMatchObject(bools);
|
18
|
+
});
|
19
|
+
});
|
20
|
+
describe('Provable Properties', () => {
|
21
|
+
it('#sizeInFields', () => {
|
22
|
+
class one extends PackedBoolFactory(1) {
|
23
|
+
}
|
24
|
+
class two_five_four extends PackedBoolFactory(254) {
|
25
|
+
}
|
26
|
+
expect(one.sizeInFields()).toBe(1);
|
27
|
+
expect(two_five_four.sizeInFields()).toBe(1);
|
28
|
+
});
|
29
|
+
});
|
30
|
+
describe('Defensive Cases', () => {
|
31
|
+
it('throws for input >= 255 bools', () => {
|
32
|
+
expect(() => PackedBoolFactory(254)).not.toThrow();
|
33
|
+
expect(() => PackedBoolFactory(255)).toThrow();
|
34
|
+
});
|
35
|
+
it('initalizes with more input than allowed', () => {
|
36
|
+
const tooMany = [...booleans].concat(false);
|
37
|
+
expect(() => {
|
38
|
+
PackedBool.fromBooleans(tooMany);
|
39
|
+
}).toThrow();
|
40
|
+
});
|
41
|
+
it('initalizes with less input than specified', () => {
|
42
|
+
const booleans = [true, false];
|
43
|
+
const pad = new Array(252);
|
44
|
+
pad.fill(false);
|
45
|
+
const expected = booleans.concat(pad);
|
46
|
+
expect(PackedBool.fromBooleans(booleans).toBooleans()).toMatchObject(expected);
|
47
|
+
});
|
48
|
+
});
|
49
|
+
describe('In the circuit', () => {
|
50
|
+
const outsidePackedBool = PackedBool.fromBooleans(booleans);
|
51
|
+
it('Initializes', () => {
|
52
|
+
expect(() => {
|
53
|
+
Provable.runAndCheck(() => {
|
54
|
+
const packedBool = new PackedBool(outsidePackedBool.packed);
|
55
|
+
PackedBool.check({ packed: packedBool.packed });
|
56
|
+
});
|
57
|
+
}).not.toThrow();
|
58
|
+
});
|
59
|
+
it('#assertEquals', () => {
|
60
|
+
expect(() => {
|
61
|
+
Provable.runAndCheck(() => {
|
62
|
+
const packedBool = new PackedBool(outsidePackedBool.packed);
|
63
|
+
packedBool.assertEquals(outsidePackedBool);
|
64
|
+
});
|
65
|
+
}).not.toThrow();
|
66
|
+
expect(() => {
|
67
|
+
Provable.runAndCheck(() => {
|
68
|
+
const fakePacked = outsidePackedBool.packed.add(32);
|
69
|
+
const packedBool = new PackedBool(fakePacked);
|
70
|
+
packedBool.assertEquals(outsidePackedBool);
|
71
|
+
});
|
72
|
+
}).toThrow();
|
73
|
+
});
|
74
|
+
});
|
75
|
+
});
|
76
76
|
//# sourceMappingURL=PackedBool.test.js.map
|
@@ -1,181 +1,181 @@
|
|
1
|
-
import { Field, Character } from 'o1js';
|
2
|
-
export declare function PackedStringFactory(l?: number): {
|
3
|
-
new (packed: import("o1js/dist/node/lib/field.js").Field): {
|
4
|
-
toString(): string;
|
5
|
-
assertEquals(other: {
|
6
|
-
assertEquals(other: any): void;
|
7
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
8
|
-
}): void;
|
9
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
10
|
-
};
|
11
|
-
extractField(input: Character): Field;
|
12
|
-
sizeInBits(): bigint;
|
13
|
-
/**
|
14
|
-
*
|
15
|
-
* @param f Field, packed with the information, as returned by #pack
|
16
|
-
* @returns Array of Character
|
17
|
-
*/
|
18
|
-
unpack(f: Field): Character[];
|
19
|
-
/**
|
20
|
-
*
|
21
|
-
* @param characters Array of Character to be packed
|
22
|
-
* @returns Instance of the implementing class
|
23
|
-
*/
|
24
|
-
fromCharacters(input: Array<Character>): {
|
25
|
-
toString(): string;
|
26
|
-
assertEquals(other: {
|
27
|
-
assertEquals(other: any): void;
|
28
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
29
|
-
}): void;
|
30
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
*
|
34
|
-
* @param str string to be packed
|
35
|
-
* @returns Instance of the implementing class
|
36
|
-
*/
|
37
|
-
fromString(str: string): {
|
38
|
-
toString(): string;
|
39
|
-
assertEquals(other: {
|
40
|
-
assertEquals(other: any): void;
|
41
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
42
|
-
}): void;
|
43
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
44
|
-
};
|
45
|
-
/**
|
46
|
-
*
|
47
|
-
* @param f Field, packed with the information, as returned by #pack
|
48
|
-
* @returns Array of Character
|
49
|
-
*/
|
50
|
-
type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
|
51
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
52
|
-
}, {
|
53
|
-
packed: string;
|
54
|
-
}>;
|
55
|
-
l: number;
|
56
|
-
bitSize: bigint;
|
57
|
-
checkPack(unpacked: Character[]): void;
|
58
|
-
pack(unpacked: Character[]): import("o1js/dist/node/lib/field.js").Field;
|
59
|
-
unpackToBigints(f: import("o1js/dist/node/lib/field.js").Field): bigint[];
|
60
|
-
_isStruct: true;
|
61
|
-
toFields: (value: {
|
62
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
63
|
-
}) => import("o1js/dist/node/lib/field.js").Field[];
|
64
|
-
toAuxiliary: (value?: {
|
65
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
66
|
-
} | undefined) => any[];
|
67
|
-
fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
|
68
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
69
|
-
};
|
70
|
-
sizeInFields(): number;
|
71
|
-
check: (value: {
|
72
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
73
|
-
}) => void;
|
74
|
-
toInput: (x: {
|
75
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
76
|
-
}) => {
|
77
|
-
fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
|
78
|
-
packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
|
79
|
-
};
|
80
|
-
toJSON: (x: {
|
81
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
82
|
-
}) => {
|
83
|
-
packed: string;
|
84
|
-
};
|
85
|
-
fromJSON: (x: {
|
86
|
-
packed: string;
|
87
|
-
}) => {
|
88
|
-
packed: import("o1js/dist/node/lib/field.js").Field;
|
89
|
-
};
|
90
|
-
};
|
91
|
-
/**
|
92
|
-
*
|
93
|
-
* @param n number of fields to employ to store the string
|
94
|
-
* @returns MultiPackedString_ class with length of n * CHARS_PER_FIELD
|
95
|
-
*/
|
96
|
-
export declare function MultiPackedStringFactory(n?: number): {
|
97
|
-
new (packed: import("o1js/dist/node/lib/field.js").Field[]): {
|
98
|
-
toString(): string;
|
99
|
-
assertEquals(other: {
|
100
|
-
assertEquals(other: any): void;
|
101
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
102
|
-
}): void;
|
103
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
104
|
-
};
|
105
|
-
extractField(input: Character): Field;
|
106
|
-
sizeInBits(): bigint;
|
107
|
-
elementsPerField(): number;
|
108
|
-
/**
|
109
|
-
*
|
110
|
-
* @param fields Array of Fields, containing packed Characters
|
111
|
-
* @returns Array of Character
|
112
|
-
*/
|
113
|
-
unpack(fields: Field[]): Character[];
|
114
|
-
/**
|
115
|
-
*
|
116
|
-
* @param characters Array of Character to be packed
|
117
|
-
* @returns Instance of the implementing class
|
118
|
-
*/
|
119
|
-
fromCharacters(input: Array<Character>): {
|
120
|
-
toString(): string;
|
121
|
-
assertEquals(other: {
|
122
|
-
assertEquals(other: any): void;
|
123
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
124
|
-
}): void;
|
125
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
126
|
-
};
|
127
|
-
/**
|
128
|
-
*
|
129
|
-
* @param str string to be packed
|
130
|
-
* @returns Instance of the implementing class
|
131
|
-
*/
|
132
|
-
fromString(str: string): {
|
133
|
-
toString(): string;
|
134
|
-
assertEquals(other: {
|
135
|
-
assertEquals(other: any): void;
|
136
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
137
|
-
}): void;
|
138
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
139
|
-
};
|
140
|
-
type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
|
141
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
142
|
-
}, {
|
143
|
-
packed: string[];
|
144
|
-
}>;
|
145
|
-
l: number;
|
146
|
-
n: number;
|
147
|
-
bitSize: bigint;
|
148
|
-
checkPack(unpacked: Character[]): void;
|
149
|
-
pack(unpacked: Character[]): import("o1js/dist/node/lib/field.js").Field[];
|
150
|
-
unpackToBigints(fields: import("o1js/dist/node/lib/field.js").Field[]): bigint[];
|
151
|
-
_isStruct: true;
|
152
|
-
toFields: (value: {
|
153
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
154
|
-
}) => import("o1js/dist/node/lib/field.js").Field[];
|
155
|
-
toAuxiliary: (value?: {
|
156
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
157
|
-
} | undefined) => any[];
|
158
|
-
fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
|
159
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
160
|
-
};
|
161
|
-
sizeInFields(): number;
|
162
|
-
check: (value: {
|
163
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
164
|
-
}) => void;
|
165
|
-
toInput: (x: {
|
166
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
167
|
-
}) => {
|
168
|
-
fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
|
169
|
-
packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
|
170
|
-
};
|
171
|
-
toJSON: (x: {
|
172
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
173
|
-
}) => {
|
174
|
-
packed: string[];
|
175
|
-
};
|
176
|
-
fromJSON: (x: {
|
177
|
-
packed: string[];
|
178
|
-
}) => {
|
179
|
-
packed: import("o1js/dist/node/lib/field.js").Field[];
|
180
|
-
};
|
181
|
-
};
|
1
|
+
import { Field, Character } from 'o1js';
|
2
|
+
export declare function PackedStringFactory(l?: number): {
|
3
|
+
new (packed: import("o1js/dist/node/lib/field.js").Field): {
|
4
|
+
toString(): string;
|
5
|
+
assertEquals(other: {
|
6
|
+
assertEquals(other: any): void;
|
7
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
8
|
+
}): void;
|
9
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
10
|
+
};
|
11
|
+
extractField(input: Character): Field;
|
12
|
+
sizeInBits(): bigint;
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* @param f Field, packed with the information, as returned by #pack
|
16
|
+
* @returns Array of Character
|
17
|
+
*/
|
18
|
+
unpack(f: Field): Character[];
|
19
|
+
/**
|
20
|
+
*
|
21
|
+
* @param characters Array of Character to be packed
|
22
|
+
* @returns Instance of the implementing class
|
23
|
+
*/
|
24
|
+
fromCharacters(input: Array<Character>): {
|
25
|
+
toString(): string;
|
26
|
+
assertEquals(other: {
|
27
|
+
assertEquals(other: any): void;
|
28
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
29
|
+
}): void;
|
30
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
*
|
34
|
+
* @param str string to be packed
|
35
|
+
* @returns Instance of the implementing class
|
36
|
+
*/
|
37
|
+
fromString(str: string): {
|
38
|
+
toString(): string;
|
39
|
+
assertEquals(other: {
|
40
|
+
assertEquals(other: any): void;
|
41
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
42
|
+
}): void;
|
43
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
44
|
+
};
|
45
|
+
/**
|
46
|
+
*
|
47
|
+
* @param f Field, packed with the information, as returned by #pack
|
48
|
+
* @returns Array of Character
|
49
|
+
*/
|
50
|
+
type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
|
51
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
52
|
+
}, {
|
53
|
+
packed: string;
|
54
|
+
}>;
|
55
|
+
l: number;
|
56
|
+
bitSize: bigint;
|
57
|
+
checkPack(unpacked: Character[]): void;
|
58
|
+
pack(unpacked: Character[]): import("o1js/dist/node/lib/field.js").Field;
|
59
|
+
unpackToBigints(f: import("o1js/dist/node/lib/field.js").Field): bigint[];
|
60
|
+
_isStruct: true;
|
61
|
+
toFields: (value: {
|
62
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
63
|
+
}) => import("o1js/dist/node/lib/field.js").Field[];
|
64
|
+
toAuxiliary: (value?: {
|
65
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
66
|
+
} | undefined) => any[];
|
67
|
+
fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
|
68
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
69
|
+
};
|
70
|
+
sizeInFields(): number;
|
71
|
+
check: (value: {
|
72
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
73
|
+
}) => void;
|
74
|
+
toInput: (x: {
|
75
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
76
|
+
}) => {
|
77
|
+
fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
|
78
|
+
packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
|
79
|
+
};
|
80
|
+
toJSON: (x: {
|
81
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
82
|
+
}) => {
|
83
|
+
packed: string;
|
84
|
+
};
|
85
|
+
fromJSON: (x: {
|
86
|
+
packed: string;
|
87
|
+
}) => {
|
88
|
+
packed: import("o1js/dist/node/lib/field.js").Field;
|
89
|
+
};
|
90
|
+
};
|
91
|
+
/**
|
92
|
+
*
|
93
|
+
* @param n number of fields to employ to store the string
|
94
|
+
* @returns MultiPackedString_ class with length of n * CHARS_PER_FIELD
|
95
|
+
*/
|
96
|
+
export declare function MultiPackedStringFactory(n?: number): {
|
97
|
+
new (packed: import("o1js/dist/node/lib/field.js").Field[]): {
|
98
|
+
toString(): string;
|
99
|
+
assertEquals(other: {
|
100
|
+
assertEquals(other: any): void;
|
101
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
102
|
+
}): void;
|
103
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
104
|
+
};
|
105
|
+
extractField(input: Character): Field;
|
106
|
+
sizeInBits(): bigint;
|
107
|
+
elementsPerField(): number;
|
108
|
+
/**
|
109
|
+
*
|
110
|
+
* @param fields Array of Fields, containing packed Characters
|
111
|
+
* @returns Array of Character
|
112
|
+
*/
|
113
|
+
unpack(fields: Field[]): Character[];
|
114
|
+
/**
|
115
|
+
*
|
116
|
+
* @param characters Array of Character to be packed
|
117
|
+
* @returns Instance of the implementing class
|
118
|
+
*/
|
119
|
+
fromCharacters(input: Array<Character>): {
|
120
|
+
toString(): string;
|
121
|
+
assertEquals(other: {
|
122
|
+
assertEquals(other: any): void;
|
123
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
124
|
+
}): void;
|
125
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
126
|
+
};
|
127
|
+
/**
|
128
|
+
*
|
129
|
+
* @param str string to be packed
|
130
|
+
* @returns Instance of the implementing class
|
131
|
+
*/
|
132
|
+
fromString(str: string): {
|
133
|
+
toString(): string;
|
134
|
+
assertEquals(other: {
|
135
|
+
assertEquals(other: any): void;
|
136
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
137
|
+
}): void;
|
138
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
139
|
+
};
|
140
|
+
type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
|
141
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
142
|
+
}, {
|
143
|
+
packed: string[];
|
144
|
+
}>;
|
145
|
+
l: number;
|
146
|
+
n: number;
|
147
|
+
bitSize: bigint;
|
148
|
+
checkPack(unpacked: Character[]): void;
|
149
|
+
pack(unpacked: Character[]): import("o1js/dist/node/lib/field.js").Field[];
|
150
|
+
unpackToBigints(fields: import("o1js/dist/node/lib/field.js").Field[]): bigint[];
|
151
|
+
_isStruct: true;
|
152
|
+
toFields: (value: {
|
153
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
154
|
+
}) => import("o1js/dist/node/lib/field.js").Field[];
|
155
|
+
toAuxiliary: (value?: {
|
156
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
157
|
+
} | undefined) => any[];
|
158
|
+
fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
|
159
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
160
|
+
};
|
161
|
+
sizeInFields(): number;
|
162
|
+
check: (value: {
|
163
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
164
|
+
}) => void;
|
165
|
+
toInput: (x: {
|
166
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
167
|
+
}) => {
|
168
|
+
fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
|
169
|
+
packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
|
170
|
+
};
|
171
|
+
toJSON: (x: {
|
172
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
173
|
+
}) => {
|
174
|
+
packed: string[];
|
175
|
+
};
|
176
|
+
fromJSON: (x: {
|
177
|
+
packed: string[];
|
178
|
+
}) => {
|
179
|
+
packed: import("o1js/dist/node/lib/field.js").Field[];
|
180
|
+
};
|
181
|
+
};
|