Skip to content

Commit

Permalink
chore: force cairo 0 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
khanti42 committed Jan 27, 2025
1 parent 5191871 commit 6c5bec9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 4 additions & 6 deletions packages/starknet-snap/src/wallet/account/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ export class AccountContractDiscovery {
this.network = network;
if (discoveryType !== undefined) {
switch (discoveryType) {
case AccountDiscoveryType.ForceCairo0:
this.contractCtors = [Cairo0Contract];
this.defaultContractCtor = Cairo0Contract;
break;
case AccountDiscoveryType.ForceCairo1:
this.contractCtors = [Cairo1Contract];
this.defaultContractCtor = Cairo1Contract;
break;
// We default te Cairo0 discovery
default:
this.contractCtors = [Cairo1Contract, Cairo0Contract];
this.defaultContractCtor = Cairo1Contract;
this.contractCtors = [Cairo0Contract];
this.defaultContractCtor = Cairo0Contract;
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ interface Props {
export const FrameworkView = ({ connected, children }: Props) => {
// Get the current `accountDiscovery` value from the URL
const urlParams = new URLSearchParams(window.location.search);
const accountDiscovery = urlParams.get('accountDiscovery');
const accountDiscovery = urlParams.get('accountDiscovery') ?? "FORCE_CAIRO_0";

const bannerMessage =
accountDiscovery === 'FORCE_CAIRO_1'
? 'This is a special version for recovering funds on a Cairo 1 account.'
: accountDiscovery === 'FORCE_CAIRO_0'
? 'This is a special version for recovering funds on a Cairo 0 account.'
: 'This is a special version of the dapp for account recovery purposes.';
: 'This is a special version for recovering funds on a Cairo 0 account.';

const handleAccountChange = (version: string) => {
// Update the URL without reloading the page
Expand All @@ -47,7 +45,7 @@ export const FrameworkView = ({ connected, children }: Props) => {
</ColMiddle>
<Banner>
<Typography variant="body1" sx={{ mb: 2 }}>
{bannerMessage}
{bannerMessage}, click <a target="_blank" href="https://github.com/Consensys/starknet-snap/blob/main/docs/tutorial-resolving-stuck-funds.md">here</a> to access the tutorial
</Typography>
<Stack
direction="row"
Expand Down

0 comments on commit 6c5bec9

Please sign in to comment.