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

Master wallet implementation #42

Merged
merged 50 commits into from
Apr 5, 2024
Merged

Master wallet implementation #42

merged 50 commits into from
Apr 5, 2024

Conversation

angrybayblade
Copy link
Contributor

@angrybayblade angrybayblade commented Mar 26, 2024

GET /api/account

Returns account status

Before setup
{
  "is_setup": false
}
After setup
{
  "is_setup": true
}

POST /api/account

Create a local user account

Request
{
  "password": "Hello,World!",
}
Response
{
  "error": null
}

If account already exists

Response
{
  "error": "Account already exists"
}

PUT /api/account

Update password

Request
{
  "old_password": "Hello,World!",
  "new_password": "Hello,World",
}
Response
{
  "error": null
}

Old password is not valid

Response
{
  "error": "Old password is not valid",
  "traceback": "..."
}

POST /api/account/login

Login and create a session

Request
{
  "password": "Hello,World",
}
Response
{
  "message": "Login successful"
}

GET /api/wallet

Returns a list of available wallets

Response
[
  {
    "address": "0xFafd5cb31a611C5e5aa65ea8c6226EB4328175E7",
    "safe_chains": [
      2
    ],
    "ledger_type": 0,
    "safe": "0xd56fb274ce2C66008D5c4C09980c4f36Ab81ff23",
    "safe_nonce": 110558881674480320952254000342160989674913430251257716940579305238321962891821
  }
]

POST /api/wallet

Creates a master key for given chain type.

Request
{
  "chain_type": ChainType,
}
Response
{
  "wallet": {
    "address": "0xAafd5cb31a611C5e5aa65ea8c6226EB4328175E1",
    "safe_chains": [],
    "ledger_type": 0,
    "safe": null,
    "safe_nonce": null
  },
  "mnemonic": [...]
}

PUT /api/wallet

Creates a gnosis safe for given chain type.

Request
{
  "chain_type": ChainType,
}
Response
{
  "address": "0xaaFd5cb31A611C5e5aa65ea8c6226EB4328175E3",
  "safe_chains": [
    2
  ],
  "ledger_type": 0,
  "safe": "0xe56fb574ce2C66008d5c4C09980c4f36Ab81ff22",
  "safe_nonce": 110558881674480320952254000342160989674913430251157716140571305138121962898821
}

Comment on lines +1 to +2
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@truemiller this script will help you setup a local wallet

@angrybayblade angrybayblade changed the base branch from refactor/api to main March 27, 2024 11:14
angrybayblade and others added 23 commits April 3, 2024 20:26
have removed the js changes as will need to use a different workaround to expose only the requested ENV
Make RPC configurable via env vars
@angrybayblade angrybayblade merged commit 380e2f5 into main Apr 5, 2024
3 checks passed
@truemiller truemiller deleted the feat/wallet branch April 5, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants