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:
Mayukha Vadari
2021-09-21 14:25:37 -04:00
parent 94a8c65200
commit 6eec7b0b77
67 changed files with 92 additions and 266 deletions

View File

@@ -1,6 +1,6 @@
import { assert } from 'chai'
import { ValidationError } from 'xrpl-local/common/errors'
import { ValidationError } from 'xrpl-local'
import { Transaction } from 'xrpl-local/models/transactions'
import rippled from '../fixtures/rippled'

View File

@@ -3,17 +3,16 @@ import net from 'net'
import { assert } from 'chai'
import _ from 'lodash'
import { Client } from 'xrpl-local'
import { Connection } from 'xrpl-local/client'
import {
Client,
ConnectionError,
DisconnectedError,
NotConnectedError,
ResponseFormatError,
XrplError,
TimeoutError,
} from '../src/common/errors'
} from 'xrpl-local'
import { Connection } from 'xrpl-local/client'
import rippled from './fixtures/rippled'
import { setupClient, teardownClient } from './setupClient'

View File

@@ -1,6 +1,6 @@
import { assert } from 'chai'
import { RippledError } from '../src/common/errors'
import { RippledError } from 'xrpl-local'
import { setupClient, teardownClient } from './setupClient'
import { assertRejects } from './testUtils'

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateAccountDelete, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateAccountDelete, validate, ValidationError } from 'xrpl-local'
/**
* AccountDelete Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateAccountSet, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateAccountSet, validate, ValidationError } from 'xrpl-local'
/**
* AccountSet Transaction Verification Testing.

View File

@@ -1,6 +1,6 @@
import { assert } from 'chai'
import { ValidationError } from 'xrpl-local/common/errors'
import { ValidationError } from 'xrpl-local'
import { validateBaseTransaction } from 'xrpl-local/models/transactions/common'
/**

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateCheckCancel, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateCheckCancel, validate, ValidationError } from 'xrpl-local'
/**
* CheckCancel Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateCheckCash, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateCheckCash, validate, ValidationError } from 'xrpl-local'
/**
* CheckCash Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateCheckCreate, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateCheckCreate, validate, ValidationError } from 'xrpl-local'
/**
* CheckCreate Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateDepositPreauth, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateDepositPreauth, validate, ValidationError } from 'xrpl-local'
/**
* DepositPreauth Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateEscrowCancel, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateEscrowCancel, validate, ValidationError } from 'xrpl-local'
/**
* Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateEscrowCreate, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateEscrowCreate, validate, ValidationError } from 'xrpl-local'
/**
* EscrowCreate Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateEscrowFinish, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateEscrowFinish, validate, ValidationError } from 'xrpl-local'
/**
* EscrowFinish Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateOfferCancel, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateOfferCancel, validate, ValidationError } from 'xrpl-local'
/**
* OfferCancel Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateOfferCreate, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateOfferCreate, validate, ValidationError } from 'xrpl-local'
/**
* OfferCreate Transaction Verification Testing.

View File

@@ -1,7 +1,11 @@
import { assert } from 'chai'
import { validatePayment, validate, PaymentTransactionFlags } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import {
validatePayment,
validate,
PaymentTransactionFlags,
ValidationError,
} from 'xrpl-local'
/**
* PaymentTransaction Verification Testing.

View File

@@ -1,7 +1,10 @@
import { assert } from 'chai'
import { validatePaymentChannelClaim, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import {
validatePaymentChannelClaim,
validate,
ValidationError,
} from 'xrpl-local'
/**
* PaymentChannelClaim Transaction Verification Testing.

View File

@@ -1,7 +1,10 @@
import { assert } from 'chai'
import { validatePaymentChannelCreate, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import {
validatePaymentChannelCreate,
validate,
ValidationError,
} from 'xrpl-local'
/**
* PaymentChannelCreate Transaction Verification Testing.

View File

@@ -1,7 +1,10 @@
import { assert } from 'chai'
import { validatePaymentChannelFund, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import {
validatePaymentChannelFund,
validate,
ValidationError,
} from 'xrpl-local'
/**
* PaymentChannelFund Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validate, validateSetRegularKey } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validate, validateSetRegularKey, ValidationError } from 'xrpl-local'
/**
* SetRegularKey Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validate, validateSignerListSet } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validate, validateSignerListSet, ValidationError } from 'xrpl-local'
/**
* SignerListSet Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateTicketCreate, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateTicketCreate, validate, ValidationError } from 'xrpl-local'
/**
* TicketCreate Transaction Verification Testing.

View File

@@ -1,7 +1,6 @@
import { assert } from 'chai'
import { validateTrustSet, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { validateTrustSet, validate, ValidationError } from 'xrpl-local'
/**
* TrustSet Transaction Verification Testing.

View File

@@ -1,6 +1,6 @@
import { assert } from 'chai'
import { ValidationError, XrplError } from '../../src/common/errors'
import { ValidationError, XrplError } from 'xrpl-local'
import { computeLedgerHash } from '../../src/utils'
import requests from '../fixtures/requests'
import responses from '../fixtures/responses'

View File

@@ -1,7 +1,7 @@
import { assert } from 'chai'
import ECDSA from '../../src/common/ecdsa'
import { UnexpectedError } from '../../src/common/errors'
import ECDSA from '../../src/ecdsa'
import { UnexpectedError } from 'xrpl-local'
import {
generateXAddress,
GenerateAddressOptions,

View File

@@ -4,8 +4,7 @@ import path from 'path'
import { assert } from 'chai'
import { encode } from 'ripple-binary-codec'
import { OfferCreate, Transaction } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { OfferCreate, Transaction, ValidationError } from 'xrpl-local'
import {
computeStateTreeHash,

View File

@@ -1,9 +1,10 @@
import { assert } from 'chai'
import { decode } from 'ripple-binary-codec/dist'
import ECDSA from '../../src/common/ecdsa'
import { Transaction } from '../../src/models/transactions'
import Wallet from '../../src/wallet'
import { Transaction } from 'xrpl-local'
import ECDSA from 'xrpl-local/ecdsa'
import Wallet from 'xrpl-local/wallet'
import requests from '../fixtures/requests'
import responses from '../fixtures/responses'

View File

@@ -2,16 +2,14 @@ import { assert } from 'chai'
import { decode, encode } from 'ripple-binary-codec/dist'
import { JsonObject } from 'ripple-binary-codec/dist/types/serialized-type'
import { Transaction } from 'xrpl-local'
import { ValidationError } from '../../src/common/errors'
import Wallet from '../../src/wallet'
import { Transaction, ValidationError } from 'xrpl-local'
import Wallet from 'xrpl-local/wallet'
import {
sign,
authorizeChannel,
multisign,
verifySignature,
} from '../../src/wallet/signer'
} from 'xrpl-local/wallet/signer'
const publicKey =
'030E58CDD076E798C84755590AAF6237CA8FAE821070A59F648B517A30DC6F589D'