/**
* Transfers sp or sbd to another account
* @param {String} wif - active key of the account we want to transfer from
* @param {String} from - account who will send the tokens
* @param {String} to - account who will recieve the tokens
* @param {String} amount - Amount of tokens that you want to send, note that it must be written like this : x.xxx unit eg : '1.265 STEEM' or '44.000 SBD'
"X.XXX STEEM" must have 3 decimal places. e.g. "25.100 STEEM". Must be denominated in STEEM
* @param {String} memo - text you want to add to your transfer
*/
function transfer(wif, from, to, amount, memo)
{
steem.broadcast.transfer(wif, from, to, amount, memo, function(err, result) {
console.log(err, result);
});
}
// example (note, you can send transfers to yourself)
transfer("wif", "howo", "howo", "0.001 SBD", "You are awesome ! take some tokens")
eg:
async transferSteem(){
let from = "timool"
let to = "lemooljiang"
let wif = "5KNxxxxxxxxxxxxxxxx"
let amount = "100.200 STEEM"
let memo = "测试"
await this.steem.broadcast.transferAsync(wif, from, to, amount, memo)
},
async steemTransfer() {
try{
this.isLoading = true
this.exchangeFlag = false
let from = this.$store.state.username
let to = this.to
let active
if(this.$store.state.active === null){
active = this.active
}else{
active = this.$store.state.active
}
let ss = parseFloat(this.steemvalue).toFixed(3)
let amount = ss+' STEEM'
// let amount = "100.200 STEEM"
let memo = addr+" +"+ss+' TSTEEM'
await this.steem.broadcast.transferAsync(active, from, to, amount, memo)
this.steemvalue = ''
this.isLoading = false
}
catch(e){
this.isLoading = false
alert("错误\n" + e)
}
},
Sort: Trending