forked from Abstract-Foundation/agw-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3e2ad8
commit 68fa560
Showing
5 changed files
with
1,490 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { createEmitter } from '@wagmi/core/internal'; | ||
import { EIP1193, type Wallet } from 'thirdweb/wallets'; | ||
import type { Chain } from 'viem/chains'; | ||
|
||
import { | ||
abstractWalletConnector, | ||
VALID_CHAINS, | ||
} 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 = (): Wallet => { | ||
const connector = abstractWalletConnector()({ | ||
chains: Object.values(VALID_CHAINS) as [Chain, ...Chain[]], | ||
emitter: createEmitter('xyz.abs'), | ||
}); | ||
return EIP1193.fromProvider({ | ||
provider: connector.getProvider, | ||
walletId: 'xyz.abs', | ||
}); | ||
}; | ||
|
||
export { abstractWallet }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { abstractWallet } from '../abstractWalletThirdweb.js'; |
Oops, something went wrong.