Skip to content

Commit

Permalink
fixed accountTemplate type
Browse files Browse the repository at this point in the history
  • Loading branch information
poocart committed Oct 25, 2023
1 parent f38974e commit 2636226
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/components/EtherspotTransactionKit.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import React from 'react';
import { WalletProviderLike, Factory } from '@etherspot/prime-sdk';
import EtherspotContextProvider from '../providers/EtherspotContextProvider';

// types
import { AccountTemplate } from '../types/EtherspotTransactionKit';

// providers
import EtherspotTransactionKitContextProvider from '../providers/EtherspotTransactionKitContextProvider';
import ProviderWalletContextProvider from '../providers/ProviderWalletContextProvider';
import EtherspotContextProvider from '../providers/EtherspotContextProvider';

interface EtherspotTransactionKitProps extends React.PropsWithChildren {
provider: WalletProviderLike;
chainId?: number;
accountTemplate?: Factory;
accountTemplate?: AccountTemplate;
}

const EtherspotTransactionKit = ({
Expand Down
7 changes: 5 additions & 2 deletions src/providers/EtherspotContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import React, {
// contexts
import EtherspotContext from '../contexts/EtherspotContext';

// types
import { AccountTemplate } from '../types/EtherspotTransactionKit';

let sdkPerChain: { [chainId: number]: PrimeSdk } = {};

const EtherspotContextProvider = ({
Expand All @@ -26,7 +29,7 @@ const EtherspotContextProvider = ({
children: ReactNode;
provider: WalletProviderLike;
chainId: number;
accountTemplate: Factory;
accountTemplate: AccountTemplate;
}) => {
const context = useContext(EtherspotContext);

Expand All @@ -49,7 +52,7 @@ const EtherspotContextProvider = ({
const sdkForChain = new PrimeSdk(provider, {
chainId: sdkChainId,
projectKey: '__ETHERSPOT_PROJECT_KEY__' || undefined,
factoryWallet: accountTemplate,
factoryWallet: accountTemplate as Factory,
});

sdkPerChain = {
Expand Down
2 changes: 2 additions & 0 deletions src/types/EtherspotTransactionKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,5 @@ interface UserOp {
paymasterAndData: EtherspotPromiseOrValue<BytesLike>;
signature: EtherspotPromiseOrValue<BytesLike>;
}

export type AccountTemplate = 'etherspot' | 'zeroDev' | 'simpleAccount';

0 comments on commit 2636226

Please sign in to comment.