Skip to content

Commit

Permalink
changed wallet type to etherspot instead of etehrspot-prime
Browse files Browse the repository at this point in the history
  • Loading branch information
RanaBug committed Jun 18, 2024
1 parent 041206d commit b9d27cf
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Breaking Changes
- Etherspot Modular SDK implemented to Transaction Kit as the default `accountTemplate`
- The account template in the `EtherspotTransactionKit` component, can only be 'etherspot' if `moddular` is true.
- Changed the `etherspot-prime` wallet type to `etherpot` wallet type

## [0.12.1] - 2024-05-22

Expand Down
4 changes: 2 additions & 2 deletions __tests__/hooks/useWalletAddress.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('useWalletAddress()', () => {
);

const { result, rerender } = renderHook(({ providerType }) => useWalletAddress(providerType), {
initialProps: { providerType: 'etherspot-prime' },
initialProps: { providerType: 'etherspot' },
wrapper,
});

Expand All @@ -59,7 +59,7 @@ describe('useWalletAddress()', () => {
);

const { result, rerender } = renderHook(({ providerType }) => useWalletAddress(providerType), {
initialProps: { providerType: 'etherspot-prime' },
initialProps: { providerType: 'etherspot' },
wrapper,
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/EtherspotTokenTransferTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const EtherspotTokenTransferTransaction = ({
}: EtherspotTokenTransferTransactionProps): JSX.Element => {
const context = useContext(EtherspotBatchContext);
const componentId = useId();
const senderAddress = useWalletAddress('etherspot-prime', context?.chainId);
const senderAddress = useWalletAddress('etherspot', context?.chainId);

if (context === null) {
throw new Error('No parent <EtherspotBatch />');
Expand Down
2 changes: 1 addition & 1 deletion src/components/EtherspotTransactionKit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const EtherspotTransactionKit = ({
accountTemplate={accountTemp}
dataApiKey={dataApiKey}
bundlerApiKey={bundlerApiKey}
isModular={accountTemp === 'etherspotModular' && true}
isModular={accountTemp === 'etherspotModular'}
>
<EtherspotTransactionKitContextProvider>
<ProviderWalletContextProvider>
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useWalletAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useEtherspot from './useEtherspot';
* @param chainId {number} - Chain ID
* @returns {string | undefined} - wallet address by its type
*/
const useWalletAddress = (walletType: IWalletType = 'etherspot-prime', chainId?: number): string | undefined => {
const useWalletAddress = (walletType: IWalletType = 'etherspot', chainId?: number): string | undefined => {
const [accountAddress, setAccountAddress] = useState<(string | undefined)>(undefined);
const { getSdk, chainId: defaultChainId, provider } = useEtherspot();

Expand All @@ -37,15 +37,15 @@ const useWalletAddress = (walletType: IWalletType = 'etherspot-prime', chainId?:
// @ts-ignore
newAccountAddress = etherspotModularOrPrimeSdk?.etherspotWallet?.accountAddress;
} catch (e) {
console.warn(`Unable to get wallet address from SDK state for etherspot-prime type for chainId ID ${walletAddressChainId}.`, e);
console.warn(`Unable to get wallet address from SDK state for etherspot type for chainId ID ${walletAddressChainId}.`, e);
}

// if were unable to get wallet address from SDK state, try to get using getCounterFactualAddress
if (!newAccountAddress) {
try {
newAccountAddress = await etherspotModularOrPrimeSdk.getCounterFactualAddress();
} catch (e) {
console.warn(`Unable to get wallet address for etherspot-prime type for chainId ID ${walletAddressChainId}.`, e);
console.warn(`Unable to get wallet address for etherspot type for chainId ID ${walletAddressChainId}.`, e);
}
}

Expand All @@ -60,7 +60,7 @@ const useWalletAddress = (walletType: IWalletType = 'etherspot-prime', chainId?:
}, [getSdk, walletAddressChainId]);

return useMemo(() => {
if (walletType === 'etherspot-prime') {
if (walletType === 'etherspot') {
return accountAddress;
}

Expand Down
2 changes: 0 additions & 2 deletions src/providers/EtherspotContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ const EtherspotContextProvider = ({
}
}, []);

console.log('PROUT', accountTemplate)

const getSdk = useCallback(async (sdkChainId: number = chainId, forceNewInstance: boolean = false) => {
if (isModular) {

Expand Down
2 changes: 1 addition & 1 deletion src/types/EtherspotTransactionKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface IProviderWalletTransactionSent {
errorMessage?: string;
}

export type IWalletType = 'provider' | 'etherspot-prime';
export type IWalletType = 'provider' | 'etherspot';

type EtherspotPromiseOrValue<T> = T | Promise<T>;

Expand Down

0 comments on commit b9d27cf

Please sign in to comment.