Skip to content

Commit

Permalink
Merge branch 'main' into feat/cip509-metadata-indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
saibatizoku authored Sep 24, 2024
2 parents 7124987 + 28cb3c5 commit c3c6277
Show file tree
Hide file tree
Showing 24 changed files with 944 additions and 134 deletions.
7 changes: 6 additions & 1 deletion catalyst_voices/Earthfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VERSION 0.8

IMPORT ../catalyst-gateway AS catalyst-gateway
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.04 AS flutter-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.06 AS flutter-ci

# Copy all the necessary files and running bootstrap
builder:
Expand Down Expand Up @@ -52,6 +52,11 @@ check-package-publishing:
FROM +builder
DO flutter-ci+PUBLISH_DRY_RUN

# Runs the license checks for Catalyst Voices.
check-license:
FROM +builder
RUN melos run license-check

# Run unit tests
test-unit:
FROM +builder
Expand Down
23 changes: 1 addition & 22 deletions catalyst_voices/lib/pages/workspace/workspace_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:catalyst_voices/pages/workspace/proposal_navigation_panel.dart';
import 'package:catalyst_voices/pages/workspace/proposal_segment_controller.dart';
import 'package:catalyst_voices/pages/workspace/proposal_setup_panel.dart';
import 'package:catalyst_voices/pages/workspace/sample_rich_text.dart';
import 'package:catalyst_voices/pages/workspace/sample_rich_text2.dart';
import 'package:catalyst_voices/pages/workspace/sample_rich_text3.dart';
import 'package:catalyst_voices/widgets/widgets.dart';
import 'package:catalyst_voices_models/catalyst_voices_models.dart';
import 'package:flutter/material.dart';
Expand All @@ -17,31 +15,12 @@ final _proposalNavigation = WorkspaceProposalNavigation(
WorkspaceProposalSetup(
id: _setupSegmentId,
steps: [
const WorkspaceProposalSegmentStep(
id: 0,
title: 'Title',
description: 'F14 / Promote Social Entrepreneurs and a '
'longer title up-to 60 characters',
isEditable: true,
),
WorkspaceProposalSegmentStep(
id: 1,
id: 0,
title: 'Rich text',
document: Document.fromJson(sampleRichText),
isEditable: true,
),
WorkspaceProposalSegmentStep(
id: 2,
title: 'Other topic',
document: Document.fromJson(sampleRichText2),
isEditable: false,
),
WorkspaceProposalSegmentStep(
id: 3,
title: 'Other topic',
document: Document.fromJson(sampleRichText3),
isEditable: false,
),
],
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class _Editor extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: ResizableBoxParent(
minHeight: 320,
minHeight: 470,
resizableVertically: true,
resizableHorizontally: false,
child: DecoratedBox(
Expand Down
2 changes: 1 addition & 1 deletion catalyst_voices/uikit_example/Earthfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VERSION 0.8

IMPORT ../ AS catalyst-voices
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.04 AS flutter-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.06 AS flutter-ci

# local-build-web - build web version of UIKit example.
# Prefixed by "local" to make sure it's not auto triggered, the target was
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ Future<void> main() async {
}
Transaction _buildUnsignedTx({
required List<TransactionUnspentOutput> utxos,
required Set<TransactionUnspentOutput> utxos,
required ShelleyAddress changeAddress,
}) {
const txBuilderConfig = TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 15,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class _WalletDetailsState extends State<_WalletDetails> {
List<ShelleyAddress>? _rewardAddresses;
List<ShelleyAddress>? _unusedAddresses;
List<ShelleyAddress>? _usedAddresses;
List<TransactionUnspentOutput>? _utxos;
Set<TransactionUnspentOutput>? _utxos;
PubDRepKey? _pubDRepKey;
List<PubStakeKey>? _registeredPubStakeKeys;
List<PubStakeKey>? _unregisteredPubStakeKeys;
Expand Down Expand Up @@ -450,7 +450,7 @@ String _formatBalance(Balance? balance) {
return buffer.toString();
}

String _formatUtxos(List<TransactionUnspentOutput>? utxos) {
String _formatUtxos(Set<TransactionUnspentOutput>? utxos) {
if (utxos == null) {
return '---';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Future<void> _signAndSubmitRbacTx({
}

Future<X509MetadataEnvelope<RegistrationData>> _buildMetadataEnvelope({
required List<TransactionUnspentOutput> utxos,
required Set<TransactionUnspentOutput> utxos,
required ShelleyAddress rewardAddress,
}) async {
final seed = List.generate(
Expand Down Expand Up @@ -152,7 +152,7 @@ Future<X509MetadataEnvelope<RegistrationData>> _buildMetadataEnvelope({
}

Transaction _buildUnsignedRbacTx({
required List<TransactionUnspentOutput> inputs,
required Set<TransactionUnspentOutput> inputs,
required ShelleyAddress changeAddress,
required ShelleyAddress rewardAddress,
required AuxiliaryData auxiliaryData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Future<void> _signAndSubmitTx({
}

Transaction _buildUnsignedTx({
required List<TransactionUnspentOutput> utxos,
required Set<TransactionUnspentOutput> utxos,
required ShelleyAddress changeAddress,
}) {
/* cSpell:disable */
Expand Down Expand Up @@ -81,9 +81,10 @@ Transaction _buildUnsignedTx({

TransactionBuilderConfig _buildTransactionBuilderConfig() {
return const TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 15,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION 0.8
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.04 AS flutter-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.06 AS flutter-ci

deps:
FROM mcr.microsoft.com/playwright:v1.45.2-jammy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ abstract interface class CardanoWalletApi {
/// specified in amount, and if this cannot be attained,
/// null shall be returned. The results can be further paginated by
/// [paginate] if it is not null.
Future<List<TransactionUnspentOutput>> getUtxos({
Future<Set<TransactionUnspentOutput>> getUtxos({
Balance? amount,
Paginate? paginate,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class JSCardanoWalletApiProxy implements CardanoWalletApi {
}

@override
Future<List<TransactionUnspentOutput>> getUtxos({
Future<Set<TransactionUnspentOutput>> getUtxos({
Balance? amount,
Paginate? paginate,
}) async {
Expand All @@ -183,7 +183,7 @@ class JSCardanoWalletApiProxy implements CardanoWalletApi {
paginate != null ? JSPaginate.fromDart(paginate) : makeUndefined(),
);

if (utxos == null) return [];
if (utxos == null) return {};

return await utxos.toDart.then(
(array) => array.toDart
Expand All @@ -192,7 +192,7 @@ class JSCardanoWalletApiProxy implements CardanoWalletApi {
cbor.decode(hex.decode(item.toDart)),
),
)
.toList(),
.toSet(),
);
} catch (ex) {
throw _mapApiException(ex) ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ import 'package:convert/convert.dart';
/* cSpell:disable */
void main() {
const txBuilderConfig = TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 0,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import 'package:convert/convert.dart';
/* cSpell:disable */
void main() {
const txBuilderConfig = TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 15,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down Expand Up @@ -58,7 +59,7 @@ void main() {

final txBuilder = TransactionBuilder(
config: txBuilderConfig,
inputs: [utxo],
inputs: {utxo},
// fee can be left empty so that it's auto calculated or can be hardcoded
// fee: const Coin(1000000),
ttl: const SlotBigNum(410021),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class TransactionBuilder extends Equatable {
///
/// Enough [inputs] must be provided to be greater or equal
/// the amount of [outputs] + [fee].
final List<TransactionUnspentOutput> inputs;
final Set<TransactionUnspentOutput> inputs;

/// The list of transaction outputs which describes which address
/// will receive what amount of [Coin].
Expand Down Expand Up @@ -64,7 +64,7 @@ final class TransactionBuilder extends Equatable {
final Coin? totalCollateral;

/// Reference inputs as nonempty set of transaction inputs.
final Set<TransactionInput>? referenceInputs;
final Set<TransactionUnspentOutput>? referenceInputs;

/// The builder that builds the witness set of the transaction.
///
Expand Down Expand Up @@ -249,7 +249,7 @@ final class TransactionBuilder extends Equatable {
Coin minFee() {
final txBody = _copyWith(fee: const Coin(Numbers.intMaxValue)).buildBody();
final fullTx = buildFakeTransaction(txBody);
return config.feeAlgo.minNoScriptFee(fullTx);
return config.feeAlgo.minFee(fullTx, {...inputs, ...?referenceInputs});
}

@override
Expand Down Expand Up @@ -521,7 +521,7 @@ final class TransactionBuilder extends Equatable {
networkId: networkId,
collateralReturn: collateralReturn,
totalCollateral: totalCollateral,
referenceInputs: referenceInputs,
referenceInputs: referenceInputs?.map((utxo) => utxo.input).toSet(),
);
}

Expand Down Expand Up @@ -555,7 +555,7 @@ final class TransactionBuilder extends Equatable {
/// protocol parameters and other constants.
final class TransactionBuilderConfig extends Equatable {
/// The protocol parameter which describes the transaction fee algorithm.
final LinearFee feeAlgo;
final TieredFee feeAlgo;

/// The protocol parameter which limits the maximum transaction size in bytes.
final int maxTxSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,21 @@ final class InsufficientAdaForAssetsException extends Equatable
@override
List<Object?> get props => [];
}

/// Exception thrown when the total size of reference scripts exceeds the limit.
final class ReferenceScriptSizeLimitExceededException extends Equatable
implements Exception {
/// The maximum size of reference scripts allowed per transaction.
final int maxRefScriptSize;

/// The default constructor for [ReferenceScriptSizeLimitExceededException].
const ReferenceScriptSizeLimitExceededException(this.maxRefScriptSize);

@override
String toString() =>
'Total size of reference scripts exceeds the limit of $maxRefScriptSize '
'bytes';

@override
List<Object?> get props => [maxRefScriptSize];
}
Loading

0 comments on commit c3c6277

Please sign in to comment.