Skip to content

Commit bdc2e96

Browse files
authored
refactor(express-relay): Update execution params hash data (#1476)
1 parent e04edcf commit bdc2e96

File tree

2 files changed

+33
-45
lines changed

2 files changed

+33
-45
lines changed

express_relay/sdk/js/src/index.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,14 @@ export class Client {
300300
privateKey: Hex
301301
): Promise<OpportunityBid> {
302302
const types = {
303-
SignedParams: [
304-
{ name: "executionParams", type: "ExecutionParams" },
305-
{ name: "signer", type: "address" },
306-
{ name: "deadline", type: "uint256" },
307-
],
308303
ExecutionParams: [
309304
{ name: "sellTokens", type: "TokenAmount[]" },
310305
{ name: "buyTokens", type: "TokenAmount[]" },
306+
{ name: "executor", type: "address" },
311307
{ name: "targetContract", type: "address" },
312308
{ name: "targetCalldata", type: "bytes" },
313309
{ name: "targetCallValue", type: "uint256" },
310+
{ name: "validUntil", type: "uint256" },
314311
{ name: "bidAmount", type: "uint256" },
315312
],
316313
TokenAmount: [
@@ -327,18 +324,16 @@ export class Client {
327324
chainId: Number(opportunity.eip712Domain.chainId),
328325
},
329326
types,
330-
primaryType: "SignedParams",
327+
primaryType: "ExecutionParams",
331328
message: {
332-
executionParams: {
333-
sellTokens: opportunity.sellTokens,
334-
buyTokens: opportunity.buyTokens,
335-
targetContract: opportunity.targetContract,
336-
targetCalldata: opportunity.targetCalldata,
337-
targetCallValue: opportunity.targetCallValue,
338-
bidAmount: bidParams.amount,
339-
},
340-
signer: account.address,
341-
deadline: bidParams.validUntil,
329+
sellTokens: opportunity.sellTokens,
330+
buyTokens: opportunity.buyTokens,
331+
executor: account.address,
332+
targetContract: opportunity.targetContract,
333+
targetCalldata: opportunity.targetCalldata,
334+
targetCallValue: opportunity.targetCallValue,
335+
validUntil: bidParams.validUntil,
336+
bidAmount: bidParams.amount,
342337
},
343338
});
344339

express_relay/sdk/python/express_relay/client.py

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,14 @@ def sign_bid(
411411
"verifyingContract": opportunity.eip_712_domain.verifying_contract,
412412
}
413413
message_types = {
414-
"SignedParams": [
415-
{"name": "executionParams", "type": "ExecutionParams"},
416-
{"name": "signer", "type": "address"},
417-
{"name": "deadline", "type": "uint256"},
418-
],
419414
"ExecutionParams": [
420415
{"name": "sellTokens", "type": "TokenAmount[]"},
421416
{"name": "buyTokens", "type": "TokenAmount[]"},
417+
{"name": "executor", "type": "address"},
422418
{"name": "targetContract", "type": "address"},
423419
{"name": "targetCalldata", "type": "bytes"},
424420
{"name": "targetCallValue", "type": "uint256"},
421+
{"name": "validUntil", "type": "uint256"},
425422
{"name": "bidAmount", "type": "uint256"},
426423
],
427424
"TokenAmount": [
@@ -432,30 +429,26 @@ def sign_bid(
432429

433430
# the data to be signed
434431
message_data = {
435-
"executionParams": {
436-
"sellTokens": [
437-
{
438-
"token": token.token,
439-
"amount": int(token.amount),
440-
}
441-
for token in opportunity.sell_tokens
442-
],
443-
"buyTokens": [
444-
{
445-
"token": token.token,
446-
"amount": int(token.amount),
447-
}
448-
for token in opportunity.buy_tokens
449-
],
450-
"targetContract": opportunity.target_contract,
451-
"targetCalldata": bytes.fromhex(
452-
opportunity.target_calldata.replace("0x", "")
453-
),
454-
"targetCallValue": opportunity.target_call_value,
455-
"bidAmount": bid_amount,
456-
},
457-
"signer": executor,
458-
"deadline": valid_until,
432+
"sellTokens": [
433+
{
434+
"token": token.token,
435+
"amount": int(token.amount),
436+
}
437+
for token in opportunity.sell_tokens
438+
],
439+
"buyTokens": [
440+
{
441+
"token": token.token,
442+
"amount": int(token.amount),
443+
}
444+
for token in opportunity.buy_tokens
445+
],
446+
"executor": executor,
447+
"targetContract": opportunity.target_contract,
448+
"targetCalldata": bytes.fromhex(opportunity.target_calldata.replace("0x", "")),
449+
"targetCallValue": opportunity.target_call_value,
450+
"validUntil": valid_until,
451+
"bidAmount": bid_amount,
459452
}
460453

461454
signed_typed_data = Account.sign_typed_data(

0 commit comments

Comments
 (0)