@proto-kit/common • Docs
Documentation / @proto-kit/common / O1PublicKeyOption
Class: O1PublicKeyOption
Extends
Option<PublicKey,object>
Constructors
new O1PublicKeyOption()
new O1PublicKeyOption(
option):O1PublicKeyOption
Parameters
• option
• option.isSome: Bool
• option.value: PublicKey
Returns
Inherited from
Option(PublicKey).constructor
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:35
Properties
isSome
isSome:
Bool
Inherited from
Option(PublicKey).isSome
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:8
value
value:
PublicKey
Inherited from
Option(PublicKey).value
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:9
check()
staticcheck: (value) =>void
Add assertions to the proof to check if value is a valid member of type T.
This function does not return anything, instead it creates any number of assertions to prove that value is a valid member of the type T.
For instance, calling check function on the type Bool asserts that the value of the element is either 1 or 0.
Parameters
• value: Option<PublicKey, object>
the element of type T to put assertions on.
Returns
void
Inherited from
Option(PublicKey).check
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:60
fromFields()
staticfromFields: (fields) =>Option<PublicKey,object>
Parameters
• fields: Field[]
Returns
Option<PublicKey, object>
Inherited from
Option(PublicKey).fromFields
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:95
fromValue
staticfromValue: (x) =>Option<PublicKey,object> & (value) =>Option<PublicKey,object>
Convert provable type from a normal JS type.
Inherited from
Option(PublicKey).fromValue
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:68
toAuxiliary()
statictoAuxiliary: (value?) =>any[]
A function that takes value (optional), an element of type T, as argument and
returns an array of any type that make up the “auxiliary” (non-provable) data of value.
Parameters
• value?: Option<PublicKey, object>
the element of type T to generate the auxiliary data array from, optional.
If not provided, a default value for auxiliary data is returned.
Returns
any[]
An array of any type describing how this T element is made up of “auxiliary” (non-provable) data.
Inherited from
Option(PublicKey).toAuxiliary
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:34
toCanonical()?
staticoptionaltoCanonical: (x) =>Option<PublicKey,object>
Optional method which transforms a provable type into its canonical representation.
This is needed for types that have multiple representations of the same underlying value, and might even not have perfect completeness for some of those representations.
An example is the ForeignField class, which allows non-native field elements to exist in unreduced form.
The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error.
Specific protocols need to be able to protect themselves against incomplete operations at all costs.
For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action.
toCanonical() converts any input into a safe form and enables us to handle cases like this generically.
Note: For most types, this method is the identity function.
The identity function will also be used when the toCanonical() is not present on a type.
Parameters
• x: Option<PublicKey, object>
Returns
Option<PublicKey, object>
Inherited from
Option(PublicKey).toCanonical
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:85
toFields()
statictoFields: (value) =>Field[]
A function that takes value, an element of type T, as argument and returns
an array of Field elements that make up the provable data of value.
Parameters
• value: Option<PublicKey, object>
the element of type T to generate the Field array from.
Returns
Field[]
A Field array describing how this T element is made up of Field elements.
Inherited from
Option(PublicKey).toFields
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:24
toValue()
statictoValue: (x) =>undefined|object
Convert provable type to a normal JS type.
Parameters
• x: Option<PublicKey, object>
Returns
undefined | object
Inherited from
Option(PublicKey).toValue
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:64
Methods
assertNone()
assertNone(
message?):void
Parameters
• message?: string
Returns
void
Inherited from
Option(PublicKey).assertNone
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:12
assertSome()
assertSome(
message?):PublicKey
Parameters
• message?: string
Returns
PublicKey
Inherited from
Option(PublicKey).assertSome
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:11
orElse()
orElse(
defaultValue):PublicKey
Parameters
• defaultValue: PublicKey | object
Returns
PublicKey
Inherited from
Option(PublicKey).orElse
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:13
from()
staticfrom(value?):Option<PublicKey,object>
Parameters
• value?: PublicKey | object
Returns
Option<PublicKey, object>
Inherited from
Option(PublicKey).from
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:43
none()
staticnone():Option<PublicKey,object>
Returns
Option<PublicKey, object>
Inherited from
Option(PublicKey).none
Defined in
node_modules/o1js/dist/node/lib/provable/option.d.ts:44
sizeInFields()
staticsizeInFields():number
Return the size of the T type in terms of Field type, as Field is the primitive type.
Returns
number
A number representing the size of the T type in terms of Field type.
Inherited from
Option(PublicKey).sizeInFields
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:51