-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: main
Are you sure you want to change the base?
Conversation
@NerdMuckee is attempting to deploy a commit to the wowcats Team on Vercel. A member of the Team first needs to authorize it. |
Just thought to mention... I decided to forward the connection as a separate parameter, instead of adding it to the payload described by 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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimulateTransaction
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimulateTransaction
The existing code uses the
RPC_URL
constant defined in theconstant.ts
file to instantiate a new web3 connection.With these changes, a
Connection
can be optionally passed to thegetOptimalComputeUnitLimitAndPrice
function, which is used to override the connection defined in the constructor of the FeeService class whenConnection.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.