mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
fix: downalod
This commit is contained in:
parent
c650cfb3b2
commit
0fbc536d89
@ -52,7 +52,9 @@ export async function orderAsset(
|
|||||||
let datatokenAddress: string
|
let datatokenAddress: string
|
||||||
let serviceId: string
|
let serviceId: string
|
||||||
let dataTokenAddressFirstIndex: string
|
let dataTokenAddressFirstIndex: string
|
||||||
|
let did: string
|
||||||
if (isVerifiableCredential(asset)) {
|
if (isVerifiableCredential(asset)) {
|
||||||
|
did = (asset as any).credentialSubject.id
|
||||||
consumeMarketFeeToken =
|
consumeMarketFeeToken =
|
||||||
(asset as any).credentialSubject.stats.price.tokenAddress ||
|
(asset as any).credentialSubject.stats.price.tokenAddress ||
|
||||||
'0x0000000000000000000000000000000000000000'
|
'0x0000000000000000000000000000000000000000'
|
||||||
@ -60,6 +62,7 @@ export async function orderAsset(
|
|||||||
dataTokenAddressFirstIndex = (asset as any).credentialSubject.datatokens[0].address
|
dataTokenAddressFirstIndex = (asset as any).credentialSubject.datatokens[0].address
|
||||||
serviceId = (asset as any).credentialSubject.services[serviceIndex].id
|
serviceId = (asset as any).credentialSubject.services[serviceIndex].id
|
||||||
} else {
|
} else {
|
||||||
|
did = asset.id
|
||||||
consumeMarketFeeToken =
|
consumeMarketFeeToken =
|
||||||
asset.stats.price.tokenAddress || '0x0000000000000000000000000000000000000000'
|
asset.stats.price.tokenAddress || '0x0000000000000000000000000000000000000000'
|
||||||
datatokenAddress = asset.datatokens[datatokenIndex].address
|
datatokenAddress = asset.datatokens[datatokenIndex].address
|
||||||
@ -75,12 +78,12 @@ export async function orderAsset(
|
|||||||
|
|
||||||
if (!datatokenAddress)
|
if (!datatokenAddress)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The datatoken with index: ${datatokenIndex} does not exist for the asset with did: ${asset.id}`
|
`The datatoken with index: ${datatokenIndex} does not exist for the asset with did: ${did}`
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!serviceId)
|
if (!serviceId)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`There is no service with index: ${serviceIndex} defined for the asset with did: ${asset.id}`
|
`There is no service with index: ${serviceIndex} defined for the asset with did: ${did}`
|
||||||
)
|
)
|
||||||
|
|
||||||
const templateIndex = await datatoken.getId(datatokenAddress)
|
const templateIndex = await datatoken.getId(datatokenAddress)
|
||||||
@ -94,7 +97,7 @@ export async function orderAsset(
|
|||||||
providerFees ||
|
providerFees ||
|
||||||
(
|
(
|
||||||
await ProviderInstance.initialize(
|
await ProviderInstance.initialize(
|
||||||
asset.id,
|
did,
|
||||||
serviceId,
|
serviceId,
|
||||||
0,
|
0,
|
||||||
await consumerAccount.getAddress(),
|
await consumerAccount.getAddress(),
|
||||||
@ -163,7 +166,7 @@ export async function orderAsset(
|
|||||||
|
|
||||||
if (!fixedRates[fixedRateIndex].id)
|
if (!fixedRates[fixedRateIndex].id)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`There is no fixed rate exchange with index: ${serviceIndex} for the asset with did: ${asset.id}`
|
`There is no fixed rate exchange with index: ${serviceIndex} for the asset with did: ${did}`
|
||||||
)
|
)
|
||||||
const fees = await fre.getFeesInfo(fixedRates[fixedRateIndex].id)
|
const fees = await fre.getFeesInfo(fixedRates[fixedRateIndex].id)
|
||||||
const exchange = await fre.getExchange(fixedRates[fixedRateIndex].id)
|
const exchange = await fre.getExchange(fixedRates[fixedRateIndex].id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user