Skip to content

Commit

Permalink
feat(grpc): add fixed-amount to calc-fee API
Browse files Browse the repository at this point in the history
  • Loading branch information
b00f committed Mar 4, 2024
1 parent 9be2ef5 commit 3c1f883
Show file tree
Hide file tree
Showing 16 changed files with 726 additions and 328 deletions.
38 changes: 33 additions & 5 deletions www/grpc/gen/dart/transaction.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ class CalculateFeeRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CalculateFeeRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
..aInt64(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'amount')
..e<PayloadType>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'payloadType', $pb.PbFieldType.OE, defaultOrMaker: PayloadType.UNKNOWN, valueOf: PayloadType.valueOf, enumValues: PayloadType.values)
..aOB(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fixedAmount')
..hasRequiredFields = false
;

CalculateFeeRequest._() : super();
factory CalculateFeeRequest({
$fixnum.Int64? amount,
PayloadType? payloadType,
$core.bool? fixedAmount,
}) {
final _result = create();
if (amount != null) {
Expand All @@ -172,6 +174,9 @@ class CalculateFeeRequest extends $pb.GeneratedMessage {
if (payloadType != null) {
_result.payloadType = payloadType;
}
if (fixedAmount != null) {
_result.fixedAmount = fixedAmount;
}
return _result;
}
factory CalculateFeeRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
Expand Down Expand Up @@ -212,19 +217,33 @@ class CalculateFeeRequest extends $pb.GeneratedMessage {
$core.bool hasPayloadType() => $_has(1);
@$pb.TagNumber(2)
void clearPayloadType() => clearField(2);

@$pb.TagNumber(3)
$core.bool get fixedAmount => $_getBF(2);
@$pb.TagNumber(3)
set fixedAmount($core.bool v) { $_setBool(2, v); }
@$pb.TagNumber(3)
$core.bool hasFixedAmount() => $_has(2);
@$pb.TagNumber(3)
void clearFixedAmount() => clearField(3);
}

class CalculateFeeResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CalculateFeeResponse', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
..aInt64(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fee')
..aInt64(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'amount')
..aInt64(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fee')
..hasRequiredFields = false
;

CalculateFeeResponse._() : super();
factory CalculateFeeResponse({
$fixnum.Int64? amount,
$fixnum.Int64? fee,
}) {
final _result = create();
if (amount != null) {
_result.amount = amount;
}
if (fee != null) {
_result.fee = fee;
}
Expand Down Expand Up @@ -252,13 +271,22 @@ class CalculateFeeResponse extends $pb.GeneratedMessage {
static CalculateFeeResponse? _defaultInstance;

@$pb.TagNumber(1)
$fixnum.Int64 get fee => $_getI64(0);
$fixnum.Int64 get amount => $_getI64(0);
@$pb.TagNumber(1)
set fee($fixnum.Int64 v) { $_setInt64(0, v); }
set amount($fixnum.Int64 v) { $_setInt64(0, v); }
@$pb.TagNumber(1)
$core.bool hasFee() => $_has(0);
$core.bool hasAmount() => $_has(0);
@$pb.TagNumber(1)
void clearFee() => clearField(1);
void clearAmount() => clearField(1);

@$pb.TagNumber(2)
$fixnum.Int64 get fee => $_getI64(1);
@$pb.TagNumber(2)
set fee($fixnum.Int64 v) { $_setInt64(1, v); }
@$pb.TagNumber(2)
$core.bool hasFee() => $_has(1);
@$pb.TagNumber(2)
void clearFee() => clearField(2);
}

class BroadcastTransactionRequest extends $pb.GeneratedMessage {
Expand Down
8 changes: 5 additions & 3 deletions www/grpc/gen/dart/transaction.pbjson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,23 @@ const CalculateFeeRequest$json = const {
'2': const [
const {'1': 'amount', '3': 1, '4': 1, '5': 3, '10': 'amount'},
const {'1': 'payload_type', '3': 2, '4': 1, '5': 14, '6': '.pactus.PayloadType', '10': 'payloadType'},
const {'1': 'fixed_amount', '3': 3, '4': 1, '5': 8, '10': 'fixedAmount'},
],
};

/// Descriptor for `CalculateFeeRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List calculateFeeRequestDescriptor = $convert.base64Decode('ChNDYWxjdWxhdGVGZWVSZXF1ZXN0EhYKBmFtb3VudBgBIAEoA1IGYW1vdW50EjYKDHBheWxvYWRfdHlwZRgCIAEoDjITLnBhY3R1cy5QYXlsb2FkVHlwZVILcGF5bG9hZFR5cGU=');
final $typed_data.Uint8List calculateFeeRequestDescriptor = $convert.base64Decode('ChNDYWxjdWxhdGVGZWVSZXF1ZXN0EhYKBmFtb3VudBgBIAEoA1IGYW1vdW50EjYKDHBheWxvYWRfdHlwZRgCIAEoDjITLnBhY3R1cy5QYXlsb2FkVHlwZVILcGF5bG9hZFR5cGUSIQoMZml4ZWRfYW1vdW50GAMgASgIUgtmaXhlZEFtb3VudA==');
@$core.Deprecated('Use calculateFeeResponseDescriptor instead')
const CalculateFeeResponse$json = const {
'1': 'CalculateFeeResponse',
'2': const [
const {'1': 'fee', '3': 1, '4': 1, '5': 3, '10': 'fee'},
const {'1': 'amount', '3': 1, '4': 1, '5': 3, '10': 'amount'},
const {'1': 'fee', '3': 2, '4': 1, '5': 3, '10': 'fee'},
],
};

/// Descriptor for `CalculateFeeResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List calculateFeeResponseDescriptor = $convert.base64Decode('ChRDYWxjdWxhdGVGZWVSZXNwb25zZRIQCgNmZWUYASABKANSA2ZlZQ==');
final $typed_data.Uint8List calculateFeeResponseDescriptor = $convert.base64Decode('ChRDYWxjdWxhdGVGZWVSZXNwb25zZRIWCgZhbW91bnQYASABKANSBmFtb3VudBIQCgNmZWUYAiABKANSA2ZlZQ==');
@$core.Deprecated('Use broadcastTransactionRequestDescriptor instead')
const BroadcastTransactionRequest$json = const {
'1': 'BroadcastTransactionRequest',
Expand Down
14 changes: 14 additions & 0 deletions www/grpc/gen/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,13 @@ <h3 id="pactus.CalculateFeeRequest">CalculateFeeRequest</h3>
<td><p>Type of transaction payload. </p></td>
</tr>

<tr>
<td>fixed_amount</td>
<td><a href="#bool">bool</a></td>
<td></td>
<td><p>Indicates that amount should be fixed and includes the fee. </p></td>
</tr>

</tbody>
</table>

Expand All @@ -610,6 +617,13 @@ <h3 id="pactus.CalculateFeeResponse">CalculateFeeResponse</h3>
</thead>
<tbody>

<tr>
<td>amount</td>
<td><a href="#int64">int64</a></td>
<td></td>
<td><p>Calculated amount. </p></td>
</tr>

<tr>
<td>fee</td>
<td><a href="#int64">int64</a></td>
Expand Down
2 changes: 2 additions & 0 deletions www/grpc/gen/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Request message for calculating transaction fee.
| ----- | ---- | ----- | ----------- |
| amount | [int64](#int64) | | Transaction amount. |
| payload_type | [PayloadType](#pactus-PayloadType) | | Type of transaction payload. |
| fixed_amount | [bool](#bool) | | Indicates that amount should be fixed and includes the fee. |



Expand All @@ -155,6 +156,7 @@ Response message containing the calculated transaction fee.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| amount | [int64](#int64) | | Calculated amount. |
| fee | [int64](#int64) | | Calculated transaction fee. |


Expand Down
14 changes: 14 additions & 0 deletions www/grpc/gen/docs/website.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@ CalculateFeeRequest
</td>
<td>Type of transaction payload. </td>
</tr>
<tr>
<td class="fw-bold">fixed_amount</td>
<td>
<a href="#bool">bool</a>
</td>
<td>Indicates that amount should be fixed and includes the fee. </td>
</tr>
</tbody>
</table>
<h3 id="pactus.CalculateFeeResponse">
Expand All @@ -682,6 +689,13 @@ CalculateFeeResponse
<tr><td>Field</td><td>Type</td><td>Description</td></tr>
</thead>
<tbody class="table-group-divider">
<tr>
<td class="fw-bold">amount</td>
<td>
<a href="#int64">int64</a>
</td>
<td>Calculated amount. </td>
</tr>
<tr>
<td class="fw-bold">fee</td>
<td>
Expand Down
1 change: 1 addition & 0 deletions www/grpc/gen/go/transaction.cobra.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3c1f883

Please sign in to comment.