Skip to content

Commit 896f6f5

Browse files
Merge branch 'pyth-network:main' into stylus-sdk
2 parents f51ffe9 + bc25ee2 commit 896f6f5

File tree

72 files changed

+4057
-2629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4057
-2629
lines changed

.github/workflows/ci-pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
toolchain: 1.82.0
2424
- name: Install Rust versions
2525
run: |
26-
rustup install 1.66.1
2726
rustup install 1.73.0
27+
rustup install 1.66.1
2828
- name: Install protoc
2929
uses: arduino/setup-protoc@v3
3030
with:

.github/workflows/ci-remote-executor.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ jobs:
1515
- uses: actions-rs/toolchain@v1
1616
with:
1717
profile: minimal
18-
toolchain: 1.66.1
18+
toolchain: 1.73.0
1919
components: rustfmt, clippy
2020
override: true
2121
- name: Install Solana
2222
run: |
23-
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
24-
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
25-
sh -c "$(curl -sSfL https://release.solana.com/v1.14.18/install)"
23+
sh -c "$(curl -sSfL https://release.solana.com/v1.18.23/install)"
2624
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
2725
- name: Run executor tests
28-
run: cargo test-bpf --manifest-path ./governance/remote_executor/Cargo.toml
26+
run: cargo test-sbf --manifest-path ./governance/remote_executor/Cargo.toml
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Publish Rust package pyth-lazer-sdk to crates.io
1+
name: Publish Rust package pyth-lazer-client to crates.io
22

33
on:
44
push:
55
tags:
6-
- rust-pyth-lazer-sdk-v*
6+
- rust-pyth-lazer-client-v*
77
jobs:
88
publish-pyth-lazer-sdk:
9-
name: Publish Rust package pyth-lazer-sdk to crates.io
9+
name: Publish Rust package pyth-lazer-client to crates.io
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout sources
@@ -15,4 +15,4 @@ jobs:
1515
- run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
1616
env:
1717
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
18-
working-directory: "lazer/sdk/solana"
18+
working-directory: "lazer/sdk/rust/client"

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ repos:
3939
- id: cargo-fmt-remote-executor
4040
name: Cargo format for remote executor
4141
language: "rust"
42-
entry: cargo +1.66.1 fmt --manifest-path ./governance/remote_executor/Cargo.toml --all
42+
entry: cargo +1.73.0 fmt --manifest-path ./governance/remote_executor/Cargo.toml --all
4343
pass_filenames: false
4444
files: governance/remote_executor
4545
- id: cargo-clippy-remote-executor
4646
name: Cargo clippy for remote executor
4747
language: "rust"
48-
entry: cargo +1.66.1 clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests -- --deny warnings
48+
entry: cargo +1.73.0 clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests -- --deny warnings
4949
pass_filenames: false
5050
files: governance/remote_executor
5151
# Hooks for cosmwasm contract

