mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
add rinkeby test
This commit is contained in:
parent
507f5f656d
commit
68f435a11d
@ -1,8 +1,5 @@
|
|||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
|
|
||||||
const Web3 = require('web3')
|
|
||||||
const web3 = new Web3('http://127.0.0.1:8545')
|
|
||||||
|
|
||||||
export class TestContractHandler {
|
export class TestContractHandler {
|
||||||
public factory: Contract
|
public factory: Contract
|
||||||
public template: Contract
|
public template: Contract
|
||||||
@ -11,21 +8,24 @@ export class TestContractHandler {
|
|||||||
public factoryBytecode: string
|
public factoryBytecode: string
|
||||||
public factoryAddress: string
|
public factoryAddress: string
|
||||||
public templateAddress: string
|
public templateAddress: string
|
||||||
|
public web3: any
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
factoryABI: Contract,
|
factoryABI: Contract,
|
||||||
datatokensABI: Contract,
|
datatokensABI: Contract,
|
||||||
templateBytecode: string,
|
templateBytecode: string,
|
||||||
factoryBytecode: string
|
factoryBytecode: string,
|
||||||
|
web3: any
|
||||||
) {
|
) {
|
||||||
this.factory = new web3.eth.Contract(factoryABI)
|
this.web3 = web3
|
||||||
this.template = new web3.eth.Contract(datatokensABI)
|
this.factory = new this.web3.eth.Contract(factoryABI)
|
||||||
|
this.template = new this.web3.eth.Contract(datatokensABI)
|
||||||
this.templateBytecode = templateBytecode
|
this.templateBytecode = templateBytecode
|
||||||
this.factoryBytecode = factoryBytecode
|
this.factoryBytecode = factoryBytecode
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getAccounts() {
|
public async getAccounts() {
|
||||||
this.accounts = await web3.eth.getAccounts()
|
this.accounts = await this.web3.eth.getAccounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
public async deployContracts(minter: string) {
|
public async deployContracts(minter: string) {
|
||||||
|
@ -27,7 +27,8 @@ describe('Marketplace flow', () => {
|
|||||||
factory.abi,
|
factory.abi,
|
||||||
datatokensTemplate.abi,
|
datatokensTemplate.abi,
|
||||||
datatokensTemplate.bytecode,
|
datatokensTemplate.bytecode,
|
||||||
factory.bytecode
|
factory.bytecode,
|
||||||
|
web3
|
||||||
)
|
)
|
||||||
await contracts.getAccounts()
|
await contracts.getAccounts()
|
||||||
owner = contracts.accounts[0]
|
owner = contracts.accounts[0]
|
||||||
|
25
test/integration/Rinkeby.test.ts
Normal file
25
test/integration/Rinkeby.test.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { TestContractHandler } from '../TestContractHandler'
|
||||||
|
|
||||||
|
const Web3 = require('web3')
|
||||||
|
const web3 = new Web3('wss://rinkeby.infura.io/ws/v3/357f2fe737db4304bd2f7285c5602d0d')
|
||||||
|
const factory = require('@oceanprotocol/contracts/artifacts/development/Factory.json')
|
||||||
|
const datatokensTemplate = require('@oceanprotocol/contracts/artifacts/development/DataTokenTemplate.json')
|
||||||
|
|
||||||
|
describe('Rinkeby test', () => {
|
||||||
|
let owner
|
||||||
|
let contracts
|
||||||
|
|
||||||
|
describe('#test', () => {
|
||||||
|
it('Initialize Ocean contracts v3', async () => {
|
||||||
|
contracts = new TestContractHandler(
|
||||||
|
factory.abi,
|
||||||
|
datatokensTemplate.abi,
|
||||||
|
datatokensTemplate.bytecode,
|
||||||
|
factory.bytecode,
|
||||||
|
web3
|
||||||
|
)
|
||||||
|
await contracts.deployContracts(owner)
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
@ -27,7 +27,8 @@ describe('Simple flow', () => {
|
|||||||
factory.abi,
|
factory.abi,
|
||||||
datatokensTemplate.abi,
|
datatokensTemplate.abi,
|
||||||
datatokensTemplate.bytecode,
|
datatokensTemplate.bytecode,
|
||||||
factory.bytecode
|
factory.bytecode,
|
||||||
|
web3
|
||||||
)
|
)
|
||||||
await contracts.getAccounts()
|
await contracts.getAccounts()
|
||||||
owner = contracts.accounts[0]
|
owner = contracts.accounts[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user