mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-22 21:25:49 +00:00
refactor: move everything out of the common folder (#1629)
* remove common/constants (all in models now) * remove common/txFlags (all in models now) * move ecdsa from src/common to src * move errors from src/common to src, export at top level
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
|||||||
NotConnectedError,
|
NotConnectedError,
|
||||||
ConnectionError,
|
ConnectionError,
|
||||||
XrplError,
|
XrplError,
|
||||||
} from '../common/errors'
|
} from '../errors'
|
||||||
import { BaseRequest } from '../models/methods/baseMethod'
|
import { BaseRequest } from '../models/methods/baseMethod'
|
||||||
|
|
||||||
import ExponentialBackoff from './backoff'
|
import ExponentialBackoff from './backoff'
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
import * as assert from 'assert'
|
import * as assert from 'assert'
|
||||||
import { EventEmitter } from 'events'
|
import { EventEmitter } from 'events'
|
||||||
|
|
||||||
import * as constants from '../common/constants'
|
import { ValidationError, XrplError } from '../errors'
|
||||||
import { ValidationError, XrplError } from '../common/errors'
|
import * as errors from '../errors'
|
||||||
import * as errors from '../common/errors'
|
|
||||||
import { txFlags } from '../common/txflags'
|
|
||||||
import {
|
import {
|
||||||
// account methods
|
// account methods
|
||||||
AccountChannelsRequest,
|
AccountChannelsRequest,
|
||||||
@@ -538,11 +536,6 @@ class Client extends EventEmitter {
|
|||||||
public generateFaucetWallet = prepend(generateFaucetWallet, this)
|
public generateFaucetWallet = prepend(generateFaucetWallet, this)
|
||||||
|
|
||||||
public errors = errors
|
public errors = errors
|
||||||
|
|
||||||
public txFlags = txFlags
|
|
||||||
public static txFlags = txFlags
|
|
||||||
public accountSetFlags = constants.AccountSetFlags
|
|
||||||
public static accountSetFlags = constants.AccountSetFlags
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Client, Connection }
|
export { Client, Connection }
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
import {
|
import { ResponseFormatError, RippledError, TimeoutError } from '../errors'
|
||||||
ResponseFormatError,
|
|
||||||
RippledError,
|
|
||||||
TimeoutError,
|
|
||||||
} from '../common/errors'
|
|
||||||
import { Response } from '../models/methods'
|
import { Response } from '../models/methods'
|
||||||
import { BaseRequest, ErrorResponse } from '../models/methods/baseMethod'
|
import { BaseRequest, ErrorResponse } from '../models/methods/baseMethod'
|
||||||
|
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
import { txFlagIndices } from './txflags'
|
|
||||||
|
|
||||||
// Ordering from https://developers.ripple.com/accountroot.html
|
|
||||||
const accountRootFlags = {
|
|
||||||
// lsfDefaultRipple:
|
|
||||||
// Enable rippling on trust lines by default.
|
|
||||||
// Required for issuing addresses; discouraged for others.
|
|
||||||
DefaultRipple: 0x00800000,
|
|
||||||
|
|
||||||
// lsfDepositAuth:
|
|
||||||
// Require account to auth deposits.
|
|
||||||
// This account can only receive funds from transactions it sends,
|
|
||||||
// or preauthorized accounts.
|
|
||||||
DepositAuth: 0x01000000,
|
|
||||||
|
|
||||||
// lsfDisableMaster:
|
|
||||||
// Force regular key.
|
|
||||||
// Disallows use of the master key.
|
|
||||||
DisableMaster: 0x00100000,
|
|
||||||
|
|
||||||
// lsfDisallowXRP:
|
|
||||||
// Disallow sending XRP.
|
|
||||||
// Not enforced by rippled; client applications should check.
|
|
||||||
DisallowXRP: 0x00080000,
|
|
||||||
|
|
||||||
// lsfGlobalFreeze:
|
|
||||||
// Trustlines globally frozen.
|
|
||||||
GlobalFreeze: 0x00400000,
|
|
||||||
|
|
||||||
// lsfNoFreeze:
|
|
||||||
// Permanently disallowed freezing trustlines.
|
|
||||||
// Once enabled, cannot be disabled.
|
|
||||||
NoFreeze: 0x00200000,
|
|
||||||
|
|
||||||
// lsfPasswordSpent:
|
|
||||||
// Password set fee is spent.
|
|
||||||
// The account has used its free SetRegularKey transaction.
|
|
||||||
PasswordSpent: 0x00010000,
|
|
||||||
|
|
||||||
// lsfRequireAuth:
|
|
||||||
// Require authorization to hold IOUs (issuances).
|
|
||||||
RequireAuth: 0x00040000,
|
|
||||||
|
|
||||||
// lsfRequireDestTag:
|
|
||||||
// Require a DestinationTag for incoming payments.
|
|
||||||
RequireDestTag: 0x00020000,
|
|
||||||
}
|
|
||||||
|
|
||||||
const AccountFlags = {
|
|
||||||
passwordSpent: accountRootFlags.PasswordSpent,
|
|
||||||
requireDestinationTag: accountRootFlags.RequireDestTag,
|
|
||||||
requireAuthorization: accountRootFlags.RequireAuth,
|
|
||||||
depositAuth: accountRootFlags.DepositAuth,
|
|
||||||
disallowIncomingXRP: accountRootFlags.DisallowXRP,
|
|
||||||
disableMasterKey: accountRootFlags.DisableMaster,
|
|
||||||
noFreeze: accountRootFlags.NoFreeze,
|
|
||||||
globalFreeze: accountRootFlags.GlobalFreeze,
|
|
||||||
defaultRipple: accountRootFlags.DefaultRipple,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Settings {
|
|
||||||
passwordSpent?: boolean
|
|
||||||
requireDestinationTag?: boolean
|
|
||||||
requireAuthorization?: boolean
|
|
||||||
depositAuth?: boolean
|
|
||||||
disallowIncomingXRP?: boolean
|
|
||||||
disableMasterKey?: boolean
|
|
||||||
noFreeze?: boolean
|
|
||||||
globalFreeze?: boolean
|
|
||||||
defaultRipple?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const AccountSetFlags = {
|
|
||||||
requireDestinationTag: txFlagIndices.AccountSet.asfRequireDest,
|
|
||||||
requireAuthorization: txFlagIndices.AccountSet.asfRequireAuth,
|
|
||||||
depositAuth: txFlagIndices.AccountSet.asfDepositAuth,
|
|
||||||
disallowIncomingXRP: txFlagIndices.AccountSet.asfDisallowXRP,
|
|
||||||
disableMasterKey: txFlagIndices.AccountSet.asfDisableMaster,
|
|
||||||
enableTransactionIDTracking: txFlagIndices.AccountSet.asfAccountTxnID,
|
|
||||||
noFreeze: txFlagIndices.AccountSet.asfNoFreeze,
|
|
||||||
globalFreeze: txFlagIndices.AccountSet.asfGlobalFreeze,
|
|
||||||
defaultRipple: txFlagIndices.AccountSet.asfDefaultRipple,
|
|
||||||
}
|
|
||||||
|
|
||||||
const AccountFields = {
|
|
||||||
EmailHash: {
|
|
||||||
name: 'emailHash',
|
|
||||||
encoding: 'hex',
|
|
||||||
length: 32,
|
|
||||||
defaults: '00000000000000000000000000000000',
|
|
||||||
},
|
|
||||||
WalletLocator: { name: 'walletLocator' },
|
|
||||||
MessageKey: { name: 'messageKey' },
|
|
||||||
Domain: { name: 'domain', encoding: 'hex' },
|
|
||||||
TransferRate: { name: 'transferRate', defaults: 0, shift: 9 },
|
|
||||||
TickSize: { name: 'tickSize', defaults: 0 },
|
|
||||||
}
|
|
||||||
|
|
||||||
export { AccountFields, AccountSetFlags, AccountFlags }
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
const txFlags = {
|
|
||||||
// Universal flags can apply to any transaction type
|
|
||||||
Universal: {
|
|
||||||
FullyCanonicalSig: 0x80000000,
|
|
||||||
},
|
|
||||||
|
|
||||||
AccountSet: {
|
|
||||||
RequireDestTag: 0x00010000,
|
|
||||||
OptionalDestTag: 0x00020000,
|
|
||||||
RequireAuth: 0x00040000,
|
|
||||||
OptionalAuth: 0x00080000,
|
|
||||||
DisallowXRP: 0x00100000,
|
|
||||||
AllowXRP: 0x00200000,
|
|
||||||
},
|
|
||||||
|
|
||||||
TrustSet: {
|
|
||||||
SetAuth: 0x00010000,
|
|
||||||
NoRipple: 0x00020000,
|
|
||||||
SetNoRipple: 0x00020000,
|
|
||||||
ClearNoRipple: 0x00040000,
|
|
||||||
SetFreeze: 0x00100000,
|
|
||||||
ClearFreeze: 0x00200000,
|
|
||||||
},
|
|
||||||
|
|
||||||
OfferCreate: {
|
|
||||||
Passive: 0x00010000,
|
|
||||||
ImmediateOrCancel: 0x00020000,
|
|
||||||
FillOrKill: 0x00040000,
|
|
||||||
Sell: 0x00080000,
|
|
||||||
},
|
|
||||||
|
|
||||||
Payment: {
|
|
||||||
NoRippleDirect: 0x00010000,
|
|
||||||
PartialPayment: 0x00020000,
|
|
||||||
LimitQuality: 0x00040000,
|
|
||||||
},
|
|
||||||
|
|
||||||
PaymentChannelClaim: {
|
|
||||||
Renew: 0x00010000,
|
|
||||||
Close: 0x00020000,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following are integer (as opposed to bit) flags
|
|
||||||
// that can be set for particular transactions in the
|
|
||||||
// SetFlag or ClearFlag field
|
|
||||||
const txFlagIndices = {
|
|
||||||
AccountSet: {
|
|
||||||
asfRequireDest: 1,
|
|
||||||
asfRequireAuth: 2,
|
|
||||||
asfDisallowXRP: 3,
|
|
||||||
asfDisableMaster: 4,
|
|
||||||
asfAccountTxnID: 5,
|
|
||||||
asfNoFreeze: 6,
|
|
||||||
asfGlobalFreeze: 7,
|
|
||||||
asfDefaultRipple: 8,
|
|
||||||
asfDepositAuth: 9,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export { txFlags, txFlagIndices }
|
|
||||||
@@ -9,4 +9,6 @@ export * from './models/transactions'
|
|||||||
|
|
||||||
export * from './utils'
|
export * from './utils'
|
||||||
|
|
||||||
|
export * from './errors'
|
||||||
|
|
||||||
export { default as Wallet } from './wallet'
|
export { default as Wallet } from './wallet'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateAccountSet */
|
/* eslint-disable complexity -- Necessary for validateAccountSet */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateCheckCash */
|
/* eslint-disable complexity -- Necessary for validateCheckCash */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
import { Amount } from '../common'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction, isAmount } from './common'
|
import { BaseTransaction, validateBaseTransaction, isAmount } from './common'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateCheckCreate */
|
/* eslint-disable complexity -- Necessary for validateCheckCreate */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
import { Amount } from '../common'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable max-lines-per-function -- Necessary for validateBaseTransaction */
|
/* eslint-disable max-lines-per-function -- Necessary for validateBaseTransaction */
|
||||||
/* eslint-disable complexity -- Necessary for validateBaseTransaction */
|
/* eslint-disable complexity -- Necessary for validateBaseTransaction */
|
||||||
/* eslint-disable max-statements -- Necessary for validateBaseTransaction */
|
/* eslint-disable max-statements -- Necessary for validateBaseTransaction */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Memo, Signer } from '../common'
|
import { Memo, Signer } from '../common'
|
||||||
import { onlyHasFields } from '../utils'
|
import { onlyHasFields } from '../utils'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateDepositPreauth */
|
/* eslint-disable complexity -- Necessary for validateDepositPreauth */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateEscrowCreate */
|
/* eslint-disable complexity -- Necessary for validateEscrowCreate */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateOfferCreate */
|
/* eslint-disable complexity -- Necessary for validateOfferCreate */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
import { Amount } from '../common'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable max-statements -- Necessary for validatePayment */
|
/* eslint-disable max-statements -- Necessary for validatePayment */
|
||||||
/* eslint-disable complexity -- Necessary for validatePayment */
|
/* eslint-disable complexity -- Necessary for validatePayment */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount, Path } from '../common'
|
import { Amount, Path } from '../common'
|
||||||
import { isFlagEnabled } from '../utils'
|
import { isFlagEnabled } from '../utils'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validatePaymentChannelClaim */
|
/* eslint-disable complexity -- Necessary for validatePaymentChannelClaim */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
|
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { SignerEntry } from '../common'
|
import { SignerEntry } from '../common'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { encode, decode } from 'ripple-binary-codec'
|
import { encode, decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { setTransactionFlagsToNumber } from '../utils'
|
import { setTransactionFlagsToNumber } from '../utils'
|
||||||
|
|
||||||
import { AccountDelete, validateAccountDelete } from './accountDelete'
|
import { AccountDelete, validateAccountDelete } from './accountDelete'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
import { Amount } from '../common'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-param-reassign -- param reassign is safe */
|
/* eslint-disable no-param-reassign -- param reassign is safe */
|
||||||
/* eslint-disable no-bitwise -- flags require bitwise operations */
|
/* eslint-disable no-bitwise -- flags require bitwise operations */
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
// eslint-disable-next-line import/no-cycle -- cycle is safe
|
// eslint-disable-next-line import/no-cycle -- cycle is safe
|
||||||
import {
|
import {
|
||||||
AccountSetFlagsInterface,
|
AccountSetFlagsInterface,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import BigNumber from 'bignumber.js'
|
|||||||
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
||||||
|
|
||||||
import type { Client } from '..'
|
import type { Client } from '..'
|
||||||
import { ValidationError } from '../common/errors'
|
import { ValidationError } from '../errors'
|
||||||
import { AccountInfoRequest, LedgerRequest } from '../models/methods'
|
import { AccountInfoRequest, LedgerRequest } from '../models/methods'
|
||||||
import { Transaction } from '../models/transactions'
|
import { Transaction } from '../models/transactions'
|
||||||
import { setTransactionFlagsToNumber } from '../models/utils'
|
import { setTransactionFlagsToNumber } from '../models/utils'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { decode, encode } from 'ripple-binary-codec'
|
import { decode, encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import type { Client, SubmitRequest, SubmitResponse, Wallet } from '..'
|
import type { Client, SubmitRequest, SubmitResponse, Wallet } from '..'
|
||||||
import { ValidationError } from '../common/errors'
|
import { ValidationError } from '../errors'
|
||||||
import { Transaction } from '../models/transactions'
|
import { Transaction } from '../models/transactions'
|
||||||
import { sign } from '../wallet/signer'
|
import { sign } from '../wallet/signer'
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { decodeAccountID } from 'ripple-address-codec'
|
|||||||
import binary from 'ripple-binary-codec'
|
import binary from 'ripple-binary-codec'
|
||||||
import { JsonObject } from 'ripple-binary-codec/dist/types/serialized-type'
|
import { JsonObject } from 'ripple-binary-codec/dist/types/serialized-type'
|
||||||
|
|
||||||
import { ValidationError } from '../common/errors'
|
import { ValidationError } from '../errors'
|
||||||
import { computeSignedTransactionHash } from '../utils/hashes'
|
import { computeSignedTransactionHash } from '../utils/hashes'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { classicAddressToXAddress } from 'ripple-address-codec'
|
import { classicAddressToXAddress } from 'ripple-address-codec'
|
||||||
import keypairs from 'ripple-keypairs'
|
import keypairs from 'ripple-keypairs'
|
||||||
|
|
||||||
import ECDSA from '../common/ecdsa'
|
import ECDSA from '../ecdsa'
|
||||||
import { UnexpectedError } from '../common/errors'
|
import { UnexpectedError } from '../errors'
|
||||||
|
|
||||||
export interface GeneratedAddress {
|
export interface GeneratedAddress {
|
||||||
xAddress: string
|
xAddress: string
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { decode, encode } from 'ripple-binary-codec'
|
import { decode, encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { ValidationError } from '../../common/errors'
|
import { ValidationError } from '../../errors'
|
||||||
import type { Ledger } from '../../models/ledger'
|
import type { Ledger } from '../../models/ledger'
|
||||||
import { LedgerEntry } from '../../models/ledger'
|
import { LedgerEntry } from '../../models/ledger'
|
||||||
import { Transaction } from '../../models/transactions'
|
import { Transaction } from '../../models/transactions'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
|
|
||||||
import { ValidationError } from '../common/errors'
|
import { ValidationError } from '../errors'
|
||||||
|
|
||||||
const DROPS_PER_XRP = 1000000.0
|
const DROPS_PER_XRP = 1000000.0
|
||||||
const MAX_FRACTION_LENGTH = 6
|
const MAX_FRACTION_LENGTH = 6
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { request as httpsRequest, RequestOptions } from 'https'
|
|||||||
import { isValidClassicAddress } from 'ripple-address-codec'
|
import { isValidClassicAddress } from 'ripple-address-codec'
|
||||||
|
|
||||||
import type { Client } from '..'
|
import type { Client } from '..'
|
||||||
import { RippledError, XRPLFaucetError } from '../common/errors'
|
import { RippledError, XRPLFaucetError } from '../errors'
|
||||||
import { GeneratedAddress } from '../utils/generateAddress'
|
import { GeneratedAddress } from '../utils/generateAddress'
|
||||||
|
|
||||||
import Wallet from '.'
|
import Wallet from '.'
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import {
|
|||||||
sign,
|
sign,
|
||||||
} from 'ripple-keypairs'
|
} from 'ripple-keypairs'
|
||||||
|
|
||||||
import ECDSA from '../common/ecdsa'
|
import ECDSA from '../ecdsa'
|
||||||
import { ValidationError } from '../common/errors'
|
import { ValidationError } from '../errors'
|
||||||
import { Transaction } from '../models/transactions'
|
import { Transaction } from '../models/transactions'
|
||||||
|
|
||||||
const DEFAULT_ALGORITHM: ECDSA = ECDSA.ed25519
|
const DEFAULT_ALGORITHM: ECDSA = ECDSA.ed25519
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
} from 'ripple-binary-codec'
|
} from 'ripple-binary-codec'
|
||||||
import { sign as signWithKeypair, verify } from 'ripple-keypairs'
|
import { sign as signWithKeypair, verify } from 'ripple-keypairs'
|
||||||
|
|
||||||
import { ValidationError } from '../common/errors'
|
import { ValidationError } from '../errors'
|
||||||
import { Signer } from '../models/common'
|
import { Signer } from '../models/common'
|
||||||
import { Transaction } from '../models/transactions'
|
import { Transaction } from '../models/transactions'
|
||||||
import { validateBaseTransaction } from '../models/transactions/common'
|
import { validateBaseTransaction } from '../models/transactions/common'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
import { ValidationError } from 'xrpl-local'
|
||||||
import { Transaction } from 'xrpl-local/models/transactions'
|
import { Transaction } from 'xrpl-local/models/transactions'
|
||||||
|
|
||||||
import rippled from '../fixtures/rippled'
|
import rippled from '../fixtures/rippled'
|
||||||
|
|||||||
@@ -3,17 +3,16 @@ import net from 'net'
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
import { Client } from 'xrpl-local'
|
|
||||||
import { Connection } from 'xrpl-local/client'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
Client,
|
||||||
ConnectionError,
|
ConnectionError,
|
||||||
DisconnectedError,
|
DisconnectedError,
|
||||||
NotConnectedError,
|
NotConnectedError,
|
||||||
ResponseFormatError,
|
ResponseFormatError,
|
||||||
XrplError,
|
XrplError,
|
||||||
TimeoutError,
|
TimeoutError,
|
||||||
} from '../src/common/errors'
|
} from 'xrpl-local'
|
||||||
|
import { Connection } from 'xrpl-local/client'
|
||||||
|
|
||||||
import rippled from './fixtures/rippled'
|
import rippled from './fixtures/rippled'
|
||||||
import { setupClient, teardownClient } from './setupClient'
|
import { setupClient, teardownClient } from './setupClient'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { RippledError } from '../src/common/errors'
|
import { RippledError } from 'xrpl-local'
|
||||||
|
|
||||||
import { setupClient, teardownClient } from './setupClient'
|
import { setupClient, teardownClient } from './setupClient'
|
||||||
import { assertRejects } from './testUtils'
|
import { assertRejects } from './testUtils'
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateAccountDelete, validate } from 'xrpl-local'
|
import { validateAccountDelete, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountDelete Transaction Verification Testing.
|
* AccountDelete Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateAccountSet, validate } from 'xrpl-local'
|
import { validateAccountSet, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountSet Transaction Verification Testing.
|
* AccountSet Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
import { ValidationError } from 'xrpl-local'
|
||||||
import { validateBaseTransaction } from 'xrpl-local/models/transactions/common'
|
import { validateBaseTransaction } from 'xrpl-local/models/transactions/common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateCheckCancel, validate } from 'xrpl-local'
|
import { validateCheckCancel, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CheckCancel Transaction Verification Testing.
|
* CheckCancel Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateCheckCash, validate } from 'xrpl-local'
|
import { validateCheckCash, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CheckCash Transaction Verification Testing.
|
* CheckCash Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateCheckCreate, validate } from 'xrpl-local'
|
import { validateCheckCreate, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CheckCreate Transaction Verification Testing.
|
* CheckCreate Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateDepositPreauth, validate } from 'xrpl-local'
|
import { validateDepositPreauth, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DepositPreauth Transaction Verification Testing.
|
* DepositPreauth Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateEscrowCancel, validate } from 'xrpl-local'
|
import { validateEscrowCancel, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transaction Verification Testing.
|
* Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateEscrowCreate, validate } from 'xrpl-local'
|
import { validateEscrowCreate, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EscrowCreate Transaction Verification Testing.
|
* EscrowCreate Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateEscrowFinish, validate } from 'xrpl-local'
|
import { validateEscrowFinish, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EscrowFinish Transaction Verification Testing.
|
* EscrowFinish Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateOfferCancel, validate } from 'xrpl-local'
|
import { validateOfferCancel, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OfferCancel Transaction Verification Testing.
|
* OfferCancel Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateOfferCreate, validate } from 'xrpl-local'
|
import { validateOfferCreate, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OfferCreate Transaction Verification Testing.
|
* OfferCreate Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validatePayment, validate, PaymentTransactionFlags } from 'xrpl-local'
|
import {
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
validatePayment,
|
||||||
|
validate,
|
||||||
|
PaymentTransactionFlags,
|
||||||
|
ValidationError,
|
||||||
|
} from 'xrpl-local'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentTransaction Verification Testing.
|
* PaymentTransaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validatePaymentChannelClaim, validate } from 'xrpl-local'
|
import {
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
validatePaymentChannelClaim,
|
||||||
|
validate,
|
||||||
|
ValidationError,
|
||||||
|
} from 'xrpl-local'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentChannelClaim Transaction Verification Testing.
|
* PaymentChannelClaim Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validatePaymentChannelCreate, validate } from 'xrpl-local'
|
import {
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
validatePaymentChannelCreate,
|
||||||
|
validate,
|
||||||
|
ValidationError,
|
||||||
|
} from 'xrpl-local'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentChannelCreate Transaction Verification Testing.
|
* PaymentChannelCreate Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validatePaymentChannelFund, validate } from 'xrpl-local'
|
import {
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
validatePaymentChannelFund,
|
||||||
|
validate,
|
||||||
|
ValidationError,
|
||||||
|
} from 'xrpl-local'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentChannelFund Transaction Verification Testing.
|
* PaymentChannelFund Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validate, validateSetRegularKey } from 'xrpl-local'
|
import { validate, validateSetRegularKey, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SetRegularKey Transaction Verification Testing.
|
* SetRegularKey Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validate, validateSignerListSet } from 'xrpl-local'
|
import { validate, validateSignerListSet, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SignerListSet Transaction Verification Testing.
|
* SignerListSet Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateTicketCreate, validate } from 'xrpl-local'
|
import { validateTicketCreate, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TicketCreate Transaction Verification Testing.
|
* TicketCreate Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { validateTrustSet, validate } from 'xrpl-local'
|
import { validateTrustSet, validate, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TrustSet Transaction Verification Testing.
|
* TrustSet Transaction Verification Testing.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { ValidationError, XrplError } from '../../src/common/errors'
|
import { ValidationError, XrplError } from 'xrpl-local'
|
||||||
import { computeLedgerHash } from '../../src/utils'
|
import { computeLedgerHash } from '../../src/utils'
|
||||||
import requests from '../fixtures/requests'
|
import requests from '../fixtures/requests'
|
||||||
import responses from '../fixtures/responses'
|
import responses from '../fixtures/responses'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import ECDSA from '../../src/common/ecdsa'
|
import ECDSA from '../../src/ecdsa'
|
||||||
import { UnexpectedError } from '../../src/common/errors'
|
import { UnexpectedError } from 'xrpl-local'
|
||||||
import {
|
import {
|
||||||
generateXAddress,
|
generateXAddress,
|
||||||
GenerateAddressOptions,
|
GenerateAddressOptions,
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import path from 'path'
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { encode } from 'ripple-binary-codec'
|
import { encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { OfferCreate, Transaction } from 'xrpl-local'
|
import { OfferCreate, Transaction, ValidationError } from 'xrpl-local'
|
||||||
import { ValidationError } from 'xrpl-local/common/errors'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
computeStateTreeHash,
|
computeStateTreeHash,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { decode } from 'ripple-binary-codec/dist'
|
import { decode } from 'ripple-binary-codec/dist'
|
||||||
|
|
||||||
import ECDSA from '../../src/common/ecdsa'
|
import { Transaction } from 'xrpl-local'
|
||||||
import { Transaction } from '../../src/models/transactions'
|
import ECDSA from 'xrpl-local/ecdsa'
|
||||||
import Wallet from '../../src/wallet'
|
import Wallet from 'xrpl-local/wallet'
|
||||||
|
|
||||||
import requests from '../fixtures/requests'
|
import requests from '../fixtures/requests'
|
||||||
import responses from '../fixtures/responses'
|
import responses from '../fixtures/responses'
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,14 @@ import { assert } from 'chai'
|
|||||||
import { decode, encode } from 'ripple-binary-codec/dist'
|
import { decode, encode } from 'ripple-binary-codec/dist'
|
||||||
import { JsonObject } from 'ripple-binary-codec/dist/types/serialized-type'
|
import { JsonObject } from 'ripple-binary-codec/dist/types/serialized-type'
|
||||||
|
|
||||||
import { Transaction } from 'xrpl-local'
|
import { Transaction, ValidationError } from 'xrpl-local'
|
||||||
|
import Wallet from 'xrpl-local/wallet'
|
||||||
import { ValidationError } from '../../src/common/errors'
|
|
||||||
import Wallet from '../../src/wallet'
|
|
||||||
import {
|
import {
|
||||||
sign,
|
sign,
|
||||||
authorizeChannel,
|
authorizeChannel,
|
||||||
multisign,
|
multisign,
|
||||||
verifySignature,
|
verifySignature,
|
||||||
} from '../../src/wallet/signer'
|
} from 'xrpl-local/wallet/signer'
|
||||||
|
|
||||||
const publicKey =
|
const publicKey =
|
||||||
'030E58CDD076E798C84755590AAF6237CA8FAE821070A59F648B517A30DC6F589D'
|
'030E58CDD076E798C84755590AAF6237CA8FAE821070A59F648B517A30DC6F589D'
|
||||||
|
|||||||
Reference in New Issue
Block a user