v2: changed gen contract flow

Signed-off-by: nfel <nfilsaraee@gmail.com>
This commit is contained in:
nfel 2025-05-18 11:06:28 +03:30
parent b796181b0a
commit d9c2be7657
Signed by: nfel
GPG Key ID: DCC0BF3F92B0D45F
2 changed files with 27 additions and 43 deletions

View File

@ -9,9 +9,7 @@ import "base/v1/msg.proto";
INTERNAL DATA INTERNAL DATA
*/ */
message InternalTransactionData { message InternalTransactionData { int64 transaction_id = 1; }
int64 transaction_id = 1;
}
/* /*
Federation Federation
@ -138,9 +136,7 @@ enum AssetType {
ASSET_TYPE_NETWORK_GAS = 3; ASSET_TYPE_NETWORK_GAS = 3;
} }
message AssetList { message AssetList { repeated Asset list = 1; }
repeated Asset list = 1;
}
message AssetFilter { message AssetFilter {
repeated int64 ids = 1; repeated int64 ids = 1;
@ -153,7 +149,7 @@ message AssetFilter {
optional bool can_deposit = 8; optional bool can_deposit = 8;
optional bool can_withdraw = 9; optional bool can_withdraw = 9;
optional bool is_active = 10; optional bool is_active = 10;
optional string search = 11; // Not yet implemented ! optional string search = 11; // Not yet implemented !
} }
message AssetDiscountReq { message AssetDiscountReq {
@ -185,9 +181,7 @@ message GetAssetReq {
optional string code = 3; optional string code = 3;
} }
message AssetMeta { message AssetMeta { PropertyMeta property = 1; }
PropertyMeta property = 1;
}
message PropertyMeta { message PropertyMeta {
string description = 1; string description = 1;
@ -271,7 +265,8 @@ message UserBNPLReq {
optional float amount = 7; optional float amount = 7;
optional PaymentPeriodInfo payment_period = 8; optional PaymentPeriodInfo payment_period = 8;
optional bool has_agreed_contract = 9; optional bool has_agreed_contract = 9;
optional int32 current_step = 10; // Can be useful for admin to change the current step optional int32 current_step =
10; // Can be useful for admin to change the current step
optional int64 asset_id = 11; optional int64 asset_id = 11;
} }
@ -295,9 +290,7 @@ message BNPLInfo {
string expires_at = 14; string expires_at = 14;
} }
message BNPLList { message BNPLList { repeated BNPLInfo list = 1; }
repeated BNPLInfo list = 1;
}
/* /*
Transaction Transaction
@ -437,9 +430,7 @@ message RedeemTokenRes {
optional auth.v1.BankInfo bank_info = 10; optional auth.v1.BankInfo bank_info = 10;
optional string receipt = 11; optional string receipt = 11;
} }
message RedeemTokenResList { message RedeemTokenResList { repeated RedeemTokenRes list = 1; }
repeated RedeemTokenRes list = 1;
}
/* /*
Utility: Get Public Key from national id Utility: Get Public Key from national id
@ -450,9 +441,7 @@ message NationalIDReq {
string national_id = 2; string national_id = 2;
} }
message PubKeyRes { message PubKeyRes { string pub_key = 1; }
string pub_key = 1;
}
/* /*
Network Details Network Details
@ -478,9 +467,7 @@ message Network {
string created_at = 11; string created_at = 11;
} }
message NetworkList { message NetworkList { repeated Network list = 1; }
repeated Network list = 1;
}
/* /*
* Commission * Commission
@ -552,9 +539,7 @@ message IPGConfirmReq {
string final_amount = 7; string final_amount = 7;
} }
message IPGConfirmRes { message IPGConfirmRes { string receipt_link = 1; }
string receipt_link = 1;
}
message SaleManualReq { message SaleManualReq {
auth.v1.InternalIAM iam = 1; auth.v1.InternalIAM iam = 1;
@ -593,9 +578,18 @@ message BuyAssetReq {
double amount_irt = 3; double amount_irt = 3;
double amount_asset = 4; double amount_asset = 4;
BuyAssetSide side = 5; BuyAssetSide side = 5;
optional uint64 aggreement_id = 6; // Only in asset that require agreement contract optional string discount_code = 6;
optional string discount_code = 7; }
optional auth.v1.TFA tfa = 8; // This might be used in the future
message DeclineBuyContractReq{
auth.v1.InternalIAM iam = 1;
uint64 aggreement_id = 2;
}
message ConfirmBuyAssetReq {
auth.v1.InternalIAM iam = 1;
uint64 aggreement_id = 2; // Only in asset that require agreement contract
optional auth.v1.TFA tfa = 3; // This might be used in the future
} }
enum BuyAssetSide { enum BuyAssetSide {
@ -604,16 +598,11 @@ enum BuyAssetSide {
} }
message CalcBuyAssetRes { message CalcBuyAssetRes {
// int64 id = 1;
// Wallet wallet = 1;
// Asset asset = 2;
// double amount = 4;
BuyAssetSide side = 1; BuyAssetSide side = 1;
double calculated_irt_amount = 2; double calculated_irt_amount = 2;
double calculated_asset_amount = 3; double calculated_asset_amount = 3;
EffectiveCommission commission = 4; EffectiveCommission commission = 4;
optional AssetDiscountRes discount_detail = 5; optional AssetDiscountRes discount_detail = 5;
// double buy_min_amount = 7;
} }
message BuyAssetRes { message BuyAssetRes {
@ -631,13 +620,6 @@ enum ContractType {
CONTRACT_TYPE_REDEEM = 3; CONTRACT_TYPE_REDEEM = 3;
} }
message GenerateContractReq {
auth.v1.InternalIAM iam = 1;
int64 asset_id = 2;
int64 amount = 3;
ContractType contract_type = 4;
map<string, string> metadata = 5;
}
message ContractRes { message ContractRes {
string link = 1; string link = 1;

View File

@ -65,8 +65,10 @@ service WalletService {
// --- Buy Asset --- // --- Buy Asset ---
rpc CalcBuyAsset(BuyAssetReq) returns (CalcBuyAssetRes); rpc CalcBuyAsset(BuyAssetReq) returns (CalcBuyAssetRes);
rpc BuyAsset(BuyAssetReq) returns (BuyAssetRes); rpc BuyAsset(ConfirmBuyAssetReq) returns (BuyAssetRes);
// -- Contract -- // -- Contract --
rpc GenerateContract(GenerateContractReq) returns (ContractRes); rpc GenerateBuyContract(BuyAssetReq) returns (ContractRes);
rpc DeclineBuyContract(DeclineBuyContractReq) returns (base.v1.StatusRes);
// rpc GenerateMarketContract(MarketContractReq) returns (ContractRes);
} }