You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-39Lines changed: 63 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# Variance SDK
2
2
3
-
Variance is a Dart SDK designed to simplify interaction with Ethereum-based blockchains and enables flutter developers to implement account abstraction with minimal efforts. It provides functionalities such as encoding and decoding ABI data, handling Ethereum transactions, working with ERC20 and ERC721 tokens, and managing Ethereum smart accounts.
3
+
Variance is an Account Abstraction Developer toolkit that is designed to simplify the development of Ethereum smart accounts and Entrypoint interactions. It relies on the [Web3dart](https://pub.dev/packages/web3dart) library.
4
4
5
5
## Features
6
6
7
7
-**ABI Encoding/Decoding:** Easily encode and decode ABI data for Ethereum smart contract and Entrypoint interactions.
8
8
-**Transaction Handling:** Simplify the process of creating and sending UserOperations.
9
9
-**Token Operations:** Work with ERC20 and ERC721 tokens, including transfer and approval functionalities.
10
-
-**Web3 Functionality:** Interact with Ethereum nodes and bundlers using abstracted methods over, `eth_sendTransaction`, and `eth_sendUserOperation`.
11
-
-**SecP256r1 Signatures:** Sign transactions with SecP256r1 signatures.
10
+
-**Web3 Functionality:** Interact with Ethereum nodes and bundlers.
11
+
-**SecP256r1 Signatures:** Sign transactions with Passkeys.
12
12
13
13
## Getting Started
14
14
@@ -19,50 +19,45 @@ open your terminal and run the following command:
> There are 8 available networks: ethereum, polygon, optimism, base, arbitrumOne, linea, opBnB and scroll. 3 available testnets: sepolia, mumbai and baseTestent. You can also develop on localHost.
46
+
> For Safe Accounts, use `Constants.safeProxyFactoryAddress` as the account factory.
47
+
> There are 8 available networks: ethereum, polygon, optimism, base, arbitrum, linea, fuse and scroll. 2 available testnets: sepolia and baseTestent.
51
48
52
-
Additionally, you can specify a different Entrypoint address. By default, the entrypoin v0.6 is used.
49
+
Additionally, you can specify a different Entrypoint address. By default, the entrypoin v0.7 is used. If you wish to use v0.6, you can do so as follows:
53
50
54
51
```dart
55
-
final EntryPointAddress entrypointAddress = EntryPointAddress.v07;
52
+
final EntryPointAddress entrypointAddress = EntryPointAddress.v06;
56
53
chain.entrypoint = entrypointAddress;
57
-
```
58
54
59
-
Also if wish to use paymasters with your smart wallet you can do so by specifying the endpoint of the paymaster. By default the paymaster is set to null. This would add a paymaster Plugin to the smart wallet.
60
-
61
-
```dart
62
-
final String paymasterUrl = 'https://api.pimlico.io/v2/84532/rpc?apikey=...';
63
-
chain.paymasterUrl = paymasterUrl;
55
+
// OR append it to the chain
56
+
..entrypoint = EntryPointAddress.v06;
64
57
```
65
58
59
+
> By default the paymaster is set to null. If wish to use paymasters with your smart wallet you can do so by specifying the rpc endpoint of the paymaster. This would add a paymaster Plugin to the smart wallet.
60
+
66
61
If you have additional context for the paymaster, you will be able to add it to the smart wallet after creation or before initiating a transaction.
67
62
68
63
```dart
@@ -75,10 +70,18 @@ In order to create a smart wallet client you need to set up a signer, which will
75
70
76
71
> You have to use the correct signer for the type of account you want to create.
77
72
78
-
1.`PrivateKeys` - use with light accounts and safe accounts only
79
-
2.`Passkey` - use with p256 smart accounts and safe Passkey accounts only
80
-
3.`EOA Wallet (Seed Phrases)` - use with light smart accounts and safe accounts only
81
-
4.`HardWare Signers (Secure Enclave/Keystore)` - use with p256 smart accounts only
73
+
1.`PrivateKeys` - use with light accounts and safe accounts
74
+
2.`Passkey` - use with safe Passkey accounts only
75
+
3.`EOA Wallet` - use with light smart accounts and safe accounts
76
+
77
+
For more information, please check out the [web3signers](https://pub.dev/packages/web3_signers) package documentation.
78
+
79
+
##### **What is the difference between `PrivateKeys` and `EOA Wallet`?**
80
+
81
+
- The `PrivateKey` signer generates only a single private key for use with a smart account. The private key requires a password, and the private key can be serialized into JSON format for storage.
82
+
- The `EOA Wallet` signer generates a HD wallet with multiple accounts for use with a smart account. Additionally the `EOA Wallet` signer allows the smart account to sign transactions with different accounts by specifying the account index.
83
+
84
+
>With `EOA Wallet` signer, users receive the mnemonic phrase but with `PrivateKey` signer they dont.
82
85
83
86
### Smart Wallet Factory
84
87
@@ -90,36 +93,57 @@ final SmartWalletFactory smartWalletFactory = SmartWalletFactory(chain, signer);
90
93
91
94
#### To Create an Alchemy Light Account
92
95
96
+
The [Alchemy Light Account](https://accountkit.alchemy.com/smart-contracts/light-account) requires the signer to have a prefix. When creating a web3_signer for your smart wallet make sure to provide a `Uint8` value prefix. This will be appended to the signature generated by the signers.
#### To create a [Safe](https://safe.global) Smart Account
136
+
> Your keypair must be a `PassKeyPair` object received when registering with your `PasskeySigner` signer.
137
+
> Keypair can serialized and stored by the app
138
+
139
+
Additionally, you can pass a `p256Verifier` address to the `createSafeAccountWithPasskey` method, by default the [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md) precompile is used.
114
140
115
141
```dart
116
-
final Smartwallet wallet = await smartWalletFactory
0 commit comments