mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
fix(refactor): rename prepareTicket to prepareTicketCreate (https://github.com/ripple/ripple-lib/pull/1324#discussion_r519027049)
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
- [prepareCheckCreate](#preparecheckcreate)
|
||||
- [prepareCheckCancel](#preparecheckcancel)
|
||||
- [prepareCheckCash](#preparecheckcash)
|
||||
- [prepareTicket](#prepareticket)
|
||||
- [prepareTicketCreate](#prepareticketcreate)
|
||||
- [sign](#sign)
|
||||
- [combine](#combine)
|
||||
- [submit](#submit)
|
||||
@@ -338,7 +338,7 @@ Executing a transaction with `RippleAPI` requires the following four steps:
|
||||
* [prepareCheckCreate](#preparecheckcreate)
|
||||
* [prepareCheckCancel](#preparecheckcancel)
|
||||
* [prepareCheckCash](#preparecheckcash)
|
||||
* [prepareTicket](#prepareticket)
|
||||
* [prepareTicketCreate](#prepareticketcreate)
|
||||
2. [Sign](#sign) - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place. For multisignature transactions, the `signedTransaction` fields returned by `sign` must be collected and passed to the [combine](#combine) method.
|
||||
3. [Submit](#submit) - Submit the transaction to the connected server.
|
||||
4. Verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted.
|
||||
@@ -5461,9 +5461,9 @@ return api.prepareCheckCash(address, checkCash).then(prepared =>
|
||||
```
|
||||
|
||||
|
||||
## prepareTicket
|
||||
## prepareTicketCreate
|
||||
|
||||
`prepareTicket(address: string, ticketCount: number, instructions: object): Promise<object>`
|
||||
`prepareTicketCreate(address: string, ticketCount: number, instructions: object): Promise<object>`
|
||||
|
||||
Prepare a ticket transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
@@ -5497,7 +5497,7 @@ instructions | object | The instructions for how to execute the transaction afte
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
return api.prepareTicket(address, 2).then(prepared => {
|
||||
return api.prepareTicketCreate(address, 2).then(prepared => {
|
||||
/* ... */
|
||||
}).catch(error => {
|
||||
/* ... as with all prepare* methods, use a Promise catch block to handle errors ... */
|
||||
|
||||
@@ -22,7 +22,7 @@ function fail(message) {
|
||||
|
||||
api.connect().then(() => {
|
||||
console.log('Connected...');
|
||||
return api.prepareTicket(address, numberOfTickets, instructions).then(prepared => {
|
||||
return api.prepareTicketCreate(address, numberOfTickets, instructions).then(prepared => {
|
||||
console.log('Ticket transaction prepared...');
|
||||
const {signedTransaction} = api.sign(prepared.txJSON, secret);
|
||||
console.log('Ticket transaction signed...');
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<%- include('prepareCheckCreate.md.ejs') %>
|
||||
<%- include('prepareCheckCancel.md.ejs') %>
|
||||
<%- include('prepareCheckCash.md.ejs') %>
|
||||
<%- include('prepareTicket.md.ejs') %>
|
||||
<%- include('prepareTicketCreate.md.ejs') %>
|
||||
<%- include('sign.md.ejs') %>
|
||||
<%- include('combine.md.ejs') %>
|
||||
<%- include('submit.md.ejs') %>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## prepareTicket
|
||||
## prepareTicketCreate
|
||||
|
||||
`prepareTicket(address: string, ticketCount: number, instructions: object): Promise<object>`
|
||||
`prepareTicketCreate(address: string, ticketCount: number, instructions: object): Promise<object>`
|
||||
|
||||
Prepare a ticket transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
### Parameters
|
||||
|
||||
<%- renderSchema("input/prepare-ticket.json") %>
|
||||
<%- renderSchema("input/prepare-ticket-create.json") %>
|
||||
|
||||
### Return Value
|
||||
|
||||
@@ -22,11 +22,11 @@ All "prepare*" methods have the same return type.
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
return api.prepareTicket(address, 2).then(prepared => {
|
||||
return api.prepareTicketCreate(address, 2).then(prepared => {
|
||||
/* ... */
|
||||
}).catch(error => {
|
||||
/* ... as with all prepare* methods, use a Promise catch block to handle errors ... */
|
||||
})
|
||||
```
|
||||
|
||||
<%- renderFixture("responses/prepare-ticket.json") %>
|
||||
<%- renderFixture("responses/prepare-ticket-create.json") %>
|
||||
|
||||
@@ -38,7 +38,7 @@ Executing a transaction with `RippleAPI` requires the following four steps:
|
||||
* [prepareCheckCreate](#preparecheckcreate)
|
||||
* [prepareCheckCancel](#preparecheckcancel)
|
||||
* [prepareCheckCash](#preparecheckcash)
|
||||
* [prepareTicket](#prepareticket)
|
||||
* [prepareTicketCreate](#prepareticketcreate)
|
||||
2. [Sign](#sign) - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place. For multisignature transactions, the `signedTransaction` fields returned by `sign` must be collected and passed to the [combine](#combine) method.
|
||||
3. [Submit](#submit) - Submit the transaction to the connected server.
|
||||
4. Verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted.
|
||||
|
||||
@@ -43,7 +43,7 @@ import prepareCheckCreate from './transaction/check-create'
|
||||
import prepareCheckCancel from './transaction/check-cancel'
|
||||
import prepareCheckCash from './transaction/check-cash'
|
||||
import prepareSettings from './transaction/settings'
|
||||
import prepareTicket from './transaction/ticket'
|
||||
import prepareTicketCreate from './transaction/ticket'
|
||||
import sign from './transaction/sign'
|
||||
import combine from './transaction/combine'
|
||||
import submit from './transaction/submit'
|
||||
@@ -396,7 +396,7 @@ class RippleAPI extends EventEmitter {
|
||||
prepareCheckCreate = prepareCheckCreate
|
||||
prepareCheckCash = prepareCheckCash
|
||||
prepareCheckCancel = prepareCheckCancel
|
||||
prepareTicket = prepareTicket
|
||||
prepareTicketCreate = prepareTicketCreate
|
||||
prepareSettings = prepareSettings
|
||||
sign = sign
|
||||
combine = combine
|
||||
|
||||
@@ -116,7 +116,7 @@ function loadSchemas() {
|
||||
require('./schemas/input/prepare-check-create.json'),
|
||||
require('./schemas/input/prepare-check-cash.json'),
|
||||
require('./schemas/input/prepare-check-cancel.json'),
|
||||
require('./schemas/input/prepare-ticket.json'),
|
||||
require('./schemas/input/prepare-ticket-create.json'),
|
||||
require('./schemas/input/compute-ledger-hash.json'),
|
||||
require('./schemas/input/sign.json'),
|
||||
require('./schemas/input/submit.json'),
|
||||
|
||||
@@ -132,7 +132,7 @@ export const prepareCheckCancel = _.partial(
|
||||
'prepareCheckCancelParameters'
|
||||
)
|
||||
|
||||
export const prepareTicket = _.partial(
|
||||
export const prepareTicketCreate = _.partial(
|
||||
schemaValidate,
|
||||
'prepareTicketParameters'
|
||||
)
|
||||
|
||||
@@ -27,14 +27,14 @@ function createTicketTransaction(
|
||||
return txJSON
|
||||
}
|
||||
|
||||
function prepareTicket(
|
||||
function prepareTicketCreate(
|
||||
this: RippleAPI,
|
||||
address: string,
|
||||
ticketCount: number,
|
||||
instructions: Instructions = {}
|
||||
): Promise<Prepare> {
|
||||
try {
|
||||
validate.prepareTicket({address, ticketCount, instructions})
|
||||
validate.prepareTicketCreate({address, ticketCount, instructions})
|
||||
const txJSON = createTicketTransaction(address, ticketCount)
|
||||
return utils.prepareTransaction(txJSON, this, instructions)
|
||||
} catch (e) {
|
||||
@@ -42,4 +42,4 @@ function prepareTicket(
|
||||
}
|
||||
}
|
||||
|
||||
export default prepareTicket
|
||||
export default prepareTicketCreate
|
||||
|
||||
@@ -31,7 +31,7 @@ export default <TestSuite>{
|
||||
fee: '0.000012'
|
||||
}
|
||||
}
|
||||
const response = await api.prepareTicket(address, 2)
|
||||
const response = await api.prepareTicketCreate(address, 2)
|
||||
assertResultMatch(response, expected, 'prepare')
|
||||
},
|
||||
|
||||
@@ -50,7 +50,7 @@ export default <TestSuite>{
|
||||
ticketSequence: 23,
|
||||
fee: '0.000012'
|
||||
}
|
||||
const response = await api.prepareTicket(address, 1, instructions)
|
||||
const response = await api.prepareTicketCreate(address, 1, instructions)
|
||||
assertResultMatch(response, expected, 'prepare')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ describe('integration tests', function () {
|
||||
it('ticket', function () {
|
||||
return this.api.getLedgerVersion().then((ledgerVersion) => {
|
||||
return this.api
|
||||
.prepareTicket(address, 1, instructions)
|
||||
.prepareTicketCreate(address, 1, instructions)
|
||||
.then((prepared) =>
|
||||
testTransaction(this, 'ticket', ledgerVersion, prepared)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user