Skip to content

Commit 7c029cd

Browse files
authored
WT-1891 - cleaned up ReadyToConnect view and SDK (#1103)
1 parent 8a86a3c commit 7c029cd

File tree

7 files changed

+264
-230
lines changed

7 files changed

+264
-230
lines changed

packages/checkout/sdk/src/Checkout.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ describe('Connect', () => {
101101
});
102102

103103
expect(connectSite).toBeCalledTimes(1);
104-
expect(getNetworkInfo).toBeCalledTimes(1);
105104
});
106105

107106
it('should call getBalance when no contract address provided', async () => {

packages/checkout/sdk/src/Checkout.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,10 @@ export class Checkout {
134134
params.provider,
135135
{ allowUnsupportedProvider: true } as ValidateProviderOptions,
136136
);
137+
137138
await connect.connectSite(web3Provider);
138-
const networkInfo = await network.getNetworkInfo(this.config, web3Provider);
139139

140-
return {
141-
provider: web3Provider,
142-
network: networkInfo,
143-
};
140+
return { provider: web3Provider };
144141
}
145142

146143
/**

packages/checkout/sdk/src/types/connect.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Web3Provider } from '@ethersproject/providers';
2-
import { NetworkInfo } from './networkInfo';
32

43
/**
54
* Interface representing the params of {@link Checkout.connect}.
@@ -12,11 +11,9 @@ export interface ConnectParams {
1211
/**
1312
* Interface representing the result of {@link Checkout.connect}.
1413
* @property {Web3Provider} provider - The provider used to connect to the network.
15-
* @property {NetworkInfo} network - Information about the connected network.
1614
*/
1715
export interface ConnectResult {
1816
provider: Web3Provider;
19-
network: NetworkInfo;
2017
}
2118

2219
/**

packages/checkout/widgets-lib/src/components/ConnectLoader/ConnectLoader.cy.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ describe('ConnectLoader', () => {
150150
provider,
151151
getSigner: () => ({
152152
getAddress: async () => Promise.resolve(''),
153+
getChainId: async () => Promise.resolve(ChainId.IMTBL_ZKEVM_TESTNET),
153154
}),
154155
isMetaMask: true,
155156
} as any as Web3Provider,

packages/checkout/widgets-lib/src/lib/analytics/identifyUser.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ export async function identifyUser(
1414
const walletAddress = (await provider.getSigner().getAddress()).toLowerCase();
1515
const isMetaMask = isMetaMaskProvider(provider);
1616
const isPassport = isPassportProvider(provider);
17-
identify(walletAddress, {
18-
isMetaMask,
19-
isPassportWallet: isPassport,
20-
});
17+
try {
18+
identify(walletAddress, {
19+
isMetaMask,
20+
isPassportWallet: isPassport,
21+
});
22+
// eslint-disable-next-line no-console
23+
} catch (error: any) { console.error('analytics: unable to identify user: ', error); }
2124
}

0 commit comments

Comments
 (0)