Skip to content

Commit

Permalink
Fix admin impersonation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
wraitii committed Dec 12, 2023
1 parent 9295689 commit 800f73a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/chain/BlockchainProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import { logDebug } from '@/Messages';
import { ref, watchEffect } from 'vue';

import { Provider } from 'starknet';
import { RpcProvider } from 'starknet';
import { getBaseUrl } from '@/url';

import { CHAIN_NETWORKS, getCurrentNetwork } from './Network';
import { TEST_ENV, DEV, APP_ENV } from '@/Meta';

class BlockchainProvider {
provider: Provider | undefined;
provider: RpcProvider | undefined;

alive = true;

Expand Down Expand Up @@ -52,13 +52,13 @@ class BlockchainProvider {
}
}

export function getProviderForNetwork(network: CHAIN_NETWORKS): Provider {
export function getProviderForNetwork(network: CHAIN_NETWORKS): RpcProvider {
return {
'localhost': new Provider({ sequencer: { baseUrl: 'http://localhost:5050/' } }),
'starknet-testnet': new Provider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-testnet/rpc`, retries: 2 } }),
'starknet-testnet-dojo': new Provider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-testnet-dojo/rpc`, retries: 2 } }),
'starknet-mainnet': new Provider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-mainnet/rpc`, retries: 3 } }),
'starknet-mainnet-dojo': new Provider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-mainnet-dojo/rpc`, retries: 3 } }),
'localhost': new RpcProvider({ sequencer: { baseUrl: 'http://localhost:5050/' } }),
'starknet-testnet': new RpcProvider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-testnet/rpc`, retries: 2 } }),
'starknet-testnet-dojo': new RpcProvider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-testnet-dojo/rpc`, retries: 2 } }),
'starknet-mainnet': new RpcProvider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-mainnet/rpc`, retries: 3 } }),
'starknet-mainnet-dojo': new RpcProvider({ rpc: { nodeUrl: `${getBaseUrl()}/v1/node/starknet-mainnet-dojo/rpc`, retries: 3 } }),
}[network];
}

Expand Down
3 changes: 2 additions & 1 deletion src/chain/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export class WalletStore {
const chainId = this.signer?.chainId;
const obj = {
isConnected: true,
account: new starknet.Account(getProviderForNetwork('starknet-mainnet'), address, new starknet.Signer(null)),
account: new starknet.Account(getProviderForNetwork('starknet-mainnet-dojo'), address, ''),
chainId: 'SN_MAIN',
enable: () => Promise.resolve(),
on: () => {},
} as unknown as StarknetWindowObject;
Expand Down

0 comments on commit 800f73a

Please sign in to comment.