Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multichain Provider #1698

Merged
merged 21 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,32 @@ 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.7.0-next.2](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.1...v2.7.0-next.2)

- fix isValid provider method [`010306c`](https://github.com/oceanprotocol/ocean.js/commit/010306c92e003021b08df0b8b8ad6743ae6b240c)

#### [v2.7.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.0...v2.7.0-next.1)

> 22 February 2023

- Release 2.7.0-next.0 [`500062b`](https://github.com/oceanprotocol/ocean.js/commit/500062beb575b21ab7210a675bdf5174d11842c8)
- Updating CodeExamples.md [`6cc891a`](https://github.com/oceanprotocol/ocean.js/commit/6cc891a5da9e4042e3eee243b651e8a7188d1786)
- Release 2.7.0-next.1 [`ba27412`](https://github.com/oceanprotocol/ocean.js/commit/ba2741296167de4c112560f2807b1a45e86eba94)

#### [v2.7.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v2.6.3...v2.7.0-next.0)

> 21 February 2023

- add needed multichain provider changes [`95551ee`](https://github.com/oceanprotocol/ocean.js/commit/95551eeb669395357149dd923ecec304955add14)
- Release 2.7.0-next.0 [`95886a1`](https://github.com/oceanprotocol/ocean.js/commit/95886a184faadd4a13e857e285e016ef4c20966f)
- fix code example [`c4a00e4`](https://github.com/oceanprotocol/ocean.js/commit/c4a00e45848ace6a4fe3d4fa1a2aeac518aa44ce)

#### [v2.6.3](https://github.com/oceanprotocol/ocean.js/compare/v2.6.2...v2.6.3)

> 13 February 2023

- add macOS readme message [`#1697`](https://github.com/oceanprotocol/ocean.js/pull/1697)
- Release 2.6.3 [`53f0c53`](https://github.com/oceanprotocol/ocean.js/commit/53f0c536a9bc683676a513edb61faf2dfd9c0262)

#### [v2.6.2](https://github.com/oceanprotocol/ocean.js/compare/v2.6.1...v2.6.2)

Expand Down
16 changes: 12 additions & 4 deletions CodeExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ Next, let's encrypt the file(s) using provider
```Typescript
ASSET_URL.datatokenAddress = freDatatokenAddress
ASSET_URL.nftAddress = freNftAddress
const encryptedFiles = await ProviderInstance.encrypt(ASSET_URL, providerUrl)
const encryptedFiles = await ProviderInstance.encrypt(
ASSET_URL,
DDO.chainId,
providerUrl
)
DDO.services[0].files = await encryptedFiles
DDO.services[0].datatokenAddress = freDatatokenAddress

Expand All @@ -359,7 +363,7 @@ Now let's console log the DID to check everything is working
```Typescript
console.log(`DID: ${DDO.id}`)

const providerResponse = await ProviderInstance.encrypt(DDO, providerUrl)
const providerResponse = await ProviderInstance.encrypt(DDO, DDO.chainId, providerUrl)
const encryptedDDO = await providerResponse
const metadataHash = getHash(JSON.stringify(DDO))
await nft.setMetadata(
Expand Down Expand Up @@ -567,13 +571,17 @@ Now we need to encrypt file(s) using provider
```Typescript
ASSET_URL.datatokenAddress = dispenserDatatokenAddress
ASSET_URL.nftAddress = dispenserNftAddress
const encryptedFiles = await ProviderInstance.encrypt(ASSET_URL, providerUrl)
const encryptedFiles = await ProviderInstance.encrypt(
ASSET_URL,
DDO.chainId,
providerUrl
)
DDO.services[0].files = await encryptedFiles
DDO.services[0].datatokenAddress = dispenserDatatokenAddress

console.log(`DID: ${DDO.id}`)

const providerResponse = await ProviderInstance.encrypt(DDO, providerUrl)
const providerResponse = await ProviderInstance.encrypt(DDO, DDO.chainId, providerUrl)
const encryptedDDO = await providerResponse
const metadataHash = getHash(JSON.stringify(DDO))
await nft.setMetadata(
Expand Down
8 changes: 5 additions & 3 deletions ComputeExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ async function createAsset(
// Next we encrypt the file or files using Ocean Provider. The provider is an off chain proxy built specifically for this task
assetUrl.datatokenAddress = datatokenAddressAsset
assetUrl.nftAddress = ddo.nftAddress
let providerResponse = await ProviderInstance.encrypt(assetUrl, providerUrl)
let providerResponse = await ProviderInstance.encrypt(assetUrl, chain, providerUrl)
ddo.services[0].files = await providerResponse
ddo.services[0].datatokenAddress = datatokenAddressAsset
ddo.services[0].serviceEndpoint = providerUrl
Expand All @@ -338,7 +338,7 @@ async function createAsset(
ddo.nftAddress = web3.utils.toChecksumAddress(nftAddress)
ddo.id =
'did:op:' + SHA256(web3.utils.toChecksumAddress(nftAddress) + chain.toString(10))
providerResponse = await ProviderInstance.encrypt(ddo, providerUrl)
providerResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
const encryptedResponse = await providerResponse
const validateResult = await aquarius.validate(ddo)

Expand Down Expand Up @@ -583,7 +583,9 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato
### 10.1 Start a compute job using a free C2D environment
let's check the free compute environment
```Typescript
const computeEnv = computeEnvs.find((ce) => ce.priceMin === 0)
const computeEnv = computeEnvs[resolvedDatasetDdo.chainId].find(
(ce) => ce.priceMin === 0
)
console.log('Free compute environment = ', computeEnv)
```
<!--
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Further releases afterwards can be done with `npm run release` again and selecti
## 🏛 License

```
Copyright ((C)) 2022 Ocean Protocol Foundation
Copyright ((C)) 2023 Ocean Protocol Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading