Skip to content

Commit 2d1c8a9

Browse files
Merge branch 'main' into tb/lazer-protocol/add-missing-symbols-response-type
2 parents dac106f + db01db1 commit 2d1c8a9

File tree

19 files changed

+911
-242
lines changed

19 files changed

+911
-242
lines changed

contract_manager/store/chains/EvmChains.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,5 +1321,12 @@
13211321
"rpcUrl": "https://rpc.itsnotreal.lol",
13221322
"networkId": 1380270412,
13231323
"type": "EvmChain"
1324+
},
1325+
{
1326+
"id": "giwa_testnet",
1327+
"mainnet": false,
1328+
"rpcUrl": "https://sepolia-rpc.giwa.io",
1329+
"networkId": 91342,
1330+
"type": "EvmChain"
13241331
}
13251332
]

contract_manager/store/contracts/EvmEntropyContracts.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,10 @@
193193
"chain": "spiderman",
194194
"address": "0xD458261E832415CFd3BAE5E416FdF3230ce6F134",
195195
"type": "EvmEntropyContract"
196+
},
197+
{
198+
"chain": "giwa_testnet",
199+
"address": "0x0708325268dF9F66270F1401206434524814508b",
200+
"type": "EvmEntropyContract"
196201
}
197-
]
202+
]

contract_manager/store/contracts/EvmExecutorContracts.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,10 @@
228228
"chain": "itsnotreal",
229229
"address": "0x98046Bd286715D3B0BC227Dd7a956b83D8978603",
230230
"type": "EvmExecutorContract"
231+
},
232+
{
233+
"chain": "giwa_testnet",
234+
"address": "0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c",
235+
"type": "EvmExecutorContract"
231236
}
232-
]
237+
]

contract_manager/store/contracts/EvmPriceFeedContracts.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,5 +868,10 @@
868868
"chain": "zero_gravity",
869869
"address": "0x2880aB155794e7179c9eE2e38200202908C17B43",
870870
"type": "EvmPriceFeedContract"
871+
},
872+
{
873+
"chain": "giwa_testnet",
874+
"address": "0x2880aB155794e7179c9eE2e38200202908C17B43",
875+
"type": "EvmPriceFeedContract"
871876
}
872877
]

contract_manager/store/contracts/EvmWormholeContracts.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,5 +878,10 @@
878878
"chain": "itsnotreal",
879879
"address": "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
880880
"type": "EvmWormholeContract"
881+
},
882+
{
883+
"chain": "giwa_testnet",
884+
"address": "0xb27e5ca259702f209a29225d0eDdC131039C9933",
885+
"type": "EvmWormholeContract"
881886
}
882-
]
887+
]

governance/xc_admin/packages/xc_admin_common/src/chains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ export const RECEIVER_CHAINS = {
255255
ethereal_devnet: 50128,
256256
ethereal_testnet_v2: 50129,
257257
fluent_testnet: 50130,
258+
giwa_testnet: 50131,
258259
};
259260

260261
// If there is any overlapping value the receiver chain will replace the wormhole

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

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,26 @@
11
import { SuiClient } from "@mysten/sui/client";
22
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
33
import { Transaction } from "@mysten/sui/transactions";
4-
import type { Request as SubscriptionRequest } from "@pythnetwork/pyth-lazer-sdk";
54
import { PythLazerClient } from "@pythnetwork/pyth-lazer-sdk";
65
import yargs from "yargs";
76
import { hideBin } from "yargs/helpers";
87

98
import { addParseAndVerifyLeEcdsaUpdateCall } from "../src/client.js";
109

11-
async function getOneLeEcdsaUpdate(urls: string[], token: string) {
10+
async function getOneLeEcdsaUpdate(token: string) {
1211
const lazer = await PythLazerClient.create({
13-
urls,
1412
token,
15-
numConnections: 1,
1613
});
1714

18-
const subscription: SubscriptionRequest = {
19-
subscriptionId: 1,
20-
type: "subscribe",
15+
const latestPrice = await lazer.get_latest_price({
2116
priceFeedIds: [1],
2217
properties: ["price", "bestBidPrice", "bestAskPrice", "exponent"],
2318
formats: ["leEcdsa"],
2419
channel: "fixed_rate@200ms",
25-
deliveryFormat: "binary",
2620
jsonBinaryEncoding: "hex",
27-
};
28-
29-
lazer.subscribe(subscription);
30-
31-
return new Promise<Uint8Array>((resolve) => {
32-
lazer.addMessageListener((event) => {
33-
if (event.type === "binary" && event.value.leEcdsa) {
34-
const buf = event.value.leEcdsa;
35-
36-
// For the purposes of this example, we only need one update.
37-
lazer.shutdown();
38-
resolve(buf);
39-
}
40-
});
4121
});
22+
23+
return latestPrice;
4224
}
4325

4426
async function main() {
@@ -87,10 +69,7 @@ async function main() {
8769
const provider = new SuiClient({ url: args.fullnodeUrl });
8870

8971
// Fetch the price update
90-
const updateBytes = await getOneLeEcdsaUpdate(
91-
args.lazerUrls,
92-
args.lazerToken,
93-
);
72+
const update = await getOneLeEcdsaUpdate(args.lazerToken);
9473

9574
// Build the Sui transaction
9675
const tx = new Transaction();
@@ -100,7 +79,7 @@ async function main() {
10079
tx,
10180
packageId: args.packageId,
10281
stateObjectId: args.stateObjectId,
103-
updateBytes,
82+
updateBytes: Buffer.from(update.leEcdsa?.data ?? "", "hex"),
10483
});
10584

10685
// --- You can add more calls to the transaction that consume the parsed update here ---

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.0",
3+
"version": "0.1.1",
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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* eslint-disable no-console */
2+
3+
import { displayParsedPrices } from "./util.js";
4+
import { PythLazerClient } from "../src/index.js";
5+
6+
const client = await PythLazerClient.create({
7+
token: "your-token-here",
8+
logger: console,
9+
});
10+
11+
// Example 1: Get latest price for BTC using feed IDs
12+
console.log("\n=== Example 1: Latest BTC price (requested with feed ID) ===");
13+
const response1 = await client.get_latest_price({
14+
priceFeedIds: [1],
15+
properties: ["price", "confidence", "exponent"],
16+
formats: [],
17+
jsonBinaryEncoding: "hex",
18+
parsed: true,
19+
channel: "fixed_rate@200ms",
20+
});
21+
displayParsedPrices(response1);
22+
23+
// Example 2: Get latest price using symbols
24+
console.log("\n=== Example 2: Latest ETH price (requested with symbols) ===");
25+
const response2 = await client.get_latest_price({
26+
priceFeedIds: [2],
27+
properties: ["price", "confidence", "exponent"],
28+
formats: [],
29+
parsed: true,
30+
channel: "real_time",
31+
});
32+
displayParsedPrices(response2);
33+
34+
// Example 3: Get historical price at specific timestamp
35+
console.log("\n=== Example 3: Historical BTC price at timestamp ===");
36+
const timestamp = 1_754_348_458_565_000;
37+
console.log(
38+
`Requesting price from timestamp: ${timestamp.toString()} (${new Date(timestamp / 1000).toISOString()})`,
39+
);
40+
const response3 = await client.get_price({
41+
timestamp: timestamp,
42+
priceFeedIds: [1],
43+
properties: ["price", "confidence", "exponent"],
44+
formats: [],
45+
parsed: true,
46+
channel: "real_time",
47+
});
48+
displayParsedPrices(response3);

lazer/sdk/js/examples/index.ts

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)