@bithomp/xrpl-api 2.7.15 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/lib/common/errors/index.d.ts +2 -2
  2. package/lib/common/errors/index.js +3 -3
  3. package/lib/common/errors/validation_error.d.ts +2 -2
  4. package/lib/common/errors/validation_error.js +2 -2
  5. package/lib/common/errors/xrpl_api_error.d.ts +9 -0
  6. package/lib/common/errors/xrpl_api_error.js +28 -0
  7. package/lib/common/utils.d.ts +1 -0
  8. package/lib/common/utils.js +17 -1
  9. package/lib/ledger/account_info.js +7 -0
  10. package/lib/ledger/account_offers.d.ts +1 -1
  11. package/lib/ledger/ledger.d.ts +1 -1
  12. package/lib/ledger/transaction.d.ts +3 -3
  13. package/lib/ledger/transaction.js +4 -4
  14. package/lib/models/account_info.d.ts +1 -1
  15. package/lib/models/account_nfts.js +2 -1
  16. package/lib/models/account_object.d.ts +1 -1
  17. package/lib/models/account_offers.d.ts +9 -0
  18. package/lib/models/account_offers.js +2 -0
  19. package/lib/models/account_uritokens.d.ts +1 -1
  20. package/lib/models/path_find.d.ts +11 -0
  21. package/lib/models/path_find.js +2 -0
  22. package/lib/models/transaction.d.ts +1 -1
  23. package/lib/models/vl.js +1 -1
  24. package/lib/parse/index.d.ts +1 -0
  25. package/lib/parse/index.js +2 -1
  26. package/lib/parse/ledger/account-order.d.ts +1 -1
  27. package/lib/parse/ledger/account-order.js +1 -1
  28. package/lib/parse/ledger/account-trustline.d.ts +1 -1
  29. package/lib/parse/ledger/amount.d.ts +1 -1
  30. package/lib/parse/ledger/currency-amount.d.ts +1 -1
  31. package/lib/parse/ledger/emit_details.d.ts +1 -1
  32. package/lib/parse/ledger/import.d.ts +1 -1
  33. package/lib/parse/ledger/index.d.ts +1 -1
  34. package/lib/parse/ledger/index.js +2 -2
  35. package/lib/parse/ledger/ledger.d.ts +1 -1
  36. package/lib/parse/ledger/memos.d.ts +3 -2
  37. package/lib/parse/ledger/memos.js +12 -1
  38. package/lib/parse/ledger/nftoken-flags.d.ts +1 -1
  39. package/lib/parse/ledger/nftoken-flags.js +1 -1
  40. package/lib/parse/ledger/nftoken-offer-flags.d.ts +1 -1
  41. package/lib/parse/ledger/nftoken-offer-flags.js +1 -1
  42. package/lib/parse/ledger/orderbook-order.d.ts +7 -2
  43. package/lib/parse/ledger/orderbook-order.js +1 -1
  44. package/lib/parse/ledger/pathfind.d.ts +3 -3
  45. package/lib/parse/ledger/ripple-amount.d.ts +1 -1
  46. package/lib/parse/ledger/uritoken-flags.d.ts +1 -1
  47. package/lib/parse/ledger/uritoken-flags.js +1 -1
  48. package/lib/parse/outcome/balance_changes.js +1 -1
  49. package/lib/parse/outcome/channel_changes.js +1 -1
  50. package/lib/parse/outcome/escrow_changes.d.ts +1 -1
  51. package/lib/parse/outcome/escrow_changes.js +3 -4
  52. package/lib/parse/outcome/locked_balance_changes.js +1 -1
  53. package/lib/parse/outcome/orderbook_changes.js +1 -1
  54. package/lib/parse/outcome/unl_report_changes.js +1 -1
  55. package/lib/parse/outcome.d.ts +1 -1
  56. package/lib/parse/specification/account-delete.d.ts +1 -1
  57. package/lib/parse/specification/account-delete.js +13 -7
  58. package/lib/parse/specification/amendment.d.ts +1 -1
  59. package/lib/parse/specification/amendment.js +2 -5
  60. package/lib/parse/specification/check-cancel.d.ts +1 -1
  61. package/lib/parse/specification/check-cancel.js +2 -5
  62. package/lib/parse/specification/check-cash.d.ts +1 -1
  63. package/lib/parse/specification/check-cash.js +2 -2
  64. package/lib/parse/specification/check-create.d.ts +1 -1
  65. package/lib/parse/specification/check-create.js +13 -4
  66. package/lib/parse/specification/deposit-preauth.d.ts +1 -1
  67. package/lib/parse/specification/deposit-preauth.js +2 -5
  68. package/lib/parse/specification/escrow-cancel.d.ts +1 -1
  69. package/lib/parse/specification/escrow-cancel.js +2 -5
  70. package/lib/parse/specification/escrow-create.d.ts +1 -1
  71. package/lib/parse/specification/escrow-create.js +2 -5
  72. package/lib/parse/specification/escrow-finish.d.ts +1 -1
  73. package/lib/parse/specification/escrow-finish.js +2 -5
  74. package/lib/parse/specification/fee-update.d.ts +1 -1
  75. package/lib/parse/specification/fee-update.js +2 -2
  76. package/lib/parse/specification/import.d.ts +1 -1
  77. package/lib/parse/specification/import.js +2 -5
  78. package/lib/parse/specification/invoke.d.ts +1 -1
  79. package/lib/parse/specification/invoke.js +2 -5
  80. package/lib/parse/specification/nftoken-accept-offer.d.ts +1 -1
  81. package/lib/parse/specification/nftoken-accept-offer.js +2 -5
  82. package/lib/parse/specification/nftoken-burn.d.ts +1 -1
  83. package/lib/parse/specification/nftoken-burn.js +2 -5
  84. package/lib/parse/specification/nftoken-cancel-offer.d.ts +1 -1
  85. package/lib/parse/specification/nftoken-cancel-offer.js +2 -5
  86. package/lib/parse/specification/nftoken-create-offer.d.ts +1 -1
  87. package/lib/parse/specification/nftoken-create-offer.js +12 -3
  88. package/lib/parse/specification/nftoken-mint.d.ts +1 -1
  89. package/lib/parse/specification/nftoken-mint.js +2 -2
  90. package/lib/parse/specification/offer-cancel.d.ts +1 -1
  91. package/lib/parse/specification/offer-cancel.js +2 -5
  92. package/lib/parse/specification/offer-create.d.ts +1 -1
  93. package/lib/parse/specification/offer-create.js +2 -2
  94. package/lib/parse/specification/payment-channel-claim.d.ts +1 -1
  95. package/lib/parse/specification/payment-channel-claim.js +2 -2
  96. package/lib/parse/specification/payment-channel-create.d.ts +1 -1
  97. package/lib/parse/specification/payment-channel-create.js +13 -5
  98. package/lib/parse/specification/payment-channel-fund.d.ts +1 -1
  99. package/lib/parse/specification/payment-channel-fund.js +2 -2
  100. package/lib/parse/specification/payment.d.ts +1 -1
  101. package/lib/parse/specification/payment.js +3 -7
  102. package/lib/parse/specification/remit.d.ts +1 -1
  103. package/lib/parse/specification/remit.js +2 -2
  104. package/lib/parse/specification/settings.js +2 -2
  105. package/lib/parse/specification/ticket-create.d.ts +1 -1
  106. package/lib/parse/specification/ticket-create.js +2 -5
  107. package/lib/parse/specification/trustline.d.ts +1 -1
  108. package/lib/parse/specification/trustline.js +2 -5
  109. package/lib/parse/specification/unl-report.d.ts +1 -1
  110. package/lib/parse/specification/unl-report.js +2 -5
  111. package/lib/parse/specification/uritoken-burn.d.ts +1 -1
  112. package/lib/parse/specification/uritoken-burn.js +2 -5
  113. package/lib/parse/specification/uritoken-buy.d.ts +1 -1
  114. package/lib/parse/specification/uritoken-buy.js +2 -5
  115. package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +1 -1
  116. package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -5
  117. package/lib/parse/specification/uritoken-create-sell-offer.d.ts +2 -2
  118. package/lib/parse/specification/uritoken-create-sell-offer.js +12 -6
  119. package/lib/parse/specification/uritoken-mint.d.ts +3 -3
  120. package/lib/parse/specification/uritoken-mint.js +14 -5
  121. package/lib/parse/transaction.d.ts +19 -19
  122. package/lib/parse/utils.d.ts +10 -1
  123. package/lib/parse/utils.js +49 -1
  124. package/lib/types/account.d.ts +15 -0
  125. package/lib/types/account.js +2 -0
  126. package/lib/types/adjustments.d.ts +16 -0
  127. package/lib/types/adjustments.js +2 -0
  128. package/lib/types/amendments.d.ts +4 -0
  129. package/lib/types/amendments.js +2 -0
  130. package/lib/types/checks.d.ts +18 -0
  131. package/lib/types/checks.js +2 -0
  132. package/lib/types/deposits.d.ts +5 -0
  133. package/lib/types/deposits.js +2 -0
  134. package/lib/types/emit_details.d.ts +7 -0
  135. package/lib/types/emit_details.js +2 -0
  136. package/lib/types/escrows.d.ts +23 -0
  137. package/lib/types/escrows.js +2 -0
  138. package/lib/types/fees.d.ts +7 -0
  139. package/lib/types/fees.js +2 -0
  140. package/lib/types/flags.d.ts +5 -0
  141. package/lib/types/flags.js +8 -0
  142. package/lib/types/hooks.d.ts +14 -0
  143. package/lib/types/hooks.js +2 -0
  144. package/lib/types/import.d.ts +23 -0
  145. package/lib/types/import.js +2 -0
  146. package/lib/types/index.d.ts +24 -1
  147. package/lib/types/index.js +38 -0
  148. package/lib/types/invoke.d.ts +6 -0
  149. package/lib/types/invoke.js +2 -0
  150. package/lib/types/ledger.d.ts +45 -0
  151. package/lib/types/ledger.js +2 -0
  152. package/lib/types/ledger_data.d.ts +10 -0
  153. package/lib/types/ledger_data.js +2 -0
  154. package/lib/types/ledger_entries.d.ts +158 -0
  155. package/lib/types/ledger_entries.js +2 -0
  156. package/lib/types/memos.d.ts +12 -0
  157. package/lib/types/memos.js +2 -0
  158. package/lib/types/nftokens.d.ts +50 -0
  159. package/lib/types/nftokens.js +13 -0
  160. package/lib/types/offers.d.ts +15 -0
  161. package/lib/types/offers.js +2 -0
  162. package/lib/types/outcome.d.ts +33 -0
  163. package/lib/types/outcome.js +2 -0
  164. package/lib/types/path_find.d.ts +28 -0
  165. package/lib/types/path_find.js +2 -0
  166. package/lib/types/payment_channels.d.ts +25 -0
  167. package/lib/types/payment_channels.js +2 -0
  168. package/lib/types/payments.d.ts +11 -0
  169. package/lib/types/payments.js +2 -0
  170. package/lib/types/queue_data.d.ts +15 -0
  171. package/lib/types/queue_data.js +2 -0
  172. package/lib/types/remits.d.ts +18 -0
  173. package/lib/types/remits.js +2 -0
  174. package/lib/types/settings.d.ts +34 -0
  175. package/lib/types/settings.js +2 -0
  176. package/lib/types/signers.d.ts +6 -0
  177. package/lib/types/signers.js +2 -0
  178. package/lib/types/specification.d.ts +4 -0
  179. package/lib/types/specification.js +2 -0
  180. package/lib/types/tickets.d.ts +4 -0
  181. package/lib/types/tickets.js +2 -0
  182. package/lib/types/transactions.d.ts +21 -0
  183. package/lib/types/transactions.js +2 -0
  184. package/lib/types/trustlines.d.ts +38 -0
  185. package/lib/types/trustlines.js +2 -0
  186. package/lib/types/unl_reports.d.ts +7 -0
  187. package/lib/types/unl_reports.js +2 -0
  188. package/lib/types/uri_tokens.d.ts +7 -0
  189. package/lib/types/uri_tokens.js +6 -0
  190. package/lib/types/uritokens.d.ts +39 -0
  191. package/lib/types/uritokens.js +6 -0
  192. package/lib/v1/common/types/objects/account.d.ts +2 -2
  193. package/lib/v1/common/types/objects/checks.d.ts +3 -2
  194. package/lib/v1/common/types/objects/nftokens.d.ts +3 -1
  195. package/lib/v1/common/types/objects/payment_channels.d.ts +3 -3
  196. package/lib/v1/common/types/objects/uritokens.d.ts +5 -2
  197. package/lib/v1/common/types/objects/uritokens.js +1 -1
  198. package/lib/v1/transaction/payment.d.ts +2 -2
  199. package/lib/v1/transaction/payment.js +9 -9
  200. package/lib/v1/transaction/types.d.ts +1 -34
  201. package/lib/v1/transaction/utils.d.ts +2 -3
  202. package/lib/v1/transaction/utils.js +19 -15
  203. package/lib/v1/types.d.ts +9 -0
  204. package/lib/v1/types.js +2 -0
  205. package/lib/v1/utils.d.ts +7 -0
  206. package/lib/v1/utils.js +42 -0
  207. package/lib/validator.js +5 -4
  208. package/lib/wallet.d.ts +3 -0
  209. package/lib/wallet.js +26 -1
  210. package/package.json +20 -20
