abstractionkit 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -5
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,97 @@
|
|
|
1
1
|
<!-- PROJECT LOGO -->
|
|
2
|
-
|
|
3
2
|
<div align="center">
|
|
4
|
-
|
|
3
|
+
<img src="https://github.com/candidelabs/abstractionkit/assets/7014833/8f28ba83-003c-4ea9-b205-99f38819e09c">
|
|
5
4
|
</div>
|
|
6
5
|
|
|
7
6
|
<div align="center">
|
|
8
|
-
<
|
|
7
|
+
<h3 align="center">Supported by Safe Grants</h3>
|
|
9
8
|
</div>
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
A Typescript Library to easily build and send ERC-4337 UserOperations, with first class support for Safe Accounts.
|
|
11
|
+
|
|
12
|
+
Abstraction Kit is agnostic of:
|
|
13
|
+
- Ethereum **interface libraries**: ethers, web3.js, viem/wagmi
|
|
14
|
+
- **Bundler** implentation: Plug and play from any bundler provider
|
|
15
|
+
- **Paymaster**: use any 3rd party paymaster to sponsor gas, or build your own
|
|
16
|
+
- **Accounts**: Safe Account are supported, but you can use use Bundlers and Paymasters with your own accounts
|
|
17
|
+
|
|
18
|
+
## Docs
|
|
19
|
+
|
|
20
|
+
For full detailed documentation visit our [docs page](https://docs.candide.dev/wallet/abstractionkit/introduction).
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install abstractionkit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quickstart
|
|
29
|
+
|
|
30
|
+
### Smart Accounts
|
|
31
|
+
|
|
32
|
+
Abstraction Kit currently features the Candide Account, a compliant EIP-4337 smart contract account based on Safe v1.4.0 contracts.
|
|
33
|
+
|
|
34
|
+
In the next releases, it will feature Safe Accounts with the new architecture of Safe{Core}Protocol.
|
|
35
|
+
```typescript
|
|
36
|
+
import { CandideAccount } from "abstractionkit";
|
|
37
|
+
|
|
38
|
+
const smartAccount = new CandideAccount();
|
|
39
|
+
```
|
|
40
|
+
Then you can consume accout methods:
|
|
41
|
+
```typescript
|
|
42
|
+
import { Wallet } from "ethers";
|
|
43
|
+
|
|
44
|
+
const eoaSigner = new Wallet(privateKey);
|
|
45
|
+
const [newAccountAddress, initCode] = smartAccount.createNewAccount([
|
|
46
|
+
eoaSigner.address,
|
|
47
|
+
]);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Bundler
|
|
51
|
+
|
|
52
|
+
Initialize a Bundler with your desired bundler RPC url
|
|
53
|
+
```typescript
|
|
54
|
+
import { Bundler } from "abstractionkit";
|
|
55
|
+
|
|
56
|
+
const bundlerRPC = "https://sepolia.voltaire.candidewallet.com/rpc";
|
|
57
|
+
const entrypointAddress = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
|
|
58
|
+
|
|
59
|
+
const bundler: Bundler = new Bundler(bundlerRPC, entrypointAddress);
|
|
60
|
+
```
|
|
61
|
+
Then you can consume Bundler methods:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
const entrypointAddresses = await bundler.supportedEntryPoints();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Paymaster
|
|
68
|
+
Initialize a Paymaster with your RPC url
|
|
69
|
+
```typescript
|
|
70
|
+
import { CandideValidationPaymaster } from "abstractionkit";
|
|
71
|
+
|
|
72
|
+
const paymasterRpc = "https://api.candide.dev/paymaster/v1/$network/$apikey";
|
|
73
|
+
const entrypointAddress = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
|
|
74
|
+
|
|
75
|
+
const paymaster: CandideValidationPaymaster = new CandideValidationPaymaster(
|
|
76
|
+
entrypointAddress,
|
|
77
|
+
paymasterRPC
|
|
78
|
+
);
|
|
79
|
+
```
|
|
80
|
+
Then you can consume Paymaster methods:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const supportedGasTokens = await paymaster.getSupportedERC20Tokens();
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Guides
|
|
87
|
+
| Title | Description
|
|
88
|
+
| -----------------------------------------------------------------------------------------| -------------------------------------------------------------------------------- |
|
|
89
|
+
| [Send your first user operation](https://docs.candide.dev/wallet/guides/getting-started) | Learn how to create a smart wallet and to send your first user operation |
|
|
90
|
+
| [Send a Gasless Transaction](https://docs.candide.dev/wallet/guides/send-gasless-tx) | Learn how to send gasless transactions using a paymaster |
|
|
91
|
+
| [Pay Gas in ERC-20](https://docs.candide.dev/wallet/guides/pay-gas-in-erc20) | Learn how to offer the ability for users to pay gas in ERC-20s using a Paymaster |
|
|
12
92
|
|
|
13
|
-
|
|
93
|
+
## npm package
|
|
94
|
+
<a href="https://www.npmjs.com/package/abstractionkit">npm</a>
|
|
14
95
|
|
|
15
96
|
<!-- LICENSE -->
|
|
16
97
|
## License
|
package/dist/types.d.ts
CHANGED
|
@@ -61,11 +61,11 @@ export type UserOperationReceiptResult = {
|
|
|
61
61
|
};
|
|
62
62
|
export type PmSponsorUserOperationResult = {
|
|
63
63
|
paymasterAndData: BytesLike;
|
|
64
|
-
callGasLimit
|
|
65
|
-
preVerificationGas
|
|
66
|
-
verificationGasLimit
|
|
67
|
-
maxFeePerGas
|
|
68
|
-
maxPriorityFeePerGas
|
|
64
|
+
callGasLimit?: BigNumberish;
|
|
65
|
+
preVerificationGas?: BigNumberish;
|
|
66
|
+
verificationGasLimit?: BigNumberish;
|
|
67
|
+
maxFeePerGas?: BigNumberish;
|
|
68
|
+
maxPriorityFeePerGas?: BigNumberish;
|
|
69
69
|
};
|
|
70
70
|
export declare enum Operation {
|
|
71
71
|
Call = 0,
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAA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