Skip to content

Commit

Permalink
fix: switch removed
Browse files Browse the repository at this point in the history
  • Loading branch information
AdriGeorge committed Nov 13, 2024
1 parent 363baa0 commit e895f0e
Showing 1 changed file with 59 additions and 85 deletions.
144 changes: 59 additions & 85 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,44 +96,33 @@ export class Commands {
}
const encryptDDO = args[2] === "false" ? false : true;
let id: string
switch (asset.version) {
case DDOVersion.V4_1_0:
case DDOVersion.V4_3_0:
case DDOVersion.V4_5_0:
case DDOVersion.V4_7_0:
id = await createAssetV4(
asset.nft.name,
asset.nft.symbol,
this.signer,
asset.services[0].files,
asset,
this.providerUrl,
this.config,
this.aquarius,
1,
this.macOsProviderUrl,
encryptDDO
);
break;

case DDOVersion.V5_0_0:
id = await createAssetV5(
asset.nft.name,
asset.nft.symbol,
this.signer,
asset.credentialSubject.services[0].files,
asset,
this.providerUrl,
this.config,
this.aquarius,
this.macOsProviderUrl,
encryptDDO
);
break;

default:
console.error("Unsupported asset type or version");
return;
if (asset.version === DDOVersion.V5_0_0) {
id = await createAssetV5(
asset.nft.name,
asset.nft.symbol,
this.signer,
asset.credentialSubject.services[0].files,
asset,
this.providerUrl,
this.config,
this.aquarius,
this.macOsProviderUrl,
encryptDDO
);
} else {
id = await createAssetV4(
asset.nft.name,
asset.nft.symbol,
this.signer,
asset.services[0].files,
asset,
this.providerUrl,
this.config,
this.aquarius,
1,
this.macOsProviderUrl,
encryptDDO
);
}
console.log("Asset published. ID:", id);
}
Expand All @@ -149,39 +138,33 @@ export class Commands {
}
const encryptDDO = args[2] === "false" ? false : true;
let id
switch (algoAsset.version) {
case DDOVersion.V4_1_0:
case DDOVersion.V4_3_0:
case DDOVersion.V4_5_0:
case DDOVersion.V4_7_0:
id = await createAssetV4(
algoAsset.nft.name,
algoAsset.nft.symbol,
this.signer,
algoAsset.services[0].files,
algoAsset,
this.providerUrl,
this.config,
this.aquarius,
1,
this.macOsProviderUrl,
encryptDDO
);
break
case DDOVersion.V5_0_0:
id = await createAssetV5(
algoAsset.nft.name,
algoAsset.nft.symbol,
this.signer,
algoAsset.credentialSubject.services[0].files,
algoAsset,
this.providerUrl,
this.config,
this.aquarius,
this.macOsProviderUrl,
encryptDDO
);
break
if (algoAsset.version === DDOVersion.V5_0_0) {
id = await createAssetV5(
algoAsset.nft.name,
algoAsset.nft.symbol,
this.signer,
algoAsset.credentialSubject.services[0].files,
algoAsset,
this.providerUrl,
this.config,
this.aquarius,
this.macOsProviderUrl,
encryptDDO
);
} else {
id = await createAssetV4(
algoAsset.nft.name,
algoAsset.nft.symbol,
this.signer,
algoAsset.services[0].files,
algoAsset,
this.providerUrl,
this.config,
this.aquarius,
1,
this.macOsProviderUrl,
encryptDDO
);
}
console.log("Algorithm published. DID:", id);
}
Expand Down Expand Up @@ -246,20 +229,11 @@ export class Commands {
let serviceEndpoint: string
let serviceId: string
let did: string
switch (dataDdo.version) {
case DDOVersion.V4_1_0:
case DDOVersion.V4_3_0:
case DDOVersion.V4_5_0:
case DDOVersion.V4_7_0:
({ chainId, serviceEndpoint, serviceId, did } = getDataDownalodV4(dataDdo));
break;
case DDOVersion.V5_0_0:
({ chainId, serviceEndpoint, serviceId, did } = getDataDownalodV5(dataDdo));
break;

default:
console.error("Unsupported asset type or version");
return;

if (dataDdo.version === DDOVersion.V5_0_0) {
({ chainId, serviceEndpoint, serviceId, did } = getDataDownalodV5(dataDdo));
} else {
({ chainId, serviceEndpoint, serviceId, did } = getDataDownalodV4(dataDdo));
}

const providerURI =
Expand Down

0 comments on commit e895f0e

Please sign in to comment.