@btc-vision/transaction
Version:
OPNet transaction library allows you to create and sign transactions for the OPNet network.
16 lines (15 loc) • 570 B
JavaScript
import { Secp256k1PointDeriver } from '../keypair/Secp256k1PointDeriver.js';
class ContractAddressBase {
constructor() {
this.deriver = new Secp256k1PointDeriver();
}
generateHybridKeyFromHash(input) {
const p = this.deriver.findOrDeriveValidPoint(this.cloneBuffer(input), false);
const y = this.deriver.getCanonicalY(p.y1, p.y2);
return Buffer.from(this.deriver.getHybridPublicKey(p.x, y));
}
cloneBuffer(buffer) {
return Buffer.from(buffer);
}
}
export const ContractAddress = new ContractAddressBase();