@aastar/account 0.16.22 → 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.
@@ -1 +0,0 @@
1
- export {};
package/dist/eoa.test.js DELETED
@@ -1,31 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { createEOAWalletClient } from './eoa.js';
3
- import * as viem from 'viem';
4
- import { mainnet } from 'viem/chains';
5
- vi.mock('viem', async () => {
6
- const actual = await vi.importActual('viem');
7
- return {
8
- ...actual,
9
- createWalletClient: vi.fn(),
10
- };
11
- });
12
- describe('EOAWalletClient', () => {
13
- const MOCK_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
14
- const MOCK_ADDR = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
15
- it('should create and use EOA wallet client', async () => {
16
- const sendTransactionSpy = vi.fn().mockResolvedValue('0xhash');
17
- const mockViemClient = {
18
- sendTransaction: sendTransactionSpy,
19
- account: { address: MOCK_ADDR }
20
- };
21
- viem.createWalletClient.mockReturnValue(mockViemClient);
22
- const client = createEOAWalletClient(MOCK_KEY, mainnet);
23
- expect(client.getAddress()).toBe(MOCK_ADDR);
24
- const hash = await client.sendTransaction({ to: MOCK_ADDR, value: 100n });
25
- expect(hash).toBe('0xhash');
26
- expect(sendTransactionSpy).toHaveBeenCalledWith(expect.objectContaining({
27
- to: MOCK_ADDR,
28
- value: 100n
29
- }));
30
- });
31
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { packUserOpLimits, UserOpClient } from './index.js';
3
- describe('Account Utils', () => {
4
- it('should pack user op limits', () => {
5
- const packed = packUserOpLimits(100n, 200n);
6
- expect(packed).toBeDefined();
7
- expect(packed.length).toBe(66); // 0x + 64 chars
8
- });
9
- describe('UserOpClient', () => {
10
- const mockBundler = {
11
- request: vi.fn()
12
- };
13
- it('should estimate gas', async () => {
14
- mockBundler.request.mockResolvedValue({ preVerificationGas: 1000n });
15
- const res = await UserOpClient.estimateGas(mockBundler, {}, '0x1');
16
- expect(res.preVerificationGas).toBe(1000n);
17
- });
18
- it('should send user operation', async () => {
19
- mockBundler.request.mockResolvedValue('0xhash');
20
- const res = await UserOpClient.sendUserOp(mockBundler, {}, '0x1');
21
- expect(res).toBe('0xhash');
22
- });
23
- it('should get receipt', async () => {
24
- mockBundler.request.mockResolvedValue({ success: true });
25
- const res = await UserOpClient.getReceipt(mockBundler, '0xhash');
26
- expect(res.success).toBe(true);
27
- });
28
- });
29
- });