@clonegod/ttd-sol-common 1.2.1 → 2.0.0
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 -7
- package/dist/index.js +0 -23
- package/package.json +31 -32
- package/src/index.ts +0 -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/index.js +0 -17
- 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/index.d.ts +0 -3
- package/dist/quote/index.js +0 -19
- 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,109 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.subscribe_wallet_transaction_txid = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const ws_1 = __importDefault(require("ws"));
|
|
18
|
-
const constants_1 = require("../common/constants");
|
|
19
|
-
const subscribe_wallet_transaction_txid = (geyser_ws_url, wallet_address, signature, eventEmitter) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
if ((0, dist_1.isEmpty)(geyser_ws_url)) {
|
|
21
|
-
(0, dist_1.log_warn)(`geyser_ws_url is empty, cann't subscribe`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if ((0, dist_1.isEmpty)(signature)) {
|
|
25
|
-
(0, dist_1.log_warn)(`signature is empty, nothing to subscribe`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
var ws_client = new ws_1.default(geyser_ws_url);
|
|
29
|
-
function subscribe_transaction_by_txid() {
|
|
30
|
-
(0, dist_1.log_info)(`subscribe_transaction_by_txid`, {
|
|
31
|
-
wallet_address,
|
|
32
|
-
signature
|
|
33
|
-
});
|
|
34
|
-
const request = {
|
|
35
|
-
jsonrpc: '2.0',
|
|
36
|
-
id: 420,
|
|
37
|
-
method: 'transactionSubscribe',
|
|
38
|
-
params: [
|
|
39
|
-
{
|
|
40
|
-
accountRequired: [wallet_address],
|
|
41
|
-
signature: signature,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
commitment: constants_1.COMMITMENT_LEVEL.PROCESSED,
|
|
45
|
-
encoding: 'base64',
|
|
46
|
-
transactionDetails: 'full',
|
|
47
|
-
showRewards: true,
|
|
48
|
-
maxSupportedTransactionVersion: 0,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
ws_client.send(JSON.stringify(request));
|
|
53
|
-
}
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
ws_client.close();
|
|
56
|
-
(0, dist_1.log_debug)('subscribe_transaction_by_txid, close helius ws conn');
|
|
57
|
-
}, 30000);
|
|
58
|
-
function startPing(ws) {
|
|
59
|
-
setInterval(() => {
|
|
60
|
-
if (ws.readyState === ws_1.default.OPEN) {
|
|
61
|
-
ws.ping();
|
|
62
|
-
(0, dist_1.log_debug)('Ping helius ws server');
|
|
63
|
-
}
|
|
64
|
-
}, 30000);
|
|
65
|
-
}
|
|
66
|
-
ws_client.on('open', function open() {
|
|
67
|
-
(0, dist_1.log_info)(`WebSocket is open`);
|
|
68
|
-
subscribe_transaction_by_txid();
|
|
69
|
-
});
|
|
70
|
-
ws_client.on('message', function incoming(data) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const messageStr = data.toString('utf8');
|
|
73
|
-
(0, dist_1.log_debug)('[helius-subscribe-tx] Received:', messageStr);
|
|
74
|
-
try {
|
|
75
|
-
if (messageStr == '{}' || messageStr.includes('INTERNAL_ERROR')) {
|
|
76
|
-
console.error('[helius-subscribe-tx] receive bad message, something wrong! reconnect ...');
|
|
77
|
-
subscribe_transaction_by_txid();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const messageObj = JSON.parse(messageStr);
|
|
81
|
-
const { method } = messageObj;
|
|
82
|
-
if (method === 'transactionNotification') {
|
|
83
|
-
if (messageObj.params.error) {
|
|
84
|
-
throw new Error(messageObj.params.error);
|
|
85
|
-
}
|
|
86
|
-
const result = messageObj.params.result;
|
|
87
|
-
const txid = result.signature;
|
|
88
|
-
const eventName = constants_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + txid;
|
|
89
|
-
eventEmitter.emit(eventName, messageStr);
|
|
90
|
-
ws_client.close();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
(0, dist_1.log_error)(`[helius-subscribe-tx] Failed to parse JSON: ${messageStr}`, e);
|
|
95
|
-
ws_client.close();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
ws_client.on('error', function error(err) {
|
|
100
|
-
(0, dist_1.log_error)(`WebSocket error:`, err);
|
|
101
|
-
ws_client.close();
|
|
102
|
-
});
|
|
103
|
-
ws_client.on('close', function close() {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
(0, dist_1.log_warn)(`Socket is closed.`);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
exports.subscribe_wallet_transaction_txid = subscribe_wallet_transaction_txid;
|
|
@@ -1,102 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.subscribe_wallet_transaction = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const ws_1 = __importDefault(require("ws"));
|
|
18
|
-
const constants_1 = require("../common/constants");
|
|
19
|
-
const subscribe_wallet_transaction = (geyser_ws_url, wallet_token_account_list, eventEmitter) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
if ((0, dist_1.isEmpty)(geyser_ws_url)) {
|
|
21
|
-
(0, dist_1.log_warn)(`geyser_ws_url is empty, cann't subscribe`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if ((0, dist_1.isEmpty)(wallet_token_account_list)) {
|
|
25
|
-
(0, dist_1.log_warn)(`user_token_account_list is empty, nothing to subscribe`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
yield (0, dist_1.sleep)(parseInt(process.env.SUBSCRIBE_WS_WAIT_SECONDS || '3000'));
|
|
29
|
-
var ws_client = new ws_1.default(geyser_ws_url);
|
|
30
|
-
function subscribe_account_transaction() {
|
|
31
|
-
(0, dist_1.log_info)(`subscribe_account_transaction`, wallet_token_account_list);
|
|
32
|
-
const request = {
|
|
33
|
-
jsonrpc: '2.0',
|
|
34
|
-
id: 420,
|
|
35
|
-
method: 'transactionSubscribe',
|
|
36
|
-
params: [
|
|
37
|
-
{
|
|
38
|
-
accountInclude: wallet_token_account_list,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
commitment: constants_1.COMMITMENT_LEVEL.PROCESSED,
|
|
42
|
-
encoding: 'base64',
|
|
43
|
-
transactionDetails: 'full',
|
|
44
|
-
showRewards: true,
|
|
45
|
-
maxSupportedTransactionVersion: 0,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
ws_client.send(JSON.stringify(request));
|
|
50
|
-
}
|
|
51
|
-
function startPing(ws) {
|
|
52
|
-
setInterval(() => {
|
|
53
|
-
if (ws.readyState === ws_1.default.OPEN) {
|
|
54
|
-
ws.ping();
|
|
55
|
-
(0, dist_1.log_debug)('Ping helius ws server');
|
|
56
|
-
}
|
|
57
|
-
}, 30000);
|
|
58
|
-
}
|
|
59
|
-
ws_client.on('open', function open() {
|
|
60
|
-
(0, dist_1.log_info)(`WebSocket is open`);
|
|
61
|
-
subscribe_account_transaction();
|
|
62
|
-
startPing(ws_client);
|
|
63
|
-
});
|
|
64
|
-
ws_client.on('message', function incoming(data) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const messageStr = data.toString('utf8');
|
|
67
|
-
(0, dist_1.log_debug)('[helius-subscribe-tx] Received:', messageStr);
|
|
68
|
-
try {
|
|
69
|
-
if (messageStr == '{}' || messageStr.includes('INTERNAL_ERROR')) {
|
|
70
|
-
console.error('[helius-subscribe-tx] receive bad message, something wrong! reconnect ...');
|
|
71
|
-
ws_client.close();
|
|
72
|
-
}
|
|
73
|
-
const messageObj = JSON.parse(messageStr);
|
|
74
|
-
const { method } = messageObj;
|
|
75
|
-
if (method === 'transactionNotification') {
|
|
76
|
-
if (messageObj.params.error) {
|
|
77
|
-
throw new Error(messageObj.params.error);
|
|
78
|
-
}
|
|
79
|
-
const result = messageObj.params.result;
|
|
80
|
-
const txid = result.signature;
|
|
81
|
-
const eventName = constants_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + txid;
|
|
82
|
-
eventEmitter.emit(eventName, messageStr);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e) {
|
|
86
|
-
(0, dist_1.log_error)(`[helius-subscribe-tx] Failed to parse JSON: ${messageStr}`, e);
|
|
87
|
-
ws_client.close();
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
ws_client.on('error', function error(err) {
|
|
92
|
-
(0, dist_1.log_error)(`WebSocket error:`, err);
|
|
93
|
-
ws_client.close();
|
|
94
|
-
});
|
|
95
|
-
ws_client.on('close', function close() {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
(0, dist_1.log_warn)(`Socket is closed. Reconnect will be attempted in few seconds`);
|
|
98
|
-
(0, exports.subscribe_wallet_transaction)(geyser_ws_url, wallet_token_account_list, eventEmitter);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
exports.subscribe_wallet_transaction = subscribe_wallet_transaction;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Webhook, CreateWebhookRequest, EditWebhookRequest, CreateCollectionWebhookRequest, MintlistRequest, MintlistResponse, MintApiRequest, MintApiResponse, MintApiAuthority, DelegateCollectionAuthorityRequest, RevokeCollectionAuthorityRequest, HeliusCluster, HeliusEndpoints } from './types';
|
|
2
|
-
import { Connection } from '@solana/web3.js';
|
|
3
|
-
import { RpcClient } from './RpcClient';
|
|
4
|
-
export declare class Helius {
|
|
5
|
-
private apiKey?;
|
|
6
|
-
readonly cluster: HeliusCluster;
|
|
7
|
-
readonly endpoint: string;
|
|
8
|
-
readonly endpoints: HeliusEndpoints;
|
|
9
|
-
readonly connection: Connection;
|
|
10
|
-
readonly rpc: RpcClient;
|
|
11
|
-
readonly mintApiAuthority: MintApiAuthority;
|
|
12
|
-
constructor(apiKey: string, cluster?: HeliusCluster, id?: string, url?: string);
|
|
13
|
-
getAllWebhooks(): Promise<Webhook[]>;
|
|
14
|
-
getWebhookByID(webhookID: string): Promise<Webhook>;
|
|
15
|
-
createWebhook(createWebhookRequest: CreateWebhookRequest): Promise<Webhook>;
|
|
16
|
-
deleteWebhook(webhookID: string): Promise<boolean>;
|
|
17
|
-
editWebhook(webhookID: string, editWebhookRequest: EditWebhookRequest): Promise<Webhook>;
|
|
18
|
-
appendAddressesToWebhook(webhookID: string, newAccountAddresses: string[]): Promise<Webhook>;
|
|
19
|
-
removeAddressesFromWebhook(webhookID: string, addressesToRemove: string[]): Promise<Webhook>;
|
|
20
|
-
createCollectionWebhook(request: CreateCollectionWebhookRequest): Promise<Webhook>;
|
|
21
|
-
getMintlist(request: MintlistRequest): Promise<MintlistResponse>;
|
|
22
|
-
mintCompressedNft(mintApiRequest: MintApiRequest): Promise<MintApiResponse>;
|
|
23
|
-
delegateCollectionAuthority(request: DelegateCollectionAuthorityRequest): Promise<string>;
|
|
24
|
-
revokeCollectionAuthority(request: RevokeCollectionAuthorityRequest): Promise<string>;
|
|
25
|
-
getApiEndpoint(path: string): string;
|
|
26
|
-
private _editWebhook;
|
|
27
|
-
private handleImageUpload;
|
|
28
|
-
private uploadImageToArweave;
|
|
29
|
-
private getCollectionAuthorityRecord;
|
|
30
|
-
private getCollectionMetadataAccount;
|
|
31
|
-
}
|