Skip to content

Commit de0d661

Browse files
fix(lazer/js/sdk): fix casing (#3099)
* fix(lazer/js/sdk): use camelCase * fix: update examples
1 parent 9c1125e commit de0d661

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

lazer/contracts/sui/sdk/js/examples/fetch-and-verify-update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function getOneLeEcdsaUpdate(token: string) {
1212
token,
1313
});
1414

15-
const latestPrice = await lazer.get_latest_price({
15+
const latestPrice = await lazer.getLatestPrice({
1616
priceFeedIds: [1],
1717
properties: ["price", "bestBidPrice", "bestAskPrice", "exponent"],
1818
formats: ["leEcdsa"],

lazer/contracts/sui/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-lazer-sui-js",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "TypeScript SDK for the Pyth Lazer Sui contract",
55
"license": "Apache-2.0",
66
"type": "module",

lazer/sdk/js/examples/history.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const client = await PythLazerClient.create({
1010

1111
// Example 1: Get latest price for BTC using feed IDs
1212
console.log("\n=== Example 1: Latest BTC price (requested with feed ID) ===");
13-
const response1 = await client.get_latest_price({
13+
const response1 = await client.getLatestPrice({
1414
priceFeedIds: [1],
1515
properties: ["price", "confidence", "exponent"],
1616
formats: [],
@@ -22,7 +22,7 @@ displayParsedPrices(response1);
2222

2323
// Example 2: Get latest price using symbols
2424
console.log("\n=== Example 2: Latest ETH price (requested with symbols) ===");
25-
const response2 = await client.get_latest_price({
25+
const response2 = await client.getLatestPrice({
2626
priceFeedIds: [2],
2727
properties: ["price", "confidence", "exponent"],
2828
formats: [],
@@ -37,7 +37,7 @@ const timestamp = 1_754_348_458_565_000;
3737
console.log(
3838
`Requesting price from timestamp: ${timestamp.toString()} (${new Date(timestamp / 1000).toISOString()})`,
3939
);
40-
const response3 = await client.get_price({
40+
const response3 = await client.getPrice({
4141
timestamp: timestamp,
4242
priceFeedIds: [1],
4343
properties: ["price", "confidence", "exponent"],

lazer/sdk/js/examples/streaming.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const client = await PythLazerClient.create({
4040
});
4141

4242
// Fetch current map of price feeds
43-
void client.get_symbols().then((symbols) => {
43+
void client.getSymbols().then((symbols) => {
4444
for (const symbol of symbols) {
4545
symbolsMap.set(symbol.pyth_lazer_id, symbol.symbol);
4646
}

lazer/sdk/js/examples/symbols.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ const client = await PythLazerClient.create({
99

1010
// Example 1: Get latest price for BTC using feed IDs
1111
console.log("\n=== Example 1: Search feeds by name/symbol ===");
12-
const response1 = await client.get_symbols({ query: "BTC" });
12+
const response1 = await client.getSymbols({ query: "BTC" });
1313
console.log(response1);
1414

1515
// Example 2: Get latest price using symbols
1616
console.log("\n=== Example 2: Get feeds by asset type ===");
17-
const response2 = await client.get_symbols({
17+
const response2 = await client.getSymbols({
1818
asset_type: "equity",
1919
});
2020
console.log(response2);
2121

2222
// Example 3: Get feeds by asset type and query
2323
console.log("\n=== Example 3: Get feeds by asset type and name/symbol ===");
24-
const response3 = await client.get_symbols({
24+
const response3 = await client.getSymbols({
2525
asset_type: "equity",
2626
query: "AAPL",
2727
});

lazer/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-lazer-sdk",
3-
"version": "3.0.1",
3+
"version": "4.0.0",
44
"description": "Pyth Lazer SDK",
55
"publishConfig": {
66
"access": "public"

lazer/sdk/js/src/client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export class PythLazerClient {
222222
* @param params - Optional query parameters to filter symbols
223223
* @returns Promise resolving to array of symbol information
224224
*/
225-
async get_symbols(params?: SymbolsQueryParams): Promise<SymbolResponse[]> {
225+
async getSymbols(params?: SymbolsQueryParams): Promise<SymbolResponse[]> {
226226
const url = new URL(`${this.metadataServiceUrl}/v1/symbols`);
227227

228228
if (params?.query) {
@@ -252,12 +252,12 @@ export class PythLazerClient {
252252
* @param params - Parameters for the latest price request
253253
* @returns Promise resolving to JsonUpdate with current price data
254254
*/
255-
async get_latest_price(params: LatestPriceRequest): Promise<JsonUpdate> {
255+
async getLatestPrice(params: LatestPriceRequest): Promise<JsonUpdate> {
256256
const url = `${this.priceServiceUrl}/v1/latest_price`;
257257

258258
try {
259259
const body = JSON.stringify(params);
260-
this.logger.debug("get_latest_price", { url, body });
260+
this.logger.debug("getLatestPrice", { url, body });
261261
const response = await this.authenticatedFetch(url, {
262262
method: "POST",
263263
headers: {
@@ -283,12 +283,12 @@ export class PythLazerClient {
283283
* @param params - Parameters for the price request including timestamp
284284
* @returns Promise resolving to JsonUpdate with price data at the specified time
285285
*/
286-
async get_price(params: PriceRequest): Promise<JsonUpdate> {
286+
async getPrice(params: PriceRequest): Promise<JsonUpdate> {
287287
const url = `${this.priceServiceUrl}/v1/price`;
288288

289289
try {
290290
const body = JSON.stringify(params);
291-
this.logger.debug("get_price", { url, body });
291+
this.logger.debug("getPrice", { url, body });
292292
const response = await this.authenticatedFetch(url, {
293293
method: "POST",
294294
headers: {

0 commit comments

Comments
 (0)