Skip to main content
Module

x/lucid/src/lucid/tx_signed.ts

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.
Very Popular
Go to Latest
File
import { C } from "../core/mod.ts";import { Transaction, TxHash } from "../types/mod.ts";import { Lucid } from "./lucid.ts";import { toHex } from "../utils/mod.ts";
export class TxSigned { txSigned: C.Transaction; private lucid: Lucid; constructor(lucid: Lucid, tx: C.Transaction) { this.lucid = lucid; this.txSigned = tx; }
async submit(): Promise<TxHash> { return await (this.lucid.wallet || this.lucid.provider).submitTx( toHex(this.txSigned.to_bytes()), ); }
/** Returns the transaction in Hex encoded Cbor. */ toString(): Transaction { return toHex(this.txSigned.to_bytes()); }
/** Return the transaction hash. */ toHash(): TxHash { return C.hash_transaction(this.txSigned.body()).to_hex(); }}