UNPKG

@taquito/taquito

Version:

High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.

54 lines 2.42 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TransactionWalletOperation = void 0; const operation_1 = require("./operation"); const rpc_1 = require("@taquito/rpc"); const errors_1 = require("./errors"); class TransactionWalletOperation extends operation_1.WalletOperation { constructor(opHash, context, newHead$) { super(opHash, context, newHead$); this.opHash = opHash; this.context = context; } revealOperation() { return __awaiter(this, void 0, void 0, function* () { const operationResult = yield this.operationResults(); if (!operationResult) { throw new errors_1.ObservableError('operationResult returned undefined'); } return operationResult.find((x) => x.kind === rpc_1.OpKind.REVEAL); }); } transactionOperation() { return __awaiter(this, void 0, void 0, function* () { const operationResult = yield this.operationResults(); if (!operationResult) { throw new errors_1.ObservableError('operationResult returned undefined'); } return operationResult.find((x) => x.kind === rpc_1.OpKind.TRANSACTION); }); } status() { return __awaiter(this, void 0, void 0, function* () { if (!this._included) { return 'pending'; } const op = yield this.transactionOperation(); if (!op) { return 'unknown'; } return op.metadata.operation_result.status; }); } } exports.TransactionWalletOperation = TransactionWalletOperation; //# sourceMappingURL=transaction-operation.js.map