0.2.38 • Published 1 year ago

@thorswap-lib/xchain-solana v0.2.38

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

2 years ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.30

2 years ago

0.2.38

1 year ago

0.2.37

1 year ago

0.2.36

1 year ago

0.2.35

1 year ago

0.2.34

1 year ago

0.2.33

2 years ago

0.2.32

2 years ago

0.2.31

2 years ago

0.2.29

2 years ago

0.2.28

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.17

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.5

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.2.4

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago