Skip to content

Conversation

@royvardhan
Copy link
Contributor

@royvardhan royvardhan commented Jan 6, 2026

Related to #263

Adds IntentGatewayV2 class to the SDK for interacting with the V2 intent gateway contract.

preparePlaceOrder - Generates session key, stores it, and returns placeOrder calldata

estimateFillOrderV2 - Estimates gas used for filling an order, includes smart account verification costs.

prepareSubmitBid - Constructs UserOperation for fillers to submit bids to Hyperbridge

signSolverSelection - Signs EIP-712 solver selection with stored session key

@royvardhan royvardhan changed the title [sdk]: IntentsV2 util class [sdk]: Add IntentsV2 Jan 6, 2026
@royvardhan royvardhan force-pushed the roy/sdk-igv2-place-order branch from 8a40e99 to a988a99 Compare January 9, 2026 13:25
Copy link
Contributor Author

@royvardhan royvardhan left a comment

Choose a reason for hiding this comment

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

Thinking....

@royvardhan royvardhan requested a review from Wizdave97 January 12, 2026 07:49
@royvardhan
Copy link
Contributor Author

Since filler will be heavily dependent on this class. I will add cache service here when I work on the filler.

@royvardhan royvardhan requested a review from Wizdave97 January 12, 2026 13:26
@Wizdave97 Wizdave97 merged commit c51113d into main Jan 13, 2026
0 of 5 checks passed
@Wizdave97 Wizdave97 deleted the roy/sdk-igv2-place-order branch January 13, 2026 05:38
Comment on lines +385 to +398
if (intentGatewayV2Address) {
const paramsSlot5 = pad(toHex(5n), { size: 32 }) as HexString
const currentSlot5Value = await this.dest.client.getStorageAt({
address: intentGatewayV2Address,
slot: paramsSlot5,
})
// Set solverSelection to 0x00 while preserving dispatcher
const currentValue = currentSlot5Value || "0x" + "0".repeat(64)
const newSlot5Value = (currentValue.slice(0, 24) + "00" + currentValue.slice(26)) as HexString
overrides.push({
address: intentGatewayV2Address,
stateDiff: [{ slot: paramsSlot5, value: newSlot5Value }],
})
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why we need to query this at all before overriding it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this slot contains the dispatcher and the solver selection packed.

If we are not changing the dispatcher address then we can have the dispatcher stored locally and can override without querying first.

// =========================================================================

/** Builds state overrides for token balances and allowances to enable gas estimation */
private async buildTokenStateOverrides(
Copy link
Member

Choose a reason for hiding this comment

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

this method should not be async

Copy link
Contributor Author

@royvardhan royvardhan Jan 13, 2026

Choose a reason for hiding this comment

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

Ohh yeah, missed this. It was using tracer before, now using config values.

Comment on lines +210 to +212
let protocolFeeInNativeToken = await this.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(() =>
this.dest.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(() => 0n),
)
Copy link
Member

Choose a reason for hiding this comment

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

A bit confusing as to why we don't just use the dest.quoteNative exclusively?

Copy link
Contributor Author

@royvardhan royvardhan Jan 13, 2026

Choose a reason for hiding this comment

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

Because direct contract call for IntentGateway.quoteNative() is just one rpc call. This will fail for some chains where we have the wrapper.

While EvmChain.quoteNative() is three rpc calls:

host.perByteFee()
host.feeToken()
uniswap.getAmountsIn()

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