From 1a54dda59c0e513ecd6e8ed0bac45fa32062f0fb Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 2 Sep 2021 19:49:21 +0200 Subject: [PATCH] more cleanup and typos --- src/utils/freePrice.ts | 5 +++-- src/utils/metadata.ts | 39 ++++++--------------------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/utils/freePrice.ts b/src/utils/freePrice.ts index 68e6de649..98645e4de 100644 --- a/src/utils/freePrice.ts +++ b/src/utils/freePrice.ts @@ -1,11 +1,12 @@ import { Logger, Ocean } from '@oceanprotocol/lib' +import { TransactionReceipt } from 'web3-core' export async function setMinterToPublisher( ocean: Ocean, dataTokenAddress: string, accountId: string, setError: (msg: string) => void -): Promise { +): Promise { // free pricing v3 workaround part1 const response = await ocean.OceanDispenser.cancelMinter( dataTokenAddress, @@ -23,7 +24,7 @@ export async function setMinterToDispenser( dataTokenAddress: string, accountId: string, setError: (msg: string) => void -): Promise { +): Promise { // free pricing v3 workaround part2 const response = await ocean.OceanDispenser.makeMinter( dataTokenAddress, diff --git a/src/utils/metadata.ts b/src/utils/metadata.ts index 7e4578b8b..0a8ebada4 100644 --- a/src/utils/metadata.ts +++ b/src/utils/metadata.ts @@ -76,7 +76,7 @@ export function checkIfTimeoutInPredefinedValues( return false } -function getAlgoithComponent( +function getAlgorithmComponent( image: string, containerTag: string, entrypoint: string, @@ -94,7 +94,7 @@ function getAlgoithComponent( } } -function getAlgoithFileExtension(fileUrl: string): string { +function getAlgorithmFileExtension(fileUrl: string): string { const splitedFileUrl = fileUrl.split('.') return splitedFileUrl[splitedFileUrl.length - 1] } @@ -203,7 +203,6 @@ export function transformPublishAlgorithmFormToMetadata( author, description, tags, - dockerImage, image, containerTag, entrypoint, @@ -214,12 +213,12 @@ export function transformPublishAlgorithmFormToMetadata( ): MetadataMarket { const currentTime = toStringNoMS(new Date()) const fileUrl = typeof files !== 'string' && files[0].url - const algorithmLanguace = getAlgoithFileExtension(fileUrl) - const algorithm = getAlgoithComponent( + const algorithmLanguage = getAlgorithmFileExtension(fileUrl) + const algorithm = getAlgorithmComponent( image, containerTag, entrypoint, - algorithmLanguace + algorithmLanguage ) const metadata: MetadataMarket = { main: { @@ -230,7 +229,7 @@ export function transformPublishAlgorithmFormToMetadata( dateCreated: ddo ? ddo.created : currentTime, files: typeof files !== 'string' && files, license: 'https://market.oceanprotocol.com/terms', - algorithm: algorithm + algorithm }, additionalInformation: { ...AssetModel.additionalInformation, @@ -242,29 +241,3 @@ export function transformPublishAlgorithmFormToMetadata( return metadata } - -function idToName(id: number): string { - switch (id) { - case 1: - return 'eth' - case 137: - return 'polygon' - case 3: - return 'ropsten' - case 4: - return 'rinkeby' - case 1287: - return 'moonbase' - default: - return 'eth' - } -} - -export function mapChainIdsToNetworkNames(chainIds: number[]): string[] { - const networkNames: string[] = [] - for (let i = 0; i < chainIds.length; i++) { - const networkName = idToName(chainIds[i]) - networkNames.push(networkName) - } - return networkNames -}