@taquito/taquito
Version:
High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.
47 lines • 2.1 kB
JavaScript
;
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.DelegationWalletOperation = void 0;
const rpc_1 = require("@taquito/rpc");
const operation_1 = require("./operation");
class DelegationWalletOperation 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();
return operationResult.find((x) => x.kind === rpc_1.OpKind.REVEAL);
});
}
delegationOperation() {
return __awaiter(this, void 0, void 0, function* () {
const operationResult = yield this.operationResults();
return operationResult.find((x) => x.kind === rpc_1.OpKind.DELEGATION);
});
}
status() {
return __awaiter(this, void 0, void 0, function* () {
if (!this._included) {
return 'pending';
}
const op = yield this.delegationOperation();
if (!op) {
return 'unknown';
}
return op.metadata.operation_result.status;
});
}
}
exports.DelegationWalletOperation = DelegationWalletOperation;
//# sourceMappingURL=delegation-operation.js.map