Skip to content

Commit 16e194c

Browse files
committed
fix: update DDO handling for version compatibility in asset creation
1 parent 9e9435b commit 16e194c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/commands.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ export class Commands {
8181
const encryptDDO = args[2] === "false" ? false : true;
8282
try {
8383
const ddoInstance = DDOManager.getDDOClass(asset);
84+
const { version, services } = ddoInstance.getDDOFields();
8485
const { indexedMetadata } = ddoInstance.getAssetFields();
85-
const { services } = ddoInstance.getDDOFields();
86+
const isV5 = version >= "5.0.0";
8687
// add some more checks
8788
const urlAssetId = await createAssetUtil(
88-
indexedMetadata.nft.name,
89-
indexedMetadata.nft.symbol,
89+
isV5 ? indexedMetadata.nft.name : asset.indexedMetadata.nft.name,
90+
isV5 ? indexedMetadata.nft.symbol : asset.indexedMetadata.nft.symbol,
9091
this.signer,
91-
services[0].files,
92+
isV5 ? services[0].files : asset.services[0].files,
9293
asset,
9394
this.oceanNodeUrl,
9495
this.config,
@@ -116,13 +117,14 @@ export class Commands {
116117
// add some more checks
117118
try {
118119
const ddoInstance = DDOManager.getDDOClass(algoAsset);
120+
const { version, services } = ddoInstance.getDDOFields();
119121
const { indexedMetadata } = ddoInstance.getAssetFields();
120-
const { services } = ddoInstance.getDDOFields();
122+
const isV5 = version >= "5.0.0";
121123
const algoDid = await createAssetUtil(
122-
indexedMetadata.nft.name,
123-
indexedMetadata.nft.symbol,
124+
isV5 ? indexedMetadata.nft.name : algoAsset.indexedMetadata.nft.name,
125+
isV5 ? indexedMetadata.nft.symbol : algoAsset.indexedMetadata.nft.symbol,
124126
this.signer,
125-
services[0].files,
127+
isV5 ? services[0].files : algoAsset.services[0].files,
126128
algoAsset,
127129
this.oceanNodeUrl,
128130
this.config,

0 commit comments

Comments
 (0)