@pythnetwork/price-pusher 10.3.1 → 10.4.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/README.md +3 -1
- package/dist/aptos/aptos.cjs +7 -7
- package/dist/aptos/aptos.d.ts +1 -1
- package/dist/aptos/balance-tracker.cjs +7 -7
- package/dist/aptos/balance-tracker.d.ts +1 -1
- package/dist/aptos/command.cjs +20 -17
- package/dist/aptos/command.d.ts +3 -2
- package/dist/controller.cjs +2 -2
- package/dist/controller.d.ts +1 -1
- package/dist/evm/balance-tracker.cjs +4 -4
- package/dist/evm/balance-tracker.d.ts +2 -2
- package/dist/evm/command.cjs +46 -43
- package/dist/evm/command.d.ts +7 -6
- package/dist/evm/evm.cjs +7 -7
- package/dist/evm/evm.d.ts +3 -4
- package/dist/evm/pyth-contract.cjs +2 -2
- package/dist/evm/super-wallet.cjs +4 -4
- package/dist/evm/super-wallet.d.ts +1 -1
- package/dist/fuel/command.cjs +17 -14
- package/dist/fuel/command.d.ts +3 -2
- package/dist/fuel/fuel.d.ts +2 -2
- package/dist/injective/command.cjs +26 -23
- package/dist/injective/command.d.ts +5 -4
- package/dist/injective/injective.cjs +11 -11
- package/dist/injective/injective.d.ts +2 -3
- package/dist/interface.d.ts +1 -1
- package/dist/metrics.cjs +29 -29
- package/dist/near/command.cjs +22 -19
- package/dist/near/command.d.ts +5 -4
- package/dist/near/near.cjs +17 -16
- package/dist/near/near.d.ts +1 -1
- package/dist/options.cjs +36 -26
- package/dist/options.d.ts +3 -0
- package/dist/price-config.cjs +13 -13
- package/dist/pyth-price-listener.cjs +2 -2
- package/dist/pyth-price-listener.d.ts +2 -3
- package/dist/solana/balance-tracker.cjs +5 -5
- package/dist/solana/balance-tracker.d.ts +2 -2
- package/dist/solana/command.cjs +75 -60
- package/dist/solana/command.d.ts +13 -10
- package/dist/solana/solana.d.ts +4 -4
- package/dist/sui/balance-tracker.cjs +4 -4
- package/dist/sui/balance-tracker.d.ts +2 -2
- package/dist/sui/command.cjs +42 -39
- package/dist/sui/command.d.ts +7 -6
- package/dist/sui/sui.cjs +14 -14
- package/dist/sui/sui.d.ts +2 -2
- package/dist/ton/command.cjs +17 -14
- package/dist/ton/command.d.ts +3 -2
- package/dist/ton/ton.d.ts +2 -3
- package/dist/utils.d.ts +1 -2
- package/package.json +119 -130
package/dist/options.cjs
CHANGED
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
get enableMetrics () {
|
|
16
16
|
return enableMetrics;
|
|
17
17
|
},
|
|
18
|
+
get hermesAccessToken () {
|
|
19
|
+
return hermesAccessToken;
|
|
20
|
+
},
|
|
18
21
|
get logLevel () {
|
|
19
22
|
return logLevel;
|
|
20
23
|
},
|
|
@@ -43,90 +46,97 @@ _export(exports, {
|
|
|
43
46
|
const priceServiceEndpoint = {
|
|
44
47
|
"price-service-endpoint": {
|
|
45
48
|
description: "Endpoint URL for the hermes client. e.g: https://endpoint/example",
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
required: true,
|
|
50
|
+
type: "string"
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const hermesAccessToken = {
|
|
54
|
+
"hermes-access-token": {
|
|
55
|
+
description: "Access token to authenticate with Hermes. Sent as a Bearer token in the Authorization header.",
|
|
56
|
+
required: false,
|
|
57
|
+
type: "string"
|
|
48
58
|
}
|
|
49
59
|
};
|
|
50
60
|
const pythContractAddress = {
|
|
51
61
|
"pyth-contract-address": {
|
|
52
62
|
description: "Pyth contract address. Provide the network name on which Pyth is deployed " + "or the Pyth contract address if you use a local network.",
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
required: true,
|
|
64
|
+
type: "string"
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
const priceConfigFile = {
|
|
58
68
|
"price-config-file": {
|
|
59
69
|
description: "Path to price configuration YAML file.",
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
required: true,
|
|
71
|
+
type: "string"
|
|
62
72
|
}
|
|
63
73
|
};
|
|
64
74
|
const pollingFrequency = {
|
|
65
75
|
"polling-frequency": {
|
|
76
|
+
default: 5,
|
|
66
77
|
description: "The frequency to poll price info data from the network if the RPC is not a websocket.",
|
|
67
|
-
type: "number",
|
|
68
78
|
required: false,
|
|
69
|
-
|
|
79
|
+
type: "number"
|
|
70
80
|
}
|
|
71
81
|
};
|
|
72
82
|
const pushingFrequency = {
|
|
73
83
|
"pushing-frequency": {
|
|
84
|
+
default: 10,
|
|
74
85
|
description: "The frequency to push prices to the RPC. " + "It is better that the value be greater than the block time of the network, so this program confirms " + "it is updated and does not push it twice.",
|
|
75
|
-
type: "number",
|
|
76
86
|
required: false,
|
|
77
|
-
|
|
87
|
+
type: "number"
|
|
78
88
|
}
|
|
79
89
|
};
|
|
80
90
|
const mnemonicFile = {
|
|
81
91
|
"mnemonic-file": {
|
|
82
92
|
description: "Path to payer mnemonic (private key) file.",
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
required: true,
|
|
94
|
+
type: "string"
|
|
85
95
|
}
|
|
86
96
|
};
|
|
87
97
|
const logLevel = {
|
|
88
98
|
"log-level": {
|
|
89
|
-
description: "Log level",
|
|
90
|
-
type: "string",
|
|
91
|
-
required: false,
|
|
92
|
-
default: "info",
|
|
93
99
|
choices: [
|
|
94
100
|
"trace",
|
|
95
101
|
"debug",
|
|
96
102
|
"info",
|
|
97
103
|
"warn",
|
|
98
104
|
"error"
|
|
99
|
-
]
|
|
105
|
+
],
|
|
106
|
+
default: "info",
|
|
107
|
+
description: "Log level",
|
|
108
|
+
required: false,
|
|
109
|
+
type: "string"
|
|
100
110
|
}
|
|
101
111
|
};
|
|
102
112
|
const controllerLogLevel = {
|
|
103
113
|
"controller-log-level": {
|
|
104
|
-
description: "Log level for the controller.",
|
|
105
|
-
type: "string",
|
|
106
|
-
required: false,
|
|
107
|
-
default: "info",
|
|
108
114
|
choices: [
|
|
109
115
|
"trace",
|
|
110
116
|
"debug",
|
|
111
117
|
"info",
|
|
112
118
|
"warn",
|
|
113
119
|
"error"
|
|
114
|
-
]
|
|
120
|
+
],
|
|
121
|
+
default: "info",
|
|
122
|
+
description: "Log level for the controller.",
|
|
123
|
+
required: false,
|
|
124
|
+
type: "string"
|
|
115
125
|
}
|
|
116
126
|
};
|
|
117
127
|
const enableMetrics = {
|
|
118
128
|
"enable-metrics": {
|
|
129
|
+
default: true,
|
|
119
130
|
description: "Enable Prometheus metrics server",
|
|
120
|
-
type: "boolean",
|
|
121
131
|
required: false,
|
|
122
|
-
|
|
132
|
+
type: "boolean"
|
|
123
133
|
}
|
|
124
134
|
};
|
|
125
135
|
const metricsPort = {
|
|
126
136
|
"metrics-port": {
|
|
137
|
+
default: 9090,
|
|
127
138
|
description: "Port for the Prometheus metrics server",
|
|
128
|
-
type: "number",
|
|
129
139
|
required: false,
|
|
130
|
-
|
|
140
|
+
type: "number"
|
|
131
141
|
}
|
|
132
142
|
};
|
package/dist/options.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import type { Options } from "yargs";
|
|
|
2
2
|
export declare const priceServiceEndpoint: {
|
|
3
3
|
"price-service-endpoint": Options;
|
|
4
4
|
};
|
|
5
|
+
export declare const hermesAccessToken: {
|
|
6
|
+
"hermes-access-token": Options;
|
|
7
|
+
};
|
|
5
8
|
export declare const pythContractAddress: {
|
|
6
9
|
"pyth-contract-address": Options;
|
|
7
10
|
};
|
package/dist/price-config.cjs
CHANGED
|
@@ -30,15 +30,15 @@ function _interop_require_default(obj) {
|
|
|
30
30
|
}
|
|
31
31
|
const PriceConfigFileSchema = _joi.default.array().items(_joi.default.object({
|
|
32
32
|
alias: _joi.default.string().required(),
|
|
33
|
-
id: _joi.default.string().regex(/^(0x)?[a-f0-9]{64}$/).required(),
|
|
34
|
-
time_difference: _joi.default.number().required(),
|
|
35
|
-
price_deviation: _joi.default.number().required(),
|
|
36
33
|
confidence_ratio: _joi.default.number().required(),
|
|
37
34
|
early_update: _joi.default.object({
|
|
38
|
-
|
|
35
|
+
confidence_ratio: _joi.default.number().optional(),
|
|
39
36
|
price_deviation: _joi.default.number().optional(),
|
|
40
|
-
|
|
41
|
-
}).optional()
|
|
37
|
+
time_difference: _joi.default.number().optional()
|
|
38
|
+
}).optional(),
|
|
39
|
+
id: _joi.default.string().regex(/^(0x)?[a-f0-9]{64}$/).required(),
|
|
40
|
+
price_deviation: _joi.default.number().required(),
|
|
41
|
+
time_difference: _joi.default.number().required()
|
|
42
42
|
})).unique("id").unique("alias").required();
|
|
43
43
|
function readPriceConfigFile(path) {
|
|
44
44
|
const priceConfigs = _yaml.default.parse(_nodefs.default.readFileSync(path, "utf8"));
|
|
@@ -49,14 +49,14 @@ function readPriceConfigFile(path) {
|
|
|
49
49
|
return priceConfigs.map((priceConfigRaw)=>{
|
|
50
50
|
const priceConfig = {
|
|
51
51
|
alias: priceConfigRaw.alias,
|
|
52
|
-
id: (0, _utils.removeLeading0x)(priceConfigRaw.id),
|
|
53
|
-
timeDifference: priceConfigRaw.time_difference,
|
|
54
|
-
priceDeviation: priceConfigRaw.price_deviation,
|
|
55
52
|
confidenceRatio: priceConfigRaw.confidence_ratio,
|
|
56
53
|
customEarlyUpdate: priceConfigRaw.early_update !== undefined,
|
|
57
|
-
|
|
54
|
+
earlyUpdateConfidenceRatio: priceConfigRaw.early_update?.confidence_ratio,
|
|
58
55
|
earlyUpdatePriceDeviation: priceConfigRaw.early_update?.price_deviation,
|
|
59
|
-
|
|
56
|
+
earlyUpdateTimeDifference: priceConfigRaw.early_update?.time_difference,
|
|
57
|
+
id: (0, _utils.removeLeading0x)(priceConfigRaw.id),
|
|
58
|
+
priceDeviation: priceConfigRaw.price_deviation,
|
|
59
|
+
timeDifference: priceConfigRaw.time_difference
|
|
60
60
|
};
|
|
61
61
|
return priceConfig;
|
|
62
62
|
});
|
|
@@ -91,8 +91,8 @@ function shouldUpdate(priceConfig, sourceLatestPrice, targetLatestPrice, logger)
|
|
|
91
91
|
const confidenceRatioPct = Math.abs(Number(sourceLatestPrice.conf) / Number(sourceLatestPrice.price) * 100);
|
|
92
92
|
logger.info({
|
|
93
93
|
sourcePrice: sourceLatestPrice,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
symbol: priceConfig.alias,
|
|
95
|
+
targetPrice: targetLatestPrice
|
|
96
96
|
}, `Analyzing price ${priceConfig.alias} (${priceId}). ` + `Time difference: ${timeDifference} (< ${priceConfig.timeDifference}? / early: < ${priceConfig.earlyUpdateTimeDifference}) OR ` + `Price deviation: ${priceDeviationPct.toFixed(5)}% (< ${priceConfig.priceDeviation}%? / early: < ${priceConfig.earlyUpdatePriceDeviation}%?) OR ` + `Confidence ratio: ${confidenceRatioPct.toFixed(5)}% (< ${priceConfig.confidenceRatio}%? / early: < ${priceConfig.earlyUpdateConfidenceRatio}%?)`);
|
|
97
97
|
if (timeDifference >= priceConfig.timeDifference || priceDeviationPct >= priceConfig.priceDeviation || confidenceRatioPct >= priceConfig.confidenceRatio) {
|
|
98
98
|
return 0;
|
|
@@ -41,8 +41,8 @@ class PythPriceListener {
|
|
|
41
41
|
async startListening() {
|
|
42
42
|
this.logger.info(`Starting to listen for price updates from Hermes for ${this.priceIds.length} price feeds.`);
|
|
43
43
|
const eventSource = await this.hermesClient.getPriceUpdatesStream(this.priceIds, {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
ignoreInvalidPriceIds: true,
|
|
45
|
+
parsed: true
|
|
46
46
|
});
|
|
47
47
|
eventSource.onmessage = (event)=>{
|
|
48
48
|
const priceUpdates = JSON.parse(event.data);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { HexString } from "@pythnetwork/hermes-client";
|
|
2
|
-
import { HermesClient } from "@pythnetwork/hermes-client";
|
|
1
|
+
import type { HermesClient, HexString } from "@pythnetwork/hermes-client";
|
|
3
2
|
import type { Logger } from "pino";
|
|
4
|
-
import type {
|
|
3
|
+
import type { IPriceListener, PriceInfo, PriceItem } from "./interface.js";
|
|
5
4
|
export declare class PythPriceListener implements IPriceListener {
|
|
6
5
|
private hermesClient;
|
|
7
6
|
private priceIds;
|
|
@@ -49,12 +49,12 @@ class SolanaBalanceTracker extends _interface.BaseBalanceTracker {
|
|
|
49
49
|
}
|
|
50
50
|
function createSolanaBalanceTracker(params) {
|
|
51
51
|
return new SolanaBalanceTracker({
|
|
52
|
-
connection: params.connection,
|
|
53
|
-
publicKey: params.publicKey,
|
|
54
52
|
address: params.publicKey.toString(),
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
connection: params.connection,
|
|
54
|
+
logger: params.logger,
|
|
57
55
|
metrics: params.metrics,
|
|
58
|
-
|
|
56
|
+
network: params.network,
|
|
57
|
+
publicKey: params.publicKey,
|
|
58
|
+
updateInterval: params.updateInterval
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Connection, PublicKey } from "@solana/web3.js";
|
|
1
|
+
import type { Connection, PublicKey } from "@solana/web3.js";
|
|
2
2
|
import type { Logger } from "pino";
|
|
3
3
|
import type { BaseBalanceTrackerConfig, IBalanceTracker } from "../interface.js";
|
|
4
4
|
import { BaseBalanceTracker } from "../interface.js";
|
|
5
|
-
import { PricePusherMetrics } from "../metrics.js";
|
|
5
|
+
import type { PricePusherMetrics } from "../metrics.js";
|
|
6
6
|
import type { DurationInSeconds } from "../utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Solana-specific configuration for balance tracker
|
package/dist/solana/command.cjs
CHANGED
|
@@ -23,14 +23,14 @@ const _pythsolanareceiver = require("@pythnetwork/pyth-solana-receiver");
|
|
|
23
23
|
const _web3 = require("@solana/web3.js");
|
|
24
24
|
const _searcher = require("jito-ts/dist/sdk/block-engine/searcher");
|
|
25
25
|
const _pino = require("pino");
|
|
26
|
+
const _controller = require("../controller.cjs");
|
|
27
|
+
const _metrics = require("../metrics.cjs");
|
|
26
28
|
const _options = /*#__PURE__*/ _interop_require_wildcard(require("../options.cjs"));
|
|
27
29
|
const _priceconfig = require("../price-config.cjs");
|
|
28
30
|
const _pythpricelistener = require("../pyth-price-listener.cjs");
|
|
29
|
-
const _solana = require("./solana.cjs");
|
|
30
|
-
const _controller = require("../controller.cjs");
|
|
31
|
-
const _metrics = require("../metrics.cjs");
|
|
32
31
|
const _utils = require("../utils.cjs");
|
|
33
32
|
const _balancetracker = require("./balance-tracker.cjs");
|
|
33
|
+
const _solana = require("./solana.cjs");
|
|
34
34
|
function _interop_require_default(obj) {
|
|
35
35
|
return obj && obj.__esModule ? obj : {
|
|
36
36
|
default: obj
|
|
@@ -78,76 +78,85 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
78
|
return newObj;
|
|
79
79
|
}
|
|
80
80
|
const _default = {
|
|
81
|
-
command: "solana",
|
|
82
|
-
describe: "run price pusher for solana",
|
|
83
81
|
builder: {
|
|
84
|
-
|
|
85
|
-
description: "
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
"keypair-file": {
|
|
90
|
-
description: "Path to a keypair file",
|
|
91
|
-
type: "string",
|
|
92
|
-
required: true
|
|
93
|
-
},
|
|
94
|
-
"shard-id": {
|
|
95
|
-
description: "Shard ID",
|
|
96
|
-
type: "number",
|
|
97
|
-
required: true
|
|
82
|
+
"address-lookup-table-account": {
|
|
83
|
+
description: "The pubkey of the ALT to use when updating price feeds",
|
|
84
|
+
optional: true,
|
|
85
|
+
type: "string"
|
|
98
86
|
},
|
|
99
87
|
"compute-unit-price-micro-lamports": {
|
|
88
|
+
default: 50_000,
|
|
100
89
|
description: "Priority fee per compute unit",
|
|
101
|
-
type: "number"
|
|
102
|
-
|
|
90
|
+
type: "number"
|
|
91
|
+
},
|
|
92
|
+
"dynamic-jito-tips": {
|
|
93
|
+
default: false,
|
|
94
|
+
description: "Use dynamic jito tips",
|
|
95
|
+
type: "boolean"
|
|
96
|
+
},
|
|
97
|
+
endpoint: {
|
|
98
|
+
description: "Solana RPC API endpoint",
|
|
99
|
+
required: true,
|
|
100
|
+
type: "string"
|
|
101
|
+
},
|
|
102
|
+
"jito-bundle-size": {
|
|
103
|
+
default: 5,
|
|
104
|
+
description: "Number of transactions in each Jito bundle",
|
|
105
|
+
type: "number"
|
|
103
106
|
},
|
|
104
107
|
"jito-endpoints": {
|
|
105
108
|
description: "Jito endpoint(s) - comma-separated list of endpoints",
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
optional: true,
|
|
110
|
+
type: "string"
|
|
108
111
|
},
|
|
109
112
|
"jito-keypair-file": {
|
|
110
113
|
description: "Path to the jito keypair file (need for grpc authentication)",
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
optional: true,
|
|
115
|
+
type: "string"
|
|
113
116
|
},
|
|
114
117
|
"jito-tip-lamports": {
|
|
115
118
|
description: "Lamports to tip the jito builder",
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
optional: true,
|
|
120
|
+
type: "number"
|
|
118
121
|
},
|
|
119
|
-
"
|
|
120
|
-
description: "
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
"keypair-file": {
|
|
123
|
+
description: "Path to a keypair file",
|
|
124
|
+
required: true,
|
|
125
|
+
type: "string"
|
|
123
126
|
},
|
|
124
127
|
"max-jito-tip-lamports": {
|
|
128
|
+
default: _web3.LAMPORTS_PER_SOL / 100,
|
|
125
129
|
description: "Maximum jito tip lamports",
|
|
126
|
-
type: "number"
|
|
127
|
-
default: _web3.LAMPORTS_PER_SOL / 100
|
|
130
|
+
type: "number"
|
|
128
131
|
},
|
|
129
|
-
"
|
|
130
|
-
description: "
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
"pyth-receiver-program-id": {
|
|
133
|
+
description: "The Pyth receiver program ID to use",
|
|
134
|
+
optional: true,
|
|
135
|
+
type: "string"
|
|
133
136
|
},
|
|
134
|
-
"
|
|
135
|
-
description: "
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
"address-lookup-table-account": {
|
|
140
|
-
description: "The pubkey of the ALT to use when updating price feeds",
|
|
141
|
-
type: "string",
|
|
142
|
-
optional: true
|
|
137
|
+
"shard-id": {
|
|
138
|
+
description: "Shard ID",
|
|
139
|
+
required: true,
|
|
140
|
+
type: "number"
|
|
143
141
|
},
|
|
144
142
|
"treasury-id": {
|
|
145
143
|
description: "The treasuryId to use. Useful when the corresponding treasury account is indexed in the ALT passed to --address-lookup-table-account. This is a tx size optimization and is optional; if not set, a random treasury account will be used.",
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
optional: true,
|
|
145
|
+
type: "number"
|
|
146
|
+
},
|
|
147
|
+
"updates-per-jito-bundle": {
|
|
148
|
+
default: 6,
|
|
149
|
+
description: "Number of price updates in each Jito bundle",
|
|
150
|
+
type: "number"
|
|
151
|
+
},
|
|
152
|
+
"wormhole-program-id": {
|
|
153
|
+
description: "The Wormhole program ID to use",
|
|
154
|
+
optional: true,
|
|
155
|
+
type: "string"
|
|
148
156
|
},
|
|
149
157
|
..._options.priceConfigFile,
|
|
150
158
|
..._options.priceServiceEndpoint,
|
|
159
|
+
..._options.hermesAccessToken,
|
|
151
160
|
..._options.pythContractAddress,
|
|
152
161
|
..._options.pollingFrequency,
|
|
153
162
|
..._options.pushingFrequency,
|
|
@@ -156,13 +165,17 @@ const _default = {
|
|
|
156
165
|
..._options.enableMetrics,
|
|
157
166
|
..._options.metricsPort
|
|
158
167
|
},
|
|
168
|
+
command: "solana",
|
|
169
|
+
describe: "run price pusher for solana",
|
|
159
170
|
handler: async function(argv) {
|
|
160
|
-
const { endpoint, keypairFile, shardId, computeUnitPriceMicroLamports, priceConfigFile, priceServiceEndpoint, pythContractAddress, pushingFrequency, pollingFrequency, jitoEndpoints, jitoKeypairFile, jitoTipLamports, dynamicJitoTips, maxJitoTipLamports, updatesPerJitoBundle, addressLookupTableAccount, treasuryId, logLevel, controllerLogLevel, enableMetrics, metricsPort } = argv;
|
|
171
|
+
const { endpoint, keypairFile, shardId, computeUnitPriceMicroLamports, priceConfigFile, priceServiceEndpoint, hermesAccessToken, pythContractAddress, pushingFrequency, pollingFrequency, jitoEndpoints, jitoKeypairFile, jitoTipLamports, dynamicJitoTips, maxJitoTipLamports, updatesPerJitoBundle, addressLookupTableAccount, treasuryId, logLevel, controllerLogLevel, enableMetrics, metricsPort, pythReceiverProgramId, wormholeProgramId } = argv;
|
|
161
172
|
const logger = (0, _pino.pino)({
|
|
162
173
|
level: logLevel
|
|
163
174
|
});
|
|
164
175
|
const priceConfigs = (0, _priceconfig.readPriceConfigFile)(priceConfigFile);
|
|
165
|
-
const hermesClient = new _hermesclient.HermesClient(priceServiceEndpoint
|
|
176
|
+
const hermesClient = new _hermesclient.HermesClient(priceServiceEndpoint, {
|
|
177
|
+
accessToken: hermesAccessToken
|
|
178
|
+
});
|
|
166
179
|
// Initialize metrics if enabled
|
|
167
180
|
let metrics;
|
|
168
181
|
if (enableMetrics) {
|
|
@@ -173,8 +186,8 @@ const _default = {
|
|
|
173
186
|
logger.info(`Metrics server started on port ${metricsPort}`);
|
|
174
187
|
}
|
|
175
188
|
let priceItems = priceConfigs.map(({ id, alias })=>({
|
|
176
|
-
|
|
177
|
-
|
|
189
|
+
alias,
|
|
190
|
+
id
|
|
178
191
|
}));
|
|
179
192
|
// Better to filter out invalid price items before creating the pyth listener
|
|
180
193
|
const { existingPriceItems, invalidPriceItems } = await (0, _utils.filterInvalidPriceItems)(hermesClient, priceItems);
|
|
@@ -190,19 +203,21 @@ const _default = {
|
|
|
190
203
|
const connection = new _web3.Connection(endpoint, "processed");
|
|
191
204
|
const pythSolanaReceiver = new _pythsolanareceiver.PythSolanaReceiver({
|
|
192
205
|
connection,
|
|
193
|
-
wallet,
|
|
194
206
|
pushOracleProgramId: new _web3.PublicKey(pythContractAddress),
|
|
195
|
-
|
|
207
|
+
receiverProgramId: pythReceiverProgramId ? new _web3.PublicKey(pythReceiverProgramId) : undefined,
|
|
208
|
+
treasuryId: treasuryId,
|
|
209
|
+
wallet,
|
|
210
|
+
wormholeProgramId: wormholeProgramId ? new _web3.PublicKey(wormholeProgramId) : undefined
|
|
196
211
|
});
|
|
197
212
|
// Create and start the balance tracker if metrics are enabled
|
|
198
213
|
if (metrics) {
|
|
199
214
|
const balanceTracker = (0, _balancetracker.createSolanaBalanceTracker)({
|
|
200
215
|
connection,
|
|
201
|
-
|
|
202
|
-
network: "solana",
|
|
203
|
-
updateInterval: 60,
|
|
216
|
+
logger,
|
|
204
217
|
metrics,
|
|
205
|
-
|
|
218
|
+
network: "solana",
|
|
219
|
+
publicKey: keypair.publicKey,
|
|
220
|
+
updateInterval: 60
|
|
206
221
|
});
|
|
207
222
|
// Start the balance tracker
|
|
208
223
|
await balanceTracker.start();
|
|
@@ -241,8 +256,8 @@ const _default = {
|
|
|
241
256
|
}, {
|
|
242
257
|
level: controllerLogLevel
|
|
243
258
|
}), {
|
|
244
|
-
|
|
245
|
-
|
|
259
|
+
metrics: metrics,
|
|
260
|
+
pushingFrequency
|
|
246
261
|
});
|
|
247
262
|
void controller.start();
|
|
248
263
|
}
|
package/dist/solana/command.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
1
|
+
import type { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
2
2
|
import type { Logger } from "pino";
|
|
3
3
|
import type { Options } from "yargs";
|
|
4
4
|
declare const _default: {
|
|
5
|
-
command: string;
|
|
6
|
-
describe: string;
|
|
7
5
|
builder: {
|
|
8
6
|
"metrics-port": Options;
|
|
9
7
|
"enable-metrics": Options;
|
|
@@ -12,22 +10,27 @@ declare const _default: {
|
|
|
12
10
|
"pushing-frequency": Options;
|
|
13
11
|
"polling-frequency": Options;
|
|
14
12
|
"pyth-contract-address": Options;
|
|
13
|
+
"hermes-access-token": Options;
|
|
15
14
|
"price-service-endpoint": Options;
|
|
16
15
|
"price-config-file": Options;
|
|
17
|
-
|
|
18
|
-
"keypair-file": Options;
|
|
19
|
-
"shard-id": Options;
|
|
16
|
+
"address-lookup-table-account": Options;
|
|
20
17
|
"compute-unit-price-micro-lamports": Options;
|
|
18
|
+
"dynamic-jito-tips": Options;
|
|
19
|
+
endpoint: Options;
|
|
20
|
+
"jito-bundle-size": Options;
|
|
21
21
|
"jito-endpoints": Options;
|
|
22
22
|
"jito-keypair-file": Options;
|
|
23
23
|
"jito-tip-lamports": Options;
|
|
24
|
-
"
|
|
24
|
+
"keypair-file": Options;
|
|
25
25
|
"max-jito-tip-lamports": Options;
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"address-lookup-table-account": Options;
|
|
26
|
+
"pyth-receiver-program-id": Options;
|
|
27
|
+
"shard-id": Options;
|
|
29
28
|
"treasury-id": Options;
|
|
29
|
+
"updates-per-jito-bundle": Options;
|
|
30
|
+
"wormhole-program-id": Options;
|
|
30
31
|
};
|
|
32
|
+
command: string;
|
|
33
|
+
describe: string;
|
|
31
34
|
handler: (argv: any) => Promise<void>;
|
|
32
35
|
};
|
|
33
36
|
export default _default;
|
package/dist/solana/solana.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HermesClient } from "@pythnetwork/hermes-client";
|
|
2
|
-
import { PythSolanaReceiver } from "@pythnetwork/pyth-solana-receiver";
|
|
3
|
-
import { AddressLookupTableAccount } from "@solana/web3.js";
|
|
4
|
-
import { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
1
|
+
import type { HermesClient } from "@pythnetwork/hermes-client";
|
|
2
|
+
import type { PythSolanaReceiver } from "@pythnetwork/pyth-solana-receiver";
|
|
3
|
+
import type { AddressLookupTableAccount } from "@solana/web3.js";
|
|
4
|
+
import type { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
5
5
|
import type { Logger } from "pino";
|
|
6
6
|
import type { IPricePusher, PriceInfo, PriceItem } from "../interface.js";
|
|
7
7
|
import { ChainPriceListener } from "../interface.js";
|
|
@@ -48,11 +48,11 @@ class SuiBalanceTracker extends _interface.BaseBalanceTracker {
|
|
|
48
48
|
}
|
|
49
49
|
function createSuiBalanceTracker(params) {
|
|
50
50
|
return new SuiBalanceTracker({
|
|
51
|
-
client: params.client,
|
|
52
51
|
address: params.address,
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
client: params.client,
|
|
53
|
+
logger: params.logger,
|
|
55
54
|
metrics: params.metrics,
|
|
56
|
-
|
|
55
|
+
network: params.network,
|
|
56
|
+
updateInterval: params.updateInterval
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui/client";
|
|
1
|
+
import type { SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import type { Logger } from "pino";
|
|
3
3
|
import type { BaseBalanceTrackerConfig, IBalanceTracker } from "../interface.js";
|
|
4
4
|
import { BaseBalanceTracker } from "../interface.js";
|
|
5
|
-
import { PricePusherMetrics } from "../metrics.js";
|
|
5
|
+
import type { PricePusherMetrics } from "../metrics.js";
|
|
6
6
|
import type { DurationInSeconds } from "../utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Sui-specific configuration for balance tracker
|