Closed freevedo33 closed 4 months ago
Thank you for the report, we will look into the issue.
Hi @freevedo33 I tried reproducing the issue and did not encounter the error you mentioned.
A few suggestions:
metadataCacheUri
configuration can be found here: https://nautilus.delta-dao.com/docs/guides/config#custom-metadata-cacheWorking code example:
import { providers, Wallet } from 'ethers'
import { LogLevel, Nautilus } from '@deltadao/nautilus'
const provider = new providers.JsonRpcProvider('https://rpc.genx.minimal-gaia-x.eu')
const wallet = new Wallet(process.env.PRIVATE_KEY, provider)
Nautilus.setLogLevel(LogLevel.Verbose)
const customConfig = {
metadataCacheUri: 'https://aquarius510.v4.delta-dao.com'
}
const nautilus = await Nautilus.create(wallet, customConfig)
await nautilus.getAquariusAsset('did:op:86bb40c1d6702cf7131837c051282b984e68d59eed6526b01f2380f7f25c645f')
Creating new Nautilus instance with signer 0x...
[aquarius] Retrieve asset did:op:86bb40c1d6702cf7131837c051282b984e68d59eed6526b01f2380f7f25c645f using cache at https://aquarius510.v4.delta-dao.com
I hope this helps! If you still encounter the issue, please provide a code snippet that we can follow to reproduce the issue.
Hi @moritzkirstein , thank you for your answer and your solution. I reproduced exactly your code and it worked fine. But I still get the same error in my code. The error is then coming from me. See the code below.
I am using Express and node JS on windows.
You have to install node, express and typescript. This link setup node express and typescript is a good starting point if needed.
My code:
import { Request, Response } from "express";
import { providers, Wallet } from 'ethers'
import { AssetBuilder, Nautilus, LogLevel } from "@deltadao/nautilus";
// load config based on selected network
const networkConfig = {
chainId: 100,
network: 'genx',
metadataCacheUri: 'https://aquarius510.v4.delta-dao.com',
nodeUri: 'https://rpc.genx.minimal-gaia-x.eu',
providerUri: 'https://provider.v4.genx.delta-dao.com',
subgraphUri: 'https://subgraph.v4.genx.minimal-gaia-x.eu',
oceanTokenAddress: '0x0995527d3473b3a98c471f1ed8787acd77fbf009',
oceanTokenSymbol: 'OCEAN',
fixedRateExchangeAddress: '0xAD8E7d2aFf5F5ae7c2645a52110851914eE6664b',
dispenserAddress: '0x94cb8FC8719Ed09bE3D9c696d2037EA95ef68d3e',
nftFactoryAddress: '0x6cb85858183B82154921f68b434299EC4281da53',
providerAddress: '0x68C24FA5b2319C81b34f248d1f928601D2E5246B'
}
const provider = new providers.JsonRpcProvider(networkConfig.nodeUri)
const wallet = new Wallet(process.env.PRIVATE_KEY, provider)
Nautilus.setLogLevel(LogLevel.Verbose);
/**
* Update a dataset
* @param req
* @param res
* @returns
*/
export async function updateAccessDataset(req: Request, res: Response) {
const { datasetId } = req.params;
const { metadata } = req.body;
try {
const nautilus = await Nautilus.create(wallet, networkConfig);
// get the asset from aquarius
const aquariusAsset = await nautilus.getAquariusAsset('did:op:86bb40c1d6702cf7131837c051282b984e68d59eed6526b01f2380f7f25c645f');
const assetBuilder = new AssetBuilder(aquariusAsset);
// set new metadata
const asset = assetBuilder
.setName(metadata.name)
.setDescription(metadata.description)
.setAuthor(metadata.author)
.build();
const result = await nautilus.edit(asset);
if (result) {
res.status(200).json({ message: "Asset updated successfully" });
} else {
res.status(500).json({ message: "Problem occured" });
}
} catch (error) {
console.error(error);
res.status(500).json({ message: "Problem occured" });
}
}
I then expose a put route in express that takes req and res as parameters:
import express, { Request, Response, Router } from "express";
import { updateAccessDataset} from "../controller/update.controller";
indexRouter.put("/edit/dataset/:datasetId", async (req: Request, res: Response) => {
await updateAccessDataset(req, res);
});
!Note that I still give the did hard coded instead of as parameter. !You can and should change the structure of the files. I put the update function in a file called update.controller, under the folder controller. The route is in a file under the folder routes. You have to call the route in the app.ts or server.ts depending on your structure.
Thank you in advance.
Hello, I found my error earlier today. It seems a good Weekend can solve problems :smiley:.
When creating the nautilus instance, I didn't pass my network configuration along with the wallet.
Thank you for your help.
Thanks for letting us know!
Summary
The getAquariusAsset function failed when trying to fetch the Aquarius cache but seems to be using a different aquarius URI.
Current Behavior
In the logs I get:
Note that the cache showed in the logs is different from the one I provided in my configuration file. I think, somewhere in the code, this cache is used statically. The desired aquarius cache URI should be: https://aquarius510.v4.delta-dao.com.
Even when I make a simple get request of any dataset using the previous cache URI : https://aquarius.v4.delta-dao.com, I got 404 not found.
Environment