@bithomp/xrpl-api 2.7.14 → 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.
- package/lib/common/errors/index.d.ts +2 -2
- package/lib/common/errors/index.js +3 -3
- package/lib/common/errors/validation_error.d.ts +2 -2
- package/lib/common/errors/validation_error.js +2 -2
- package/lib/common/errors/xrpl_api_error.d.ts +9 -0
- package/lib/common/errors/xrpl_api_error.js +28 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.js +17 -1
- package/lib/ledger/account_info.js +7 -0
- package/lib/ledger/account_offers.d.ts +1 -1
- package/lib/ledger/ledger.d.ts +1 -1
- package/lib/ledger/transaction.d.ts +3 -3
- package/lib/ledger/transaction.js +4 -4
- package/lib/models/account_info.d.ts +1 -1
- package/lib/models/account_lines.d.ts +2 -0
- package/lib/models/account_nfts.js +2 -1
- package/lib/models/account_object.d.ts +1 -1
- package/lib/models/account_object.js +9 -2
- package/lib/models/account_offers.d.ts +9 -0
- package/lib/models/account_offers.js +2 -0
- package/lib/models/account_uritokens.d.ts +1 -1
- package/lib/models/path_find.d.ts +11 -0
- package/lib/models/path_find.js +2 -0
- package/lib/models/transaction.d.ts +1 -1
- package/lib/models/vl.js +1 -1
- package/lib/parse/index.d.ts +1 -0
- package/lib/parse/index.js +2 -1
- package/lib/parse/ledger/account-order.d.ts +1 -1
- package/lib/parse/ledger/account-order.js +1 -1
- package/lib/parse/ledger/account-trustline.d.ts +1 -1
- package/lib/parse/ledger/amount.d.ts +1 -1
- package/lib/parse/ledger/currency-amount.d.ts +1 -1
- package/lib/parse/ledger/emit_details.d.ts +1 -1
- package/lib/parse/ledger/import.d.ts +1 -1
- package/lib/parse/ledger/index.d.ts +1 -1
- package/lib/parse/ledger/index.js +2 -2
- package/lib/parse/ledger/ledger.d.ts +1 -1
- package/lib/parse/ledger/memos.d.ts +3 -2
- package/lib/parse/ledger/memos.js +12 -1
- package/lib/parse/ledger/nftoken-flags.d.ts +1 -1
- package/lib/parse/ledger/nftoken-flags.js +1 -1
- package/lib/parse/ledger/nftoken-offer-flags.d.ts +1 -1
- package/lib/parse/ledger/nftoken-offer-flags.js +1 -1
- package/lib/parse/ledger/orderbook-order.d.ts +7 -2
- package/lib/parse/ledger/orderbook-order.js +1 -1
- package/lib/parse/ledger/pathfind.d.ts +3 -3
- package/lib/parse/ledger/ripple-amount.d.ts +1 -1
- package/lib/parse/ledger/uritoken-flags.d.ts +1 -1
- package/lib/parse/ledger/uritoken-flags.js +1 -1
- package/lib/parse/outcome/balance_changes.js +1 -1
- package/lib/parse/outcome/channel_changes.js +1 -1
- package/lib/parse/outcome/escrow_changes.d.ts +1 -1
- package/lib/parse/outcome/escrow_changes.js +3 -4
- package/lib/parse/outcome/locked_balance_changes.js +1 -1
- package/lib/parse/outcome/orderbook_changes.js +1 -1
- package/lib/parse/outcome/unl_report_changes.js +1 -1
- package/lib/parse/outcome.d.ts +1 -1
- package/lib/parse/specification/account-delete.d.ts +1 -1
- package/lib/parse/specification/account-delete.js +13 -7
- package/lib/parse/specification/amendment.d.ts +1 -1
- package/lib/parse/specification/amendment.js +2 -5
- package/lib/parse/specification/check-cancel.d.ts +1 -1
- package/lib/parse/specification/check-cancel.js +2 -5
- package/lib/parse/specification/check-cash.d.ts +1 -1
- package/lib/parse/specification/check-cash.js +2 -2
- package/lib/parse/specification/check-create.d.ts +1 -1
- package/lib/parse/specification/check-create.js +13 -4
- package/lib/parse/specification/deposit-preauth.d.ts +1 -1
- package/lib/parse/specification/deposit-preauth.js +2 -5
- package/lib/parse/specification/escrow-cancel.d.ts +1 -1
- package/lib/parse/specification/escrow-cancel.js +2 -5
- package/lib/parse/specification/escrow-create.d.ts +1 -1
- package/lib/parse/specification/escrow-create.js +2 -5
- package/lib/parse/specification/escrow-finish.d.ts +1 -1
- package/lib/parse/specification/escrow-finish.js +2 -5
- package/lib/parse/specification/fee-update.d.ts +1 -1
- package/lib/parse/specification/fee-update.js +2 -2
- package/lib/parse/specification/import.d.ts +1 -1
- package/lib/parse/specification/import.js +2 -5
- package/lib/parse/specification/invoke.d.ts +1 -1
- package/lib/parse/specification/invoke.js +2 -5
- package/lib/parse/specification/nftoken-accept-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-accept-offer.js +2 -5
- package/lib/parse/specification/nftoken-burn.d.ts +1 -1
- package/lib/parse/specification/nftoken-burn.js +2 -5
- package/lib/parse/specification/nftoken-cancel-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-cancel-offer.js +2 -5
- package/lib/parse/specification/nftoken-create-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-create-offer.js +12 -3
- package/lib/parse/specification/nftoken-mint.d.ts +1 -1
- package/lib/parse/specification/nftoken-mint.js +2 -2
- package/lib/parse/specification/offer-cancel.d.ts +1 -1
- package/lib/parse/specification/offer-cancel.js +2 -5
- package/lib/parse/specification/offer-create.d.ts +1 -1
- package/lib/parse/specification/offer-create.js +2 -2
- package/lib/parse/specification/payment-channel-claim.d.ts +1 -1
- package/lib/parse/specification/payment-channel-claim.js +2 -2
- package/lib/parse/specification/payment-channel-create.d.ts +1 -1
- package/lib/parse/specification/payment-channel-create.js +13 -5
- package/lib/parse/specification/payment-channel-fund.d.ts +1 -1
- package/lib/parse/specification/payment-channel-fund.js +2 -2
- package/lib/parse/specification/payment.d.ts +1 -1
- package/lib/parse/specification/payment.js +3 -7
- package/lib/parse/specification/remit.d.ts +1 -1
- package/lib/parse/specification/remit.js +2 -2
- package/lib/parse/specification/settings.js +2 -2
- package/lib/parse/specification/ticket-create.d.ts +1 -1
- package/lib/parse/specification/ticket-create.js +2 -5
- package/lib/parse/specification/trustline.d.ts +1 -1
- package/lib/parse/specification/trustline.js +2 -5
- package/lib/parse/specification/unl-report.d.ts +1 -1
- package/lib/parse/specification/unl-report.js +2 -5
- package/lib/parse/specification/uritoken-burn.d.ts +1 -1
- package/lib/parse/specification/uritoken-burn.js +2 -5
- package/lib/parse/specification/uritoken-buy.d.ts +1 -1
- package/lib/parse/specification/uritoken-buy.js +2 -5
- package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +1 -1
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -5
- package/lib/parse/specification/uritoken-create-sell-offer.d.ts +2 -2
- package/lib/parse/specification/uritoken-create-sell-offer.js +12 -6
- package/lib/parse/specification/uritoken-mint.d.ts +3 -3
- package/lib/parse/specification/uritoken-mint.js +14 -5
- package/lib/parse/transaction.d.ts +19 -19
- package/lib/parse/utils.d.ts +10 -1
- package/lib/parse/utils.js +49 -1
- package/lib/types/account.d.ts +15 -0
- package/lib/types/account.js +2 -0
- package/lib/types/adjustments.d.ts +16 -0
- package/lib/types/adjustments.js +2 -0
- package/lib/types/amendments.d.ts +4 -0
- package/lib/types/amendments.js +2 -0
- package/lib/types/checks.d.ts +18 -0
- package/lib/types/checks.js +2 -0
- package/lib/types/deposits.d.ts +5 -0
- package/lib/types/deposits.js +2 -0
- package/lib/types/emit_details.d.ts +7 -0
- package/lib/types/emit_details.js +2 -0
- package/lib/types/escrows.d.ts +23 -0
- package/lib/types/escrows.js +2 -0
- package/lib/types/fees.d.ts +7 -0
- package/lib/types/fees.js +2 -0
- package/lib/types/flags.d.ts +5 -0
- package/lib/types/flags.js +8 -0
- package/lib/types/hooks.d.ts +14 -0
- package/lib/types/hooks.js +2 -0
- package/lib/types/import.d.ts +23 -0
- package/lib/types/import.js +2 -0
- package/lib/types/index.d.ts +24 -1
- package/lib/types/index.js +38 -0
- package/lib/types/invoke.d.ts +6 -0
- package/lib/types/invoke.js +2 -0
- package/lib/types/ledger.d.ts +45 -0
- package/lib/types/ledger.js +2 -0
- package/lib/types/ledger_data.d.ts +10 -0
- package/lib/types/ledger_data.js +2 -0
- package/lib/types/ledger_entries.d.ts +158 -0
- package/lib/types/ledger_entries.js +2 -0
- package/lib/types/memos.d.ts +12 -0
- package/lib/types/memos.js +2 -0
- package/lib/types/nftokens.d.ts +50 -0
- package/lib/types/nftokens.js +13 -0
- package/lib/types/offers.d.ts +15 -0
- package/lib/types/offers.js +2 -0
- package/lib/types/outcome.d.ts +33 -0
- package/lib/types/outcome.js +2 -0
- package/lib/types/path_find.d.ts +28 -0
- package/lib/types/path_find.js +2 -0
- package/lib/types/payment_channels.d.ts +25 -0
- package/lib/types/payment_channels.js +2 -0
- package/lib/types/payments.d.ts +11 -0
- package/lib/types/payments.js +2 -0
- package/lib/types/queue_data.d.ts +15 -0
- package/lib/types/queue_data.js +2 -0
- package/lib/types/remits.d.ts +18 -0
- package/lib/types/remits.js +2 -0
- package/lib/types/settings.d.ts +34 -0
- package/lib/types/settings.js +2 -0
- package/lib/types/signers.d.ts +6 -0
- package/lib/types/signers.js +2 -0
- package/lib/types/specification.d.ts +4 -0
- package/lib/types/specification.js +2 -0
- package/lib/types/tickets.d.ts +4 -0
- package/lib/types/tickets.js +2 -0
- package/lib/types/transactions.d.ts +21 -0
- package/lib/types/transactions.js +2 -0
- package/lib/types/trustlines.d.ts +38 -0
- package/lib/types/trustlines.js +2 -0
- package/lib/types/unl_reports.d.ts +7 -0
- package/lib/types/unl_reports.js +2 -0
- package/lib/types/uri_tokens.d.ts +7 -0
- package/lib/types/uri_tokens.js +6 -0
- package/lib/types/uritokens.d.ts +39 -0
- package/lib/types/uritokens.js +6 -0
- package/lib/v1/common/types/objects/account.d.ts +2 -2
- package/lib/v1/common/types/objects/checks.d.ts +3 -2
- package/lib/v1/common/types/objects/nftokens.d.ts +3 -1
- package/lib/v1/common/types/objects/payment_channels.d.ts +3 -3
- package/lib/v1/common/types/objects/uritokens.d.ts +5 -2
- package/lib/v1/common/types/objects/uritokens.js +1 -1
- package/lib/v1/transaction/payment.d.ts +2 -2
- package/lib/v1/transaction/payment.js +9 -9
- package/lib/v1/transaction/types.d.ts +1 -34
- package/lib/v1/transaction/utils.d.ts +2 -3
- package/lib/v1/transaction/utils.js +19 -15
- package/lib/v1/types.d.ts +9 -0
- package/lib/v1/types.js +2 -0
- package/lib/v1/utils.d.ts +7 -0
- package/lib/v1/utils.js +42 -0
- package/lib/validator.js +5 -4
- package/lib/wallet.d.ts +3 -0
- package/lib/wallet.js +26 -1
- package/package.json +20 -20
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormattedBaseSpecification } from "./specification";
|
|
2
|
+
import { FormattedDestinationAddress, FormattedSourceAddress } from "./account";
|
|
3
|
+
import { Amount } from "./amounts";
|
|
4
|
+
import { URITokenFlagsKeysInterface } from "./uritokens";
|
|
5
|
+
export type FormattedRemitsSpecification = {
|
|
6
|
+
source: FormattedSourceAddress;
|
|
7
|
+
destination: FormattedDestinationAddress;
|
|
8
|
+
amounts?: Amount[];
|
|
9
|
+
uritokenIDs?: string[];
|
|
10
|
+
uritokenMint?: {
|
|
11
|
+
uri: string;
|
|
12
|
+
flags?: URITokenFlagsKeysInterface;
|
|
13
|
+
digest?: string;
|
|
14
|
+
};
|
|
15
|
+
blob?: string;
|
|
16
|
+
inform?: string;
|
|
17
|
+
invoiceID?: string;
|
|
18
|
+
} & FormattedBaseSpecification;
|
|
@@ -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,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,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,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,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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FormattedBaseSpecification } from "./specification";
|
|
2
2
|
import { FormattedIssuedCurrencyAmount } from "../../../../types";
|
|
3
3
|
export type FormattedAccountDeleteSpecification = {
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
+
source?: FormattedSourceAddress;
|
|
33
|
+
destination?: FormattedDestinationAddress;
|
|
31
34
|
} & FormattedBaseSpecification;
|
|
32
35
|
export type FormattedURITokenAcceptOfferSpecification = {
|
|
33
36
|
nftokenSellOffer?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransactionJSON } from "
|
|
2
|
-
import { Adjustment, MaxAdjustment, MinAdjustment, FormattedMemo } from "
|
|
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("
|
|
10
|
-
const
|
|
11
|
-
const
|
|
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,
|
|
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,
|
|
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(
|
|
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,
|
|
118
|
+
txJSON.SendMax = (0, utils_1.toRippledAmount)(sourceAmount);
|
|
119
119
|
if (isMinAdjustment(payment.destination)) {
|
|
120
|
-
txJSON.DeliverMin = (0,
|
|
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 "
|
|
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 {
|
|
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.
|
|
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;
|
package/lib/v1/types.js
ADDED
|
@@ -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;
|
package/lib/v1/utils.js
ADDED
|
@@ -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.
|
|
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 =
|
|
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 =
|
|
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 };
|