- 创建fotoken目录
mkdir fotoken
cd fotoken
- 新建package.json文件
{
"name": "fotoken",
"version": "1.0.0",
"description": "",
"repository": "",
"keywords": "",
"author": "watano@qq.com",
"license": "MIT"
}
- 新建fotoken.js文件
var FIBOS = require('fibos.js');
var http = require('http');
const foAccount = 'fiboscouncil'; //公开的兑换fo帐号
const fibosMainNetChainId = '6aa7bd33b6b45192465afa3553dedb531acaaff8928cf64b70bd4c5e49b7ec6a'; //FIBOS MainNet 主网chainId
const fibosHttpEndpoint = 'http://se-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址
//const fibosHttpEndpoint = 'http://sl-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址
//const fibosHttpEndpoint = 'http://to-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址
//const fibosHttpEndpoint = 'http://ca-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址
//const fibosHttpEndpoint = 'http://ln-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址
//const fibosHttpEndpoint = 'http://va-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址
const eosMainNetChainId = 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'; //EOS MainNet 主网chainId
const eosHttpEndpoint = 'http://api-mainnet1.starteos.io'; //EOS MainNet 主网RPC地址
const fibosAccount = ''; //你的 FIBOS 账户名
const fibosPubKey = ''; //你的 FIBOS 公钥
const fibosPriKey = ''; //你的 FIBOS 私钥
const eosAccount = ''; //你的EOS账户名
const eosPriKey = ''; //你的EOS私钥
const eosNum = '0.5000'; //购买数量
//创建帐号
//var httpClient = new http.Client();
//var rep = httpClient
// .post('http://tunnel.fibos.io/1.0/app/token/create', {
// json: {
// account: fibosAccount,
// pubkey: fibosPubKey,
// },
// })
// .json();
//console.log(rep);
//发起转账操作
//var eos_client = FIBOS({
// chainId: eosMainNetChainId,
// keyProvider: eosPriKey,
// httpEndpoint: eosHttpEndpoint,
// verbose: true,
// logger: {
// log: null,
// error: null,
// },
//});
//let ctx = eos_client.contractSync('eosio.token');
//let result = ctx.transferSync(eosAccount, foAccount, eosNum+' EOS', fibosAccount);
//console.log(result);
var fibos_client = FIBOS({
chainId: fibosMainNetChainId,
keyProvider: fibosPriKey,
httpEndpoint: fibosHttpEndpoint,
verbose: true,
logger: {
log: null,
error: null,
},
});
//兑换通证
//let ctx = fibos_client.contractSync('eosio.token');
//result = ctx.exchangeSync(fibosAccount, eosNum+' EOS@eosio', '0.0000 FO@eosio', 'exchange EOS to FO',
// {
// authorization: fibosAccount,
// },
//);
//console.log(result);
//查询 FIBOS 余额
var rs = fibos_client.getTableRowsSync(
true,
'eosio.token',
fibosAccount,
'accounts',
);
console.log(rs);
- 安装相关依赖
fibos --install fibos.js
获取fibos的公钥和私钥
http://103.80.170.107:8080/使用EOS转帐工具转帐eos到
fiboscouncil
, 并备注你的FIBOS帐号
推荐使用比特派, more wallet钱包
7.修改fotoken.js文件中的fibosAccount, fibosPubKey, fibosPriKey, eosAccount, eosPriKey, eosNum变量
- 执行余额查询
fibos fotoken.js
如果正确显示EOS余额,则表示转帐成功. 如果不能显示则等待1分钟左右再次运行此命令查看.
- 删除fotoken.js文件中的
兑换通证
下面代码的注释,并执行以下命令:
fibos fotoken.js