Skip to content

Commit

Permalink
Merge pull request #55 from nevermined-io/feature/nvm_config
Browse files Browse the repository at this point in the history
Adapting to `ethersjs`
  • Loading branch information
r-marques authored Aug 12, 2022
2 parents 63cba06 + ddd8175 commit 45ea296
Show file tree
Hide file tree
Showing 43 changed files with 760 additions and 2,254 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ jobs:
strategy:
fail-fast: false
matrix:
network: ["--spree-embedded-contracts"]
network: ["--spree-embedded-contracts", "--polygon"]
node: ["16"]
include:
- network: "--spree-embedded-contracts"
network-name: spree
- network: "--polygon"
network-name: polygon-localnet

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -45,13 +50,16 @@ jobs:
./start_nevermined.sh ${{ matrix.network }} 2>&1 | tee nevermined_tools.txt &
cd ..
./scripts/wait-nevermined.sh
./scripts/wait-subgraphs.sh
./scripts/wait-subgraphs.sh ${{ matrix.network-name }}
- name: Run integration tests
env:
MNEMONIC: ${{ secrets.TEST_MNEMONIC }}
TOKEN_ADDRESS: "0x0000000000000000000000000000000000000000"
NODE_URL: "http://localhost:8545"
NETWORK: ${{ matrix.network-name }}
IPFS_PROJECT_ID: ${{ secrets.IPFS_PROJECT_ID }}
IPFS_PROJECT_SECRET: ${{ secrets.IPFS_PROJECT_SECRET }}
run: |
sleep 10
yarn build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ yarn-error.log
coverage
.vscode
package-lock.json
yarn.lock
49 changes: 33 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Options:
--help Show help [boolean]
--version Show version number [boolean]
-v, --verbose Run with verbose logging [boolean]
-n, --network The network to use [string] [default: "spree"]
-n, --network The network to use [string] [default: "testnet"]
-a, --account The account to use [string] [default: ""]
```

Expand All @@ -114,34 +114,51 @@ The CLI has pre-configured some Nevermined environments. You can check what is p
```
$ ncli network list
Nevermined pre-configured networks:
rinkeby:
Gateway: https://gateway.rinkeby.nevermined.rocks
Metadata API: https://metadata.rinkeby.nevermined.rocks
Faucet: https://faucet.rinkeby.nevermined.rocks
spree:
This environment is used for local development. If you want to have a fully functional environment running in your computer, please visit https://github.com/nevermined-io/tools/
Is a Production environment? false
Node Uri: http://localhost:8545
Gateway: http://localhost:8030
Marketplace API: http://172.17.0.1:3100
Faucet: http://localhost:3001
spree:
Gateway: http://localhost:8030
Metadata API: http://nevermined-metadata:5000
Faucet: http://localhost:3001
testnet:
Public testnet environment where users can interact with Nevermined protocol.
Is a Production environment? false
Node Uri: https://rpc-mumbai.maticvigil.com
Gateway: https://gateway.mumbai.public.nevermined.rocks
Marketplace API: https://marketplace-api.mumbai.public.nevermined.rocks
Faucet: https://faucet.mumbai.public.nevermined.rocks
defiMumbai:
Gateway: https://gateway.mumbai.nevermined.rocks
Metadata API: https://metadata.mumbai.nevermined.rocks
Faucet: https://faucet.mumbai.nevermined.rocks
Testnet environment for the DeFi Marketplace.
Is a Production environment? false
Node Uri: https://rpc-mumbai.maticvigil.com
Gateway: https://defi.v2.gateway.mumbai.nevermined.rocks
Marketplace API: https://defi.v2.marketplace-api.mumbai.nevermined.rocks
Faucet: https://faucet.mumbai.public.nevermined.rocks
autonomiesMumbai:
Gateway: https://gateway.autonomies.mumbai.nevermined.rocks
Metadata API: https://metadata.autonomies.mumbai.nevermined.rocks
Faucet: https://faucet.mumbai.nevermined.rocks
Testnet environment for the Autonomies Marketplace.
Is a Production environment? false
Node Uri: https://rpc-mumbai.maticvigil.com
Gateway: https://gateway.autonomies.test.nevermined.rocks
Marketplace API: https://marketplace-api.autonomies.test.nevermined.rocks
Faucet: https://faucet.mumbai.public.nevermined.rocks
```

A part of these networks you can connect to any other network using the environment variables described above.

When you want to connect and interact with a different network of the default (`spree`), make sure you have exported the `NODE_URL` environment variable connected to the right environment, and pass the `-n NETWORK_NAME` parameter to your commands.
When you want to connect and interact with a different network of the default (`testnet`), make sure you have exported the `NODE_URL` environment variable connected to the right environment, and pass the `-n NETWORK_NAME` parameter to your commands.


## License
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@
"build:watch": "npm build --watch",
"start": "ts-node src/index.ts",
"generate-doc": "ts-node src/generateDoc.ts",
"test": "jest --coverage --rootDir test",
"test": "jest --coverage --rootDir test -w 1",
"test:watch": "jest --watch --rootDir test"
},
"bin": {
"ncli": "./dist/src/index.js"
},
"dependencies": {
"@nevermined-io/nevermined-sdk-js": "0.21.0",
"@nevermined-io/nevermined-sdk-js": "0.22.6",
"@truffle/hdwallet-provider": "^2.0.9",
"chalk": "^4.1.2",
"cross-fetch": "~3.1.5",
"dotenv": "^16.0.1",
"eta": "1.12.3",
"ethers": "~5.6.9",
"ipfs-http-client-lite": "~0.3.0",
"log4js": "^6.5.2",
"tar": "^6.1.11",
"cross-fetch": "~3.1.5",
"yargs": "^17.5.1"
},
"devDependencies": {
Expand Down
36 changes: 31 additions & 5 deletions resources/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"name": "network",
"alias": "n",
"default": "spree",
"default": "testnet",
"type": "string",
"description": "The network to use"
},
Expand Down Expand Up @@ -45,6 +45,32 @@
"examples": ["ncli network status"],
"commandHandler": "networkStatus",
"requiresAccount": false
}, {
"name": "get-config",
"description": "Get all the Governance configuration about a Nevermined environment",
"details": "If the `ncli` is connected to a Nevermined network correctly this command will return information about all the governance parameters related to a Nevermined deployment.",
"examples": ["ncli network get-config"],
"commandHandler": "networkGetConfig",
"requiresAccount": false
}, {
"name": "set-config [parameter]",
"description": "Allows to the governor account to modify the configuration of a running Nevermined blockchain environment",
"details": "If the `ncli` is connected to a Nevermined network correctly this command will allow to modify the on-chain configuration of a deployment. This function only can be executed by a `governor` account.",
"examples": ["ncli network set-config governor 0x12345", "ncli network set-config fees 350,0x4569832"],
"commandHandler": "networkSetConfig",
"requiresAccount": true,
"positionalArguments": [{
"name": "parameter",
"type": "string",
"description": "the name of the governance parameter to configure. Existing options: 'fees' OR 'governor'"
}],
"optionalArguments": [{
"name": "newValue",
"type": "string",
"demandOption": true,
"description": "the new value to set"
}
]
}]
}, {
"name": "accounts",
Expand Down Expand Up @@ -460,7 +486,7 @@
{
"name": "signature",
"type": "string",
"default": "0x0",
"default": "0x",
"description": "The signature associated to the provenance event"
},
{
Expand Down Expand Up @@ -591,7 +617,7 @@
"positionalArguments": [{
"name": "did",
"type": "string",
"description": "The DID associated with the NFT (tokenId)"
"description": "The DID associated with the NFT"
}],
"optionalArguments": [{
"name": "nftAddress",
Expand Down Expand Up @@ -647,7 +673,7 @@
"type": "string",
"default": "",
"description": "The address of the receiver of the NFT, if not given will be the minter address"
},
},
{
"name": "nftType",
"type": "string",
Expand Down Expand Up @@ -1102,7 +1128,7 @@
}],
"optionalArguments": [{
"name": "networkId",
"type": "string",
"type": "string",
"description": "The networkId of the network where Nevermined contracts are deployed and we want to download the artifacts. For example 'mumbai' is 80001"
}, {
"name": "tag",
Expand Down
22 changes: 21 additions & 1 deletion resources/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@
"gasMultiplier": 0,
"gasPriceMultiplier": 0
},
"polygon-localnet": {
"envDescription": "This environment is used for local development. If you want to have a fully functional environment running in your computer, please visit https://github.com/nevermined-io/tools/",
"isProduction": false,
"nvm": {
"nodeUri": "http://localhost:8545",
"marketplaceUri": "http://172.17.0.1:3100",
"faucetUri": "http://localhost:3001",
"graphHttpUri": "http://localhost:9000/subgraphs/name/nevermined-io/development",
"gatewayUri": "http://localhost:8030",
"gatewayAddress": "0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0",
"verbose": true
},
"nativeToken": "MATIC",
"networkId": "8997",
"networkName": "polygon-localnet",
"etherscanUrl": "",
"erc20TokenAddress": "0x0000000000000000000000000000000000000000",
"gasMultiplier": 0,
"gasPriceMultiplier": 0
},
"testnet": {
"envDescription": "Public testnet environment where users can interact with Nevermined protocol.",
"envUrl": "https://defi.v2.portal.mumbai.nevermined.rocks/",
Expand All @@ -35,7 +55,7 @@
"nativeToken": "MATIC",
"networkId": "80001",
"networkName": "mumbai",
"contractsVersion": "2.0.0",
"contractsVersion": "2.0.3",
"tagName": "public",
"etherscanUrl": "https://mumbai.polygonscan.com",
"erc20TokenAddress": "0xe11A86849d99F524cAC3E7A0Ec1241828e332C62",
Expand Down
Loading

0 comments on commit 45ea296

Please sign in to comment.