Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/refactor, fix build, lint issues and tests. #40

Merged
merged 1,691 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1691 commits
Select commit Hold shift + click to select a range
2898811
Added fix for selected quote case ERC20 paymaster
GabiDev45 Jan 18, 2024
638daee
Merge branch 'v4' into feature/SMA-526_add-tsdoc
joepegler Jan 18, 2024
68cce44
Changed send user op approach in ERC20 paymaster test
GabiDev45 Jan 19, 2024
56424b5
Modify sendUserOp function description
GabiDev45 Jan 19, 2024
693bf08
Added throw instead of return user op
GabiDev45 Jan 19, 2024
25f77ee
continued
joepegler Jan 19, 2024
290cede
Fix branch for deployment of docs
joepegler Jan 19, 2024
fa09e4d
Removed try catch
GabiDev45 Jan 19, 2024
41a50c6
Added utility func to get balance in tests
GabiDev45 Jan 19, 2024
74d0432
Merge pull request #369 from bcnmy/feature/SMA-526_add-tsdoc
AmanRaj1608 Jan 21, 2024
f1185b4
Merge branch 'v4' of https://github.com/bcnmy/biconomy-client-sdk int…
GabiDev45 Jan 22, 2024
b1e5b5e
Removed unused value param from tx obj
GabiDev45 Jan 22, 2024
4a0597d
Merge pull request #371 from bcnmy/feat/SMA-540-check-paymaster-userop
livingrockrises Jan 22, 2024
8c8e983
Fix UserOpResponse wait confirmations
au2001 Jan 18, 2024
0670f1e
Merge pull request #374 from arl-sh/fixes/userop-response-wait
livingrockrises Jan 22, 2024
1d1f9da
Apply Signer Abstraction to modules (#375)
joepegler Jan 22, 2024
68a59d6
fix:circular_dependency
joepegler Jan 22, 2024
3ba9702
Merge pull request #376 from bcnmy/fix/circular_dep
livingrockrises Jan 22, 2024
5dce507
Resolved SM-547
joepegler Jan 22, 2024
965e44c
lint:fix
joepegler Jan 22, 2024
6735141
Merge pull request #378 from bcnmy/chore/SMA-547_move-common-code
AmanRaj1608 Jan 23, 2024
2a625cb
Removed lint-staged (#382)
VGabriel45 Jan 23, 2024
56c87c6
README tweaks (#377)
joepegler Jan 24, 2024
232472c
createSmartAccountClient (#385)
joepegler Jan 24, 2024
ff28ebd
Add paymasterAndData validation in e2e tests (#381)
VGabriel45 Jan 24, 2024
f56b4da
Use RpcUrl from provider (#379)
joepegler Jan 24, 2024
bb54888
Feat/sma 540 check paymaster userop (#384)
VGabriel45 Jan 25, 2024
c2100ee
update lockfile
livingrockrises Jan 25, 2024
9727fd5
Add ethersV6 compatibility (#387)
VGabriel45 Jan 25, 2024
741806d
Feat(SMA-559): Improved dx for erc20 paymaster calls (#388)
joepegler Jan 26, 2024
203391b
Added more tests and checks
GabiDev45 Jan 26, 2024
c5aa4f6
Except sessionStorageData folder from gitignore but not files (#389)
VGabriel45 Jan 26, 2024
efc811b
fixes in v4 for front end frameworks (#392)
livingrockrises Jan 30, 2024
25d2bee
Added simulationType flag (#390)
VGabriel45 Jan 30, 2024
d6205c4
Fix(SMA-574): ESM builds (#393)
joepegler Jan 30, 2024
20a4d57
Fix check for maxApproval in BiconomySmartAccountV2 (#395)
VGabriel45 Jan 31, 2024
99715b0
Bugfix/api error message (#396)
VGabriel45 Jan 31, 2024
5b86983
Change type: sessionSigner: SupportedSigner (#397)
joepegler Jan 31, 2024
dce4a0c
Fixed merkletreejs import (#400)
VGabriel45 Feb 1, 2024
8246483
Feat(SMA-579): Allow empty tokenInfo fields during getTokenFees (#399)
joepegler Feb 1, 2024
5d3af2e
yarn lock
livingrockrises Feb 1, 2024
08f83be
Feat(SMA-583): Update README.md with v4 examples (#405)
joepegler Feb 4, 2024
22d5de3
update lockfile
livingrockrises Feb 4, 2024
b905dcf
Added string as a supported Transaction value type (#404)
VGabriel45 Feb 4, 2024
ec36bc9
Added export for UserOpStatus type from /account (#403)
VGabriel45 Feb 4, 2024
4971287
Added needed exports from modules (#402)
VGabriel45 Feb 4, 2024
2ee540e
Added readme (#409)
VGabriel45 Feb 6, 2024
78db73e
Commented overrides and skipBundlerGasEstimation params (#407)
VGabriel45 Feb 6, 2024
8ce04a5
V4 with viem v2 (bump aa-core and viem) (#406)
livingrockrises Feb 6, 2024
2388003
Merge branch 'develop' into v4
joepegler Feb 6, 2024
8205a76
update lockfile
livingrockrises Feb 6, 2024
c56cd8b
Merge branch 'v4' of https://github.com/bcnmy/biconomy-client-sdk int…
livingrockrises Feb 6, 2024
9278ecc
Added a new param to sendRequest "service" (#412)
VGabriel45 Feb 8, 2024
80a90f1
Added changelog (#410)
joepegler Feb 8, 2024
ebff7e3
Make package exports consistent (#411)
joepegler Feb 9, 2024
3d86837
birth of V4 SDK (#401)
livingrockrises Feb 9, 2024
cfea08f
Merge branch 'v4' of https://github.com/bcnmy/biconomy-client-sdk int…
GabiDev45 Feb 9, 2024
af84712
Merged with v4
GabiDev45 Feb 9, 2024
7bb3813
Release 8 - Biconomy V4 SDK (#414)
livingrockrises Feb 12, 2024
db298a5
Replaced baseGoerli with baseSepolia (#415)
VGabriel45 Feb 12, 2024
b82c3e2
Merge branch 'develop' of https://github.com/bcnmy/biconomy-client-sd…
GabiDev45 Feb 12, 2024
1688f9d
Batched session router fix
GabiDev45 Feb 12, 2024
3c94de1
Added ethers defaultAbiCoder
GabiDev45 Feb 12, 2024
b27061e
Fix for encodeAbiParameters inside batched session module (#416)
VGabriel45 Feb 12, 2024
11a7e6e
Merge Develop to Main (#417)
livingrockrises Feb 12, 2024
4e0141c
Merge branch 'develop' of https://github.com/bcnmy/biconomy-client-sd…
GabiDev45 Feb 13, 2024
2eb9765
Batched session router testing
GabiDev45 Feb 13, 2024
536f099
Fixed logs
GabiDev45 Feb 13, 2024
da340fb
Get smart account balances
joepegler Feb 14, 2024
f8a1b2e
lint:fix
joepegler Feb 14, 2024
b7e0d98
fix comments
joepegler Feb 14, 2024
d8d2cb2
remove log
joepegler Feb 14, 2024
66eb3c4
fix build
joepegler Feb 14, 2024
8a7eb0d
continued
joepegler Feb 14, 2024
00ad1da
Fix tests (#422)
joepegler Feb 15, 2024
7374c79
Merge remote-tracking branch 'origin/develop' into feature/SMA-599_ba…
joepegler Feb 15, 2024
b66648e
Batched session router tests
GabiDev45 Feb 19, 2024
b2f2c33
Fix batched router test
GabiDev45 Feb 19, 2024
6541707
Test fixes
GabiDev45 Feb 19, 2024
2824a60
Merge branch 'develop' of https://github.com/bcnmy/biconomy-client-sd…
GabiDev45 Feb 20, 2024
bf11eff
Merge with develop
GabiDev45 Feb 20, 2024
74a24ab
Fixed broken tests
GabiDev45 Feb 20, 2024
15e8a6d
Delete packages/common/src/typechain directory
VGabriel45 Feb 21, 2024
fe73494
Resolve SMA-673
joepegler Feb 22, 2024
1a8f296
Chore(SMA-604): ecdsa tests (#418)
joepegler Feb 22, 2024
be0a8b6
Merge pull request #432 from bcnmy/hotfix/SMA-673_rpc_provider_cors
livingrockrises Feb 22, 2024
5fb3eed
Fix(SMA-677): Particle auth build broken
joepegler Feb 22, 2024
a619434
Increased test timeouts
GabiDev45 Feb 23, 2024
363fa3b
fix(SMA-682): docs-currently-are-down
joepegler Feb 23, 2024
b7d86d9
cont.
joepegler Feb 23, 2024
75c9548
Merge pull request #435 from bcnmy/fix/SMA-682_docs-fix
livingrockrises Feb 23, 2024
a480670
bump aa-core version
joepegler Feb 23, 2024
329003c
Merge branch 'develop' into DEVX-441/increase-test-coverage
livingrockrises Feb 25, 2024
acac619
update lockfile
livingrockrises Feb 25, 2024
70fbb34
Merge pull request #394 from bcnmy/DEVX-441/increase-test-coverage
livingrockrises Feb 25, 2024
d331bc5
Merge pull request #419 from bcnmy/bugfix/fix-log
livingrockrises Feb 25, 2024
20fd54c
Added StateOverrideSet parameter (#427)
VGabriel45 Feb 26, 2024
24b4c32
Merge pull request #433 from bcnmy/fix/SMA-677_particle-auth-build
livingrockrises Feb 26, 2024
4b8bae4
Feat(SMA-599): Get balances (#420)
joepegler Feb 26, 2024
e6cd7db
fix yarn
joepegler Feb 26, 2024
891dd98
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Feb 26, 2024
b689dc9
fix comment
joepegler Feb 26, 2024
8b9fb5d
Feat(SMA-663): Minimal Reproducible Example request (#426)
joepegler Feb 26, 2024
6d2fb27
Feat(SMA-597): Supported Tokens method (#425)
joepegler Feb 26, 2024
1949e68
rpcUrl as required and removed redundant code (#430)
VGabriel45 Feb 26, 2024
c411f55
Update changelogs
joepegler Feb 26, 2024
5264016
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Feb 26, 2024
66d5d56
Merge pull request #436 from bcnmy/hotfix/changelo_update
livingrockrises Feb 26, 2024
4bb17a7
default recipient
joepegler Feb 26, 2024
fa30abb
default with empty string
joepegler Feb 26, 2024
be9dc4d
Feat(SMA-670): SmartAccount deploy method (#429)
joepegler Feb 26, 2024
480e47f
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Feb 26, 2024
e74dbf4
Particle build revert
joepegler Feb 28, 2024
f316562
bump version
joepegler Feb 28, 2024
5a9c3b0
Merge pull request #438 from bcnmy/hotfix/particle-build-revert
livingrockrises Feb 28, 2024
5051ba5
Feat(SMA-675): Add optimism tests (#437)
joepegler Feb 29, 2024
7a2bd59
Merge branch 'develop' into feature/SMA-598_withdrawal
joepegler Mar 1, 2024
e4f067c
usdt fix
joepegler Mar 1, 2024
d2e8ee1
Fix: E2E tests (#440)
joepegler Mar 1, 2024
37ed719
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Mar 1, 2024
e2193ad
cont.
joepegler Mar 1, 2024
75698c8
added flag to skip calldata approval patch (#441)
livingrockrises Mar 4, 2024
2371b23
Remove extra call to Bundler for Sponsored User ops (#408)
livingrockrises Mar 4, 2024
01f4c4d
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Mar 4, 2024
de02980
reinclude publicClient
joepegler Mar 4, 2024
bc0c6da
fix/e2e_tests (#444)
joepegler Mar 4, 2024
eeb55fd
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Mar 4, 2024
8908d6a
feat: support custom chains (#443)
joepegler Mar 4, 2024
49c9682
Added ABI SVM test (#439)
VGabriel45 Mar 4, 2024
5d2f34d
Refactor to paymaster url & added check for chain ids + tests (#434)
VGabriel45 Mar 4, 2024
d27d84d
Improved balances (#445)
joepegler Mar 4, 2024
635db84
Back merge main branch (#446)
joepegler Mar 4, 2024
6874311
Changelog
joepegler Mar 4, 2024
4ddc6fe
Merge branch 'main' into chore/changelog
joepegler Mar 4, 2024
3c048c0
version bump
joepegler Mar 4, 2024
6df7c65
Merge pull request #448 from bcnmy/chore/changelog
livingrockrises Mar 4, 2024
99c65a5
Add getChain helper (#449)
joepegler Mar 5, 2024
466968d
Merge pull request #447 from bcnmy/develop
livingrockrises Mar 6, 2024
815e944
yml formatting
joepegler Mar 6, 2024
a8af7fd
merge develop
joepegler Mar 6, 2024
007b703
lint: fix
joepegler Mar 6, 2024
93186ad
Fix esm builds
joepegler Mar 7, 2024
345753c
Merge pull request #450 from bcnmy/hotfix/issue_report
livingrockrises Mar 7, 2024
04bc6c5
Merge pull request #451 from bcnmy/hotfix/esm_builld
livingrockrises Mar 7, 2024
d9b895b
Merge pull request #453 from bcnmy/hotfix/issue_report
livingrockrises Mar 8, 2024
af8b725
Merge pull request #452 from bcnmy/hotfix/esm_builld
livingrockrises Mar 8, 2024
f256712
Fix wrong falsy check for user op nonce (#455)
VGabriel45 Mar 13, 2024
4125973
update docs link
himanshugarg06 Mar 19, 2024
bab0818
Merge pull request #456 from bcnmy/update_docs
livingrockrises Apr 1, 2024
fd832fe
added 1271 support + tests
GabiDev45 Apr 3, 2024
28422f1
continued
joepegler Apr 3, 2024
7a93d87
Merge branch 'develop' into feature/SMA-598_withdrawal
joepegler Apr 3, 2024
079def2
lint:fix
joepegler Apr 3, 2024
eaef063
yarn lock
joepegler Apr 3, 2024
44d2529
fix comment
joepegler Apr 3, 2024
cb4b60a
fix comment
joepegler Apr 3, 2024
f963c10
renamed test and remove redundant variable
GabiDev45 Apr 3, 2024
55a12d4
Merge pull request #457 from bcnmy/feat/1271-integration
VGabriel45 Apr 4, 2024
050d542
Merge remote-tracking branch 'origin/develop' into feature/SMA-598_wi…
joepegler Apr 5, 2024
f7e5420
Merge pull request #424 from bcnmy/feature/SMA-598_withdrawal
livingrockrises Apr 10, 2024
7c594fa
chore: modernise tooling and reduce package size (#466)
joepegler Apr 19, 2024
539269e
chore: add further tests (#471)
joepegler Apr 19, 2024
facab25
chore: add 6492 signature (#468)
VGabriel45 Apr 19, 2024
6c6583f
chore: remove buffer (#473)
joepegler Apr 19, 2024
e290fd1
chore: export abi svm helper (#476)
joepegler Apr 25, 2024
8694366
chore: add token balances in getSupportedTokens (#470)
VGabriel45 Apr 25, 2024
950a521
feat: gas estimates (#477)
joepegler Apr 25, 2024
e39bb88
update docs link (#480)
joepegler Apr 25, 2024
44999e7
chore: backmerge main
joepegler Apr 25, 2024
8d34d14
chore: dumy pnd override (#481)
livingrockrises Apr 25, 2024
b44a7bf
chore: update readme (#482)
joepegler Apr 26, 2024
c06a8d4
chore: version bump (#483)
joepegler Apr 29, 2024
8fc9038
Merge pull request #479 from bcnmy/develop
joepegler Apr 29, 2024
73965ab
feat: gas offset param for sendTransaction and sendUserOp (#474)
VGabriel45 May 9, 2024
000fa86
feat: transfer ownership (#484)
VGabriel45 May 10, 2024
76be2c0
feat: transfer_ownership_v2 (#488)
VGabriel45 May 13, 2024
498b79b
chore: r11 - v4.2.1 (#489)
VGabriel45 May 13, 2024
9941115
chore: release v4.3.0 (#491)
VGabriel45 May 14, 2024
37ebce9
Merge branch 'main' of https://github.com/bcnmy/biconomy-client-sdk i…
GabiDev45 May 14, 2024
b9b2077
chore: sessions dx (#486)
joepegler May 14, 2024
f4976f4
Merge branch 'main' into develop
joepegler May 14, 2024
71b5b04
fix: process.env errors (#494)
joepegler May 16, 2024
81854a1
chore: tests counterfactual address (#485)
joepegler May 16, 2024
c172a40
chore: v4.4.1 (#495)
joepegler May 16, 2024
c70febb
ci: tests
joepegler May 16, 2024
39761a7
fix: reference value (#498)
joepegler May 17, 2024
5d4406e
chore: improve useSession dx (#502)
joepegler May 23, 2024
6a0ddee
feat: simulate user op tests + ts doc (#503)
VGabriel45 May 27, 2024
b969a91
feat: custom chains support (#500)
joepegler May 27, 2024
97c8fcd
chore: add test concurrency using nonceOptions (#506)
VGabriel45 May 30, 2024
6678f24
chore: batch session with token gas payments (#505)
joepegler May 30, 2024
5606954
chore: release v4.4.5 (#511)
joepegler May 30, 2024
e74606a
chore: skip transfer tests (#514)
joepegler May 31, 2024
ec082bd
fix: remove file storage (#515)
joepegler Jun 4, 2024
1af2f31
feat: nexus integration draft
GabiDev45 Jun 12, 2024
49431dd
fix: lint fixes
GabiDev45 Jun 12, 2024
21a693f
refactor: refactor calldata encoding
GabiDev45 Jun 13, 2024
1d8e651
refactor: calldata encoding and types
GabiDev45 Jun 13, 2024
3d6f494
refactor: cleaning and removing unused code
GabiDev45 Jun 13, 2024
c74a612
feat: install & uninstall module
GabiDev45 Jun 14, 2024
78b7327
feat: added batch execution, wait() for receipt, account modes ++
GabiDev45 Jun 17, 2024
1527f79
refactor: lint fixes
GabiDev45 Jun 17, 2024
eab0825
feat: added executor module + more module helper metods
GabiDev45 Jun 17, 2024
5f3ce6e
refactor: lint fix
GabiDev45 Jun 18, 2024
0f0c022
feat: executor module
GabiDev45 Jun 18, 2024
f9cb261
fix: fix mode
GabiDev45 Jun 18, 2024
330d3ac
fix: lint
GabiDev45 Jun 18, 2024
7363f52
feat: added tests for hook and handler
GabiDev45 Jun 19, 2024
9d1ece2
feat: cleaning & fix batch call from executor
GabiDev45 Jun 19, 2024
bdb8444
feat: modules integration +++
GabiDev45 Jun 21, 2024
c350fe4
fix: linting
GabiDev45 Jun 21, 2024
3249944
feat: added ownable validator module
GabiDev45 Jun 25, 2024
9a5b8df
fix: lint
GabiDev45 Jun 25, 2024
cc4530f
feat: improve install/uninstall flow, renaming, error handling, refactor
GabiDev45 Jun 28, 2024
2268af2
feat: add account address argument
GabiDev45 Jul 4, 2024
21dab0d
refactor: lint
GabiDev45 Jul 4, 2024
4f329f7
feat: extra argument to executor + test case
GabiDev45 Jul 8, 2024
35778ee
refactor: fix lint issues
GabiDev45 Jul 8, 2024
e102c3d
feat: nexus enable mode (#543)
VGabriel45 Jul 18, 2024
99463a3
feat: added getInstalledModules function + minor refactor
GabiDev45 Jul 29, 2024
60cddcd
refactor: refactor after new contracts
GabiDev45 Jul 31, 2024
d5855fd
feat: Nexus signature tests (draft)
GabiDev45 Aug 1, 2024
2ecb682
refactor: eip712 signature tests (draft)
GabiDev45 Aug 2, 2024
d42a1de
refactor: fixed signature methods & tests
GabiDev45 Aug 8, 2024
4eb51f4
refactor: lint fixes
GabiDev45 Aug 8, 2024
7278f08
chore: add dotenv
joepegler Aug 8, 2024
36bad84
Update parsing of the URL from config (#554)
veljkovranic Aug 9, 2024
8da8bd2
feat: added sendUserOperation script
GabiDev45 Aug 13, 2024
bb812ed
Merge branch 'feat/nexus' of https://github.com/bcnmy/biconomy-client…
GabiDev45 Aug 13, 2024
95f8862
refactor: change testing chain to baseSepolia
GabiDev45 Aug 13, 2024
c2af94a
refactor: cleanup
GabiDev45 Aug 15, 2024
d283ea4
refactor: cleanup + tsdoc + tests
GabiDev45 Aug 16, 2024
dc9f53a
fix: fixed script
GabiDev45 Aug 16, 2024
b3fe78f
refactor: removed initCode from packing
GabiDev45 Aug 16, 2024
43bca20
refactor: cleanup variable names and added 1 more test
Aug 20, 2024
81acdef
refactor: changes for interoperability between account sdks + removin…
Aug 20, 2024
8c25a8e
refactor: rename module field
Aug 20, 2024
b66b611
refactor: updated test case for OwnableExecutor
Aug 20, 2024
a67103d
broken links fixed
B-Venkatesh7210 Aug 23, 2024
678a5cc
feat: testing framework (#561)
joepegler Aug 30, 2024
b2a3e28
chore: test support for smart sessions (#565)
joepegler Sep 3, 2024
1a85cb6
chore: add paymaster (#566)
joepegler Sep 3, 2024
7cb4ff8
chore: fix nexus import (#567)
joepegler Sep 3, 2024
0175646
chore: fix gas estimate endpoint
joepegler Sep 6, 2024
ce0b025
chore: return script
joepegler Sep 6, 2024
08365da
signTypedData implementation + tests + nexus contracts update (#573)
VGabriel45 Sep 13, 2024
f548ab4
chore: refactor (#574)
joepegler Sep 19, 2024
4ad18e4
Nexus fix: OwnableValidator & OwnableExecutor integration + tests, + …
VGabriel45 Sep 23, 2024
b23737a
Merge branch 'feat/nexus' of https://github.com/bcnmy/biconomy-client…
Sep 24, 2024
3b3cc57
refactor: add missing pieces, fix build, fix lint issues, fix tests
Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
slug: bcnmy/sdk
slug: bcnmy/sdk
2 changes: 1 addition & 1 deletion .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
BUNDLER_URL: ${{ secrets.BUNDLER_URL }}
CHAIN_ID: 84532
CI: true
CI: true
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @biconomy/sdk

## 0.0.0
## 0.0.0
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"commit-msg": "npx --no -- commitlint --edit ${1}"
},
"dependencies": {
"@rhinestone/module-sdk": "^0.1.17",
"merkletreejs": "^0.3.11"
}
}
2 changes: 1 addition & 1 deletion scripts/send:userOp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if ([chain, privateKey, bundlerUrl].every(Boolean) !== true)
const account = privateKeyToAccount(`0x${privateKey}`)
const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" // vitalik.eth
const nexusClient = await createNexusClient({
holder: account,
signer: account,
chain,
transport: http(),
bundlerTransport: http(bundlerUrl),
Expand Down
2 changes: 1 addition & 1 deletion scripts/viem:bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const publicClient = createPublicClient({

const main = async () => {
const nexusAccount = await toNexusAccount({
holder: account,
signer: account,
chain,
transport: http(),
k1ValidatorAddress,
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/account/toNexusAccount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe("nexus.account", async () => {
})

nexusClient = await createNexusClient({
holder: account,
signer: account,
chain,
transport: http(),
bundlerTransport: http(bundlerUrl)
Expand Down
71 changes: 43 additions & 28 deletions src/sdk/account/toNexusAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@ import {
packUserOp,
typeToString
} from "./utils/Utils"
import { type UnknownHolder, toHolder } from "./utils/toHolder"
import { type UnknownSigner, toSigner } from "./utils/toSigner"

/**
* Parameters for creating a Nexus Smart Account
*/
export type ToNexusSmartAccountParameters = Prettify<
{
/** The blockchain network */
chain: Chain
/** The transport configuration */
transport: ClientConfig["transport"]
/** The holder account or address */
holder: UnknownHolder
/** Optional index for the account */
index?: bigint | undefined
/** Optional active validation module */
activeModule?: BaseValidationModule
/** Optional factory address */
factoryAddress?: Address
/** Optional K1 validator address */
k1ValidatorAddress?: Address
} & Pick<
export type ToNexusSmartAccountParameters = {
/** The blockchain network */
chain: Chain
/** The transport configuration */
transport: ClientConfig["transport"]
/** The signer account or address */
signer: UnknownSigner
/** Optional index for the account */
index?: bigint | undefined
/** Optional active validation module */
activeValidationModule?: BaseValidationModule
/** Optional factory address */
factoryAddress?: Address
/** Optional K1 validator address */
k1ValidatorAddress?: Address
} & Prettify<
Pick<
ClientConfig<Transport, Chain, Account, RpcSchema>,
| "account"
| "cacheTime"
Expand Down Expand Up @@ -113,6 +113,8 @@ export type NexusSmartAccountImplementation = SmartAccountImplementation<
encodeExecute: (call: Call) => Promise<Hex>
encodeExecuteBatch: (calls: readonly Call[]) => Promise<Hex>
getUserOpHash: (userOp: Partial<UserOperationStruct>) => Promise<Hex>
setActiveValidationModule: (validationModule: BaseValidationModule) => void
getActiveValidationModule: () => BaseValidationModule
factoryData: Hex
factoryAddress: Address
}
Expand All @@ -132,7 +134,7 @@ export type NexusSmartAccountImplementation = SmartAccountImplementation<
* const account = await toNexusAccount({
* chain: mainnet,
* transport: http(),
* holder: '0x...',
* signer: '0x...',
* })
*/
export const toNexusAccount = async (
Expand All @@ -141,19 +143,19 @@ export const toNexusAccount = async (
const {
chain,
transport,
holder: holder_,
signer: _signer,
index = 0n,
activeModule,
activeValidationModule,
factoryAddress = contracts.k1ValidatorFactory.address,
k1ValidatorAddress = contracts.k1Validator.address,
key = "nexus account",
name = "Nexus Account"
} = parameters

const holder = await toHolder({ holder: holder_ })
const signer = await toSigner({ signer: _signer })

const masterClient = createWalletClient({
account: holder,
account: signer,
chain,
transport,
key,
Expand All @@ -178,16 +180,16 @@ export const toNexusAccount = async (
args: [signerAddress, index, [], 0]
})

const defaultedActiveModule =
activeModule ??
let defaultedActiveModule =
activeValidationModule ??
new K1ValidatorModule(
{
address: k1ValidatorAddress,
type: "validator",
context: signerAddress,
data: signerAddress,
additionalContext: "0x"
},
holder
signer
)

let _accountAddress: Address
Expand Down Expand Up @@ -344,6 +346,17 @@ export const toNexusAccount = async (
}
}

/**
* @description Changes the active module for the account
* @param newModule - The new module to set as active
* @returns void
*/
const setActiveValidationModule = (
validationModule: BaseValidationModule
): void => {
defaultedActiveModule = validationModule
}

/**
* @description Signs a message
* @param params - The parameters for signing
Expand All @@ -354,7 +367,7 @@ export const toNexusAccount = async (
message
}: { message: SignableMessage }): Promise<Hex> => {
const tempSignature = await defaultedActiveModule
.getHolder()
.getSigner()
.signMessage({ message })

const signature = encodePacked(
Expand Down Expand Up @@ -509,6 +522,8 @@ export const toNexusAccount = async (
encodeExecute,
encodeExecuteBatch,
getUserOpHash,
setActiveValidationModule,
getActiveValidationModule: () => defaultedActiveModule,
factoryData,
factoryAddress
}
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/account/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export * from "./Utils.js"
export * from "./Constants.js"
export * from "./getChain.js"
export * from "./Logger.js"
export * from "./toHolder.js"
export * from "./toSigner.js"
86 changes: 86 additions & 0 deletions src/sdk/account/utils/toSigner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {
type Account,
type Address,
type Chain,
type EIP1193Provider,
type EIP1193RequestFn,
type EIP1474Methods,
type LocalAccount,
type OneOf,
type Transport,
type WalletClient,
createWalletClient,
custom
} from "viem"
import { toAccount } from "viem/accounts"

import { signTypedData } from "viem/actions"
import { getAction } from "viem/utils"

export type Signer = LocalAccount
export type UnknownSigner = OneOf<
| EIP1193Provider
| WalletClient<Transport, Chain | undefined, Account>
| LocalAccount
| Account
>
export async function toSigner({
signer,
address
}: {
signer: UnknownSigner
address?: Address
}): Promise<LocalAccount> {
if ("type" in signer && signer.type === "local") {
return signer as LocalAccount
}

let walletClient:
| WalletClient<Transport, Chain | undefined, Account>
| undefined = undefined

if ("request" in signer) {
if (!address) {
try {
;[address] = await (signer.request as EIP1193RequestFn<EIP1474Methods>)(
{
method: "eth_requestAccounts"
}
)
} catch {
;[address] = await (signer.request as EIP1193RequestFn<EIP1474Methods>)(
{
method: "eth_accounts"
}
)
}
}
if (!address) throw new Error("address required")

walletClient = createWalletClient({
account: address,
transport: custom(signer as EIP1193Provider)
})
}

if (!walletClient) {
walletClient = signer as WalletClient<Transport, Chain | undefined, Account>
}

return toAccount({
address: walletClient.account.address,
async signMessage({ message }) {
return walletClient.signMessage({ message })
},
async signTypedData(typedData) {
return getAction(
walletClient,
signTypedData,
"signTypedData"
)(typedData as any)
},
async signTransaction(_) {
throw new Error("Not supported")
}
})
}
2 changes: 1 addition & 1 deletion src/sdk/clients/createBicoBundlerClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("bico.bundler", async () => {
testClient = toTestClient(chain, getTestAccount(5))

nexusAccount = await toNexusAccount({
holder: account,
signer: account,
chain,
transport: http()
})
Expand Down
46 changes: 13 additions & 33 deletions src/sdk/clients/createNexusClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { AbiCoder, ParamType } from "ethers/abi"
import { JsonRpcProvider } from "ethers/providers"
import { Wallet } from "ethers/wallet"
import {
http,
type AbiParameter,
type Account,
type Address,
type Chain,
type Hex,
encodeAbiParameters,
encodeFunctionData,
parseEther
} from "viem"
Expand All @@ -24,7 +18,6 @@ import {
topUp
} from "../../test/testUtils"
import type { MasterClient, NetworkConfig } from "../../test/testUtils"
import { pKey } from "../../test/testUtils"
import { addresses } from "../__contracts/addresses"
import { ERROR_MESSAGES } from "../account/utils/Constants"
import { makeInstallDataAndHash } from "../account/utils/Utils"
Expand Down Expand Up @@ -56,7 +49,7 @@ describe("nexus.client", async () => {
testClient = toTestClient(chain, getTestAccount(5))

nexusClient = await createNexusClient({
holder: account,
signer: account,
chain,
transport: http(),
bundlerTransport: http(bundlerUrl)
Expand Down Expand Up @@ -157,19 +150,19 @@ describe("nexus.client", async () => {
expect(result).toBeTruthy()
}, 30000)

test.skip("should create a nexusAccount from an ethers signer", async () => {
const ethersProvider = new JsonRpcProvider(chain.rpcUrls.default.http[0])
const ethersSigner = new Wallet(pKey, ethersProvider)
// test.skip("should create a nexusAccount from an ethers signer", async () => {
// const ethersProvider = new JsonRpcProvider(chain.rpcUrls.default.http[0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

// const ethersSigner = new Wallet(pKey, ethersProvider)

const ethOwnerNexusClient = await createNexusClient({
chain,
owner: (await ethersSigner.getAddress()) as Hex,
bundlerTransport: http(bundlerUrl),
transport: http(chain.rpcUrls.default.http[0])
})
// const ethOwnerNexusClient = await createNexusClient({
// chain,
// owner: (await ethersSigner.getAddress()) as Hex,
// bundlerTransport: http(bundlerUrl),
// transport: http(chain.rpcUrls.default.http[0])
// })

expect(await ethOwnerNexusClient.account.getAddress()).toBeTruthy()
})
// expect(await ethOwnerNexusClient.account.getAddress()).toBeTruthy()
// })

test("should read estimated user op gas values", async () => {
const userOp = await nexusClient.prepareUserOperation({
Expand Down Expand Up @@ -234,7 +227,7 @@ describe("nexus.client", async () => {
module: {
type: "validator",
address: addresses.K1Validator,
context: "0x"
data: "0x"
}
}),
nexusClient.supportsExecutionMode({
Expand All @@ -259,17 +252,4 @@ describe("nexus.client", async () => {
expect(status).toBe("success")
expect(balanceAfter - balanceBefore).toBe(2n)
})

// Not working
test.skip("should uninstall modules", async () => {
const result = await nexusClient.uninstallModules({
modules: [
{
type: "validator",
address: addresses.K1Validator,
context: "0x"
}
]
})
})
})
Loading
Loading