Skip to content

Commit 47a3019

Browse files
authored
Merge pull request #8 from magiclabs/sync-bcnmy
Sync bcnmy
2 parents 3948687 + 94ce18f commit 47a3019

File tree

267 files changed

+18972
-9441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+18972
-9441
lines changed

β€Ž.cursorrulesβ€Ž

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Ignore node_modules
2+
node_modules/
3+
4+
# Ignore build artifacts
5+
dist/
6+
build/
7+
8+
# Ignore large data files
9+
*.csv
10+
*.json
11+
.data
12+
13+
# Include specific directories that might otherwise be excluded
14+
!src/important-directory/

β€Ž.env.exampleβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PRIVATE_KEY=
2+
PRIVATE_KEY_TWO=
23
TESTNET_CHAIN_ID=84532
34
MAINNET_CHAIN_ID=10
45
RPC_URL=
@@ -9,4 +10,7 @@ PIMLICO_API_KEY=
910
TENDERLY_API_KEY=
1011
TENDERLY_ACCOUNT_SLUG=
1112
TENDERLY_PROJECT_SLUG=
12-
RUN_PAID_TESTS=false
13+
RUN_PAID_TESTS=false
14+
ALCHEMY_API_KEY=
15+
STAGING=false
16+
INFURA_KEY=

β€Ž.github/workflows/funded-tests.ymlβ€Ž

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,37 @@ jobs:
2222
uses: ./.github/actions/install-dependencies
2323

2424
- name: Fund Nexus
25-
run: bun run fund:nexus
25+
run: bun run fund:nexus 84532 10
2626
env:
2727
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
28+
PRIVATE_KEY_TWO: ${{ secrets.PRIVATE_KEY_TWO }}
29+
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
30+
INFURA_KEY: ${{ secrets.INFURA_KEY }}
2831
TESTNET_CHAIN_ID: 84532
2932
MAINNET_CHAIN_ID: 10
3033

3134
- name: Run the tests
32-
run: bun run test
35+
run: bun run coverage --bail=1
3336
env:
3437
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
38+
PRIVATE_KEY_TWO: ${{ secrets.PRIVATE_KEY_TWO }}
3539
PIMLICO_API_KEY: ${{ secrets.PIMLICO_API_KEY }}
3640
PAYMASTER_URL: ${{ secrets.PAYMASTER_URL }}
3741
BUNDLER_URL: ${{ secrets.BUNDLER_URL }}
42+
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
43+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
44+
INFURA_KEY: ${{ secrets.INFURA_KEY }}
3845
TESTNET_CHAIN_ID: 84532
3946
MAINNET_CHAIN_ID: 10
4047
RUN_PAID_TESTS: true
4148
CI: true
49+
STAGING: false
50+
51+
- name: Upload coverage reports to Codecov
52+
uses: codecov/codecov-action@v5
53+
with:
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
56+
57+
4258

β€Ž.github/workflows/playground.ymlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
env:
2323
RUN_PLAYGROUND: true
2424
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
25+
PRIVATE_KEY_TWO: ${{ secrets.PRIVATE_KEY_TWO }}
2526
BUNDLER_URL: ${{ secrets.BUNDLER_URL }}
2627
TESTNET_CHAIN_ID: 84532
2728
CI: true

β€Ž.github/workflows/unit-tests.ymlβ€Ž

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,27 @@ jobs:
2222
uses: ./.github/actions/install-dependencies
2323

2424
- name: Fund Nexus
25-
run: bun run fund:nexus
25+
run: bun run fund:nexus 84532 10
2626
env:
2727
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
28+
PRIVATE_KEY_TWO: ${{ secrets.PRIVATE_KEY_TWO }}
29+
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
30+
INFURA_KEY: ${{ secrets.INFURA_KEY }}
2831
TESTNET_CHAIN_ID: 84532
2932
MAINNET_CHAIN_ID: 10
3033

