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

fix: Allow custom RPC URL in FeeService class #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

muckee
Copy link

@muckee muckee commented Nov 10, 2024

The existing code uses the RPC_URL constant defined in the constant.ts file to instantiate a new web3 connection.

With these changes, a Connection can be optionally passed to the getOptimalComputeUnitLimitAndPrice function, which is used to override the connection defined in the constructor of the FeeService class when Connection.simulateTransaction is executed.

Additionally, inside the referral.ts file, the referral provider's connection property is passed to feeService.getOptimalComputeUnitLimitAndPrice to ensure that the fee service can make use of custom RPC URLs passed to the provider.

Copy link

vercel bot commented Nov 10, 2024

@NerdMuckee is attempting to deploy a commit to the wowcats Team on Vercel.

A member of the Team first needs to authorize it.

@muckee muckee changed the title Support optional custom RPC URL in FeeService class fix: Allow custom RPC URL in FeeService class Nov 10, 2024
@muckee
Copy link
Author

muckee commented Nov 12, 2024

Just thought to mention...

I decided to forward the connection as a separate parameter, instead of adding it to the payload described by GetOptimalComputeUnitLimitAndPricePayload.

I assumed that your intended definition of 'payload' describes data included in the blockchain interaction, as opposed to all of the data passed as props within JS.

Let me know if you want me to edit the PR so that the connection is passed as one of the properties of GetOptimalComputeUnitLimitAndPricePayload, instead of as a separate parameter.

@@ -100,7 +102,7 @@ class FeeServiceImpl implements FeeService {
}).compileToV0Message(lookupTables),
);

const simulation = await this.connection.simulateTransaction(
const simulation = await (connection || this.connection).simulateTransaction(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimulateTransaction

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All credit goes to my wallet

@@ -100,7 +102,7 @@ class FeeServiceImpl implements FeeService {
}).compileToV0Message(lookupTables),
);

const simulation = await this.connection.simulateTransaction(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimulateTransaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants