@xchainjs/xchain-solana 1.1.1 → 1.1.3

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/index.esm.js CHANGED
@@ -6,7 +6,7 @@ import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, getAccount, createTran
6
6
  import { Connection, clusterApiUrl, Keypair, PublicKey, Transaction, SystemProgram, TransactionInstruction, ComputeBudgetProgram, SendTransactionError } from '@solana/web3.js';
7
7
  import { ExplorerProvider, Network, BaseXChainClient, TxType, FeeType, FeeOption } from '@xchainjs/xchain-client';
8
8
  import { getSeed } from '@xchainjs/xchain-crypto';
9
- import { AssetType, baseAmount, assetToBase, assetAmount, assetFromStringEx, eqAsset, getContractAddressFromAsset } from '@xchainjs/xchain-util';
9
+ import { AssetType, baseAmount, assetFromStringEx, assetToBase, assetAmount, eqAsset, getContractAddressFromAsset } from '@xchainjs/xchain-util';
10
10
  import bs58 from 'bs58';
11
11
  import slip10 from 'micro-key-producer/slip10.js';
12
12
  import SolanaLedgerApp from '@ledgerhq/hw-app-solana';
@@ -552,7 +552,19 @@ class Client extends BaseXChainClient {
552
552
  return __awaiter(this, void 0, void 0, function* () {
553
553
  try {
554
554
  for (const provider of this.providers) {
555
- const signatures = yield provider.solanaProvider.getSignaturesForAddress(new PublicKey((params === null || params === void 0 ? void 0 : params.address) || (yield this.getAddressAsync())));
555
+ const address = new PublicKey((params === null || params === void 0 ? void 0 : params.address) || (yield this.getAddressAsync()));
556
+ const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
557
+ const offset = (params === null || params === void 0 ? void 0 : params.offset) || 0;
558
+ // To support offset, fetch enough signatures to skip past the offset
559
+ const fetchCount = offset + limit;
560
+ const allSignatures = yield provider.solanaProvider.getSignaturesForAddress(address, {
561
+ limit: fetchCount,
562
+ });
563
+ // Apply offset by slicing
564
+ const signatures = allSignatures.slice(offset);
565
+ if (signatures.length === 0) {
566
+ return { txs: [], total: 0 };
567
+ }
556
568
  const transactions = yield provider.solanaProvider.getParsedTransactions(signatures.map(({ signature }) => signature));
557
569
  const results = yield Promise.allSettled(transactions
558
570
  .filter((transaction) => !!transaction)
package/lib/index.js CHANGED
@@ -560,7 +560,19 @@ class Client extends xchainClient.BaseXChainClient {
560
560
  return __awaiter(this, void 0, void 0, function* () {
561
561
  try {
562
562
  for (const provider of this.providers) {
563
- const signatures = yield provider.solanaProvider.getSignaturesForAddress(new web3_js.PublicKey((params === null || params === void 0 ? void 0 : params.address) || (yield this.getAddressAsync())));
563
+ const address = new web3_js.PublicKey((params === null || params === void 0 ? void 0 : params.address) || (yield this.getAddressAsync()));
564
+ const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
565
+ const offset = (params === null || params === void 0 ? void 0 : params.offset) || 0;
566
+ // To support offset, fetch enough signatures to skip past the offset
567
+ const fetchCount = offset + limit;
568
+ const allSignatures = yield provider.solanaProvider.getSignaturesForAddress(address, {
569
+ limit: fetchCount,
570
+ });
571
+ // Apply offset by slicing
572
+ const signatures = allSignatures.slice(offset);
573
+ if (signatures.length === 0) {
574
+ return { txs: [], total: 0 };
575
+ }
564
576
  const transactions = yield provider.solanaProvider.getParsedTransactions(signatures.map(({ signature }) => signature));
565
577
  const results = yield Promise.allSettled(transactions
566
578
  .filter((transaction) => !!transaction)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-solana",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Solana client for XChainJS",
5
5
  "keywords": [
6
6
  "Solana",
@@ -39,9 +39,9 @@
39
39
  "@solana/addresses": "^2.1.1",
40
40
  "@solana/spl-token": "^0.4.13",
41
41
  "@solana/web3.js": "^1.98.2",
42
- "@xchainjs/xchain-client": "2.0.10",
42
+ "@xchainjs/xchain-client": "2.0.11",
43
43
  "@xchainjs/xchain-crypto": "1.0.6",
44
- "@xchainjs/xchain-util": "2.0.5",
44
+ "@xchainjs/xchain-util": "2.0.6",
45
45
  "bs58": "^6.0.0",
46
46
  "micro-key-producer": "^0.7.6"
47
47
  },