UNPKG

opnet

Version:

The perfect library for building Bitcoin-based applications.

39 lines (38 loc) 1.55 kB
import { Address } from '@btc-vision/transaction'; export class ContractData { contractAddress; contractPublicKey; bytecode; wasCompressed; deployedTransactionId; deployedTransactionHash; deployerPubKey; contractSeed; contractSaltHash; deployerAddress; constructor(raw) { this.contractAddress = raw.contractAddress; this.contractPublicKey = Buffer.isBuffer(raw.contractTweakedPublicKey) ? new Address(raw.contractTweakedPublicKey) : new Address(Buffer.from(raw.contractTweakedPublicKey, 'base64')); this.bytecode = Buffer.isBuffer(raw.bytecode) ? raw.bytecode : Buffer.from(raw.bytecode, 'base64'); this.wasCompressed = raw.wasCompressed; this.deployedTransactionId = raw.deployedTransactionId; this.deployedTransactionHash = raw.deployedTransactionHash; this.deployerPubKey = Buffer.isBuffer(raw.deployerPubKey) ? raw.deployerPubKey : Buffer.from(raw.deployerPubKey, 'base64'); this.contractSeed = Buffer.isBuffer(raw.contractSeed) ? raw.contractSeed : Buffer.from(raw.contractSeed, 'base64'); this.contractSaltHash = Buffer.isBuffer(raw.contractSaltHash) ? raw.contractSaltHash : Buffer.from(raw.contractSaltHash, 'base64'); this.deployerAddress = !raw.deployerAddress && this.deployerPubKey ? new Address(this.deployerPubKey) : raw.deployerAddress; } }