Skip to content

Commit

Permalink
Fix up UI side for multi-package support
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgSchneider committed Jan 4, 2023
1 parent cc36dad commit 3760cc4
Show file tree
Hide file tree
Showing 47 changed files with 2,740 additions and 7,603 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@

Copyright © 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

### Dependencies
# Dependencies

This repo assumes the use of [direnv] for local development, along with a
working [Nix] installation.

[direnv]: https://github.com/direnv/direnv
[Nix]: https://nixos.org/download.html

# Running
# Building

If on Linux or MacOS, run the following commands:
To build all packages run:
```
./scripts/get-dependencies.sh
daml start
make ci-local
```
If on Windows, run the following:
The built packages are now located in the `.dars` directory.

# Running

We currently don't support running the app on Windows natively, but you can use Windows Subsystem for Linux (WSL) if available and follow the instructions below.

On Linux or MacOS run the following command:
```
./scripts/get-dependencies.bat
daml start
DAML_PROJECT=package/main/daml/Daml.Finance.Setup/ daml start
```

Wait until the sandbox is up and running, indicated by the following output:
Expand Down
10 changes: 10 additions & 0 deletions package/main/daml/Daml.Finance.Setup/daml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ dependencies:
- daml-script
data-dependencies:
- .lib/daml-finance/ContingentClaims.Core/1.0.0/contingent-claims-core-1.0.0.dar
- .lib/daml-finance/ContingentClaims.Lifecycle/1.0.0/contingent-claims-lifecycle-1.0.0.dar
- .lib/daml-finance/ContingentClaims.Valuation/0.2.0/contingent-claims-valuation-0.2.0.dar
- .lib/daml-finance/Daml.Finance.Account/1.0.0/daml-finance-account-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Claims/1.0.0/daml-finance-claims-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Data/1.0.0/daml-finance-data-1.0.0.dar
Expand All @@ -23,8 +25,14 @@ data-dependencies:
- .lib/daml-finance/Daml.Finance.Instrument.Token/1.0.0/daml-finance-instrument-token-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Account/1.0.0/daml-finance-interface-account-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Claims/1.0.0/daml-finance-interface-claims-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Data/1.0.0/daml-finance-interface-data-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Holding/1.0.0/daml-finance-interface-holding-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Instrument.Base/1.0.0/daml-finance-interface-instrument-base-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Instrument.Bond/0.2.0/daml-finance-interface-instrument-bond-0.2.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Instrument.Equity/0.2.0/daml-finance-interface-instrument-equity-0.2.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Instrument.Generic/1.0.0/daml-finance-interface-instrument-generic-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Instrument.Swap/0.2.0/daml-finance-interface-instrument-swap-0.2.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Instrument.Token/1.0.0/daml-finance-interface-instrument-token-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Lifecycle/1.0.0/daml-finance-interface-lifecycle-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Settlement/1.0.0/daml-finance-interface-settlement-1.0.0.dar
- .lib/daml-finance/Daml.Finance.Interface.Types.Common/1.0.0/daml-finance-interface-types-common-1.0.0.dar
Expand Down Expand Up @@ -60,5 +68,7 @@ sandbox-options:
- -c=canton.conf
script-options:
- --output-file=../../../../ui/src/parties.json
json-api-options:
- --config=json-api.conf
build-options:
- --target=1.15
10,094 changes: 2,603 additions & 7,491 deletions ui/package-lock.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@
"version": "0.0.1",
"private": true,
"dependencies": {
"@daml.js/daml-finance-app-data": "file:daml.js/daml-finance-app-data-0.0.1",
"@daml.js/daml-finance-app-interface-base": "file:daml.js/daml-finance-app-interface-base-0.0.1",
"@daml.js/daml-finance-app-interface-custody": "file:daml.js/daml-finance-app-interface-custody-0.0.1",
"@daml.js/daml-finance-app-interface-decentralized": "file:daml.js/daml-finance-app-interface-decentralized-0.0.1",
"@daml.js/daml-finance-app-interface-distribution": "file:daml.js/daml-finance-app-interface-distribution-0.0.1",
"@daml.js/daml-finance-app-interface-issuance": "file:daml.js/daml-finance-app-interface-issuance-0.0.1",
"@daml.js/daml-finance-app-interface-lending": "file:daml.js/daml-finance-app-interface-lending-0.0.1",
"@daml.js/daml-finance-app-interface-lifecycle": "file:daml.js/daml-finance-app-interface-lifecycle-0.0.1",
"@daml.js/daml-finance-app-interface-listing": "file:daml.js/daml-finance-app-interface-listing-0.0.1",
"@daml.js/daml-finance-app-interface-settlement": "file:daml.js/daml-finance-app-interface-settlement-0.0.1",
"@daml.js/daml-finance-app-interface-structuring": "file:daml.js/daml-finance-app-interface-structuring-0.0.1",
"@daml.js/daml-finance-app-interface-trading": "file:daml.js/daml-finance-app-interface-trading-0.0.1",
"@daml.js/contingent-claims-core": "file:daml.js/contingent-claims-core-1.0.0",
"@daml.js/daml-finance-interface-account": "file:daml.js/daml-finance-interface-account-1.0.0",
"@daml.js/daml-finance-interface-claims": "file:daml.js/daml-finance-interface-claims-1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Card/Dex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Card, CardActionArea, CardContent, Grid, Table, TableBody, TableCell, T
import { Box } from "@mui/system";
import useStyles from "./styles";
import { fmt } from "../../util";
import { Service } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Decentralized/Exchange/Service";
import { Service } from "@daml.js/daml-finance-app-interface-decentralized/lib/Daml/Finance/App/Interface/Decentralized/Exchange/Service";
import { useParties } from "../../context/PartiesContext";

type DexProps = {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Instrument/Aggregate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useStyles from "./styles";
import { ClaimsTreeBuilder, ClaimTreeNode } from "../../components/Claims/ClaimsTreeBuilder";
import { and, claimToNode } from "../../components/Claims/util";
import { InstrumentAggregate } from "../../context/InstrumentContext";
import { Service as Lifecycle } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Lifecycle/Service";
import { Service as Lifecycle } from "@daml.js/daml-finance-app-interface-lifecycle/lib/Daml/Finance/App/Interface/Lifecycle/Service";
import { useParties } from "../../context/PartiesContext";
import { shorten } from "../../util";
import { Spinner } from "../Spinner/Spinner";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/context/AccountContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from "react";
import { useParty, useStreamQueries } from "@daml/react";
import { AccountKey, InstrumentKey } from "@daml.js/daml-finance-interface-types-common/lib/Daml/Finance/Interface/Types/Common/Types";
import { Reference } from "@daml.js/daml-finance-interface-account/lib/Daml/Finance/Interface/Account/Account";
import { AccountDirectory } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Data/AccountDirectory";
import { AccountDirectory } from "@daml.js/daml-finance-app-data/lib/Daml/Finance/App/Data/AccountDirectory";

export type AccountState = {
loading : boolean
Expand Down
46 changes: 23 additions & 23 deletions ui/src/context/ServicesContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
import React from "react";
import { CreateEvent } from "@daml/ledger";
import { useStreamQueries } from "@daml/react";
import { Service as BaseService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Base/Service"
import { Service as BackToBackService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Issuance/BackToBack"
import { Service as CustodyService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Custody/Service"
import { Service as CustodyAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Custody/Auto"
import { Service as DecentralizedExchangeService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Decentralized/Exchange/Service"
import { Service as AuctionService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Service"
import { Service as AuctionAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Auto"
import { Service as BiddingService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Bidding/Service"
import { Service as BiddingAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Bidding/Auto"
import { Service as SubscriptionService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Subscription/Service"
import { Service as FundService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Fund/Service"
import { Service as InvestmentService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Investment/Service"
import { Service as IssuanceService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Issuance/Service"
import { Service as IssuanceAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Issuance/Auto"
import { Service as LendingService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Lending/Service"
import { Service as LifecycleService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Lifecycle/Service"
import { Service as StructuringService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Structuring/Service"
import { Service as StructuringAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Structuring/Auto"
import { Service as ListingService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Listing/Service"
import { Service as ListingAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Listing/Auto"
import { Service as SettlementService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Settlement/Service"
import { Service as TradingService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Trading/Service"
import { Service as TradingAutoService } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Trading/Auto"
import { Service as BaseService } from "@daml.js/daml-finance-app-interface-base/lib/Daml/Finance/App/Interface/Base/Service"
import { Service as CustodyService } from "@daml.js/daml-finance-app-interface-custody/lib/Daml/Finance/App/Interface/Custody/Service"
import { Service as CustodyAutoService } from "@daml.js/daml-finance-app-interface-custody/lib/Daml/Finance/App/Interface/Custody/Auto"
import { Service as DecentralizedExchangeService } from "@daml.js/daml-finance-app-interface-decentralized/lib/Daml/Finance/App/Interface/Decentralized/Exchange/Service"
import { Service as AuctionService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Service"
import { Service as AuctionAutoService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Auto"
import { Service as BiddingService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Service"
import { Service as BiddingAutoService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Auto"
import { Service as SubscriptionService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Subscription/Service"
import { Service as FundService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Fund/Service"
import { Service as InvestmentService } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Investment/Service"
import { Service as BackToBackService } from "@daml.js/daml-finance-app-interface-issuance/lib/Daml/Finance/App/Interface/Issuance/BackToBack"
import { Service as IssuanceService } from "@daml.js/daml-finance-app-interface-issuance/lib/Daml/Finance/App/Interface/Issuance/Service"
import { Service as IssuanceAutoService } from "@daml.js/daml-finance-app-interface-issuance/lib/Daml/Finance/App/Interface/Issuance/Auto"
import { Service as LendingService } from "@daml.js/daml-finance-app-interface-lending/lib/Daml/Finance/App/Interface/Lending/Service"
import { Service as LifecycleService } from "@daml.js/daml-finance-app-interface-lifecycle/lib/Daml/Finance/App/Interface/Lifecycle/Service"
import { Service as ListingService } from "@daml.js/daml-finance-app-interface-listing/lib/Daml/Finance/App/Interface/Listing/Service"
import { Service as ListingAutoService } from "@daml.js/daml-finance-app-interface-listing/lib/Daml/Finance/App/Interface/Listing/Auto"
import { Service as SettlementService } from "@daml.js/daml-finance-app-interface-settlement/lib/Daml/Finance/App/Interface/Settlement/Service"
import { Service as StructuringService } from "@daml.js/daml-finance-app-interface-structuring/lib/Daml/Finance/App/Interface/Structuring/Service"
import { Service as StructuringAutoService } from "@daml.js/daml-finance-app-interface-structuring/lib/Daml/Finance/App/Interface/Structuring/Auto"
import { Service as TradingService } from "@daml.js/daml-finance-app-interface-trading/lib/Daml/Finance/App/Interface/Trading/Service"
import { Service as TradingAutoService } from "@daml.js/daml-finance-app-interface-trading/lib/Daml/Finance/App/Interface/Trading/Auto"

type ServicesAggregate<S extends object> = {
services : ServiceAggregate<S>[]
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/defi/Exchange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Button, Grid, Paper, Table, TableBody, TableCell, TableRow, TextField,
import { Percentage } from "../../components/Slider/Percentage";
import useStyles from "../styles";
import { Bonding } from "../../components/Curve/Bonding";
import { Service } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Decentralized/Exchange/Service";
import { Service } from "@daml.js/daml-finance-app-interface-decentralized/lib/Daml/Finance/App/Interface/Decentralized/Exchange/Service";
import { useServices } from "../../context/ServicesContext";
import { useHoldings } from "../../context/HoldingContext";
import { useAccounts } from "../../context/AccountContext";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/distribution/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { Bid } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Distribution/Bidding/Model/module";
import { Bid } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Bid";

export const getBidAllocation = (bid : Bid) : string => {
switch (bid.status.tag) {
Expand Down
6 changes: 3 additions & 3 deletions ui/src/pages/distribution/auction/Auction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { useLedger, useParty, useStreamQueries } from "@daml/react";
import { Typography, Grid, Table, TableBody, TableCell, TableRow, Button, Paper } from "@mui/material";
import { useParams } from "react-router-dom";
import useStyles from "../../styles";
import { Auction as AuctionI, Status as AuctionStatus } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Auction";
import { Service } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Service";
import { Bid } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Bidding/Bid";
import { Auction as AuctionI, Status as AuctionStatus } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Auction";
import { Service } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Service";
import { Bid } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Bid";
import { getBidAllocation } from "../Utils";
import { Spinner } from "../../../components/Spinner/Spinner";
import { fmt } from "../../../util";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/distribution/auction/Auctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from "react";
import { useParty, useStreamQueries } from "@daml/react";
import { Auction } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Auction";
import { Auction } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Auction";
import { Spinner } from "../../../components/Spinner/Spinner";
import { fmt } from "../../../util";
import { useParties } from "../../../context/PartiesContext";
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/distribution/auction/Bidding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import React, { useState } from "react";
import useStyles from "../../styles";
import classnames from "classnames";
import { Auction } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Auction";
import { Bid } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Bidding/Bid";
import { Auction } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Auction";
import { Bid } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Bid";
import { useLedger, useParty, useStreamQueries } from "@daml/react";
import { Grid, Paper, Typography, Table, TableRow, TableCell, TableBody, TextField, Button } from "@mui/material";
import { useParams } from "react-router-dom";
import { Service } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Bidding/Service";
import { Service as ServiceAuto } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Bidding/Auto";
import { Service } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Service";
import { Service as ServiceAuto } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Bidding/Auto";
import { getBidAllocation } from "../Utils";
import { Spinner } from "../../../components/Spinner/Spinner";
import { fmt } from "../../../util";
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/distribution/auction/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { createSet } from "../../../util";
import { useParties } from "../../../context/PartiesContext";
import { useInstruments } from "../../../context/InstrumentContext";
import { useServices } from "../../../context/ServicesContext";
import { Service as Auction } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Service";
import { Service as AuctionAuto } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Auto";
import { Service as Auction } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Service";
import { Service as AuctionAuto } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Auto";
import { useHoldings } from "../../../context/HoldingContext";
import { CenteredForm } from "../../../components/CenteredForm/CenteredForm";
import { TextInput } from "../../../components/Form/TextInput";
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/distribution/auction/Requests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Button } from "@mui/material";
import { CreateEvent } from "@daml/ledger";
import { useLedger, useParty, useStreamQueries } from "@daml/react";
import useStyles from "../../styles";
import { CreateAuctionRequest } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/CreateAuctionRequest";
import { Service } from "@daml.js/daml-finance-app/lib/Daml/Finance/App/Interface/Distribution/Auction/Service";
import { CreateAuctionRequest } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/CreateAuctionRequest";
import { Service } from "@daml.js/daml-finance-app-interface-distribution/lib/Daml/Finance/App/Interface/Distribution/Auction/Service";
import { Spinner } from "../../../components/Spinner/Spinner";
import { fmt } from "../../../util";
import { useParties } from "../../../context/PartiesContext";
Expand Down
Loading

0 comments on commit 3760cc4

Please sign in to comment.