-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrpc.proto
148 lines (115 loc) · 6.33 KB
/
rpc.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
syntax = "proto3";
package land.gno.gnomobile.v1;
import "gnomobiletypes.proto";
option go_package = "github.com/gnolang/gnomobile/service/rpc";
option objc_class_prefix = "RTG";
// GnomobileService is the service to interact with the Gno blockchain
service GnomobileService {
// Set the connection addresse for the remote node. If you don't call this,
// the default is "127.0.0.1:26657"
rpc SetRemote(SetRemoteRequest) returns (SetRemoteResponse);
// Set the chain ID for the remote node. If you don't call this, the default
// is "dev"
rpc SetChainID(SetChainIDRequest) returns (SetChainIDResponse);
// Generate a recovery phrase of BIP39 mnemonic words using entropy from the
// crypto library random number generator. This can be used as the mnemonic in
// CreateAccount.
rpc GenerateRecoveryPhrase(GenerateRecoveryPhraseRequest)
returns (GenerateRecoveryPhraseResponse);
// Get the information for all keys in the keybase
rpc ListKeyInfo(ListKeyInfoRequest) returns (ListKeyInfoResponse);
// Check for the key in the keybase with the given name.
// In the response, set has true if the keybase has the key.
rpc HasKeyByName(HasKeyByNameRequest) returns (HasKeyByNameResponse);
// Check for the key in the keybase with the given address.
// In the response, set has true if the keybase has the key.
rpc HasKeyByAddress(HasKeyByAddressRequest) returns (HasKeyByAddressResponse);
// Check for the key in the keybase with the given name or bech32 string address.
// In the response, set has true if the keybase has the key.
rpc HasKeyByNameOrAddress(HasKeyByNameOrAddressRequest) returns (HasKeyByNameOrAddressResponse);
// Get the information for the key in the keybase with the given name.
// If the key doesn't exist, then return ErrCryptoKeyNotFound.
rpc GetKeyInfoByName(GetKeyInfoByNameRequest) returns (GetKeyInfoByNameResponse);
// Get the information for the key in the keybase with the given address.
// If the key doesn't exist, then return ErrCryptoKeyNotFound.
rpc GetKeyInfoByAddress(GetKeyInfoByAddressRequest) returns (GetKeyInfoByAddressResponse);
// Get the information for the key in the keybase with the given name or bech32 string address.
// If the key doesn't exist, then return ErrCryptoKeyNotFound.
rpc GetKeyInfoByNameOrAddress(GetKeyInfoByNameOrAddressRequest) returns (GetKeyInfoByNameOrAddressResponse);
// Create a new account the keybase using the name an password specified by SetAccount.
// If an account with the same name already exists in the keybase,
// this replaces it. (If you don't want to replace it, then it's your responsibility
// to use GetKeyInfoByName to check if it exists before calling this.)
rpc CreateAccount(CreateAccountRequest) returns (CreateAccountResponse);
// SelectAccount selects the active account to use for later operations
rpc SelectAccount(SelectAccountRequest) returns (SelectAccountResponse);
// Set the password for the account in the keybase, used for later operations.
// If the password is wrong, return ErrDecryptionFailed.
rpc SetPassword(SetPasswordRequest) returns (SetPasswordResponse);
// GetActiveAccount gets the active account which was set by SelectAccount.
// If there is no active account, then return ErrNoActiveAccount.
// (To check if there is an active account, use ListKeyInfo and check the
// length of the result.)
rpc GetActiveAccount(GetActiveAccountRequest)
returns (GetActiveAccountResponse);
// QueryAccount retrieves account information from the blockchain for a given
// address.
rpc QueryAccount(QueryAccountRequest) returns (QueryAccountResponse);
// DeleteAccount deletes the account with the given name, using the password
// to ensure access. However, if skip_password is true, then ignore the
// password. If the account doesn't exist, then return ErrCryptoKeyNotFound.
// If the password is wrong, then return ErrDecryptionFailed.
rpc DeleteAccount(DeleteAccountRequest) returns (DeleteAccountResponse);
// Make an ABCI query to the remote node.
rpc Query(QueryRequest) returns (QueryResponse);
// Render calls the Render function for package_path with optional args. The
// package path should include the prefix like "gno.land/". This is similar to
// using a browser URL <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have
// the prefix like "gno.land/".
rpc Render(RenderRequest) returns (RenderResponse);
// QEval evaluates the given expression with the realm code at package_path.
// The package path should include the prefix like "gno.land/". The expression
// is usually a function call like "GetBoardIDFromName(\"testboard\")". The
// return value is a typed expression like
// "(1 gno.land/r/demo/boards.BoardID)\n(true bool)".
rpc QEval(QEvalRequest) returns (QEvalResponse);
// Call a specific realm function.
rpc Call(CallRequest) returns (CallResponse);
// Convert a byte array address to a bech32 string address.
rpc AddressToBech32(AddressToBech32Request) returns (AddressToBech32Response);
// Convert a bech32 string address to a byte array address.
rpc AddressFromBech32(AddressFromBech32Request)
returns (AddressFromBech32Response);
// Hello is for debug purposes
rpc Hello(HelloRequest) returns (HelloResponse);
// HelloStream is for debug purposes
rpc HelloStream(HelloStreamRequest) returns (stream HelloStreamResponse);
}
// The ErrCode enum defines errors for gRPC API functions. These are converted
// from the Go error types returned by gnoclient.
enum ErrCode {
//----------------
// Special errors
//----------------
Undefined = 0; // default value, should never be set manually
TODO = 1; // indicates that you plan to create an error later
ErrNotImplemented = 2; // indicates that a method is not implemented yet
ErrInternal = 3; // indicates an unknown error (without Code), i.e. in gRPC
//----------------
// Generic errors
//----------------
// Parameters and I/O errors
ErrInvalidInput = 100;
ErrBridgeInterrupted = 101;
ErrMissingInput = 102;
ErrSerialization = 103;
ErrDeserialization = 104;
ErrCryptoKeyTypeUnknown = 105;
ErrCryptoKeyNotFound = 106;
ErrNoActiveAccount = 107;
ErrRunGRPCServer = 108;
ErrDecryptionFailed = 109;
ErrUnknownAddress =
110; // indicates that the address is unknown on the blockchain
}
message ErrDetails { repeated ErrCode codes = 1; }