@proto-kit/protocolDocs


Documentation / @proto-kit/protocol / RuntimeTransaction

Class: RuntimeTransaction

This struct is used to expose transaction information to the runtime method execution. This class has not all data included in transactions on purpose. For example, we don’t want to expose the signature or args as fields.

Extends

  • object

Constructors

new RuntimeTransaction()

new RuntimeTransaction(value): RuntimeTransaction

Parameters

value

value.argsHash: Field = Field

value.methodId: Field = Field

value.nonce: UInt64Option = UInt64Option

value.sender: PublicKeyOption = PublicKeyOption

Returns

RuntimeTransaction

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).constructor

Defined in

node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:103

Properties

argsHash

argsHash: Field = Field

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).argsHash

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:13


methodId

methodId: Field = Field

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).methodId

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:12


nonce

nonce: UInt64Option = UInt64Option

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).nonce

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:14


sender

sender: PublicKeyOption = PublicKeyOption

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).sender

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:15


_isStruct

static _isStruct: true

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, })._isStruct

Defined in

node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:104


check()

static check: (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

the element of type T to put assertions on.

value.argsHash: Field = Field

value.methodId: Field = Field

value.nonce: UInt64Option = UInt64Option

value.sender: PublicKeyOption = PublicKeyOption

Returns

void

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).check

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:60


empty()

static empty: () => object

Returns

object

argsHash

argsHash: Field = Field

methodId

methodId: Field = Field

nonce

nonce: UInt64Option = UInt64Option

sender

sender: PublicKeyOption = PublicKeyOption

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).empty

Defined in

node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:113


fromFields()

static fromFields: (fields, aux) => object

A function that returns an element of type T from the given provable and “auxiliary” data.

This function is the reverse operation of calling toFields and toAuxiliary methods on an element of type T.

Parameters

fields: Field[]

an array of Field elements describing the provable data of the new T element.

aux: any[]

an array of any type describing the “auxiliary” data of the new T element, optional.

Returns

object

An element of type T generated from the given provable and “auxiliary” data.

argsHash

argsHash: Field = Field

methodId

methodId: Field = Field

nonce

nonce: UInt64Option = UInt64Option

sender

sender: PublicKeyOption = PublicKeyOption

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).fromFields

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:45


fromJSON()

static fromJSON: (x) => object

Parameters

x

x.argsHash: string = Field

x.methodId: string = Field

x.nonce = UInt64Option

x.nonce.isSome: boolean = Bool

x.nonce.value: any = valueType

x.sender = PublicKeyOption

x.sender.isSome: boolean = Bool

x.sender.value: any = valueType

Returns

object

argsHash

argsHash: Field = Field

methodId

methodId: Field = Field

nonce

nonce: UInt64Option = UInt64Option

sender

sender: PublicKeyOption = PublicKeyOption

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).fromJSON

Defined in

node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:112


fromValue

static fromValue: (x) => object & (value) => object

Convert provable type from a normal JS type.

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).fromValue

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:68


toAuxiliary()

static toAuxiliary: (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?

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.argsHash?: Field = Field

value.methodId?: Field = Field

value.nonce?: UInt64Option = UInt64Option

value.sender?: PublicKeyOption = PublicKeyOption

Returns

any[]

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

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).toAuxiliary

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:34


toCanonical()?

static optional toCanonical: (x) => 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

x.argsHash: Field = Field

x.methodId: Field = Field

x.nonce: UInt64Option = UInt64Option

x.sender: PublicKeyOption = PublicKeyOption

Returns

object

argsHash

argsHash: Field = Field

methodId

methodId: Field = Field

nonce

nonce: UInt64Option = UInt64Option

sender

sender: PublicKeyOption = PublicKeyOption

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).toCanonical

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:85


toFields()

static toFields: (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

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

value.argsHash: Field = Field

value.methodId: Field = Field

value.nonce: UInt64Option = UInt64Option

value.sender: PublicKeyOption = PublicKeyOption

Returns

Field[]

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

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).toFields

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:24


toInput()

static toInput: (x) => object

Parameters

x

x.argsHash: Field = Field

x.methodId: Field = Field

x.nonce: UInt64Option = UInt64Option

x.sender: PublicKeyOption = PublicKeyOption

Returns

object

fields?

optional fields: Field[]

packed?

optional packed: [Field, number][]

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).toInput

Defined in

node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:107


toJSON()

static toJSON: (x) => object

Parameters

x

x.argsHash: Field = Field

x.methodId: Field = Field

x.nonce: UInt64Option = UInt64Option

x.sender: PublicKeyOption = PublicKeyOption

Returns

object

argsHash

argsHash: string = Field

methodId

methodId: string = Field

nonce

nonce: object = UInt64Option

nonce.isSome

nonce.isSome: boolean = Bool

nonce.value

nonce.value: any = valueType

sender

sender: object = PublicKeyOption

sender.isSome

sender.isSome: boolean = Bool

sender.value

sender.value: any = valueType

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).toJSON

Defined in

node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:111


toValue()

static toValue: (x) => object

Convert provable type to a normal JS type.

Parameters

x

x.argsHash: Field = Field

x.methodId: Field = Field

x.nonce: UInt64Option = UInt64Option

x.sender: PublicKeyOption = PublicKeyOption

Returns

object

argsHash

argsHash: bigint = Field

methodId

methodId: bigint = Field

nonce

nonce: object = UInt64Option

nonce.isSome

nonce.isSome: boolean = Bool

nonce.value

nonce.value: any = valueType

sender

sender: object = PublicKeyOption

sender.isSome

sender.isSome: boolean = Bool

sender.value

sender.value: any = valueType

Inherited from

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).toValue

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:64

Methods

assertTransactionType()

assertTransactionType(isMessage): void

Parameters

isMessage: Bool

Returns

void

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:61


hash()

hash(): Field

Returns

Field

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:106


hashData()

hashData(): Field[]

Returns

Field[]

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:80


isDummy()

isDummy(): Bool

Returns

Bool

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:76


dummyTransaction()

static dummyTransaction(): RuntimeTransaction

Returns

RuntimeTransaction

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:46


fromHashData()

static fromHashData(fields): RuntimeTransaction

Parameters

fields: Field[]

Returns

RuntimeTransaction

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:89


fromMessage()

static fromMessage(__namedParameters): RuntimeTransaction

Parameters

__namedParameters

__namedParameters.argsHash: Field

__namedParameters.methodId: Field

Returns

RuntimeTransaction

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:31


fromTransaction()

static fromTransaction(input): RuntimeTransaction

Parameters

input

input.argsHash: Field

input.methodId: Field

input.nonce: UInt64

input.sender: PublicKey

Returns

RuntimeTransaction

Defined in

packages/protocol/src/model/transaction/RuntimeTransaction.ts:17


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

Struct({ methodId: Field, argsHash: Field, nonce: UInt64Option, sender: PublicKeyOption, }).sizeInFields

Defined in

node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:51