3134
- name: Run the tests
32-
run: bun run test
35+
run: bun run test --bail=1
3336
env:
3437
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
38+
PRIVATE_KEY_TWO: ${{ secrets.PRIVATE_KEY_TWO }}
3539
PIMLICO_API_KEY: ${{ secrets.PIMLICO_API_KEY }}
3640
PAYMASTER_URL: ${{ secrets.PAYMASTER_URL }}
3741
BUNDLER_URL: ${{ secrets.BUNDLER_URL }}
42+
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
43+
INFURA_KEY: ${{ secrets.INFURA_KEY }}
3844
TESTNET_CHAIN_ID: 84532
3945
MAINNET_CHAIN_ID: 10
46+
RUN_PAID_TESTS: false
4047
CI: true
48+
STAGING: false

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,154 @@
11
# @biconomy/abstractjs
22

3+
## 1.0.3
4+
5+
### Patch Changes
6+
7+
- 7702 support
8+
9+
## 1.0.2
10+
11+
### Patch Changes
12+
13+
- Raw call data
14+
15+
## 1.0.1
16+
17+
### Patch Changes
18+
19+
- - Added callData helper for composability
20+
- Improved error reporting during tests
21+
- Fix 6492 signature verification
22+
23+
## 1.0.0
24+
25+
### Minor Changes
26+
27+
#### Breaking Changes
28+
29+
- Added composability module by default resulting in a change of address for all users of latest SDK
30+
- Renamed `getDefaultFactoryData` to `getFactoryData` for more generic module support
31+
- Renamed `getDefaultNexusAddress` to `getlNexusAccount` to reflect universal module initialization
32+
- Updated module initialization structure to support any validator type extending BaseModule
33+
- Changed module configuration format to require explicit type declarations
34+
35+
#### Features
36+
37+
- Added universal module initialization support for Nexus accounts
38+
- Same account for both mee and 4337 flows
39+
- Introduced flexible module configuration system allowing extended properties
40+
- Added support for custom bootstrap addresses during account initialization
41+
- Implemented smart session helpers for improved session management
42+
- Added new utility functions `toInitData` and `toInstallData` for standardized module formatting
43+
- Added composability module for multi-transaction batching in a single userOp
44+
- Added support for Nexus v1.2.0 with improved composability features
45+
- Added custom gas limits for composability calls
46+
- Added EIP-6492 compatibility for account signatures
47+
- Integrated userOp status reporting and receipt tracking
48+
49+
#### Improvements
50+
51+
- Enable mode for smart sessions by default
52+
- Streamlined factory data and counterfactual address calculations
53+
- Enhanced type safety for module configurations
54+
- Improved error handling for module initialization
55+
- Reduced bundle size through code optimization (-5.45% ESM, -7.42% CJS)
56+
- Added comprehensive test coverage for new module initialization flows
57+
- Improved status reporting for userOps
58+
- Fixed initCode computation for accurate counterfactual address generation
59+
- Enhanced batch builder with better composability checks
60+
61+
## 0.3.0
62+
63+
### Minor Changes
64+
65+
- Change attester address for Mee users. Results in change in MEE users' addresses
66+
67+
## 0.2.1
68+
69+
### Patch Changes
70+
71+
- Added an additional configuration to version config to cater for accounts < 0.0.34
72+
- Added an upgradeSmartAccount decorator to the smart account client
73+
- Added a new test for the upgradeSmartAccount decorator
74+
75+
## 0.2.0
76+
77+
### Minor Changes
78+
79+
- Update K1_VALIDATOR_FACTORY_ADDRESS address, resulting in changed default addresses for users
80+
81+
## 0.1.1
82+
83+
### Patch Changes
84+
85+
- Added GasBuffer option to increase gasValues returned from the bundler prior to sending the userOp
86+
87+
## 0.1.0
88+
89+
### Minor Changes
90+
91+
- Update BICONOMY_ATTESTER address, resulting in changed default addresses for users
92+
93+
## 0.0.41
94+
95+
### Patch Changes
96+
97+
- Improved batching logic
98+
- Added mcWeth
99+
- Fixed getAccountMeta helper
100+
- Fixed EIP712Sign logic after EIP 7779 changes
101+
- Added tests for installing & uninstalling smart sessions
102+
103+
## 0.0.40
104+
105+
### Patch Changes
106+
107+
- Fixed mee signer issues with metamask
108+
- Added export for UniswapSwapRouterAbi
109+
- Introduced optimistic mode parameter for across relayer
110+
- Made interfacing with multichain contracts consitent while building instructions
111+
- Added getSupertransactionReceipt helper
112+
- Added buildBatch instruction helper
113+
114+
## 0.0.39
115+
116+
### Patch Changes
117+
118+
- Nexus init using custom validator
119+
- BREAKING: `getMeeFactoryData` helper now renamed to `getDefaultFactoryData`
120+
- BREAKING: `getMeeNexusAddress` helper now renamed to `getNexusAddress`
121+
- Moved useTestBundler datapoint to the bundler client instead of the account & renamed to 'mock'.
122+
- Use pimlico gasEstimates if string 'pimlico' is in the bundlerUrl
123+
- Added confirmations: 2 to waitForUserOperationReceipt in signOnChainQuote helper to avoid race condition
124+
- Changed threshold :bigint to :number in getOwnableValidator helper
125+
126+
## 0.0.38
127+
128+
### Patch Changes
129+
130+
- Added Fusion support
131+
- BREAKING: `createSmartAccountClient` now requires an explicit account instance instead of account parameters
132+
- BREAKING: Removed `executeSignedFusionQuote` helper
133+
- BREAKING: `toMultichainNexusAccount` now requires an explicit `transports` parameter, to encourate the use of paid RPCs
134+
- Made `createSmartAccountClient` an alias of `createBicoBundlerClient`
135+
- Added / modified MEE client methods:
136+
- getFusionQuote
137+
- executeFusionQuote
138+
- signFusionQuote
139+
- Additional transaction types:
140+
- Transfer
141+
- TransferFrom
142+
- Approve
143+
- Withdrawal
144+
145+
## 0.0.37
146+
147+
### Patch Changes
148+
149+
- MeeNode info validation
150+
- Ownables fix for moduleInitArgs
151+
3152
## 0.0.36
4153

