mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Implements TypeScript types for transaction method requests/responses (#1517)
* submit * submit_multisigned * transaction_entry * tx * export * move searched_all to TxResponse
This commit is contained in:
@@ -19,6 +19,10 @@ import { RandomRequest, RandomResponse } from "./random";
|
|||||||
import { RipplePathFindRequest, RipplePathFindResponse } from "./ripplePathFind";
|
import { RipplePathFindRequest, RipplePathFindResponse } from "./ripplePathFind";
|
||||||
import { ServerInfoRequest, ServerInfoResponse } from "./serverInfo";
|
import { ServerInfoRequest, ServerInfoResponse } from "./serverInfo";
|
||||||
import { ServerStateRequest, ServerStateResponse } from "./serverState";
|
import { ServerStateRequest, ServerStateResponse } from "./serverState";
|
||||||
|
import { SubmitRequest, SubmitResponse } from "./submit";
|
||||||
|
import { SubmitMultisignedRequest, SubmitMultisignedResponse } from "./submitMultisigned";
|
||||||
|
import { TransactionEntryRequest, TransactionEntryResponse } from "./transactionEntry";
|
||||||
|
import { TxRequest, TxResponse } from "./tx";
|
||||||
|
|
||||||
type Request = // account methods
|
type Request = // account methods
|
||||||
AccountChannelsRequest
|
AccountChannelsRequest
|
||||||
@@ -30,6 +34,11 @@ type Request = // account methods
|
|||||||
| AccountTxRequest
|
| AccountTxRequest
|
||||||
| GatewayBalancesRequest
|
| GatewayBalancesRequest
|
||||||
| NoRippleCheckRequest
|
| NoRippleCheckRequest
|
||||||
|
// transaction methods
|
||||||
|
| SubmitRequest
|
||||||
|
| SubmitMultisignedRequest
|
||||||
|
| TransactionEntryRequest
|
||||||
|
| TxRequest
|
||||||
// path and order book methods
|
// path and order book methods
|
||||||
| BookOffersRequest
|
| BookOffersRequest
|
||||||
| DepositAuthorizedRequest
|
| DepositAuthorizedRequest
|
||||||
@@ -57,6 +66,11 @@ type Response = // account methods
|
|||||||
| AccountTxResponse
|
| AccountTxResponse
|
||||||
| GatewayBalancesResponse
|
| GatewayBalancesResponse
|
||||||
| NoRippleCheckResponse
|
| NoRippleCheckResponse
|
||||||
|
// transaction methods
|
||||||
|
| SubmitResponse
|
||||||
|
| SubmitMultisignedResponse
|
||||||
|
| TransactionEntryResponse
|
||||||
|
| TxResponse
|
||||||
// path and order book methods
|
// path and order book methods
|
||||||
| BookOffersResponse
|
| BookOffersResponse
|
||||||
| DepositAuthorizedResponse
|
| DepositAuthorizedResponse
|
||||||
@@ -96,6 +110,15 @@ export {
|
|||||||
GatewayBalancesResponse,
|
GatewayBalancesResponse,
|
||||||
NoRippleCheckRequest,
|
NoRippleCheckRequest,
|
||||||
NoRippleCheckResponse,
|
NoRippleCheckResponse,
|
||||||
|
// transaction methods
|
||||||
|
SubmitRequest,
|
||||||
|
SubmitResponse,
|
||||||
|
SubmitMultisignedRequest,
|
||||||
|
SubmitMultisignedResponse,
|
||||||
|
TransactionEntryRequest,
|
||||||
|
TransactionEntryResponse,
|
||||||
|
TxRequest,
|
||||||
|
TxResponse,
|
||||||
// path and order book methods
|
// path and order book methods
|
||||||
BookOffersRequest,
|
BookOffersRequest,
|
||||||
BookOffersResponse,
|
BookOffersResponse,
|
||||||
|
|||||||
26
src/models/methods/submit.ts
Normal file
26
src/models/methods/submit.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { BaseRequest, BaseResponse } from "./baseMethod";
|
||||||
|
|
||||||
|
export interface SubmitRequest extends BaseRequest {
|
||||||
|
command: "submit"
|
||||||
|
tx_blob: string
|
||||||
|
fail_hard?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SubmitResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
engine_result: string
|
||||||
|
engine_result_code: number
|
||||||
|
engine_result_message: string
|
||||||
|
tx_blob: string
|
||||||
|
tx_json: any // TODO: type this properly when we have Transaction types
|
||||||
|
accepted: boolean
|
||||||
|
account_sequence_available: number
|
||||||
|
account_sequence_next: number
|
||||||
|
applied: boolean
|
||||||
|
broadcast: boolean
|
||||||
|
kept: boolean
|
||||||
|
queued: boolean
|
||||||
|
open_ledger_cost: string
|
||||||
|
validated_ledger_index: number
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/models/methods/submitMultisigned.ts
Normal file
17
src/models/methods/submitMultisigned.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { BaseRequest, BaseResponse } from "./baseMethod";
|
||||||
|
|
||||||
|
export interface SubmitMultisignedRequest extends BaseRequest {
|
||||||
|
command: "submit_multisigned"
|
||||||
|
tx_json: any // TODO: type this properly when we have Transaction types
|
||||||
|
fail_hard?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SubmitMultisignedResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
engine_result: string
|
||||||
|
engine_result_code: number
|
||||||
|
engine_result_message: string
|
||||||
|
tx_blob: string
|
||||||
|
tx_json: any // TODO: type this properly when we have Transaction types
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/models/methods/transactionEntry.ts
Normal file
19
src/models/methods/transactionEntry.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { LedgerIndex } from "../common";
|
||||||
|
import { TransactionMetadata } from "../common/transaction";
|
||||||
|
import { BaseRequest, BaseResponse } from "./baseMethod";
|
||||||
|
|
||||||
|
export interface TransactionEntryRequest extends BaseRequest {
|
||||||
|
command: "transaction_entry"
|
||||||
|
ledger_hash?: string
|
||||||
|
ledger_index?: LedgerIndex
|
||||||
|
tx_hash: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransactionEntryResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
ledger_hash: string
|
||||||
|
ledger_index: number
|
||||||
|
metadata: TransactionMetadata
|
||||||
|
tx_json: any // TODO: type this properly when we have Transaction types
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/models/methods/tx.ts
Normal file
20
src/models/methods/tx.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { TransactionMetadata } from "../common/transaction";
|
||||||
|
import { BaseRequest, BaseResponse } from "./baseMethod";
|
||||||
|
|
||||||
|
export interface TxRequest extends BaseRequest {
|
||||||
|
command: "tx"
|
||||||
|
transaction: string
|
||||||
|
binary?: boolean
|
||||||
|
min_ledger?: number
|
||||||
|
max_ledger?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TxResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
hash: string
|
||||||
|
ledger_index: number
|
||||||
|
meta: TransactionMetadata | string
|
||||||
|
validated?: boolean
|
||||||
|
} // TODO: needs to be `& Transaction` once that type is available
|
||||||
|
searched_all?: boolean
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user