@alchemy/smart-accounts 5.0.0-beta.24 → 5.0.0-beta.26
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 +43 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,49 @@ Viem-compatible smart account implementations for Alchemy's smart contract accou
|
|
|
10
10
|
npm install @alchemy/smart-accounts @alchemy/common viem
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Example Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createPublicClient } from "viem";
|
|
17
|
+
import {
|
|
18
|
+
createBundlerClient,
|
|
19
|
+
createPaymasterClient,
|
|
20
|
+
} from "viem/account-abstraction";
|
|
21
|
+
import { sepolia } from "viem/chains";
|
|
22
|
+
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
|
|
23
|
+
import { alchemyTransport } from "@alchemy/common";
|
|
24
|
+
import { estimateFeesPerGas } from "@alchemy/aa-infra";
|
|
25
|
+
import { toModularAccountV2 } from "@alchemy/smart-accounts";
|
|
26
|
+
|
|
27
|
+
const transport = alchemyTransport({ apiKey: "YOUR_API_KEY" });
|
|
28
|
+
|
|
29
|
+
// 1. Create a MAv2 smart account
|
|
30
|
+
const account = await toModularAccountV2({
|
|
31
|
+
client: createPublicClient({ chain: sepolia, transport }),
|
|
32
|
+
owner: privateKeyToAccount(generatePrivateKey()),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 2. Create a bundler client with the account
|
|
36
|
+
const bundlerClient = createBundlerClient({
|
|
37
|
+
account,
|
|
38
|
+
chain: sepolia,
|
|
39
|
+
transport,
|
|
40
|
+
userOperation: {
|
|
41
|
+
estimateFeesPerGas,
|
|
42
|
+
},
|
|
43
|
+
// Optional: sponsor gas with a paymaster
|
|
44
|
+
paymaster: createPaymasterClient({ transport }),
|
|
45
|
+
paymasterContext: { policyId: "YOUR_POLICY_ID" },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// 3. Send a user operation
|
|
49
|
+
const hash = await bundlerClient.sendUserOperation({
|
|
50
|
+
calls: [{ to: "0x...", value: 0n, data: "0x" }],
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const receipt = await bundlerClient.waitForUserOperationReceipt({ hash });
|
|
54
|
+
```
|
|
55
|
+
|
|
13
56
|
## Key Exports
|
|
14
57
|
|
|
15
58
|
### LightAccount
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "5.0.0-beta.
|
|
1
|
+
export declare const VERSION = "5.0.0-beta.25";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.25\";\n"]}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "5.0.0-beta.
|
|
1
|
+
export declare const VERSION = "5.0.0-beta.25";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/smart-accounts",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.26",
|
|
4
4
|
"description": "This package contains all of the viem interfaces for Alchemy's Smart Contract Accounts",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"test:run": "vitest run"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@alchemy/aa-infra": "5.0.0-beta.
|
|
42
|
+
"@alchemy/aa-infra": "5.0.0-beta.26",
|
|
43
43
|
"typescript-template": "workspace:*",
|
|
44
44
|
"viem": "^2.45.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@alchemy/common": "5.0.0-beta.
|
|
47
|
+
"@alchemy/common": "5.0.0-beta.26"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"viem": "^2.45.0"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "f250979fa0141a06cd343c36d129c3faf838a9be"
|
|
65
65
|
}
|
package/src/version.ts
CHANGED