Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace simple account with alchemy light account #22

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.1.3

* replace Simple account with Alchemy light account
* hardcoded safe proxy creation code to reduce network requests
* add light account abi and signature prefix
* separate constants from chains

## 0.1.2

* Update web3-signers
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ In order to create a smart wallet client you need to set up a signer, which will

> You have to use the correct signer for the type of account you want to create.

1. `PrivateKeys` - use with simple accounts and safe accounts only
1. `PrivateKeys` - use with light accounts and safe accounts only
2. `Passkey` - use with p256 smart accounts and safe Passkey accounts only
3. `EOA Wallet (Seed Phrases)` - use with simple smart accounts and safe accounts only
3. `EOA Wallet (Seed Phrases)` - use with light smart accounts and safe accounts only
4. `HardWare Signers (Secure Enclave/Keystore)` - use with p256 smart accounts only

### Smart Wallet Factory
Expand All @@ -88,11 +88,11 @@ The smart wallet factory handles the creation of smart wallet instances. Make su
final SmartWalletFactory smartWalletFactory = SmartWalletFactory(chain, signer);
```

#### To Create a Simple Smart Account
#### To Create an Alchemy Light Account

```dart
final Smartwallet wallet = await smartWalletFactory.createSimpleAccount(salt);
print("simple wallet address: ${wallet.address.hex}");
final Smartwallet wallet = await smartWalletFactory.createAlchemyLightAccount(salt);
print("light account wallet address: ${wallet.address.hex}");
```

#### To create a P256 Smart Account (Secure Enclave/Keystore)
Expand Down
6 changes: 3 additions & 3 deletions example/lib/providers/wallet_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class WalletProvider extends ChangeNotifier {
}

Future<void> createEOAWallet() async {
_chain.accountFactory = Constants.simpleAccountFactoryAddressv06;
_chain.accountFactory = Constants.lightAccountFactoryAddressv06;

final signer = EOAWallet.createWallet();
log("signer: ${signer.getAddress()}");
Expand All @@ -86,7 +86,7 @@ class WalletProvider extends ChangeNotifier {
.keccak256(EthereumAddress.fromHex(signer.getAddress()).addressBytes)));

try {
_wallet = await walletFactory.createSimpleAccount(salt);
_wallet = await walletFactory.createAlchemyLightAccount(salt);
log("wallet created ${_wallet?.address.hex} ");
} catch (e) {
_errorMessage = e.toString();
Expand All @@ -111,7 +111,7 @@ class WalletProvider extends ChangeNotifier {
log("pk salt: ${salt.toHex()}");

try {
_wallet = await walletFactory.createSimpleAccount(salt);
_wallet = await walletFactory.createAlchemyLightAccount(salt);
log("pk wallet created ${_wallet?.address.hex} ");
} catch (e) {
_errorMessage = e.toString();
Expand Down
Loading
Loading