1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-16 02:04:54 +01:00

more cleanup and typos

This commit is contained in:
Matthias Kretschmann 2021-09-02 19:49:21 +02:00
parent fe065aea58
commit 1a54dda59c
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 9 additions and 35 deletions

View File

@ -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<any> {
): Promise<TransactionReceipt> {
// 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<any> {
): Promise<TransactionReceipt> {
// free pricing v3 workaround part2
const response = await ocean.OceanDispenser.makeMinter(
dataTokenAddress,

View File

@ -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
}