Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update readme, remove deprecated texts #24

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 2 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,3 @@
# Coming Soon
# dlc-btc-lib

## Ethereum

### Interacting with the DLC Smart Contracts

TThe DLC-related smart contracts are currently deployed on the Arbitrum and Arbitrum Sepolia chains. To interact with these contracts and mint dlcBTC Tokens, you'll need to use an instance of the EthereumHandler class. This object facilitates interaction with the deployed smart contracts.

The three contracts you'll need to interact with are named: 'TokenManager', 'DLCManager', and 'DLCBTC'.

To create an EthereumHandler object, you need to provide the following parameters:

- Deployment plans for all three contracts
- The Ethereum Private Key of your Wallet or a Provider for an external Ethereum wallet (e.g., MetaMask)
- The Ethereum Node API URL for write interactions
- [OPTIONAL] The Ethereum Node API URL for read interactions (if not provided, the write API will be used for reading as well)

```ts
import { EthereumHandler } from 'dlc-btc-lib';

const ethereumHandler = new EthereumHandler(
deploymentPlans, // Deployment plans for all three contracts
ethereumPrivateKey, // The Ethereum Private Key of your wallet or a provider for an external Ethereum wallet (e.g., MetaMask)
ethereumNodeAPI, // The Ethereum Node API URL for write interactions
ethereumReadOnlyNodeAPI // [OPTIONAL] The Ethereum Node API URL for read interactions
);
```

After the Ethereum Handler is setup, you can interact with the smart contracts using the following methods:

```ts
async getAllVaults(): Promise<RawVault[]> // Returns all the User's Vaults
async getRawVault(vaultUUID: string): Promise<RawVault> // Returns the Vault with the specified UUID
async setupVault(bitcoinDepositAmount: number): Promise<any | undefined> // Sets up a new Vault and returns a Transaction Receipt
async closeVault(vaultUUID: string): Promise<any | undefined> // Closes the Vault with the specified UUID and returns a Transaction Receipt
async getDLCBTCBalance(): Promise<number | undefined> // Returns the User's dlcBTC balance
async getAttestorGroupPublicKey(): Promise<string> // Returns the Group Public Key of the Attestors for Bitcoin transactions
```

### Reading the DLC Smart Contracts

If you would like to only read the data from the smart contracts, you can use the ReadOnlyEthereumHandler class. This object facilitates reading data from the deployed smart contracts.

To create an ReadOnlyEthereumHandler object, you need to provide the following parameters:

- Deployment plans for all three contracts
- The Ethereum Node API URL for read interactions

```ts
const readOnlyEthereumHandler = new ReadOnlyEthereumHandler(
deploymentPlans, // Deployment plans for all three contracts
ethereumNodeAPI // The Ethereum Node API URL for read interactions
);
```

After the Read Only Ethereum Handler is setup, you can interact with the smart contracts using the following methods:

```ts
async getAttestorGroupPublicKey(): Promise<string> // Returns the Group Public Key of the Attestors for Bitcoin transactions
async getContractTransferEvents(): Promise<Event[]> // Returns all the transfer events from the DLCBTC Contract
async getContractTotalSupply(): Promise<number> // Returns the total supply of dlcBTC Tokens
async getContractFundedVaults(amount: number = 50): Promise<RawVault[]> // Returns all funded Vaults
```
**dlc-btc-lib** is a comprehensive library for interacting with DLC.Link smart contracts and the Bitcoin blockchain. It includes functions for creating valid Partially Signed Bitcoin Transactions, handling setup, deposit, and withdrawal interactions, and interfacing with Attestors. This library provides all the essential tools and utilities for seamless blockchain and smart contract interactions.
Loading