1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

merge main and update multichain provider ip

This commit is contained in:
Bogdan Fazakas 2023-02-08 13:45:26 +03:00
commit 5ac79b9b63
9 changed files with 92 additions and 47 deletions

View File

@ -4,8 +4,19 @@ 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).
#### [v2.6.2](https://github.com/oceanprotocol/ocean.js/compare/v2.6.1...v2.6.2)
- Bump @truffle/hdwallet-provider from 2.1.4 to 2.1.5 [`#1689`](https://github.com/oceanprotocol/ocean.js/pull/1689)
- Bump http-cache-semantics from 4.1.0 to 4.1.1 [`#1691`](https://github.com/oceanprotocol/ocean.js/pull/1691)
- Set withMint default to true [`#1693`](https://github.com/oceanprotocol/ocean.js/pull/1693)
- Bump decimal.js from 10.4.2 to 10.4.3 [`#1687`](https://github.com/oceanprotocol/ocean.js/pull/1687)
- Bump mocha from 10.1.0 to 10.2.0 [`#1690`](https://github.com/oceanprotocol/ocean.js/pull/1690)
- Bump json5 from 1.0.1 to 1.0.2 [`#1681`](https://github.com/oceanprotocol/ocean.js/pull/1681)
#### [v2.6.1](https://github.com/oceanprotocol/ocean.js/compare/v2.6.0...v2.6.1)
> 6 January 2023
- Fix download when content disposition header missing [`#1680`](https://github.com/oceanprotocol/ocean.js/pull/1680)
- Bump prettier from 2.7.1 to 2.8.1 [`#1676`](https://github.com/oceanprotocol/ocean.js/pull/1676)
- Bump @types/node from 18.8.0 to 18.11.18 [`#1675`](https://github.com/oceanprotocol/ocean.js/pull/1675)
@ -284,7 +295,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump typedoc from 0.22.15 to 0.22.17 [`#1514`](https://github.com/oceanprotocol/ocean.js/pull/1514)
- Release 1.1.3 [`7772e93`](https://github.com/oceanprotocol/ocean.js/commit/7772e9387ef9d63f98ea80cfd4eefbea963dd0ad)
#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.2)
#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.1.1...v1.1.2)
> 15 June 2022
- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
#### [v1.1.1](https://github.com/oceanprotocol/ocean.js/compare/v1.1.0...v1.1.1)
> 15 June 2022
- Release 1.1.1 [`ea48e01`](https://github.com/oceanprotocol/ocean.js/commit/ea48e015ac8299f71d57a929f8f30c5d1a8446e7)
- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
#### [v1.1.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.0)
> 15 June 2022
@ -292,9 +317,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump @types/node from 17.0.35 to 17.0.44 [`#1513`](https://github.com/oceanprotocol/ocean.js/pull/1513)
- Bump eslint-config-oceanprotocol from 1.5.0 to 2.0.1 [`#1466`](https://github.com/oceanprotocol/ocean.js/pull/1466)
- update to new schema & compute fixes [`#1510`](https://github.com/oceanprotocol/ocean.js/pull/1510)
- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
- Release 1.1.0 [`112c27e`](https://github.com/oceanprotocol/ocean.js/commit/112c27edab58ef0681ea3e87fb09978411924753)
#### [v1.0.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.45...v1.0.0)

64
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@oceanprotocol/lib",
"version": "2.6.1",
"version": "2.6.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@oceanprotocol/lib",
"version": "2.6.1",
"version": "2.6.2",
"license": "Apache-2.0",
"dependencies": {
"@oceanprotocol/contracts": "^1.1.8",
@ -3046,9 +3046,9 @@
}
},
"node_modules/@truffle/hdwallet-provider": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.1.4.tgz",
"integrity": "sha512-oVpiQSu3JtaDuVHKLZ9Is3hxoCVFwlMjflCJyqTBXMhLmPMPpij4paxaUvXTpeUzGZJJGcBl2DVFhnmPshGrJQ==",
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.1.5.tgz",
"integrity": "sha512-YHAm+kNxR+rFZ54KXXv5fGgzY4KNMlDo2Ocdr8zvjuMXJ0pLwHp52KzUv8oak1G1IUS4F/7yIs9+6qk2hOoQjQ==",
"dev": true,
"dependencies": {
"@ethereumjs/common": "^2.4.0",
@ -3212,9 +3212,9 @@
}
},
"node_modules/@types/mocha": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz",
"integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==",
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz",
"integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==",
"dev": true
},
"node_modules/@types/node": {
@ -5752,9 +5752,9 @@
}
},
"node_modules/decimal.js": {
"version": "10.4.2",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.2.tgz",
"integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA=="
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
},
"node_modules/decode-uri-component": {
"version": "0.2.2",
@ -9088,9 +9088,9 @@
"dev": true
},
"node_modules/http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ=="
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="
},
"node_modules/http-errors": {
"version": "2.0.0",
@ -11594,9 +11594,9 @@
}
},
"node_modules/mocha": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz",
"integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
"dev": true,
"dependencies": {
"ansi-colors": "4.1.1",
@ -19610,9 +19610,9 @@
}
},
"@truffle/hdwallet-provider": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.1.4.tgz",
"integrity": "sha512-oVpiQSu3JtaDuVHKLZ9Is3hxoCVFwlMjflCJyqTBXMhLmPMPpij4paxaUvXTpeUzGZJJGcBl2DVFhnmPshGrJQ==",
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-2.1.5.tgz",
"integrity": "sha512-YHAm+kNxR+rFZ54KXXv5fGgzY4KNMlDo2Ocdr8zvjuMXJ0pLwHp52KzUv8oak1G1IUS4F/7yIs9+6qk2hOoQjQ==",
"dev": true,
"requires": {
"@ethereumjs/common": "^2.4.0",
@ -19762,9 +19762,9 @@
}
},
"@types/mocha": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz",
"integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==",
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz",
"integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==",
"dev": true
},
"@types/node": {
@ -21656,9 +21656,9 @@
"dev": true
},
"decimal.js": {
"version": "10.4.2",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.2.tgz",
"integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA=="
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
},
"decode-uri-component": {
"version": "0.2.2",
@ -24272,9 +24272,9 @@
"dev": true
},
"http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ=="
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="
},
"http-errors": {
"version": "2.0.0",
@ -26187,9 +26187,9 @@
}
},
"mocha": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz",
"integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
"dev": true,
"requires": {
"ansi-colors": "4.1.1",

View File

@ -1,7 +1,7 @@
{
"name": "@oceanprotocol/lib",
"source": "./src/index.ts",
"version": "2.6.1",
"version": "2.6.2",
"description": "JavaScript client library for Ocean Protocol",
"main": "./dist/lib.js",
"umd:main": "dist/lib.umd.js",
@ -30,7 +30,7 @@
"test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
"test:integration": "npm run mocha -- 'test/integration/MultichainProvider.test.ts'",
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
"create:guide": "./scripts/createCodeExamples.sh test/integration/CodeExamples.test.ts",
"create:guidec2d": "./scripts/createCodeExamples.sh test/integration/ComputeExamples.test.ts",

View File

@ -39,6 +39,6 @@ export interface OrderParams {
export interface DispenserParams {
maxTokens: string
maxBalance: string
withMint?: boolean // true if we want to allow the dispenser to be a minter
withMint?: boolean // true if we want to allow the dispenser to be a minter, default true
allowedSwapper?: string // only account that can ask tokens. set address(0) if not required
}

View File

@ -2,7 +2,7 @@ export interface DispenserCreationParams {
dispenserAddress: string
maxTokens: string // how many tokens cand be dispensed when someone requests . If maxTokens=2 then someone can't request 3 in one tx
maxBalance: string // how many dt the user has in it's wallet before the dispenser will not dispense dt
withMint?: boolean // true if we want to allow the dispenser to be a minter
withMint?: boolean // true if we want to allow the dispenser to be a minter, default true
allowedSwapper?: string // only account that can ask tokens. set address(0) if not required
}

View File

@ -7,7 +7,7 @@ export interface FreCreationParams {
datatokenDecimals: number
fixedRate: string
marketFee: string
withMint?: boolean // add FixedPriced contract as minter if withMint == true
withMint?: boolean // adds FixedPriced contract as minter if withMint is not set to false
allowedConsumer?: string // only account that consume the exhchange
}

View File

@ -102,7 +102,7 @@ export class Datatoken extends SmartContract {
}
if (!fixedRateParams.allowedConsumer) fixedRateParams.allowedConsumer = ZERO_ADDRESS
const withMint = fixedRateParams.withMint ? 1 : 0
const withMint = fixedRateParams.withMint === false ? 0 : 1
// should check DatatokenDeployer role using NFT level ..
@ -173,7 +173,7 @@ export class Datatoken extends SmartContract {
if (!dispenserParams.allowedSwapper) dispenserParams.allowedSwapper = ZERO_ADDRESS
if (!dispenserParams.withMint) dispenserParams.withMint = false
dispenserParams.withMint = dispenserParams.withMint !== false
// should check DatatokenDeployer role using NFT level ..

View File

@ -594,7 +594,7 @@ export class NftFactory extends SmartContractWithAddress {
private getFreCreationParams(freParams: FreCreationParams): any {
if (!freParams.allowedConsumer) freParams.allowedConsumer = ZERO_ADDRESS
const withMint = freParams.withMint ? 1 : 0
const withMint = freParams.withMint === false ? 0 : 1
return {
fixedPriceAddress: freParams.fixedRateAddress,

View File

@ -10,7 +10,8 @@ import {
downloadFile,
calculateEstimatedGas,
sendTx,
transfer
transfer,
Provider
} from '../../src'
import { ProviderFees, Files } from '../../src/@types'
import { createAsset, updateAssetMetadata } from './utils'
@ -93,6 +94,27 @@ describe('Multichain Provider test', async () => {
console.log(`Publisher account address: ${publisherAccount}`)
console.log(`Consumer account address: ${consumerAccount}`)
console.log(
'provider 1 endpoints',
ProviderInstance.getEndpoints('http://172.15.0.4:8030')
)
console.log(
'provider 2 endpoints',
ProviderInstance.getEndpoints('http://172.15.0.7:8030')
)
console.log(
'provider 2 endpoints 8031',
ProviderInstance.getEndpoints('http://172.15.0.7:8031')
)
console.log(
'provider multi endpoints',
ProviderInstance.getEndpoints('http://172.15.0.9:8030')
)
console.log(
'provider multi endpoints 8032',
ProviderInstance.getEndpoints('http://172.15.0.9:8032')
)
})
it('Mint OCEAN to publisher account', async () => {
@ -217,7 +239,7 @@ describe('Multichain Provider test', async () => {
})
it('Should update metadata the asset metadata with second provider as serviceEndpoint', async () => {
resolvedDdo.services[0].serviceEndpoint = 'http://172.15.0.104:8030'
resolvedDdo.services[0].serviceEndpoint = 'http://172.15.0.9:8030'
const updateTx = await updateAssetMetadata(
publisherAccount,
resolvedDdo,
@ -230,7 +252,7 @@ describe('Multichain Provider test', async () => {
delay(10000) // let's wait for aquarius to index the updated ddo
it('Should resolve updated metadata asset', async () => {
providerUrl = 'http://172.15.0.104:8030'
providerUrl = 'http://172.15.0.9:8030'
resolvedDdoAfterUpdate = await aquarius.waitForAqua(assetId)
console.log('____resolvedDdoAfterUpdate____ ', resolvedDdoAfterUpdate)
assert(resolvedDdoAfterUpdate, 'Cannot fetch DDO from Aquarius')