@@ -0,0 +1,34 @@
1
+ import { FormattedBaseSpecification } from "./specification";
2
+ export type WeightedSigner = {
3
+ address: string;
4
+ weight: number;
5
+ };
6
+ export type Signers = {
7
+ threshold?: number;
8
+ weights: WeightedSigner[];
9
+ };
10
+ export type FormattedSettingsSpecification = {
11
+ defaultRipple?: boolean;
12
+ depositAuth?: boolean;
13
+ disableMasterKey?: boolean;
14
+ disallowIncomingXRP?: boolean;
15
+ disallowIncomingNFTokenOffer?: boolean;
16
+ disallowIncomingCheck?: boolean;
17
+ disallowIncomingPayChan?: boolean;
18
+ disallowIncomingTrustline?: boolean;
19
+ domain?: string;
20
+ emailHash?: string | null;
21
+ walletLocator?: string | null;
22
+ enableTransactionIDTracking?: boolean;
23
+ globalFreeze?: boolean;
24
+ messageKey?: string;
25
+ noFreeze?: boolean;
26
+ passwordSpent?: boolean;
27
+ regularKey?: string;
28
+ requireAuthorization?: boolean;
29
+ requireDestinationTag?: boolean;
30
+ signers?: Signers;
31
+ transferRate?: number | null;
32
+ tickSize?: number;
33
+ nftokenMinter?: string;
34
+ } & FormattedBaseSpecification;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface SignerEntry {
2
+ SignerEntry: {
3
+ Account: string;
4
+ SignerWeight: number;
5
+ };
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { FormattedMemo } from "./memos";
2
+ export type FormattedBaseSpecification = {
3
+ memos?: FormattedMemo[];
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { FormattedBaseSpecification } from "./specification";
2
+ export type FormattedTicketCreateSpecification = {
3
+ ticketCount: number;
4
+ } & FormattedBaseSpecification;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ import { Amount } from "./amounts";
2
+ import { Memo } from "./memos";
3
+ export interface OfferCreateTransaction {
4
+ TransactionType: "OfferCreate";
5
+ Account: string;
6
+ AccountTxnID?: string;
7
+ Fee: string;
8
+ Field: any;
9
+ Flags: number;
10
+ LastLedgerSequence?: number;
11
+ Sequence: number;
12
+ Signers: any[];
13
+ SigningPubKey: string;
14
+ SourceTag?: number;
15
+ TakerGets: Amount;
16
+ TakerPays: Amount;
17
+ TxnSignature: string;
18
+ Expiration?: number;
19
+ Memos?: Memo[];
20
+ OfferSequence?: number;
21
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,38 @@
1
+ import { FormattedBaseSpecification } from "./specification";
2
+ export interface Trustline {
3
+ account: string;
4
+ balance: string;
5
+ currency: string;
6
+ limit: string;
7
+ limit_peer: string;
8
+ quality_in: number;
9
+ quality_out: number;
10
+ no_ripple?: boolean;
11
+ no_ripple_peer?: boolean;
12
+ freeze?: boolean;
13
+ freeze_peer?: boolean;
14
+ authorized?: boolean;
15
+ peer_authorized?: boolean;
16
+ }
17
+ export type FormattedTrustlineSpecification = {
18
+ currency: string;
19
+ counterparty: string;
20
+ limit: string;
21
+ qualityIn?: number;
22
+ qualityOut?: number;
23
+ ripplingDisabled?: boolean;
24
+ authorized?: boolean;
25
+ frozen?: boolean;
26
+ } & FormattedBaseSpecification;
27
+ export type FormattedTrustline = {
28
+ specification: FormattedTrustlineSpecification;
29
+ counterparty: {
30
+ limit: string;
31
+ ripplingDisabled?: boolean;
32
+ frozen?: boolean;
33
+ authorized?: boolean;
34
+ };
35
+ state: {
36
+ balance: string;
37
+ };
38
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { FormattedBaseSpecification } from "./specification";
2
+ import { FormattedSourceAddress } from "./account";
3
+ export type FormattedUNLReportSpecification = {
4
+ source: FormattedSourceAddress;
5
+ activeValidator?: string;
6
+ importVLKey?: string;
7
+ } & FormattedBaseSpecification;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { URITokenMintFlags } from "../models/transactions/URITokenMint";
2
+ export declare const URITokenFlagsKeys: {
3
+ burnable: URITokenMintFlags;
4
+ };
5
+ export interface URITokenFlagsKeysInterface {
6
+ burnable?: boolean;
7
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URITokenFlagsKeys = void 0;
4
+ exports.URITokenFlagsKeys = {
5
+ burnable: 1,
6
+ };
@@ -0,0 +1,39 @@
1
+ import { URITokenMintFlags } from "../models/transactions/URITokenMint";
2
+ import { FormattedBaseSpecification } from "./specification";
3
+ import { Amount } from "./amounts";
4
+ import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
5
+ export declare const URITokenFlagsKeys: {
6
+ burnable: URITokenMintFlags;
7
+ };
8
+ export interface URITokenFlagsKeysInterface {
9
+ burnable?: boolean;
10
+ }
11
+ export type FormattedURITokenBurnSpecification = {
12
+ uritokenID: string;
13
+ } & FormattedBaseSpecification;
14
+ export type FormattedURITokenBuySpecification = {
15
+ uritokenID: string;
16
+ amount: string;
17
+ } & FormattedBaseSpecification;
18
+ export type FormattedURITokenMintSpecification = {
19
+ uri?: string;
20
+ flags?: URITokenFlagsKeysInterface;
21
+ digest?: string;
22
+ amount: Amount;
23
+ source?: FormattedSourceAddress;
24
+ destination?: FormattedDestinationAddress;
25
+ } & FormattedBaseSpecification;
26
+ export type FormattedURITokenCancelSellOfferSpecification = {
27
+ uritokenID: string;
28
+ } & FormattedBaseSpecification;
29
+ export type FormattedURITokenCreateSellOfferSpecification = {
30
+ uritokenID: string;
31
+ amount: string;
32
+ source?: FormattedSourceAddress;
33
+ destination?: FormattedDestinationAddress;
34
+ } & FormattedBaseSpecification;
35
+ export type FormattedURITokenAcceptOfferSpecification = {
36
+ nftokenSellOffer?: string;
37
+ nftokenBuyOffer?: string;
38
+ nftokenBrokerFee?: string;
39
+ } & FormattedBaseSpecification;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URITokenFlagsKeys = void 0;
4
+ exports.URITokenFlagsKeys = {
5
+ burnable: 1,
6
+ };
@@ -1,8 +1,8 @@
1
1
  import { FormattedBaseSpecification } from "./specification";
2
2
  import { FormattedIssuedCurrencyAmount } from "../../../../types";
3
3
  export type FormattedAccountDeleteSpecification = {
4
- destination: string;
5
- destinationTag?: number;
4
+ source?: FormattedSourceAddress;
5
+ destination?: FormattedDestinationAddress;
6
6
  } & FormattedBaseSpecification;
7
7
  export type FormattedSourceAddress = {
8
8
  address: string;
@@ -1,5 +1,6 @@
1
1
  import { FormattedBaseSpecification } from "./specification";
2
2
  import { FormattedIssuedCurrencyAmount } from "../../../../types";
3
+ import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
3
4
  export type FormattedCheckCancelSpecification = {
4
5
  checkID: string;
5
6
  } & FormattedBaseSpecification;
@@ -9,9 +10,9 @@ export type FormattedCheckCashSpecification = {
9
10
  deliverMin: FormattedIssuedCurrencyAmount;
10
11
  } & FormattedBaseSpecification;
11
12
  export type FormattedCheckCreateSpecification = {
12
- destination: string;
13
+ source?: FormattedSourceAddress;
14
+ destination?: FormattedDestinationAddress;
13
15
  sendMax: FormattedIssuedCurrencyAmount;
14
- destinationTag?: string;
15
16
  expiration?: string;
16
17
  invoiceID?: string;
17
18
  } & FormattedBaseSpecification;
@@ -1,6 +1,7 @@
1
1
  import { NFTokenMintFlags, NFTokenCreateOfferFlags } from "xrpl";
2
2
  import { FormattedBaseSpecification } from "./specification";
3
3
  import { Amount } from "../../../../types";
4
+ import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
4
5
  export declare const NFTokenFlagsKeys: {
5
6
  burnable: NFTokenMintFlags;
6
7
  onlyXRP: NFTokenMintFlags;
@@ -37,7 +38,8 @@ export type FormattedNFTokenCreateOfferSpecification = {
37
38
  nftokenID: string;
38
39
  amount: Amount;
39
40
  owner?: string;
40
- destination?: string;
41
+ source?: FormattedSourceAddress;
42
+ destination?: FormattedDestinationAddress;
41
43
  expiration?: number;
42
44
  flags?: NFTokenOfferFlagsKeysInterface;
43
45
  } & FormattedBaseSpecification;
@@ -1,5 +1,6 @@
1
1
  import { FormattedBaseSpecification } from "./specification";
2
2
  import { FormattedAmount } from "../../../../types";
3
+ import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
3
4
  export type FormattedPaymentChannelClaimSpecification = {
4
5
  channel: string;
5
6
  balance?: FormattedAmount;
@@ -10,13 +11,12 @@ export type FormattedPaymentChannelClaimSpecification = {
10
11
  close?: boolean;
11
12
  } & FormattedBaseSpecification;
12
13
  export type FormattedPaymentChannelCreateSpecification = {
14
+ source?: FormattedSourceAddress;
15
+ destination?: FormattedDestinationAddress;
13
16
  amount?: FormattedAmount;
14
- destination: string;
15
17
  settleDelay: number;
16
18
  publicKey?: string;
17
19
  cancelAfter?: string;
18
- sourceTag?: number;
19
- destinationTag?: number;
20
20
  } & FormattedBaseSpecification;
21
21
  export type FormattedPaymentChannelFundSpecification = {
22
22
  channel: string;
@@ -1,6 +1,7 @@
1
1
  import { URITokenMintFlags } from "../../../../models/transactions/URITokenMint";
2
2
  import { FormattedBaseSpecification } from "./specification";
3
3
  import { Amount } from "../../../../types";
4
+ import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
4
5
  export declare const URITokenFlagsKeys: {
5
6
  burnable: URITokenMintFlags;
6
7
  };
@@ -19,7 +20,8 @@ export type FormattedURITokenMintSpecification = {
19
20
  flags?: URITokenFlagsKeysInterface;
20
21
  digest?: string;
21
22
  amount: Amount;
22
- destination?: string;
23
+ source?: FormattedSourceAddress;
24
+ destination?: FormattedDestinationAddress;
23
25
  } & FormattedBaseSpecification;
24
26
  export type FormattedURITokenCancelSellOfferSpecification = {
25
27
  uritokenID: string;
@@ -27,7 +29,8 @@ export type FormattedURITokenCancelSellOfferSpecification = {
27
29
  export type FormattedURITokenCreateSellOfferSpecification = {
28
30
  uritokenID: string;
29
31
  amount: string;
30
- destination?: string;
32
+ source?: FormattedSourceAddress;
33
+ destination?: FormattedDestinationAddress;
31
34
  } & FormattedBaseSpecification;
32
35
  export type FormattedURITokenAcceptOfferSpecification = {
33
36
  nftokenSellOffer?: string;
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.URITokenFlagsKeys = void 0;
4
4
  exports.URITokenFlagsKeys = {
5
- burnable: 1
5
+ burnable: 1,
6
6
  };
@@ -1,5 +1,5 @@
1
- import { TransactionJSON } from "./types";
2
- import { Adjustment, MaxAdjustment, MinAdjustment, FormattedMemo } from "../common/types/objects";
1
+ import { TransactionJSON } from "../types";
2
+ import { Adjustment, MaxAdjustment, MinAdjustment, FormattedMemo } from "../../types";
3
3
  export interface Payment {
4
4
  source: Adjustment | MaxAdjustment;
5
5
  destination: Adjustment | MinAdjustment;
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createPaymentTransaction = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const xrpl_1 = require("xrpl");
9
- const common_1 = require("../common");
10
- const common_2 = require("../../common");
11
- const utils_1 = require("./utils");
9
+ const common_1 = require("../../common");
10
+ const utils_1 = require("../utils");
11
+ const memos_1 = require("../../parse/ledger/memos");
12
12
  const client_1 = require("../../client");
13
13
  function isMaxAdjustment(source) {
14
14
  return source.maxAmount != null;
@@ -26,7 +26,7 @@ function isXRPToXRPPayment(payment) {
26
26
  (destinationCurrency === (0, client_1.getNativeCurrency)() || destinationCurrency === "drops"));
27
27
  }
28
28
  function isIOUWithoutCounterparty(amount) {
29
- return amount && amount.currency !== (0, client_1.getNativeCurrency)() && amount.currency !== "drops" && amount.counterparty == null;
29
+ return (amount && amount.currency !== (0, client_1.getNativeCurrency)() && amount.currency !== "drops" && amount.counterparty == null);
30
30
  }
31
31
  function applyAnyCounterpartyEncoding(payment) {
32
32
  [payment.source, payment.destination].forEach((adjustment) => {
@@ -45,7 +45,7 @@ function createMaximalAmount(amount) {
45
45
  maxValue = maxXRPValue;
46
46
  }
47
47
  else if (amount.currency === "drops") {
48
- maxValue = (0, common_2.xrpToDrops)(maxXRPValue);
48
+ maxValue = (0, common_1.xrpToDrops)(maxXRPValue);
49
49
  }
50
50
  else {
51
51
  maxValue = maxIOUValue;
@@ -87,7 +87,7 @@ function createPaymentTransaction(address, paymentArgument) {
87
87
  TransactionType: "Payment",
88
88
  Account: sourceAddressAndTag.classicAccount,
89
89
  Destination: destinationAddressAndTag.classicAccount,
90
- Amount: (0, common_1.toRippledAmount)(amount),
90
+ Amount: (0, utils_1.toRippledAmount)(amount),
91
91
  Flags: 0,
92
92
  };
93
93
  if (payment.invoiceID != null) {
@@ -103,7 +103,7 @@ function createPaymentTransaction(address, paymentArgument) {
103
103
  txJSON.NetworkID = payment.networkID;
104
104
  }
105
105
  if (payment.memos != null) {
106
- txJSON.Memos = payment.memos.map(utils_1.convertMemo);
106
+ txJSON.Memos = payment.memos.map(memos_1.formattedMemoToMemo);
107
107
  }
108
108
  if (payment.noDirectRipple === true) {
109
109
  txJSON.Flags |= xrpl_1.PaymentFlags.tfNoDirectRipple;
@@ -115,9 +115,9 @@ function createPaymentTransaction(address, paymentArgument) {
115
115
  if (payment.allowPartialPayment || isMinAdjustment(payment.destination)) {
116
116
  txJSON.Flags |= xrpl_1.PaymentFlags.tfPartialPayment;
117
117
  }
118
- txJSON.SendMax = (0, common_1.toRippledAmount)(sourceAmount);
118
+ txJSON.SendMax = (0, utils_1.toRippledAmount)(sourceAmount);
119
119
  if (isMinAdjustment(payment.destination)) {
120
- txJSON.DeliverMin = (0, common_1.toRippledAmount)(destinationAmount);
120
+ txJSON.DeliverMin = (0, utils_1.toRippledAmount)(destinationAmount);
121
121
  }
122
122
  if (payment.paths != null) {
123
123
  txJSON.Paths = JSON.parse(payment.paths);
@@ -1,4 +1,4 @@
1
- import { Amount, Memo } from "../common/types/objects";
1
+ import { Amount, Memo } from "../../types";
2
2
  export type TransactionJSON = {
3
3
  Account: string;
4
4
  TransactionType: string;
@@ -7,36 +7,3 @@ export type TransactionJSON = {
7
7
  Fulfillment?: string;
8
8
  [Field: string]: string | number | any[] | Amount | undefined;
9
9
  };
10
- export type Outcome = {
11
- result?: string;
12
- ledgerVersion?: number;
13
- indexInLedger?: number;
14
- fee?: string;
15
- balanceChanges?: {
16
- [key: string]: {
17
- currency: string;
18
- counterparty?: string;
19
- value: string;
20
- }[];
21
- };
22
- lockedBalanceChanges?: {
23
- [key: string]: {
24
- currency: string;
25
- counterparty?: string;
26
- value: string;
27
- }[];
28
- };
29
- orderbookChanges?: object;
30
- channelChanges?: object;
31
- nftokenChanges?: object;
32
- nftokenOfferChanges?: object;
33
- uritokenChanges?: object;
34
- uritokenSellOfferChanges?: object;
35
- affectedObjects?: object;
36
- deliveredAmount?: {
37
- currency: string;
38
- counterparty?: string;
39
- value: string;
40
- };
41
- timestamp?: string;
42
- };
@@ -1,8 +1,7 @@
1
- import { FormattedMemo, Memo } from "../common/types/objects";
1
+ import { Amount, FormattedIssuedCurrencyAmount } from "../../types";
2
+ export declare function toRippledAmount(amount: Amount | FormattedIssuedCurrencyAmount): Amount;
2
3
  export interface ClassicAccountAndTag {
3
4
  classicAccount: string;
4
5
  tag: number | false | undefined;
5
6
  }
6
7
  export declare function getClassicAccountAndTag(Account: string, expectedTag?: number): ClassicAccountAndTag;
7
- export declare function convertStringToHex(value: string): string;
8
- export declare function convertMemo(memo: FormattedMemo): Memo;
@@ -1,8 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertMemo = exports.convertStringToHex = exports.getClassicAccountAndTag = void 0;
3
+ exports.getClassicAccountAndTag = exports.toRippledAmount = void 0;
4
4
  const ripple_address_codec_1 = require("ripple-address-codec");
5
5
  const common_1 = require("../../common");
6
+ const client_1 = require("../../client");
7
+ function toRippledAmount(amount) {
8
+ if (typeof amount === "string")
9
+ return amount;
10
+ if (amount.currency === (0, client_1.getNativeCurrency)()) {
11
+ return (0, common_1.xrpToDrops)(amount.value);
12
+ }
13
+ if (amount.currency === "drops") {
14
+ return amount.value;
15
+ }
16
+ const issuer = amount.counterparty || amount.issuer;
17
+ return {
18
+ currency: amount.currency,
19
+ issuer,
20
+ value: amount.value,
21
+ };
22
+ }
23
+ exports.toRippledAmount = toRippledAmount;
6
24
  function getClassicAccountAndTag(Account, expectedTag) {
7
25
  if ((0, ripple_address_codec_1.isValidXAddress)(Account)) {
8
26
  const classic = (0, ripple_address_codec_1.xAddressToClassicAddress)(Account);
@@ -22,17 +40,3 @@ function getClassicAccountAndTag(Account, expectedTag) {
22
40
  }
23
41
  }
24
42
  exports.getClassicAccountAndTag = getClassicAccountAndTag;
25
- function convertStringToHex(value) {
26
- return Buffer.from(value, "utf8").toString("hex").toUpperCase();
27
- }
28
- exports.convertStringToHex = convertStringToHex;
29
- function convertMemo(memo) {
30
- return {
31
- Memo: (0, common_1.removeUndefined)({
32
- MemoData: memo.data ? convertStringToHex(memo.data) : undefined,
33
- MemoType: memo.type ? convertStringToHex(memo.type) : undefined,
34
- MemoFormat: memo.format ? convertStringToHex(memo.format) : undefined,
35
- }),
36
- };
37
- }
38
- exports.convertMemo = convertMemo;
@@ -0,0 +1,9 @@
1
+ import { Amount, Memo } from "../types";
2
+ export type TransactionJSON = {
3
+ Account: string;
4
+ TransactionType: string;
5
+ Memos?: Memo[];
6
+ Flags?: number;
7
+ Fulfillment?: string;
8
+ [Field: string]: string | number | any[] | Amount | undefined;
9
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { Amount, FormattedIssuedCurrencyAmount } from "../types";
2
+ export declare function toRippledAmount(amount: Amount | FormattedIssuedCurrencyAmount): Amount;
3
+ export interface ClassicAccountAndTag {
4
+ classicAccount: string;
5
+ tag: number | false | undefined;
6
+ }
7
+ export declare function getClassicAccountAndTag(Account: string, expectedTag?: number): ClassicAccountAndTag;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClassicAccountAndTag = exports.toRippledAmount = void 0;
4
+ const ripple_address_codec_1 = require("ripple-address-codec");
5
+ const common_1 = require("../common");
6
+ const client_1 = require("../client");
7
+ function toRippledAmount(amount) {
8
+ if (typeof amount === "string")
9
+ return amount;
10
+ if (amount.currency === (0, client_1.getNativeCurrency)()) {
11
+ return (0, common_1.xrpToDrops)(amount.value);
12
+ }
13
+ if (amount.currency === "drops") {
14
+ return amount.value;
15
+ }
16
+ const issuer = amount.counterparty || amount.issuer;
17
+ return {
18
+ currency: amount.currency,
19
+ issuer,
20
+ value: amount.value,
21
+ };
22
+ }
23
+ exports.toRippledAmount = toRippledAmount;
24
+ function getClassicAccountAndTag(Account, expectedTag) {
25
+ if ((0, ripple_address_codec_1.isValidXAddress)(Account)) {
26
+ const classic = (0, ripple_address_codec_1.xAddressToClassicAddress)(Account);
27
+ if (expectedTag != null && classic.tag !== expectedTag) {
28
+ throw new Error("address includes a tag that does not match the tag specified in the transaction");
29
+ }
30
+ return {
31
+ classicAccount: classic.classicAddress,
32
+ tag: classic.tag,
33
+ };
34
+ }
35
+ else {
36
+ return {
37
+ classicAccount: Account,
38
+ tag: expectedTag,
39
+ };
40
+ }
41
+ }
42
+ exports.getClassicAccountAndTag = getClassicAccountAndTag;
package/lib/validator.js CHANGED
@@ -35,6 +35,7 @@ const elliptic_1 = __importDefault(require("elliptic"));
35
35
  const secp256k1 = new elliptic_1.default.ec("secp256k1");
36
36
  const ed25519 = new elliptic_1.default.eddsa("ed25519");
37
37
  const rippleKeypairs = __importStar(require("ripple-keypairs"));
38
+ const utils_1 = require("./parse/utils");
38
39
  const DER_PRIVATE_KEY_PREFIX = Buffer.from("302E020100300506032B657004220420", "hex");
39
40
  const DER_PUBLIC_KEY_PREFIX = Buffer.from("302A300506032B6570032100", "hex");
40
41
  const VALIDATOR_HEX_PREFIX_ED25519 = "ED";
@@ -42,7 +43,7 @@ const VALIDATOR_NODE_PUBLIC_KEY_PREFIX = "n";
42
43
  function classicAddressFromValidatorPK(pk) {
43
44
  let pubkey = pk;
44
45
  if (typeof pk === "string") {
45
- pubkey = (0, ripple_address_codec_1.decodeNodePublic)(pk);
46
+ pubkey = Buffer.from((0, ripple_address_codec_1.decodeNodePublic)(pk).buffer);
46
47
  }
47
48
  assert.ok(pubkey.length === 33);
48
49
  assert.ok(Crypto.getHashes().includes("sha256"));
@@ -87,7 +88,7 @@ function sign(message, secret) {
87
88
  }
88
89
  try {
89
90
  const decoded = ripple_address_codec_1.codec.decode(secret, { versions: [0x20] });
90
- secret = VALIDATOR_HEX_PREFIX_ED25519 + decoded.bytes.toString("hex");
91
+ secret = VALIDATOR_HEX_PREFIX_ED25519 + (0, utils_1.bytesToHex)(decoded.bytes.buffer);
91
92
  }
92
93
  catch (err) {
93
94
  }
@@ -100,7 +101,7 @@ function verify(message, signature, publicKey) {
100
101
  }
101
102
  if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
102
103
  const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
103
- publicKey = publicKeyBuffer.toString("hex").toUpperCase();
104
+ publicKey = (0, utils_1.bytesToHex)(publicKeyBuffer.buffer);
104
105
  }
105
106
  try {
106
107
  return rippleKeypairs.verify(message.toString("hex"), signature, publicKey);
@@ -113,7 +114,7 @@ exports.verify = verify;
113
114
  function verify2(message, signature, publicKey) {
114
115
  if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
115
116
  const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
116
- publicKey = publicKeyBuffer.toString("hex").toUpperCase();
117
+ publicKey = (0, utils_1.bytesToHex)(publicKeyBuffer.buffer);
117
118
  }
118
119
  if (publicKey.slice(0, 2) === VALIDATOR_HEX_PREFIX_ED25519) {
119
120
  const verifyKey = ed25519.keyFromPublic(publicKey.slice(2), "hex");
package/lib/wallet.d.ts CHANGED
@@ -7,6 +7,8 @@ interface GenerateAddressInterface {
7
7
  address: string;
8
8
  seed: string;
9
9
  }
10
+ export declare function isValidSecret(secret: string): boolean;
11
+ export declare function walletFromSeed(seed: string): Wallet;
10
12
  export declare function generateAddress(): GenerateAddressInterface;
11
13
  export declare function isValidClassicAddress(address: string): boolean;
12
14
  export declare function checksumClassicAddress(buffer: Buffer): Buffer;
@@ -14,5 +16,6 @@ export declare function signTransaction(wallet: Wallet, transaction: Transaction
14
16
  tx_blob: string;
15
17
  hash: string;
16
18
  };
19
+ export declare function verifyTransaction(wallet: Wallet, signedTransaction: Transaction | string): boolean;
17
20
  declare function hashSignedTx(tx: Transaction | string, definitions?: XrplDefinitionsBase, validateTx?: boolean): string;
18
21
  export { XrplDefinitionsBase, XrplDefinitions, DEFAULT_DEFINITIONS, hashSignedTx };