Created
June 22, 2020 10:01
-
-
Save dlarchikov/9c6d5246fa3467c8052cc5af9b9828fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from 'node-fetch' | |
import { Api, JsonRpc } from 'eosjs/dist' | |
import config from 'config' | |
import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig' | |
import { TextEncoder, TextDecoder } from 'util' | |
const rpc = new JsonRpc(config.get('daobet.apiEndpoint'), { fetch }) | |
// const defaultPrivateKey = config.get<string>('daobet.privateKey') | |
const defaultPrivateKey = '' | |
const signatureProvider = new JsSignatureProvider([defaultPrivateKey]) | |
const api = new Api({ | |
rpc, | |
signatureProvider, | |
textDecoder: new TextDecoder(), | |
textEncoder: new TextEncoder(), | |
}) | |
// api.transact({ | |
// actions: [{ | |
// account: 'eosio.token', | |
// name: 'transfer', | |
// authorization: [{ | |
// actor: 'walletback11', | |
// permission: 'active', | |
// }], | |
// data: { | |
// from: 'walletback11', | |
// to: 'walcccn1tt1q', | |
// quantity: '500.0000 USDB', | |
// memo: '', | |
// }, | |
// }] | |
// }, { | |
// blocksBehind: 3, | |
// expireSeconds: 30, | |
// }).then(r => console.log(r)).catch(e => console.log(e)) | |
api.transact({ | |
actions: [{ | |
account: 'eosio.token', | |
name: 'transfer', | |
authorization: [{ | |
actor: 'usdb', | |
permission: 'active', | |
}], | |
data: { | |
from: 'usdb', | |
to: 'walcccn1tt1q', | |
quantity: '500.0000 USDB', | |
memo: '', | |
}, | |
}] | |
}, { | |
blocksBehind: 3, | |
expireSeconds: 30, | |
}).then(r => console.log(r)).catch(e => console.log(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment