Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add graphql type #1607

Merged
merged 5 commits into from
Sep 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more updates for contracts 1.1.4
alexcos20 committed Sep 12, 2022
commit 6daca4891163606e9f957816837cbbc7f1d6b0fe
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -118,6 +118,8 @@ jobs:
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --with-provider2 --no-dashboard --with-c2d 2>&1 > start_ocean.log &
env:
CONTRACTS_VERSION: v1.1.3

- run: npm ci
- run: npm run build:metadata
38 changes: 37 additions & 1 deletion test/integration/CodeExamples.test.ts
Original file line number Diff line number Diff line change
@@ -85,6 +85,7 @@

/// ```Typescript
import { assert } from 'chai'
import { AbiItem } from 'web3-utils'
import { SHA256 } from 'crypto-js'
import {
approve,
@@ -106,7 +107,9 @@ import {
ProviderFees,
ProviderInstance,
transfer,
ZERO_ADDRESS
ZERO_ADDRESS,
calculateEstimatedGas,
sendTx
} from '../../src'
import { getAddresses, getTestConfig, web3 } from '../config'
/// ```
@@ -214,6 +217,39 @@ describe('Marketplace flow tests', async () => {
console.log(`Publisher account address: ${publisherAccount}`)
console.log(`Consumer account address: ${consumerAccount}`)
console.log(`Staker account address: ${stakerAccount}`)
/// <!--
// mint ocean to publisherAccount
const minAbi = [
{
constant: false,
inputs: [
{ name: 'to', type: 'address' },
{ name: 'value', type: 'uint256' }
],
name: 'mint',
outputs: [{ name: '', type: 'bool' }],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
}
] as AbiItem[]
const tokenContract = new web3.eth.Contract(minAbi, addresses.Ocean)
const estGas = await calculateEstimatedGas(
publisherAccount,
tokenContract.methods.mint,
publisherAccount,
web3.utils.toWei('1000')
)
await sendTx(
publisherAccount,
estGas,
web3,
1,
tokenContract.methods.mint,
publisherAccount,
web3.utils.toWei('1000')
)
/// -->
}) ///
/// ```

39 changes: 38 additions & 1 deletion test/integration/ComputeFlow.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assert } from 'chai'
import { SHA256 } from 'crypto-js'
import { AbiItem } from 'web3-utils'
import { web3, getTestConfig, getAddresses } from '../config'
import {
Config,
@@ -10,7 +11,9 @@ import {
Datatoken,
Nft,
ZERO_ADDRESS,
approveWei
approveWei,
calculateEstimatedGas,
sendTx
} from '../../src'
import {
DatatokenCreateParams,
@@ -360,6 +363,40 @@ describe('Simple compute tests', async () => {
const accounts = await web3.eth.getAccounts()
publisherAccount = accounts[0]
consumerAccount = accounts[1]
// mint Ocean
/// <!--
// mint ocean to publisherAccount
const minAbi = [
{
constant: false,
inputs: [
{ name: 'to', type: 'address' },
{ name: 'value', type: 'uint256' }
],
name: 'mint',
outputs: [{ name: '', type: 'bool' }],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
}
] as AbiItem[]
const tokenContract = new web3.eth.Contract(minAbi, addresses.Ocean)
const estGas = await calculateEstimatedGas(
publisherAccount,
tokenContract.methods.mint,
publisherAccount,
web3.utils.toWei('1000')
)
await sendTx(
publisherAccount,
estGas,
web3,
1,
tokenContract.methods.mint,
publisherAccount,
web3.utils.toWei('1000')
)

ddoWith1mTimeoutId = await createAsset(
'D1Min',
'D1M',
39 changes: 38 additions & 1 deletion test/integration/SimplePublishConsumeFlow.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assert } from 'chai'
import { SHA256 } from 'crypto-js'
import { AbiItem } from 'web3-utils'
import { web3, getTestConfig, getAddresses } from '../config'
import {
Config,
@@ -11,7 +12,9 @@ import {
getHash,
Nft,
downloadFile,
ZERO_ADDRESS
ZERO_ADDRESS,
calculateEstimatedGas,
sendTx
} from '../../src'
import { ProviderFees, DatatokenCreateParams, DDO, Files } from '../../src/@types'

@@ -74,6 +77,40 @@ describe('Simple Publish & consume test', async () => {
const accounts = await web3.eth.getAccounts()
publisherAccount = accounts[0]
consumerAccount = accounts[1]

// mint Ocean tokens
/// <!--
// mint ocean to publisherAccount
const minAbi = [
{
constant: false,
inputs: [
{ name: 'to', type: 'address' },
{ name: 'value', type: 'uint256' }
],
name: 'mint',
outputs: [{ name: '', type: 'bool' }],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
}
] as AbiItem[]
const tokenContract = new web3.eth.Contract(minAbi, addresses.Ocean)
const estGas = await calculateEstimatedGas(
publisherAccount,
tokenContract.methods.mint,
publisherAccount,
web3.utils.toWei('1000')
)
await sendTx(
publisherAccount,
estGas,
web3,
1,
tokenContract.methods.mint,
publisherAccount,
web3.utils.toWei('1000')
)
})

it('should publish a dataset (create NFT + Datatoken)', async () => {