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

View File

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

View File

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