@atomiqlabs/chain-solana 13.5.13 → 13.5.14
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/LICENSE +201 -201
- package/README.md +73 -73
- package/dist/index.d.ts +81 -81
- package/dist/index.js +102 -102
- package/dist/node/index.d.ts +9 -9
- package/dist/node/index.js +13 -13
- package/dist/solana/SolanaChainType.d.ts +15 -15
- package/dist/solana/SolanaChainType.js +2 -2
- package/dist/solana/SolanaChains.d.ts +12 -12
- package/dist/solana/SolanaChains.js +45 -45
- package/dist/solana/SolanaInitializer.d.ts +94 -94
- package/dist/solana/SolanaInitializer.js +174 -174
- package/dist/solana/btcrelay/SolanaBtcRelay.d.ts +222 -222
- package/dist/solana/btcrelay/SolanaBtcRelay.js +455 -455
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.d.ts +84 -84
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.js +70 -70
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.d.ts +92 -92
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.js +109 -109
- package/dist/solana/btcrelay/program/programIdl.json +671 -671
- package/dist/solana/chain/SolanaAction.d.ts +26 -26
- package/dist/solana/chain/SolanaAction.js +87 -87
- package/dist/solana/chain/SolanaChainInterface.d.ts +224 -224
- package/dist/solana/chain/SolanaChainInterface.js +275 -275
- package/dist/solana/chain/SolanaModule.d.ts +14 -14
- package/dist/solana/chain/SolanaModule.js +13 -13
- package/dist/solana/chain/modules/SolanaAddresses.d.ts +8 -8
- package/dist/solana/chain/modules/SolanaAddresses.js +22 -22
- package/dist/solana/chain/modules/SolanaBlocks.d.ts +32 -32
- package/dist/solana/chain/modules/SolanaBlocks.js +78 -78
- package/dist/solana/chain/modules/SolanaEvents.d.ts +68 -68
- package/dist/solana/chain/modules/SolanaEvents.js +238 -238
- package/dist/solana/chain/modules/SolanaFees.d.ts +189 -189
- package/dist/solana/chain/modules/SolanaFees.js +434 -434
- package/dist/solana/chain/modules/SolanaSignatures.d.ts +24 -24
- package/dist/solana/chain/modules/SolanaSignatures.js +39 -39
- package/dist/solana/chain/modules/SolanaSlots.d.ts +33 -33
- package/dist/solana/chain/modules/SolanaSlots.js +72 -72
- package/dist/solana/chain/modules/SolanaTokens.d.ts +123 -123
- package/dist/solana/chain/modules/SolanaTokens.js +242 -242
- package/dist/solana/chain/modules/SolanaTransactions.d.ts +149 -149
- package/dist/solana/chain/modules/SolanaTransactions.js +445 -445
- package/dist/solana/connection/ConnectionWithRetries.d.ts +35 -35
- package/dist/solana/connection/ConnectionWithRetries.js +86 -71
- package/dist/solana/events/SolanaChainEvents.d.ts +45 -45
- package/dist/solana/events/SolanaChainEvents.js +108 -108
- package/dist/solana/events/SolanaChainEventsBrowser.d.ts +205 -205
- package/dist/solana/events/SolanaChainEventsBrowser.js +404 -404
- package/dist/solana/program/SolanaProgramBase.d.ts +73 -73
- package/dist/solana/program/SolanaProgramBase.js +54 -54
- package/dist/solana/program/SolanaProgramModule.d.ts +8 -8
- package/dist/solana/program/SolanaProgramModule.js +11 -11
- package/dist/solana/program/modules/SolanaProgramEvents.d.ts +53 -53
- package/dist/solana/program/modules/SolanaProgramEvents.js +117 -117
- package/dist/solana/swaps/SolanaSwapData.d.ts +333 -333
- package/dist/solana/swaps/SolanaSwapData.js +535 -535
- package/dist/solana/swaps/SolanaSwapModule.d.ts +11 -11
- package/dist/solana/swaps/SolanaSwapModule.js +12 -12
- package/dist/solana/swaps/SolanaSwapProgram.d.ts +376 -376
- package/dist/solana/swaps/SolanaSwapProgram.js +769 -769
- package/dist/solana/swaps/SwapTypeEnum.d.ts +11 -11
- package/dist/solana/swaps/SwapTypeEnum.js +43 -43
- package/dist/solana/swaps/modules/SolanaDataAccount.d.ts +95 -95
- package/dist/solana/swaps/modules/SolanaDataAccount.js +232 -232
- package/dist/solana/swaps/modules/SolanaLpVault.d.ts +69 -69
- package/dist/solana/swaps/modules/SolanaLpVault.js +171 -171
- package/dist/solana/swaps/modules/SwapClaim.d.ts +126 -126
- package/dist/solana/swaps/modules/SwapClaim.js +294 -294
- package/dist/solana/swaps/modules/SwapInit.d.ts +213 -213
- package/dist/solana/swaps/modules/SwapInit.js +658 -658
- package/dist/solana/swaps/modules/SwapRefund.d.ts +87 -87
- package/dist/solana/swaps/modules/SwapRefund.js +293 -293
- package/dist/solana/swaps/programIdl.json +945 -945
- package/dist/solana/swaps/programTypes.d.ts +943 -943
- package/dist/solana/swaps/programTypes.js +945 -945
- package/dist/solana/swaps/v1/programIdl.json +945 -945
- package/dist/solana/swaps/v1/programTypes.d.ts +943 -943
- package/dist/solana/swaps/v1/programTypes.js +945 -945
- package/dist/solana/swaps/v2/programIdl.json +952 -952
- package/dist/solana/swaps/v2/programTypes.d.ts +950 -950
- package/dist/solana/swaps/v2/programTypes.js +952 -952
- package/dist/solana/wallet/SolanaKeypairWallet.d.ts +29 -29
- package/dist/solana/wallet/SolanaKeypairWallet.js +50 -50
- package/dist/solana/wallet/SolanaSigner.d.ts +30 -30
- package/dist/solana/wallet/SolanaSigner.js +30 -30
- package/dist/utils/Utils.d.ts +58 -58
- package/dist/utils/Utils.js +170 -170
- package/node/index.d.ts +1 -1
- package/node/index.js +3 -3
- package/package.json +46 -46
- package/src/index.ts +87 -87
- package/src/node/index.ts +9 -9
- package/src/solana/SolanaChainType.ts +32 -32
- package/src/solana/SolanaChains.ts +46 -46
- package/src/solana/SolanaInitializer.ts +278 -278
- package/src/solana/btcrelay/SolanaBtcRelay.ts +615 -615
- package/src/solana/btcrelay/headers/SolanaBtcHeader.ts +116 -116
- package/src/solana/btcrelay/headers/SolanaBtcStoredHeader.ts +148 -148
- package/src/solana/btcrelay/program/programIdl.json +670 -670
- package/src/solana/chain/SolanaAction.ts +109 -109
- package/src/solana/chain/SolanaChainInterface.ts +404 -404
- package/src/solana/chain/SolanaModule.ts +20 -20
- package/src/solana/chain/modules/SolanaAddresses.ts +20 -20
- package/src/solana/chain/modules/SolanaBlocks.ts +89 -89
- package/src/solana/chain/modules/SolanaEvents.ts +271 -271
- package/src/solana/chain/modules/SolanaFees.ts +522 -522
- package/src/solana/chain/modules/SolanaSignatures.ts +39 -39
- package/src/solana/chain/modules/SolanaSlots.ts +85 -85
- package/src/solana/chain/modules/SolanaTokens.ts +300 -300
- package/src/solana/chain/modules/SolanaTransactions.ts +503 -503
- package/src/solana/connection/ConnectionWithRetries.ts +113 -96
- package/src/solana/events/SolanaChainEvents.ts +127 -127
- package/src/solana/events/SolanaChainEventsBrowser.ts +495 -495
- package/src/solana/program/SolanaProgramBase.ts +119 -119
- package/src/solana/program/SolanaProgramModule.ts +15 -15
- package/src/solana/program/modules/SolanaProgramEvents.ts +157 -157
- package/src/solana/swaps/SolanaSwapData.ts +735 -735
- package/src/solana/swaps/SolanaSwapModule.ts +19 -19
- package/src/solana/swaps/SolanaSwapProgram.ts +1074 -1074
- package/src/solana/swaps/SwapTypeEnum.ts +30 -30
- package/src/solana/swaps/modules/SolanaDataAccount.ts +302 -302
- package/src/solana/swaps/modules/SolanaLpVault.ts +208 -208
- package/src/solana/swaps/modules/SwapClaim.ts +387 -387
- package/src/solana/swaps/modules/SwapInit.ts +785 -785
- package/src/solana/swaps/modules/SwapRefund.ts +353 -353
- package/src/solana/swaps/v1/programIdl.json +944 -944
- package/src/solana/swaps/v1/programTypes.ts +1885 -1885
- package/src/solana/swaps/v2/programIdl.json +951 -951
- package/src/solana/swaps/v2/programTypes.ts +1899 -1899
- package/src/solana/wallet/SolanaKeypairWallet.ts +56 -56
- package/src/solana/wallet/SolanaSigner.ts +43 -43
- package/src/utils/Utils.ts +194 -194
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { SolanaModule } from "../SolanaModule";
|
|
2
|
-
import { Finality, ParsedAccountsModeBlockResponse } from "@solana/web3.js";
|
|
3
|
-
export type BlockChecked = ParsedAccountsModeBlockResponse & {
|
|
4
|
-
blockTime: number;
|
|
5
|
-
blockHeight: number;
|
|
6
|
-
};
|
|
7
|
-
export declare class SolanaBlocks extends SolanaModule {
|
|
8
|
-
private blockCache;
|
|
9
|
-
/**
|
|
10
|
-
* Initiates a fetch of the block at specified slot & saves the fetch promise into a block cache
|
|
11
|
-
*
|
|
12
|
-
* @param slot
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
private fetchAndSaveParsedBlock;
|
|
16
|
-
/**
|
|
17
|
-
* Tries to find the latest existing block for a given commitment, skipping blocks that are not available, runs a
|
|
18
|
-
* search backwards from the latest slot for the given commitment and fails after 10 tries
|
|
19
|
-
*
|
|
20
|
-
* @param commitment
|
|
21
|
-
*/
|
|
22
|
-
findLatestParsedBlock(commitment: Finality): Promise<{
|
|
23
|
-
block: BlockChecked;
|
|
24
|
-
slot: number;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Gets parsed block for a given slot, uses block cache if the block was already fetched before
|
|
28
|
-
*
|
|
29
|
-
* @param slot
|
|
30
|
-
*/
|
|
31
|
-
getParsedBlock(slot: number): Promise<BlockChecked>;
|
|
32
|
-
}
|
|
1
|
+
import { SolanaModule } from "../SolanaModule";
|
|
2
|
+
import { Finality, ParsedAccountsModeBlockResponse } from "@solana/web3.js";
|
|
3
|
+
export type BlockChecked = ParsedAccountsModeBlockResponse & {
|
|
4
|
+
blockTime: number;
|
|
5
|
+
blockHeight: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class SolanaBlocks extends SolanaModule {
|
|
8
|
+
private blockCache;
|
|
9
|
+
/**
|
|
10
|
+
* Initiates a fetch of the block at specified slot & saves the fetch promise into a block cache
|
|
11
|
+
*
|
|
12
|
+
* @param slot
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
private fetchAndSaveParsedBlock;
|
|
16
|
+
/**
|
|
17
|
+
* Tries to find the latest existing block for a given commitment, skipping blocks that are not available, runs a
|
|
18
|
+
* search backwards from the latest slot for the given commitment and fails after 10 tries
|
|
19
|
+
*
|
|
20
|
+
* @param commitment
|
|
21
|
+
*/
|
|
22
|
+
findLatestParsedBlock(commitment: Finality): Promise<{
|
|
23
|
+
block: BlockChecked;
|
|
24
|
+
slot: number;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets parsed block for a given slot, uses block cache if the block was already fetched before
|
|
28
|
+
*
|
|
29
|
+
* @param slot
|
|
30
|
+
*/
|
|
31
|
+
getParsedBlock(slot: number): Promise<BlockChecked>;
|
|
32
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaBlocks = void 0;
|
|
4
|
-
const SolanaModule_1 = require("../SolanaModule");
|
|
5
|
-
class SolanaBlocks extends SolanaModule_1.SolanaModule {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.blockCache = new Map();
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Initiates a fetch of the block at specified slot & saves the fetch promise into a block cache
|
|
12
|
-
*
|
|
13
|
-
* @param slot
|
|
14
|
-
* @private
|
|
15
|
-
*/
|
|
16
|
-
fetchAndSaveParsedBlock(slot) {
|
|
17
|
-
const blockCacheData = this.connection.getParsedBlock(slot, {
|
|
18
|
-
transactionDetails: "none",
|
|
19
|
-
commitment: "confirmed",
|
|
20
|
-
rewards: false
|
|
21
|
-
}).then(val => {
|
|
22
|
-
if (val.blockHeight == null || val.blockTime == null)
|
|
23
|
-
throw new Error(`Cannot get block for slot ${slot}: blockHeight or blockTime empty!`);
|
|
24
|
-
return val;
|
|
25
|
-
});
|
|
26
|
-
this.blockCache.set(slot, blockCacheData);
|
|
27
|
-
blockCacheData.catch(() => {
|
|
28
|
-
if (this.blockCache.get(slot) == blockCacheData)
|
|
29
|
-
this.blockCache.delete(slot);
|
|
30
|
-
});
|
|
31
|
-
return blockCacheData;
|
|
32
|
-
}
|
|
33
|
-
///////////////////
|
|
34
|
-
//// Blocks
|
|
35
|
-
/**
|
|
36
|
-
* Tries to find the latest existing block for a given commitment, skipping blocks that are not available, runs a
|
|
37
|
-
* search backwards from the latest slot for the given commitment and fails after 10 tries
|
|
38
|
-
*
|
|
39
|
-
* @param commitment
|
|
40
|
-
*/
|
|
41
|
-
async findLatestParsedBlock(commitment) {
|
|
42
|
-
let slot = await this.root.Slots.getSlot(commitment);
|
|
43
|
-
for (let i = 0; i < 16; i++) {
|
|
44
|
-
const block = await this.getParsedBlock(slot).catch(e => {
|
|
45
|
-
const errorStr = e.toString();
|
|
46
|
-
if (errorStr.startsWith("SolanaJSONRPCError: failed to get block:") && (errorStr.includes("Block not available for slot") ||
|
|
47
|
-
errorStr.includes("was skipped") ||
|
|
48
|
-
errorStr.includes("missing in long-term storage"))) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
throw e;
|
|
52
|
-
});
|
|
53
|
-
if (block != null) {
|
|
54
|
-
this.logger.debug("findLatestParsedBlock(): Found valid block, slot: " + slot +
|
|
55
|
-
" blockhash: " + block.blockhash + " tries: " + i);
|
|
56
|
-
return {
|
|
57
|
-
block,
|
|
58
|
-
slot
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
slot--;
|
|
62
|
-
}
|
|
63
|
-
throw new Error(`Ran out of tries trying to find a parsedBlock, last attempted slot: ${slot + 1}`);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Gets parsed block for a given slot, uses block cache if the block was already fetched before
|
|
67
|
-
*
|
|
68
|
-
* @param slot
|
|
69
|
-
*/
|
|
70
|
-
getParsedBlock(slot) {
|
|
71
|
-
let blockCacheData = this.blockCache.get(slot);
|
|
72
|
-
if (blockCacheData == null) {
|
|
73
|
-
blockCacheData = this.fetchAndSaveParsedBlock(slot);
|
|
74
|
-
}
|
|
75
|
-
return blockCacheData;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.SolanaBlocks = SolanaBlocks;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaBlocks = void 0;
|
|
4
|
+
const SolanaModule_1 = require("../SolanaModule");
|
|
5
|
+
class SolanaBlocks extends SolanaModule_1.SolanaModule {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.blockCache = new Map();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Initiates a fetch of the block at specified slot & saves the fetch promise into a block cache
|
|
12
|
+
*
|
|
13
|
+
* @param slot
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
fetchAndSaveParsedBlock(slot) {
|
|
17
|
+
const blockCacheData = this.connection.getParsedBlock(slot, {
|
|
18
|
+
transactionDetails: "none",
|
|
19
|
+
commitment: "confirmed",
|
|
20
|
+
rewards: false
|
|
21
|
+
}).then(val => {
|
|
22
|
+
if (val.blockHeight == null || val.blockTime == null)
|
|
23
|
+
throw new Error(`Cannot get block for slot ${slot}: blockHeight or blockTime empty!`);
|
|
24
|
+
return val;
|
|
25
|
+
});
|
|
26
|
+
this.blockCache.set(slot, blockCacheData);
|
|
27
|
+
blockCacheData.catch(() => {
|
|
28
|
+
if (this.blockCache.get(slot) == blockCacheData)
|
|
29
|
+
this.blockCache.delete(slot);
|
|
30
|
+
});
|
|
31
|
+
return blockCacheData;
|
|
32
|
+
}
|
|
33
|
+
///////////////////
|
|
34
|
+
//// Blocks
|
|
35
|
+
/**
|
|
36
|
+
* Tries to find the latest existing block for a given commitment, skipping blocks that are not available, runs a
|
|
37
|
+
* search backwards from the latest slot for the given commitment and fails after 10 tries
|
|
38
|
+
*
|
|
39
|
+
* @param commitment
|
|
40
|
+
*/
|
|
41
|
+
async findLatestParsedBlock(commitment) {
|
|
42
|
+
let slot = await this.root.Slots.getSlot(commitment);
|
|
43
|
+
for (let i = 0; i < 16; i++) {
|
|
44
|
+
const block = await this.getParsedBlock(slot).catch(e => {
|
|
45
|
+
const errorStr = e.toString();
|
|
46
|
+
if (errorStr.startsWith("SolanaJSONRPCError: failed to get block:") && (errorStr.includes("Block not available for slot") ||
|
|
47
|
+
errorStr.includes("was skipped") ||
|
|
48
|
+
errorStr.includes("missing in long-term storage"))) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
throw e;
|
|
52
|
+
});
|
|
53
|
+
if (block != null) {
|
|
54
|
+
this.logger.debug("findLatestParsedBlock(): Found valid block, slot: " + slot +
|
|
55
|
+
" blockhash: " + block.blockhash + " tries: " + i);
|
|
56
|
+
return {
|
|
57
|
+
block,
|
|
58
|
+
slot
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
slot--;
|
|
62
|
+
}
|
|
63
|
+
throw new Error(`Ran out of tries trying to find a parsedBlock, last attempted slot: ${slot + 1}`);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets parsed block for a given slot, uses block cache if the block was already fetched before
|
|
67
|
+
*
|
|
68
|
+
* @param slot
|
|
69
|
+
*/
|
|
70
|
+
getParsedBlock(slot) {
|
|
71
|
+
let blockCacheData = this.blockCache.get(slot);
|
|
72
|
+
if (blockCacheData == null) {
|
|
73
|
+
blockCacheData = this.fetchAndSaveParsedBlock(slot);
|
|
74
|
+
}
|
|
75
|
+
return blockCacheData;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.SolanaBlocks = SolanaBlocks;
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { SolanaModule } from "../SolanaModule";
|
|
2
|
-
import { ConfirmedSignatureInfo, ParsedTransactionWithMeta, PublicKey } from "@solana/web3.js";
|
|
3
|
-
export declare class SolanaEvents extends SolanaModule {
|
|
4
|
-
readonly LOG_FETCH_LIMIT = 500;
|
|
5
|
-
private usingHeliusTFA;
|
|
6
|
-
/**
|
|
7
|
-
* Gets the signatures for a given topicKey public key, if lastProcessedSignature is specified, it fetches only
|
|
8
|
-
* the signatures before this signature
|
|
9
|
-
*
|
|
10
|
-
* @param topicKey
|
|
11
|
-
* @param logFetchLimit
|
|
12
|
-
* @param lastProcessedSignature
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
private getSignatures;
|
|
16
|
-
/**
|
|
17
|
-
* Implements Helius getTransactionsForAddress RPC API
|
|
18
|
-
*
|
|
19
|
-
* @param account
|
|
20
|
-
* @param options
|
|
21
|
-
* @param commitment
|
|
22
|
-
*/
|
|
23
|
-
getTransactionsForAddress(account: PublicKey, options?: {
|
|
24
|
-
paginationToken?: string;
|
|
25
|
-
filters?: {
|
|
26
|
-
slot?: {
|
|
27
|
-
gte?: number;
|
|
28
|
-
lte?: number;
|
|
29
|
-
gt?: number;
|
|
30
|
-
lt?: number;
|
|
31
|
-
};
|
|
32
|
-
blockTime?: {
|
|
33
|
-
gte?: number;
|
|
34
|
-
lte?: number;
|
|
35
|
-
gt?: number;
|
|
36
|
-
lt?: number;
|
|
37
|
-
eq?: number;
|
|
38
|
-
};
|
|
39
|
-
signature?: {
|
|
40
|
-
gte?: number;
|
|
41
|
-
lte?: number;
|
|
42
|
-
gt?: number;
|
|
43
|
-
lt?: number;
|
|
44
|
-
eq?: number;
|
|
45
|
-
};
|
|
46
|
-
status?: "succeeded" | "failed" | "any";
|
|
47
|
-
};
|
|
48
|
-
}, commitment?: "finalized" | "confirmed" | "processed"): Promise<{
|
|
49
|
-
data: ParsedTransactionWithMeta[];
|
|
50
|
-
paginationToken?: string;
|
|
51
|
-
} | null>;
|
|
52
|
-
private _findInTxsTFA;
|
|
53
|
-
/**
|
|
54
|
-
* Runs a search backwards in time, processing transaction signatures for a specific topic public key
|
|
55
|
-
*
|
|
56
|
-
* @param topicKey
|
|
57
|
-
* @param processor called for every batch of returned signatures, should return a value if the correct signature
|
|
58
|
-
* was found, or null if the search should continue
|
|
59
|
-
* @param abortSignal
|
|
60
|
-
* @param logFetchLimit
|
|
61
|
-
* @param startBlockheight
|
|
62
|
-
*/
|
|
63
|
-
private _findInSignatures;
|
|
64
|
-
findInSignatures<T>(topicKey: PublicKey, processor: (data: {
|
|
65
|
-
signatures?: ConfirmedSignatureInfo[];
|
|
66
|
-
txs?: ParsedTransactionWithMeta[];
|
|
67
|
-
}) => Promise<T | undefined | null>, abortSignal?: AbortSignal, logFetchLimit?: number, startBlockheight?: number): Promise<T | null>;
|
|
68
|
-
}
|
|
1
|
+
import { SolanaModule } from "../SolanaModule";
|
|
2
|
+
import { ConfirmedSignatureInfo, ParsedTransactionWithMeta, PublicKey } from "@solana/web3.js";
|
|
3
|
+
export declare class SolanaEvents extends SolanaModule {
|
|
4
|
+
readonly LOG_FETCH_LIMIT = 500;
|
|
5
|
+
private usingHeliusTFA;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the signatures for a given topicKey public key, if lastProcessedSignature is specified, it fetches only
|
|
8
|
+
* the signatures before this signature
|
|
9
|
+
*
|
|
10
|
+
* @param topicKey
|
|
11
|
+
* @param logFetchLimit
|
|
12
|
+
* @param lastProcessedSignature
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
private getSignatures;
|
|
16
|
+
/**
|
|
17
|
+
* Implements Helius getTransactionsForAddress RPC API
|
|
18
|
+
*
|
|
19
|
+
* @param account
|
|
20
|
+
* @param options
|
|
21
|
+
* @param commitment
|
|
22
|
+
*/
|
|
23
|
+
getTransactionsForAddress(account: PublicKey, options?: {
|
|
24
|
+
paginationToken?: string;
|
|
25
|
+
filters?: {
|
|
26
|
+
slot?: {
|
|
27
|
+
gte?: number;
|
|
28
|
+
lte?: number;
|
|
29
|
+
gt?: number;
|
|
30
|
+
lt?: number;
|
|
31
|
+
};
|
|
32
|
+
blockTime?: {
|
|
33
|
+
gte?: number;
|
|
34
|
+
lte?: number;
|
|
35
|
+
gt?: number;
|
|
36
|
+
lt?: number;
|
|
37
|
+
eq?: number;
|
|
38
|
+
};
|
|
39
|
+
signature?: {
|
|
40
|
+
gte?: number;
|
|
41
|
+
lte?: number;
|
|
42
|
+
gt?: number;
|
|
43
|
+
lt?: number;
|
|
44
|
+
eq?: number;
|
|
45
|
+
};
|
|
46
|
+
status?: "succeeded" | "failed" | "any";
|
|
47
|
+
};
|
|
48
|
+
}, commitment?: "finalized" | "confirmed" | "processed"): Promise<{
|
|
49
|
+
data: ParsedTransactionWithMeta[];
|
|
50
|
+
paginationToken?: string;
|
|
51
|
+
} | null>;
|
|
52
|
+
private _findInTxsTFA;
|
|
53
|
+
/**
|
|
54
|
+
* Runs a search backwards in time, processing transaction signatures for a specific topic public key
|
|
55
|
+
*
|
|
56
|
+
* @param topicKey
|
|
57
|
+
* @param processor called for every batch of returned signatures, should return a value if the correct signature
|
|
58
|
+
* was found, or null if the search should continue
|
|
59
|
+
* @param abortSignal
|
|
60
|
+
* @param logFetchLimit
|
|
61
|
+
* @param startBlockheight
|
|
62
|
+
*/
|
|
63
|
+
private _findInSignatures;
|
|
64
|
+
findInSignatures<T>(topicKey: PublicKey, processor: (data: {
|
|
65
|
+
signatures?: ConfirmedSignatureInfo[];
|
|
66
|
+
txs?: ParsedTransactionWithMeta[];
|
|
67
|
+
}) => Promise<T | undefined | null>, abortSignal?: AbortSignal, logFetchLimit?: number, startBlockheight?: number): Promise<T | null>;
|
|
68
|
+
}
|