@abstract-foundation/agw-react
Version:
Abstract Global Wallet React Components
31 lines • 1.05 kB
JavaScript
import { validChains } from '@abstract-foundation/agw-client';
import { createEmitter } from '@wagmi/core/internal';
import { EIP1193 } from 'thirdweb/wallets';
import { abstractWalletConnector } from './abstractWalletConnector.js';
/**
* Create a thirdweb wallet for Abstract Global Wallet
*
* @returns A wallet instance wrapping Abstract Global Wallet to be used with the thirdweb Connect SDK
*
* @example
* ```tsx
* import { createThirdwebClient } from "thirdweb";
* import { abstractWallet } from "@abstract-foundation/agw-react/thirdweb"
*
* const client = createThirdwebClient({ clientId });
*
* <ConnectButton client={client} wallets=[abstractWallet()]>
* ```
*/
const abstractWallet = () => {
const connector = abstractWalletConnector()({
chains: Object.values(validChains),
emitter: createEmitter('xyz.abs'),
});
return EIP1193.fromProvider({
provider: connector.getProvider,
walletId: 'xyz.abs',
});
};
export { abstractWallet };
//# sourceMappingURL=abstractWalletThirdweb.js.map