Skip to content

Latest commit

 

History

History
138 lines (97 loc) · 2.39 KB

dex-transaction.md

File metadata and controls

138 lines (97 loc) · 2.39 KB

DEX Transactions

You should never have to create DEX transactions yourself. However, the documentation below gives a rundown on how you can obtain information for your swap transactions, as well as listen for specific events through the Tx lifecycle.

Getters

hash(): string Get the Tx hash if available
Using
console.log(transaction.hash);

isSigned(): boolean Get whether the Tx has been signed
Using
console.log(transaction.isSigned);

payments(): PayToAddress[] Get the address payments made for the Tx
Using
console.log(transaction.payments);

status(): TransactionStatus Get the current status of the transaction
Using
console.log(transaction.status);

Listen for Events

onBuilding(TransactionCallback): DexTransaction Tx is in building status
Using
transaction.onBuilding(() => {
    console.log('Tx building');
});

onSigning(TransactionCallback): DexTransaction Tx is in signing status
Using
transaction.onSigning(() => {
    console.log('Tx signing');
});

onSubmitting(TransactionCallback): DexTransaction Tx is in submitting status
Using
transaction.onSubmitting(() => {
    console.log('Tx submitting to chain');
});

onSubmitted(TransactionCallback): DexTransaction Tx has been submitted on-chain
Using
transaction.onSubmitted(() => {
    console.log('Tx submitted');
});

onError(TransactionCallback): DexTransaction Error has occurred with the transaction
Using
transaction.onError(() => {
    console.log('Something went wrong');
});

onFinally(TransactionCallback): DexTransaction Everything went OK or error has occurred
Using
transaction.onFinally(() => {
    console.log('All complete or has errored');
});