@ngraveio/ur-blockchain-commons
Version:
A JS implementation of Uniform Resources(UR) Registry specification from Blockchain Commons.
31 lines • 970 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PSBT = void 0;
const bc_ur_1 = require("@ngraveio/bc-ur");
/**
* Partially Signed Bitcoin Transaction (PSBT)
*
* Definition: https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-006-urtypes.md#partially-signed-bitcoin-transaction-psbt-psbt
*/
class PSBT extends (0, bc_ur_1.registryItemFactory)({
tag: NaN, // This is just bytes, so no need to tag it for CBOR
URType: 'psbt',
CDDL: `bytes`,
}) {
constructor(psbt) {
super(psbt);
this.getPSBT = () => this.psbt;
this.psbt = psbt;
}
verifyInput(input) {
if (!(input instanceof Uint8Array)) {
return {
valid: false,
reasons: [new Error('Invalid data type for PSBT, data must be a Uint8Array')],
};
}
return { valid: true };
}
}
exports.PSBT = PSBT;
//# sourceMappingURL=PSBT.js.map