Skip to content

Commit

Permalink
WT-1891 - cleaned up ReadyToConnect view and SDK (#1103)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrearampin authored Nov 1, 2023
1 parent 8a86a3c commit 7c029cd
Show file tree
Hide file tree
Showing 7 changed files with 264 additions and 230 deletions.
1 change: 0 additions & 1 deletion packages/checkout/sdk/src/Checkout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('Connect', () => {
});

expect(connectSite).toBeCalledTimes(1);
expect(getNetworkInfo).toBeCalledTimes(1);
});

it('should call getBalance when no contract address provided', async () => {
Expand Down
7 changes: 2 additions & 5 deletions packages/checkout/sdk/src/Checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,10 @@ export class Checkout {
params.provider,
{ allowUnsupportedProvider: true } as ValidateProviderOptions,
);

await connect.connectSite(web3Provider);
const networkInfo = await network.getNetworkInfo(this.config, web3Provider);

return {
provider: web3Provider,
network: networkInfo,
};
return { provider: web3Provider };
}

/**
Expand Down
3 changes: 0 additions & 3 deletions packages/checkout/sdk/src/types/connect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Web3Provider } from '@ethersproject/providers';
import { NetworkInfo } from './networkInfo';

/**
* Interface representing the params of {@link Checkout.connect}.
Expand All @@ -12,11 +11,9 @@ export interface ConnectParams {
/**
* Interface representing the result of {@link Checkout.connect}.
* @property {Web3Provider} provider - The provider used to connect to the network.
* @property {NetworkInfo} network - Information about the connected network.
*/
export interface ConnectResult {
provider: Web3Provider;
network: NetworkInfo;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ describe('ConnectLoader', () => {
provider,
getSigner: () => ({
getAddress: async () => Promise.resolve(''),
getChainId: async () => Promise.resolve(ChainId.IMTBL_ZKEVM_TESTNET),
}),
isMetaMask: true,
} as any as Web3Provider,
Expand Down
11 changes: 7 additions & 4 deletions packages/checkout/widgets-lib/src/lib/analytics/identifyUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ export async function identifyUser(
const walletAddress = (await provider.getSigner().getAddress()).toLowerCase();
const isMetaMask = isMetaMaskProvider(provider);
const isPassport = isPassportProvider(provider);
identify(walletAddress, {
isMetaMask,
isPassportWallet: isPassport,
});
try {
identify(walletAddress, {
isMetaMask,
isPassportWallet: isPassport,
});
// eslint-disable-next-line no-console
} catch (error: any) { console.error('analytics: unable to identify user: ', error); }
}
Loading

0 comments on commit 7c029cd

Please sign in to comment.