Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lazer/js-sdk): add promises for open and disconnected #2254

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: naming
tejasbadadare committed Jan 15, 2025
commit 1be7862bf856fc5fe05a879cf7efdc5cd161cade
2 changes: 1 addition & 1 deletion lazer/sdk/js/examples/index.ts
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ client.addMessageListener((message) => {

// Monitor for all connections in the pool being down simultaneously (e.g. if the internet goes down)
// The connections may still try to reconnect in the background. To shut down the client completely, call shutdown().
client.addAllConnectionsDownHandler(() => {
client.addAllConnectionsDownListener(() => {
console.error("All connections are down!");
});

2 changes: 1 addition & 1 deletion lazer/sdk/js/src/client.ts
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ export class PythLazerClient {
* The connections may still try to reconnect in the background. To shut down the pool, call `shutdown()`.
* @param handler - Function to be called when all connections are down
*/
addAllConnectionsDownHandler(handler: () => void): void {
addAllConnectionsDownListener(handler: () => void): void {
this.wsp.addAllConnectionsDownListener(handler);
}


Unchanged files with check annotations Beta

describe("Test parse accumulator update", () => {
test("Happy path", async () => {
const { vaa, updates } = parseAccumulatorUpdateData(

Check warning on line 14 in price_service/sdk/js/src/__tests__/AccumulatorUpdateData.test.ts

GitHub Actions / test

'vaa' is assigned a value but never used
Buffer.from(TEST_ACCUMULATOR_UPDATE_DATA, "base64")
);
).updates.length
).toBe(3);
const { vaa, updates } = parseAccumulatorUpdateData(

Check warning on line 76 in price_service/sdk/js/src/__tests__/AccumulatorUpdateData.test.ts

GitHub Actions / test

'vaa' is assigned a value but never used
sliceAccumulatorUpdateData(
Buffer.from(TEST_ACCUMULATOR_UPDATE_DATA, "base64"),
1,
eventSource.onmessage = (event: MessageEvent<string>) => {
console.log("Received price update:", event.data);
const _priceUpdate = JSON.parse(event.data) as PriceUpdate;

Check warning on line 92 in apps/hermes/client/js/src/examples/HermesClient.ts

GitHub Actions / test

'_priceUpdate' is assigned a value but never used
};
eventSource.onerror = (error: Event) => {
let seenOutOfOrder = false;
for (let i = 1; i < observedSlots.length; i++) {
if (observedSlots[i] < observedSlots[i - 1]) {
seenOutOfOrder = true;

Check warning on line 224 in price_service/client/js/src/__tests__/connection.e2e.test.ts

GitHub Actions / test

'seenOutOfOrder' is assigned a value but never used
}
}
private createOpportunity(vault: VaultWithId) {
const priceUpdates = [
this.prices[vault.tokenIdCollateral].getVAA()!,

Check warning on line 109 in express_relay/examples/easy_lend/src/monitor.ts

GitHub Actions / test

Forbidden non-null assertion
this.prices[vault.tokenIdDebt].getVAA()!,

Check warning on line 110 in express_relay/examples/easy_lend/src/monitor.ts

GitHub Actions / test

Forbidden non-null assertion
];
const vaas: Hex[] = priceUpdates.map(
(vaa): Hex => `0x${Buffer.from(vaa, "base64").toString("hex")}`
getOrDeployWormholeContract,
BaseDeployConfig,
} from "./common";
import Web3 from "web3";

Check warning on line 21 in contract_manager/scripts/deploy_evm_entropy_contracts.ts

GitHub Actions / test

'Web3' is defined but never used
interface DeploymentConfig extends BaseDeployConfig {
type: DeploymentType;
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { DefaultStore } from "../src";
import { Chain } from "../src/chains";

Check warning on line 4 in contract_manager/scripts/generate_governance_set_fee_payload.ts

GitHub Actions / test

'Chain' is defined but never used
const parser = yargs(hideBin(process.argv))
.usage("Usage: $0 --chain <chain_id> --fee <fee> --exponent <exponent>")
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import {
DefaultStore,

Check warning on line 4 in contract_manager/scripts/load_test_entropy.ts

GitHub Actions / test

'DefaultStore' is defined but never used
EvmEntropyContract,

Check warning on line 5 in contract_manager/scripts/load_test_entropy.ts

GitHub Actions / test

'EvmEntropyContract' is defined but never used
PrivateKey,
toPrivateKey,
} from "../src";