-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
I am building a data service using @deltadao/nautilus and ethers.js (v5.8.0) in an AdonisJS environment. I am trying to publish a Data Asset on the Pontus-X Testnet (Chain ID 32457).
Since this network is not part of the default ocean.js ConfigHelper, I am passing a manualConfig object to the Nautilus.create() method.
The Issue
During the execution, the console logs: No config found for given network '32457'.
Immediately after, when calling nautilus.publish(asset), the process crashes with the following error from Ethers: Error: invalid address or ENS name (argument="name", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.8.0)
It appears that even though the configuration is provided, the internal Ocean logic is not mapping the contract addresses correctly, passing undefined to the contract factories.
Full Implementation Context
JavaScript
import { inject } from '@adonisjs/core'
import env from '#start/env'
import User from '#models/user'
import DataAsset from '#models/data_asset'
import DataSpaceService from '#services/data_space_service'
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
@inject()
export default class DataAssetService {
constructor(protected data_space_service: DataSpaceService) {}
public async publish_asset(
user_uuid: string,
user_encrypted_key: string,
payload: { title: string; description: string; category: string; price_eurau: string; file_url: string }
) {
const { Nautilus, AssetBuilder, ServiceBuilder, ServiceTypes, FileTypes } = require('@deltadao/nautilus')
const ethers = require('ethers')
const user = await User.findByOrFail('uuid', user_uuid)
const RPC_URL = 'https://rpc.test.pontus-x.eu'
const provider = new ethers.providers.JsonRpcProvider(RPC_URL)
// Wallet initialization from a custom service
const user_wallet = await this.data_space_service.getWallet(user_encrypted_key)
const walletWithProvider = user_wallet.connect(provider)
/**
* CUSTOM CONFIGURATION
* Based on Ocean.js ConfigHelper schema and Pontus-X Portal requirements
*/
const manualConfig = {
chainId: 32457,
network: 'pontusx',
metadataCacheUri: 'https://aquarius.pontus-x.eu',
nodeUri: RPC_URL,
providerUri: 'https://provider.test.pontus-x.eu',
subgraphUri: 'https://subgraph.test.pontus-x.eu',
explorerUri: 'https://explorer.pontus-x.eu/pontusx/test',
// Contract addresses as per Pontus-X documentation
nftFactoryAddress: '0x2C4d542ff791890D9290Eec89C9348A4891A6Fd2'.toLowerCase(),
oceanTokenAddress: '0x5B190F9E2E721f8c811E4d584383E3d57b865C69'.toLowerCase(),
fixedRateExchangeAddress: '0xcE0F39abB6DA2aE4d072DA78FA0A711cBB62764E'.toLowerCase(),
dispenserAddress: '0xaB5B68F88Bc881CAA427007559E9bbF8818026dE'.toLowerCase(),
// Web3 / Transaction parameters
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 1,
transactionPollingTimeout: 750,
gasFeeMultiplier: 1.1,
// Aliases to satisfy internal Ocean.js mappings
erc721FactoryAddress: '0x2C4d542ff791890D9290Eec89C9348A4891A6Fd2'.toLowerCase(),
opfCommunityFeeCollector: '0xACC8d1B2a0007951fb4ed622ACB1C4fcCAbe778D'.toLowerCase()
}
console.log('π Initializing Nautilus with Custom Config...')
const nautilus = await Nautilus.create(walletWithProvider, manualConfig)
// Building the service
const service = new ServiceBuilder({
serviceType: ServiceTypes.ACCESS,
fileType: FileTypes.URL,
})
.setServiceEndpoint(manualConfig.providerUri)
.addFile({ type: 'url', url: payload.file_url, method: 'GET' })
.setPricing({
type: 'fixed',
price: payload.price_eurau,
tokenAddress: manualConfig.oceanTokenAddress,
})
.build()
const asset = new AssetBuilder()
.setType('dataset')
.setName(payload.title)
.setDescription(payload.description)
.addService(service)
.build()
try {
// THE ERROR HAPPENS HERE
const result = await nautilus.publish(asset)
return result
} catch (error: any) {
console.error('[CRITICAL ERROR]:', error)
throw error
}
}
}
Environment
Node.js: v20+
Framework: AdonisJS v6
Library: @deltadao/nautilus
Network: Pontus-X Testnet (EVM compatible)
Question
How can I correctly inject the network configuration so that Nautilus (or the underlying ocean.js instance) recognizes the contract addresses for a non-default Chain ID? Is there a specific property I am missing for the ServiceBuilder or AssetBuilder to correctly resolve the factory addresses?