mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge branch 'v4main' into issue-1346-rewrite-datatoken-test
This commit is contained in:
commit
258b2d6ecc
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -58,8 +58,6 @@ jobs:
|
||||
working-directory: ${{ github.workspace }}/barge
|
||||
run: |
|
||||
bash -x start_ocean.sh --no-aquarius --no-elasticsearch --no-provider --no-dashboard 2>&1 > start_ocean.log &
|
||||
env:
|
||||
CONTRACTS_VERSION: v1.0.0-alpha.28
|
||||
- run: npm ci
|
||||
- name: Wait for contracts deployment
|
||||
working-directory: ${{ github.workspace }}/barge
|
||||
@ -117,8 +115,6 @@ 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.0.0-alpha.28
|
||||
- run: npm ci
|
||||
- run: npm run build:metadata
|
||||
|
||||
|
35
CHANGELOG.md
35
CHANGELOG.md
@ -4,8 +4,43 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [v1.0.0-next.36](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.35...v1.0.0-next.36)
|
||||
|
||||
- Fix get compute results [`#1386`](https://github.com/oceanprotocol/ocean.js/pull/1386)
|
||||
|
||||
#### [v1.0.0-next.35](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.34...v1.0.0-next.35)
|
||||
|
||||
> 14 April 2022
|
||||
|
||||
- fix mm signature [`#1420`](https://github.com/oceanprotocol/ocean.js/pull/1420)
|
||||
- setPaymentCollector apply same checking as contract [`#1396`](https://github.com/oceanprotocol/ocean.js/pull/1396)
|
||||
- Release 1.0.0-next.35 [`80bf5cc`](https://github.com/oceanprotocol/ocean.js/commit/80bf5cc33fa7f5e3b4cf47805ce53510c563b29b)
|
||||
|
||||
#### [v1.0.0-next.34](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.33...v1.0.0-next.34)
|
||||
|
||||
> 14 April 2022
|
||||
|
||||
- refactor signatures [`#1395`](https://github.com/oceanprotocol/ocean.js/pull/1395)
|
||||
- Bump @types/chai from 4.3.0 to 4.3.1 [`#1417`](https://github.com/oceanprotocol/ocean.js/pull/1417)
|
||||
- Bump @truffle/hdwallet-provider from 2.0.5 to 2.0.6 [`#1418`](https://github.com/oceanprotocol/ocean.js/pull/1418)
|
||||
- Issue-#1353: Rewrite Router test [`#1382`](https://github.com/oceanprotocol/ocean.js/pull/1382)
|
||||
- Issue-#1413: Refactor ZERO_ADDRESS constant [`#1414`](https://github.com/oceanprotocol/ocean.js/pull/1414)
|
||||
- Issue-#1410: Export Router and SideStaking classes [`#1411`](https://github.com/oceanprotocol/ocean.js/pull/1411)
|
||||
- Bump prettier from 2.6.1 to 2.6.2 [`#1388`](https://github.com/oceanprotocol/ocean.js/pull/1388)
|
||||
- Bump release-it from 14.14.1 to 14.14.2 [`#1415`](https://github.com/oceanprotocol/ocean.js/pull/1415)
|
||||
- Bump typedoc from 0.22.14 to 0.22.15 [`#1407`](https://github.com/oceanprotocol/ocean.js/pull/1407)
|
||||
- Bump @truffle/hdwallet-provider from 2.0.4 to 2.0.5 [`#1408`](https://github.com/oceanprotocol/ocean.js/pull/1408)
|
||||
- Bump release-it from 14.14.0 to 14.14.1 [`#1405`](https://github.com/oceanprotocol/ocean.js/pull/1405)
|
||||
- Bump typedoc from 0.22.13 to 0.22.14 [`#1402`](https://github.com/oceanprotocol/ocean.js/pull/1402)
|
||||
- Bump web3 from 1.7.1 to 1.7.3 [`#1403`](https://github.com/oceanprotocol/ocean.js/pull/1403)
|
||||
- refactor constants [`73c4647`](https://github.com/oceanprotocol/ocean.js/commit/73c464778395bceab02e9459c830dd52cdcb23d1)
|
||||
- refactor pool and erc creation params [`0ecc973`](https://github.com/oceanprotocol/ocean.js/commit/0ecc973e0884eab5b60af9c12c7c441c0b2cfe77)
|
||||
- Use ZERO_ADDRESS constant in src folder files [`ec10f43`](https://github.com/oceanprotocol/ocean.js/commit/ec10f43ac7fdf696191d3894d2e2d3f82b7da3ca)
|
||||
|
||||
#### [v1.0.0-next.33](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.32...v1.0.0-next.33)
|
||||
|
||||
> 4 April 2022
|
||||
|
||||
- Feature/bump contracts to alpha 28 [`#1392`](https://github.com/oceanprotocol/ocean.js/pull/1392)
|
||||
- Bump mock-local-storage from 1.1.20 to 1.1.21 [`#1384`](https://github.com/oceanprotocol/ocean.js/pull/1384)
|
||||
- Bump release-it from 14.13.1 to 14.14.0 [`#1385`](https://github.com/oceanprotocol/ocean.js/pull/1385)
|
||||
|
224
package-lock.json
generated
224
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@oceanprotocol/lib",
|
||||
"version": "1.0.0-next.33",
|
||||
"version": "1.0.0-next.36",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@oceanprotocol/lib",
|
||||
"version": "1.0.0-next.33",
|
||||
"version": "1.0.0-next.36",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@oceanprotocol/contracts": "1.0.0-alpha.28",
|
||||
@ -19,12 +19,12 @@
|
||||
"web3-eth-contract": "^1.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@truffle/hdwallet-provider": "^2.0.5",
|
||||
"@types/chai": "^4.2.19",
|
||||
"@truffle/hdwallet-provider": "^2.0.6",
|
||||
"@types/chai": "^4.3.1",
|
||||
"@types/chai-spies": "^1.0.3",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/mocha": "^9.1.0",
|
||||
"@types/node": "^17.0.23",
|
||||
"@types/node": "^17.0.24",
|
||||
"@types/node-fetch": "^3.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||
"@typescript-eslint/parser": "^4.33.0",
|
||||
@ -2417,6 +2417,24 @@
|
||||
"integrity": "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@noble/hashes": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.0.0.tgz",
|
||||
"integrity": "sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@noble/secp256k1": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.5.5.tgz",
|
||||
"integrity": "sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@ -2723,6 +2741,51 @@
|
||||
"integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@scure/base": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.0.0.tgz",
|
||||
"integrity": "sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/@scure/bip32": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.0.1.tgz",
|
||||
"integrity": "sha512-AU88KKTpQ+YpTLoicZ/qhFhRRIo96/tlb+8YmDDHR9yiKVjSsFZiefJO4wjS2PMTkz5/oIcw84uAq/8pleQURA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@noble/hashes": "~1.0.0",
|
||||
"@noble/secp256k1": "~1.5.2",
|
||||
"@scure/base": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@scure/bip39": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.0.0.tgz",
|
||||
"integrity": "sha512-HrtcikLbd58PWOkl02k9V6nXWQyoa7A0+Ek9VF7z17DDk9XZAFUcIdqfh0jJXLypmizc5/8P6OxoUeKliiWv4w==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@noble/hashes": "~1.0.0",
|
||||
"@scure/base": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||
@ -2755,15 +2818,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@truffle/hdwallet-provider": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.0.5.tgz",
|
||||
"integrity": "sha512-aF0tadToEU31w33mhUYK7oV8GGuyID2Ov/yx1pueTKcMhOAJYfqEMTE96qq/GNQOkrsmi7blnGdjCSzuCUCb7w==",
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.0.6.tgz",
|
||||
"integrity": "sha512-w0JaxN1efX32BCCi0SF/lkJLyNEYMhvK6u62l/4hRtY++lC7JfP6vkoGN8py1Tqdt2phczZMULht8UdDi/vSZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@ethereumjs/common": "^2.4.0",
|
||||
"@ethereumjs/tx": "^3.3.0",
|
||||
"eth-sig-util": "^3.0.1",
|
||||
"ethereum-cryptography": "^0.1.3",
|
||||
"ethereum-cryptography": "1.0.3",
|
||||
"ethereum-protocol": "^1.0.1",
|
||||
"ethereumjs-util": "^6.1.0",
|
||||
"ethereumjs-wallet": "^1.0.1",
|
||||
@ -2779,6 +2842,18 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@truffle/hdwallet-provider/node_modules/ethereum-cryptography": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.0.3.tgz",
|
||||
"integrity": "sha512-NQLTW0x0CosoVb/n79x/TRHtfvS3hgNUPTUSCu0vM+9k6IIhHFFrAOJReneexjZsoZxMjJHnJn4lrE8EbnSyqQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@noble/hashes": "1.0.0",
|
||||
"@noble/secp256k1": "1.5.5",
|
||||
"@scure/bip32": "1.0.1",
|
||||
"@scure/bip39": "1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@truffle/hdwallet-provider/node_modules/ethereumjs-util": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz",
|
||||
@ -2794,6 +2869,29 @@
|
||||
"rlp": "^2.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@truffle/hdwallet-provider/node_modules/ethereumjs-util/node_modules/ethereum-cryptography": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz",
|
||||
"integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pbkdf2": "^3.0.0",
|
||||
"@types/secp256k1": "^4.0.1",
|
||||
"blakejs": "^1.1.0",
|
||||
"browserify-aes": "^1.2.0",
|
||||
"bs58check": "^2.1.2",
|
||||
"create-hash": "^1.2.0",
|
||||
"create-hmac": "^1.1.7",
|
||||
"hash.js": "^1.1.7",
|
||||
"keccak": "^3.0.0",
|
||||
"pbkdf2": "^3.0.17",
|
||||
"randombytes": "^2.1.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"scrypt-js": "^3.0.0",
|
||||
"secp256k1": "^4.0.1",
|
||||
"setimmediate": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@trysound/sax": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
|
||||
@ -2836,9 +2934,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/chai": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz",
|
||||
"integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.1.tgz",
|
||||
"integrity": "sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/chai-spies": {
|
||||
@ -2881,9 +2979,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "17.0.23",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz",
|
||||
"integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw=="
|
||||
"version": "17.0.24",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.24.tgz",
|
||||
"integrity": "sha512-aveCYRQbgTH9Pssp1voEP7HiuWlD2jW2BO56w+bVrJn04i61yh6mRfoKO6hEYQD9vF+W8Chkwc6j1M36uPkx4g=="
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
"version": "3.0.3",
|
||||
@ -18491,6 +18589,18 @@
|
||||
"integrity": "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@noble/hashes": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.0.0.tgz",
|
||||
"integrity": "sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg==",
|
||||
"dev": true
|
||||
},
|
||||
"@noble/secp256k1": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.5.5.tgz",
|
||||
"integrity": "sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@ -18733,6 +18843,33 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@scure/base": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.0.0.tgz",
|
||||
"integrity": "sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA==",
|
||||
"dev": true
|
||||
},
|
||||
"@scure/bip32": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.0.1.tgz",
|
||||
"integrity": "sha512-AU88KKTpQ+YpTLoicZ/qhFhRRIo96/tlb+8YmDDHR9yiKVjSsFZiefJO4wjS2PMTkz5/oIcw84uAq/8pleQURA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@noble/hashes": "~1.0.0",
|
||||
"@noble/secp256k1": "~1.5.2",
|
||||
"@scure/base": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"@scure/bip39": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.0.0.tgz",
|
||||
"integrity": "sha512-HrtcikLbd58PWOkl02k9V6nXWQyoa7A0+Ek9VF7z17DDk9XZAFUcIdqfh0jJXLypmizc5/8P6OxoUeKliiWv4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@noble/hashes": "~1.0.0",
|
||||
"@scure/base": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"@sindresorhus/is": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||
@ -18759,15 +18896,15 @@
|
||||
}
|
||||
},
|
||||
"@truffle/hdwallet-provider": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.0.5.tgz",
|
||||
"integrity": "sha512-aF0tadToEU31w33mhUYK7oV8GGuyID2Ov/yx1pueTKcMhOAJYfqEMTE96qq/GNQOkrsmi7blnGdjCSzuCUCb7w==",
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.0.6.tgz",
|
||||
"integrity": "sha512-w0JaxN1efX32BCCi0SF/lkJLyNEYMhvK6u62l/4hRtY++lC7JfP6vkoGN8py1Tqdt2phczZMULht8UdDi/vSZQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@ethereumjs/common": "^2.4.0",
|
||||
"@ethereumjs/tx": "^3.3.0",
|
||||
"eth-sig-util": "^3.0.1",
|
||||
"ethereum-cryptography": "^0.1.3",
|
||||
"ethereum-cryptography": "1.0.3",
|
||||
"ethereum-protocol": "^1.0.1",
|
||||
"ethereumjs-util": "^6.1.0",
|
||||
"ethereumjs-wallet": "^1.0.1",
|
||||
@ -18783,6 +18920,18 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"ethereum-cryptography": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.0.3.tgz",
|
||||
"integrity": "sha512-NQLTW0x0CosoVb/n79x/TRHtfvS3hgNUPTUSCu0vM+9k6IIhHFFrAOJReneexjZsoZxMjJHnJn4lrE8EbnSyqQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@noble/hashes": "1.0.0",
|
||||
"@noble/secp256k1": "1.5.5",
|
||||
"@scure/bip32": "1.0.1",
|
||||
"@scure/bip39": "1.0.0"
|
||||
}
|
||||
},
|
||||
"ethereumjs-util": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz",
|
||||
@ -18796,6 +18945,31 @@
|
||||
"ethereum-cryptography": "^0.1.3",
|
||||
"ethjs-util": "0.1.6",
|
||||
"rlp": "^2.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethereum-cryptography": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz",
|
||||
"integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/pbkdf2": "^3.0.0",
|
||||
"@types/secp256k1": "^4.0.1",
|
||||
"blakejs": "^1.1.0",
|
||||
"browserify-aes": "^1.2.0",
|
||||
"bs58check": "^2.1.2",
|
||||
"create-hash": "^1.2.0",
|
||||
"create-hmac": "^1.1.7",
|
||||
"hash.js": "^1.1.7",
|
||||
"keccak": "^3.0.0",
|
||||
"pbkdf2": "^3.0.17",
|
||||
"randombytes": "^2.1.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"scrypt-js": "^3.0.0",
|
||||
"secp256k1": "^4.0.1",
|
||||
"setimmediate": "^1.0.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18839,9 +19013,9 @@
|
||||
}
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz",
|
||||
"integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.1.tgz",
|
||||
"integrity": "sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/chai-spies": {
|
||||
@ -18884,9 +19058,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "17.0.23",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz",
|
||||
"integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw=="
|
||||
"version": "17.0.24",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.24.tgz",
|
||||
"integrity": "sha512-aveCYRQbgTH9Pssp1voEP7HiuWlD2jW2BO56w+bVrJn04i61yh6mRfoKO6hEYQD9vF+W8Chkwc6j1M36uPkx4g=="
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
"version": "3.0.3",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@oceanprotocol/lib",
|
||||
"source": "./src/index.ts",
|
||||
"version": "1.0.0-next.33",
|
||||
"version": "1.0.0-next.36",
|
||||
"description": "JavaScript client library for Ocean Protocol",
|
||||
"main": "./dist/lib.js",
|
||||
"umd:main": "dist/lib.umd.js",
|
||||
@ -40,6 +40,7 @@
|
||||
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
||||
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
||||
"test:provider": "npm run mocha -- 'test/integration/Provider.test.ts'",
|
||||
"test:compute": "npm run mocha -- 'test/integration/ComputeFlow.test.ts'",
|
||||
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration"
|
||||
},
|
||||
"repository": {
|
||||
@ -67,12 +68,12 @@
|
||||
"web3-eth-contract": "^1.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@truffle/hdwallet-provider": "^2.0.5",
|
||||
"@types/chai": "^4.2.19",
|
||||
"@truffle/hdwallet-provider": "^2.0.6",
|
||||
"@types/chai": "^4.3.1",
|
||||
"@types/chai-spies": "^1.0.3",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/mocha": "^9.1.0",
|
||||
"@types/node": "^17.0.23",
|
||||
"@types/node": "^17.0.24",
|
||||
"@types/node-fetch": "^3.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||
"@typescript-eslint/parser": "^4.33.0",
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { Metadata, MetadataAlgorithm } from './DDO/Metadata'
|
||||
|
||||
export type ComputeResultType = 'algorithmLog' | 'output'
|
||||
export type ComputeResultType =
|
||||
| 'algorithmLog'
|
||||
| 'output'
|
||||
| 'configrationLog'
|
||||
| 'publishLog'
|
||||
|
||||
export interface ComputeEnvironment {
|
||||
id: string
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Web3 from 'web3'
|
||||
import { LoggerInstance, getData, downloadFile, downloadFileBrowser } from '../utils'
|
||||
import { LoggerInstance, getData } from '../utils'
|
||||
import {
|
||||
FileMetadata,
|
||||
ComputeJob,
|
||||
@ -10,9 +10,7 @@ import {
|
||||
ProviderInitialize
|
||||
} from '../@types/'
|
||||
import { noZeroX } from '../utils/ConversionTypeHelper'
|
||||
import { signText, signWithHash } from '../utils/SignatureUtils'
|
||||
import fetch from 'cross-fetch'
|
||||
import { DownloadResponse } from '../@types/DownloadResponse'
|
||||
export interface HttpCallback {
|
||||
(httpMethod: string, url: string, body: string, header: any): Promise<any>
|
||||
}
|
||||
@ -67,7 +65,7 @@ export class Provider {
|
||||
return serviceEndpoints
|
||||
}
|
||||
|
||||
/** Encrypt DDO using the Provider's own symmetric key
|
||||
/** Gets current nonce
|
||||
* @param {string} providerUri provider uri address
|
||||
* @param {string} consumerAddress Publisher address
|
||||
* @param {AbortSignal} signal abort signal
|
||||
@ -107,22 +105,21 @@ export class Provider {
|
||||
}
|
||||
}
|
||||
|
||||
public async createSignature(
|
||||
public async signProviderRequest(
|
||||
web3: Web3,
|
||||
accountId: string,
|
||||
agreementId: string
|
||||
message: string,
|
||||
password?: string
|
||||
): Promise<string> {
|
||||
const signature = await signText(web3, noZeroX(agreementId), accountId)
|
||||
return signature
|
||||
}
|
||||
|
||||
public async createHashSignature(
|
||||
web3: Web3,
|
||||
accountId: string,
|
||||
message: string
|
||||
): Promise<string> {
|
||||
const signature = await signWithHash(web3, message, accountId)
|
||||
return signature
|
||||
const consumerMessage = web3.utils.soliditySha3({
|
||||
t: 'bytes',
|
||||
v: web3.utils.utf8ToHex(message)
|
||||
})
|
||||
const isMetaMask =
|
||||
web3 && web3.currentProvider && (web3.currentProvider as any).isMetaMask
|
||||
if (isMetaMask)
|
||||
return await web3.eth.personal.sign(consumerMessage, accountId, password)
|
||||
else return await web3.eth.sign(consumerMessage, accountId)
|
||||
}
|
||||
|
||||
/** Encrypt data using the Provider's own symmetric key
|
||||
@ -144,12 +141,11 @@ export class Provider {
|
||||
const path = this.getEndpointURL(serviceEndpoints, 'encrypt')
|
||||
? this.getEndpointURL(serviceEndpoints, 'encrypt').urlPath
|
||||
: null
|
||||
|
||||
if (!path) return null
|
||||
try {
|
||||
const response = await fetch(path, {
|
||||
method: 'POST',
|
||||
body: decodeURI(JSON.stringify(data)),
|
||||
body: JSON.stringify(data),
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream'
|
||||
},
|
||||
@ -361,8 +357,7 @@ export class Provider {
|
||||
: null
|
||||
if (!downloadUrl) return null
|
||||
const nonce = Date.now()
|
||||
const signature = await this.createSignature(web3, accountId, did + nonce)
|
||||
|
||||
const signature = await this.signProviderRequest(web3, accountId, did + nonce)
|
||||
let consumeUrl = downloadUrl
|
||||
consumeUrl += `?fileIndex=${fileIndex}`
|
||||
consumeUrl += `&documentId=${did}`
|
||||
@ -411,12 +406,11 @@ export class Provider {
|
||||
let signatureMessage = consumerAddress
|
||||
signatureMessage += dataset.documentId
|
||||
signatureMessage += nonce
|
||||
const signature = await this.createHashSignature(
|
||||
const signature = await this.signProviderRequest(
|
||||
web3,
|
||||
consumerAddress,
|
||||
signatureMessage
|
||||
)
|
||||
|
||||
const payload = Object()
|
||||
payload.consumerAddress = consumerAddress
|
||||
payload.signature = signature
|
||||
@ -441,7 +435,7 @@ export class Provider {
|
||||
const params = await response.json()
|
||||
return params
|
||||
}
|
||||
console.error('Compute start failed:', response.status, response.statusText)
|
||||
LoggerInstance.error('Compute start failed: ', response.status, response.statusText)
|
||||
LoggerInstance.error('Payload was:', payload)
|
||||
return null
|
||||
} catch (e) {
|
||||
@ -490,12 +484,11 @@ export class Provider {
|
||||
signatureMessage += jobId || ''
|
||||
signatureMessage += (did && `${noZeroX(did)}`) || ''
|
||||
signatureMessage += nonce
|
||||
const signature = await this.createHashSignature(
|
||||
const signature = await this.signProviderRequest(
|
||||
web3,
|
||||
consumerAddress,
|
||||
signatureMessage
|
||||
)
|
||||
|
||||
const payload = Object()
|
||||
payload.signature = signature
|
||||
payload.documentId = noZeroX(did)
|
||||
@ -582,23 +575,21 @@ export class Provider {
|
||||
}
|
||||
}
|
||||
|
||||
/** Get status for a specific jobId/documentId/owner.
|
||||
* @param {string} jobId
|
||||
* @param {number} index
|
||||
* @param {string} providerUri
|
||||
* @param {string} destination
|
||||
* @param {Web3} web3
|
||||
* @param {AbortSignal} signal abort signal
|
||||
* @return {Promise<ComputeJob | ComputeJob[]>}
|
||||
/** Get compute result url
|
||||
* @param {string} providerUri The URI of the provider we want to query
|
||||
* @param {Web3} web3 Web3 instance
|
||||
* @param {string} consumerAddress The consumer ethereum address
|
||||
* @param {string} jobId The ID of a compute job.
|
||||
* @param {number} index Result index
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
public async computeResult(
|
||||
jobId: string,
|
||||
index: number,
|
||||
accountId: string,
|
||||
public async getComputeResultUrl(
|
||||
providerUri: string,
|
||||
web3: Web3,
|
||||
signal?: AbortSignal
|
||||
): Promise<DownloadResponse | void> {
|
||||
consumerAddress: string,
|
||||
jobId: string,
|
||||
index: number
|
||||
): Promise<string> {
|
||||
const providerEndpoints = await this.getEndpoints(providerUri)
|
||||
const serviceEndpoints = await this.getServiceEndpoints(
|
||||
providerUri,
|
||||
@ -608,38 +599,24 @@ export class Provider {
|
||||
? this.getEndpointURL(serviceEndpoints, 'computeResult').urlPath
|
||||
: null
|
||||
|
||||
const nonce = await this.getNonce(
|
||||
providerUri,
|
||||
accountId,
|
||||
signal,
|
||||
providerEndpoints,
|
||||
serviceEndpoints
|
||||
)
|
||||
|
||||
let signatureMessage = accountId
|
||||
const nonce = Date.now()
|
||||
let signatureMessage = consumerAddress
|
||||
signatureMessage += jobId
|
||||
signatureMessage += index.toString()
|
||||
signatureMessage += nonce
|
||||
const signature = await this.createHashSignature(web3, accountId, signatureMessage)
|
||||
|
||||
let consumeUrl = computeResultUrl
|
||||
consumeUrl += `?consumerAddress=${accountId}`
|
||||
consumeUrl += `&jobId=${jobId}`
|
||||
consumeUrl += `&index=${String(index)}`
|
||||
consumeUrl += (signature && `&signature=${signature}`) || ''
|
||||
|
||||
const signature = await this.signProviderRequest(
|
||||
web3,
|
||||
consumerAddress,
|
||||
signatureMessage
|
||||
)
|
||||
if (!computeResultUrl) return null
|
||||
try {
|
||||
if (document) {
|
||||
await downloadFileBrowser(consumeUrl)
|
||||
} else {
|
||||
return await downloadFile(consumeUrl, index)
|
||||
}
|
||||
} catch (e) {
|
||||
LoggerInstance.error('Error getting job result')
|
||||
LoggerInstance.error(e)
|
||||
throw e
|
||||
}
|
||||
let resultUrl = computeResultUrl
|
||||
resultUrl += `?consumerAddress=${consumerAddress}`
|
||||
resultUrl += `&jobId=${jobId}`
|
||||
resultUrl += `&index=${index.toString()}`
|
||||
resultUrl += `&nonce=${nonce}`
|
||||
resultUrl += (signature && `&signature=${signature}`) || ''
|
||||
return resultUrl
|
||||
}
|
||||
|
||||
/** Deletes a compute job.
|
||||
@ -680,12 +657,11 @@ export class Provider {
|
||||
signatureMessage += jobId || ''
|
||||
signatureMessage += (did && `${noZeroX(did)}`) || ''
|
||||
signatureMessage += nonce
|
||||
const signature = await this.createHashSignature(
|
||||
const signature = await this.signProviderRequest(
|
||||
web3,
|
||||
consumerAddress,
|
||||
signatureMessage
|
||||
)
|
||||
|
||||
const payload = Object()
|
||||
payload.documentId = noZeroX(did)
|
||||
payload.consumerAddress = consumerAddress
|
||||
|
@ -782,8 +782,15 @@ export class Datatoken {
|
||||
new this.web3.eth.Contract(this.datatokensAbi, dtAddress),
|
||||
this.config
|
||||
)
|
||||
if ((await this.getDTPermissions(dtAddress, address)).paymentManager !== true) {
|
||||
throw new Error(`Caller is not Fee Manager`)
|
||||
const isPaymentManager = (await this.getDTPermissions(dtAddress, address))
|
||||
.paymentManager
|
||||
const nftAddress = !isPaymentManager && (await this.getNFTAddress(dtAddress))
|
||||
const isNftOwner = nftAddress && (await this.nft.getNftOwner(nftAddress)) === address
|
||||
const nftPermissions =
|
||||
nftAddress && !isNftOwner && (await this.nft.getNftPermissions(nftAddress, address))
|
||||
const isErc20Deployer = nftPermissions?.deployERC20
|
||||
if (!isPaymentManager && !isNftOwner && !isErc20Deployer) {
|
||||
throw new Error(`Caller is not Fee Manager, owner or erc20 Deployer`)
|
||||
}
|
||||
|
||||
const estGas = await this.estGasSetPaymentCollector(
|
||||
|
@ -32,7 +32,8 @@ export const configHelperNetworks: Config[] = [
|
||||
...configHelperNetworksBase,
|
||||
chainId: 8996,
|
||||
network: 'development',
|
||||
metadataCacheUri: 'http://127.0.0.1:5000'
|
||||
metadataCacheUri: 'http://127.0.0.1:5000',
|
||||
providerUri: 'http://172.15.0.4:8030'
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import sha256 from 'crypto-js/sha256'
|
||||
import Web3 from 'web3'
|
||||
import LoggerInstance from './Logger'
|
||||
|
||||
export function generateDid(erc721Address: string, chainId: number): string {
|
||||
erc721Address = Web3.utils.toChecksumAddress(erc721Address)
|
||||
@ -8,5 +9,9 @@ export function generateDid(erc721Address: string, chainId: number): string {
|
||||
}
|
||||
|
||||
export function getHash(data: any): string {
|
||||
return sha256(data).toString()
|
||||
try {
|
||||
return sha256(data).toString()
|
||||
} catch (e) {
|
||||
LoggerInstance.error('getHash error: ', e.message)
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,6 @@
|
||||
import Web3 from 'web3'
|
||||
import { LoggerInstance } from './Logger'
|
||||
|
||||
export async function signText(
|
||||
web3: Web3,
|
||||
text: string,
|
||||
publicKey: string,
|
||||
password?: string
|
||||
): Promise<string> {
|
||||
const isMetaMask =
|
||||
web3 && web3.currentProvider && (web3.currentProvider as any).isMetaMask
|
||||
try {
|
||||
return await web3.eth.personal.sign(text, publicKey, password)
|
||||
} catch (e) {
|
||||
if (isMetaMask) {
|
||||
throw e
|
||||
}
|
||||
LoggerInstance.warn('Error on personal sign.')
|
||||
LoggerInstance.warn(e)
|
||||
try {
|
||||
return await web3.eth.sign(text, publicKey)
|
||||
} catch (e2) {
|
||||
LoggerInstance.error('Error on sign.')
|
||||
LoggerInstance.error(e2)
|
||||
throw new Error('Error executing personal sign')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function signHash(web3: Web3, message: string, address: string) {
|
||||
let signedMessage = await web3.eth.sign(message, address)
|
||||
signedMessage = signedMessage.substr(2) // remove 0x
|
||||
@ -38,30 +12,3 @@ export async function signHash(web3: Web3, message: string, address: string) {
|
||||
if (v === '0x01') v = '0x1c'
|
||||
return { v, r, s }
|
||||
}
|
||||
|
||||
export async function signWithHash(
|
||||
web3: Web3,
|
||||
text: string,
|
||||
publicKey: string,
|
||||
password?: string
|
||||
): Promise<string> {
|
||||
const hash = web3.utils.utf8ToHex(text)
|
||||
const isMetaMask =
|
||||
web3 && web3.currentProvider && (web3.currentProvider as any).isMetaMask
|
||||
try {
|
||||
return await web3.eth.personal.sign(hash, publicKey, password)
|
||||
} catch (e) {
|
||||
if (isMetaMask) {
|
||||
throw e
|
||||
}
|
||||
LoggerInstance.warn('Error on personal sign.')
|
||||
LoggerInstance.warn(e)
|
||||
try {
|
||||
return await web3.eth.sign(hash, publicKey)
|
||||
} catch (e2) {
|
||||
LoggerInstance.error('Error on sign.')
|
||||
LoggerInstance.error(e2)
|
||||
throw new Error('Error executing personal sign')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { assert } from 'chai'
|
||||
import { SHA256 } from 'crypto-js'
|
||||
import console from 'console'
|
||||
import { web3, getTestConfig, getAddresses } from '../config'
|
||||
import {
|
||||
Config,
|
||||
@ -10,9 +9,10 @@ import {
|
||||
NftCreateData,
|
||||
Datatoken,
|
||||
getHash,
|
||||
Nft
|
||||
Nft,
|
||||
sleep
|
||||
} from '../../src'
|
||||
import { ProviderFees, Erc20CreateParams } from '../../src/@types'
|
||||
import { ProviderFees, Erc20CreateParams, ComputeJob, Asset } from '../../src/@types'
|
||||
|
||||
const assetUrl = [
|
||||
{
|
||||
@ -110,12 +110,15 @@ const algoDdo = {
|
||||
}
|
||||
]
|
||||
}
|
||||
let providerUrl: string
|
||||
let consumerAccount: string
|
||||
let computeJobId: string
|
||||
let resolvedDDOAsset: Asset
|
||||
|
||||
describe('Simple compute tests', async () => {
|
||||
let config: Config
|
||||
let addresses: any
|
||||
let aquarius: Aquarius
|
||||
let providerUrl: any
|
||||
|
||||
before(async () => {
|
||||
config = await getTestConfig(web3)
|
||||
@ -130,7 +133,7 @@ describe('Simple compute tests', async () => {
|
||||
const Factory = new NftFactory(addresses.ERC721Factory, web3)
|
||||
const accounts = await web3.eth.getAccounts()
|
||||
const publisherAccount = accounts[0]
|
||||
const consumerAccount = accounts[1]
|
||||
consumerAccount = accounts[1]
|
||||
const chain = await web3.eth.getChainId()
|
||||
const nftParamsAsset: NftCreateData = {
|
||||
name: 'testNFT',
|
||||
@ -234,7 +237,7 @@ describe('Simple compute tests', async () => {
|
||||
)
|
||||
|
||||
// let's wait
|
||||
const resolvedDDOAsset = await aquarius.waitForAqua(ddo.id)
|
||||
resolvedDDOAsset = await aquarius.waitForAqua(ddo.id)
|
||||
assert(resolvedDDOAsset, 'Cannot fetch DDO from Aquarius')
|
||||
const resolvedDDOAlgo = await aquarius.waitForAqua(algoDdo.id)
|
||||
assert(resolvedDDOAlgo, 'Cannot fetch DDO from Aquarius')
|
||||
@ -246,7 +249,6 @@ describe('Simple compute tests', async () => {
|
||||
const computeEnvs = await ProviderInstance.getComputeEnvironments(providerUrl)
|
||||
assert(computeEnvs, 'No Compute environments found')
|
||||
// we choose the first env
|
||||
console.log(computeEnvs)
|
||||
const computeEnv = computeEnvs[0].id
|
||||
const computeConsumerAddress = computeEnvs[0].consumerAddress
|
||||
// let's have 10 minutesof compute access
|
||||
@ -265,7 +267,6 @@ describe('Simple compute tests', async () => {
|
||||
computeEnv,
|
||||
computeValidUntil
|
||||
)
|
||||
console.log(initializeDataAlgo)
|
||||
const providerAlgoFees: ProviderFees = {
|
||||
providerFeeAddress: initializeDataAlgo.providerFee.providerFeeAddress,
|
||||
providerFeeToken: initializeDataAlgo.providerFee.providerFeeToken,
|
||||
@ -302,7 +303,6 @@ describe('Simple compute tests', async () => {
|
||||
computeEnv,
|
||||
computeValidUntil
|
||||
)
|
||||
console.log(initializeData)
|
||||
const providerDatasetFees: ProviderFees = {
|
||||
providerFeeAddress: initializeData.providerFee.providerFeeAddress,
|
||||
providerFeeToken: initializeData.providerFee.providerFeeToken,
|
||||
@ -340,12 +340,28 @@ describe('Simple compute tests', async () => {
|
||||
}
|
||||
)
|
||||
assert(computeJobs, 'Cannot start compute job')
|
||||
const jobStatus = await ProviderInstance.computeStatus(
|
||||
computeJobId = computeJobs[0].jobId
|
||||
})
|
||||
|
||||
it('Check compute status', async () => {
|
||||
const jobStatus = (await ProviderInstance.computeStatus(
|
||||
providerUrl,
|
||||
consumerAccount,
|
||||
computeJobs[0].jobId,
|
||||
computeJobId,
|
||||
resolvedDDOAsset.id
|
||||
)) as ComputeJob
|
||||
assert(jobStatus, 'Cannot retrieve compute status!')
|
||||
})
|
||||
|
||||
it('Get download compute results url', async () => {
|
||||
sleep(10000)
|
||||
const downloadURL = await ProviderInstance.getComputeResultUrl(
|
||||
providerUrl,
|
||||
web3,
|
||||
consumerAccount,
|
||||
computeJobId,
|
||||
0
|
||||
)
|
||||
assert(jobStatus)
|
||||
assert(downloadURL, 'Provider getComputeResultUrl failed!')
|
||||
})
|
||||
})
|
||||
|
@ -18,6 +18,7 @@ describe('Datatoken', () => {
|
||||
let user1: string
|
||||
let user2: string
|
||||
let user3: string
|
||||
let erc20DeployerUser: string
|
||||
let contracts: Addresses
|
||||
let nftDatatoken: Nft
|
||||
let datatoken: Datatoken
|
||||
@ -56,6 +57,7 @@ describe('Datatoken', () => {
|
||||
user3 = accounts[3]
|
||||
|
||||
NFT_DATA.owner = nftOwner
|
||||
erc20DeployerUser = accounts[4]
|
||||
})
|
||||
|
||||
it('should deploy contracts', async () => {
|
||||
@ -82,7 +84,8 @@ describe('Datatoken', () => {
|
||||
})
|
||||
|
||||
it('#createERC20 - should create a new ERC20 DT from NFT contract', async () => {
|
||||
// await nftDatatoken.addERC20Deployer(nftAddress, nftOwner, nftOwner)
|
||||
await nftDatatoken.addErc20Deployer(nftAddress, nftOwner,
|
||||
)
|
||||
datatokenAddress = await nftDatatoken.createErc20(
|
||||
nftAddress,
|
||||
nftOwner,
|
||||
@ -271,7 +274,7 @@ describe('Datatoken', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#setPaymentCollector - should fail to set a new paymentCollector, if NOT PAYMENT Manager', async () => {
|
||||
it('#setPaymentCollector - should fail to set a new paymentCollector, if NOT PAYMENT Manager, NFT OWNER OR ERC 20 DEPLOYER', async () => {
|
||||
assert(
|
||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||
)
|
||||
@ -280,7 +283,7 @@ describe('Datatoken', () => {
|
||||
await datatoken.setPaymentCollector(datatokenAddress, user1, user2)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not Fee Manager')
|
||||
assert(e.message === 'Caller is not Fee Manager, owner or erc20 Deployer')
|
||||
}
|
||||
})
|
||||
|
||||
@ -298,6 +301,25 @@ describe('Datatoken', () => {
|
||||
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user3)
|
||||
})
|
||||
|
||||
it('#setPaymentCollector - should set a new paymentCollector, if NFT OWNER', async () => {
|
||||
assert((await nftDatatoken.getNftOwner(nftAddress)) === nftOwner)
|
||||
|
||||
await datatoken.setPaymentCollector(datatokenAddress, nftOwner, user2)
|
||||
|
||||
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user2)
|
||||
})
|
||||
|
||||
it('#setPaymentCollector - should set a new paymentCollector, if ERC 20 DEPLOYER', async () => {
|
||||
assert(
|
||||
(await nftDatatoken.getNftPermissions(nftAddress, erc20DeployerUser))
|
||||
.deployERC20 === true
|
||||
)
|
||||
|
||||
await datatoken.setPaymentCollector(datatokenAddress, erc20DeployerUser, user3)
|
||||
|
||||
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user3)
|
||||
})
|
||||
|
||||
it('#startOrder- user2 should create an order for DT ', async () => {
|
||||
assert(
|
||||
(await datatoken.balance(datatokenAddress, user1)) === DATATOKENS_AMOUNT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user