UNPKG

@tidecloak/js

Version:

TideCloak client side JS SDK

57 lines 1.77 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Hash_js_1 = require("../../Cryptide/Hashing/Hash.js"); const index_js_1 = require("../../Cryptide/index.js"); const Serialization_js_1 = require("../../Cryptide/Serialization.js"); const Utils_js_1 = require("../../Tools/Utils.js"); const BaseTideRequest_js_1 = __importDefault(require("../BaseTideRequest.js")); class CardanoTxBodySignRequest extends BaseTideRequest_js_1.default { /** * @param {string} authFlow */ constructor(authFlow) { super("CardanoTx", "1", authFlow, new Uint8Array()); this.txBody = null; } /** * @param {Uint8Array} contexts */ setTxBody(txBody) { this.txBody = txBody; } /** * Serializes the data into a draft format */ serializeDraft() { if (this.draft.length === 0) { const txBodyToSign = index_js_1.Serialization.base64ToBytes(this.txBody); this.draft = (0, Serialization_js_1.CreateTideMemory)(txBodyToSign, 4 + txBodyToSign.length); } } /** * Generates data to authorize * @returns {Promise<Uint8Array>} */ async getDataToAuthorize() { this.serializeDraft(); return super.dataToAuthorize(); } /** * @returns {Uint8Array} Draft copy */ getDraft() { this.serializeDraft(); return this.draft.slice(); } /** * @param {Uint8Array} draft */ setDraft(draft) { this.draft = draft; } } exports.default = CardanoTxBodySignRequest; //# sourceMappingURL=CardanoTxBodySignRequest.js.map