Reversible Release (Escrow)
The ReversibleRelease module enables sending payment that are held in escrow.
To create an escrow, set the moduleName property of the module object to "reversibleRelease" and provide the inspector property. The inspector is the party in charge of releasing or reversing the payment. If no inspector is provided, the payer is set as the inspector.
import Denota from '@denota-labs/denota-sdk';
async function createNota() {
const { txHash, notaId } = await Denota.write({
amount: 1,
currency: "DAI",
metadata: { type: "raw", notes: "Example invoice" },
module: {
moduleName: "reversibleRelease",
type: "invoice",
inspector: "0x...",
creditor: "0x...",
debitor: "0x...",
},
});
}
createNota();
The properties of the
ReversibleReleaseData
module object are as follows:moduleName
: Set to "reversibleRelease" for the Reversible Release module.type
: Set to "invoice" for creating an invoice or "payment" for sending a payment.creditor
: The Ethereum address of the creditor or the recipient of the payment.debitor
: The Ethereum address of the debitor or the payer of the payment.inspector
(optional): The Ethereum address of the inspector, who is responsible for approving or rejecting the release of the payment.notes
(optional): Any additional notes or comments regarding the payment or invoice.file
(optional): AFile
object containing any relevant documentation, like a statement of work, contract, or invoice.ipfsHash
(optional): The IPFS hash of any additional documentation, like a statement of work or contract, that has been uploaded to IPFS.imageHash
(optional): The IPFS hash of an image representing the payment or invoice, which can be used for display purposes.
To release or reverse a payment, the inspector uses the cash function
async function releaseNota() {
const receipt = await Denota.cash({ notaId: "0", type: "release" });
}
async function reverseNota() {
const receipt = await Denota.cash({ notaId: "0", type: "reversal" });
}
Last modified 1h ago