mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-15 01:55:48 +00:00
37 lines
1.5 KiB
Plaintext
37 lines
1.5 KiB
Plaintext
## prepareEscrowCreation
|
|
|
|
`prepareEscrowCreation(address: string, escrowCreation: object, instructions: object): Promise<object>`
|
|
|
|
Prepare an escrow creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
|
|
|
### Parameters
|
|
|
|
<%- renderSchema('input/prepare-escrow-creation.json') %>
|
|
|
|
This is a convenience method for generating the EscrowCreate JSON used by rippled, so the same restrictions apply.
|
|
|
|
Field mapping: `allowCancelAfter` is equivalent to rippled's `CancelAfter`; `allowExecuteAfter` is equivalent to `FinishAfter`. At the `allowCancelAfter` time, the escrow is considered expired. This means that the funds can only be returned to the sender. At the `allowExecuteAfter` time, the escrow is permitted to be released to the recipient (if the `condition` is fulfilled).
|
|
|
|
Note that `allowCancelAfter` must be chronologically later than `allowExecuteAfter`.
|
|
|
|
### Return Value
|
|
|
|
This method returns a promise that resolves with an object with the following structure:
|
|
|
|
<aside class="notice">
|
|
All "prepare*" methods have the same return type.
|
|
</aside>
|
|
|
|
<%- renderSchema('output/prepare.json') %>
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
|
const escrowCreation = <%- importFile('test/fixtures/requests/prepare-escrow-creation.json') %>;
|
|
return api.prepareEscrowCreation(address, escrowCreation).then(prepared =>
|
|
{/* ... */});
|
|
```
|
|
|
|
<%- renderFixture('responses/prepare-escrow-creation.json') %>
|