@xchainjs/xchain-solana 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.d.ts +72 -3
- package/lib/index.esm.js +413 -207
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +414 -204
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +2 -1
- package/package.json +4 -4
package/lib/client.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { AssetInfo, BaseXChainClient, Fees, PreparedTx, TxHash, TxHistoryParams } from '@xchainjs/xchain-client';
|
|
1
|
+
import { AssetInfo, BaseXChainClient, Fees, Network, PreparedTx, TxHash, TxHistoryParams } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, TokenAsset } from '@xchainjs/xchain-util';
|
|
3
3
|
import { Balance, SOLClientParams, Tx, TxParams, TxsPage } from './types';
|
|
4
4
|
export declare class Client extends BaseXChainClient {
|
|
5
5
|
private explorerProviders;
|
|
6
|
-
private
|
|
7
|
-
private
|
|
6
|
+
private providers;
|
|
7
|
+
private clientUrls?;
|
|
8
8
|
constructor(params?: SOLClientParams);
|
|
9
|
+
/**
|
|
10
|
+
* Set or update the current network.
|
|
11
|
+
* @param {Network} network The network to set
|
|
12
|
+
* @returns {void}
|
|
13
|
+
*/
|
|
14
|
+
setNetwork(network: Network): void;
|
|
9
15
|
/**
|
|
10
16
|
* Get information about the native asset of the Solana.
|
|
11
17
|
*
|
|
@@ -79,6 +85,12 @@ export declare class Client extends BaseXChainClient {
|
|
|
79
85
|
* @returns {Tx} The transaction details.
|
|
80
86
|
*/
|
|
81
87
|
getTransactionData(txId: string): Promise<Tx>;
|
|
88
|
+
/**
|
|
89
|
+
* Get the transaction history of a given address with pagination options.
|
|
90
|
+
*
|
|
91
|
+
* @param {TxHistoryParams} params The options to get transaction history.
|
|
92
|
+
* @returns {TxsPage} The transaction history.
|
|
93
|
+
*/
|
|
82
94
|
getTransactions(params?: TxHistoryParams): Promise<TxsPage>;
|
|
83
95
|
/**
|
|
84
96
|
* Transfers SOL or Solana token
|
|
@@ -104,4 +116,61 @@ export declare class Client extends BaseXChainClient {
|
|
|
104
116
|
}): Promise<PreparedTx>;
|
|
105
117
|
private getPrivateKeyPair;
|
|
106
118
|
private parseTransaction;
|
|
119
|
+
/**
|
|
120
|
+
* Retrieves the balance of a given address making a round robin over the providers.
|
|
121
|
+
*
|
|
122
|
+
* @param {Address} address - The address to retrieve the balance for.
|
|
123
|
+
* @param {TokenAsset[]} assets - Assets to retrieve the balance for (optional).
|
|
124
|
+
* @returns {Promise<Balance[]>} An array containing the balance of the address.
|
|
125
|
+
* @throws {Error} if there is no provider able to retrieve the balances
|
|
126
|
+
*/
|
|
127
|
+
private roundRobinGetBalance;
|
|
128
|
+
/**
|
|
129
|
+
* Get transaction fees making a round robin over the providers.
|
|
130
|
+
*
|
|
131
|
+
* @param {TxParams} params - The transaction parameters.
|
|
132
|
+
* @returns {Fees} The average, fast, and fastest fees.
|
|
133
|
+
* @throws {Error} if there is no provider able to retrieve the fees
|
|
134
|
+
*/
|
|
135
|
+
private roundRobinGetFees;
|
|
136
|
+
/**
|
|
137
|
+
* Get the transaction details of a given transaction ID making a round robin over the providers.
|
|
138
|
+
*
|
|
139
|
+
* @param {string} txId The transaction ID.
|
|
140
|
+
* @returns {Tx} The transaction details.
|
|
141
|
+
* @throws {Error} if there is no provider able to retrieve the transaction data
|
|
142
|
+
*/
|
|
143
|
+
private roundRobinGetTransactionData;
|
|
144
|
+
/**
|
|
145
|
+
* Get the transaction history of a given address with pagination options making a round robin over the providers.
|
|
146
|
+
*
|
|
147
|
+
* @param {TxHistoryParams} params The options to get transaction history.
|
|
148
|
+
* @returns {TxsPage} The transaction history.
|
|
149
|
+
* @throws {Error} if there is no provider able to retrieve the transactions
|
|
150
|
+
*/
|
|
151
|
+
private roundRobinGetTransactions;
|
|
152
|
+
/**
|
|
153
|
+
* Transfers SOL or Solana token making a round robin over the providers
|
|
154
|
+
*
|
|
155
|
+
* @param {TxParams} params The transfer options.
|
|
156
|
+
* @returns {TxHash} The transaction hash.
|
|
157
|
+
* @throws {Error} if there is no provider able to make the transfer
|
|
158
|
+
*/
|
|
159
|
+
private roundRobinTransfer;
|
|
160
|
+
/**
|
|
161
|
+
* Broadcast a transaction to the network making a round robin over the providers
|
|
162
|
+
*
|
|
163
|
+
* @param {string} txHex Raw transaction to broadcast
|
|
164
|
+
* @returns {TxHash} The hash of the transaction broadcasted
|
|
165
|
+
* @throws {Error} if there is no provider able to broadcast transaction
|
|
166
|
+
*/
|
|
167
|
+
private roundRobinBroadcastTx;
|
|
168
|
+
/**
|
|
169
|
+
* Prepares a transaction for transfer making round robin over the providers.
|
|
170
|
+
*
|
|
171
|
+
* @param {TxParams&Address} params - The transfer options.
|
|
172
|
+
* @returns {Promise<PreparedTx>} The raw unsigned transaction.
|
|
173
|
+
* @throws {Error} if there is no provider able to prepare transaction
|
|
174
|
+
*/
|
|
175
|
+
private roundRobinPrepareTx;
|
|
107
176
|
}
|