Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pages/express-relay/integrate-as-searcher/svm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ import * as anchor from "@coral-xyz/anchor";
import * as limo from "@kamino-finance/limo-sdk";

/**
* Generates a bid for a given opportunity. The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.
* @param opportunity The SVM opportunity to bid on
* @returns The generated bid object
* Generates a bid for a given opportunity.
* The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.
* @param opportunity The SVM opportunity to bid on.
* @returns The generated bid object.
*/
async generateBid(opportunity: OpportunitySvm): Promise<BidSvm> {
const order = opportunity.order;
Expand Down Expand Up @@ -192,14 +193,15 @@ from express_relay.svm.limo_client import OrderStateAndAddress
DEADLINE = 2**62
logger = logging.getLogger(__name__)

async def assess_opportunity(self, opp: OpportunitySvm) -> BidSvm | None:
async def generate_bid(self, opp: OpportunitySvm) -> BidSvm:
"""
Method to assess an opportunity and return a bid if the opportunity is worth taking. This method always returns a bid for any valid opportunity. The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.
Generates a bid for a given opportunity.
The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.

Args:
opp: An object representing a single opportunity.
opp: The SVM opportunity to bid on.
Returns:
A bid object if the opportunity is worth taking to be submitted to the Express Relay server, otherwise None.
The generated bid object.
"""
order: OrderStateAndAddress = {"address": opp.order_address, "state": opp.order}

Expand All @@ -220,9 +222,7 @@ async def assess_opportunity(self, opp: OpportunitySvm) -> BidSvm | None:
relayer_signer=(await self.get_metadata()).relayer_signer,
)
latest_chain_update = self.latest_chain_update[self.chain_id]
fee_instruction = set_compute_unit_price(
latest_chain_update.latest_prioritization_fee
)
fee_instruction = set_compute_unit_price(latest_chain_update.latest_prioritization_fee)
transaction = Transaction.new_with_payer(
[fee_instruction, submit_bid_ix] + ixs_take_order, self.private_key.pubkey()
)
Expand Down
Loading