0.2.38 • Published 3 years ago

@thorswap-lib/xchain-solana v0.2.38

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@thorswap-lib/xchain-solana

Modules

  • client - Custom client for communicating with Solana by using @solana/web3.js

Installation

yarn add @thorswap-lib/xchain-solana

Following peer dependencies have to be installed into your project. These are not included in @thorswap-lib/xchain-solana.

yarn add @thorswap-lib/xchain-client @thorswap-lib/xchain-crypto @thorswap-lib/xchain-util @solana/web3.js @solana/spl-token ed25519-hd-key

Solana Client Testing

yarn install
yarn test

Service Providers

This package uses the following service providers:

FunctionServiceNotes
BalancesSolana RPChttps://solana-labs.github.io/solana-web3.js/classes/Connection.html#getBalance
Transaction historySolana RPChttps://solana-labs.github.io/solana-web3.js/classes/Connection.html#getParsedTransactions
Transaction details by hashSolana RPChttps://solana-labs.github.io/solana-web3.js/classes/Connection.html#getParsedTransaction
Transaction feesSolana RPChttps://solana-labs.github.io/solana-web3.js/classes/Transaction.html#getEstimatedFee
Transaction broadcastSolana RPChttps://solana-labs.github.io/solana-web3.js/modules.html#sendAndConfirmTransaction
ExplorerSolana Explorerhttps://explorer.solana.com/

Examples

// import `xchain-solana`
import { Client } from '@thorswap-lib/xchain-solana'

// Create a `Client`
const client = new Client({ network: Network.Testnet, phrase: 'my secret phrase' })

// get address
const address = client.getAddress()
console.log('address:', address) // address: DsgX3wpzzaZwuEUAZVMtg52sgywkXf7mUCHodzX2YJef

// get balances
const balances = await client.getBalance(address)
console.log('balances:', balances[0].amount.amount().toString()) // balance: 6

// get transactions
const txs = await client.getTransactions({ address })
console.log('txs total:', txs.total) // txs total: 20

// get transaction details
const tx = await client.getTransactionData('any-tx-hash')
console.log('tx asset:', tx.asset) // tx asset: { chain: 'SOL', symbol: 'SOL', ticker: 'SOL' }

For more examples check out tests in ./__tests__/client.test.ts

0.2.27

3 years ago

0.2.26

3 years ago

0.2.25

3 years ago

0.2.24

3 years ago

0.2.23

3 years ago

0.2.22

3 years ago

0.2.21

3 years ago

0.2.20

3 years ago

0.2.19

3 years ago

0.2.18

3 years ago

0.2.30

3 years ago

0.2.38

3 years ago

0.2.37

3 years ago

0.2.36

3 years ago

0.2.35

3 years ago

0.2.34

3 years ago

0.2.33

3 years ago

0.2.32

3 years ago

0.2.31

3 years ago

0.2.29

3 years ago

0.2.28

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.17

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.1.3

3 years ago

0.2.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago