Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Add blockchain_wallet.get and blockchain_wallet.all #1072

Merged
merged 28 commits into from Jul 2, 2019

Conversation

ripzery
Copy link
Contributor

@ripzery ripzery commented Jun 25, 2019

Issue/Task Number: #691

Closes #691

Overview

This PR adds 2 endpoints for blockchain wallet which are:

  • blockchain_wallet.get to get a single wallet by the given address
  • blockchain_wallet.all to get all wallets by given pagination params

Usage

Follows Setup local geth testnet guide then you will need to create a wallet and update tokens' blockchain_address:

  1. mix seed --sample
  2. iex -S mix
  3. Insert blockchain wallet by run the followings command:
EWalletDB.BlockchainWallet.insert(
  %{
    address: "0xprimary_address", 
    type: "hot", 
    name: "Primary wallet", 
    public_key: "12345", 
    originator: %ActivityLogger.System{}
  }
)

Replace address with your wallet address from the geth setup.

  1. Update Ethereum's blockchain_address
EWalletDB.Token.update(
  EWalletDB.Token.get_by(name: "Ether"), 
  %{
    blockchain_address: "0x0000000000000000000000000000000000000000", 
    originator: %ActivityLogger.System{}
  }
)
  1. Update OmiseGO's blockchain_address
EWalletDB.Token.update(
  EWalletDB.Token.get_by(name: "OmiseGO"), 
  %{
    blockchain_address: "omg_address", 
    originator: %ActivityLogger.System{}
  }
)

Replace omg_address with the omg token address from geth (Run omgtoken.address)

  1. Try retrieve a wallet or a list of wallets from /blockchain_wallet.get and /blockchain_wallet.all in the Swagger

@ripzery ripzery added the kind/enhancement 🚀 New feature or request label Jun 25, 2019
@ripzery ripzery self-assigned this Jun 25, 2019
@unnawut
Copy link
Contributor

unnawut commented Jun 25, 2019

Should BlockchainWallet now enforce association with Account or User? Right now it’s floating without any association so I’m not sure what should be returned/unauthorized for the endpoints.

Also, EWalletDB.GlobalRole and EWalletDB.Role are empty at the moment. Probably needed to make these 2 endpoints fully functioning.

@unnawut
Copy link
Contributor

unnawut commented Jun 27, 2019

Also this probably needs an update: EWallet.BlockchainWalletPolicy (see EWallet.WalletPolicy)

@unnawut unnawut requested review from T-Dnzt and mederic-p June 27, 2019 06:24
@ripzery
Copy link
Contributor Author

ripzery commented Jun 27, 2019

Also this probably needs an update: EWallet.BlockchainWalletPolicy (see EWallet.WalletPolicy)

I think it can be updated when the blockchain_wallet.create is available. But I've just added account and user associated maybe better to add now? 🤔

@ripzery ripzery requested a review from unnawut June 28, 2019 10:03
@mederic-p mederic-p merged commit a2c2d98 into master Jul 2, 2019
@mederic-p mederic-p deleted the 691-management-endpoints-for-blockchain-wallet branch July 2, 2019 02:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/enhancement 🚀 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Management endpoints for blockchain wallets
4 participants