-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use createAsset function from SDK. #73
base: main
Are you sure you want to change the base?
Conversation
|
||
// Create Allow List | ||
allowListAddress = await accessListFactory.deployAccessListContract( | ||
await accessListFactoryObj.deployAccessListContract( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure about these params?
config.accessListFactory
allowAccessList
denyAccessList
if they do not match probably there will be errors at smart contract level (not sure if console.log will help if the issue is on those)
btw, there is a function to deploy the access list on the SDK as well
export async function createAccessListFactory(
we could probably just use that one instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I double-checked, I put them in place to match createAsset from ocean.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its not about the order of the params:
accessListFactoryObj
, allowAccessList
and denyAccessList
should be contract addresses (strings)
Here, you're creating a new access list factory and a new access list deployed from that factory
// Create Access List Factory
const accessListFactoryObj = new AccesslistFactory(config.accessListFactory, wrappedSigner, chainId);
// Create Allow List
await accessListFactoryObj.deployAccessListContract(
'AllowList',
'ALLOW',
['https://oceanprotocol.com/nft/'],
false,
await owner.getAddress(),
[await owner.getAddress(), ZERO_ADDRESS]
)
return await createAsset(name, symbol, wrappedSigner, assetUrl, templateIndex, ddo, encryptDDO, providerUrl || macOsProviderUrl, providerFeeToken, aquariusInstance, accessListFactory, allowAccessList, denyAccessList)
But you're calling the function with other values, the factory addresses and the allow access list addresses do not match (you're creating new ones and passing something else)
In fact this code is not doing anything.. you can probably delete most of it
cause you're passing the values received on the function (which are not defined btw)
src/helpers.ts
Outdated
const nftFactory = new NftFactory(config.nftFactoryAddress, owner); | ||
|
||
let wrappedSigner | ||
let allowListAddress | ||
if(templateIndex === 4){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be the template id or the template address...
template index is something else (and must be calculated on SDK side)
might work, but is not exactly the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name is misleading, it should be template id, correct, I'll update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this still needs to be updated
btw, just published an asset on ganache from this branch... all good on my side
|
@mariacarmina Check the chain id on the tests. better also use a try/catch on the caller side... so we know whats happening (as we throw errors) |
Hello @paulo-ocean, if you tested on barge, the chain id from simpleComputeDataset.json is set correctly, maybe the issue was on simpleDownloadDataset.json which is the mumbai chain id, I updated in the code the chain id to see if the tests pass. |
I've seen that within the commands and publish.ts file there are try/catch blocks and they print the errors when they are raised, one spot was missing when publishing the algo, I've added right now, is there any other place that you were referring to? |
The test are still failing can you share how did you receive the chain id error? the tests from CI indicate another type of error. |
@paulo-ocean I have updated the chain ids, now it helped to advance the tests suite, PR to fix the check on ocean.js is merged, I think we need to do a minor release for ocean.js. Thank you! |
Yes, the wrong one was |
We don't get any errors when we code like "throw new Error()" and don't use try/catch :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm still not sure this is enough..
the template id = 4 could be used on any other network..
if(templateId === 4){
// Wrap the signer for Sapphire
const wrappedSigner = sapphire.wrap(owner);
We're assuming that every time we have template 4 is sapphire network wich might not always be true (i have no idea of what happens if we wrap the signer for any other network using sapphire SDK)
Right, we also need to check the sdk part, I'm fixing it right now. |
this.config, | ||
this.aquarius, | ||
encryptDDO | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still not OK, we are not able to properly publish to oasis shappire for instance (it publishes but with wrong template and we will not be able to download the asset)...
as we're always assuming template 1, as we don't pass template id or template address
@@ -44,13 +44,7 @@ export async function publishAsset(params: PublishAssetParams, signer: Signer, c | |||
license: 'MIT', | |||
tags: params.tags | |||
}, | |||
stats: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we turned back the Asset
into a DDO
, removing the stats..
but by removing this lines:
price: {
value: params.isCharged ? params.price : "0"
}
we now have a FixedPrice datatoken instead of Dispenser one
We totally changed the behavior of the previous function
Before it was doing:
bundleNFT = await nftFactory.createNftWithDatatokenWithDispenser(
Now it does always
bundleNFT = await nftFactory.createNftWithDatatokenWithFixedRate(
These changes + the default template of 1 ... breaks download of the asset (on SDK OrderUtils) at least for oasis shappire
you can check the previous version of createAsset
here:
Line 70 in ce5ea7f
export async function createAsset( |
and then compare with the SDK one:
https://github.com/oceanprotocol/ocean.js/blob/4437713b2243a87ae1a01730196abc27c872ac24/src/utils/Assets.ts#L46
To make sure we're passing all the relevant/needed parameters
specially the
templateIDorAddress
and the stats
fields are very important
Fixes # .
Changes proposed in this PR: