Skip to content

Commit

Permalink
fix: remove aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Polybius93 committed May 30, 2024
1 parent fec0193 commit b0c5b84
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 59 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Coming Soon
21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/attestor-handlers/attestor-handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AttestorError } from '@models/errors.js';
import { AttestorError } from '../models/errors.js';

export class AttestorHandler {
private attestorRootURLs: string[];
Expand Down
2 changes: 1 addition & 1 deletion src/constants/ethereum-constants.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/dlc-handlers/ledger-dlc-handler.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down
33 changes: 17 additions & 16 deletions src/example.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/functions/bitcoin/bitcoin-request-functions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitcoinTransaction } from '@models/bitcoin-models.js';
import { BitcoinTransaction } from '../../models/bitcoin-models.js';

export async function fetchBitcoinTransaction(
txID: string,
Expand Down
4 changes: 2 additions & 2 deletions src/functions/bitcoin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/functions/bitcoin/psbt-functions.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 4 additions & 3 deletions src/functions/ethereum/ethereum-functions.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/functions/ethereum/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { fetchEthereumDeploymentPlan } from '@ethereum/ethereum-functions.js';
import { fetchEthereumDeploymentPlan } from '../ethereum/ethereum-functions.js';

export { fetchEthereumDeploymentPlan };
5 changes: 3 additions & 2 deletions src/functions/hardware-wallet/ledger-functions.ts
Original file line number Diff line number Diff line change
@@ -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<ReturnType<typeof Transport.default.create>>;

export async function getLedgerApp(appName: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/network-handlers/ethereum-handler.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 8 additions & 4 deletions src/network-handlers/read-only-ethereum-handler.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
11 changes: 6 additions & 5 deletions src/proof-of-reserve-handlers/proof-of-reserve-handler.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { hex } from '@scure/base';
import { Network } from 'bitcoinjs-lib';

import {
createTaprootMultisigPayment,
createTaprootMultisigPaymentLegacy,
deriveUnhardenedPublicKey,
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;
Expand Down
12 changes: 0 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b0c5b84

Please sign in to comment.