-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathstate_service.proto
93 lines (74 loc) · 3.7 KB
/
state_service.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
syntax = "proto3";
package escrow;
option java_package = "io.singularitynet.daemon.escrow";
option go_package = "../escrow";
// PaymentChannelStateService contains methods to get the MultiPartyEscrow
// payment channel state.
// channel_id, channel_nonce, value and amount fields below in fact are
// Solidity uint256 values. Which are big-endian integers, see
// https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#formal-specification-of-the-encoding
// These values may be or may be not padded by zeros, service supports both
// options.
service PaymentChannelStateService {
// GetChannelState method returns a channel state by channel id.
rpc GetChannelState(ChannelStateRequest) returns (ChannelStateReply) {}
}
// ChanelStateRequest is a request for channel state.
message ChannelStateRequest {
// channel_id contains id of the channel which state is requested.
bytes channel_id = 1;
// signature is a client signature of the message which contains
// channel_id. It is used for client authorization.
bytes signature = 2;
//current block number (signature will be valid only for short time around this block number)
uint64 current_block = 3;
}
// ChannelStateReply message contains a latest channel state. current_nonce and
// current_value fields can be different from ones stored in the blockchain if
// server started withdrawing funds froms channel but transaction is still not
// finished.
message ChannelStateReply {
// current_nonce is a latest nonce of the payment channel.
bytes current_nonce = 1;
// current_signed_amount is a last amount which were signed by client with current_nonce
//it could be absent if none message was signed with current_nonce
bytes current_signed_amount = 2;
// current_signature is a last signature sent by client with current_nonce
// it could be absent if none message was signed with current nonce
bytes current_signature = 3;
// last amount which was signed by client with nonce=current_nonce - 1
bytes old_nonce_signed_amount = 4;
// last signature sent by client with nonce = current_nonce - 1
bytes old_nonce_signature = 5;
//If the client / user chooses to sign upfront , the planned amount in cogs will be indicative of this.
//For pay per use, this will be zero
uint64 planned_amount = 6;
//If the client / user chooses to sign upfront , the usage amount in cogs will be indicative of how much of the
//planned amount has actually been used.
//For pay per use, this will be zero
uint64 used_amount = 7;
}
//Used to determine free calls available for a given user.
service FreeCallStateService {
rpc GetFreeCallsAvailable(FreeCallStateRequest) returns (FreeCallStateReply) {}
}
message FreeCallStateRequest {
//Has the user email id
string user_id = 1;
//signer-token = (user@mail, user-public-key, token_issue_date), this is generated my Market place Dapp
//to leverage free calls from SDK/ snet-cli, you will need this signer-token to be downloaded from Dapp
bytes token_for_free_call = 2;
//Token expiration date in Block number
uint64 token_expiry_date_block = 3 ;
//Signature is made up of the below, user signs with the private key corresponding with the public key used to generate the authorized token
//free-call-metadata = ("__prefix_free_trial",user_id,organization_id,service_id,group_id,current_block,authorized_token)
bytes signature = 4;
//current block number (signature will be valid only for short time around this block number)
uint64 current_block = 5;
}
message FreeCallStateReply {
//Has the user email id
string user_id = 1;
//Balance number of free calls available
uint64 free_calls_available = 2;
}