syntax = "proto3"; package tokenstate; import "replica-provider.proto"; message QueryStateTsidRequest {} message QueryStateTsidResponse { bytes stateTsid = 1; } message QueryTeaBalanceRequest { bytes acct = 1; bytes tokenId = 2; } message QueryTeaBalanceResponse { bytes balanceBytes = 1; bytes stateTsid = 2; } message ReadTeaBalanceRequest { bytes ctx = 1; bytes acct = 2; bytes conflictMode = 3; } message ReadDepositBalanceRequest { bytes ctx = 1; bytes acct = 2; bytes conflictMode = 3; } message ReadTeaBalanceResponse { bytes balanceBytes = 1; bytes ctx = 2; } message ReadDepositBalanceResponse{ bytes balanceBytes = 1; bytes ctx = 2; } message QueryTokenBalanceRequest { bytes acct = 1; bytes tokenId = 2; } message QueryTokenBalanceResponse { bytes balanceBytes = 1; bytes stateTsid = 2; } message QueryAppAesRequest { bytes tokenId = 1; } message GenAppAesRequest { bytes ctx = 1; bytes tsidBytes = 2; } message GenAppAesResponse { bytes ctx = 1; bytes newKey = 2; } message GenAppConsumeAcctRequest { bytes ctx = 1; bytes tsidBytes = 2; } message GenAppConsumeAcctResponse { bytes ctx = 1; bytes newKey = 2; } message GetTappstoreAccountRequest { bytes tokenId = 1; } message GetTappstoreAccountResponse { AccountKey key = 1; } message AccountKey { bytes key = 1; } message GenTappstoreAccountRequest { bytes ctx = 1; bytes tsidBytes = 2; } message GenTappstoreAccountResponse { bytes ctx = 1; bytes newKey = 2; } message GetFailedPaymentsRequest { bytes tokenId = 1; } message GetFailedPaymentsResponse { bytes failedPaymentsBytes = 1; bool isEmpty = 2; } message SetFailedPaymentsRequest { bytes ctx = 1; bytes failedPaymentsBytes = 2; } message SetFailedPaymentsResponse { bytes ctx = 1; } message QueryAppAesResponse { bytes key = 1; } message QueryAuthOpsRequest{ bytes authKey = 1; } message QueryAppConsumeBalanceRequest{ bytes tokenId = 1; } message QueryAppConsumeBalanceResponse{ bytes balanceBytes = 1; } message SetAuthOpsRequest{ bytes authKey = 1; bytes authOpsBytes = 2; bytes ctx = 3; bytes tokenId = 4; bytes acct = 5; } message SetAuthOpsResponse{ bytes ctx = 1; } message ExtendAuthKeyRequest{ bytes authKey = 1; bytes newExpire = 2; } message SetUserLoginSessionKey{ bytes tokenId = 1; bytes acct = 2; bytes authKey = 3; bytes ts = 4; bytes ctx = 5; } message SetUserLoginSessionKeyResponse{ bytes ctx = 1; } //message GetUserLoginSessionKey{ // bytes tokenId = 1; // bytes acct = 2; //} message DepositRequest{ bytes ctx = 1; bytes acct = 2; bytes amt = 3; } message ApiDepositRequest{ bytes ctx = 1; bytes acct = 2; bytes amt = 3; bytes tokenCtx = 4; } message RefundRequest{ bytes ctx = 1; bytes acct = 2; bytes amt = 3; } message ApiRefundRequest { bytes ctx = 1; bytes acct = 2; bytes amt = 3; bytes tokenCtx = 4; } message ConsumeFromDepositRequest{ bytes ctx = 1; bytes acct = 2; bytes amt = 3; } message ConsumeFromAccountRequest{ bytes ctx = 1; bytes acct = 2; bytes amt = 3; } message PaymentFromDepositRequest{ bytes ctx = 1; bytes acct = 2; bytes to = 3; bytes amt = 4; } message BurnConsumeUnbalancedRequest{ bytes ctx = 1; bytes tokenId = 2; bytes amtBytes = 3; } message BurnConsumeUnbalancedResponse{ bytes burntAmtBytes = 1; } message CommitRequest { bytes ctx = 1; bytes authKey = 2;// bincode serde AuthKey GluedbTransactionContext gluedbCtx = 3; optional bytes payeeMinerCtx = 4; optional bytes payeeAppCtx = 5; } message TopupRequest { bytes ctx = 1; bytes to = 2; bytes amt = 3; } message WithdrawRequest { bytes ctx = 1; bytes from = 2; bytes amt = 3; } /// To simplify the coding and process, we did not use One_of the /// protobuf syntax. We just check if ctx bytes is empty, then check /// the error. The protocol here is that if there is error, set the ctx /// to empty bytes message StateOperateResponse { bytes ctx = 1; bytes operateError = 2; } message CrossStateOperateResponse { bytes fromCtx = 1; bytes toCtx = 2; bytes operateError = 3; } message ApiStateOperateResponse { bytes ctx = 1; bytes tokenCtx = 2; bytes operateError = 3; } message StateCommitResponse { bytes hiddenAcctCredit = 2; bytes hiddenAcctDebit = 3; bytes statementsBytes = 4; } message ExportStateRequest { } message ExportStateResponse { bytes data = 1; bytes tsid = 2; bytes teaHash = 3; bytes tokenHash = 4; bytes keysHash = 5; uint64 magicNumber = 6; } message ImportStateRequest { bytes data = 1; } message ImportStateResponse { bytes tsid = 1; uint64 stateMagicNumber = 2; } message ExportGlueSqlRequest {} message ExportGlueSqlResponse { bytes data = 1; bytes globalDbHash = 2; } message ImportGlueSqlRequest { bytes data = 1; } message InitGlueSqlRequest { bytes tokenId = 1; bytes tsid = 2; } message ExecGlueSqlRequest { bytes tokenId = 1; string sql = 2; bytes tsid = 3; } message ExecGlueQueryRequest { bytes tokenId = 1; string sql = 2; } message ExecGlueQueryResponse { repeated bytes payloads = 1; } message StatePing { Checkpoint checkpoint = 1; ExecCursor execCursor = 2; replica.ValidatorsState validatorsState = 3; } message StatePong { Checkpoint checkpoint = 1; ExecCursor execCursor = 2; replica.ValidatorsState validatorsState = 3; } message Checkpoint { int64 timestamp = 1; bytes globalHash = 3; bytes gluedbHash = 4; bytes RoundTableHash = 5; bytes stateBalancesHash = 6; bytes stateKeysHash = 7; uint64 stateMagicNumber = 8; } message ExecCursor { bytes execCursor = 1; } message SyncStateRequest { Checkpoint checkpoint = 1; ExecCursor execCursor = 2; } message SyncStateResponse { int64 lastCheckpointTimestamp = 1; CheckpointData checkpoint = 2; repeated HistoryItem historyItems = 3; bytes tsid = 4; GluedbData gluedb = 5; RoundTableData roundTable = 6; bool success = 7; uint64 stateMagicNumber = 8; } message CheckpointData { bytes data = 1; bytes balancesHash = 2; bytes keysHash = 3; } message HistoryItem { bytes tsid = 1; bytes txn = 2; optional bytes args = 3; } message GluedbData { bytes gluedb = 1; bytes globalDbHash = 2; } message RoundTableData { bytes roundTable = 1; } message GetConsumeAccountRequest{ bytes tokenId = 1; } // Top level message send to state receiver message StateReceiverMessage { string uuid = 1; oneof msg { StateCommand StateCommand = 2; StateFollowup StateFollowup = 3; StateQuery StateQuery = 4; TxnFollowupPair TxnFollowupPair = 5; } optional string from_token = 6; } // Top level message response from state receiver message StateReceiverResponse { string uuid = 1; bool success = 2; string errorMessage = 3; oneof msg { DirectResponse DirectResponse = 4; CommandFollowupResponse CommandFollowupResponse = 5; GeneralQueryResponse GeneralQueryResponse = 6; // this is a error response, means the requesting A node is not validator InvalidValidatorResponse InvalidValidatorResponse = 7; } } message InvalidValidatorResponse { // returns the current validators that the A node belives repeated bytes validators = 1; repeated string connIds = 2; } message GeneralQueryResponse { bytes data = 1; } message TxnFollowupPair { StateCommand txn = 1; StateFollowup followup = 2; } message StateCommand { bytes data = 1; bytes target = 2; uint64 nonce = 3; bytes pre_args = 4; uint64 gas_limit = 5; } message StateFollowup { bytes data = 1; } message StateQuery { bytes data = 1; } // Direct response do not return something meaningful, it just indicates that // the request has been relayed successfully, and may return real result in // another response message DirectResponse {} message CommandFollowupResponse { bytes ts = 1; bytes hash = 2; bytes sender = 3; } message BeginTransactionRequest { bytes tokenId = 1; } message BeginTransactionResponse { GluedbTransactionContext context = 1; } message CancelTransactionRequest { bytes tokenId = 1; } message IsInTransactionRequest { bytes tokenId = 1; } message IsInTransactionResponse { bool yes = 1; } message GluedbTransactionContext { bytes data = 1; } message AcctBalancePair { bytes account = 1; bytes balance = 2; } message BondingMintRequest { bytes ctx = 1; repeated AcctBalancePair acctBalancePairs = 4; } message BondingMintResponse { bytes ctx = 1; } message BondingBurnRequest { bytes ctx = 1; bytes account = 2; bytes amount = 3; } message BondingBurnResponse { bytes ctx = 1; } message ReadBondingTotalSupplyRequest { bytes ctx = 1; } message ReadBondingTotalSupplyResponse { bytes ctx = 1; bytes totalSupply = 2; } message ReadAllBondingRequest { bytes ctx = 1; } message ReadAllBondingResponse { bytes ctx = 1; bytes accounts = 2; repeated bytes amounts = 3; } message BondingReserveRequest { bytes ctx = 1; bytes account = 2; bytes amount = 3; } message BondingReserveResponse { bytes ctx = 1; } message BondingUnreserveRequest { bytes ctx = 1; bytes account = 2; bytes amount = 3; } message BondingUnreserveResponse { bytes ctx = 1; } message GetTokenTotalSupplyRequest { bytes tokenId = 1; } message GetTokenTotalSupplyResponse { bytes amount = 1; } message ReadTokenBalanceRequest { bytes ctx = 1; bytes account = 2; bytes conflictMode = 3; } message ReadTokenBalanceResponse { bytes amount = 1; bytes ctx = 2; } message GetTokenReservedBalanceRequest { bytes tokenId = 1; } message GetTokenReservedBalanceResponse { bytes amount = 1; } message SlashRequest { bytes ctx = 1; bytes account = 2; bytes amount = 3; } message SlashResponse { bytes ctx = 1; } message HasGlueDbInitRequest { bytes tokenId = 1; } message HasGlueDbInitResponse { bool hasInit = 1; } message SetAllowanceRequest { bytes tokenId = 1; bytes address = 2; bytes amount = 3; } message SetAllowanceResponse{ } message QueryAllowanceRequest { bytes tokenId = 1; bytes address = 2; } message QueryAllowanceResponse{ bytes allowance = 1; } message DeductAllowanceRequest{ bytes address = 2; bytes amount = 3; bytes payeeCtx = 4; } message DeductAllowanceResponse{ bytes payeeCtx = 1; } message RestoreAllowanceRequest{ bytes address = 2; bytes amount = 3; bytes payeeCtx = 4; } message RestoreAllowanceResponse{ bytes payeeCtx = 1; } message PayMinerGasRequest{ bytes tokenId = 1; bytes address = 2; bytes amount = 3; bytes tappstoreCtx = 4; bytes payeeCtx = 5; } message PayMinerGasResponse{ bytes tappstoreCtx = 1; bytes payeeCtx = 2; } message InAppPurchaseRequest{ bytes address = 2; bytes amount = 3; bytes tappstoreCtx = 4; bytes payeeCtx = 5; } message InAppPurchaseResponse{ bytes tappstoreCtx = 1; bytes payeeCtx = 2; } message IterTeaFtStateRequest{ bytes tokenId = 1; } message IterTeaFtStateResponse{ repeated AcctBalancePair acctBalancePairs = 1; }