mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Expose the granted agreementIds for a consumer.
This commit is contained in:
parent
7f0d50691c
commit
90fbc0b1d6
@ -20,9 +20,11 @@ export class AccessSecretStoreCondition extends Condition {
|
|||||||
return this.call<boolean>("checkPermissions", [grantee, didZeroX(did)].map(zeroX), from)
|
return this.call<boolean>("checkPermissions", [grantee, didZeroX(did)].map(zeroX), from)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getGrantedDidByConsumer(consumer: string): Promise<string[]> {
|
public async getGrantedDidByConsumer(consumer: string): Promise<{did: string, agreementId: string}[]> {
|
||||||
return (await this.getPastEvents("Fulfilled", {_grantee: zeroX(consumer)}))
|
return (await this.getPastEvents("Fulfilled", {_grantee: zeroX(consumer)}))
|
||||||
.map(({returnValues}) => returnValues._documentId)
|
.map(({returnValues}) => ({
|
||||||
.map(didPrefixed)
|
did: didPrefixed(returnValues._documentId),
|
||||||
|
agreementId: zeroX(returnValues._agreementId),
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,8 @@ export class OceanAssets extends Instantiable {
|
|||||||
* @return {Promise<string[]>} List of DIDs.
|
* @return {Promise<string[]>} List of DIDs.
|
||||||
*/
|
*/
|
||||||
public async consumerAssets(consumer: string) {
|
public async consumerAssets(consumer: string) {
|
||||||
return this.ocean.keeper.conditions.accessSecretStoreCondition.getGrantedDidByConsumer(consumer)
|
return (await this.ocean.keeper.conditions.accessSecretStoreCondition.getGrantedDidByConsumer(consumer))
|
||||||
|
.map(({did}) => did)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user