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" +} 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}`; };