Skip to main content

AccountUpdateTree

Class which represents a tree of account updates, in a compressed way which allows iterating and selectively witnessing the account updates.

The (recursive) type signature is:

type AccountUpdateTree = {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
};
type AccountUpdateForest = MerkleList<AccountUpdateTree>;

Extends​

  • {"accountUpdate": HashedAccountUpdate; "children": AccountUpdateForest; "id": RandomId; }

Constructors​

new AccountUpdateTree()​

new AccountUpdateTree(value: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}): AccountUpdateTree

Parameters​

• value

• value.accountUpdate: Hashed\<AccountUpdate>= HashedAccountUpdate

• value.children: AccountUpdateForest= AccountUpdateForest

• value.id: number= RandomId

Returns​

AccountUpdateTree

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).constructor

Source​

lib/provable/types/struct.ts:280

Properties​

accountUpdate​

accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).accountUpdate

Source​

lib/mina/account-update.ts:1468


children​

children: AccountUpdateForest = AccountUpdateForest;

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).children

Source​

lib/mina/account-update.ts:1469


id​

id: number = RandomId;

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).id

Source​

lib/mina/account-update.ts:1467


_isStruct​

static _isStruct: true;

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, })._isStruct

Source​

lib/provable/types/struct.ts:280


check()​

static check: (value: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}) => 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

the element of type T to put assertions on.

• value.accountUpdate: Hashed\<AccountUpdate>= HashedAccountUpdate

• value.children: AccountUpdateForest= AccountUpdateForest

• value.id: number= RandomId

Returns​

void

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).check

Source​

lib/provable/types/provable-intf.ts:76


fromValue()​

static fromValue: (x: any) => {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
};

Convert provable type from a normal JS type.

Parameters​

• x: any

Returns​

{
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}
accountUpdate​
accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;
children​
children: AccountUpdateForest = AccountUpdateForest;
id​
id: number = RandomId;

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).fromValue

Source​

lib/provable/types/provable-intf.ts:86


toAuxiliary()​

static toAuxiliary: (value?: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}) => 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?

the element of type T to generate the auxiliary data array from, optional. If not provided, a default value for auxiliary data is returned.

• value.accountUpdate?: Hashed\<AccountUpdate>= HashedAccountUpdate

• value.children?: AccountUpdateForest= AccountUpdateForest

• value.id?: number= RandomId

Returns​

any[]

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).toAuxiliary

Source​

lib/provable/types/provable-intf.ts:47


toCanonical()?​

static optional toCanonical: (x: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}) => {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
};

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

• x.accountUpdate: Hashed\<AccountUpdate>= HashedAccountUpdate

• x.children: AccountUpdateForest= AccountUpdateForest

• x.id: number= RandomId

Returns​

{
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}
accountUpdate​
accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;
children​
children: AccountUpdateForest = AccountUpdateForest;
id​
id: number = RandomId;

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).toCanonical

Source​

lib/provable/types/provable-intf.ts:104


toFields()​

static toFields: (value: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}) => 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

the element of type T to generate the Field array from.

• value.accountUpdate: Hashed\<AccountUpdate>= HashedAccountUpdate

• value.children: AccountUpdateForest= AccountUpdateForest

• value.id: number= RandomId

Returns​

Field[]

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).toFields

Source​

lib/provable/types/provable-intf.ts:36


toInput()​

static toInput: (x: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}) => {
"fields": Field[];
"packed": [Field, number][];
};

Parameters​

• x

• x.accountUpdate: Hashed\<AccountUpdate>= HashedAccountUpdate

• x.children: AccountUpdateForest= AccountUpdateForest

• x.id: number= RandomId

Returns​

{
"fields": Field[];
"packed": [Field, number][];
}
fields?​
optional fields: Field[];
packed?​
optional packed: [Field, number][];

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).toInput

Source​

lib/provable/types/struct.ts:283


toValue()​

static toValue: (x: {
"accountUpdate": HashedAccountUpdate;
"children": AccountUpdateForest;
"id": RandomId;
}) => any;

Convert provable type to a normal JS type.

Parameters​

• x

• x.accountUpdate: Hashed\<AccountUpdate>= HashedAccountUpdate

• x.children: AccountUpdateForest= AccountUpdateForest

• x.id: number= RandomId

Returns​

any

Inherited from​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).toValue

Source​

lib/provable/types/provable-intf.ts:81

Methods​

approve()​

approve(update: AccountUpdate | AccountUpdateTree, hash?: Field): void

Add an AccountUpdate or AccountUpdateTree to the children of this tree's root.

See AccountUpdate.approve.

Parameters​

• update: AccountUpdate | AccountUpdateTree

• hash?: Field

Returns​

void

Source​

lib/mina/account-update.ts:1488


empty()​

static empty(): AccountUpdateTree

Returns​

AccountUpdateTree

Overrides​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).empty

Source​

lib/mina/account-update.ts:1504


from()​

static from(update: AccountUpdate | AccountUpdateTree, hash?: Field): AccountUpdateTree

Create a tree of account updates which only consists of a root.

Parameters​

• update: AccountUpdate | AccountUpdateTree

• hash?: Field

Returns​

AccountUpdateTree

Source​

lib/mina/account-update.ts:1474


fromFields()​

static fromFields(fields: Field[], aux: any): AccountUpdateTree

Parameters​

• fields: Field[]

• aux: any

Returns​

AccountUpdateTree

Overrides​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).fromFields

Source​

lib/mina/account-update.ts:1501


sizeInFields()​

static sizeInFields(): 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​

StructNoJson({ id: RandomId, accountUpdate: HashedAccountUpdate, children: AccountUpdateForest, }).sizeInFields

Source​

lib/provable/types/provable-intf.ts:66