Skip to main content

UnprovenOutput

@midnight/zswap v4.0.0-rc


@midnight/zswap / UnprovenOutput

Class: UnprovenOutput

An Output before being proven

All "shielded" information in the output can still be extracted at this stage!

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

Methods

serialize()

serialize(netid): Uint8Array<ArrayBufferLike>

Parameters

netid

NetworkId

Returns

Uint8Array<ArrayBufferLike>


toString()

toString(compact?): string

Parameters

compact?

boolean

Returns

string


deserialize()

static deserialize(raw, netid): UnprovenOutput

Parameters

raw

Uint8Array<ArrayBufferLike>

netid

NetworkId

Returns

UnprovenOutput


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 CoinInfo is transferred to the recipient another way

Parameters

coin

CoinInfo

segment

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

CoinInfo

segment

number

contract

string

Returns

UnprovenOutput