Skip to content

Commit

Permalink
Merge pull request #22 from vaariance/feat/light-account
Browse files Browse the repository at this point in the history
replace simple account with alchemy light account
  • Loading branch information
code-z2 authored Oct 11, 2024
2 parents 73f2b78 + 7021028 commit 1bb53b2
Show file tree
Hide file tree
Showing 26 changed files with 985 additions and 603 deletions.
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

0 comments on commit 1bb53b2

Please sign in to comment.