0

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
3
  • Strange, that should definitely work! Here's a simple example, does this work if you plug the code that creates your this._rpc in as connection? stackblitz.com/edit/stackblitz-starters-5ugjpk?file=index.mjs
    – Callum M
    Commented Jan 25 at 14:50
  • 1
    Perhaps you're using a very outdated version of web3.js, make sure to double check this too.
    – McBain
    Commented Jan 25 at 18:39
  • I am at version 1.89.1 for web3.js.. I am able to get the priority fees in a separate script.. Idk why this one isn't working.. pretty weird.. let me research more.. it seems to be an issue with different thing.. not web3.js itself..
    – mesnia
    Commented Jan 25 at 19:56

1 Answer 1

0

So.. I was able to pull get priorityFees when I code it outside of the Wormhole Project.. Looked at it more closely. Wormhole is indeed using the outdated web3.js for the connect sdk.. A PR was raised by WH team to bump web3.js version in upcoming major release -->https://github.com/wormhole-foundation/connect-sdk/pull/275/files

https://github.com/wormhole-foundation/connect-sdk/blob/main/platforms/solana/package.json#L54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.