proto/wallet/v1/msg.proto
2025-04-12 16:04:45 +03:30

511 lines
11 KiB
Protocol Buffer

syntax = "proto3";
package wallet.v1;
import "auth/v1/msg.proto";
import "base/v1/msg.proto";
/*
INTERNAL DATA
*/
message InternalTransactionData { int64 transaction_id = 1; }
/*
Federation
*/
message Federation {
int64 id = 1;
int64 user_id = 2;
string ed_public = 3;
string ed_public_hash = 4;
int32 status = 5;
string created_at = 6;
string system_wallet_address = 7;
}
message GetFederationReq {
optional int64 federation_id = 1;
optional int64 user_id = 2;
optional string ed_public = 3;
optional string ed_public_hash = 4;
}
/*
Asset
*/
message AssetList { repeated Asset list = 1; }
message Asset {
int64 id = 1;
string name = 2;
string code = 3;
string issuer = 4;
int32 decimal = 5;
double limit_amount = 6;
string anchor = 7;
string image = 8;
string description = 9;
string url = 10;
int64 buy_unit_price = 11;
int64 sell_unit_price = 12;
double buy_min_amount = 13;
double buy_max_amount = 14;
double sell_min_amount = 15;
double sell_max_amount = 16;
double buy_fee_amount = 17;
int64 buy_fee_price = 18;
double sell_fee_amount = 19;
int64 sell_fee_price = 20;
double withdraw_min_amount = 21;
double withdraw_max_amount = 22;
bool is_active = 23;
bool can_buy = 24;
bool can_sell = 25;
bool can_deposit = 26;
bool can_withdraw = 27;
string updated_at = 28;
string created_at = 29;
repeated string images = 30;
int32 status = 31;
AssetMeta meta = 32;
string type = 33;
AssetPrice price = 34;
bool is_base_asset = 35;
bool is_locked = 36;
}
message AssetPrice {
string updated_at = 1;
double market_price = 2;
double admin_price = 3;
}
message GetAssetReq {
optional int64 id = 1;
optional string code = 3;
}
message AssetMeta { PropertyMeta property = 1; }
message PropertyMeta {
string description = 1;
string builder_description = 2;
string white_paper_url = 3;
string expert_report_url = 4;
string project_catalog_url = 5;
string ownership_document_url = 6;
double total_area_meters = 7;
int32 total_unit_count = 8;
string usage_type = 9;
string completion_date = 10;
string user_agreement_url = 11;
}
/*
BNPL - not really but close name
*/
// enum BNPLPgState {
//
// }
message GetUserBNPLInfoReq {
auth.v1.InternalIAM iam = 1;
base.v1.IdReq id = 2;
}
enum BNPLPaymentsStatus {
PENDING_PAYMENT = 0;
PAYED = 1;
OVER_DUE = 2;
NOT_STARTED = 3;
NOT_YET_DUE = 4;
CANCELED = 5;
REJECTED = 6;
}
message BNPLPayments {
uint64 id = 1;
double amount = 2;
double amount_irr = 7;
bool is_paied = 3;
string due_date = 4;
string settlement_date = 5;
BNPLPaymentsStatus status = 6;
}
message UserBNPLResp {
uint64 id = 1;
BNPLInfo bnpl = 2;
int32 current_step = 3;
optional float amount = 4;
optional PaymentPeriodInfo payment_period = 5;
optional bool accepted_terms = 6;
repeated BNPLPayments payments = 7;
optional string employee_id = 8;
optional auth.v1.Company company = 10;
auth.v1.InternalIAM iam = 11;
optional string updated_at = 12;
optional string created_at = 13;
Asset selected_asset = 14;
optional string rejection_reason = 15;
}
message UserBNPLReq {
uint64 id = 1;
int64 bnpl_id = 2;
auth.v1.InternalIAM iam = 6;
optional string created_at = 3;
optional string employee_id = 4;
optional int64 company_id = 5;
optional float amount = 7;
optional PaymentPeriodInfo payment_period = 8;
optional bool has_agreed_contract = 9;
optional int32 current_step =
10; // Can be useful for admin to change the current step
optional int64 asset_id = 11;
}
message PaymentPeriodInfo {
uint64 id = 1;
uint64 period = 2;
bool enabled = 3;
}
message BNPLInfo {
uint64 id = 1;
string description = 3;
repeated Asset supported_assets = 2;
optional bool enabled = 4;
float amount_start = 5;
float amount_end = 6;
float amount_steps = 7;
repeated PaymentPeriodInfo payment_period = 8;
repeated auth.v1.Company possible_companies = 11;
string updated_at = 12;
string created_at = 13;
string expires_at = 14;
}
message BNPLList { repeated BNPLInfo list = 1; }
/*
Wallet
*/
message WalletList {
repeated Wallet list = 1;
// optional base.v1.Pagination pagination = 2;
double available_balance = 3;
double locked_balance = 4;
double total_balance = 5;
}
message Wallet {
int64 id = 1;
int64 user_id = 2;
int64 asset_id = 3;
Asset asset_info = 4;
int64 federation_id = 5;
Federation federation_info = 6;
double balance = 7;
double frozen_balance = 8;
string updated_at = 9;
string created_at = 10;
string wallet_code = 11;
bool accepted_terms = 12;
bool is_locked = 13;
}
// Frozen Asset is asset locked due to reservation
message FrozenAsset {
uint64 id = 1;
int64 asset_id = 2;
int64 wallet_id = 4;
double amount = 5;
string created_at = 6;
string updated_at = 7;
optional string expires_at = 8;
}
message UserInitWalletReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
}
/*
Transaction
*/
message TransactionList {
repeated Transaction list = 1;
int64 total_count = 2;
}
enum TransactionType {
UNKNOWN = 0;
BUY = 1;
SELL = 2;
INTERNAL_TRANSFER = 3;
EXTERNAL_TRANSFER = 4;
REDEEM = 5;
TRUST_LINE = 6;
WAGE = 7;
EXTERNAL_DEPOSIT = 8;
INTERNAL_DEPOSIT = 9;
MARKETPLACE_BUY = 10;
MARKETPLACE_SELL = 11;
LOCK = 12;
}
enum TransactionStatus {
UNDETERMINED = 0;
FAILED = -10;
SUSPENDED = -9;
CREATED = -1;
PENDING_TRX = 1;
SUCCESSFUL = 2;
}
message Transaction {
int64 id = 1;
int64 asset_id = 2;
// Asset asset_info = 3; //Causing network overloading
optional int64 from_user_id = 4;
optional auth.v1.UserIdentityBasic from_user_info = 5;
optional int64 from_federation_id = 6;
optional Federation from_federation_info = 7;
optional int64 to_user_id = 8;
optional auth.v1.UserIdentityBasic to_user_info = 9;
optional int64 to_federation_id = 10;
optional Federation to_federation_info = 11;
double amount = 12;
TransactionStatus status = 13;
TransactionType type = 14;
string updated_at = 15;
string created_at = 16;
string tracking_code = 17;
optional string trx_hash = 18;
optional string from_public_key = 19;
optional string to_public_key = 20;
double token_price = 21;
}
message UserGetTransactionListReq {
auth.v1.InternalIAM iam = 1;
optional int32 page_index = 2;
optional int32 page_size = 3;
optional int64 id = 4;
optional int64 asset_id = 5;
optional int64 from_user_id = 6;
optional int64 from_federation_id = 7;
optional int64 to_user_id = 8;
optional int64 to_federation_id = 9;
optional double amount_from = 10;
optional double amount_to = 11;
optional string tracking_code = 12;
repeated TransactionType type = 13;
repeated TransactionStatus status = 14;
optional string from_date = 15;
optional string to_date = 16;
}
/*
Buy
*/
message UserBuyAssetReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
double amount = 3;
}
/*
Sell
*/
/*
Transfer
*/
message TransferAssetReq {
auth.v1.InternalIAM iam = 1;
auth.v1.Recipient recipient = 2;
double amount = 3;
optional int64 network_id = 4;
int64 asset_id = 5;
optional bool approval = 6;
optional auth.v1.TFA tfa = 7;
}
message TransferAssetRes {
auth.v1.Recipient recipient = 1;
double amount = 2;
// TODO: Change to Asset
int64 transaction_id = 3;
string transaction_hash = 4;
}
// represent the information regarding the withdraw in bank
message BalanceReq {
auth.v1.InternalIAM iam = 1;
auth.v1.BankInfo bank_info = 2; //BankInfo
}
message WithdrawReceipt { string code = 1; }
message DepositReq{
auth.v1.BankInfo bank_info = 1; //BankInfo
double amount = 2;
}
// represent the information regarding the sale of the token
message SaleGetTokenReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
double amount = 3;
optional uint64 discount_code = 4;
}
// represent the information regarding the ipg gateway
message SaleGetTokenRes {
string url = 1;
int64 unit_price = 2;
int64 total_price = 3;
double amount = 4;
string asset = 5;
optional uint64 discount_code = 6;
}
message SaleConfirmReq {
string ref_id = 1;
string res_code = 2;
string sale_order_id = 3;
string sale_reference_id = 4;
string card_holder_info = 5;
string card_holder_pan = 6;
string final_amount = 7;
optional uint64 discount_code = 8;
}
message SaleConfirmRes { string receipt_link = 1; }
message SaleManualReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
double amount = 3;
string paid_at = 4;
string rrn = 5;
string national_id = 6;
optional uint64 discount_code = 7;
}
/*
Redeem Token
*/
message RedeemTokenReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
uint64 bank_info_id = 3;
double amount = 4;
optional string tfa_code = 5;
}
message CalculateRedeemTokenRes {
Asset asset = 1;
double free_balance = 2;
double total_balance = 3;
double request_amount = 4;
double profit_capital = 5;
double user_capital = 6;
optional auth.v1.BankInfo bank_info = 7;
}
message RedeemTokenRes {
uint64 id = 1;
int64 user_id = 2;
Asset asset = 3;
double free_balance = 4;
double total_balance = 5;
double request_amount = 6;
string created_at = 7;
bool is_paied = 8;
// receipt.Receipt receipt = 8;
double calculated_profit = 9;
optional auth.v1.BankInfo bank_info = 10;
optional string receipt = 11;
}
message RedeemTokenResList { repeated RedeemTokenRes list = 1; }
message GetPublicKeyByNationalIDReq {
auth.v1.InternalIAM iam = 1;
string national_id = 2;
}
message GetPublicKeyByNationalIDRes { string pub_key = 1; }
/*
Network Details
*/
enum NetworkType {
UNKNOWN_NETWORK_TYPE = 0;
ETH = 1;
XLM = 2;
BTC = 3;
}
message Network {
int64 id = 1;
string name = 2;
string code = 3;
string explorer = 4;
int64 gas_asset_id = 5;
string description = 6;
NetworkType type = 7;
bool is_active = 8;
string image = 9;
string updated_at = 10;
string created_at = 11;
}
message NetworkList { repeated Network list = 1; }
message Commission {
uint64 id = 1;
string name = 2;
double service = 3;
double tax = 4;
double total = 5;
string collector = 6;
optional string description = 7;
string updated_at = 10;
string created_at = 11;
}
message LockAssetReq {
int64 asset_id = 1;
double amount = 2;
auth.v1.InternalIAM iam = 3;
optional auth.v1.TFA tfa = 4; // if request is not internal
}
message AssetDiscountReq {
auth.v1.InternalIAM iam = 1;
string code = 2;
int64 asset_id = 3;
optional double amount = 4; // calculate discount amount
}
message AssetDiscountRes {
uint64 id = 1;
string code = 2;
string expires_at = 3;
double static_amount = 4;
double percentage = 5;
double max_amount = 6;
optional int64 supported_asset = 7;
optional double discount_amount =
8; // based of asset price and discount amount in req
}