From b0c5b847f858684c4cb1ca791a9aec0681ef148b Mon Sep 17 00:00:00 2001 From: Polybius93 Date: Thu, 30 May 2024 16:32:00 +0200 Subject: [PATCH] fix: remove aliases --- README.md | 1 + package.json | 21 ++++++++---- src/attestor-handlers/attestor-handler.ts | 2 +- src/constants/ethereum-constants.ts | 2 +- src/dlc-handlers/ledger-dlc-handler.ts | 2 +- src/example.ts | 33 ++++++++++--------- .../bitcoin/bitcoin-request-functions.ts | 2 +- src/functions/bitcoin/index.ts | 4 +-- src/functions/bitcoin/psbt-functions.ts | 4 +-- src/functions/ethereum/ethereum-functions.ts | 7 ++-- src/functions/ethereum/index.ts | 2 +- .../hardware-wallet/ledger-functions.ts | 5 +-- src/network-handlers/ethereum-handler.ts | 2 +- .../read-only-ethereum-handler.ts | 12 ++++--- .../proof-of-reserve-handler.ts | 11 ++++--- tsconfig.json | 12 ------- 16 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d30962b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Coming Soon diff --git a/package.json b/package.json index 50f59fb..4797fc0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "type": "module", - "name": "dlc-btc-app", - "version": "1.0.5", - "description": "", + "name": "dlc-btc-lib", + "version": "1.0.1", + "description": "This library provides a comprehensive set of interfaces and functions for minting dlcBTC tokens on supported blockchains.", "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ @@ -13,8 +13,8 @@ "./utilities": "./dist/utilities/index.js", "./constants": "./dist/constants/index.js", "./models": "./dist/models/index.js", - "./bitcoin-functions": "./dist/functions/bitcoin-functions/index.js", - "./ethereum-functions": "./dist/functions/ethereum-functions/index.js" + "./bitcoin-functions": "./dist/functions/bitcoin/index.js", + "./ethereum-functions": "./dist/functions/ethereum/index.js" }, "scripts": { "clean": "rm -rf dist && rm -rf node_modules", @@ -28,8 +28,15 @@ "lint:prettier:fix": "prettier --write \"{src,tests}/**/*.ts\" *.js", "lint:typecheck": "tsc --noEmit" }, - "keywords": [], - "author": "", + "keywords": [ + "dlc", + "dlcbtc", + "dlclink", + "bitcoin", + "ethereum", + "token" + ], + "author": "DLC.Link", "license": "ISC", "devDependencies": { "@types/prompts": "^2.4.9", diff --git a/src/attestor-handlers/attestor-handler.ts b/src/attestor-handlers/attestor-handler.ts index 273de23..3be0943 100644 --- a/src/attestor-handlers/attestor-handler.ts +++ b/src/attestor-handlers/attestor-handler.ts @@ -1,4 +1,4 @@ -import { AttestorError } from '@models/errors.js'; +import { AttestorError } from '../models/errors.js'; export class AttestorHandler { private attestorRootURLs: string[]; diff --git a/src/constants/ethereum-constants.ts b/src/constants/ethereum-constants.ts index 41ca2ba..c98dfd0 100644 --- a/src/constants/ethereum-constants.ts +++ b/src/constants/ethereum-constants.ts @@ -1,4 +1,4 @@ -import { EthereumNetwork, EthereumNetworkID } from '@models/ethereum-models.js'; +import { EthereumNetwork, EthereumNetworkID } from '../models/ethereum-models.js'; export const ethereumArbitrumSepolia: EthereumNetwork = { name: 'ArbSepolia', diff --git a/src/dlc-handlers/ledger-dlc-handler.ts b/src/dlc-handlers/ledger-dlc-handler.ts index d2bb164..b7b4e4a 100644 --- a/src/dlc-handlers/ledger-dlc-handler.ts +++ b/src/dlc-handlers/ledger-dlc-handler.ts @@ -1,6 +1,5 @@ import { Transaction } from '@scure/btc-signer'; import { P2Ret, P2TROut, p2wpkh } from '@scure/btc-signer/payment'; -import { truncateAddress } from '@utilities/index.js'; import { Network, Psbt } from 'bitcoinjs-lib'; import { bitcoin, regtest, testnet } from 'bitcoinjs-lib/src/networks.js'; import { AppClient, DefaultWalletPolicy, WalletPolicy } from 'ledger-bitcoin'; @@ -26,6 +25,7 @@ import { } from '../functions/bitcoin/psbt-functions.js'; import { PaymentInformation } from '../models/bitcoin-models.js'; import { RawVault } from '../models/ethereum-models.js'; +import { truncateAddress } from '../utilities/index.js'; interface LedgerPolicyInformation { nativeSegwitWalletPolicy: DefaultWalletPolicy; diff --git a/src/example.ts b/src/example.ts index 9bbd0e1..ae1a2c0 100644 --- a/src/example.ts +++ b/src/example.ts @@ -1,6 +1,9 @@ -import { AttestorHandler } from '@attestor-handlers/attestor-handler.js'; -import { broadcastTransaction } from '@bitcoin/bitcoin-request-functions.js'; -import { ethereumArbitrumSepolia } from '@constants/ethereum-constants.js'; +import { bytesToHex } from '@noble/hashes/utils'; +import { regtest, testnet } from 'bitcoinjs-lib/src/networks.js'; +import { Event } from 'ethers'; + +import { AttestorHandler } from './attestor-handlers/attestor-handler.js'; +import { ethereumArbitrumSepolia } from './constants/ethereum-constants.js'; import { EXAMPLE_BITCOIN_AMOUNT, EXAMPLE_BITCOIN_BLOCKCHAIN_FEE_RECOMMENDATION_API, @@ -18,19 +21,17 @@ import { EXAMPLE_TESTNET_ATTESTOR_APIS, EXAMPLE_TESTNET_ATTESTOR_GROUP_PUBLIC_KEY_V1, EXAMPLE_TESTNET_BITCOIN_BLOCKCHAIN_API, -} from '@constants/example-constants.js'; -import { LEDGER_APPS_MAP } from '@constants/ledger-constants.js'; -import { LedgerDLCHandler } from '@dlc-handlers/ledger-dlc-handler.js'; -import { PrivateKeyDLCHandler } from '@dlc-handlers/private-key-dlc-handler.js'; -import { fetchEthereumDeploymentPlan } from '@ethereum/ethereum-functions.js'; -import { getLedgerApp } from '@hardware-wallet/ledger-functions.js'; -import { EthereumHandler } from '@network-handlers/ethereum-handler.js'; -import { ReadOnlyEthereumHandler } from '@network-handlers/read-only-ethereum-handler.js'; -import { bytesToHex } from '@noble/hashes/utils'; -import { ProofOfReserveHandler } from '@proof-of-reserve-handlers/proof-of-reserve-handler.js'; -import { shiftValue } from '@utilities/index.js'; -import { regtest, testnet } from 'bitcoinjs-lib/src/networks.js'; -import { Event } from 'ethers'; +} from './constants/example-constants.js'; +import { LEDGER_APPS_MAP } from './constants/ledger-constants.js'; +import { LedgerDLCHandler } from './dlc-handlers/ledger-dlc-handler.js'; +import { PrivateKeyDLCHandler } from './dlc-handlers/private-key-dlc-handler.js'; +import { broadcastTransaction } from './functions/bitcoin/bitcoin-request-functions.js'; +import { fetchEthereumDeploymentPlan } from './functions/ethereum/ethereum-functions.js'; +import { getLedgerApp } from './functions/hardware-wallet/ledger-functions.js'; +import { EthereumHandler } from './network-handlers/ethereum-handler.js'; +import { ReadOnlyEthereumHandler } from './network-handlers/read-only-ethereum-handler.js'; +import { ProofOfReserveHandler } from './proof-of-reserve-handlers/proof-of-reserve-handler.js'; +import { shiftValue } from './utilities/index.js'; async function runFlowWithPrivateKey() { // Fetch Ethereum Contract Deployment Plans diff --git a/src/functions/bitcoin/bitcoin-request-functions.ts b/src/functions/bitcoin/bitcoin-request-functions.ts index dd631d3..826f2ee 100644 --- a/src/functions/bitcoin/bitcoin-request-functions.ts +++ b/src/functions/bitcoin/bitcoin-request-functions.ts @@ -1,4 +1,4 @@ -import { BitcoinTransaction } from '@models/bitcoin-models.js'; +import { BitcoinTransaction } from '../../models/bitcoin-models.js'; export async function fetchBitcoinTransaction( txID: string, diff --git a/src/functions/bitcoin/index.ts b/src/functions/bitcoin/index.ts index c2098b1..f89523c 100644 --- a/src/functions/bitcoin/index.ts +++ b/src/functions/bitcoin/index.ts @@ -2,8 +2,8 @@ import { broadcastTransaction, fetchBitcoinBlockchainBlockHeight, fetchBitcoinTransaction, -} from '@bitcoin/bitcoin-request-functions.js'; -import { createClosingTransaction, createFundingTransaction } from '@bitcoin/psbt-functions.js'; +} from '../bitcoin/bitcoin-request-functions.js'; +import { createClosingTransaction, createFundingTransaction } from '../bitcoin/psbt-functions.js'; export { createClosingTransaction, diff --git a/src/functions/bitcoin/psbt-functions.ts b/src/functions/bitcoin/psbt-functions.ts index 4edbe0a..e615b07 100644 --- a/src/functions/bitcoin/psbt-functions.ts +++ b/src/functions/bitcoin/psbt-functions.ts @@ -1,11 +1,11 @@ -import { BitcoinInputSigningConfig, PaymentTypes } from '@models/bitcoin-models.js'; import { hexToBytes } from '@noble/hashes/utils'; import { p2wpkh, selectUTXO } from '@scure/btc-signer'; import { P2Ret, P2TROut } from '@scure/btc-signer/payment'; -import { reverseBytes } from '@utilities/index.js'; import { Network, Psbt } from 'bitcoinjs-lib'; import { PartialSignature } from 'ledger-bitcoin/build/main/lib/appClient.js'; +import { BitcoinInputSigningConfig, PaymentTypes } from '../../models/bitcoin-models.js'; +import { reverseBytes } from '../../utilities/index.js'; import { ecdsaPublicKeyToSchnorr, getFeeRecipientAddressFromPublicKey, diff --git a/src/functions/ethereum/ethereum-functions.ts b/src/functions/ethereum/ethereum-functions.ts index d8b5ba2..07aaa9d 100644 --- a/src/functions/ethereum/ethereum-functions.ts +++ b/src/functions/ethereum/ethereum-functions.ts @@ -1,12 +1,13 @@ -import { EthereumError } from '@models/errors.js'; +import { Contract, Wallet, providers } from 'ethers'; + +import { EthereumError } from '../../models/errors.js'; import { DLCEthereumContracts, EthereumDeploymentPlan, EthereumNetwork, RawVault, VaultState, -} from '@models/ethereum-models.js'; -import { Contract, Wallet, providers } from 'ethers'; +} from '../../models/ethereum-models.js'; export async function fetchEthereumDeploymentPlan( contractName: string, diff --git a/src/functions/ethereum/index.ts b/src/functions/ethereum/index.ts index 9aacf80..23bef10 100644 --- a/src/functions/ethereum/index.ts +++ b/src/functions/ethereum/index.ts @@ -1,3 +1,3 @@ -import { fetchEthereumDeploymentPlan } from '@ethereum/ethereum-functions.js'; +import { fetchEthereumDeploymentPlan } from '../ethereum/ethereum-functions.js'; export { fetchEthereumDeploymentPlan }; diff --git a/src/functions/hardware-wallet/ledger-functions.ts b/src/functions/hardware-wallet/ledger-functions.ts index 999910a..f9dcece 100644 --- a/src/functions/hardware-wallet/ledger-functions.ts +++ b/src/functions/hardware-wallet/ledger-functions.ts @@ -1,8 +1,9 @@ -import { LEDGER_APPS_MAP } from '@constants/ledger-constants.js'; import Transport from '@ledgerhq/hw-transport-node-hid'; -import { delay } from '@utilities/index.js'; import { AppClient } from 'ledger-bitcoin'; +import { LEDGER_APPS_MAP } from '../../constants/ledger-constants.js'; +import { delay } from '../../utilities/index.js'; + type TransportInstance = Awaited>; export async function getLedgerApp(appName: string) { diff --git a/src/network-handlers/ethereum-handler.ts b/src/network-handlers/ethereum-handler.ts index bd0aaea..feef9b3 100644 --- a/src/network-handlers/ethereum-handler.ts +++ b/src/network-handlers/ethereum-handler.ts @@ -1,6 +1,6 @@ -import { getEthereumContracts, getProvider } from '@ethereum/ethereum-functions.js'; import { Wallet, providers } from 'ethers'; +import { getEthereumContracts, getProvider } from '../functions/ethereum/ethereum-functions.js'; import { EthereumError } from '../models/errors.js'; import { DLCEthereumContracts, diff --git a/src/network-handlers/read-only-ethereum-handler.ts b/src/network-handlers/read-only-ethereum-handler.ts index 28208f9..8c6fb04 100644 --- a/src/network-handlers/read-only-ethereum-handler.ts +++ b/src/network-handlers/read-only-ethereum-handler.ts @@ -1,12 +1,16 @@ -import { getProvider, getReadOnlyEthereumContracts } from '@ethereum/ethereum-functions.js'; -import { EthereumError } from '@models/errors.js'; +import { Event } from 'ethers'; + +import { + getProvider, + getReadOnlyEthereumContracts, +} from '../functions/ethereum/ethereum-functions.js'; +import { EthereumError } from '../models/errors.js'; import { DLCReadOnlyEthereumContracts, EthereumDeploymentPlan, RawVault, VaultState, -} from '@models/ethereum-models.js'; -import { Event } from 'ethers'; +} from '../models/ethereum-models.js'; export class ReadOnlyEthereumHandler { private ethereumContracts: DLCReadOnlyEthereumContracts; diff --git a/src/proof-of-reserve-handlers/proof-of-reserve-handler.ts b/src/proof-of-reserve-handlers/proof-of-reserve-handler.ts index d03e736..a8d7910 100644 --- a/src/proof-of-reserve-handlers/proof-of-reserve-handler.ts +++ b/src/proof-of-reserve-handlers/proof-of-reserve-handler.ts @@ -1,3 +1,6 @@ +import { hex } from '@scure/base'; +import { Network } from 'bitcoinjs-lib'; + import { createTaprootMultisigPayment, createTaprootMultisigPaymentLegacy, @@ -5,15 +8,13 @@ import { findMatchingScript, getUnspendableKeyCommittedToUUID, getValueMatchingInputFromTransaction, -} from '@bitcoin/bitcoin-functions.js'; +} from '../functions/bitcoin/bitcoin-functions.js'; import { checkBitcoinTransactionConfirmations, fetchBitcoinBlockchainBlockHeight, fetchBitcoinTransaction, -} from '@bitcoin/bitcoin-request-functions.js'; -import { RawVault } from '@models/ethereum-models.js'; -import { hex } from '@scure/base'; -import { Network } from 'bitcoinjs-lib'; +} from '../functions/bitcoin/bitcoin-request-functions.js'; +import { RawVault } from '../models/ethereum-models.js'; export class ProofOfReserveHandler { private bitcoinBlockchainAPI: string; diff --git a/tsconfig.json b/tsconfig.json index 04568f8..bca497e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,18 +4,6 @@ "module": "NodeNext", "strict": true, "baseUrl": ".", - "paths": { - "@dlc-handlers/*": ["src/dlc-handlers/*"], - "@attestor-handlers/*": ["src/attestor-handlers/*"], - "@network-handlers/*": ["src/network-handlers/*"], - "@proof-of-reserve-handlers/*": ["src/proof-of-reserve-handlers/*"], - "@models/*": ["src/models/*"], - "@constants/*": ["src/constants/*"], - "@utilities/*": ["src/utilities/*"], - "@bitcoin/*": ["src/functions/bitcoin/*"], - "@ethereum/*": ["src/functions/ethereum/*"], - "@hardware-wallet/*": ["src/functions/hardware-wallet/*"], - }, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "moduleResolution": "NodeNext",