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

Biconomy Smart Account Integration (CLI) #71

Open
dOrgJelli opened this issue Mar 23, 2024 · 4 comments
Open

Biconomy Smart Account Integration (CLI) #71

dOrgJelli opened this issue Mar 23, 2024 · 4 comments

Comments

@dOrgJelli
Copy link
Contributor

dOrgJelli commented Mar 23, 2024

In this first integration we will focus on the CLI. The user must specify an EOA private key they want to use as the root address in control of the smart account. The environment variables will be modified to reflect the following: SAFE_SMART_ACCOUNT_ADDRESS & SMART_ACCOUNT_OWNER_PK. The user must specify one of these to use AutoTx.

Once the user private key is set, when AutoTx is run, it will detect if there is an existing smart account created for this address (localstorage). If one does not exist, it will walk the user through smart account deployment on the desired chain:

AutoTx: It appears you do not have a smart account deployed on this chain. Let's get that deployed for you...
AutoTx: Your smart account is 0xABC, please send at least ${amount} ${native_asset} to this address on ${chain} to initialize the account and get started making transactions.
...waiting...
...user sends funds...
AutoTx: Your smart account has been funded, we're ready to begin generating transactions.

Now that the smart accounts exists, AutoTx will continue to execute using the smart account's address as the user's address. Upon creating transaction bundles, we must format them accordingly for the bundler to be able to execute. NOTE: we'll need to a an environment variable for the bundler. This is something we can add on the user's behalf to be used by default.

Since the Biconomy SDK is only available in JS/TS, simplest approach would be to run a "smart account service" in a docker container that allows us to interface with the SDK for things like deployment, bundle creation, and bundle submission.

References:
https://www.biconomy.io/smart-accounts
https://www.biconomy.io/post/modular-session-keys
https://github.com/bcnmy/biconomy-client-sdk/tree/main
https://github.com/bcnmy/sdk-examples/blob/master/scripts/index.ts

@dOrgJelli dOrgJelli added this to the Integrations milestone Mar 23, 2024
@nerfZael
Copy link
Contributor

Been looking into AA a lot lately, so I'd love to tackle this as soon as it's a priority

@dOrgJelli dOrgJelli removed this from the Integrations milestone Mar 28, 2024
@dOrgJelli dOrgJelli changed the title Investigate Biconomy Smart Account Integration Biconomy Smart Account Integration Apr 10, 2024
@dOrgJelli dOrgJelli changed the title Biconomy Smart Account Integration Biconomy Smart Account Integration (CLI) Jun 19, 2024
@livingrockrises
Copy link

can you share example of CLI integration please?

Also below maybe relevant on Discord integration issue but..
"You need to add AutoTx's address as a delegate or signer to your Safe. This allows AutoTx to propose transactions. Address: 0xa14C92946b37BFd4b2d55aCFAE43EF77ECb189e0" - from my discord interaction

Would we need this in this case? Why do make AutoTx delegate? just so it appears on safe dashboard for user to sign with main signer/s of the safe?

@livingrockrises
Copy link

Once the user private key is set, when AutoTx is run, it will detect if there is an existing smart account created for this address

this can be done by getting counterfactual SA address for an EOA, with or without biconomy SDK (using ECDSA module address and SA factory address)

@livingrockrises
Copy link

please check here for preparing and sending tx using a bundler. can share individual internal steps from the sdk and help them translate to smart account service.

https://github.com/bcnmy/sdk-examples/blob/master/scripts/gasless/mintNFT.ts#L36

imo AutoTx would just prepare the calldata (tx object or array of tx objects) and ask the EOA signer to sign userop hash.

also, smart account V2 repo is this one. https://github.com/bcnmy/scw-contracts/tree/develop
we can give you deployed addresses from the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants