1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

merge fixes

This commit is contained in:
Matthias Kretschmann 2020-01-23 10:33:02 +01:00
parent e31aa81dcc
commit c8ea5f77c2
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 14 additions and 2 deletions

View File

@ -292,7 +292,7 @@ export class OceanAssets extends Instantiable {
public order( public order(
did: string, did: string,
index: number, index: number,
consumerAccount: Account consumerAccount: Account,
provider?: string provider?: string
): SubscribablePromise<OrderProgressStep, string> { ): SubscribablePromise<OrderProgressStep, string> {
return new SubscribablePromise(async observer => { return new SubscribablePromise(async observer => {

View File

@ -44,7 +44,8 @@ export class OceanCompute extends Instantiable {
*/ */
public order( public order(
consumerAccount: Account, consumerAccount: Account,
datasetDid: string datasetDid: string,
provider?: string
): SubscribablePromise<OrderProgressStep, string> { ): SubscribablePromise<OrderProgressStep, string> {
return new SubscribablePromise(async observer => { return new SubscribablePromise(async observer => {
const { keeper, assets, agreements } = this.ocean const { keeper, assets, agreements } = this.ocean
@ -95,12 +96,23 @@ export class OceanCompute extends Instantiable {
observer.next(OrderProgressStep.CreatingAgreement) observer.next(OrderProgressStep.CreatingAgreement)
this.logger.log('Creating agreement') this.logger.log('Creating agreement')
// Get provider from didRegistry if not given in arguments
let _provider = provider
if (!provider) {
const providers = await keeper.didRegistry.getDIDProviders(ddo.shortId())
if (providers) {
_provider = providers[0]
}
}
await agreements.create( await agreements.create(
datasetDid, datasetDid,
agreementId, agreementId,
index, index,
undefined, undefined,
consumerAccount, consumerAccount,
_provider,
consumerAccount consumerAccount
) )
this.logger.log('Agreement created') this.logger.log('Agreement created')