mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
More updates.
This commit is contained in:
parent
c6876ca9e2
commit
e22b63cc80
@ -30,10 +30,11 @@ export class TemplateStoreManager extends ContractBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public generateId(templateName: string) {
|
public generateId(templateName: string) {
|
||||||
return this.call(
|
const args: any = [
|
||||||
"generateId",
|
{ type: 'string', value: templateName },
|
||||||
[templateName]
|
]
|
||||||
)
|
|
||||||
|
return this.web3.utils.soliditySha3(...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
public getOwner(): Promise<string> {
|
public getOwner(): Promise<string> {
|
||||||
@ -83,6 +84,14 @@ export class TemplateStoreManager extends ContractBase {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getActorTypeValue(actorTypeId: string) {
|
||||||
|
const typeValue = await this.call(
|
||||||
|
"getTemplateActorTypeValue",
|
||||||
|
[actorTypeId]
|
||||||
|
)
|
||||||
|
return typeValue
|
||||||
|
}
|
||||||
|
|
||||||
public async getTemplate(templateId: string) {
|
public async getTemplate(templateId: string) {
|
||||||
const {
|
const {
|
||||||
state,
|
state,
|
||||||
|
@ -87,7 +87,7 @@ export class AgreementTemplateBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getId() {
|
public getId() {
|
||||||
return ''
|
return this.templateManager.generateId(this.templateName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,8 +143,8 @@ export class AgreementTemplateBase {
|
|||||||
* Conditions address list.
|
* Conditions address list.
|
||||||
* @return {Promise<string[]>} Conditions address.
|
* @return {Promise<string[]>} Conditions address.
|
||||||
*/
|
*/
|
||||||
public getConditionTypes(): Promise<string[]> {
|
public async getConditionTypes(): Promise<string[]> {
|
||||||
return this.templateManager.getConditionTypes(this.getId())
|
return await this.templateManager.getConditionTypes(this.getId())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,4 +276,21 @@ export class AgreementTemplateBase {
|
|||||||
return this.agreementStoreManager.getAgreementCreatedEvent(agreementId)
|
return this.agreementStoreManager.getAgreementCreatedEvent(agreementId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return actor type ids for this template (specified by subclass)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public async getActorTypeIds() {
|
||||||
|
const { actorTypeIds } = await this.templateManager.getTemplate(this.getId())
|
||||||
|
return actorTypeIds
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return actor types (strings) for this template (specified by subclass)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public async getActorTypes() {
|
||||||
|
const actorTypeIds = await this.getActorTypeIds()
|
||||||
|
return actorTypeIds.map(typeId => this.templateManager.getActorTypeValue(typeId))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,8 @@ export class OceanAssets extends Instantiable {
|
|||||||
/**
|
/**
|
||||||
* Creates a new DDO.
|
* Creates a new DDO.
|
||||||
* @param {MetaData} metadata DDO metadata.
|
* @param {MetaData} metadata DDO metadata.
|
||||||
* @param {Account} publisher Publisher account.
|
* @param {Account} publisher Publisher account.
|
||||||
|
* @param {list} services list of Service description documents
|
||||||
* @return {Promise<DDO>}
|
* @return {Promise<DDO>}
|
||||||
*/
|
*/
|
||||||
public create(
|
public create(
|
||||||
@ -106,7 +107,7 @@ export class OceanAssets extends Instantiable {
|
|||||||
{
|
{
|
||||||
type: 'access',
|
type: 'access',
|
||||||
serviceEndpoint: this.ocean.brizo.getConsumeEndpoint(),
|
serviceEndpoint: this.ocean.brizo.getConsumeEndpoint(),
|
||||||
templateId: templates.escrowAccessSecretStoreTemplate.getAddress(),
|
templateId: templates.escrowAccessSecretStoreTemplate.getId(),
|
||||||
attributes: {
|
attributes: {
|
||||||
main: {
|
main: {
|
||||||
creator: publisher.getId(),
|
creator: publisher.getId(),
|
||||||
|
Loading…
Reference in New Issue
Block a user