Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const addressContractBurner = 0;
const feesPerTenThousand = 10; // 0.1 %
import requestArtifacts from 'requestnetworkartifacts';
import { Web3Single } from '../src/servicesExternal/web3-Single';
const requestCoreJson = requestArtifacts('private', 'last-RequestCore');
const requestEthereumJson = requestArtifacts('private', 'last-RequestEthereum');
const requestBurnManagerSimple = requestArtifacts('private', 'last-RequestBurnManagerSimple');
Web3Single.init('http://localhost:8545', 10000000000);
const web3Single = Web3Single.getInstance();
const instanceRequestCore = new web3Single.web3.eth.Contract(requestCoreJson.abi);
const instanceRequestEthereum = new web3Single.web3.eth.Contract(requestEthereumJson.abi);
const instancerequestBurnManagerSimple = new web3Single.web3.eth.Contract(requestBurnManagerSimple.abi)
let addressRequestCore: string;
let addressRequestEthereum: string;
let addressrequestBurnManagerSimple: string;
let newContractInstanceRequestCore: any;
let newContractInstanceRequestEthereum: any;
let newContractInstancerequestBurnManagerSimple: any;
web3Single.getDefaultAccount().then((creator) => {
// Test token on rinkeby
'RequestERC20-centralbank': Types.Currency.REQ,
'RequestERC20-knc': Types.Currency.KNC,
'RequestERC20-dgx': Types.Currency.DGX,
'RequestERC20-dai': Types.Currency.DAI,
'RequestERC20-omg': Types.Currency.OMG,
'RequestERC20-kin': Types.Currency.KIN,
'RequestERC20-zrx': Types.Currency.ZRX,
'RequestERC20-bat': Types.Currency.BAT,
'RequestERC20-bnb': Types.Currency.BNB,
'RequestERC20-link': Types.Currency.LINK,
};
const currencyContractName = requestArtifacts.getContractNameForAddress(address.toLowerCase());
return currencyMapping[currencyContractName];
},
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount: string;
let payer: string;
let payee: string;
let otherGuy: string;
let currentNumRequest: any;
let signedRequest: any;
describe('broadcastSignedRequestAsPayer', () => {
const arbitraryAmount = 100000000;
rn = new RequestNetwork('http://localhost:8545', 10000000000, false);
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount: string;
let payer: string;
let payee: string;
let otherGuy: string;
let coreVersion: any;
let currentNumRequest: any;
describe('getRequestByTransactionHash', () => {
const arbitraryAmount = 100000000;
rn = new RequestNetwork('http://localhost:8545', 10000000000);
web3 = rn.requestEthereumService.web3Single.web3;
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount: string;
let payer: string;
let payee: string;
let otherGuy: string;
let coreVersion: any;
let currentNumRequest: any;
let requestId: any;
describe('paymentAction', () => {
const arbitraryAmount = 100000000;
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount;
let payer: any;
let payee: any;
let otherGuy: any;
let coreVersion: any;
let currentNumRequest: any;
let requestId: any;
describe('cancel', () => {
const arbitraryAmount = 100000000;
rn = new RequestNetwork('http://localhost:8545', 10000000000, false);
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount: string;
let payer: string;
let payee: string;
let otherGuy: string;
let coreVersion: any;
let currentNumRequest: any;
let requestId: any;
describe('refundAction', () => {
const arbitraryAmount = 100000000;
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount: string;
let payer: string;
let payee: string;
let otherGuy: string;
let coreVersion: any;
let currentNumRequest: any;
let requestId: any;
describe('paymentAction', () => {
const arbitraryAmount = 100000000;
rn = new RequestNetwork('http://localhost:8545', 10000000000, false);
import {expect} from 'chai';
import 'mocha';
import requestArtifacts from 'requestnetworkartifacts';
import RequestNetwork from '../../../src/requestNetwork';
import * as utils from '../../utils';
const WEB3 = require('web3');
const BN = WEB3.utils.BN;
const addressRequestEthereum = requestArtifacts('private', 'last-RequestEthereum').networks.private.address;
const addressRequestCore = requestArtifacts('private', 'last-RequestCore').networks.private.address;
let rn: any;
let web3: any;
let defaultAccount;
let payer: any;
let payee: any;
let otherGuy: any;
let coreVersion: any;
let currentNumRequest: any;
let requestId: any;
describe('cancel', () => {
const arbitraryAmount = 100000000;
public getAllCoreInstance(): any[] {
const result: any[] = [];
const allArtifacts = requestArtifacts.getAllArtifactsForNetwork(this.web3Single.networkName);
for ( const key in allArtifacts ) {
if (key.slice(0, 2) === '0x' && allArtifacts[key].split('/')[0] === 'RequestCore') {
result.push( this.web3Single.getContractInstance(key) );
}
}
return result;
}