Skip to content

Commit

Permalink
Merge pull request #37 from xchainjs/feature/hip/updateDocs
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
Thorian1te authored Oct 5, 2023
2 parents 1877cf9 + bb095c4 commit ef8dcc1
Show file tree
Hide file tree
Showing 52 changed files with 1,258 additions and 831 deletions.
12 changes: 10 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ var packages = [
path: 'xchain-thorchain-query/available-functions',
},
{
module: 'xchain-midgard',
path: 'xchain-midgard/available-functions',
module: 'xchain-midgard-query',
path: 'xchain-midgard-query/available-functions',
},
{
module: 'xchain-cosmos-sdk',
path: 'xchain-cosmos-sdk/available-functions',
},
{
module: 'xchain-evm',
path: 'xchain-evm/available-functions',
},
{
module: 'xchain-thornode',
Expand Down
2 changes: 1 addition & 1 deletion xchain-client/xchain-avax/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ yarn add @xchainjs/xchain-avax
Following peer dependencies have to be installed into your project. These are not included in `@xchainjs/xchain-avax`.

```
yarn add @xchainjs/xchain-evm @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios ethers
yarn add @xchainjs/xchain-evm @xchainjs/xchain-evm-providers @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios ethers
```

## Client Testing
Expand Down
4 changes: 4 additions & 0 deletions xchain-client/xchain-binance/available-functions/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Validate the given address.

Returns **[boolean][4]** `true` or `false`

## getAssetInfo

Returns **any** asset info

## getAccount

Get account data of wallets or by given address.
Expand Down
4 changes: 4 additions & 0 deletions xchain-client/xchain-binance/available-functions/const.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Chain identifier for BNB.
## AssetBNB

Base "chain" asset of Binance chain.

## BNB_DECIMAL

Asset Decimal
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Custom Bitcoin Cash client

## Parameters

- `params` **UtxoClientParams** (optional, default `exports.defaultBCHParams`)
- `params` **UtxoClientParams** (optional, default `exports.defaultBchParams`)

## getAddress

Expand All @@ -25,6 +25,10 @@ The address is then decoded into type P2WPKH and returned.

Returns **Address** The current address.

## getAssetInfo

Returns **any** BCH asset info

## validateAddress

Validate the given address.
Expand Down
9 changes: 9 additions & 0 deletions xchain-client/xchain-bsc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sort: 3
---

# XCHAIN BSC

Custom Binance smart chain client and utilities used by XChainJS clients

{% include list.liquid all=true %}
25 changes: 25 additions & 0 deletions xchain-client/xchain-bsc/how-it-works.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sort: 1
---

# How it works

This package uses etherjs library, by default it uses several providers. (https://docs.ethers.io/v5/api-keys/)

### Explorer URL
* Mainnet:[`https://bscscan.com`](https://bscscan.com)
* Testnet:[`https://testnet.bscscan.com`](https://testnet.bscscan.com)

## RPC Ethers Providers
* Mainnet:[`https://rpc.ankr.com/bsc`](https://rpc.ankr.com/bsc)
* Testnet:[`https://bsc-testnet.public.blastapi.io`](https://bsc-testnet.public.blastapi.io)

## Dependencies

* [`@xchainjs/xchain-client`](http://docs.xchainjs.org/xchain-client/interface.html)
* [`@xchainjs/xchain-crypto`](http://docs.xchainjs.org/xchain-crypto/how-to-use.html)
* [`@xchainjs/xchain-util`](http://docs.xchainjs.org/xchain-util/how-to-use.html)
* [`@xchainjs/xchain-evm-providers`](http://docs.xchainjs.org/@xchainjs/xchain-evm-providers/how-to-use.html)
* [`@xchainjs/xchain-evm-providers`](http://docs.xchainjs.org/@xchainjs/xchain-evm-providers/how-to-use.html)
* @xchainjs/xchain-evm

62 changes: 62 additions & 0 deletions xchain-client/xchain-bsc/how-to-use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
sort: 2
---

# How to use

## Installation

```
yarn add @xchainjs/xchain-bsc
```

Following peer dependencies have to be installed into your project. These are not included in `@xchainjs/xchain-bsc`.

```
yarn add @xchainjs/xchain-evm @xchainjs/xchain-evm-providers @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios ethers
```

## Client Testing

```
yarn install
yarn test
```

## Basic Usage Example
###Imports
```ts
import { Client, defaultBscParams, AssetBSC } from "@xchainjs/xchain-bsc"
import { FeeOption } from "@xchainjs/xchain-client"
import { assetToBase, baseToAsset, assetAmount, Asset, Chain } from "@xchainjs/xchain-util"
```

### Connect wallet to new Bsc Chain Client
Network default is Mainnet
```ts
// Create new Bsc Asset
const assetRIP: Asset = {
chain: AssetBSC.chain,
symbol: `RIP-0x224695ba2a98e4a096a519b503336e06d9116e48`,
ticker: `RIP`,
synth: false,
}
// Create new Bsc Client Instance
const connectWallet =async () => {
defaultBscParams.phrase = "phrase"
const bscClient = new Client(defaultBscParams)
let address = bscClient.getAddress()
console.log(`Address: ${address}`)
let isValid = bscClient.validateAddress(address)
if( isValid === true ){
try {
const balance = await bscClient.getBalance(address)
let assetAmount = (baseToAsset(balance[1].amount)).amount()
console.log(`With balance: ${assetAmount}`)

} catch (error) {
console.log(`Caught: ${error}`)
}
}
}
```
4 changes: 4 additions & 0 deletions xchain-client/xchain-cosmos/available-functions/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ Get the balance of a given address.

Returns **[Array][4]<Balance>** The balance of the address.

## getAssetInfo

Returns **any** asset info

## getTransactions

Get transaction history of a given address and asset with pagination options.
Expand Down
4 changes: 4 additions & 0 deletions xchain-client/xchain-doge/available-functions/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ The address is then decoded into type P2WPKH and returned.

Returns **Address** The current address.

## getAssetInfo

Returns **any** Doge asset info

## validateAddress

Validate the given address.
Expand Down
Loading

0 comments on commit ef8dcc1

Please sign in to comment.