@clonegod/ttd-sol-common 1.2.1 → 2.0.1
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/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/quote/index.d.ts +1 -3
- package/dist/quote/index.js +1 -3
- package/dist/quote/pricing/index.d.ts +1 -0
- package/dist/{helius_sdk_v1.4.0/utils → quote/pricing}/index.js +1 -1
- package/dist/quote/pricing/token_price_cache.d.ts +9 -0
- package/dist/quote/pricing/token_price_cache.js +39 -0
- package/package.json +2 -3
- package/src/index.ts +1 -0
- package/src/quote/index.ts +1 -0
- package/src/quote/pricing/index.ts +1 -0
- package/src/quote/pricing/token_price_cache.ts +48 -0
- package/tsconfig.json +22 -0
- package/dist/appconfig/app_config.d.ts +0 -23
- package/dist/appconfig/app_config.js +0 -134
- package/dist/appconfig/env_args.d.ts +0 -27
- package/dist/appconfig/env_args.js +0 -39
- package/dist/appconfig/index.d.ts +0 -2
- package/dist/appconfig/index.js +0 -18
- package/dist/common/constants.d.ts +0 -12
- package/dist/common/constants.js +0 -18
- package/dist/common/context.d.ts +0 -23
- package/dist/common/context.js +0 -51
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.js +0 -18
- package/dist/helius_geyser_ws/index.d.ts +0 -3
- package/dist/helius_geyser_ws/index.js +0 -19
- package/dist/helius_geyser_ws/subscribe_pool_change_by_geyser.d.ts +0 -3
- package/dist/helius_geyser_ws/subscribe_pool_change_by_geyser.js +0 -102
- package/dist/helius_geyser_ws/subscribe_txid.d.ts +0 -2
- package/dist/helius_geyser_ws/subscribe_txid.js +0 -109
- package/dist/helius_geyser_ws/subscribe_wallet_transaction.d.ts +0 -2
- package/dist/helius_geyser_ws/subscribe_wallet_transaction.js +0 -102
- package/dist/helius_sdk_v1.4.0/Helius.d.ts +0 -31
- package/dist/helius_sdk_v1.4.0/Helius.js +0 -450
- package/dist/helius_sdk_v1.4.0/RpcClient.d.ts +0 -70
- package/dist/helius_sdk_v1.4.0/RpcClient.js +0 -978
- package/dist/helius_sdk_v1.4.0/constants.d.ts +0 -1
- package/dist/helius_sdk_v1.4.0/constants.js +0 -4
- package/dist/helius_sdk_v1.4.0/index.d.ts +0 -5
- package/dist/helius_sdk_v1.4.0/index.js +0 -21
- package/dist/helius_sdk_v1.4.0/types/das-types.d.ts +0 -408
- package/dist/helius_sdk_v1.4.0/types/das-types.js +0 -2
- package/dist/helius_sdk_v1.4.0/types/enums.d.ts +0 -542
- package/dist/helius_sdk_v1.4.0/types/enums.js +0 -606
- package/dist/helius_sdk_v1.4.0/types/index.d.ts +0 -3
- package/dist/helius_sdk_v1.4.0/types/index.js +0 -19
- package/dist/helius_sdk_v1.4.0/types/types.d.ts +0 -305
- package/dist/helius_sdk_v1.4.0/types/types.js +0 -2
- package/dist/helius_sdk_v1.4.0/utils/get-helius-endpoints.d.ts +0 -2
- package/dist/helius_sdk_v1.4.0/utils/get-helius-endpoints.js +0 -19
- package/dist/helius_sdk_v1.4.0/utils/index.d.ts +0 -1
- package/dist/helius_sdk_v1.4.0/utils/mintApi.d.ts +0 -2
- package/dist/helius_sdk_v1.4.0/utils/mintApi.js +0 -14
- package/dist/jito/index.d.ts +0 -14
- package/dist/jito/index.js +0 -142
- package/dist/jito/jitodontfront.d.ts +0 -5
- package/dist/jito/jitodontfront.js +0 -41
- package/dist/quote/log_quote_price.d.ts +0 -2
- package/dist/quote/log_quote_price.js +0 -29
- package/dist/quote/publish_quote_price.d.ts +0 -3
- package/dist/quote/publish_quote_price.js +0 -19
- package/dist/quote/to_price_message.d.ts +0 -5
- package/dist/quote/to_price_message.js +0 -103
- package/dist/send_tx/get_jito_tip_floor.d.ts +0 -1
- package/dist/send_tx/get_jito_tip_floor.js +0 -86
- package/dist/send_tx/get_signature.d.ts +0 -2
- package/dist/send_tx/get_signature.js +0 -17
- package/dist/send_tx/helius_client.d.ts +0 -16
- package/dist/send_tx/helius_client.js +0 -119
- package/dist/send_tx/index.d.ts +0 -4
- package/dist/send_tx/index.js +0 -20
- package/dist/send_tx/notify_new_txid.d.ts +0 -1
- package/dist/send_tx/notify_new_txid.js +0 -20
- package/dist/send_tx/sol_gas_cache.d.ts +0 -3
- package/dist/send_tx/sol_gas_cache.js +0 -15
- package/dist/send_tx/strategy_util.d.ts +0 -7
- package/dist/send_tx/strategy_util.js +0 -147
- package/dist/token/get_token_info.d.ts +0 -4
- package/dist/token/get_token_info.js +0 -136
- package/dist/token/get_token_price.d.ts +0 -6
- package/dist/token/get_token_price.js +0 -186
- package/dist/token/index.d.ts +0 -4
- package/dist/token/index.js +0 -20
- package/dist/token/types.d.ts +0 -17
- package/dist/token/types.js +0 -2
- package/dist/token/util.d.ts +0 -3
- package/dist/token/util.js +0 -33
- package/dist/trade/abstract_trade.d.ts +0 -5
- package/dist/trade/abstract_trade.js +0 -6
- package/dist/trade/handle_order_message.d.ts +0 -4
- package/dist/trade/handle_order_message.js +0 -118
- package/dist/trade/index.d.ts +0 -4
- package/dist/trade/index.js +0 -20
- package/dist/trade/tx_result_check.d.ts +0 -29
- package/dist/trade/tx_result_check.js +0 -232
- package/dist/trade/tx_result_parse.d.ts +0 -13
- package/dist/trade/tx_result_parse.js +0 -150
- package/grpc/transaction/LThcUp2D5p4JgRMnWEUVVSdNEHiq5YfN5HXPGRYeWBfypMT3aTa1CaC9XdPT69CyMdoJ32XAkjXAa2TmBYBeZAy.json +0 -1
- package/types/index.d.ts +0 -71
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import type { BlockhashWithExpiryBlockHeight, Cluster, Keypair, Transaction, TransactionConfirmationStatus, TransactionError, VersionedTransaction, SendOptions as SolanaWebJsSendOptions } from '@solana/web3.js';
|
|
2
|
-
import type { WebhookType, TokenStandard, TransactionType, Source, ProgramName, TransactionContext, TxnStatus, AccountWebhookEncoding, PriorityLevel, UiTransactionEncoding } from './enums';
|
|
3
|
-
export type HeliusCluster = Omit<Cluster, 'testnet'>;
|
|
4
|
-
export type SmartTransactionContext = {
|
|
5
|
-
transaction: Transaction | VersionedTransaction;
|
|
6
|
-
blockhash: BlockhashWithExpiryBlockHeight;
|
|
7
|
-
minContextSlot: number;
|
|
8
|
-
};
|
|
9
|
-
export interface HeliusEndpoints {
|
|
10
|
-
api: string;
|
|
11
|
-
rpc: string;
|
|
12
|
-
}
|
|
13
|
-
export type HeliusOptions = {
|
|
14
|
-
limit?: number;
|
|
15
|
-
paginationToken?: string;
|
|
16
|
-
};
|
|
17
|
-
export interface Webhook {
|
|
18
|
-
webhookID: string;
|
|
19
|
-
wallet: string;
|
|
20
|
-
project: string;
|
|
21
|
-
webhookURL: string;
|
|
22
|
-
transactionTypes: TransactionType[];
|
|
23
|
-
accountAddresses: string[];
|
|
24
|
-
accountAddressOwners?: string[];
|
|
25
|
-
webhookType?: WebhookType;
|
|
26
|
-
authHeader?: string;
|
|
27
|
-
txnStatus?: TxnStatus;
|
|
28
|
-
encoding?: AccountWebhookEncoding;
|
|
29
|
-
}
|
|
30
|
-
export type CollectionIdentifier = {
|
|
31
|
-
firstVerifiedCreators?: string[];
|
|
32
|
-
verifiedCollectionAddresses?: string[];
|
|
33
|
-
};
|
|
34
|
-
export type CreateWebhookRequest = Omit<Webhook, 'webhookID' | 'wallet' | 'project'>;
|
|
35
|
-
export type EditWebhookRequest = Partial<Omit<Webhook, 'webhookID' | 'wallet' | 'project'>>;
|
|
36
|
-
export interface CreateCollectionWebhookRequest extends CreateWebhookRequest {
|
|
37
|
-
collectionQuery: CollectionIdentifier;
|
|
38
|
-
}
|
|
39
|
-
export interface MintlistResponse {
|
|
40
|
-
result: MintlistItem[];
|
|
41
|
-
paginationToken: string;
|
|
42
|
-
}
|
|
43
|
-
export type MintlistRequest = {
|
|
44
|
-
query: CollectionIdentifier;
|
|
45
|
-
options?: HeliusOptions;
|
|
46
|
-
};
|
|
47
|
-
export interface MintlistItem {
|
|
48
|
-
mint: string;
|
|
49
|
-
name: string;
|
|
50
|
-
}
|
|
51
|
-
export interface RawTokenAmount {
|
|
52
|
-
tokenAmount: string;
|
|
53
|
-
decimals: number;
|
|
54
|
-
}
|
|
55
|
-
export interface TokenBalanceChange {
|
|
56
|
-
userAccount: string;
|
|
57
|
-
tokenAccount: string;
|
|
58
|
-
rawTokenAmount: RawTokenAmount;
|
|
59
|
-
mint: string;
|
|
60
|
-
}
|
|
61
|
-
export interface AccountData {
|
|
62
|
-
account: string;
|
|
63
|
-
nativeBalanceChange: number;
|
|
64
|
-
tokenBalanceChanges: TokenBalanceChange[] | null;
|
|
65
|
-
}
|
|
66
|
-
export interface TokenTransfer {
|
|
67
|
-
fromUserAccount: string | null;
|
|
68
|
-
toUserAccount: string | null;
|
|
69
|
-
fromTokenAccount: string | null;
|
|
70
|
-
toTokenAccount: string | null;
|
|
71
|
-
tokenAmount: number;
|
|
72
|
-
decimals: number;
|
|
73
|
-
tokenStandard: TokenStandard;
|
|
74
|
-
mint: string;
|
|
75
|
-
}
|
|
76
|
-
export interface NativeBalanceChange {
|
|
77
|
-
account: string;
|
|
78
|
-
amount: number;
|
|
79
|
-
}
|
|
80
|
-
export interface NativeTransfer {
|
|
81
|
-
fromUserAccount: string | null;
|
|
82
|
-
toUserAccount: string | null;
|
|
83
|
-
amount: number;
|
|
84
|
-
}
|
|
85
|
-
export type Instruction = {
|
|
86
|
-
accounts: string[];
|
|
87
|
-
data: string;
|
|
88
|
-
programId: string;
|
|
89
|
-
innerInstructions: InnerInstruction[];
|
|
90
|
-
};
|
|
91
|
-
export type InnerInstruction = {
|
|
92
|
-
accounts: string[];
|
|
93
|
-
data: string;
|
|
94
|
-
programId: string;
|
|
95
|
-
};
|
|
96
|
-
export interface ProgramInfo {
|
|
97
|
-
source: Source;
|
|
98
|
-
account: string;
|
|
99
|
-
programName: ProgramName;
|
|
100
|
-
instructionName: string;
|
|
101
|
-
}
|
|
102
|
-
export interface TokenSwap {
|
|
103
|
-
nativeInput: NativeTransfer | null;
|
|
104
|
-
nativeOutput: NativeTransfer | null;
|
|
105
|
-
tokenInputs: TokenTransfer[];
|
|
106
|
-
tokenOutputs: TokenTransfer[];
|
|
107
|
-
tokenFees: TokenTransfer[];
|
|
108
|
-
nativeFees: NativeTransfer[];
|
|
109
|
-
programInfo: ProgramInfo;
|
|
110
|
-
}
|
|
111
|
-
export interface SwapEvent {
|
|
112
|
-
nativeInput: NativeBalanceChange;
|
|
113
|
-
nativeOutput: NativeBalanceChange;
|
|
114
|
-
tokenInputs: TokenBalanceChange[];
|
|
115
|
-
tokenOutputs: TokenBalanceChange[];
|
|
116
|
-
tokenFees: TokenBalanceChange[];
|
|
117
|
-
nativeFees: NativeBalanceChange[];
|
|
118
|
-
innerSwaps: TokenSwap[];
|
|
119
|
-
}
|
|
120
|
-
export interface CompressedNftCreator {
|
|
121
|
-
address: string;
|
|
122
|
-
share: number;
|
|
123
|
-
verified: boolean;
|
|
124
|
-
}
|
|
125
|
-
export interface CompressedNftMetadata {
|
|
126
|
-
collection: {
|
|
127
|
-
key: string;
|
|
128
|
-
verified: boolean;
|
|
129
|
-
};
|
|
130
|
-
creators: CompressedNftCreator[];
|
|
131
|
-
isMutable: boolean;
|
|
132
|
-
name: string;
|
|
133
|
-
primarySaleHappened: boolean;
|
|
134
|
-
sellerFeeBasisPoints: number;
|
|
135
|
-
symbol: string;
|
|
136
|
-
tokenProgramVersion: string;
|
|
137
|
-
tokenStandard: TokenStandard;
|
|
138
|
-
uri: string;
|
|
139
|
-
}
|
|
140
|
-
export interface CompressedNftEvent {
|
|
141
|
-
type: TransactionType;
|
|
142
|
-
treeId: string;
|
|
143
|
-
leafIndex: number | null;
|
|
144
|
-
seq: number | null;
|
|
145
|
-
assetId: string | null;
|
|
146
|
-
instructionIndex: number | null;
|
|
147
|
-
innerInstructionIndex: number | null;
|
|
148
|
-
newLeafOwner: string | null;
|
|
149
|
-
oldLeafOwner: string | null;
|
|
150
|
-
newLeafDelegate: string | null;
|
|
151
|
-
oldLeafDelegate: string | null;
|
|
152
|
-
treeDelegate: string | null;
|
|
153
|
-
metadata: CompressedNftMetadata | null;
|
|
154
|
-
}
|
|
155
|
-
export interface Token {
|
|
156
|
-
mint: string;
|
|
157
|
-
tokenStandard: TokenStandard;
|
|
158
|
-
}
|
|
159
|
-
export interface NFTEvent {
|
|
160
|
-
seller: string;
|
|
161
|
-
buyer: string;
|
|
162
|
-
timestamp: number;
|
|
163
|
-
amount: number;
|
|
164
|
-
fee: number;
|
|
165
|
-
signature: string;
|
|
166
|
-
source: Source;
|
|
167
|
-
type: TransactionType;
|
|
168
|
-
saleType?: TransactionContext;
|
|
169
|
-
nfts: Token[];
|
|
170
|
-
}
|
|
171
|
-
export interface TransactionEvent {
|
|
172
|
-
nft: NFTEvent | null;
|
|
173
|
-
swap: SwapEvent | null;
|
|
174
|
-
compressed: CompressedNftEvent[] | null;
|
|
175
|
-
}
|
|
176
|
-
export interface EnrichedTransaction {
|
|
177
|
-
description: string;
|
|
178
|
-
type: TransactionType;
|
|
179
|
-
source: Source;
|
|
180
|
-
fee: number;
|
|
181
|
-
feePayer: string;
|
|
182
|
-
signature: string;
|
|
183
|
-
slot: number;
|
|
184
|
-
timestamp: number;
|
|
185
|
-
nativeTransfers: NativeTransfer[] | null;
|
|
186
|
-
tokenTransfers: TokenTransfer[] | null;
|
|
187
|
-
accountData: AccountData[];
|
|
188
|
-
transactionError: TransactionError | null;
|
|
189
|
-
instructions: Instruction[];
|
|
190
|
-
events: TransactionEvent;
|
|
191
|
-
}
|
|
192
|
-
export interface MintApiRequest {
|
|
193
|
-
name: string;
|
|
194
|
-
symbol: string;
|
|
195
|
-
description?: string;
|
|
196
|
-
owner: string;
|
|
197
|
-
delegate?: string;
|
|
198
|
-
collection?: string;
|
|
199
|
-
creators?: {
|
|
200
|
-
address: string;
|
|
201
|
-
share: number;
|
|
202
|
-
}[];
|
|
203
|
-
uri?: string;
|
|
204
|
-
sellerFeeBasisPoints?: number;
|
|
205
|
-
imageUrl?: string;
|
|
206
|
-
externalUrl?: string;
|
|
207
|
-
attributes?: {
|
|
208
|
-
trait_type: string;
|
|
209
|
-
value: string;
|
|
210
|
-
}[];
|
|
211
|
-
imagePath?: string;
|
|
212
|
-
walletPrivateKey?: string;
|
|
213
|
-
}
|
|
214
|
-
export interface MintApiResponse {
|
|
215
|
-
jsonrpc: string;
|
|
216
|
-
id: string;
|
|
217
|
-
result: {
|
|
218
|
-
signature: string;
|
|
219
|
-
minted: boolean;
|
|
220
|
-
assetId: string;
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export interface DelegateCollectionAuthorityRequest {
|
|
224
|
-
collectionMint: string;
|
|
225
|
-
newCollectionAuthority?: string;
|
|
226
|
-
updateAuthorityKeypair: Keypair;
|
|
227
|
-
payerKeypair?: Keypair;
|
|
228
|
-
}
|
|
229
|
-
export interface RevokeCollectionAuthorityRequest {
|
|
230
|
-
collectionMint: string;
|
|
231
|
-
delegatedCollectionAuthority?: string;
|
|
232
|
-
revokeAuthorityKeypair: Keypair;
|
|
233
|
-
payerKeypair?: Keypair;
|
|
234
|
-
}
|
|
235
|
-
interface AssetControllerAccount {
|
|
236
|
-
address: string;
|
|
237
|
-
mint: string;
|
|
238
|
-
authority: string;
|
|
239
|
-
delegate: string;
|
|
240
|
-
version: number;
|
|
241
|
-
closed: boolean;
|
|
242
|
-
}
|
|
243
|
-
interface DataRegistryAccount {
|
|
244
|
-
address: string;
|
|
245
|
-
mint: string;
|
|
246
|
-
version: number;
|
|
247
|
-
closed: boolean;
|
|
248
|
-
}
|
|
249
|
-
interface IdentityRegistryAccount {
|
|
250
|
-
address: string;
|
|
251
|
-
mint: string;
|
|
252
|
-
authority: string;
|
|
253
|
-
delegate: string;
|
|
254
|
-
version: number;
|
|
255
|
-
closed: boolean;
|
|
256
|
-
}
|
|
257
|
-
interface PolicyEngine {
|
|
258
|
-
address: string;
|
|
259
|
-
mint: string;
|
|
260
|
-
authority: string;
|
|
261
|
-
delegate: string;
|
|
262
|
-
policies: string[];
|
|
263
|
-
version: number;
|
|
264
|
-
closed: boolean;
|
|
265
|
-
}
|
|
266
|
-
export interface FullRwaAccount {
|
|
267
|
-
asset_controller?: AssetControllerAccount;
|
|
268
|
-
data_registry?: DataRegistryAccount;
|
|
269
|
-
identity_registry?: IdentityRegistryAccount;
|
|
270
|
-
policy_engine?: PolicyEngine;
|
|
271
|
-
}
|
|
272
|
-
export interface GetPriorityFeeEstimateOptions {
|
|
273
|
-
priorityLevel?: PriorityLevel;
|
|
274
|
-
includeAllPriorityFeeLevels?: boolean;
|
|
275
|
-
transactionEncoding?: UiTransactionEncoding;
|
|
276
|
-
lookbackSlots?: number;
|
|
277
|
-
recommended?: boolean;
|
|
278
|
-
}
|
|
279
|
-
export interface GetPriorityFeeEstimateRequest {
|
|
280
|
-
transaction?: string;
|
|
281
|
-
accountKeys?: string[];
|
|
282
|
-
options?: GetPriorityFeeEstimateOptions;
|
|
283
|
-
}
|
|
284
|
-
export interface MicroLamportPriorityFeeLevels {
|
|
285
|
-
min: number;
|
|
286
|
-
low: number;
|
|
287
|
-
medium: number;
|
|
288
|
-
high: number;
|
|
289
|
-
veryHigh: number;
|
|
290
|
-
unsafeMax: number;
|
|
291
|
-
}
|
|
292
|
-
export interface GetPriorityFeeEstimateResponse {
|
|
293
|
-
priorityFeeEstimate?: number;
|
|
294
|
-
priorityFeeLevels?: MicroLamportPriorityFeeLevels;
|
|
295
|
-
}
|
|
296
|
-
export type JitoRegion = 'Default' | 'NY' | 'Amsterdam' | 'Frankfurt' | 'Tokyo' | 'Slc';
|
|
297
|
-
export type PollTransactionOptions = {
|
|
298
|
-
confirmationStatuses?: TransactionConfirmationStatus[];
|
|
299
|
-
timeout?: number;
|
|
300
|
-
interval?: number;
|
|
301
|
-
};
|
|
302
|
-
export interface HeliusSendOptions extends SolanaWebJsSendOptions {
|
|
303
|
-
validatorAcls?: string[];
|
|
304
|
-
}
|
|
305
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHeliusEndpoints = getHeliusEndpoints;
|
|
4
|
-
function getHeliusEndpoints(cluster) {
|
|
5
|
-
switch (cluster) {
|
|
6
|
-
case 'devnet':
|
|
7
|
-
return {
|
|
8
|
-
api: 'https://api-devnet.helius-rpc.com',
|
|
9
|
-
rpc: 'https://devnet.helius-rpc.com',
|
|
10
|
-
};
|
|
11
|
-
case 'mainnet-beta':
|
|
12
|
-
return {
|
|
13
|
-
api: 'https://api-mainnet.helius-rpc.com',
|
|
14
|
-
rpc: 'https://mainnet.helius-rpc.com',
|
|
15
|
-
};
|
|
16
|
-
default:
|
|
17
|
-
throw new Error(`Unknown cluster ${cluster}`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './get-helius-endpoints';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mintApiAuthority = mintApiAuthority;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
|
-
function mintApiAuthority(cluster) {
|
|
6
|
-
switch (cluster) {
|
|
7
|
-
case 'devnet':
|
|
8
|
-
return types_1.MintApiAuthority.DEVNET;
|
|
9
|
-
case 'mainnet-beta':
|
|
10
|
-
return types_1.MintApiAuthority.MAINNET;
|
|
11
|
-
default:
|
|
12
|
-
throw new Error('Invalid cluster');
|
|
13
|
-
}
|
|
14
|
-
}
|
package/dist/jito/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare class JitoJsonRpcClient {
|
|
2
|
-
baseUrl: string;
|
|
3
|
-
uuid: string;
|
|
4
|
-
client: any;
|
|
5
|
-
constructor(baseUrl: string, uuid: string);
|
|
6
|
-
sendRequest(endpoint: any, method: any, params: any): Promise<any>;
|
|
7
|
-
getTipAccounts(): Promise<any>;
|
|
8
|
-
getRandomTipAccount(): Promise<any>;
|
|
9
|
-
sendBundle(params: any): Promise<any>;
|
|
10
|
-
sendTxn(params: any, bundleOnly?: boolean): Promise<any>;
|
|
11
|
-
getInFlightBundleStatuses(params: any): Promise<any>;
|
|
12
|
-
getBundleStatuses(params: any): Promise<any>;
|
|
13
|
-
confirmInflightBundle(bundleId: any, timeoutMs?: number): Promise<any>;
|
|
14
|
-
}
|
package/dist/jito/index.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.JitoJsonRpcClient = void 0;
|
|
13
|
-
const axios = require('axios');
|
|
14
|
-
class JitoJsonRpcClient {
|
|
15
|
-
constructor(baseUrl, uuid) {
|
|
16
|
-
this.baseUrl = baseUrl;
|
|
17
|
-
this.uuid = uuid;
|
|
18
|
-
this.client = axios.create({
|
|
19
|
-
headers: {
|
|
20
|
-
'Content-Type': 'application/json',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
sendRequest(endpoint, method, params) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const url = `${this.baseUrl}${endpoint}`;
|
|
27
|
-
const data = {
|
|
28
|
-
jsonrpc: '2.0',
|
|
29
|
-
id: 1,
|
|
30
|
-
method,
|
|
31
|
-
params: params || [],
|
|
32
|
-
};
|
|
33
|
-
console.log(`Sending request to: ${url}`);
|
|
34
|
-
console.log(`Request body: ${JSON.stringify(data, null, 2)}`);
|
|
35
|
-
try {
|
|
36
|
-
const response = yield this.client.post(url, data);
|
|
37
|
-
console.log(`Response status: ${response.status}`);
|
|
38
|
-
console.log(`Response body: ${JSON.stringify(response.data, null, 2)}`);
|
|
39
|
-
return response.data;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (axios.isAxiosError(error)) {
|
|
43
|
-
console.error(`HTTP error: ${error.message}`);
|
|
44
|
-
throw error;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
console.error(`Unexpected error: ${error}`);
|
|
48
|
-
throw new Error('An unexpected error occurred');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
getTipAccounts() {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const endpoint = this.uuid ? `/bundles?uuid=${this.uuid}` : '/bundles';
|
|
56
|
-
return this.sendRequest(endpoint, 'getTipAccounts', null);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
getRandomTipAccount() {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const tipAccountsResponse = yield this.getTipAccounts();
|
|
62
|
-
if (tipAccountsResponse.result && Array.isArray(tipAccountsResponse.result) && tipAccountsResponse.result.length > 0) {
|
|
63
|
-
const randomIndex = Math.floor(Math.random() * tipAccountsResponse.result.length);
|
|
64
|
-
return tipAccountsResponse.result[randomIndex];
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
throw new Error('No tip accounts available');
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
sendBundle(params) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const endpoint = this.uuid ? `/bundles?uuid=${this.uuid}` : '/bundles';
|
|
74
|
-
return this.sendRequest(endpoint, 'sendBundle', params);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
sendTxn(params_1) {
|
|
78
|
-
return __awaiter(this, arguments, void 0, function* (params, bundleOnly = false) {
|
|
79
|
-
let endpoint = '/transactions';
|
|
80
|
-
const queryParams = [];
|
|
81
|
-
if (bundleOnly) {
|
|
82
|
-
queryParams.push('bundleOnly=true');
|
|
83
|
-
}
|
|
84
|
-
if (this.uuid) {
|
|
85
|
-
queryParams.push(`uuid=${this.uuid}`);
|
|
86
|
-
}
|
|
87
|
-
if (queryParams.length > 0) {
|
|
88
|
-
endpoint += `?${queryParams.join('&')}`;
|
|
89
|
-
}
|
|
90
|
-
return this.sendRequest(endpoint, 'sendTransaction', params);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
getInFlightBundleStatuses(params) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const endpoint = this.uuid ? `/bundles?uuid=${this.uuid}` : '/bundles';
|
|
96
|
-
return this.sendRequest(endpoint, 'getInflightBundleStatuses', params);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
getBundleStatuses(params) {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const endpoint = this.uuid ? `/bundles?uuid=${this.uuid}` : '/bundles';
|
|
102
|
-
return this.sendRequest(endpoint, 'getBundleStatuses', params);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
confirmInflightBundle(bundleId_1) {
|
|
106
|
-
return __awaiter(this, arguments, void 0, function* (bundleId, timeoutMs = 60000) {
|
|
107
|
-
const start = Date.now();
|
|
108
|
-
while (Date.now() - start < timeoutMs) {
|
|
109
|
-
try {
|
|
110
|
-
const response = yield this.getInFlightBundleStatuses([[bundleId]]);
|
|
111
|
-
if (response.result && response.result.value && response.result.value.length > 0) {
|
|
112
|
-
const bundleStatus = response.result.value[0];
|
|
113
|
-
console.log(`Bundle status: ${bundleStatus.status}, Landed slot: ${bundleStatus.landed_slot}`);
|
|
114
|
-
if (bundleStatus.status === "Failed") {
|
|
115
|
-
return bundleStatus;
|
|
116
|
-
}
|
|
117
|
-
else if (bundleStatus.status === "Landed") {
|
|
118
|
-
const detailedStatus = yield this.getBundleStatuses([[bundleId]]);
|
|
119
|
-
if (detailedStatus.result && detailedStatus.result.value && detailedStatus.result.value.length > 0) {
|
|
120
|
-
return detailedStatus.result.value[0];
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
console.log('No detailed status returned for landed bundle.');
|
|
124
|
-
return bundleStatus;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
console.log('No status returned for the bundle. It may be invalid or very old.');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
console.error('Error checking bundle status:', error);
|
|
134
|
-
}
|
|
135
|
-
yield new Promise(resolve => setTimeout(resolve, 2000));
|
|
136
|
-
}
|
|
137
|
-
console.log(`Bundle ${bundleId} has not reached a final state within ${timeoutMs}ms`);
|
|
138
|
-
return { status: 'Timeout' };
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
exports.JitoJsonRpcClient = JitoJsonRpcClient;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Keypair } from "@solana/web3.js";
|
|
2
|
-
import { Transaction, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
-
import { PublicKey } from "@solana/web3.js";
|
|
4
|
-
export declare function createJitoDontFrontTransaction(recentBlockhash: string, tipPayer: Keypair): Transaction;
|
|
5
|
-
export declare function createCustomComputeBudgetInstructionWithJitoDontFront(jitodontfrontPubkey: PublicKey, units: number): TransactionInstruction;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createJitoDontFrontTransaction = createJitoDontFrontTransaction;
|
|
4
|
-
exports.createCustomComputeBudgetInstructionWithJitoDontFront = createCustomComputeBudgetInstructionWithJitoDontFront;
|
|
5
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
-
const web3_js_2 = require("@solana/web3.js");
|
|
7
|
-
const web3_js_3 = require("@solana/web3.js");
|
|
8
|
-
function createJitoDontFrontTransaction(recentBlockhash, tipPayer) {
|
|
9
|
-
const jitodontfrontPubkey = process.env.JITODONTFRONT_PUBKEY || 'jitodontfront111111111111111111111111111111';
|
|
10
|
-
const jitoDontFrontTransaction = new web3_js_2.Transaction();
|
|
11
|
-
jitoDontFrontTransaction.add(createCustomComputeBudgetInstruction(tipPayer.publicKey, new web3_js_3.PublicKey(jitodontfrontPubkey), 100000));
|
|
12
|
-
jitoDontFrontTransaction.recentBlockhash = recentBlockhash;
|
|
13
|
-
jitoDontFrontTransaction.feePayer = tipPayer.publicKey;
|
|
14
|
-
jitoDontFrontTransaction.sign(tipPayer);
|
|
15
|
-
return jitoDontFrontTransaction;
|
|
16
|
-
}
|
|
17
|
-
function createCustomComputeBudgetInstruction(payerPubkey, jitodontfrontPubkey, units) {
|
|
18
|
-
const data = Buffer.alloc(5);
|
|
19
|
-
data.writeUInt8(2, 0);
|
|
20
|
-
data.writeUInt32LE(units, 1);
|
|
21
|
-
return new web3_js_2.TransactionInstruction({
|
|
22
|
-
keys: [
|
|
23
|
-
{ pubkey: payerPubkey, isSigner: true, isWritable: true },
|
|
24
|
-
{ pubkey: jitodontfrontPubkey, isSigner: false, isWritable: false },
|
|
25
|
-
],
|
|
26
|
-
programId: web3_js_1.ComputeBudgetProgram.programId,
|
|
27
|
-
data: data,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function createCustomComputeBudgetInstructionWithJitoDontFront(jitodontfrontPubkey, units) {
|
|
31
|
-
const data = Buffer.alloc(5);
|
|
32
|
-
data.writeUInt8(2, 0);
|
|
33
|
-
data.writeUInt32LE(units, 1);
|
|
34
|
-
return new web3_js_2.TransactionInstruction({
|
|
35
|
-
keys: [
|
|
36
|
-
{ pubkey: jitodontfrontPubkey, isSigner: false, isWritable: false },
|
|
37
|
-
],
|
|
38
|
-
programId: web3_js_1.ComputeBudgetProgram.programId,
|
|
39
|
-
data: data,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.log_quote_price = log_quote_price;
|
|
13
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
14
|
-
function log_quote_price(event_source, price_message, tx_hash) {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const { unique_orderbook_id, pool_name, pair, fee_rate, price_id, quote_amount_usd, ask, bid, time } = price_message;
|
|
17
|
-
let price_time = new Date().getTime();
|
|
18
|
-
let price_time_str = (0, dist_1.parseToDateTime)(price_time);
|
|
19
|
-
let times = [
|
|
20
|
-
time.quote_start_time - time.stream_time,
|
|
21
|
-
time.quote_end_time - time.quote_start_time,
|
|
22
|
-
time.price_time - time.stream_time,
|
|
23
|
-
];
|
|
24
|
-
if (event_source || tx_hash) {
|
|
25
|
-
console.log(`> [${event_source}] - ${tx_hash}`);
|
|
26
|
-
}
|
|
27
|
-
console.log(price_time_str, ' - ', unique_orderbook_id, ' - ', String(price_id).padEnd(32), ' - ', pool_name.padEnd(12), ' - ', pair.padEnd(12), ' - ', String(quote_amount_usd).padEnd(4), ' - ', String(ask.price).padEnd(8), ' - ', String(bid.price).padEnd(8), ' - ', `${times.join(',')} ms`, '\n');
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.publish_quote_price = void 0;
|
|
4
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
5
|
-
const publish_quote_price = (appConfig, price_msg) => {
|
|
6
|
-
const chain_id = appConfig.env_args.chain_id;
|
|
7
|
-
let price_id = price_msg.price_id;
|
|
8
|
-
let event = {
|
|
9
|
-
event_type: dist_1.REDIS_EVENT_TYPE_QUOTE.NEW_QUOTE_PRICE,
|
|
10
|
-
event_time: Date.now(),
|
|
11
|
-
chain_id,
|
|
12
|
-
data: price_msg
|
|
13
|
-
};
|
|
14
|
-
appConfig.arb_cache.redis_event_publisher.publish_quote_price_event(chain_id, event);
|
|
15
|
-
appConfig.arb_cache.cache_price_message(price_msg)
|
|
16
|
-
.then(() => (0, dist_1.log_debug)(`cache price success, price_id=${price_id}`))
|
|
17
|
-
.catch(err => (0, dist_1.log_error)(`cache price error! price_id=${price_id}`, err));
|
|
18
|
-
};
|
|
19
|
-
exports.publish_quote_price = publish_quote_price;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PriceMessageType, QuoteTimeInfoType, StandardPoolInfoType } from '@clonegod/ttd-core';
|
|
2
|
-
import { AppConfig } from '../appconfig';
|
|
3
|
-
export declare const get_quote_token_decimals: (pool_info: StandardPoolInfoType) => number;
|
|
4
|
-
export declare function to_price_message(appConfig: AppConfig, quote_amount_usd: number, tx_price: number, quote_ask_price: number, quote_bid_price: number, pool_info: StandardPoolInfoType, time: QuoteTimeInfoType, slot?: string): Promise<PriceMessageType>;
|
|
5
|
-
export declare function normalize_pair_name(priceMessage: PriceMessageType): void;
|