apps/hermes/client/js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/hermes-client",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"description": "Pyth Hermes Client",
55
"author": {
66
"name": "Pyth Data Association"
@@ -47,7 +47,7 @@
4747
"openapi-zod-client": "^1.18.1",
4848
"prettier": "^2.6.2",
4949
"ts-jest": "^29.0.5",
50-
"typescript": "^4.6.3",
50+
"typescript": "catalog:",
5151
"yargs": "^17.4.1"
5252
},
5353
"dependencies": {

apps/hermes/client/js/src/HermesClient.ts

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,17 @@ export class HermesClient {
6363
schema: z.ZodSchema<ResponseData>,
6464
options?: RequestInit,
6565
retries = this.httpRetries,
66-
backoff = 100 + Math.floor(Math.random() * 100), // Adding randomness to the initial backoff to avoid "thundering herd" scenario where a lot of clients that get kicked off all at the same time (say some script or something) and fail to connect all retry at exactly the same time too
67-
externalAbortController?: AbortController
66+
backoff = 100 + Math.floor(Math.random() * 100) // Adding randomness to the initial backoff to avoid "thundering herd" scenario where a lot of clients that get kicked off all at the same time (say some script or something) and fail to connect all retry at exactly the same time too
6867
): Promise<ResponseData> {
69-
const controller = externalAbortController ?? new AbortController();
70-
const { signal } = controller;
71-
options = {
72-
...options,
73-
signal,
74-
headers: { ...this.headers, ...options?.headers },
75-
}; // Merge any existing options with the signal and headers
76-
77-
// Set a timeout to abort the request if it takes too long
78-
const timeout = setTimeout(() => controller.abort(), this.timeout);
79-
8068
try {
81-
const response = await fetch(url, options);
82-
clearTimeout(timeout); // Clear the timeout if the request completes in time
69+
const response = await fetch(url, {
70+
...options,
71+
signal: AbortSignal.any([
72+
...(options?.signal ? [options.signal] : []),
73+
AbortSignal.timeout(this.timeout),
74+
]),
75+
headers: { ...this.headers, ...options?.headers },
76+
});
8377
if (!response.ok) {
8478
const errorBody = await response.text();
8579
throw new Error(
@@ -91,7 +85,6 @@ export class HermesClient {
9185
const data = await response.json();
9286
return schema.parse(data);
9387
} catch (error) {
94-
clearTimeout(timeout);
9588
if (
9689
retries > 0 &&
9790
!(error instanceof Error && error.name === "AbortError")
@@ -115,17 +108,22 @@ export class HermesClient {
115108
*
116109
* @returns Array of PriceFeedMetadata objects.
117110
*/
118-
async getPriceFeeds(options?: {
111+
async getPriceFeeds({
112+
fetchOptions,
113+
...options
114+
}: {
119115
query?: string;
120116
filter?: string;
121-
}): Promise<PriceFeedMetadata[]> {
117+
fetchOptions?: RequestInit;
118+
} = {}): Promise<PriceFeedMetadata[]> {
122119
const url = this.buildURL("price_feeds");
123120
if (options) {
124121
this.appendUrlSearchParams(url, options);
125122
}
126123
return await this.httpRequest(
127124
url.toString(),
128-
schemas.PriceFeedMetadata.array()
125+
schemas.PriceFeedMetadata.array(),
126+
fetchOptions
129127
);
130128
}
131129

@@ -140,10 +138,14 @@ export class HermesClient {
140138
*
141139
* @returns PublisherCaps object containing the latest publisher stake caps.
142140
*/
143-
async getLatestPublisherCaps(options?: {
141+
async getLatestPublisherCaps({
142+
fetchOptions,
143+
...options
144+
}: {
144145
encoding?: EncodingType;
145146
parsed?: boolean;
146-
}): Promise<PublisherCaps> {
147+
fetchOptions?: RequestInit;
148+
} = {}): Promise<PublisherCaps> {
147149
const url = this.buildURL("updates/publisher_stake_caps/latest");
148150
if (options) {
149151
this.appendUrlSearchParams(url, options);
@@ -173,7 +175,8 @@ export class HermesClient {
173175
encoding?: EncodingType;
174176
parsed?: boolean;
175177
ignoreInvalidPriceIds?: boolean;
176-
}
178+
},
179+
fetchOptions?: RequestInit
177180
): Promise<PriceUpdate> {
178181
const url = this.buildURL("updates/price/latest");
179182
for (const id of ids) {
@@ -185,7 +188,7 @@ export class HermesClient {
185188
this.appendUrlSearchParams(url, transformedOptions);
186189
}
187190

188-
return this.httpRequest(url.toString(), schemas.PriceUpdate);
191+
return this.httpRequest(url.toString(), schemas.PriceUpdate, fetchOptions);
189192
}
190193

191194
/**
@@ -209,7 +212,8 @@ export class HermesClient {
209212
encoding?: EncodingType;
210213
parsed?: boolean;
211214
ignoreInvalidPriceIds?: boolean;
212-
}
215+
},
216+
fetchOptions?: RequestInit
213217
): Promise<PriceUpdate> {
214218
const url = this.buildURL(`updates/price/${publishTime}`);
215219
for (const id of ids) {
@@ -221,7 +225,7 @@ export class HermesClient {
221225
this.appendUrlSearchParams(url, transformedOptions);
222226
}
223227

224-
return this.httpRequest(url.toString(), schemas.PriceUpdate);
228+
return this.httpRequest(url.toString(), schemas.PriceUpdate, fetchOptions);
225229
}
226230

227231
/**
@@ -286,7 +290,8 @@ export class HermesClient {
286290
encoding?: EncodingType;
287291
parsed?: boolean;
288292
ignoreInvalidPriceIds?: boolean;
289-
}
293+
},
294+
fetchOptions?: RequestInit
290295
): Promise<TwapsResponse> {
291296
const url = this.buildURL(`updates/twap/${window_seconds}/latest`);
292297
for (const id of ids) {
@@ -298,7 +303,11 @@ export class HermesClient {
298303
this.appendUrlSearchParams(url, transformedOptions);
299304
}
300305

301-
return this.httpRequest(url.toString(), schemas.TwapsResponse);
306+
return this.httpRequest(
307+
url.toString(),
308+
schemas.TwapsResponse,
309+
fetchOptions
310+
);
302311
}
303312

304313
private appendUrlSearchParams(

apps/insights/src/app/layout.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
export { Root as default } from "../components/Root";
22
export { metadata, viewport } from "../metadata";
3+
4+
export const dynamic = "error";
5+
export const revalidate = 3600;
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import type { Metadata } from "next";
22

3-
import { Cluster, getFeeds } from "../../../services/pyth";
43
export { PriceFeedLayout as default } from "../../../components/PriceFeed/layout";
54

65
export const metadata: Metadata = {
76
title: "Price Feeds",
87
};
98

10-
export const generateStaticParams = async () => {
11-
const feeds = await getFeeds(Cluster.Pythnet);
12-
return feeds.map(({ symbol }) => ({ slug: encodeURIComponent(symbol) }));
13-
};
9+
export const dynamic = "error";
10+
export const revalidate = 3600;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
export { ChartPage as default } from "../../../components/PriceFeed/chart-page";
2+
3+
export const dynamic = "error";
4+
export const revalidate = 3600;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
export { Publishers as default } from "../../../../components/PriceFeed/publishers";
2+
3+
export const dynamic = "error";
4+
export const revalidate = 3600;

0 commit comments

Comments
 (0)