mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
consume flow
This commit is contained in:
parent
853b78e1d9
commit
4890d2f27b
@ -7,7 +7,7 @@ export const nodeHost = 'localhost'
|
|||||||
export const nodePort = 8545
|
export const nodePort = 8545
|
||||||
|
|
||||||
export const aquariusScheme = 'http'
|
export const aquariusScheme = 'http'
|
||||||
export const aquariusHost = 'localhost'
|
export const aquariusHost = 'aquarius'
|
||||||
export const aquariusPort = 5000
|
export const aquariusPort = 5000
|
||||||
|
|
||||||
export const brizoScheme = 'http'
|
export const brizoScheme = 'http'
|
||||||
|
@ -31,29 +31,9 @@ export default class Details extends Component<DetailsProps, DetailsState> {
|
|||||||
private purchaseAsset = async (ddo: any) => {
|
private purchaseAsset = async (ddo: any) => {
|
||||||
try {
|
try {
|
||||||
const account = await this.context.ocean.getAccounts()
|
const account = await this.context.ocean.getAccounts()
|
||||||
const service = ddo.findServiceByType('Access')
|
const accessService = ddo.findServiceByType('Access')
|
||||||
const serviceAgreementSignatureResult = await this.context.ocean.signServiceAgreement(
|
const agreementId = await this.context.ocean.assets.order(ddo.id, accessService.serviceDefinitionId, account[0])
|
||||||
ddo.id,
|
Logger.log('agreementId', agreementId)
|
||||||
service.serviceDefinitionId,
|
|
||||||
account[0]
|
|
||||||
)
|
|
||||||
await this.context.ocean.initializeServiceAgreement(
|
|
||||||
ddo.id,
|
|
||||||
service.serviceDefinitionId,
|
|
||||||
serviceAgreementSignatureResult.agreementId,
|
|
||||||
serviceAgreementSignatureResult.signature,
|
|
||||||
(files: any) => {
|
|
||||||
Logger.log('downloading files', files)
|
|
||||||
files.forEach((file: any) => {
|
|
||||||
const parsedUrl: any = queryString.parseUrl(file)
|
|
||||||
setTimeout(() => {
|
|
||||||
// eslint-disable-next-line
|
|
||||||
window.open(parsedUrl.query.url)
|
|
||||||
}, 100)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
account[0]
|
|
||||||
)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.log('error', e)
|
Logger.log('error', e)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user