This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | |
-- SPDX-License-Identifier: Apache-2.0 | |
daml 1.2 | |
module FlexibleControllers where | |
template FeatureAssignment with | |
employee : Party | |
sponsor : Party | |
description : Text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"test": "react-scripts test", | |
"eject": "react-scripts eject" | |
}, | |
+ "proxy": "http://localhost:4000", | |
"dependencies": { | |
"@auth0/auth0-spa-js": "^1.0.2", | |
"@fortawesome/fontawesome-svg-core": "^1.2.17", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TestLedgerApi = () => { | |
const [apiResult, setApiResult] = useState({}); | |
const { getTokenSilently } = useAuth0(); | |
const callLedgerApi = async () => { | |
try { | |
// Get the access token from auth0 | |
const audienceOptions = { | |
audience: 'https://daml.com/ledger-api' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Auth0Provider | |
domain={config.domain} | |
client_id={config.clientId} | |
redirect_uri={window.location.origin} | |
onRedirectCallback={onRedirectCallback} | |
+ audience={config.audience} | |
> | |
<App /> | |
</Auth0Provider>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"domain": "dev-uswtyz53.eu.auth0.com", | |
- "clientId": "<auth0 client id>" | |
+ "clientId": "<auth0 client id>", | |
+ "audience": "https://daml.com/ledger-api" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
// Hardcoded constants | |
var ledgerId = 'daml-auth0-example-ledger'; | |
var applicationId = 'daml-auth0-example'; | |
// Read the DAML party identifier from the app metadata | |
var actAs = []; | |
if (user.app_metadata && user.app_metadata.daml_ledger_api) { | |
actAs = [user.app_metadata.daml_ledger_api.partyIdentifier]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
// Only support users with a verified email address | |
if (!user.email || !user.email_verified) { | |
return callback(null, user, context); | |
} | |
// Only onboard the user to the ledger once | |
if (user.app_metadata && user.app_metadata.daml_ledger_api) { | |
return callback(null, user, context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
assetCid <- create Asset with | |
owner | |
amount = 5.0 | |
asset1 <- fetch assetCid | |
let | |
asset2 = Asset with | |
owner | |
amount = 5.0 | |
asset1 === asset2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compareAssetRecords: Party -> Decimal -> Bool | |
compareAssetRecords owner amount = do | |
let | |
asset1 = Asset with .. | |
let | |
asset2 = Asset with .. | |
asset1 == asset2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asset <- fetch assetCid | |
transferAsset asset newOwner |
NewerOlder