Skip to content

Commit

Permalink
Merge pull request #127 from nevermined-io/feat/environments
Browse files Browse the repository at this point in the history
Adding environments and NvmAppApi doc
  • Loading branch information
aaitor committed Jun 19, 2024
2 parents 9abf015 + dbdcf43 commit fe7ada7
Show file tree
Hide file tree
Showing 6 changed files with 1,626 additions and 602 deletions.
6 changes: 5 additions & 1 deletion docs/environments/05-production.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ description: Production Environment

# Production environment

The Nevermined Point of Sales App is deployed on https://nevermined.app/.
The Nevermined Point of Sales App is deployed on https://nevermined.app/. The main difference between the production and testing environments is that in the production environment users can publish and receive payments with real money.

There are 2 types of production environments:
- With a [Nevermined App](https://nevermined.app) instance. This environment is where users can publish their Agents and AIs and receive payments and also Agents can interact with each other.
- Without Nevermined App. This environment is specially oriented to **Agent2Agent** communication and orchestration.

## Network Fee

Expand Down
2 changes: 1 addition & 1 deletion docs/environments/07-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Point of Sales Testing Environment

# Testing environment

The Point of Sales testing environment is free to use and where users can interact with the application without using real money.
The Point of Sales testing environment is free to use and where users can interact with the application without using real money. The existing testing environment (Environment id: `appTesting`) is available at [https://testing.nevermined.app/](https://testing.nevermined.app/).

## Network Fee

Expand Down
15 changes: 15 additions & 0 deletions docs/environments/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ In [testing](https://testing.nevermined.app/) environment all the payments are n
:::


A part of these environments we have **Headless Deployments** where we don't provide a Nevermined App **BUT** the underlying network is available. This deployments are specially oriented to **Agent2Agent** communication and orchestration.


Environment ID | Type | Nevermined App | Marketplace API (Metadata) | Node
---------------|------|----------------|----------------------------|------------------
appArbitrum | **Production** | https://nevermined.app | https://marketplace-api.arbitrum.nevermined.app | https://node.arbitrum.nevermined.app
appTesting | **Testing** | https://testing.nevermined.app | https://marketplace-api.testing.nevermined.app | https://node.testing.nevermined.app
appMatic | **Production without App** | - | https://marketplace-api.matic.nevermined.app | https://node.matic.nevermined.app
appGnosis | **Production without App** | - | https://marketplace-api.gnosis.nevermined.app | https://node.gnosis.nevermined.app
appOptimism | **Production without App** | - | https://marketplace-api.optimism.nevermined.app | https://node.optimism.nevermined.app
appBase | **Production without App** | - | https://marketplace-api.base.nevermined.app | https://node.base.nevermined.app
appCelo | **Production without App** | - | https://marketplace-api.celo.nevermined.app | https://node.celo.nevermined.app



import DocCardList from '@theme/DocCardList';

<DocCardList />
26 changes: 17 additions & 9 deletions docs/tutorials/integration/03-api-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ Once you added the Nevermined App API to your project, you can connect to any of
const nvmApp = await NvmApp.getInstance(NVMAppEnvironments.Testing)
```

:::info

You can connect to different environments by using any of the existing `NVMAppEnvironments`

:::

The default instance of the nvmApp will be connected to the Testing environment and allows using the search API:

```typescript
Expand All @@ -48,18 +54,14 @@ You can download the Smart Contracts artifacts using the [download script](https
You can connect with your account using the `connect` method:

```typescript
const randomWallet = ethers.Wallet.createRandom()
const zerodevProvider = await ZeroDevEthersProvider.init('ECDSA', {
projectId,
owner: convertEthersV6SignerToAccountSigner(randomWallet),
})
const accountSigner = zerodevProvider.getAccountSigner()

const accountSigner = makeWallet(process.env.SEED_WORDS)
await nvmApp.connect(accountSigner)
```

Regarding the wallet, you can use ethers/viem or other libraries to have the wallet connected.

:::warning
The use of zeroDev is optional. And regarding the wallet, you can use ethers/viem or other libraries to have the wallet connected.
You can pass a ZeroDev account to the `connect` method. The use of zeroDev is optional.
:::

### Publishing subscriptions
Expand Down Expand Up @@ -167,11 +169,17 @@ await nvmAppSubscriber.connect(subscriberAddress, appConfig)
And now we order the previously created subscription with the new account:

```typescript
const orderResult = await nvmAppSubscriber.orderSubscription(subscriptionDDO.id, subscriptionDDO.credits)
const orderResult = await nvmAppSubscriber.orderSubscription(subscriptionDDO.id)
const agreementId = orderResult.agreementId
await nvmApp.claimSubscription(agreementId, subscriptionDDO.id, subscriptionDDO.credits)
```

Now you should be able to check the balance of credits of the subscription ordered:

```typescript
const creditsBalance = await nvmApp.getBalance(subscriptionDDO.id)
```

### Using the subscription to get access to AI Agents

```typescript
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
},
"dependencies": {
"@babel/traverse": "7.23.7",
"@docusaurus/core": "^3.1.0",
"@docusaurus/plugin-google-analytics": "^3.1.0",
"@docusaurus/preset-classic": "^3.1.0",
"@docusaurus/theme-classic": "^3.1.0",
"@docusaurus/theme-common": "^3.1.0",
"@docusaurus/theme-search-algolia": "^3.1.0",
"@docusaurus/core": "^3.4.0",
"@docusaurus/plugin-google-analytics": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-classic": "^3.4.0",
"@docusaurus/theme-common": "^3.4.0",
"@docusaurus/theme-search-algolia": "^3.4.0",
"@mdx-js/react": "^3.0.0",
"@nevermined-io/payments": "0.3.2",
"@nevermined-io/styles": "^0.1.1",
Expand Down
Loading

0 comments on commit fe7ada7

Please sign in to comment.