Skip to content

Commit

Permalink
feat: throw errors for unsupported wallet methods
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Oct 31, 2024
1 parent d6a48ff commit c01b931
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/kakarot/src/kakarot.ts
Original file line number Diff line number Diff line change
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 c01b931

Please sign in to comment.