把大多数ticc方法的参数类型统一为 { ... } 对象

This commit is contained in:
陆柯 2022-08-03 16:30:21 +08:00
parent 94152ec736
commit bbba2589d5
2 changed files with 3 additions and 2 deletions

3
btc.js
View File

@ -10,7 +10,8 @@ const BTC_TXFEE = 30
class BTC { class BTC {
constructor (privateKey) { constructor (privateKey) {
if (!ticc.is_seckey(privateKey)) throw new Error('Invalid PrivateKey') if (!ticc.is_seckey({ seckey: privateKey }))
throw new Error('Invalid PrivateKey')
var publicKey = ticc.seckey_to_pubkey(privateKey) var publicKey = ticc.seckey_to_pubkey(privateKey)
Object.defineProperties(this, { Object.defineProperties(this, {
privateKey: { privateKey: {

2
tic.js
View File

@ -8,7 +8,7 @@ const TIC_NODE = require('./netConfig').TIC_NODE
class TIC { class TIC {
constructor (seckey, option = {}) { constructor (seckey, option = {}) {
if (!seckey || !ticc.is_seckey(seckey)) throw 'ERROR:Invalid Seckey' if (!seckey || !ticc.is_seckey({ seckey })) throw 'ERROR:Invalid Seckey'
Object.defineProperties(this, { Object.defineProperties(this, {
seckey: { seckey: {
value: seckey, value: seckey,