Skip to content

Commit

Permalink
Add createEscrowIntentWithSecret to handle signing of secret
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Apr 3, 2024
1 parent 95ae75c commit 4c36b17
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { AccountInstance } from '@xyo-network/account-model'
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
import { IdPayload } from '@xyo-network/id-payload-plugin'

import { EscrowTerms } from './Terms'

/**
* Creates an escrow intent
* @deprecated Use createEscrowIntentWithSecret instead
* @param terms The payloads describing the terms for the escrow
* @param account The account to create the escrow intent with
* @returns The escrow intent
Expand All @@ -13,3 +15,15 @@ export const createEscrowIntent = async (terms: EscrowTerms[], account: AccountI
const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build()
return result
}

/**
* Creates an escrow intent (for a buyer or seller) using the supplied secret
* @param terms The payload describing the terms for the escrow
* @param secret The secret for the escrow principal party to use for the escrow
* @param account The account to create the escrow intent with
* @returns The escrow intent
*/
export const createEscrowIntentWithSecret = async (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => {
const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build()
return result
}

0 comments on commit 4c36b17

Please sign in to comment.