scrypt-ts-transpiler
Version:
```bash npm i npx scryptlib download npm t ```
40 lines • 1.6 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EMPTY_CONSTRUCTOR = exports.TIME_LOCK_FUNCTION = exports.VERIFY_PREVOUTS = exports.REQUIRE_PREVOUTS_EMPTY = exports.INIT_PREVOUTS = exports.INIT_CHANGE = exports.CHANGE_STRUCT = exports.BUILD_CHANGE_OUTPUT_FUNCTION = exports.BUILD_STATE_OUTPUT_FUNCTION = void 0;
exports.BUILD_STATE_OUTPUT_FUNCTION = `
function buildStateOutput(int amount) : bytes {
return Utils.buildOutput(this.getStateScript(), amount);
}
`;
exports.BUILD_CHANGE_OUTPUT_FUNCTION = `
function buildChangeOutput() : bytes {
return this.__scrypt_ts_change.amount > 0 ? Utils.buildOutput(Utils.buildPublicKeyHashScript(this.__scrypt_ts_change.address), this.__scrypt_ts_change.amount) : b'';
}
`;
exports.CHANGE_STRUCT = `
struct __scrypt_ts_Change {
int amount;
Ripemd160 address;
}
`;
exports.INIT_CHANGE = `this.__scrypt_ts_change = {__scrypt_ts_changeAmount, __scrypt_ts_changeAddress};`;
exports.INIT_PREVOUTS = `this.__scrypt_ts_prevouts = __scrypt_ts_prevouts;`;
exports.REQUIRE_PREVOUTS_EMPTY = `require(__scrypt_ts_prevouts == b'');`;
exports.VERIFY_PREVOUTS = `require(hash256(__scrypt_ts_prevouts) == this.__scrypt_ts_ctx_hashprevouts);`;
exports.TIME_LOCK_FUNCTION = `
function timeLock(int locktime): bool {
bool res = true;
res = this.__scrypt_ts_ctx_sequence < 0xffffffff;
if (
locktime < 500000000
) {
res = res && this.__scrypt_ts_ctx_locktime < 500000000;
}
return res && this.__scrypt_ts_ctx_locktime >= locktime;
}
`;
exports.EMPTY_CONSTRUCTOR = `
constructor(){
}
`;
//# sourceMappingURL=snippets.js.map