Skip to main content

fromJSON

function fromJSON(json: string | ZkappCommand): Transaction<false, false>;

Defined in: lib/mina/v1/transaction.ts:102

Deserializes a transaction from a JSON object or JSON string representation. This method accepts both parsed JSON objects and JSON strings, making it flexible for different use cases.

Parameters

json

A JSON object representation of a transaction (Types.Json.ZkappCommand) or a JSON string

string | ZkappCommand

Returns

Transaction<false, false>

A new Transaction instance reconstructed from the JSON input

Example

const originalTx = await Mina.transaction(sender, () => {
zkapp.someMethod();
});
const serialized = originalTx.toJSON();
const deserializedTx = Transaction.fromJSON(serialized);