@clonegod/ttd-base-common 1.0.25 → 1.1.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/appconfig/BaseQuoteAppConfig.d.ts +10 -0
- package/dist/appconfig/BaseQuoteAppConfig.js +36 -0
- package/dist/appconfig/BaseTradeAppConfig.d.ts +7 -0
- package/dist/appconfig/BaseTradeAppConfig.js +13 -0
- package/dist/appconfig/base_dex_env_args.d.ts +5 -0
- package/dist/appconfig/base_dex_env_args.js +68 -0
- package/dist/appconfig/base_env_args.d.ts +82 -0
- package/dist/appconfig/base_env_args.js +91 -0
- package/dist/appconfig/ensure_core_env.d.ts +1 -0
- package/dist/appconfig/ensure_core_env.js +18 -0
- package/dist/appconfig/index.d.ts +5 -0
- package/dist/appconfig/index.js +21 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/quote/depth/amm_depth_calculator.d.ts +19 -0
- package/dist/quote/depth/amm_depth_calculator.js +55 -0
- package/dist/quote/depth/clmm_depth_calculator.d.ts +28 -0
- package/dist/quote/depth/clmm_depth_calculator.js +176 -0
- package/dist/quote/depth/index.d.ts +51 -0
- package/dist/quote/depth/index.js +264 -0
- package/dist/quote/depth/tick_liquidity_snapshot.d.ts +58 -0
- package/dist/quote/depth/tick_liquidity_snapshot.js +143 -0
- package/dist/quote/event/index.d.ts +1 -0
- package/dist/quote/event/index.js +1 -0
- package/dist/quote/event/pool_event_listener.d.ts +5 -3
- package/dist/quote/event/pool_event_listener.js +128 -150
- package/dist/quote/event/swap_debouncer.d.ts +22 -0
- package/dist/quote/event/swap_debouncer.js +80 -0
- package/dist/quote/get_base_token_price.d.ts +6 -0
- package/dist/quote/get_base_token_price.js +90 -0
- package/dist/quote/index.d.ts +7 -0
- package/dist/quote/index.js +7 -0
- package/dist/quote/preload_token_prices.d.ts +2 -0
- package/dist/quote/preload_token_prices.js +37 -0
- package/dist/quote/price_feed_handler.d.ts +15 -0
- package/dist/quote/price_feed_handler.js +56 -0
- package/dist/quote/pricing/fee_helpers.d.ts +13 -0
- package/dist/quote/pricing/fee_helpers.js +68 -0
- package/dist/quote/pricing/index.d.ts +3 -1
- package/dist/quote/pricing/index.js +3 -1
- package/dist/quote/pricing/pool_state_initializer.d.ts +12 -0
- package/dist/quote/pricing/pool_state_initializer.js +191 -0
- package/dist/quote/pricing/sdk_token_factory.d.ts +2 -0
- package/dist/quote/pricing/sdk_token_factory.js +21 -0
- package/dist/quote/quote_amount.d.ts +4 -0
- package/dist/quote/quote_amount.js +24 -0
- package/dist/quote/tick/cached_tick_data_provider.d.ts +12 -0
- package/dist/quote/tick/cached_tick_data_provider.js +45 -0
- package/dist/quote/tick/clmm_tick_cache.d.ts +42 -0
- package/dist/quote/tick/clmm_tick_cache.js +236 -0
- package/dist/quote/tick/index.d.ts +4 -0
- package/dist/{ws → quote/tick}/index.js +4 -2
- package/dist/quote/tick/state_view_tick_loader.d.ts +17 -0
- package/dist/quote/tick/state_view_tick_loader.js +136 -0
- package/dist/quote/tick/tick_lens_loaders.d.ts +24 -0
- package/dist/quote/tick/tick_lens_loaders.js +158 -0
- package/dist/quote/verify/index.d.ts +2 -0
- package/dist/quote/verify/index.js +5 -0
- package/dist/quote/verify/quote_price_verify.d.ts +30 -0
- package/dist/quote/verify/quote_price_verify.js +240 -0
- package/dist/redis/redis_client.d.ts +3 -2
- package/dist/redis/redis_client.js +86 -116
- package/dist/send-tx/constants.d.ts +2 -0
- package/dist/send-tx/constants.js +6 -0
- package/dist/send-tx/index.d.ts +2 -0
- package/dist/{config → send-tx}/index.js +2 -1
- package/dist/send-tx/types.d.ts +4 -0
- package/dist/send-tx/types.js +2 -0
- package/dist/trade/abstract_dex_trade.d.ts +43 -21
- package/dist/trade/abstract_dex_trade.js +347 -133
- package/dist/trade/caller_manager.d.ts +31 -0
- package/dist/trade/caller_manager.js +202 -0
- package/dist/trade/check/abstract_tx_result_checker.d.ts +28 -0
- package/dist/trade/check/abstract_tx_result_checker.js +192 -0
- package/dist/trade/check/index.d.ts +1 -1
- package/dist/trade/check/index.js +1 -1
- package/dist/trade/index.d.ts +2 -2
- package/dist/trade/index.js +2 -2
- package/dist/trade/parse/base_parser.d.ts +1 -2
- package/dist/trade/parse/base_parser.js +36 -36
- package/dist/trade/trade_trace.d.ts +17 -0
- package/dist/trade/trade_trace.js +65 -0
- package/dist/types/config_types.d.ts +3 -3
- package/dist/types/event_types.d.ts +3 -3
- package/dist/types/pool_state.d.ts +140 -13
- package/dist/utils/ethers_compat.d.ts +13 -0
- package/dist/utils/ethers_compat.js +18 -0
- package/dist/utils/fast_signer.d.ts +1 -0
- package/dist/utils/fast_signer.js +87 -0
- package/dist/utils/gas_helper.d.ts +2 -2
- package/dist/utils/gas_helper.js +48 -60
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.js +6 -2
- package/dist/utils/pool_filter.d.ts +8 -0
- package/dist/utils/pool_filter.js +38 -0
- package/dist/utils/trade_direction.d.ts +14 -0
- package/dist/utils/trade_direction.js +23 -0
- package/package.json +2 -2
- package/dist/config/base_env_args.d.ts +0 -11
- package/dist/config/base_env_args.js +0 -19
- package/dist/config/index.d.ts +0 -1
- package/dist/quote/event/verify_clmm_swap_event.d.ts +0 -1
- package/dist/quote/event/verify_clmm_swap_event.js +0 -178
- package/dist/quote/pricing/token_price_cache.d.ts +0 -10
- package/dist/quote/pricing/token_price_cache.js +0 -40
- package/dist/trade/abstract_dex_trade_plus.d.ts +0 -43
- package/dist/trade/abstract_dex_trade_plus.js +0 -421
- package/dist/trade/check/tx_websocket_manager.d.ts +0 -23
- package/dist/trade/check/tx_websocket_manager.js +0 -119
- package/dist/trade/send/alchemy_base.d.ts +0 -5
- package/dist/trade/send/alchemy_base.js +0 -48
- package/dist/trade/send/ankr_base.d.ts +0 -5
- package/dist/trade/send/ankr_base.js +0 -48
- package/dist/trade/send/base_rpc.d.ts +0 -5
- package/dist/trade/send/base_rpc.js +0 -48
- package/dist/trade/send/blockpi_base.d.ts +0 -5
- package/dist/trade/send/blockpi_base.js +0 -48
- package/dist/trade/send/bloxroute_base.d.ts +0 -11
- package/dist/trade/send/bloxroute_base.js +0 -115
- package/dist/trade/send/chainstack_base.d.ts +0 -5
- package/dist/trade/send/chainstack_base.js +0 -48
- package/dist/trade/send/drpc_base.d.ts +0 -5
- package/dist/trade/send/drpc_base.js +0 -48
- package/dist/trade/send/getblock_base.d.ts +0 -5
- package/dist/trade/send/getblock_base.js +0 -48
- package/dist/trade/send/index.d.ts +0 -15
- package/dist/trade/send/index.js +0 -33
- package/dist/trade/send/infura_base.d.ts +0 -5
- package/dist/trade/send/infura_base.js +0 -48
- package/dist/trade/send/moralis_base.d.ts +0 -5
- package/dist/trade/send/moralis_base.js +0 -48
- package/dist/trade/send/onerpc_base.d.ts +0 -5
- package/dist/trade/send/onerpc_base.js +0 -48
- package/dist/trade/send/quicknode_base.d.ts +0 -5
- package/dist/trade/send/quicknode_base.js +0 -48
- package/dist/trade/send/send_tx.d.ts +0 -17
- package/dist/trade/send/send_tx.js +0 -163
- package/dist/ws/event_filter.d.ts +0 -8
- package/dist/ws/event_filter.js +0 -36
- package/dist/ws/index.d.ts +0 -2
- package/dist/ws/subscribe_v2_events.d.ts +0 -14
- package/dist/ws/subscribe_v2_events.js +0 -174
- package/dist/ws/subscribe_v3_events.d.ts +0 -14
- package/dist/ws/subscribe_v3_events.js +0 -174
|
@@ -1,48 +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.BaseRpc = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class BaseRpc {
|
|
19
|
-
constructor(rpc_endpoint) {
|
|
20
|
-
this.endpoint = rpc_endpoint || process.env.BASE_OFFICIAL_RPC_ENDPOINT || 'https://mainnet.base.org';
|
|
21
|
-
}
|
|
22
|
-
eth_sendRawTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: "2.0",
|
|
27
|
-
method: "eth_sendRawTransaction",
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
"Content-Type": "application/json"
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`Base Mainnet RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`Base Mainnet transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.BaseRpc = BaseRpc;
|
|
@@ -1,48 +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.BlockpiBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class BlockpiBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_BLOCKPI_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`BlockPI RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`BlockPI transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.BlockpiBase = BlockpiBase;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare class BloxrouteBase {
|
|
2
|
-
private endpoint;
|
|
3
|
-
private authToken;
|
|
4
|
-
private ws_endpoint;
|
|
5
|
-
private wsClient;
|
|
6
|
-
constructor();
|
|
7
|
-
private initWsConnection;
|
|
8
|
-
sendTransaction(signedTx: string): Promise<string>;
|
|
9
|
-
private sendTransactionByHttp;
|
|
10
|
-
private sendTransactionByWs;
|
|
11
|
-
}
|
|
@@ -1,115 +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.BloxrouteBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class BloxrouteBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_BLOXROUTE_RPC_ENDPOINT || 'https://api.blxrbdn.com';
|
|
21
|
-
this.authToken = process.env.BASE_BLOXROUTE_AUTH_TOKEN || '';
|
|
22
|
-
this.ws_endpoint = process.env.BASE_BLOXROUTE_WS_ENDPOINT || 'wss://api.blxrbdn.com/ws';
|
|
23
|
-
if (this.authToken) {
|
|
24
|
-
this.initWsConnection();
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
(0, dist_1.log_warn)('BloXroute authToken is not set!!! BASE_BLOXROUTE_AUTH_TOKEN is empty or null');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
initWsConnection() {
|
|
31
|
-
if (!this.wsClient) {
|
|
32
|
-
this.wsClient = new dist_1.WebSocketClient(this.ws_endpoint, {
|
|
33
|
-
headers: {
|
|
34
|
-
'Authorization': this.authToken || ''
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
this.wsClient.onOpen(() => {
|
|
38
|
-
(0, dist_1.log_info)('BloXroute Base ws connected:', this.ws_endpoint);
|
|
39
|
-
});
|
|
40
|
-
this.wsClient.onMessage((message) => {
|
|
41
|
-
(0, dist_1.log_info)('BloXroute Base ws message', (0, dist_1.to_json_str)(message));
|
|
42
|
-
});
|
|
43
|
-
this.wsClient.connect();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
sendTransaction(signedTx) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
if (!this.authToken) {
|
|
49
|
-
(0, dist_1.log_warn)('BloXroute Base authToken is not set!!! BASE_BLOXROUTE_AUTH_TOKEN is empty or null');
|
|
50
|
-
return '';
|
|
51
|
-
}
|
|
52
|
-
if (signedTx.startsWith('0x')) {
|
|
53
|
-
signedTx = signedTx.slice(2);
|
|
54
|
-
}
|
|
55
|
-
this.sendTransactionByWs(signedTx);
|
|
56
|
-
return yield this.sendTransactionByHttp(signedTx);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
sendTransactionByHttp(signedTx) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
try {
|
|
62
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
63
|
-
jsonrpc: "2.0",
|
|
64
|
-
id: "1",
|
|
65
|
-
method: "blxr_tx",
|
|
66
|
-
params: {
|
|
67
|
-
"transaction": signedTx,
|
|
68
|
-
"blockchain_network": "Base-Mainnet"
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
headers: {
|
|
72
|
-
'Content-Type': 'application/json',
|
|
73
|
-
'Authorization': this.authToken
|
|
74
|
-
},
|
|
75
|
-
timeout: 3000
|
|
76
|
-
});
|
|
77
|
-
if (response.data.error) {
|
|
78
|
-
throw new Error(`BloXroute Base Error: ${response.data.error.code} - ${response.data.error.message}`);
|
|
79
|
-
}
|
|
80
|
-
return response.data.result.txHash;
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
(0, dist_1.log_error)('BloXroute Base sendPrivateTransaction failed!!!', error);
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
sendTransactionByWs(signedTx) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
if (!this.ws_endpoint) {
|
|
91
|
-
return '';
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
if (!this.wsClient || !this.wsClient.isConnected()) {
|
|
95
|
-
(0, dist_1.log_warn)('BloXroute Base ws is not connected!!!');
|
|
96
|
-
return '';
|
|
97
|
-
}
|
|
98
|
-
this.wsClient.send(JSON.stringify({
|
|
99
|
-
jsonrpc: "2.0",
|
|
100
|
-
id: "1",
|
|
101
|
-
method: "blxr_tx",
|
|
102
|
-
params: {
|
|
103
|
-
"transaction": signedTx,
|
|
104
|
-
"blockchain_network": "Base-Mainnet"
|
|
105
|
-
}
|
|
106
|
-
}));
|
|
107
|
-
return '';
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
(0, dist_1.log_error)('BloXroute Base sendTransactionByWs failed!!!', error);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.BloxrouteBase = BloxrouteBase;
|
|
@@ -1,48 +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.ChainstackBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class ChainstackBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_CHAINSTACK_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`Chainstack RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`Chainstack transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.ChainstackBase = ChainstackBase;
|
|
@@ -1,48 +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.DrpcBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class DrpcBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_DRPC_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`DRPC RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`DRPC transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.DrpcBase = DrpcBase;
|
|
@@ -1,48 +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.GetblockBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class GetblockBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_GETBLOCK_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`GetBlock RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`GetBlock transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.GetblockBase = GetblockBase;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './send_tx';
|
|
2
|
-
export * from './alchemy_base';
|
|
3
|
-
export * from './base_rpc';
|
|
4
|
-
export * from './bloxroute_base';
|
|
5
|
-
export * from './drpc_base';
|
|
6
|
-
export * from './quicknode_base';
|
|
7
|
-
export * from './infura_base';
|
|
8
|
-
export * from './blockpi_base';
|
|
9
|
-
export * from './getblock_base';
|
|
10
|
-
export * from './ankr_base';
|
|
11
|
-
export * from './chainstack_base';
|
|
12
|
-
export * from './moralis_base';
|
|
13
|
-
export * from './onerpc_base';
|
|
14
|
-
export declare enum BASE_EOA_ADDRESS {
|
|
15
|
-
}
|
package/dist/trade/send/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.BASE_EOA_ADDRESS = void 0;
|
|
18
|
-
__exportStar(require("./send_tx"), exports);
|
|
19
|
-
__exportStar(require("./alchemy_base"), exports);
|
|
20
|
-
__exportStar(require("./base_rpc"), exports);
|
|
21
|
-
__exportStar(require("./bloxroute_base"), exports);
|
|
22
|
-
__exportStar(require("./drpc_base"), exports);
|
|
23
|
-
__exportStar(require("./quicknode_base"), exports);
|
|
24
|
-
__exportStar(require("./infura_base"), exports);
|
|
25
|
-
__exportStar(require("./blockpi_base"), exports);
|
|
26
|
-
__exportStar(require("./getblock_base"), exports);
|
|
27
|
-
__exportStar(require("./ankr_base"), exports);
|
|
28
|
-
__exportStar(require("./chainstack_base"), exports);
|
|
29
|
-
__exportStar(require("./moralis_base"), exports);
|
|
30
|
-
__exportStar(require("./onerpc_base"), exports);
|
|
31
|
-
var BASE_EOA_ADDRESS;
|
|
32
|
-
(function (BASE_EOA_ADDRESS) {
|
|
33
|
-
})(BASE_EOA_ADDRESS || (exports.BASE_EOA_ADDRESS = BASE_EOA_ADDRESS = {}));
|
|
@@ -1,48 +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.InfuraBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class InfuraBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_INFURA_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`Infura RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`Infura transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.InfuraBase = InfuraBase;
|
|
@@ -1,48 +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.MoralisBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class MoralisBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_MORALIS_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`Moralis RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`Moralis transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.MoralisBase = MoralisBase;
|
|
@@ -1,48 +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.OneRpcBase = void 0;
|
|
16
|
-
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
class OneRpcBase {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.endpoint = process.env.BASE_1RPC_RPC_ENDPOINT || '';
|
|
21
|
-
}
|
|
22
|
-
sendTransaction(signedTx) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axios_1.default.post(this.endpoint, {
|
|
26
|
-
jsonrpc: '2.0',
|
|
27
|
-
method: 'eth_sendRawTransaction',
|
|
28
|
-
params: [signedTx],
|
|
29
|
-
id: 1
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
},
|
|
34
|
-
timeout: 3000
|
|
35
|
-
});
|
|
36
|
-
if (response.data.error) {
|
|
37
|
-
throw new Error(`1RPC error: ${response.data.error.message}`);
|
|
38
|
-
}
|
|
39
|
-
return response.data.result;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
(0, dist_1.log_info)(`1RPC transaction sending failed`, { error: error.message });
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.OneRpcBase = OneRpcBase;
|