mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
wip clean up
This commit is contained in:
parent
3b8d986445
commit
435d0fd19c
@ -114,7 +114,7 @@ export class DataTokens {
|
|||||||
dataTokenAddress,
|
dataTokenAddress,
|
||||||
{ from: account }
|
{ from: account }
|
||||||
)
|
)
|
||||||
|
|
||||||
const estGas = await datatoken.methods.mint(address, amount)
|
const estGas = await datatoken.methods.mint(address, amount)
|
||||||
.estimateGas(function(err, estGas){
|
.estimateGas(function(err, estGas){
|
||||||
return estGas
|
return estGas
|
||||||
@ -188,9 +188,9 @@ export class DataTokens {
|
|||||||
const datatoken = new this.web3.eth.Contract(
|
const datatoken = new this.web3.eth.Contract(
|
||||||
this.datatokensABI,
|
this.datatokensABI,
|
||||||
dataTokenAddress,
|
dataTokenAddress,
|
||||||
{ from: account.getId() }
|
{ from: account }
|
||||||
)
|
)
|
||||||
const trxReceipt = await datatoken.methods.balanceOf(account.getId()).call()
|
const trxReceipt = await datatoken.methods.balanceOf(account).call()
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { DataTokens } from '../../src/datatokens/Datatokens'
|
|
||||||
import { TestContractHandler } from './TestContractHandler'
|
import { TestContractHandler } from './TestContractHandler'
|
||||||
|
import { DataTokens } from '../../src/datatokens/Datatokens'
|
||||||
|
|
||||||
const Web3 = require('web3')
|
const Web3 = require('web3')
|
||||||
const web3 = new Web3("http://127.0.0.1:8545")
|
const web3 = new Web3("http://127.0.0.1:8545")
|
||||||
@ -12,6 +12,8 @@ describe('DataTokens', () => {
|
|||||||
|
|
||||||
let minter
|
let minter
|
||||||
let contracts
|
let contracts
|
||||||
|
let datatoken
|
||||||
|
let tokenAddress
|
||||||
|
|
||||||
let tokenAmount = 100
|
let tokenAmount = 100
|
||||||
let blob = 'https://example.com/dataset-1'
|
let blob = 'https://example.com/dataset-1'
|
||||||
@ -22,24 +24,24 @@ describe('DataTokens', () => {
|
|||||||
|
|
||||||
minter = contracts.accounts[0]
|
minter = contracts.accounts[0]
|
||||||
await contracts.deployContracts(minter)
|
await contracts.deployContracts(minter)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#test', () => {
|
describe('#test', () => {
|
||||||
it('should create Datatoken object', async () => {
|
it('should create Datatoken object', async () => {
|
||||||
const datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
||||||
assert(datatoken !== null)
|
assert(datatoken !== null)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create Datatoken contract', async () => {
|
it('should create Datatoken contract', async () => {
|
||||||
const datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
tokenAddress = await datatoken.create(blob, minter)
|
||||||
const token = await datatoken.create(blob, minter)
|
assert(tokenAddress !== null)
|
||||||
assert(token !== null)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should mint Datatokens', async () => {
|
it('should mint Datatokens', async () => {
|
||||||
const datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
|
||||||
const tokenAddress = await datatoken.create(blob, minter)
|
const tokenAddress = await datatoken.create(blob, minter)
|
||||||
await datatoken.mint(tokenAddress, minter, tokenAmount)
|
await datatoken.mint(tokenAddress, minter, tokenAmount)
|
||||||
|
let balance = await datatoken.balance(tokenAddress, minter)
|
||||||
|
// assert(balance === tokenAmount)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user