5154
### Patch Changes
@@ -48,7 +197,7 @@
48197

49198
- AbstractJS rebrand
50199
- meeNode support
51-
- useTestBundler
200+
- mock
52201

53202
## 0.0.28
54203

β€ŽCODE_OF_CONDUCT.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
3434

3535
## Enforcement
3636

37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected] or [email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
3838

3939
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other project leadership members.
4040

β€ŽLICENSEβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Biconomy
3+
Copyright (c) Biconomy
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

β€ŽREADME.mdβ€Ž

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
[![Biconomy](https://img.shields.io/badge/Made_with_%F0%9F%8D%8A_by-Biconomy-ff4e17?style=flat)](https://biconomy.io) [![License MIT](https://img.shields.io/badge/License-MIT-blue?&style=flat)](./LICENSE) [![codecov](https://codecov.io/github/bcnmy/abstractjs/graph/badge.svg?token=DTdIR5aBDA)](https://codecov.io/github/bcnmy/abstractjs)[![install size](https://packagephobia.com/badge?p=@biconomy/abstractjs)](https://packagephobia.com/result?p=@biconomy/abstractjs)
1+
[![Biconomy](https://img.shields.io/badge/Made_with_%F0%9F%8D%8A_by-Biconomy-ff4e17?style=flat)](https://biconomy.io)
2+
[![Build](https://github.com/bcnmy/abstractjs/actions/workflows/build.yml/badge.svg)](https://github.com/bcnmy/abstractjs/actions)
3+
[![License MIT](https://img.shields.io/badge/License-MIT-blue?&style=flat)](./LICENSE)
4+
[![codecov](https://codecov.io/github/bcnmy/abstractjs/graph/badge.svg?token=DTdIR5aBDA)](https://codecov.io/github/bcnmy/abstractjs)
5+
[![install size](https://packagephobia.com/badge?p=@biconomy/abstractjs)](https://packagephobia.com/result?p=@biconomy/abstractjs)
26

37
# abstractjs πŸš€
48

@@ -12,14 +16,12 @@ The Biconomy SDK is your all-in-one toolkit for building decentralized applicati
1216

1317
- [πŸ“š Table of Contents](#-table-of-contents)
1418
- [πŸ› οΈ Quickstart](#-quickstart)
15-
16-
- [Prerequisites](#prerequisites)
1719
- [Installation](#installation)
18-
20+
- [Testing](#testing)
1921
- [πŸ“„ Documentation and Resources](#-documentation-and-resources)
2022
- [πŸ’Ό Examples](#-examples)
2123
- [License](#license)
22-
- [Connect with Biconomy 🍊](#connect-with-biconomy-🍊)
24+
- [Connect with Biconomy 🍊](#connect-with-biconomy-)
2325

2426
## πŸ› οΈ Quickstart
2527

@@ -35,23 +37,24 @@ bun add @biconomy/abstractjs viem @rhinestone/module-sdk
3537
import { toMultichainNexusAccount, mcUSDC } from "@biconomy/abstractjs";
3638
import { base, optimism } from "viem/chains";
3739
import { privateKeyToAccount } from "viem/accounts";
38-
40+
import { http } from "viem";
3941
const eoaAccount = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`)
4042
const mcNexus = await toMultichainNexusAccount({
4143
chains: [base, optimism],
44+
transports: [http(), http()],
4245
signer: eoaAccount
4346
})
44-
const meeClient = createMeeClient({ account: mcNexus })
47+
const meeClient = await createMeeClient({ account: mcNexus })
4548

4649
const quote = await meeClient.getQuote({
4750
instructions: [{
4851
calls: [{ to: "0x...", value: 1n, gasLimit: 100000n }],
4952
chainId: base.id
5053
}],
51-
feeToken: toFeeToken({
52-
mcToken: mcUSDC,
54+
feeToken: {
55+
address: mcUSDC.addressOn(base.id),
5356
chainId: base.id
54-
})
57+
}
5558
})
5659

5760
// Execute the quote and get back a transaction hash
@@ -75,7 +78,7 @@ bun install --frozen-lockfile
7578
**Funding test accounts:**
7679

7780
```bash
78-
# Fund test PRIVATE_KEY account with native tokens and USDC
81+
# Fund test nexus accounts with native tokens and USDC, using a funded PRIVATE_KEY master account
7982
bun run fund:nexus
8083
```
8184

@@ -84,20 +87,19 @@ bun run fund:nexus
8487
# Run all tests
8588
bun run test
8689

87-
# Run tests for a specific subset of tests (by test description)
88-
bun run test -t=mee
89-
90+
# Run tests in watch mode for a specific subset of tests (by test description)
91+
bun run test:watch -t=mee
9092
```
9193

9294
For detailed information about the testing framework, network configurations, and debugging guidelines, please refer to our [Testing Documentation](./src/test/README.md).
9395

94-
## Documentation and Resources
96+
## πŸ“„ Documentation and Resources
9597

9698
For a comprehensive understanding of our project and to contribute effectively, please refer to the following resources:
9799

98100
- [**Biconomy Documentation**](https://docs.biconomy.io)
99101
- [**Biconomy Dashboard**](https://dashboard.biconomy.io)
100-
- [**API Documentation**](https://bcnmy.github.io/sdk)
102+
- [**API Documentation**](https://bcnmy.github.io/abstractjs)
101103
- [**Contributing Guidelines**](./CONTRIBUTING.md): Learn how to contribute to our project, from code contributions to documentation improvements.
102104
- [**Code of Conduct**](./CODE_OF_CONDUCT.md): Our commitment to fostering an open and welcoming environment.
103105
- [**Security Policy**](./SECURITY.md): Guidelines for reporting security vulnerabilities.
@@ -109,4 +111,4 @@ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) fil
109111

110112
## Connect with Biconomy 🍊
111113

112-
[![Website](https://img.shields.io/badge/🍊-Website-ff4e17?style=for-the-badge&logoColor=white)](https://biconomy.io) [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/biconomy) [![Twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/biconomy) [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/biconomy) [![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/biconomy) [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UC0CtA-Dw9yg-ENgav_VYjRw) [![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bcnmy/)
114+
[![Website](https://img.shields.io/badge/🍊-Website-ff4e17?style=for-the-badge&logoColor=white)](https://biconomy.io) [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/biconomy) [![Twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/biconomy) [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/biconomy) [![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/biconomy) [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UC0CtA-Dw9yg-ENgav_VYjRw) [![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bcnmy/)

β€Žbiome.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"javascript": {
4444
"formatter": {
4545
"semicolons": "asNeeded",
46-
"trailingComma": "none"
46+
"trailingCommas": "none"
4747
}
4848
}
4949
}

0 commit comments

Comments
Β (0)