I am not able to figure out what is going on.. I am using @solana/web3.js version 1.89.1 (latest) . What am I doing wrong here? Based on this doc, the usage seems to be fine
Anyone?
Here is my code example:
import { Connection } from '@solana/web3.js';
export class SolanaPlatform<N extends Network> extends PlatformContext<
N,
SolanaPlatformType
> {
static _platform = _platform;
constructor(network: N, config?: ChainsConfig<N, SolanaPlatformType>) {
super(
network,
config ?? networkPlatformConfigs(network, SolanaPlatform._platform),
);
}
static async getPrFees(rpc: Connection): Promise<{ prioritizationFee: number; slot: number }[]> {
try {
const obj: { prioritizationFee: number; slot: number }[] = await rpc.getRecentPrioritizationFees();
console.log("Prioritization Fees", obj);
return obj;
} catch (error) {
console.error("Error fetching prioritization fees:", error);
throw error;
}
}
}
// Example usage
try {
let rpf = await SolanaPlatform.getPrFees(this._rpc);
console.log("rpf", rpf);
} catch (error) {
// Handle error
console.error("Error:", error);
}
I am getting this error.. it works fine when i do getBlockheight for example.
TypeError: rpc.getRecentPrioritizationFees is not a function
this._rpc
in asconnection
? stackblitz.com/edit/stackblitz-starters-5ugjpk?file=index.mjs