Skip to main content

ZswapOffer

@midnight/ledger v7.0.0


@midnight/ledger / ZswapOffer

Class: ZswapOffer<P>

A full Zswap offer; the zswap part of a transaction

Consists of sets of ZswapInputs, ZswapOutputs, and ZswapTransients, as well as a deltas vector of the transaction value

Type Parameters

P

P extends Proofish

Properties

deltas

readonly deltas: Map<string, bigint>;

The value of this offer for each token type; note that this may be negative

This is input coin values - output coin values, for value vectors


inputs

readonly inputs: ZswapInput<P>[];

The inputs this offer is composed of


outputs

readonly outputs: ZswapOutput<P>[];

The outputs this offer is composed of


transients

readonly transients: ZswapTransient<P>[];

The transients this offer is composed of

Methods

merge()

merge(other): ZswapOffer<P>;

Combine this offer with another

Parameters

other

ZswapOffer<P>

Returns

ZswapOffer<P>


serialize()

serialize(): Uint8Array;

Returns

Uint8Array


toString()

toString(compact?): string;

Parameters

compact?

boolean

Returns

string


deserialize()

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

Type Parameters

P

P extends Proofish

Parameters

markerP

P["instance"]

raw

Uint8Array

Returns

ZswapOffer<P>


fromInput()

static fromInput<P>(
input,
type_?,
value?): ZswapOffer<P>;

Creates a singleton offer, from an ZswapInput and its value vector

The type_ and value parameters are deprecated and will be ignored.

Type Parameters

P

P extends Proofish

Parameters

input

ZswapInput<P>

type_?

string

value?

bigint

Returns

ZswapOffer<P>


fromOutput()

static fromOutput<P>(
output,
type_?,
value?): ZswapOffer<P>;

Creates a singleton offer, from an ZswapOutput and its value vector

The type_ and value parameters are deprecated and will be ignored.

Type Parameters

P

P extends Proofish

Parameters

output

ZswapOutput<P>

type_?

string

value?

bigint

Returns

ZswapOffer<P>


fromTransient()

static fromTransient<P>(transient): ZswapOffer<P>;

Creates a singleton offer, from a ZswapTransient

Type Parameters

P

P extends Proofish

Parameters

transient

ZswapTransient<P>

Returns

ZswapOffer<P>