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

refactor README #5

Merged
merged 18 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Ensure you have the following installed:
### Installation
To install the XLink SDK, use the following command:
```bash
pnpm install @xlink-project/xlink-sdk
pnpm install @xlink-network/xlink-sdk
```

## XLink SDK API
Expand Down Expand Up @@ -58,31 +58,29 @@ The `KnownTokenId` namespace manages the token IDs of supported cryptocurrencies

Note: Users can transfer between different coins/tokens, not just the same token on different blockchains. For example, it's possible to convert BTC to WBTC when moving from Bitcoin to an EVM network.


### XLink SDK
The `XLinkSDK` object contains the most important functions of this library, all grouped together. To create it:
The [`XLinkSDK`](https://docs-typedoc.xlink-sdk.pages.dev/modules/XLinkSDK) object contains the most important functions of this library, all grouped together. To create it:
tenuki marked this conversation as resolved.
Show resolved Hide resolved

```typescript
const theSdk = new XLinkSDK();
```

For detailed API documentation, including a full list of available methods and their usage, please refer to:

[Latest version SDK API Documentation](https://releases-latest.xlink-sdk.pages.dev/)
[SDK API Documentation](https://docs-typedoc.xlink-sdk.pages.dev/classes/XLinkSDK.XLinkSDK)
tenuki marked this conversation as resolved.
Show resolved Hide resolved

### USE CASES
### Use Cases

Create an instance of the SDK with default options
```typescript
import{ XLinkSDK } from '@xlink-project/xlink-sdk/src';

import{ XLinkSDK } from '@xlink-network/xlink-sdk';
const xlinkSdk = new XLinkSDK();
```
1. Bridge from Stacks
```typescript
import { BridgeInfoFromStacksInput } from '@xlink-project/xlink-sdk/src/xlinkSdkUtils/bridgeInfoFromStacks';
import { BridgeFromStacksInput } from '@xlink-project/xlink-sdk/src/xlinkSdkUtils/bridgeFromStacks';
import { KnownChainId, KnownTokenId } from '@xlink-project/xlink-sdk/src/utils/types/knownIds';
import { BridgeInfoFromStacksInput } from '@xlink-network/xlink-sdk/xlinkSdkUtils/bridgeInfoFromStacks';
ignaciopenia marked this conversation as resolved.
Show resolved Hide resolved
import { BridgeFromStacksInput } from '@xlink-network/xlink-sdk/xlinkSdkUtils/bridgeFromStacks';
import { KnownChainId, KnownTokenId } from '@xlink-network/xlink-sdk/utils/types/knownIds';

// Get bridge info
const bridgeInfo = await xlinkSdk.bridgeInfoFromStacks({
Expand Down Expand Up @@ -124,9 +122,9 @@ console.log("Transaction ID:", result.txid);

2. Bridge from EVM
```typescript
import { BridgeInfoFromEVMInput } from '@xlink-project/xlink-sdk/src/xlinkSdkUtils/bridgeInfoFromEVM';
import { BridgeFromEVMInput } from '@xlink-project/xlink-sdk/src/xlinkSdkUtils/bridgeFromEVM';
import { KnownChainId, KnownTokenId } from '@xlink-project/xlink-sdk/src/utils/types/knownIds';
import { BridgeInfoFromEVMInput } from '@xlink-network/xlink-sdk/xlinkSdkUtils/bridgeInfoFromEVM';
import { BridgeFromEVMInput } from '@xlink-network/xlink-sdk/xlinkSdkUtils/bridgeFromEVM';
import { KnownChainId, KnownTokenId } from '@xlink-network/xlink-sdk/utils/types/knownIds';

// Get bridge info
const bridgeInfo = await xlinkSdk.bridgeInfoFromEVM({
Expand All @@ -153,9 +151,9 @@ console.log("Transaction ID:", result.txHash);

3. Bridge from Bitcoin
```typescript
import { BridgeInfoFromBitcoinInput } from '@xlink-project/xlink-sdk/src/xlinkSdkUtils/bridgeInfoFromBitcoin';
import { BridgeFromBitcoinInput } from '@xlink-project/xlink-sdk/src/xlinkSdkUtils/bridgeFromBitcoin';
import { KnownChainId, KnownTokenId } from '@xlink-project/xlink-sdk/src/utils/types/knownIds';
import { BridgeInfoFromBitcoinInput } from '@xlink-network/xlink-sdk/xlinkSdkUtils/bridgeInfoFromBitcoin';
import { BridgeFromBitcoinInput } from '@xlink-network/xlink-sdk/xlinkSdkUtils/bridgeFromBitcoin';
import { KnownChainId, KnownTokenId } from '@xlink-network/xlink-sdk/utils/types/knownIds';

// Get bridge info
const bridgeInfo = await xlinkSdk.bridgeInfoFromBitcoin({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"scripts": {
"gen:stacksContract": "rm -rf generated/smartContract && mkdir -p generated/smartContract && tsx ./scripts/generateClarityTranscoders.ts",
"gen": "pnpm run gen:stacksContract",
"docs": "typedoc",
"docs:watch": "typedoc --watch",
"docs": "typedoc src/index.ts",
ignaciopenia marked this conversation as resolved.
Show resolved Hide resolved
"docs:watch": "typedoc src/index.ts --watch",
"build": "pnpm run gen && rm -rf lib && tsup-node --sourcemap --dts -d lib --format cjs,esm src",
"prepare": "pnpm run build",
"test": "vitest --exclude lib"
Expand Down