Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log( this.accountPublicKey );
let nodeAddress = 'http://52.77.224.13:8888';
config = {
keyProvider: this.accountPrivateKey, // WIF string or array of keys..
httpEndpoint: nodeAddress,
// mockTransactions: () => 'pass', // or 'fail'
// transactionHeaders: (expireInSeconds, callback) => {
// callback(null/*error*/, headers)
// },
expireInSeconds: 60,
broadcast: true,
debug: false,
sign: true,
chainId: '706a7ddd808de9fc2b8879904f3b392256c83104c1d544b38302cc07d9fca477',
};
this.eos = Eos.Testnet( config );
console.log( this.eos );
}
export function GetEOS( accountPrivateKey ) {
try {
const Eos = require( 'eosjs' );
const config = {
keyProvider: accountPrivateKey, // WIF string or array of keys..
httpEndpoint: nodeAddress,
expireInSeconds: 60,
broadcast: true,
debug: false,
sign: true,
chainId: chainId,
};
let eos = Eos.Testnet( config );
return eos;
} catch ( error ) {
return null;
}
}
const configureClient = (target, opts = {}) => {
if (!opts.keyProvider)
throw new Error(`api client connection needs a keyProvider`);
const eosNode = eos.Testnet({
keyProvider: opts.keyProvider,
httpEndpoint: apiEndpoint,
debug: process.env.NODE_ENV !== "production",
broadcast: false
});
return Object.assign(target, {
keyProvider: opts.keyProvider,
eos: eosNode
});
};