Skip to main content

AccountUpdateTree

Defined in: lib/mina/v1/account-update.ts:1359

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

Constructors

new AccountUpdateTree()

new AccountUpdateTree(value: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}): AccountUpdateTree

Defined in: lib/provable/types/struct.ts:265

Parameters

value
accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

id

number = RandomId

Returns

AccountUpdateTree

Inherited from

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

Properties

accountUpdate

accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;

Defined in: lib/mina/v1/account-update.ts:1361

Inherited from

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

children

children: AccountUpdateForest = AccountUpdateForest;

Defined in: lib/mina/v1/account-update.ts:1362

Inherited from

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

id

id: number = RandomId;

Defined in: lib/mina/v1/account-update.ts:1360

Inherited from

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

_isStruct

static _isStruct: true;

Defined in: lib/provable/types/struct.ts:265

Inherited from

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

check()

static check: (value: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}) => void;

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

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.

accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

id

number = RandomId

Returns

void

Inherited from

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

fromValue()

static fromValue: (x: any) => {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
};

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

Convert provable type from a normal JS type.

Parameters

x

any

Returns

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

Inherited from

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

toAuxiliary()

static toAuxiliary: (value?: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}) => any[];

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

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.

accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

id

number = RandomId

Returns

any[]

An array of any type describing how this T element is made up of "auxiliary" (non-provable) data.

Inherited from

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

toCanonical()?

static optional toCanonical: (x: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}) => {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
};

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

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
accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

id

number = RandomId

Returns

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

Inherited from

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

toFields()

static toFields: (value: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}) => Field[];

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

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.

accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

id

number = RandomId

Returns

Field[]

A Field array describing how this T element is made up of Field elements.

Inherited from

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

toInput()

static toInput: (x: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}) => {
fields: Field[];
packed: [Field, number][];
};

Defined in: lib/provable/types/struct.ts:268

Parameters

x
accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

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

toValue()

static toValue: (x: {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
id: number;
}) => any;

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

Convert provable type to a normal JS type.

Parameters

x
accountUpdate

Hashed<AccountUpdate> = HashedAccountUpdate

children

AccountUpdateForest = AccountUpdateForest

id

number = RandomId

Returns

any

Inherited from

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

Methods

approve()

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

Defined in: lib/mina/v1/account-update.ts:1381

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

See AccountUpdate.approve.

Parameters

update

AccountUpdate | AccountUpdateTree

hash?

Field

Returns

void


empty()

static empty(): AccountUpdateTree

Defined in: lib/mina/v1/account-update.ts:1394

Returns

AccountUpdateTree

Overrides

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

from()

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

Defined in: lib/mina/v1/account-update.ts:1367

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

Parameters

update

AccountUpdate | AccountUpdateTree

hash?

Field

Returns

AccountUpdateTree


fromFields()

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

Defined in: lib/mina/v1/account-update.ts:1391

Parameters

fields

Field[]

aux

any

Returns

AccountUpdateTree

Overrides

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

sizeInFields()

static sizeInFields(): number

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

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