1
0
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:
arsenyjin 2020-06-22 09:38:43 +02:00
parent 1454785e17
commit 24c8a87623
2 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { TestContractHandler } from '../TestContractHandler'
import { DataTokens } from '../../src/datatokens/Datatokens'
const Web3 = require('web3')
const web3 = new Web3('wss://rinkeby.infura.io/ws/v3/357f2fe737db4304bd2f7285c5602d0d')
@ -6,7 +7,14 @@ const factory = require('@oceanprotocol/contracts/artifacts/development/Factory.
const datatokensTemplate = require('@oceanprotocol/contracts/artifacts/development/DataTokenTemplate.json')
describe('Rinkeby test', () => {
let account
let contracts
let datatoken
let tokenAddress
const tokenAmount = 100
const blob = 'http://localhost:8030/api/v1/provider/services'
describe('#test', () => {
it('Initialize Ocean contracts v3', async () => {
@ -19,11 +27,25 @@ describe('Rinkeby test', () => {
)
const privateKey = 'PRIVATE_KEY'
const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey)
account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey)
web3.eth.accounts.wallet.add(account)
await contracts.deployContracts(account.address)
})
it('Publish a dataset', async () => {
datatoken = new DataTokens(
contracts.factoryAddress,
factory.abi,
datatokensTemplate.abi,
web3
)
tokenAddress = await datatoken.create(blob, account.address)
})
it('Mint 100 tokens', async () => {
await datatoken.mint(tokenAddress, account.address, tokenAmount)
})
})
})

View File

@ -53,7 +53,7 @@ describe('Simple flow', () => {
})
it('Alice transfers 1 token to Bob', async () => {
const ts = await datatoken.transfer(tokenAddress, bob, tokenAmount, alice)
const ts = await datatoken.transfer(tokenAddress, bob, transferAmount, alice)
transactionId = ts.transactionHash
})