UNPKG

@radixdlt/application

Version:

A JavaScript client library for interacting with the Radix Distributed Ledger.

27 lines 974 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TransactionIdentifier = void 0; const neverthrow_1 = require("neverthrow"); const isTransactionIdentifier = (something) => { const inspection = something; return inspection.__hex !== undefined && inspection.__witness === 'isTXId'; }; const create = (bytes) => { const buffer = typeof bytes === 'string' ? Buffer.from(bytes, 'hex') : bytes; const length = 32; if (buffer.length !== length) { return (0, neverthrow_1.err)(new Error(`Expected #${length} bytes, but got #${buffer.length}`)); } const asString = buffer.toString('hex'); return (0, neverthrow_1.ok)({ __witness: 'isTXId', __hex: asString, toString: () => asString, equals: (other) => other.toString() === asString, }); }; exports.TransactionIdentifier = { is: isTransactionIdentifier, create, }; //# sourceMappingURL=transactionIdentifier.js.map