Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions documentation.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,22 @@
}
}
},
"/v1/escrow/PostEscrowApprovalRequest": {
"post": {
"tags": [
"EscrowTransactionService"
],
"operationId": "PostApprovalEscrowTransaction",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/modelTransaction"
}
}
}
}
},
"/v1/host/GetHostInfo": {
"get": {
"tags": [
Expand Down Expand Up @@ -965,6 +981,57 @@
"modelEmptyTransactionBody": {
"type": "object"
},
"modelEscrow": {
"type": "object",
"properties": {
"Amount": {
"type": "string",
"format": "int64"
},
"ApproverAddress": {
"type": "string"
},
"BlockHeight": {
"type": "integer",
"format": "int64"
},
"Commission": {
"type": "string",
"format": "int64"
},
"ID": {
"type": "string",
"format": "int64"
},
"Latest": {
"type": "boolean",
"format": "boolean"
},
"RecipientAddress": {
"type": "string"
},
"SenderAddress": {
"type": "string"
},
"Status": {
"$ref": "#/definitions/modelEscrowStatus"
},
"Timeout": {
"type": "string",
"format": "uint64",
"title": "Timeout is BlockHeight gap"
}
}
},
"modelEscrowStatus": {
"type": "string",
"default": "Approved",
"enum": [
"Approved",
"Rejected",
"Expired"
]
},
"modelEventType": {
"type": "string",
"default": "EventAny",
Expand Down Expand Up @@ -1324,6 +1391,9 @@
"type": "integer",
"format": "int64"
},
"Escrow": {
"$ref": "#/definitions/modelEscrow"
},
"FeePerByte": {
"type": "string",
"format": "int64"
Expand Down Expand Up @@ -1734,6 +1804,10 @@
"type": "string",
"format": "int64"
},
"Escrow": {
"title": "nullable",
"$ref": "#/definitions/modelEscrow"
},
"Fee": {
"type": "string",
"format": "int64"
Expand Down
33 changes: 33 additions & 0 deletions model/escrow.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";

package model;
option go_package = "github.com/zoobc/zoobc-core/common/model";

message Escrow {
int64 ID = 1 [ jstype = JS_STRING ];
string SenderAddress = 2;
string RecipientAddress = 3;
string ApproverAddress = 4;
int64 Amount = 5 [ jstype = JS_STRING ];
int64 Commission = 6 [ jstype = JS_STRING ];
// Timeout is BlockHeight gap
uint64 Timeout = 7 [ jstype = JS_STRING ];
EscrowStatus Status = 8;
uint32 BlockHeight = 9;
bool Latest = 10;
}
enum EscrowStatus {
Approved = 0;
Rejected = 1;
Expired = 2;
}

enum EscrowApproval {
Approve = 0;
Reject = 1;
}
// PostEscrowApprovalRequest message for approval transaction escrow
message PostEscrowApprovalRequest {
// ApprovalBytes format: [EscrowApproval][int64 TransactionID]
bytes ApprovalBytes = 1;
}
4 changes: 3 additions & 1 deletion model/mempool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package model;
option go_package = "github.com/zoobc/zoobc-core/common/model";

import "model/pagination.proto";

import "model/escrow.proto";
// Mempool represent the mempool data structure stored in the database
message MempoolTransaction {
int64 ID = 1 [jstype = JS_STRING];
Expand All @@ -14,6 +14,8 @@ message MempoolTransaction {
bytes TransactionBytes = 5;
string SenderAccountAddress = 6;
string RecipientAccountAddress = 7;
Escrow Escrow = 8;

}

message GetMempoolTransactionRequest {
Expand Down
3 changes: 3 additions & 0 deletions model/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "model/proofOfOwnership.proto";
import "model/pagination.proto";
import "model/batchReceipt.proto";
import "model/nodeRegistration.proto";
import "model/escrow.proto";

// Transaction represent the transaction data structure stored in the database
message Transaction {
Expand Down Expand Up @@ -35,6 +36,8 @@ message Transaction {
RemoveAccountDatasetTransactionBody removeAccountDatasetTransactionBody = 21;
}
bytes Signature = 22;
// nullable
Escrow Escrow = 23;
}

enum TransactionType {
Expand Down
16 changes: 16 additions & 0 deletions service/escrow.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package service;
option go_package = "github.com/zoobc/zoobc-core/common/service";

import "model/transaction.proto";
import "model/escrow.proto";
import "google/api/annotations.proto";

service EscrowTransactionService {
rpc PostApprovalEscrowTransaction(model.PostEscrowApprovalRequest) returns (model.Transaction) {
option (google.api.http) = {
post: "/v1/escrow/PostEscrowApprovalRequest"
};
}
}