import { AgreementTemplateBase } from './AgreementTemplateBase' import { escrowAccessServiceAgreementTemplate } from './EscrowAccess.serviceAgreementTemplate' export class EscrowAccessSecretStoreTemplate extends AgreementTemplateBase { public static templateName: 'EscrowAccessSecretStoreTemplate' public async getServiceAgreementTemplate() { return escrowAccessServiceAgreementTemplate } protected async createFullAgreementData( agreementId: string, did: string, amount: number | string, consumer: string ) { const { lockRewardCondition, accessSecretStoreCondition, escrowReward } = this.conditions const publisher = await this.didRegistry.getDIDOwner(did) const lockRewardConditionId = await lockRewardCondition.generateIdHash( agreementId, await escrowReward.getAddress(), amount ) const accessSecretStoreConditionId = await accessSecretStoreCondition.generateIdHash( agreementId, did, consumer ) const escrowRewardId = await escrowReward.generateIdHash( agreementId, String(amount), publisher, consumer, lockRewardConditionId, accessSecretStoreConditionId ) return [ lockRewardConditionId, accessSecretStoreConditionId, escrowRewardId ] } }