Skip to content

Commit

Permalink
fix: kakarot connector (#528)
Browse files Browse the repository at this point in the history
- Fixes the address of the kakarot multicall precompile
- Unsupported wallet_* methods now throw an error instead of returning
false
  • Loading branch information
fracek authored Oct 31, 2024
2 parents cd858a2 + c01b931 commit 58e3e36
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: kakarot multicall precompile address",
"packageName": "@starknet-react/kakarot",
"email": "[email protected]",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion packages/kakarot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@starknet-react/kakarot",
"version": "3.0.5",
"version": "3.0.6",
"license": "MIT",
"repository": "apibara/starknet-react",
"homepage": "https://www.starknet-react.com/",
Expand Down
1 change: 1 addition & 0 deletions packages/kakarot/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { kakarotSepolia } from "./chains";
export { kakarotConnectors } from "./connectors";
export { KakarotConnector } from "./kakarot";
20 changes: 14 additions & 6 deletions packages/kakarot/src/kakarot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
getCorrespondingStarknetChain,
} from "./chains";

const MULTICALL_CAIRO_PRECOMPILE = "0x0000000000000000000000000000000000750003";
const MULTICALL_CAIRO_PRECOMPILE = "0x0000000000000000000000000000000000075003";

class ProviderNotFoundError extends Error {
constructor() {
Expand Down Expand Up @@ -369,19 +369,25 @@ export class KakarotConnector extends Connector {
return requestedAccounts.map((x: string) => getAddress(x));
}
case "wallet_addStarknetChain":
return false;
throw new Error(
"wallet_addStarknetChain not implemented for Kakarot connectors",
);
case "wallet_watchAsset":
return false;
throw new Error(
"wallet_watchAsset not implemented for Kakarot connectors",
);
case "wallet_switchStarknetChain": {
if (!params) throw new Error("Params are missing");

const { chainId } = params as SwitchStarknetChainParameters;

this.switchChain(BigInt(chainId));
await this.switchChain(BigInt(chainId));
return true;
}
case "wallet_addDeclareTransaction": {
return false;
throw new Error(
"wallet_addDeclareTransaction not implemented for Kakarot connectors",
);
}
case "wallet_addInvokeTransaction": {
if (!params) throw new Error("Params are missing");
Expand Down Expand Up @@ -421,7 +427,9 @@ export class KakarotConnector extends Connector {
// method: "eth_signTypedData_v4",
// params: [accounts[0], domain, message, primaryType, types],
// });
return false;
throw new Error(
"wallet_signTypedData not implemented for Kakarot connectors",
);
}
default:
throw new Error("Unknown request type");
Expand Down

0 comments on commit 58e3e36

Please sign in to comment.