Skip to main content

ZswapOutput

@midnight/ledger v7.0.0


@midnight/ledger / ZswapOutput

Class: ZswapOutput<P>

A shielded transaction output

Type Parameters

P

P extends Proofish

Properties

commitment

readonly commitment: string;

The commitment of the output


contractAddress

readonly contractAddress: undefined | string;

The contract address receiving the output, if the recipient is a contract


proof

readonly proof: P;

The proof of this output

Methods

serialize()

serialize(): Uint8Array;

Returns

Uint8Array


toString()

toString(compact?): string;

Parameters

compact?

boolean

Returns

string


deserialize()

static deserialize<P>(markerP, raw): ZswapOutput<P>;

Type Parameters

P

P extends Proofish

Parameters

markerP

P["instance"]

raw

Uint8Array

Returns

ZswapOutput<P>


new()

static new(
coin,
segment,
target_cpk,
target_epk): UnprovenOutput;

Creates a new output, targeted to a user's coin public key.

Optionally the output contains a ciphertext encrypted to the user's encryption public key, which may be omitted only if the ShieldedCoinInfo is transferred to the recipient another way

Parameters

coin

ShieldedCoinInfo

segment

undefined | number

target_cpk

string

target_epk

string

Returns

UnprovenOutput


newContractOwned()

static newContractOwned(
coin,
segment,
contract): UnprovenOutput;

Creates a new output, targeted to a smart contract

A contract must also explicitly receive a coin created in this way for the output to be valid

Parameters

coin

ShieldedCoinInfo

segment

undefined | number

contract

string

Returns

UnprovenOutput