Skip to content

Commit c5bbf8b

Browse files
authored
Merge pull request #1993 from o1-labs/2025-01-typdoc-errors-1
Resolve documentation signature mismatches
2 parents 90de4c1 + afb26c7 commit c5bbf8b

File tree

8 files changed

+53
-56
lines changed

8 files changed

+53
-56
lines changed

src/lib/mina/fetch.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ function setMinaGraphqlFallbackEndpoints(graphqlEndpoints: string[]) {
129129
/**
130130
* Sets up a GraphQL endpoint to be used for fetching information from an Archive Node.
131131
*
132-
* @param A GraphQL endpoint.
133132
*/
134133
function setArchiveGraphqlEndpoint(graphqlEndpoint: string) {
135134
if (!checkForValidUrl(graphqlEndpoint)) {
@@ -170,8 +169,9 @@ function setLightnetAccountManagerEndpoint(endpoint: string) {
170169
* If an error is returned by the specified endpoint, an error is thrown. Otherwise,
171170
* the data is returned.
172171
*
173-
* @param publicKey The specified publicKey to get account information on
174-
* @param tokenId The specified tokenId to get account information on
172+
* @param accountInfo The public key and token id of the account to fetch
173+
* @param accountInfo.publicKey The specified publicKey to get account information on
174+
* @param accountInfo.tokenId The specified tokenId to get account information on
175175
* @param graphqlEndpoint The graphql endpoint to fetch from
176176
* @param config An object that exposes an additional timeout option
177177
* @returns zkapp information on the specified account or an error is thrown
@@ -632,7 +632,6 @@ function sendZkapp(
632632

633633
/**
634634
* Asynchronously fetches event data for an account from the Mina Archive Node GraphQL API.
635-
* @async
636635
* @param accountInfo - The account information object.
637636
* @param accountInfo.publicKey - The account public key.
638637
* @param [accountInfo.tokenId] - The optional token ID for the account.

src/lib/mina/zkapp.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,6 @@ super.init();
10391039

10401040
/**
10411041
* Asynchronously fetches events emitted by this {@link SmartContract} and returns an array of events with their corresponding types.
1042-
* @async
10431042
* @param [start=UInt32.from(0)] - The start height of the events to fetch.
10441043
* @param end - The end height of the events to fetch. If not provided, fetches events up to the latest height.
10451044
* @returns A promise that resolves to an array of objects, each containing the event type and event data for the specified range.

src/lib/provable/field.ts

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ class Field {
202202
*
203203
* **Important**: If an assertion fails, the code throws an error.
204204
*
205-
* @param value - the "field-like" value to compare & assert with this {@link Field}.
206-
* @param message? - a string error message to print if the assertion fails, optional.
205+
* @param y - the "field-like" value to compare & assert with this {@link Field}.
206+
* @param message - a string error message to print if the assertion fails, optional.
207207
*/
208208
assertEquals(y: Field | bigint | number | string, message?: string) {
209209
try {
@@ -243,7 +243,7 @@ class Field {
243243
* sum.sub(Field(-7)).assertEquals(x);
244244
* ```
245245
*
246-
* @param value - a "field-like" value to add to the {@link Field}.
246+
* @param y - a "field-like" value to add to the {@link Field}.
247247
*
248248
* @return A {@link Field} element equivalent to the modular addition of the two value.
249249
*/
@@ -307,7 +307,7 @@ class Field {
307307
* difference.add(Field(2)).assertEquals(x);
308308
* ```
309309
*
310-
* @param value - a "field-like" value to subtract from the {@link Field}.
310+
* @param y - a "field-like" value to subtract from the {@link Field}.
311311
*
312312
* @return A {@link Field} element equivalent to the modular difference of the two value.
313313
*/
@@ -351,7 +351,7 @@ class Field {
351351
* product.assertEquals(Field(15));
352352
* ```
353353
*
354-
* @param value - a "field-like" value to multiply with the {@link Field}.
354+
* @param y - a "field-like" value to multiply with the {@link Field}.
355355
*
356356
* @return A {@link Field} element equivalent to the modular difference of the two value.
357357
*/
@@ -435,7 +435,7 @@ class Field {
435435
* quotient.mul(y).assertEquals(x);
436436
* ```
437437
*
438-
* @param value - a "field-like" value to divide with the {@link Field}.
438+
* @param y - a "field-like" value to divide with the {@link Field}.
439439
*
440440
* @return A {@link Field} element equivalent to the modular division of the two value.
441441
*/
@@ -515,7 +515,7 @@ class Field {
515515
* Field(5).equals(5).assertEquals(Bool(true));
516516
* ```
517517
*
518-
* @param value - the "field-like" value to compare with this {@link Field}.
518+
* @param y - the "field-like" value to compare with this {@link Field}.
519519
*
520520
* @return A {@link Bool} representing if this {@link Field} is equal another "field-like" value.
521521
*/
@@ -564,7 +564,7 @@ class Field {
564564
* let isFalse = Field(1).div(3).lessThan(Field(1).div(2)); // in fact, 1/3 > 1/2
565565
* ```
566566
*
567-
* @param value - the "field-like" value to compare with this {@link Field}.
567+
* @param y - the "field-like" value to compare with this {@link Field}.
568568
*
569569
* @return A {@link Bool} representing if this {@link Field} is less than another "field-like" value.
570570
*/
@@ -591,7 +591,7 @@ class Field {
591591
* let isFalse = Field(1).div(3).lessThanOrEqual(Field(1).div(2)); // in fact, 1/3 > 1/2
592592
* ```
593593
*
594-
* @param value - the "field-like" value to compare with this {@link Field}.
594+
* @param y - the "field-like" value to compare with this {@link Field}.
595595
*
596596
* @return A {@link Bool} representing if this {@link Field} is less than or equal another "field-like" value.
597597
*/
@@ -618,7 +618,7 @@ class Field {
618618
* let isFalse = Field(1).div(2).greaterThan(Field(1).div(3); // in fact, 1/3 > 1/2
619619
* ```
620620
*
621-
* @param value - the "field-like" value to compare with this {@link Field}.
621+
* @param y - the "field-like" value to compare with this {@link Field}.
622622
*
623623
* @return A {@link Bool} representing if this {@link Field} is greater than another "field-like" value.
624624
*/
@@ -642,7 +642,7 @@ class Field {
642642
* let isFalse = Field(1).div(2).greaterThanOrEqual(Field(1).div(3); // in fact, 1/3 > 1/2
643643
* ```
644644
*
645-
* @param value - the "field-like" value to compare with this {@link Field}.
645+
* @param y - the "field-like" value to compare with this {@link Field}.
646646
*
647647
* @return A {@link Bool} representing if this {@link Field} is greater than or equal another "field-like" value.
648648
*/
@@ -658,8 +658,8 @@ class Field {
658658
*
659659
* **Important**: If an assertion fails, the code throws an error.
660660
*
661-
* @param value - the "field-like" value to compare & assert with this {@link Field}.
662-
* @param message? - a string error message to print if the assertion fails, optional.
661+
* @param y - the "field-like" value to compare & assert with this {@link Field}.
662+
* @param message - a string error message to print if the assertion fails, optional.
663663
*/
664664
assertLessThan(y: Field | bigint | number | string, message?: string) {
665665
try {
@@ -683,8 +683,8 @@ class Field {
683683
*
684684
* **Important**: If an assertion fails, the code throws an error.
685685
*
686-
* @param value - the "field-like" value to compare & assert with this {@link Field}.
687-
* @param message? - a string error message to print if the assertion fails, optional.
686+
* @param y - the "field-like" value to compare & assert with this {@link Field}.
687+
* @param message - a string error message to print if the assertion fails, optional.
688688
*/
689689
assertLessThanOrEqual(y: Field | bigint | number | string, message?: string) {
690690
try {
@@ -708,8 +708,8 @@ class Field {
708708
*
709709
* **Important**: If an assertion fails, the code throws an error.
710710
*
711-
* @param value - the "field-like" value to compare & assert with this {@link Field}.
712-
* @param message? - a string error message to print if the assertion fails, optional.
711+
* @param y - the "field-like" value to compare & assert with this {@link Field}.
712+
* @param message - a string error message to print if the assertion fails, optional.
713713
*/
714714
assertGreaterThan(y: Field | bigint | number | string, message?: string) {
715715
Field.from(y).assertLessThan(this, message);
@@ -723,8 +723,8 @@ class Field {
723723
*
724724
* **Important**: If an assertion fails, the code throws an error.
725725
*
726-
* @param value - the "field-like" value to compare & assert with this {@link Field}.
727-
* @param message? - a string error message to print if the assertion fails, optional.
726+
* @param y - the "field-like" value to compare & assert with this {@link Field}.
727+
* @param message - a string error message to print if the assertion fails, optional.
728728
*/
729729
assertGreaterThanOrEqual(
730730
y: Field | bigint | number | string,
@@ -738,6 +738,9 @@ class Field {
738738
*
739739
* Note: This uses fewer constraints than `x.equals(y).assertFalse()`.
740740
*
741+
* @param y - the "field-like" value to compare & assert with this {@link Field}.
742+
* @param message - a string error message to print if the assertion fails, optional.
743+
*
741744
* @example
742745
* ```ts
743746
* x.assertNotEquals(0, "expect x to be non-zero");
@@ -775,7 +778,7 @@ class Field {
775778
*
776779
* If the assertion fails, the code throws an error.
777780
*
778-
* @param message? - a string error message to print if the assertion fails, optional.
781+
* @param message - a string error message to print if the assertion fails, optional.
779782
*/
780783
assertBool(message?: string) {
781784
try {
@@ -834,11 +837,11 @@ class Field {
834837
*
835838
* The method throws if the given bits do not fit in a single Field element. In this case, no more than 254 bits are allowed because some 255 bit integers do not fit into a single Field element.
836839
*
837-
* **Important**: If the given `bytes` array is an array of `booleans` or {@link Bool} elements that all are `constant`, the resulting {@link Field} element will be a constant as well. Or else, if the given array is a mixture of constants and variables of {@link Bool} type, the resulting {@link Field} will be a variable as well.
840+
* **Important**: If the given `bits` array is an array of `booleans` or {@link Bool} elements that all are `constant`, the resulting {@link Field} element will be a constant as well. Or else, if the given array is a mixture of constants and variables of {@link Bool} type, the resulting {@link Field} will be a variable as well.
838841
*
839-
* @param bytes - An array of {@link Bool} or `boolean` type.
842+
* @param bits - An array of {@link Bool} or `boolean` type.
840843
*
841-
* @return A {@link Field} element matching the [little endian binary representation](https://en.wikipedia.org/wiki/Endianness) of the given `bytes` array.
844+
* @return A {@link Field} element matching the [little endian binary representation](https://en.wikipedia.org/wiki/Endianness) of the given `bits` array.
842845
*/
843846
static fromBits(bits: (Bool | boolean)[]) {
844847
const length = bits.length;
@@ -909,16 +912,14 @@ class Field {
909912
*
910913
* @return A {@link Field} array of length 1 created from this {@link Field}.
911914
*/
912-
static toFields(x: Field) {
913-
return [x];
915+
static toFields(value: Field) {
916+
return [value];
914917
}
915918

916919
/**
917920
* This function is the implementation of {@link Provable.toAuxiliary} for the {@link Field} type.
918921
*
919922
* As the primitive {@link Field} type has no auxiliary data associated with it, this function will always return an empty array.
920-
*
921-
* @param value - The {@link Field} element to get the auxiliary data of, optional. If not provided, the function returns an empty array.
922923
*/
923924
static toAuxiliary(): [] {
924925
return [];
@@ -960,8 +961,6 @@ class Field {
960961
* This function is the implementation of {@link Provable.check} in {@link Field} type.
961962
*
962963
* As any field element can be a {@link Field}, this function does not create any assertions, so it does nothing.
963-
*
964-
* @param value - the {@link Field} element to check.
965964
*/
966965
static check() {}
967966

@@ -1044,16 +1043,16 @@ class Field {
10441043
*
10451044
* @return A string equivalent to the JSON representation of the given {@link Field}.
10461045
*/
1047-
static toJSON(x: Field) {
1048-
return x.toJSON();
1046+
static toJSON(value: Field) {
1047+
return value.toJSON();
10491048
}
10501049

10511050
/**
10521051
* Deserialize a JSON string containing a "field-like" value into a {@link Field} element.
10531052
*
10541053
* **Warning**: This operation does _not_ affect the circuit and can't be used to prove anything about the string representation of the {@link Field}.
10551054
*
1056-
* @param value - the "field-like" value to coerce the {@link Field} from.
1055+
* @param json - the "field-like" value to coerce the {@link Field} from.
10571056
*
10581057
* @return A {@link Field} coerced from the given JSON string.
10591058
*/
@@ -1071,8 +1070,8 @@ class Field {
10711070
* @return An object where the `fields` key is a {@link Field} array of length 1 created from this {@link Field}.
10721071
*
10731072
*/
1074-
static toInput(x: Field) {
1075-
return { fields: [x] };
1073+
static toInput(value: Field) {
1074+
return { fields: [value] };
10761075
}
10771076

10781077
// Binable<Field>
@@ -1086,8 +1085,8 @@ class Field {
10861085
* @return An array of digits equal to the [little-endian](https://en.wikipedia.org/wiki/Endianness) byte order of the given {@link Field} element.
10871086
*
10881087
*/
1089-
static toBytes(x: Field) {
1090-
return FieldBinable.toBytes(x);
1088+
static toBytes(value: Field) {
1089+
return FieldBinable.toBytes(value);
10911090
}
10921091

10931092
/**

src/lib/provable/int.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ class UInt64 extends CircuitValue {
302302
*
303303
* ```
304304
*
305-
* @param a - The value to apply NOT to.
306-
*
307305
*/
308306
not() {
309307
return new UInt64(Bitwise.not(this.value, UInt64.NUM_BITS, false).value);
@@ -776,7 +774,6 @@ class UInt32 extends CircuitValue {
776774
* // 11111111111111111111111111111010
777775
* ```
778776
*
779-
* @param a - The value to apply NOT to.
780777
*/
781778
not() {
782779
return new UInt32(Bitwise.not(this.value, UInt32.NUM_BITS, false).value);
@@ -1147,7 +1144,7 @@ class Int64 extends CircuitValue implements BalanceChange {
11471144
* This is the recommended way to create Int64 instances.
11481145
*
11491146
* @param magnitude - The magnitude of the integer as a UInt64
1150-
* @param sgn - The sign of the integer.
1147+
* @param sign - The sign of the integer.
11511148
* @returns A new Int64 instance with a canonical representation.
11521149
*
11531150
* @example
@@ -1654,7 +1651,7 @@ class UInt8 extends Struct({
16541651
* **Important**: If an assertion fails, the code throws an error.
16551652
*
16561653
* @param y - the {@link UInt8} value to compare & assert with this {@link UInt8}.
1657-
* @param message? - a string error message to print if the assertion fails, optional.
1654+
* @param message - a string error message to print if the assertion fails, optional.
16581655
*/
16591656
assertLessThan(y: UInt8 | bigint | number, message?: string) {
16601657
let y_ = UInt8.from(y);
@@ -1679,7 +1676,7 @@ class UInt8 extends Struct({
16791676
* **Important**: If an assertion fails, the code throws an error.
16801677
*
16811678
* @param y - the {@link UInt8} value to compare & assert with this {@link UInt8}.
1682-
* @param message? - a string error message to print if the assertion fails, optional.
1679+
* @param message - a string error message to print if the assertion fails, optional.
16831680
*/
16841681
assertLessThanOrEqual(y: UInt8 | bigint | number, message?: string) {
16851682
let y_ = UInt8.from(y);
@@ -1736,7 +1733,7 @@ class UInt8 extends Struct({
17361733
* **Important**: If an assertion fails, the code throws an error.
17371734
*
17381735
* @param y - the {@link UInt8} value to compare & assert with this {@link UInt8}.
1739-
* @param message? - a string error message to print if the assertion fails, optional.
1736+
* @param message - a string error message to print if the assertion fails, optional.
17401737
*/
17411738
assertGreaterThan(y: UInt8 | bigint | number, message?: string) {
17421739
UInt8.from(y).assertLessThan(this, message);
@@ -1748,7 +1745,7 @@ class UInt8 extends Struct({
17481745
* **Important**: If an assertion fails, the code throws an error.
17491746
*
17501747
* @param y - the {@link UInt8} value to compare & assert with this {@link UInt8}.
1751-
* @param message? - a string error message to print if the assertion fails, optional.
1748+
* @param message - a string error message to print if the assertion fails, optional.
17521749
*/
17531750
assertGreaterThanOrEqual(y: UInt8, message?: string) {
17541751
UInt8.from(y).assertLessThanOrEqual(this, message);
@@ -1760,7 +1757,7 @@ class UInt8 extends Struct({
17601757
* **Important**: If an assertion fails, the code throws an error.
17611758
*
17621759
* @param y - the {@link UInt8} value to compare & assert with this {@link UInt8}.
1763-
* @param message? - a string error message to print if the assertion fails, optional.
1760+
* @param message - a string error message to print if the assertion fails, optional.
17641761
*/
17651762
assertEquals(y: UInt8 | bigint | number, message?: string) {
17661763
let y_ = UInt8.from(y);

src/lib/provable/merkle-tree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class MerkleTree {
6868
* @param index Index of the leaf.
6969
* @returns The data of the leaf.
7070
*/
71-
getLeaf(key: bigint) {
72-
return this.getNode(0, key);
71+
getLeaf(index: bigint) {
72+
return this.getNode(0, index);
7373
}
7474

7575
/**

src/lib/provable/scalar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ class Scalar implements ShiftedScalar {
244244
* @return An object where the `fields` key is a {@link Field} array of length 1 created from this {@link Field}.
245245
*
246246
*/
247-
static toInput(x: Scalar): HashInput {
248-
return { fields: [x.high254], packed: [[x.lowBit.toField(), 1]] };
247+
static toInput(value: Scalar): HashInput {
248+
return { fields: [value.high254], packed: [[value.lowBit.toField(), 1]] };
249249
}
250250

251251
/**

src/lib/provable/types/struct.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type AnyConstructor = Constructor<any>;
7171
* These composite types can be passed in as arguments to smart contract methods, used for on-chain state variables
7272
* or as event / action types.
7373
*
74+
* @example
7475
* Here's an example of creating a "Voter" struct, which holds a public key and a collection of votes on 3 different proposals:
7576
* ```ts
7677
* let Vote = { hasVoted: Bool, inFavor: Bool };
@@ -131,10 +132,9 @@ type AnyConstructor = Constructor<any>;
131132
* Again, it's important to note that this doesn't enable you to prove anything about the `fullName` string.
132133
* From the circuit point of view, it simply doesn't exist!
133134
*
134-
* @note Ensure you do not use or extend `Struct` as a type directly. Instead, always call it as a function to construct a type. `Struct` is not a valid provable type itself, types created with `Struct(...)` are.
135+
* **Note**: Ensure you do not use or extend `Struct` as a type directly. Instead, always call it as a function to construct a type. `Struct` is not a valid provable type itself, types created with `Struct(...)` are.
135136
*
136137
* @param type Object specifying the layout of the `Struct`
137-
* @param options Advanced option which allows you to force a certain order of object keys
138138
* @returns Class which you can extend
139139
*/
140140
function Struct<

typedoc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"src/lib/provable/+(core|test)/**/*",
1515
"src/**/*(test|unit-test).ts",
1616
],
17+
"validation": {
18+
"notExported": false, // Allows us to reference types and classes that are not documented from types and classes that are documented
19+
},
1720
"entryPoints": [
1821
"src/index.ts",
1922
"src/lib/provable/field.ts",

0 commit comments

Comments
 (0)