Methods

(inner) exchangeAccept(client, exchangeAccount, releasePublicKey)

Initializes an Exchange account.

Parameters:
NameTypeDescription
clientObject

The NinaClient instance.

exchangeAccountString

The public key of the Exchange account.

releasePublicKeyString

The public key of the Release account.

(inner) exchangeCancel(client, exchangeAccount) → {Object}

Cancels an initialized Exchange.

Parameters:
NameTypeDescription
clientObject

The NinaClient instance.

exchangeAccountString

The public key of the Exchange account.

Returns:

The transaction id and the public key of the Exchange.

Type: 
Object
Example
const canceledExchange = await exchangeCancel(client, exchangeAccount);

(inner) exchangeInit(client, exchangeAccount, isSelling, releasePublicKey) → {Object}

Initializes an Exchange account.

Parameters:
NameTypeDescription
clientObject

The NinaClient instance.

exchangeAccountString

The public key of the Exchange account.

isSellingBoolean

Whether the Exchange is selling or buying.

releasePublicKeyString

The public key of the Release account.

Returns:

The transaction id, the Exchange account, the Release Public Key, and the Exchange Signer.

Type: 
Object

(inner) fetch(publicKey, withAccountDataopt, transactionIdopt)

Fetches an exchange.

Parameters:
NameTypeAttributesDefaultDescription
publicKeyString

The Public key of an Exchange account.

withAccountDataBoolean<optional>
false

Include full on-chain Exchange account.

transactionIdString<optional>

A transaction id from an interaction with an account - cancelling and completing Exchanges closes their on-chain accounts - by fetching a transaction we can have more context around interactions with an Exchange - useful for indexing.

Example
const exchange = await NinaClient.Exchange.fetch('Fxv2G4cQQAeEXN2WkaSAusbNV7E1ouV9W6XHXf3DEfQ8');

(inner) fetchAll(paginationopt, withAccountDataopt)

Fetches all exchanges.

Parameters:
NameTypeAttributesDefaultDescription
paginationObject<optional>
{limit: 20, offset: 0, sort: 'desc'}

Pagination options.

withAccountDataBoolean<optional>
false

Include full on-chain Exchange accounts.

Example
const exchanges = await NinaClient.Exchange.fetchAll();