1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| claim_account() { const creator = "lemooljiang" const active_key = "5Jffffffffff" return new Promise(resolve => { const wif = this.dsteem.PrivateKey.fromString(active_key) const fee = this.dsteem.Asset.from(0, 'STEEM') const op = [ 'claim_account', { creator: creator, extensions: [], fee: fee }]
this.client.broadcast.sendOperations([op], wif).then(function (result) { console.log('11,Included in block: ' + result.block_num) console.log('222,申明新帐户创建成功!' ) resolve("ok") }, function (error) { console.error(error) console.log('333,申明新帐户创建失败!' ) resolve("err") }) }) }, create_discounted_account() { const creator = "lemooljiang" const active_key = "5Jofffffffffffff" const username = this.username const password = this.password return new Promise(resolve => { const wif = this.dsteem.PrivateKey.fromString(active_key) const prefix = this.client.addressPrefix const ownerKey = this.dsteem.PrivateKey.fromLogin(username, password, 'owner').createPublic(prefix) let owner = this.dsteem.Authority.from(ownerKey) const activeKey = this.dsteem.PrivateKey.fromLogin(username, password, 'active').createPublic(prefix) let active = this.dsteem.Authority.from(activeKey) const postingKey = this.dsteem.PrivateKey.fromLogin(username, password, 'posting').createPublic(prefix) let posting = this.dsteem.Authority.from(postingKey) let memo_key = this.dsteem.PrivateKey.fromLogin(username, password, 'memo').createPublic(prefix)
const metadata = {date: new Date()} const create_op = [ 'create_claimed_account', { active, creator, extensions: [], json_metadata: metadata ? JSON.stringify(metadata) : '', memo_key, new_account_name: username, owner, posting, } ]
this.client.broadcast.sendOperations([create_op], wif).then(function (result) { console.log('22, Included in block: ' + result.block_num) console.log('666,新帐户创建成功!' ) resolve("ok") }, function (error) { console.log('444,新帐户创建失败!' ) console.error(error) resolve("err") }) }) },
|