diff --git a/auction-server/src/state.rs b/auction-server/src/state.rs index d191092f..8818b418 100644 --- a/auction-server/src/state.rs +++ b/auction-server/src/state.rs @@ -1680,9 +1680,12 @@ impl Store { #[serde_as] #[derive(Serialize, Clone, ToSchema, ToResponse)] pub struct SvmChainUpdate { + #[schema(example = "solana", value_type = String)] pub chain_id: ChainId, #[serde_as(as = "DisplayFromStr")] + #[schema(example = "SLxp9LxX1eE9Z5v99Y92DaYEwyukFgMUF6zRerCF12j", value_type = String)] pub blockhash: Hash, /// The prioritization fee that the server suggests to use for the next transaction + #[schema(example = "1000", value_type = u64)] pub latest_prioritization_fee: MicroLamports, } diff --git a/sdk/js/package-lock.json b/sdk/js/package-lock.json index dc40f743..64bf88cb 100644 --- a/sdk/js/package-lock.json +++ b/sdk/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pythnetwork/express-relay-js", - "version": "0.14.1", + "version": "0.14.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pythnetwork/express-relay-js", - "version": "0.14.1", + "version": "0.14.2", "license": "Apache-2.0", "dependencies": { "@coral-xyz/anchor": "^0.30.1", diff --git a/sdk/js/package.json b/sdk/js/package.json index 102ef81d..d94c967f 100644 --- a/sdk/js/package.json +++ b/sdk/js/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/express-relay-js", - "version": "0.14.1", + "version": "0.14.2", "description": "Utilities for interacting with the express relay protocol", "homepage": "https://github.com/pyth-network/per/tree/main/sdk/js", "author": "Douro Labs", diff --git a/sdk/js/src/examples/simpleSearcherLimo.ts b/sdk/js/src/examples/simpleSearcherLimo.ts index 70ba64e9..d18359f1 100644 --- a/sdk/js/src/examples/simpleSearcherLimo.ts +++ b/sdk/js/src/examples/simpleSearcherLimo.ts @@ -103,7 +103,7 @@ export class SimpleSearcherLimo { const ixsTakeOrder = await this.generateTakeOrderIxs(limoClient, order); const feeInstruction = ComputeBudgetProgram.setComputeUnitPrice({ microLamports: - this.latestChainUpdate[this.chainId].latest_prioritization_fee, + this.latestChainUpdate[this.chainId].latestPrioritizationFee, }); const txRaw = new anchor.web3.Transaction().add( feeInstruction, @@ -236,7 +236,7 @@ export class SimpleSearcherLimo { } async svmChainUpdateHandler(update: SvmChainUpdate) { - this.latestChainUpdate[update.chain_id] = update; + this.latestChainUpdate[update.chainId] = update; } // NOTE: Developers are responsible for implementing custom removal logic specific to their use case. diff --git a/sdk/js/src/index.ts b/sdk/js/src/index.ts index f3549562..feac50f4 100644 --- a/sdk/js/src/index.ts +++ b/sdk/js/src/index.ts @@ -166,7 +166,13 @@ export class Client { } } else if ("type" in message && message.type === "svm_chain_update") { if (typeof this.websocketSvmChainUpdateCallback === "function") { - await this.websocketSvmChainUpdateCallback(message.update); + await this.websocketSvmChainUpdateCallback({ + chainId: message.update.chain_id, + blockhash: message.update.blockhash, + latestPrioritizationFee: BigInt( + message.update.latest_prioritization_fee + ), + }); } } else if ("type" in message && message.type === "remove_opportunities") { if (typeof this.websocketRemoveOpportunitiesCallback === "function") { diff --git a/sdk/js/src/serverTypes.d.ts b/sdk/js/src/serverTypes.d.ts index c55805c7..b6af9d83 100644 --- a/sdk/js/src/serverTypes.d.ts +++ b/sdk/js/src/serverTypes.d.ts @@ -771,9 +771,16 @@ export interface components { items: components["schemas"]["SimulatedBid"][]; }; SvmChainUpdate: { - blockhash: components["schemas"]["Hash"]; - chain_id: components["schemas"]["ChainId"]; - latest_prioritization_fee: components["schemas"]["MicroLamports"]; + /** @example SLxp9LxX1eE9Z5v99Y92DaYEwyukFgMUF6zRerCF12j */ + blockhash: string; + /** @example solana */ + chain_id: string; + /** + * Format: int64 + * @description The prioritization fee that the server suggests to use for the next transaction + * @example 1000 + */ + latest_prioritization_fee: number; }; TokenAmountEvm: { /** diff --git a/sdk/js/src/types.ts b/sdk/js/src/types.ts index 70ba95ed..fc424ec0 100644 --- a/sdk/js/src/types.ts +++ b/sdk/js/src/types.ts @@ -242,7 +242,11 @@ export type SvmConstantsConfig = { expressRelayProgram: PublicKey; }; -export type SvmChainUpdate = components["schemas"]["SvmChainUpdate"]; +export type SvmChainUpdate = { + chainId: ChainId; + blockhash: string; + latestPrioritizationFee: bigint; +}; export type OpportunityDeleteSvm = { chainId: ChainId;