Skip to content

Commit 83e0e04

Browse files
authored
Merge pull request #933 from IntersectMBO/mgalazyn/fix/rpc-js-numbers-precision-fix
cardano-rpc | Encode coin as String in JavaScript
2 parents 1168bbe + d27850e commit 83e0e04

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

cardano-rpc/proto/utxorpc/v1alpha/cardano/cardano.proto

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package utxorpc.v1alpha.cardano;
55
// Represents a transaction output in the Cardano blockchain.
66
message TxOutput {
77
bytes address = 1; // Address receiving the output.
8-
uint64 coin = 2; // Amount of ADA in the output.
8+
uint64 coin = 2 [jstype = JS_STRING]; // Amount of ADA in the output.
99
repeated MultiAsset assets = 3; // Additional native (non-ADA) assets in the output.
1010
Datum datum = 4; // Plutus data associated with the output.
1111
Script script = 5; // Script associated with the output.
@@ -22,12 +22,13 @@ message Datum {
2222
bytes original_cbor = 3; // Original cbor-encoded data as seen on-chain
2323
}
2424

25-
// TODO u5c: mint_coin made optional
2625
// Represents a custom asset in the Cardano blockchain.
2726
message Asset {
2827
bytes name = 1; // Name of the custom asset.
29-
uint64 output_coin = 2; // Quantity of the custom asset in case of an output.
30-
optional int64 mint_coin = 3; // Quantity of the custom asset in case of a mint.
28+
oneof quantity {
29+
uint64 output_coin = 2 [jstype = JS_STRING]; // Quantity of the custom asset in case of an output.
30+
int64 mint_coin = 3 [jstype = JS_STRING]; // Quantity of the custom asset in case of a mint.
31+
}
3132
}
3233

3334
// TODO u5c: redeemer was removed
@@ -51,8 +52,8 @@ message Script {
5152
// Represents a rational number as a fraction.
5253
// TODO u5c increased precision to 64 bits
5354
message RationalNumber {
54-
int64 numerator = 1;
55-
uint64 denominator = 2;
55+
int64 numerator = 1 [jstype = JS_STRING];
56+
uint64 denominator = 2 [jstype = JS_STRING];
5657
}
5758

5859
// PARAMS
@@ -88,24 +89,24 @@ message VotingThresholds {
8889
}
8990

9091
message PParams {
91-
uint64 coins_per_utxo_byte = 1; // The number of coins per UTXO byte.
92-
uint64 max_tx_size = 2; // The maximum transaction size.
93-
uint64 min_fee_coefficient = 3; // The minimum fee coefficient.
94-
uint64 min_fee_constant = 4; // The minimum fee constant.
95-
uint64 max_block_body_size = 5; // The maximum block body size.
96-
uint64 max_block_header_size = 6; // The maximum block header size.
97-
uint64 stake_key_deposit = 7; // The stake key deposit.
98-
uint64 pool_deposit = 8; // The pool deposit.
92+
uint64 coins_per_utxo_byte = 1 [jstype = JS_STRING]; // The number of coins per UTXO byte.
93+
uint64 max_tx_size = 2 [jstype = JS_STRING]; // The maximum transaction size.
94+
uint64 min_fee_coefficient = 3 [jstype = JS_STRING]; // The minimum fee coefficient.
95+
uint64 min_fee_constant = 4 [jstype = JS_STRING]; // The minimum fee constant.
96+
uint64 max_block_body_size = 5 [jstype = JS_STRING]; // The maximum block body size.
97+
uint64 max_block_header_size = 6 [jstype = JS_STRING]; // The maximum block header size.
98+
uint64 stake_key_deposit = 7 [jstype = JS_STRING]; // The stake key deposit.
99+
uint64 pool_deposit = 8 [jstype = JS_STRING]; // The pool deposit.
99100
uint64 pool_retirement_epoch_bound = 9; // The pool retirement epoch bound.
100101
uint64 desired_number_of_pools = 10; // The desired number of pools.
101102
RationalNumber pool_influence = 11; // The pool influence.
102103
RationalNumber monetary_expansion = 12; // The monetary expansion.
103104
RationalNumber treasury_expansion = 13; // The treasury expansion.
104-
uint64 min_pool_cost = 14; // The minimum pool cost.
105-
ProtocolVersion protocol_version = 15; // The maximum value size in an output.
106-
uint64 max_value_size = 16; // The maximum value size.
107-
uint64 collateral_percentage = 17; // Percentage of the txfee which must be provided as collateral when including non-native scripts.
108-
uint64 max_collateral_inputs = 18; // The maximum collateral inputs.
105+
uint64 min_pool_cost = 14 [jstype = JS_STRING]; // The minimum pool cost.
106+
ProtocolVersion protocol_version = 15; // The protocol version.
107+
uint64 max_value_size = 16 [jstype = JS_STRING]; // The maximum value size.
108+
uint64 collateral_percentage = 17 [jstype = JS_STRING]; // The collateral percentage.
109+
uint64 max_collateral_inputs = 18 [jstype = JS_STRING]; // The maximum collateral inputs.
109110
CostModels cost_models = 19; // The cost models.
110111
ExPrices prices = 20; // The prices.
111112
ExUnits max_execution_units_per_transaction = 21; // The maximum execution units per transaction.
@@ -116,8 +117,8 @@ message PParams {
116117
uint32 min_committee_size = 26; // The minimum committee size.
117118
uint64 committee_term_limit = 27; // The committee term limit.
118119
uint64 governance_action_validity_period = 28; // The governance action validity period.
119-
uint64 governance_action_deposit = 29; // The governance action deposit.
120-
uint64 drep_deposit = 30; // The drep deposit.
120+
uint64 governance_action_deposit = 29 [jstype = JS_STRING]; // The governance action deposit.
121+
uint64 drep_deposit = 30 [jstype = JS_STRING]; // The drep deposit.
121122
uint64 drep_inactivity_period = 31; // The drep inactivity period.
122123
}
123124

0 commit comments

Comments
 (0)