-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
6,270 additions
and
747 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
MARLOWE_RUNTIME_WEB_URL=<Your-Runtime-Instance> | ||
MARLOWE_SCAN_URL=<Your-Scan-Instance> | ||
MARLOWE_RUNTIME_WEB_URL=https://marlowe-runtime-preprod-web.demo.scdev.aws.iohkdev.io | ||
MARLOWE_SCAN_URL=https://preprod.marlowescan.com | ||
CARDANO_SCAN_URL=https://preprod.cardanoscan.io |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { AssetId, Assets, PayoutId, Token, payoutIdToTxId, unPayoutId, unPolicyId } from "@marlowe.io/runtime-core"; | ||
import React, { } from 'react'; | ||
import { ContractId, unContractId } from "@marlowe.io/runtime-core" | ||
|
||
|
||
export function* intersperse(a: string[], delim: string) { | ||
let first = true; | ||
for (const x of a) { | ||
if (!first) yield delim; | ||
first = false; | ||
yield x; | ||
} | ||
} | ||
|
||
export function contractIdLink (marloweScanURL : string , contractId : ContractId) { | ||
return <a target="_blank" | ||
rel="noopener noreferrer" | ||
href={`${marloweScanURL}/contractView?tab=info&contractId=` + encodeURIComponent(unContractId(contractId))}> | ||
{truncateAddress(unContractId(contractId))}<span style={{fontSize:"small"}}>#</span> </a> | ||
} | ||
|
||
export function payoutTxLink (cardanoScanURL : string , payoutId : PayoutId) { | ||
return <a target="_blank" | ||
rel="noopener noreferrer" | ||
href={`${cardanoScanURL}/transaction/` + encodeURIComponent(payoutIdToTxId(payoutId))}> | ||
{truncateId(payoutIdToTxId(payoutId))}<span style={{fontSize:"small"}}>#</span> </a> | ||
} | ||
|
||
export function roleTokenLink (cardanoScanURL : string , roleToken : AssetId) { | ||
return <a target="_blank" | ||
rel="noopener noreferrer" | ||
href={`${cardanoScanURL}/tokenPolicy/` + encodeURIComponent(unPolicyId(roleToken.policyId))}> | ||
{roleToken.assetName}</a> | ||
} | ||
|
||
const truncateId = (str: string) => { | ||
const length = str.length; | ||
return str.slice(length-64, length-59) | ||
} | ||
|
||
const truncateAddress = (str: string) => { | ||
const length = str.length; | ||
return str.slice(length-66, length-61) | ||
} | ||
|
||
export const formatAssets = (assets: Assets, isMainnnet: Boolean): string[] => { | ||
const [adas, lovelaces, currency] = formatADAs(assets.lovelaces, isMainnnet) | ||
const formattedADA = lovelaces === '000000' ? adas + ' ' + currency : adas + '.' + lovelaces + ' ' + currency | ||
return [formattedADA].concat(assets.tokens.map((tk: Token) => `${tk.quantity} ${tk.assetId.assetName}`)) | ||
} | ||
|
||
export type CurrencyF = String | ||
export type WholeNumberF = string | ||
export type DecimalF = string | ||
const formatADAs = (lovelaces: bigint, isMainnet: Boolean = false, currencyName: string = "₳"): [WholeNumberF, DecimalF, CurrencyF] => { | ||
const adas = (Math.trunc(Number(lovelaces).valueOf() / 1_000_000)) | ||
const decimalADAs = (lovelaces % 1_000_000n) | ||
const currency = isMainnet ? currencyName : "t" + currencyName | ||
return [adas.toString(), decimalADAs.toString().padStart(6, '0'), currency] | ||
} | ||
|
||
export const shortViewTxOutRef = (txOutRef: string) => txOutRef.substring(txOutRef.length - 6); | ||
|
||
export const cssOverrideSpinnerCentered | ||
= ({display: "block", | ||
marginLeft: "10px", | ||
marginRight:"auto", | ||
height: "auto", | ||
witdth : "20px", | ||
paddingTop: "10px"}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const ICON_SIZES = { | ||
XS: 15, | ||
S: 20, | ||
M: 25, | ||
L: 30, | ||
XL: 40, | ||
XXL: 64, | ||
XXXL: 192, | ||
}; |
File renamed without changes.
Oops, something went wrong.