UNPKG

@thirdweb-dev/wallets

Version:

<p align="center"> <br /> <a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/legacy_packages/sdk/logo.svg?raw=true" width="200" alt=""/></a> <br /> </p> <h1 align="center">thirdweb Wallet SDK</h1> <p align="center"> <a h

37 lines (34 loc) 1.57 kB
import { ethers } from 'ethers'; import { SmartWalletConnector } from '../../smart-wallet/dist/thirdweb-dev-wallets-evm-connectors-smart-wallet.esm.js'; import { E as ERC6551_REGISTRY } from '../../../../dist/utils-80af2010.esm.js'; import '../../../../dist/connector-20f7cf73.esm.js'; import 'eventemitter3'; import '../../../../dist/http-rpc-client-25e8ff7a.esm.js'; import '../../../../dist/url-0d129c6b.esm.js'; import '@thirdweb-dev/chains'; import '../../../../dist/headers-31b6ef3b.esm.js'; import '@account-abstraction/contracts'; import '../../../../dist/defineProperty-7303a112.esm.js'; import '@thirdweb-dev/sdk'; import '../../../wallets/abstract/dist/thirdweb-dev-wallets-evm-wallets-abstract.esm.js'; class TokenBoundSmartWalletConnector extends SmartWalletConnector { constructor(input) { super({ ...input, factoryAddress: input.registryAddress || ERC6551_REGISTRY }); this.tbaConfig = input; // TODO default account implementation address } defaultFactoryInfo() { return { createAccount: async factory => { return factory.prepare("createAccount", [this.tbaConfig.accountImplementation, this.chainId, this.tbaConfig.tokenContract, this.tbaConfig.tokenId, this.tbaConfig.salt, ethers.utils.toUtf8Bytes("")]); }, getAccountAddress: async factory => { return await factory.call("account", [this.tbaConfig.accountImplementation, this.chainId, this.tbaConfig.tokenContract, this.tbaConfig.tokenId, this.tbaConfig.salt]); } }; } } export { TokenBoundSmartWalletConnector };