1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

more logging within createTokensAndPricing

This commit is contained in:
Matthias Kretschmann 2022-01-12 19:05:15 +00:00
parent 5d40121adc
commit 25920b7763
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 30 additions and 6 deletions

View File

@ -11,7 +11,6 @@ export async function getEncryptedFiles(
): Promise<string> {
try {
// https://github.com/oceanprotocol/provider/blob/v4main/API.md#encrypt-endpoint
console.log('start encr')
const response = await ProviderInstance.encrypt(
files,
providerUrl,
@ -23,7 +22,6 @@ export async function getEncryptedFiles(
})
}
)
console.log('encr eres', response)
return response.data
} catch (error) {
console.error('Error parsing json: ' + error.message)

View File

@ -197,7 +197,7 @@ export async function createTokensAndPricing(
values.metadata.nft
)
LoggerInstance.log('[publish] NFT metadata', nftCreateData)
LoggerInstance.log('[publish] Creating NFT with metadata', nftCreateData)
// TODO: cap is hardcoded for now to 1000, this needs to be discussed at some point
// fee is default 0 for now
@ -214,6 +214,8 @@ export async function createTokensAndPricing(
symbol: values.services[0].dataTokenOptions.symbol
}
LoggerInstance.log('[publish] Creating datatoken with ercParams', ercParams)
let erc721Address, datatokenAddress, txHash
// TODO: cleaner code for this huge switch !??!?
@ -237,16 +239,23 @@ export async function createTokensAndPricing(
swapFeeLiquidityProvider: 1e15,
swapFeeMarketRunner: 1e15
}
LoggerInstance.log(
'[publish] Creating dynamic pricing with poolParams',
poolParams
)
// the spender in this case is the erc721Factory because we are delegating
const pool = new Pool(web3, LoggerInstance)
const txApp = await pool.approve(
const txApprove = await pool.approve(
accountId,
config.oceanTokenAddress,
config.erc721FactoryAddress,
'200',
false
)
LoggerInstance.log('[publish] approve', txApp)
LoggerInstance.log('[publish] pool.approve tx', txApprove)
const result = await nftFactory.createNftErcWithPool(
accountId,
nftCreateData,
@ -257,6 +266,8 @@ export async function createTokensAndPricing(
erc721Address = result.events.NFTCreated.returnValues[0]
datatokenAddress = result.events.TokenCreated.returnValues[0]
txHash = result.transactionHash
LoggerInstance.log('[publish] createNftErcWithPool tx', txHash)
break
}
case 'fixed': {
@ -272,6 +283,11 @@ export async function createTokensAndPricing(
withMint: true
}
LoggerInstance.log(
'[publish] Creating fixed pricing with freParams',
freParams
)
const result = await nftFactory.createNftErcWithFixedRate(
accountId,
nftCreateData,
@ -283,6 +299,8 @@ export async function createTokensAndPricing(
datatokenAddress = result.events.TokenCreated.returnValues[0]
txHash = result.transactionHash
LoggerInstance.log('[publish] createNftErcWithFixedRate tx', txHash)
break
}
case 'free': {
@ -296,6 +314,12 @@ export async function createTokensAndPricing(
withMint: true,
allowedSwapper: ZERO_ADDRESS
}
LoggerInstance.log(
'[publish] Creating free pricing with dispenserParams',
dispenserParams
)
const result = await nftFactory.createNftErcWithDispenser(
accountId,
nftCreateData,
@ -306,6 +330,8 @@ export async function createTokensAndPricing(
datatokenAddress = result.events.TokenCreated.returnValues[0]
txHash = result.transactionHash
LoggerInstance.log('[publish] createNftErcWithDispenser tx', txHash)
break
}
}

View File

@ -133,7 +133,7 @@ export default function PublishPage({
)
_ddo = ddo
LoggerInstance.log('[publish] Got new DDO', JSON.stringify(ddo))
LoggerInstance.log('[publish] Got new DDO', ddo)
const encryptedResponse = await ProviderInstance.encrypt(
ddo,