Skip to content

Conversation

@m30m
Copy link
Contributor

@m30m m30m commented Oct 8, 2024

  • Add necessary types for fetching SvmOpportunities
  • Remove relayerSigner and feeReceiverRelayer from configs since they are dynamic and should not be hardcoded in the sdk but fetched in the initialization of the client
  • Add fill rate option to the sample searchers
  • Add support for submitting SvmOpportunities in the js sdk (python not supported yet)

- Add necessary types for fetching SvmOpportunities
- Remove relayerSigner and feeReceiverRelayer from configs since they are dynamic
and should not be hardcoded in the sdk but fetched in the initialization of the client
- Add fill rate option to the sample searchers
- Add support for submitting SvmOpportunities in the js sdk (python not supported yet)
@vercel
Copy link

vercel bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:52pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:52pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
proposals ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 3:52pm

}

async opportunityHandler(opportunity: Opportunity) {
if (!("targetContract" in opportunity))
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we trying to validate fields and type here or just checking if it's a Svm or Evm opp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just checking it's an Svm/Evm opp.

return bid;
}

async opportunityHandler(opportunity: Opportunity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change the code so that opportunityHandler get a svm opportunity as input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, this would affect all the subscription interfaces.


async opportunityHandler(opportunity: Opportunity) {
if (!("order" in opportunity))
throw new Error("Not a valid SVM opportunity");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it okay to throw when getting invalid opp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you have subscribed to a SVM chain and receive EVM opportunities, I think you should throw and it's fine here

await new Promise((resolve) => setTimeout(resolve, 2000));
await this.fetchConfig();
try {
await this.client.subscribeChains([argv.chainId]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we pass a chain_type to server with chain_id, we can remove bunch of type checkings above :-?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, assuming we want to keep stuff backward compatible and not change a lot on the server side, I thought this is a good enough solution

self.fill_rate = fill_rate
self.express_relay_metadata = None

async def opportunity_callback(self, opp: Opportunity):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the opp here is a OpportunitySvm type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the general callback and should accept a general opportunity type. I know it's suboptimal, but I guess the alternative is to have separate callbacks for svm and evm which is ugly in another way 😅

await self.evaluate_order(order)

async def evaluate_order(self, order: OrderStateAndAddress):
async def assess_opportunity(self, opp: Opportunity) -> BidSvm:
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will move this check to the other function so that this one only accepts OpportunitySvm

Copy link
Contributor

@danimhr danimhr left a comment

Choose a reason for hiding this comment

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

Add tasks to backlog for some refactoring

@m30m m30m merged commit 53521aa into main Oct 9, 2024
6 checks passed
@m30m m30m deleted the feat/opp-svm-websocket branch October 9, 2024 16:03
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.

2 participants