Skip to content

Instantly share code, notes, and snippets.

@dlarchikov
Created June 22, 2020 10:01
Show Gist options
  • Save dlarchikov/9c6d5246fa3467c8052cc5af9b9828fa to your computer and use it in GitHub Desktop.
Save dlarchikov/9c6d5246fa3467c8052cc5af9b9828fa to your computer and use it in GitHub Desktop.
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