From b062bac5e77cd827d6059898cf5d9f8e6b74ff53 Mon Sep 17 00:00:00 2001 From: enitrat Date: Fri, 1 Nov 2024 12:21:43 +0700 Subject: [PATCH 1/2] fix: kakarot invokeTransaction returndata type & multicall evm encoding --- packages/kakarot/src/kakarot.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/kakarot/src/kakarot.ts b/packages/kakarot/src/kakarot.ts index 0921e6dd..77d22374 100644 --- a/packages/kakarot/src/kakarot.ts +++ b/packages/kakarot/src/kakarot.ts @@ -392,7 +392,7 @@ export class KakarotConnector extends Connector { case "wallet_addInvokeTransaction": { if (!params) throw new Error("Params are missing"); const { calls } = params as AddInvokeTransactionParameters; - return await provider.request({ + const transaction_hash = await provider.request({ method: "eth_sendTransaction", params: [ { @@ -402,6 +402,9 @@ export class KakarotConnector extends Connector { }, ], }); + return { + transaction_hash: transaction_hash, + }; } case "wallet_signTypedData": { if (!params) throw new Error("Params are missing"); @@ -575,7 +578,7 @@ export class KakarotConnector extends Connector { */ const prepareTransactionData = (calls: RequestCall[]) => { const encodedCalls = calls.map((call) => { - return encodeAbiParameters( + const encoded = encodeAbiParameters( [ { type: "uint256", name: "contractAddress" }, { type: "uint256", name: "selector" }, @@ -587,9 +590,10 @@ const prepareTransactionData = (calls: RequestCall[]) => { (call.calldata as string[]).map((data: string) => BigInt(data)), ], ); + return encoded.slice(2); // Remove the '0x' prefix from each encoded call }); const concatenatedCalls = encodedCalls.join(""); - const callCount = toHex(calls.length, { size: 32 }); - return `${callCount}${concatenatedCalls.slice(2)}` as `0x${string}`; + const callCount = toHex(calls.length, { size: 32 }).slice(2); // Remove the '0x' prefix from the call count + return `0x${callCount}${concatenatedCalls}` as `0x${string}`; }; From 23f109e32d07091993924f18a9253b12776c4319 Mon Sep 17 00:00:00 2001 From: enitrat Date: Fri, 1 Nov 2024 12:22:01 +0700 Subject: [PATCH 2/2] Change files --- ...react-kakarot-35774e84-0f76-4f61-996a-76eba0d19258.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@starknet-react-kakarot-35774e84-0f76-4f61-996a-76eba0d19258.json diff --git a/change/@starknet-react-kakarot-35774e84-0f76-4f61-996a-76eba0d19258.json b/change/@starknet-react-kakarot-35774e84-0f76-4f61-996a-76eba0d19258.json new file mode 100644 index 00000000..1ee0bfbc --- /dev/null +++ b/change/@starknet-react-kakarot-35774e84-0f76-4f61-996a-76eba0d19258.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: kakarot invokeTransaction returndata type & multicall evm encoding", + "packageName": "@starknet-react/kakarot", + "email": "msaug@protonmail.com", + "dependentChangeType": "patch" +}