npm package: @nekoproject/networks
Description: Cross-chain Network
Author: @minhdocs
Latest version: 2.1.12

# @nekoproject/networks

A complete crypto wallet base support for cross-chain

Table of contents
=================
<!--ts-->
  * [Re-Build](#build)
  * [Install](#install)
  * [Documents](#documents)
    * [Setter](#setter)
    * [Getter](#getter)
    * [Get SOL balance](#get-sol-balance)
    * [Create transaction order](#create-transaction-order)
    * [Send transaction](#send-transaction)
    * [Get transaction](#get-transaction)
    * [Sign message](#sign-message)
    * [Verify message](#verify-message)
  * [Notice](#notice)
<!--te-->

Build
========
Re-build project from scratch
  - Clean project
    ```bash
      npm run clean
    ```
  - Build
    ```bash
      npm run build
    ```
  - Unit test
    ```bash
      npm run test:cover
    ```
Install
=======
  Install `@nekoproject/networks` with `npm`
  ```bash
    npm i @nekoproject/networks
  ```
  Import
  ```ts
    import { Network, SPLNetwork } from '@nekoproject/networks'
    import type { Web3Provider, OrderRequest, SPLTransactionRequest, SPLTransactionResponse } from '@nekoproject/networks'
  ```
Documents
=========
Use created instance
```ts
   import { SPLNetworkInstance } from '@nekoproject/networks'
```
Create new Network instance
```ts
  const config: Web3Provider = {
    rpcUrl: 'rpc URL',
    explorer: 'https://solscan.io',
  }
  let network: Network;
  network = new SPLNetwork(config)
```
### Network methods
#### Setter
  - Set new RPC URL
    ```ts
      network.rcpUrl = 'new rpc URL'
    ```
  - Set new explorer URL
    ```ts
      network.explorerUrl = 'new explorer URL'
    ```
#### Getter
  - Get provider (Connection)
    ```ts
      const provider = network.provider
    ```
#### Get SOL balance
  ```ts
    /**
   * 
   * @param address : string
   * @returns : SOL balance (not lamport unit)
   */
    const balance = await network.getBalance(address)
  ```
#### Create transaction Order
  ```ts
    const order: OrderRequest = {
      from: 'address',
      to: 'address',
      amount: 'SOL value'
    }
    /**
   * Create order for transaction
   * @param order: OrderRequest
   * @returns : SPLTransactionRequest
   */
    const transsactionOrder = await network.createTransactionOrder(order)
    
  ```
#### Send transaction
  ```ts
     /**
   * Send transaction
   * @param transactionOrder: SPLTransactionRequest
   * @param wallet : Wallet
   * @returns : signature
   */
    const signature = await network.sendTransaction(transactionOrder, wallet)
  ```
#### Get transaction
  ```ts
    /**
   * Get detail of finalized transaction by signature
   * @param signature : signature of transaction
   * @returns : SPLTransactionResponse
   */
    const response = await network.getTransaction(signature)
  ```
#### Sign message
  ```ts
    /**
   * Sign message
   * @param message : string
   * @param wallet: Wallet
   * @returns : signature of signed message
   */
    const signature = network.signMessage(wallet, message)
  ```
#### Verify message
  ```ts
     /**
   * Verify message signed
   * @param wallet : Wallet
   * @param signature: signature of signed message
   * @params message: message signed
   * @returns : signature of signed message
   */
    const verify = network.verifyMessage(wallet, signature, message)
  ```
  

Notice
========
# Ref