Skip to content

Commit

Permalink
Merge pull request #1287 from mesg-foundation/ss/update
Browse files Browse the repository at this point in the history
Update system services to work with latest gRPC API
  • Loading branch information
antho1404 authored Sep 2, 2019
2 parents 74acfd7 + 6df0d0f commit 4df8104
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 56 deletions.
9 changes: 5 additions & 4 deletions systemservices/ethwallet/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"time"

"github.com/mesg-foundation/engine/hash"
pb "github.com/mesg-foundation/engine/protobuf/api"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
Expand All @@ -26,7 +27,7 @@ type Client struct {
pb.ServiceClient

// instance hash that could be used in api calls.
InstanceHash string
InstanceHash []byte
}

// New creates a new client from env variables supplied by mesg engine.
Expand All @@ -36,9 +37,9 @@ func New() (*Client, error) {
return nil, fmt.Errorf("client: mesg server address env(%s) is empty", envMesgEndpoint)
}

instanceHash := os.Getenv(envMesgInstanceHash)
if instanceHash == "" {
return nil, fmt.Errorf("client: mesg instance hash env(%s) is empty", envMesgInstanceHash)
instanceHash, err := hash.Decode(os.Getenv(envMesgInstanceHash))
if err != nil {
return nil, fmt.Errorf("client: error with mesg's instance hash env(%s): %s", envMesgInstanceHash, err.Error())
}

conn, err := grpc.DialContext(context.Background(), endpoint, dialoptions()...)
Expand Down
2 changes: 1 addition & 1 deletion systemservices/ethwallet/compiled.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"sid":"ethwallet","name":"Ethereum Wallet","description":"Manage Ethereum accounts and sign transactions.","tasks":[{"key":"list","name":"List accounts","description":"Return the addresses of existing account.","inputs":[],"outputs":[{"key":"addresses","name":"Addresses","description":"List of addresses.","type":"String","repeated":true,"object":[]}]},{"key":"create","name":"Create a new account","description":"Create a new account with a passphrase. Make sure to backup the passphrase.","inputs":[{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]},{"key":"delete","name":"Delete an account","description":"Delete an account from the wallet. Need the address and its associated passphrase.","inputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]},{"key":"export","name":"Export an account","description":"Export an existing account in order to backup it and import it in an other wallet. Respect the Web3 Secret Storage specification. See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information.","inputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"id","name":"ID","description":"The id of the account.","type":"String","object":[]},{"key":"version","name":"Version","description":"The version used to export the account.","type":"Number","object":[]},{"key":"crypto","name":"Crypto","description":"The encrypted account.","type":"Object","object":[]}]},{"key":"import","name":"Import an account","description":"Import an account. The account have to respect the Web3 Secret Storage specification. See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information.","inputs":[{"key":"account","name":"Account","description":"The JSON encoded account.","type":"Object","object":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"id","name":"ID","description":"The id of the account.","type":"String","object":[]},{"key":"version","name":"Version","description":"The version used to export the account.","type":"Number","object":[]},{"key":"crypto","name":"Crypto","description":"The encrypted account.","type":"Object","object":[]}]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]},{"key":"sign","name":"Sign transaction","description":"Sign a transaction with the specified account.","inputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]},{"key":"transaction","name":"Transaction","description":"The transaction to sign.","type":"Object","object":[{"key":"chainID","name":"Chain ID","description":"The ID of the chain the transaction is for. See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md#list-of-chain-ids.","type":"Number","object":[]},{"key":"nonce","name":"Nonce","description":"Nonce to use.","type":"Number","object":[]},{"key":"to","name":"To","description":"The to address.","type":"String","object":[]},{"key":"value","name":"Value","description":"The value in Wei.","type":"String","object":[]},{"key":"gas","name":"Gas","description":"The maximum gas to use to execute this transaction","type":"Number","object":[]},{"key":"gasPrice","name":"Gas price","description":"The gas price in Wei.","type":"String","object":[]},{"key":"data","name":"Data","description":"The data of the transaction.","type":"String","object":[]}]}],"outputs":[{"key":"signedTransaction","name":"Signed transaction","description":"The signed transaction.","type":"String","object":[]}]},{"key":"importFromPrivateKey","name":"Import an account from a private key","description":"Import an account from a private key.","inputs":[{"key":"privateKey","name":"Private key","description":"The private key to import.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]}],"events":[],"dependencies":[],"configuration":{"env":["MESG_KEYSTORE=/keystore"],"volumes":["/keystore"]},"source":"QmWJMCurpAQiAgSDW6dMpUH8Xktbvo4DyVd5jSrAQazDFG"}
{"sid":"ethwallet","name":"Ethereum Wallet","description":"Manage Ethereum accounts and sign transactions.","configuration":{"env":["MESG_KEYSTORE=/keystore"],"volumes":["/keystore"]},"dependencies":[],"tasks":[{"key":"list","name":"List accounts","description":"Return the addresses of existing account.","inputs":[],"outputs":[{"key":"addresses","name":"Addresses","description":"List of addresses.","type":"String","repeated":true,"object":[]}]},{"key":"create","name":"Create a new account","description":"Create a new account with a passphrase. Make sure to backup the passphrase.","inputs":[{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]},{"key":"delete","name":"Delete an account","description":"Delete an account from the wallet. Need the address and its associated passphrase.","inputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]},{"key":"export","name":"Export an account","description":"Export an existing account in order to backup it and import it in an other wallet. Respect the Web3 Secret Storage specification. See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information.","inputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"id","name":"ID","description":"The id of the account.","type":"String","object":[]},{"key":"version","name":"Version","description":"The version used to export the account.","type":"Number","object":[]},{"key":"crypto","name":"Crypto","description":"The encrypted account.","type":"Object","object":[]}]},{"key":"import","name":"Import an account","description":"Import an account. The account have to respect the Web3 Secret Storage specification. See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information.","inputs":[{"key":"account","name":"Account","description":"The JSON encoded account.","type":"Object","object":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"id","name":"ID","description":"The id of the account.","type":"String","object":[]},{"key":"version","name":"Version","description":"The version used to export the account.","type":"Number","object":[]},{"key":"crypto","name":"Crypto","description":"The encrypted account.","type":"Object","object":[]}]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]},{"key":"sign","name":"Sign transaction","description":"Sign a transaction with the specified account.","inputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]},{"key":"transaction","name":"Transaction","description":"The transaction to sign.","type":"Object","object":[{"key":"chainID","name":"Chain ID","description":"The ID of the chain the transaction is for. See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md#list-of-chain-ids.","type":"Number","object":[]},{"key":"nonce","name":"Nonce","description":"Nonce to use.","type":"Number","object":[]},{"key":"to","name":"To","description":"The to address.","type":"String","object":[]},{"key":"value","name":"Value","description":"The value in Wei.","type":"String","object":[]},{"key":"gas","name":"Gas","description":"The maximum gas to use to execute this transaction","type":"Number","object":[]},{"key":"gasPrice","name":"Gas price","description":"The gas price in Wei.","type":"String","object":[]},{"key":"data","name":"Data","description":"The data of the transaction.","type":"String","object":[]}]}],"outputs":[{"key":"signedTransaction","name":"Signed transaction","description":"The signed transaction.","type":"String","object":[]}]},{"key":"importFromPrivateKey","name":"Import an account from a private key","description":"Import an account from a private key.","inputs":[{"key":"privateKey","name":"Private key","description":"The private key to import.","type":"String","object":[]},{"key":"passphrase","name":"Passphrase","description":"Passphrase to use with the account.","type":"String","object":[]}],"outputs":[{"key":"address","name":"Address","description":"The public address of the account.","type":"String","object":[]}]}],"events":[],"workflows":[],"source":"QmTqJXKdqLL5FjJ8yaTa4M32nLCE8vJQzKdm1xsEKxxCKR"}
27 changes: 21 additions & 6 deletions systemservices/ethwallet/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,33 @@ module github.com/mesg-foundation/engine/systemservices/ethwallet
go 1.12

require (
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
github.com/aristanetworks/goarista v0.0.0-20190628180533-8e7d5b18fe7a // indirect
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8 // indirect
github.com/cespare/cp v1.1.1 // indirect
github.com/deckarep/golang-set v1.7.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/ethereum/go-ethereum v1.8.27
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.3.1
github.com/mesg-foundation/engine v0.5.1-0.20190725113935-3e817175f412
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
github.com/gliderlabs/ssh v0.2.2 // indirect
github.com/golang/protobuf v1.3.2
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e // indirect
github.com/mesg-foundation/engine v0.5.1-0.20190830132122-7f4f7dd94c4f
github.com/mitchellh/mapstructure v1.1.2
github.com/pborman/uuid v1.2.0 // indirect
github.com/pelletier/go-buffruneio v0.2.0 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/stretchr/testify v1.3.0
google.golang.org/grpc v1.19.0
github.com/sergi/go-diff v1.0.0 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/stretchr/testify v1.4.0
github.com/xanzy/ssh-agent v0.2.1 // indirect
google.golang.org/grpc v1.23.0
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.0 // indirect
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 // indirect
gopkg.in/src-d/go-git.v4 v4.5.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
Loading

0 comments on commit 4df8104

Please sign in to comment.