Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as Web3 from "web3";
import * as gremlin from "gremlin";
let web3: Web3;
export default web3;
if (web3 !== undefined) {
web3 = new Web3(Web3.currentProvider);
} else {
// TODO - move to configuration
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
const client = gremlin.createClient();
const tt = gremlin.makeTemplateTag(client);
export class Account {
id: string;
address: string;
abiInterface: string;
constructor(address: string, abiInterface?: string) {
this.address = address;
this.abiInterface = abiInterface;
}
balance() {
const balance = web3.eth.getBalance(this.address);
return balance.toString(10);
}
module.exports = async function () {
let result;
var configObject = {
"session": false,
"ssl": true,
"user": `/dbs/${config.database}/colls/${config.collection}`,
"password": config.primarykey
};
const client = Gremlin.createClient(443, config.endpoint, configObject);
const gremlin = Gremlin.makeTemplateTag(client);
const runQuery = async () => {
let data = {
dates: ['11/9', '11/10', '11/11', '11/12', '11/13', '11/14', '11/15'],
"Diamond Hotel": {
positiveTweetCounts: [0, 0, 0, 0, 0, 0, 0],
negativeTweetCounts: [0, 0, 0, 0, 0, 0, 0]
},
"Platinum Hotel": {
positiveTweetCounts: [0, 0, 0, 0, 0, 0, 0],
negativeTweetCounts: [0, 0, 0, 0, 0, 0, 0]
},
"Gold Hotel": {
positiveTweetCounts: [0, 0, 0, 0, 0, 0, 0],
negativeTweetCounts: [0, 0, 0, 0, 0, 0, 0]
}