mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Bump contracts to 0.6.4 (#837)
* Bump @oceanprotocol/contracts from 0.6.3 to 0.6.4 Bumps [@oceanprotocol/contracts](https://github.com/oceanprotocol/contracts) from 0.6.3 to 0.6.4. - [Release notes](https://github.com/oceanprotocol/contracts/releases) - [Changelog](https://github.com/oceanprotocol/contracts/blob/main/CHANGELOG.md) - [Commits](https://github.com/oceanprotocol/contracts/compare/v0.6.3...v0.6.4) --- updated-dependencies: - dependency-name: "@oceanprotocol/contracts" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * use startBlock & chainId from contracts * export network metadata * less repetetive network metadata * switch Polygon mainnet URLs * typing fixes * package bumps Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: alexcos20 <alex.coseru@gmail.com> Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
This commit is contained in:
parent
7503485af6
commit
5852b0a27d
35590
package-lock.json
generated
35590
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
41
package.json
41
package.json
@ -45,10 +45,9 @@
|
||||
"web3": "^1.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethereum-navigator/navigator": "^0.5.2",
|
||||
"@oceanprotocol/contracts": "^0.6.2",
|
||||
"@types/crypto-js": "^4.0.1",
|
||||
"cross-fetch": "^3.1.2",
|
||||
"@ethereum-navigator/navigator": "^0.5.3",
|
||||
"@oceanprotocol/contracts": "^0.6.4",
|
||||
"cross-fetch": "^3.1.4",
|
||||
"crypto-js": "^4.0.0",
|
||||
"decimal.js": "^10.2.1",
|
||||
"fs": "0.0.1-security",
|
||||
@ -56,39 +55,39 @@
|
||||
"node-abort-controller": "^2.0.0",
|
||||
"save-file": "^2.3.1",
|
||||
"uuid": "^8.3.2",
|
||||
"web3": "^1.3.5",
|
||||
"web3": "^1.3.6",
|
||||
"web3-eth-contract": "^1.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@truffle/hdwallet-provider": "^1.2.1",
|
||||
"@types/chai": "^4.2.11",
|
||||
"@types/chai-spies": "^1.0.1",
|
||||
"@truffle/hdwallet-provider": "^1.4.1",
|
||||
"@types/chai": "^4.2.19",
|
||||
"@types/chai-spies": "^1.0.3",
|
||||
"@types/crypto-js": "^4.0.1",
|
||||
"@types/mocha": "^8.0.3",
|
||||
"@types/node": "^15.0.0",
|
||||
"@types/node-fetch": "^2.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^4.13.0",
|
||||
"@typescript-eslint/parser": "^4.13.0",
|
||||
"auto-changelog": "^2.2.1",
|
||||
"chai": "^4.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
||||
"@typescript-eslint/parser": "^4.28.0",
|
||||
"auto-changelog": "^2.3.0",
|
||||
"chai": "^4.3.4",
|
||||
"chai-spies": "^1.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^7.17.0",
|
||||
"eslint-config-oceanprotocol": "^1.5.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"lcov-result-merger": "^3.1.0",
|
||||
"microbundle": "^0.13.0",
|
||||
"mocha": "^9.0.0",
|
||||
"mock-local-storage": "^1.1.15",
|
||||
"microbundle": "^0.13.3",
|
||||
"mocha": "^9.0.1",
|
||||
"mock-local-storage": "^1.1.17",
|
||||
"nyc": "^15.1.0",
|
||||
"ora": "^5.2.0",
|
||||
"prettier": "^2.3.0",
|
||||
"release-it": "^14.7.0",
|
||||
"ora": "^5.4.1",
|
||||
"prettier": "^2.3.1",
|
||||
"release-it": "^14.10.0",
|
||||
"source-map-support": "^0.5.19",
|
||||
"ts-node": "^10.0.0",
|
||||
"ts-node-register": "^1.0.0",
|
||||
"typedoc": "^0.20.14",
|
||||
"typescript": "^4.1.3"
|
||||
"typedoc": "^0.21.0",
|
||||
"typescript": "^4.3.4"
|
||||
},
|
||||
"nyc": {
|
||||
"include": [
|
||||
|
11
src/lib.ts
11
src/lib.ts
@ -5,12 +5,7 @@ import { Ocean } from './ocean/Ocean'
|
||||
import { LoggerInstance as Logger, LogLevel } from './utils/Logger'
|
||||
import { MetadataCache } from './metadatacache/MetadataCache'
|
||||
import { DataTokens } from './datatokens/Datatokens'
|
||||
import {
|
||||
ConfigHelper,
|
||||
ConfigHelperConfig,
|
||||
ConfigHelperNetworkId,
|
||||
ConfigHelperNetworkName
|
||||
} from './utils/ConfigHelper'
|
||||
import { ConfigHelper, ConfigHelperConfig } from './utils/ConfigHelper'
|
||||
|
||||
import * as utils from './utils'
|
||||
import { Provider } from './provider/Provider'
|
||||
@ -39,7 +34,5 @@ export {
|
||||
DataTokens,
|
||||
utils,
|
||||
ConfigHelper,
|
||||
ConfigHelperConfig,
|
||||
ConfigHelperNetworkId,
|
||||
ConfigHelperNetworkName
|
||||
ConfigHelperConfig
|
||||
}
|
||||
|
@ -5,59 +5,44 @@ import { homedir } from 'os'
|
||||
import { default as DefaultContractsAddresses } from '@oceanprotocol/contracts/artifacts/address.json'
|
||||
import Logger from './Logger'
|
||||
|
||||
export declare type ConfigHelperNetworkName =
|
||||
| 'mainnet'
|
||||
| 'rinkeby'
|
||||
| 'development'
|
||||
| string
|
||||
|
||||
export declare type ConfigHelperNetworkId = 1 | 4 | number
|
||||
|
||||
export interface ConfigHelperConfig extends Config {
|
||||
networkId: ConfigHelperNetworkId
|
||||
network: ConfigHelperNetworkName
|
||||
networkId: number
|
||||
network: string
|
||||
subgraphUri: string
|
||||
explorerUri: string
|
||||
oceanTokenSymbol: string
|
||||
}
|
||||
|
||||
const configs: ConfigHelperConfig[] = [
|
||||
const configHelperNetworksBase: ConfigHelperConfig = {
|
||||
networkId: null,
|
||||
network: 'unknown',
|
||||
nodeUri: 'http://localhost:8545',
|
||||
metadataCacheUri: 'http://127.0.0.1:5000',
|
||||
providerUri: 'http://127.0.0.1:8030',
|
||||
subgraphUri: null,
|
||||
explorerUri: null,
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: '0x1234',
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 0
|
||||
}
|
||||
|
||||
export const configHelperNetworks: ConfigHelperConfig[] = [
|
||||
{
|
||||
networkId: null,
|
||||
network: 'unknown',
|
||||
nodeUri: 'http://localhost:8545',
|
||||
metadataCacheUri: 'http://127.0.0.1:5000',
|
||||
providerUri: 'http://127.0.0.1:8030',
|
||||
subgraphUri: null,
|
||||
explorerUri: null,
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: '0x1234',
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 0
|
||||
...configHelperNetworksBase
|
||||
},
|
||||
{
|
||||
// barge
|
||||
...configHelperNetworksBase,
|
||||
networkId: 8996,
|
||||
network: 'development',
|
||||
nodeUri: 'http://localhost:8545',
|
||||
metadataCacheUri: 'http://127.0.0.1:5000',
|
||||
providerUri: 'http://127.0.0.1:8030',
|
||||
subgraphUri: null,
|
||||
explorerUri: null,
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: null,
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 0
|
||||
network: 'development'
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 3,
|
||||
network: 'ropsten',
|
||||
nodeUri: 'https://ropsten.infura.io/v3',
|
||||
@ -65,16 +50,10 @@ const configs: ConfigHelperConfig[] = [
|
||||
providerUri: 'https://provider.ropsten.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.ropsten.oceanprotocol.com',
|
||||
explorerUri: 'https://ropsten.etherscan.io',
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: null,
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 9227563
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 4,
|
||||
network: 'rinkeby',
|
||||
nodeUri: 'https://rinkeby.infura.io/v3',
|
||||
@ -82,16 +61,10 @@ const configs: ConfigHelperConfig[] = [
|
||||
providerUri: 'https://provider.rinkeby.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.rinkeby.oceanprotocol.com',
|
||||
explorerUri: 'https://rinkeby.etherscan.io',
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: null,
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 7294090
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 1,
|
||||
network: 'mainnet',
|
||||
nodeUri: 'https://mainnet.infura.io/v3',
|
||||
@ -99,33 +72,22 @@ const configs: ConfigHelperConfig[] = [
|
||||
providerUri: 'https://provider.mainnet.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.mainnet.oceanprotocol.com',
|
||||
explorerUri: 'https://etherscan.io',
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: null,
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 11105459
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 137,
|
||||
network: 'polygon',
|
||||
nodeUri: 'https://rpc-mainnet.maticvigil.com/',
|
||||
nodeUri: 'https://polygon-mainnet.infura.io/v3/',
|
||||
metadataCacheUri: 'https://aquarius.polygon.oceanprotocol.com',
|
||||
providerUri: 'https://provider.polygon.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.polygon.oceanprotocol.com',
|
||||
explorerUri: 'https://explorer.matic.network',
|
||||
oceanTokenAddress: null,
|
||||
explorerUri: 'https://polygonscan.com',
|
||||
oceanTokenSymbol: 'mOCEAN',
|
||||
factoryAddress: null,
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 11005222
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 1287,
|
||||
network: 'moonbeamalpha',
|
||||
nodeUri: 'https://rpc.testnet.moonbeam.network/',
|
||||
@ -133,14 +95,37 @@ const configs: ConfigHelperConfig[] = [
|
||||
providerUri: 'https://provider.moonbeamalpha.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.moonbeamalpha.oceanprotocol.com',
|
||||
explorerUri: 'https://moonbase-blockscout.testnet.moonbeam.network/',
|
||||
oceanTokenAddress: null,
|
||||
oceanTokenSymbol: 'OCEAN',
|
||||
factoryAddress: null,
|
||||
poolFactoryAddress: null,
|
||||
fixedRateExchangeAddress: null,
|
||||
dispenserAddress: null,
|
||||
metadataContractAddress: null,
|
||||
startBlock: 90707
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 2021000,
|
||||
network: 'gaiaxtestnet',
|
||||
nodeUri: 'https://gaia-x.rpc',
|
||||
metadataCacheUri: 'https://aquarius.gaiaxtestnet.oceanprotocol.com',
|
||||
providerUri: 'https://provider.gaiaxtestnet.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.gaiaxtestnet.oceanprotocol.com',
|
||||
explorerUri: 'https://gaiaxtestnet.explorer'
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 80001,
|
||||
network: 'mumbai',
|
||||
nodeUri: 'https://polygon-mumbai.infura.io/v3/',
|
||||
metadataCacheUri: 'https://aquarius.mumbai.oceanprotocol.com',
|
||||
providerUri: 'https://provider.mumbai.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.mumbai.oceanprotocol.com',
|
||||
explorerUri: 'https://explorer-mumbai.maticvigil.com/'
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
networkId: 56,
|
||||
network: 'bsc',
|
||||
nodeUri: 'https://bsc-dataseed.binance.org/',
|
||||
metadataCacheUri: 'https://aquarius.bsc.oceanprotocol.com',
|
||||
providerUri: 'https://provider.bsc.oceanprotocol.com',
|
||||
subgraphUri: 'https://subgraph.bsc.oceanprotocol.com',
|
||||
explorerUri: 'https://bscscan.com/'
|
||||
}
|
||||
]
|
||||
|
||||
@ -150,8 +135,16 @@ export class ConfigHelper {
|
||||
// use the defaults first
|
||||
let configAddresses: Partial<ConfigHelperConfig>
|
||||
if (DefaultContractsAddresses[network]) {
|
||||
const { DTFactory, BFactory, FixedRateExchange, Dispenser, Metadata, Ocean } =
|
||||
DefaultContractsAddresses[network]
|
||||
const {
|
||||
DTFactory,
|
||||
BFactory,
|
||||
FixedRateExchange,
|
||||
Dispenser,
|
||||
Metadata,
|
||||
Ocean,
|
||||
chainId,
|
||||
startBlock
|
||||
} = DefaultContractsAddresses[network]
|
||||
configAddresses = {
|
||||
factoryAddress: DTFactory,
|
||||
poolFactoryAddress: BFactory,
|
||||
@ -159,6 +152,8 @@ export class ConfigHelper {
|
||||
dispenserAddress: Dispenser,
|
||||
metadataContractAddress: Metadata,
|
||||
oceanTokenAddress: Ocean,
|
||||
networkId: chainId,
|
||||
startBlock: startBlock,
|
||||
...(process.env.AQUARIUS_URI && { metadataCacheUri: process.env.AQUARIUS_URI })
|
||||
}
|
||||
}
|
||||
@ -172,8 +167,16 @@ export class ConfigHelper {
|
||||
'utf8'
|
||||
)
|
||||
)
|
||||
const { DTFactory, BFactory, FixedRateExchange, Dispenser, Metadata, Ocean } =
|
||||
data[network]
|
||||
const {
|
||||
DTFactory,
|
||||
BFactory,
|
||||
FixedRateExchange,
|
||||
Dispenser,
|
||||
Metadata,
|
||||
Ocean,
|
||||
chainId,
|
||||
startBlock
|
||||
} = data[network]
|
||||
configAddresses = {
|
||||
factoryAddress: DTFactory,
|
||||
poolFactoryAddress: BFactory,
|
||||
@ -181,6 +184,8 @@ export class ConfigHelper {
|
||||
dispenserAddress: Dispenser,
|
||||
metadataContractAddress: Metadata,
|
||||
oceanTokenAddress: Ocean,
|
||||
networkId: chainId,
|
||||
startBlock: startBlock,
|
||||
...(process.env.AQUARIUS_URI && { metadataCacheUri: process.env.AQUARIUS_URI })
|
||||
}
|
||||
} catch (e) {
|
||||
@ -191,12 +196,9 @@ export class ConfigHelper {
|
||||
return configAddresses
|
||||
}
|
||||
|
||||
public getConfig(
|
||||
network: ConfigHelperNetworkName | ConfigHelperNetworkId,
|
||||
infuraProjectId?: string
|
||||
): Config {
|
||||
public getConfig(network: string | number, infuraProjectId?: string): Config {
|
||||
const filterBy = typeof network === 'string' ? 'network' : 'networkId'
|
||||
let config = configs.find((c) => c[filterBy] === network)
|
||||
let config = configHelperNetworks.find((c) => c[filterBy] === network)
|
||||
|
||||
if (!config) {
|
||||
Logger.error(`No config found for given network '${network}'`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user