@aastar/account 0.16.23 → 0.17.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aastar/account",
3
- "version": "0.16.23",
3
+ "version": "0.17.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "viem": "2.43.3",
16
- "@aastar/core": "0.16.23"
16
+ "@aastar/core": "0.17.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "typescript": "5.7.2"
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { toSimpleSmartAccount } from './simple.js';
3
- describe('SimpleSmartAccount', () => {
4
- const MOCK_OWNER = {
5
- address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
6
- signMessage: vi.fn().mockResolvedValue('0xsignature'),
7
- signTypedData: vi.fn(),
8
- };
9
- const MOCK_FACTORY = '0x1111111111111111111111111111111111111111';
10
- const MOCK_SMART_ACCOUNT = '0x2222222222222222222222222222222222222222';
11
- const MOCK_EP = '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789';
12
- it('should create simple smart account wrapper', async () => {
13
- const mockClient = {
14
- readContract: vi.fn().mockResolvedValue(MOCK_SMART_ACCOUNT),
15
- chain: { id: 31337 }
16
- };
17
- const account = await toSimpleSmartAccount({
18
- client: mockClient,
19
- owner: MOCK_OWNER,
20
- factoryAddress: MOCK_FACTORY,
21
- entryPoint: { address: MOCK_EP, version: '0.6' }
22
- });
23
- expect(account.address).toBe(MOCK_SMART_ACCOUNT);
24
- expect(account.entryPoint).toBe(MOCK_EP);
25
- const initCode = await account.getInitCode();
26
- expect(initCode.startsWith(MOCK_FACTORY)).toBe(true);
27
- const dummy = await account.getDummySignature();
28
- expect(dummy).toBeDefined();
29
- });
30
- it('should sign user operation', async () => {
31
- const mockClient = {
32
- readContract: vi.fn().mockResolvedValue(MOCK_SMART_ACCOUNT),
33
- chain: { id: 31337 }
34
- };
35
- const account = await toSimpleSmartAccount({
36
- client: mockClient,
37
- owner: MOCK_OWNER,
38
- factoryAddress: MOCK_FACTORY,
39
- entryPoint: { address: MOCK_EP, version: '0.6' }
40
- });
41
- const userOp = {
42
- sender: MOCK_SMART_ACCOUNT,
43
- nonce: 0n,
44
- initCode: '0x',
45
- callData: '0x',
46
- accountGasLimits: '0x0000000000000000000000000000000000000000000000000000000000000000',
47
- preVerificationGas: 0n,
48
- gasFees: '0x0000000000000000000000000000000000000000000000000000000000000000',
49
- paymasterAndData: '0x'
50
- };
51
- const sig = await account.signUserOperation(userOp);
52
- expect(sig).toBe('0xsignature');
53
- expect(MOCK_OWNER.signMessage).toHaveBeenCalled();
54
- });
55
- it('should sign message and typed data', async () => {
56
- const mockClient = { readContract: vi.fn().mockResolvedValue(MOCK_SMART_ACCOUNT) };
57
- const account = await toSimpleSmartAccount({
58
- client: mockClient,
59
- owner: MOCK_OWNER,
60
- factoryAddress: MOCK_FACTORY,
61
- entryPoint: { address: MOCK_EP, version: '0.6' }
62
- });
63
- await account.signMessage({ message: 'hello' });
64
- expect(MOCK_OWNER.signMessage).toHaveBeenCalled();
65
- await account.signTypedData({});
66
- expect(MOCK_OWNER.signTypedData).toHaveBeenCalled();
67
- });
68
- it('should throw on signTransaction', async () => {
69
- const mockClient = { readContract: vi.fn().mockResolvedValue(MOCK_SMART_ACCOUNT) };
70
- const account = await toSimpleSmartAccount({
71
- client: mockClient,
72
- owner: MOCK_OWNER,
73
- factoryAddress: MOCK_FACTORY,
74
- entryPoint: { address: MOCK_EP, version: '0.6' }
75
- });
76
- await expect(account.signTransaction({})).rejects.toThrow('UserOperations');
77
- });
78
- });