@akita-protocol/algomd-rn 0.0.0-stage → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -2
- package/package.json +118 -3
- package/src/adapters/index.ts +4 -0
- package/src/adapters/txn-graph.ts +138 -0
- package/src/components/ASA.tsx +38 -0
- package/src/components/ASASearch.tsx +79 -0
- package/src/components/Account.tsx +42 -0
- package/src/components/AccountSearch.tsx +75 -0
- package/src/components/AuctionListing.tsx +40 -0
- package/src/components/Collection.tsx +42 -0
- package/src/components/DualStakePool.tsx +244 -0
- package/src/components/NFDProfile.tsx +45 -0
- package/src/components/NFDSearch.tsx +81 -0
- package/src/components/NFTListing.tsx +73 -0
- package/src/components/NFTSearch.tsx +68 -0
- package/src/components/Poll.tsx +39 -0
- package/src/components/PollSearch.tsx +79 -0
- package/src/components/PrizeBoxBundle.tsx +1 -0
- package/src/components/RaffleListing.tsx +40 -0
- package/src/components/SelfFetching.tsx +1048 -0
- package/src/components/StakingPool.tsx +134 -0
- package/src/components/TradeOffer.tsx +47 -0
- package/src/components/TradeSearch.tsx +103 -0
- package/src/components/TransactionDetails.tsx +37 -0
- package/src/components/TransactionSearch.tsx +102 -0
- package/src/components/TransactionsGraph.tsx +60 -0
- package/src/components/index.ts +41 -0
- package/src/fonts/OFL.txt +93 -0
- package/src/fonts/SpaceGrotesk_300Light.ttf +0 -0
- package/src/fonts/SpaceGrotesk_400Regular.ttf +0 -0
- package/src/fonts/SpaceGrotesk_500Medium.ttf +0 -0
- package/src/fonts/SpaceGrotesk_600SemiBold.ttf +0 -0
- package/src/fonts/SpaceGrotesk_700Bold.ttf +0 -0
- package/src/fonts/app.css +5 -0
- package/src/graph.ts +3 -0
- package/src/hooks/index.ts +17 -0
- package/src/hooks/useAlgomdData.ts +1539 -0
- package/src/hooks/useAlgorandClient.ts +54 -0
- package/src/index.ts +147 -0
- package/src/presentation/ASADisplay.tsx +380 -0
- package/src/presentation/AccountDisplay.tsx +132 -0
- package/src/presentation/AccountMentionInline.tsx +38 -0
- package/src/presentation/AccountMentionText.tsx +80 -0
- package/src/presentation/AdaptiveImage.tsx +314 -0
- package/src/presentation/AssetMention.tsx +87 -0
- package/src/presentation/AuctionListingDisplay.tsx +428 -0
- package/src/presentation/BundleContents.tsx +228 -0
- package/src/presentation/CardContainer.tsx +61 -0
- package/src/presentation/CardEntrance.tsx +21 -0
- package/src/presentation/CollectionDisplay.tsx +168 -0
- package/src/presentation/ContractMenu.tsx +243 -0
- package/src/presentation/DualStakePoolDisplay.tsx +335 -0
- package/src/presentation/Embeds.tsx +300 -0
- package/src/presentation/GateRequirements.tsx +334 -0
- package/src/presentation/HEROICONS-LICENSE.txt +21 -0
- package/src/presentation/NFDProfileDisplay.tsx +194 -0
- package/src/presentation/NFTListingDisplay.tsx +284 -0
- package/src/presentation/OnChainActionCard.tsx +557 -0
- package/src/presentation/PollDisplay.tsx +222 -0
- package/src/presentation/PrizeBoxBundleDisplay.tsx +103 -0
- package/src/presentation/PrizeBoxMedia.tsx +46 -0
- package/src/presentation/PrizePreview.tsx +296 -0
- package/src/presentation/ProgressBar.tsx +50 -0
- package/src/presentation/RaffleListingDisplay.tsx +399 -0
- package/src/presentation/References.tsx +310 -0
- package/src/presentation/ReservedNotice.tsx +73 -0
- package/src/presentation/ResultsPanel.tsx +241 -0
- package/src/presentation/Sparkline.tsx +70 -0
- package/src/presentation/SquishyPressable.tsx +145 -0
- package/src/presentation/StakingPoolDisplay.tsx +419 -0
- package/src/presentation/StatusBadge.tsx +56 -0
- package/src/presentation/TradeOfferDisplay.tsx +275 -0
- package/src/presentation/TransactionDisplay.tsx +262 -0
- package/src/presentation/WinnerBadge.tsx +58 -0
- package/src/presentation/assetHelpers.ts +36 -0
- package/src/presentation/assets.ts +7 -0
- package/src/presentation/explorer.ts +95 -0
- package/src/presentation/format.ts +90 -0
- package/src/presentation/gates.ts +100 -0
- package/src/presentation/icons.tsx +1178 -0
- package/src/presentation/identity.tsx +175 -0
- package/src/presentation/index.ts +88 -0
- package/src/presentation/media.ts +70 -0
- package/src/presentation/pluginColors.ts +8 -0
- package/src/presentation/runtime.tsx +280 -0
- package/src/presentation/sheets.tsx +7 -0
- package/src/presentation/subject.tsx +31 -0
- package/src/presentation/textTheme.ts +17 -0
- package/src/presentation/themes.json +158 -0
- package/src/presentation/variants.ts +14 -0
- package/src/provider/AlgomdProvider.tsx +45 -0
- package/src/provider/context.ts +18 -0
- package/src/provider/imageResolver.ts +12 -0
- package/src/provider/index.ts +5 -0
- package/src/provider/networks.ts +23 -0
- package/src/provider/types.ts +29 -0
- package/src/refs/AccountRef.tsx +226 -0
- package/src/refs/ApplicationRef.tsx +72 -0
- package/src/refs/AssetRef.tsx +142 -0
- package/src/refs/AuctionRef.tsx +108 -0
- package/src/refs/CollectionRef.tsx +70 -0
- package/src/refs/DualStakeRef.tsx +88 -0
- package/src/refs/GuildProposalRef.tsx +285 -0
- package/src/refs/HostRefs.tsx +82 -0
- package/src/refs/ListingRef.tsx +90 -0
- package/src/refs/NfdRef.tsx +96 -0
- package/src/refs/PollRef.tsx +120 -0
- package/src/refs/RaffleRef.tsx +101 -0
- package/src/refs/RewardRef.tsx +78 -0
- package/src/refs/StakingPoolRef.tsx +136 -0
- package/src/refs/SubscriptionRef.tsx +200 -0
- package/src/refs/TradeRef.tsx +100 -0
- package/src/refs/TransactionRef.tsx +156 -0
- package/src/refs/assetInfo.ts +49 -0
- package/src/refs/contractParts.tsx +159 -0
- package/src/refs/index.tsx +140 -0
- package/src/refs/primitives.tsx +588 -0
- package/src/refs/types.ts +13 -0
- package/src/types/algorand.ts +496 -0
- package/src/types/index.ts +1 -0
- package/src/ui/CopyButton.tsx +44 -0
- package/src/ui/DataStates.tsx +45 -0
- package/src/ui/ProgressBar.tsx +64 -0
- package/src/ui/SearchSheet.tsx +141 -0
- package/src/ui/SizeContainer.tsx +25 -0
- package/src/ui/StatusBadge.tsx +51 -0
- package/src/ui/index.ts +6 -0
- package/src/utils/algomdImageUrl.ts +20 -0
- package/src/utils/arc19.ts +120 -0
- package/src/utils/arc62.ts +246 -0
- package/src/utils/capacity.ts +26 -0
- package/src/utils/format.ts +181 -0
- package/src/utils/ids.ts +31 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/nfdDisplay.ts +45 -0
- package/src/utils/search.ts +87 -0
- package/src/utils/stakingPool.ts +174 -0
- package/src/utils/stakingSnapshot.ts +132 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { formatRelativeTime, type RaffleData } from "@akita-protocol/algomd-core";
|
|
4
|
+
import { useRaffle } from "@akita-protocol/algomd-core/react";
|
|
5
|
+
import { ContractMenu } from "../presentation/ContractMenu";
|
|
6
|
+
import { TicketIcon } from "../presentation/icons";
|
|
7
|
+
import { usePresentation } from "../presentation/runtime";
|
|
8
|
+
import { PersonRow } from "./AccountRef";
|
|
9
|
+
import { useAssetInfo } from "./assetInfo";
|
|
10
|
+
import { ActionButton, plural, PrizeThumb, ProvenanceNote, StatusChip, timeLeft, useNow, usePrizeLabel } from "./contractParts";
|
|
11
|
+
import { Card, CardHeader, CardSkeleton, DetailLine, headerMedia, InlinePill, Note, Row, RowSkeleton, Section, Stat, StatRow, Title, Unavailable } from "./primitives";
|
|
12
|
+
import type { RefViewProps } from "./types";
|
|
13
|
+
|
|
14
|
+
/** A raffle: live state, or its final state and per-entrant tickets after deletion. */
|
|
15
|
+
export function RaffleRef({ id, size = "large", onPress, visible }: RefViewProps) {
|
|
16
|
+
const presentation = usePresentation();
|
|
17
|
+
const raffle = useRaffle(id, { visible });
|
|
18
|
+
const data = raffle.data?.data as RaffleData | undefined;
|
|
19
|
+
const live = data?.status === "live" || data?.status === "upcoming";
|
|
20
|
+
const now = useNow(1000, live && size !== "inline");
|
|
21
|
+
const prizeName = usePrizeLabel(data?.prize, data?.isPrizeBox);
|
|
22
|
+
const ticket = useAssetInfo(data?.ticketAsset);
|
|
23
|
+
const press = onPress ?? (presentation.onOpenContract ? () => presentation.onOpenContract!("raffle", id) : undefined);
|
|
24
|
+
const enter = presentation.actions?.enterRaffle;
|
|
25
|
+
const retry = raffle.isError ? () => void raffle.refetch() : undefined;
|
|
26
|
+
|
|
27
|
+
if (size === "inline") {
|
|
28
|
+
return (
|
|
29
|
+
<InlinePill
|
|
30
|
+
label={data ? `${prizeName} · raffle` : `Raffle ${id}`}
|
|
31
|
+
dim={raffle.isPending}
|
|
32
|
+
leading={data ? <PrizeThumb prize={data.prize} isPrizeBox={data.isPrizeBox} size={16} /> : null}
|
|
33
|
+
onPress={press}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (size === "small") {
|
|
39
|
+
if (raffle.isPending) return <RowSkeleton shape="rounded" />;
|
|
40
|
+
if (!data) return <Unavailable size="small" label={`Raffle ${id}`} Icon={TicketIcon} onRetry={retry} />;
|
|
41
|
+
return (
|
|
42
|
+
<Row
|
|
43
|
+
leading={<PrizeThumb prize={data.prize} isPrizeBox={data.isPrizeBox} size={40} />}
|
|
44
|
+
title={<Title>{prizeName}</Title>}
|
|
45
|
+
subtitle={`${plural(data.ticketCount, "ticket")} · ${plural(data.entryCount, "entrant")}${live ? ` · ends ${formatRelativeTime(Number(data.endTimestamp), now)}` : ""}`}
|
|
46
|
+
trailing={<StatusChip status={data.status} />}
|
|
47
|
+
onPress={press}
|
|
48
|
+
accessibilityLabel={`Open raffle for ${prizeName}`}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const full = size === "full";
|
|
54
|
+
if (raffle.isPending) return <CardSkeleton media="rounded" blocks={2} action full={full} />;
|
|
55
|
+
if (!data) return <Unavailable size={size} label={`Raffle ${id}`} Icon={TicketIcon} onRetry={retry} />;
|
|
56
|
+
const winnerIsSeller = data.failed || (data.winner && data.winner === data.seller);
|
|
57
|
+
const entries = (data.entries ?? []).slice(0, 10);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Card>
|
|
61
|
+
<CardHeader
|
|
62
|
+
media={<PrizeThumb prize={data.prize} isPrizeBox={data.isPrizeBox} size={headerMedia(full)} />}
|
|
63
|
+
title={prizeName}
|
|
64
|
+
full={full}
|
|
65
|
+
status={<StatusChip status={data.status} />}
|
|
66
|
+
meta={timeLeft(Number(data.endTimestamp), Number(data.startTimestamp), now)}
|
|
67
|
+
menu={<ContractMenu appId={id} type="application" embedType="RaffleListing" />}
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<StatRow>
|
|
71
|
+
<Stat label="Tickets">{data.ticketCount}</Stat>
|
|
72
|
+
<Stat label="Entrants">{data.entryCount}</Stat>
|
|
73
|
+
<Stat label="Paid in" align="right">{ticket.label}</Stat>
|
|
74
|
+
</StatRow>
|
|
75
|
+
|
|
76
|
+
{data.winner && !winnerIsSeller ? <PersonRow address={data.winner} role="Winner" roleTone="good" visible={visible} /> : null}
|
|
77
|
+
{data.failed ? <Note tone="warn">Not enough people entered, so the prize went back to the seller.</Note> : null}
|
|
78
|
+
{full ? <PersonRow address={data.seller} role="Seller" visible={visible} /> : null}
|
|
79
|
+
|
|
80
|
+
{full ? (
|
|
81
|
+
<View>
|
|
82
|
+
<DetailLine label="Tickets per entrant">{`${data.minTickets}–${data.maxTickets}`}</DetailLine>
|
|
83
|
+
{data.minEntries !== "0" ? <DetailLine label="Needs at least">{plural(data.minEntries, "entrant")}</DetailLine> : null}
|
|
84
|
+
</View>
|
|
85
|
+
) : null}
|
|
86
|
+
|
|
87
|
+
{full && entries.length ? (
|
|
88
|
+
<Section label="Entries">
|
|
89
|
+
<View style={{ gap: 8 }}>
|
|
90
|
+
{entries.map((e) => (
|
|
91
|
+
<PersonRow key={e.entrant} address={e.entrant} role={plural(e.tickets, "ticket")} visible={visible} />
|
|
92
|
+
))}
|
|
93
|
+
</View>
|
|
94
|
+
</Section>
|
|
95
|
+
) : null}
|
|
96
|
+
|
|
97
|
+
<ProvenanceNote entity={raffle.data} />
|
|
98
|
+
{data.status === "live" && enter ? <ActionButton label="Enter raffle" onPress={() => enter(id)} /> : null}
|
|
99
|
+
</Card>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { formatRelativeTime } from "@akita-protocol/algomd-core";
|
|
3
|
+
import { useReward } from "@akita-protocol/algomd-core/react";
|
|
4
|
+
import { GiftIcon } from "../presentation/icons";
|
|
5
|
+
import { Text, useAppTheme, usePresentation } from "../presentation/runtime";
|
|
6
|
+
import { PersonRow } from "./AccountRef";
|
|
7
|
+
import { ActionButton, plural, ProvenanceNote, StatusChip } from "./contractParts";
|
|
8
|
+
import { Card, CardHeader, CardSkeleton, headerMedia, InlinePill, KindTile, Row, RowSkeleton, Stat, StatRow, Title, Unavailable } from "./primitives";
|
|
9
|
+
import type { RefViewProps } from "./types";
|
|
10
|
+
|
|
11
|
+
/** Share of the disbursement already claimed. Unit-free, so it needs no asset. */
|
|
12
|
+
function claimedShare(distributed: string, amount: string): string {
|
|
13
|
+
const total = Number(amount);
|
|
14
|
+
if (!total) return "—";
|
|
15
|
+
const p = (Number(distributed) / total) * 100;
|
|
16
|
+
return `${p >= 99.5 || p === 0 ? Math.round(p) : p < 1 ? "<1" : Math.round(p)}%`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A reward disbursement in the Rewards singleton. */
|
|
20
|
+
export function RewardRef({ id, size = "large", onPress, visible }: RefViewProps) {
|
|
21
|
+
const { theme } = useAppTheme();
|
|
22
|
+
const presentation = usePresentation();
|
|
23
|
+
const reward = useReward(id, { visible });
|
|
24
|
+
const data = reward.data?.data ?? undefined;
|
|
25
|
+
const claim = presentation.actions?.claimReward;
|
|
26
|
+
const press = onPress ?? (presentation.onOpenContract ? () => presentation.onOpenContract!("reward", id) : undefined);
|
|
27
|
+
const title = data?.title || `Reward ${id}`;
|
|
28
|
+
// A claimable disbursement with nothing left reads as done, not open.
|
|
29
|
+
const status = data?.status === "claimable" && Number(data.allocations) === 0 ? "claimed" : data?.status ?? "";
|
|
30
|
+
const retry = reward.isError ? () => void reward.refetch() : undefined;
|
|
31
|
+
const when = data
|
|
32
|
+
? data.status === "locked"
|
|
33
|
+
? `Unlocks ${formatRelativeTime(Number(data.unlockAt))}`
|
|
34
|
+
: Number(data.expiresAt) && Number(data.expiresAt) < 4_000_000_000
|
|
35
|
+
? `${data.status === "expired" ? "Expired" : "Expires"} ${formatRelativeTime(Number(data.expiresAt))}`
|
|
36
|
+
: "No expiry"
|
|
37
|
+
: "";
|
|
38
|
+
|
|
39
|
+
if (size === "inline") return <InlinePill label={title} dim={reward.isPending} leading={<GiftIcon size={12} color={theme.colors.primary} />} onPress={press} />;
|
|
40
|
+
|
|
41
|
+
if (size === "small") {
|
|
42
|
+
if (reward.isPending) return <RowSkeleton shape="rounded" />;
|
|
43
|
+
if (!data) return <Unavailable size="small" label={title} Icon={GiftIcon} onRetry={retry} />;
|
|
44
|
+
return (
|
|
45
|
+
<Row
|
|
46
|
+
leading={<KindTile Icon={GiftIcon} size={40} />}
|
|
47
|
+
title={<Title>{title}</Title>}
|
|
48
|
+
subtitle={`${plural(data.allocations, "claim")} left · ${when}`}
|
|
49
|
+
trailing={<StatusChip status={status} />}
|
|
50
|
+
onPress={press}
|
|
51
|
+
accessibilityLabel={`Open reward ${title}`}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const full = size === "full";
|
|
57
|
+
if (reward.isPending) return <CardSkeleton media="rounded" blocks={1} full={full} />;
|
|
58
|
+
if (!data) return <Unavailable size={size} label={title} Icon={GiftIcon} onRetry={retry} />;
|
|
59
|
+
const open = Number(data.allocations) > 0;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Card>
|
|
63
|
+
<CardHeader media={<KindTile Icon={GiftIcon} size={headerMedia(full)} />} title={title} full={full} status={<StatusChip status={status} />} meta={when} />
|
|
64
|
+
{data.note ? (
|
|
65
|
+
<Text size="sm" style={{ color: theme.colors.textDim }}>
|
|
66
|
+
{data.note}
|
|
67
|
+
</Text>
|
|
68
|
+
) : null}
|
|
69
|
+
<StatRow>
|
|
70
|
+
<Stat label="Claims left">{Number(data.allocations).toLocaleString()}</Stat>
|
|
71
|
+
<Stat label="Claimed" align="right">{claimedShare(data.distributed, data.amount)}</Stat>
|
|
72
|
+
</StatRow>
|
|
73
|
+
{full && data.creator ? <PersonRow address={data.creator} role="From" visible={visible} /> : null}
|
|
74
|
+
<ProvenanceNote entity={reward.data} />
|
|
75
|
+
{data.status === "claimable" && open && claim ? <ActionButton label="Claim" onPress={() => claim(id)} /> : null}
|
|
76
|
+
</Card>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import { formatDuration, formatRelativeTime, type StakingPoolData, type StakingPoolReward } from "@akita-protocol/algomd-core";
|
|
4
|
+
import { useStakingPool } from "@akita-protocol/algomd-core/react";
|
|
5
|
+
import { ContractMenu } from "../presentation/ContractMenu";
|
|
6
|
+
import { FireIcon } from "../presentation/icons";
|
|
7
|
+
import { Text, useAppTheme, usePresentation } from "../presentation/runtime";
|
|
8
|
+
import { CreatorIdentity } from "./AccountRef";
|
|
9
|
+
import { AssetRef } from "./AssetRef";
|
|
10
|
+
import { useFormattedAmount } from "./assetInfo";
|
|
11
|
+
import { ProvenanceNote, StatusChip, useNow } from "./contractParts";
|
|
12
|
+
import { Card, CardHeader, CardSkeleton, Chip, headerMedia, InlinePill, Inset, KindTile, Note, Row, RowSkeleton, Section, Stat, StatRow, Title, Unavailable } from "./primitives";
|
|
13
|
+
import type { RefViewProps } from "./types";
|
|
14
|
+
|
|
15
|
+
const POOL_TYPE_LABEL: Record<string, string> = {
|
|
16
|
+
none: "Open entry",
|
|
17
|
+
heartbeat: "Online stake",
|
|
18
|
+
soft: "Soft stake",
|
|
19
|
+
hard: "Hard stake",
|
|
20
|
+
lock: "Locked stake",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function timing(p: StakingPoolData, now: number): string {
|
|
24
|
+
const signup = Number(p.signupAt);
|
|
25
|
+
const start = Number(p.startAt);
|
|
26
|
+
const end = Number(p.endAt);
|
|
27
|
+
if (p.status === "draft") return "Not finalized yet";
|
|
28
|
+
if (now < signup) return `Signups open ${formatRelativeTime(signup, now)}`;
|
|
29
|
+
if (now < start) return `Starts ${formatRelativeTime(start, now)}`;
|
|
30
|
+
if (end && now < end) return `Ends ${formatRelativeTime(end, now)}`;
|
|
31
|
+
return end ? `Ended ${formatRelativeTime(end, now)}` : "Running";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function RewardLine({ reward }: { reward: StakingPoolReward }) {
|
|
35
|
+
const rate = useFormattedAmount(reward.rate, reward.asset);
|
|
36
|
+
const every = Number(reward.interval) ? ` every ${formatDuration(Number(reward.interval))}` : "";
|
|
37
|
+
const how =
|
|
38
|
+
reward.distribution === "percentage"
|
|
39
|
+
? `${Number(reward.rate) / 1000}% of stake${every}`
|
|
40
|
+
: reward.distribution === "shuffle"
|
|
41
|
+
? `${rate} to ${reward.winnerCount || "?"} winners${every}`
|
|
42
|
+
: reward.distribution === "even"
|
|
43
|
+
? `${rate} shared evenly${every}`
|
|
44
|
+
: `${rate} per staker${every}`;
|
|
45
|
+
return (
|
|
46
|
+
<View style={styles.reward}>
|
|
47
|
+
<AssetRef id={reward.asset} size="inline" />
|
|
48
|
+
<Text size="xs" weight="medium" numberOfLines={2} style={{ flex: 1, textAlign: "right" }}>
|
|
49
|
+
{how}
|
|
50
|
+
</Text>
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A staking pool: live header and rewards, or the header of a deleted pool. */
|
|
56
|
+
export function StakingPoolRef({ id, size = "large", onPress, visible }: RefViewProps) {
|
|
57
|
+
const { theme } = useAppTheme();
|
|
58
|
+
const presentation = usePresentation();
|
|
59
|
+
const pool = useStakingPool(id, { visible });
|
|
60
|
+
const data = pool.data?.data ?? undefined;
|
|
61
|
+
const live = data && data.status !== "ended" && data.status !== "closed";
|
|
62
|
+
const now = useNow(1000, Boolean(live) && size !== "inline");
|
|
63
|
+
const press = onPress ?? (presentation.onOpenContract ? () => presentation.onOpenContract!("staking-pool", id) : undefined);
|
|
64
|
+
const title = data?.title || `Staking pool ${id}`;
|
|
65
|
+
const retry = pool.isError ? () => void pool.refetch() : undefined;
|
|
66
|
+
|
|
67
|
+
if (size === "inline") return <InlinePill label={title} dim={pool.isPending} leading={<FireIcon size={12} color={theme.colors.primary} />} onPress={press} />;
|
|
68
|
+
|
|
69
|
+
if (size === "small") {
|
|
70
|
+
if (pool.isPending) return <RowSkeleton shape="rounded" />;
|
|
71
|
+
if (!data) return <Unavailable size="small" label={title} Icon={FireIcon} onRetry={retry} />;
|
|
72
|
+
return (
|
|
73
|
+
<Row
|
|
74
|
+
leading={<KindTile Icon={FireIcon} size={40} />}
|
|
75
|
+
title={<Title>{title}</Title>}
|
|
76
|
+
subtitle={`${POOL_TYPE_LABEL[data.poolType] ?? data.poolType} · ${entries(data)} · ${timing(data, now)}`}
|
|
77
|
+
trailing={<StatusChip status={data.status} />}
|
|
78
|
+
onPress={press}
|
|
79
|
+
accessibilityLabel={`Open staking pool ${title}`}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const full = size === "full";
|
|
85
|
+
if (pool.isPending) return <CardSkeleton media="rounded" blocks={2} full={full} />;
|
|
86
|
+
if (!data) return <Unavailable size={size} label={title} Icon={FireIcon} onRetry={retry} />;
|
|
87
|
+
const rewards = data.rewards ?? [];
|
|
88
|
+
const shown = full ? rewards : rewards.slice(0, 2);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Card>
|
|
92
|
+
<CardHeader
|
|
93
|
+
media={<KindTile Icon={FireIcon} size={headerMedia(full)} />}
|
|
94
|
+
title={title}
|
|
95
|
+
full={full}
|
|
96
|
+
status={<StatusChip status={data.status} />}
|
|
97
|
+
meta={timing(data, now)}
|
|
98
|
+
menu={<ContractMenu appId={id} type="application" embedType="StakingPool" />}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<StatRow>
|
|
102
|
+
<Stat label="Type">{POOL_TYPE_LABEL[data.poolType] ?? data.poolType}</Stat>
|
|
103
|
+
<Stat label="Stakers">{data.maxEntries !== "0" ? `${data.entryCount} / ${data.maxEntries}` : data.entryCount}</Stat>
|
|
104
|
+
<Stat label="Rewards" align="right">{data.rewards ? String(data.rewards.length) : "—"}</Stat>
|
|
105
|
+
</StatRow>
|
|
106
|
+
|
|
107
|
+
{shown.length ? (
|
|
108
|
+
<Section label="Rewards">
|
|
109
|
+
<Inset>
|
|
110
|
+
{shown.map((r) => (
|
|
111
|
+
<RewardLine key={r.id} reward={r} />
|
|
112
|
+
))}
|
|
113
|
+
{rewards.length > shown.length ? <Note>{`And ${rewards.length - shown.length} more`}</Note> : null}
|
|
114
|
+
</Inset>
|
|
115
|
+
</Section>
|
|
116
|
+
) : null}
|
|
117
|
+
|
|
118
|
+
{data.allowLateSignups || (full && data.gateId !== "0") ? (
|
|
119
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
120
|
+
{data.allowLateSignups ? <Chip label="Late signups allowed" /> : null}
|
|
121
|
+
{full && data.gateId !== "0" ? <Chip label={`Gate ${data.gateId}`} /> : null}
|
|
122
|
+
</View>
|
|
123
|
+
) : null}
|
|
124
|
+
|
|
125
|
+
{full && data.creator ? <CreatorIdentity address={data.creator} visible={visible} /> : null}
|
|
126
|
+
|
|
127
|
+
<ProvenanceNote entity={pool.data} />
|
|
128
|
+
</Card>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const entries = (p: StakingPoolData) => `${p.entryCount}${p.maxEntries !== "0" ? `/${p.maxEntries}` : ""} stakers`;
|
|
133
|
+
|
|
134
|
+
const styles = StyleSheet.create({
|
|
135
|
+
reward: { alignItems: "center", flexDirection: "row", gap: 12, justifyContent: "space-between", paddingVertical: 8 },
|
|
136
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import { Image } from "expo-image";
|
|
4
|
+
import { formatAmount, splitSubscriptionId, type SubscriptionData } from "@akita-protocol/algomd-core";
|
|
5
|
+
import { useSubscription } from "@akita-protocol/algomd-core/react";
|
|
6
|
+
import { UserGroupIcon } from "../presentation/icons";
|
|
7
|
+
import { LinearGradient, Text, useAppTheme, usePresentation } from "../presentation/runtime";
|
|
8
|
+
import { SquishyPressable } from "../presentation/SquishyPressable";
|
|
9
|
+
import { CreatorIdentity } from "./AccountRef";
|
|
10
|
+
import { useAssetInfo } from "./assetInfo";
|
|
11
|
+
import { AmountLockup, plural } from "./contractParts";
|
|
12
|
+
import { Avatar, Card, CardSkeleton, InlinePill, KindTile, Note, Row, RowSkeleton, StatusBadge, Title, Unavailable, useImageUrl, type Tone } from "./primitives";
|
|
13
|
+
import type { RefViewProps } from "./types";
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* A subscription service, drawn like the Akita app's service offering card
|
|
17
|
+
* (highlight band, banner, price, Subscribe) with the creator block from its
|
|
18
|
+
* subscriptions screen. The id is `<owner>/<serviceId>`; tags written without
|
|
19
|
+
* an owner resolve only through a resolver.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const STATUS: Record<string, [string, Tone]> = {
|
|
23
|
+
active: ["Active", "good"],
|
|
24
|
+
paused: ["Paused", "warn"],
|
|
25
|
+
shutdown: ["Closed", "bad"],
|
|
26
|
+
draft: ["Draft", "neutral"],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const HIGHLIGHT_LABELS: Record<number, string> = {
|
|
30
|
+
1: "Best Value",
|
|
31
|
+
2: "Popular",
|
|
32
|
+
3: "New",
|
|
33
|
+
4: "Limited Offer",
|
|
34
|
+
5: "Recommended",
|
|
35
|
+
6: "Trending",
|
|
36
|
+
7: "Staff Pick",
|
|
37
|
+
8: "Top Rated",
|
|
38
|
+
9: "Editor's Choice",
|
|
39
|
+
10: "Hot Deal",
|
|
40
|
+
11: "Seasonal",
|
|
41
|
+
12: "Flash Sale",
|
|
42
|
+
13: "Exclusive",
|
|
43
|
+
14: "Limited Edition",
|
|
44
|
+
15: "Early Access",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// The Akita app's service gradients, picked by service id.
|
|
48
|
+
const SERVICE_GRADIENTS: [string, string][] = [
|
|
49
|
+
["#3EE1A1", "#1CB5E0"],
|
|
50
|
+
["#90E0FF", "#4BC9FF"],
|
|
51
|
+
["#D16BA5", "#C777B9"],
|
|
52
|
+
["#F7971E", "#FFD200"],
|
|
53
|
+
["#7F7FD5", "#86A8E7"],
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const DAY = 86_400;
|
|
57
|
+
|
|
58
|
+
/** "Month", "Week", "Year" or "N Days", as the app labels billing periods. */
|
|
59
|
+
function intervalLabel(seconds: number): string {
|
|
60
|
+
if (seconds >= DAY * 28 && seconds <= DAY * 31) return "Month";
|
|
61
|
+
if (seconds >= DAY * 6 && seconds <= DAY * 8) return "Week";
|
|
62
|
+
if (seconds >= DAY * 364 && seconds <= DAY * 366) return "Year";
|
|
63
|
+
if (seconds >= DAY) return `${Math.round(seconds / DAY)} Days`;
|
|
64
|
+
if (seconds >= 3600) return `${Math.round(seconds / 3600)} Hours`;
|
|
65
|
+
return `${seconds} Seconds`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Dark text on light fills, white on dark ones. */
|
|
69
|
+
function textOn(hex: string): string {
|
|
70
|
+
const n = parseInt(hex.replace("#", "").slice(0, 6), 16);
|
|
71
|
+
if (Number.isNaN(n)) return "#FFFFFF";
|
|
72
|
+
const [r, g, b] = [(n >> 16) & 255, (n >> 8) & 255, n & 255];
|
|
73
|
+
return 0.299 * r + 0.587 * g + 0.114 * b > 150 ? "#09090b" : "#FFFFFF";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface ServicePrice {
|
|
77
|
+
period?: string;
|
|
78
|
+
line: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function useServicePrice(data: SubscriptionData | undefined): ServicePrice {
|
|
82
|
+
const info = useAssetInfo(data?.asset);
|
|
83
|
+
const amount = data && info.data ? formatAmount(data.amount, info.data.decimals, { maxFraction: 4 }) : undefined;
|
|
84
|
+
const period = data && Number(data.interval) ? intervalLabel(Number(data.interval)) : undefined;
|
|
85
|
+
return { period, line: amount ? `${amount} ${info.label}${period ? ` / ${period}` : ""}` : "" };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The description's markdown list markers, as bullets. Other markdown stays as text. */
|
|
89
|
+
const plainDescription = (md: string) => md.replace(/^\s*[-*]\s+/gm, "• ").trim();
|
|
90
|
+
|
|
91
|
+
export function SubscriptionRef({ id, size = "large", onPress, visible }: RefViewProps) {
|
|
92
|
+
const { theme } = useAppTheme();
|
|
93
|
+
const presentation = usePresentation();
|
|
94
|
+
const sub = useSubscription(id, { visible });
|
|
95
|
+
const press = onPress ?? (presentation.onOpenContract ? () => presentation.onOpenContract!("subscription", id) : undefined);
|
|
96
|
+
const retry = sub.isError ? () => void sub.refetch() : undefined;
|
|
97
|
+
const data = sub.data?.data ?? undefined;
|
|
98
|
+
const price = useServicePrice(data);
|
|
99
|
+
const title = data?.title || `Subscription ${splitSubscriptionId(id).serviceId}`;
|
|
100
|
+
if (size === "inline") return <InlinePill label={title} dim={sub.isPending} leading={<UserGroupIcon size={12} color={theme.colors.primary} />} onPress={press} />;
|
|
101
|
+
|
|
102
|
+
if (size === "small") {
|
|
103
|
+
if (sub.isPending) return <RowSkeleton shape="rounded" />;
|
|
104
|
+
if (!data) return <Unavailable size="small" label={title} Icon={UserGroupIcon} onRetry={retry} />;
|
|
105
|
+
const [label, tone] = STATUS[data.status] ?? [data.status, "neutral"];
|
|
106
|
+
return (
|
|
107
|
+
<Row
|
|
108
|
+
leading={data.banner ? <Avatar uri={data.banner} size={40} shape="rounded" /> : <KindTile Icon={UserGroupIcon} size={40} />}
|
|
109
|
+
title={<Title>{title}</Title>}
|
|
110
|
+
subtitle={price.line}
|
|
111
|
+
trailing={data.status === "active" ? undefined : <StatusBadge label={label} tone={tone} />}
|
|
112
|
+
onPress={press}
|
|
113
|
+
accessibilityLabel={`Open subscription ${title}`}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (sub.isPending) return <CardSkeleton media="banner" action full={size === "full"} />;
|
|
119
|
+
if (!data) return <Unavailable size={size} label={title} Icon={UserGroupIcon} onRetry={retry} />;
|
|
120
|
+
return <ServiceCard data={data} title={title} price={price} full={size === "full"} visible={visible} />;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function ServiceCard({ data, title, price, full, visible }: { data: SubscriptionData; title: string; price: ServicePrice; full: boolean; visible?: boolean }) {
|
|
124
|
+
const { theme } = useAppTheme();
|
|
125
|
+
const subscribe = usePresentation().actions?.subscribe;
|
|
126
|
+
const banner = useImageUrl(data.banner, 600);
|
|
127
|
+
const accent = SERVICE_GRADIENTS[Number(data.serviceId) % SERVICE_GRADIENTS.length] ?? SERVICE_GRADIENTS[0]!;
|
|
128
|
+
const highlight = data.highlightMessage ? HIGHLIGHT_LABELS[data.highlightMessage] : undefined;
|
|
129
|
+
const highlightColor = data.highlightColor && data.highlightColor !== "#000000" ? data.highlightColor : theme.colors.primary;
|
|
130
|
+
const [statusLabel, statusTone] = STATUS[data.status] ?? [data.status, "neutral"];
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Card style={styles.card}>
|
|
134
|
+
{highlight ? (
|
|
135
|
+
<View style={[styles.highlight, { backgroundColor: highlightColor }]}>
|
|
136
|
+
<Text size="xs" weight="bold" style={{ color: textOn(highlightColor) }}>
|
|
137
|
+
{highlight}
|
|
138
|
+
</Text>
|
|
139
|
+
</View>
|
|
140
|
+
) : null}
|
|
141
|
+
|
|
142
|
+
<View style={{ height: full ? 160 : 112 }}>
|
|
143
|
+
{banner ? (
|
|
144
|
+
<>
|
|
145
|
+
<Image source={{ uri: banner }} contentFit="cover" cachePolicy="memory-disk" style={StyleSheet.absoluteFill} />
|
|
146
|
+
<LinearGradient
|
|
147
|
+
colors={["rgba(0,0,0,0)", "rgba(0,0,0,0.2)", theme.colors.accentBackground]}
|
|
148
|
+
locations={[0, 0.6, 1]}
|
|
149
|
+
start={{ x: 0, y: 0 }}
|
|
150
|
+
end={{ x: 0, y: 1 }}
|
|
151
|
+
style={StyleSheet.absoluteFill}
|
|
152
|
+
/>
|
|
153
|
+
</>
|
|
154
|
+
) : (
|
|
155
|
+
<LinearGradient colors={accent} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={StyleSheet.absoluteFill} />
|
|
156
|
+
)}
|
|
157
|
+
</View>
|
|
158
|
+
|
|
159
|
+
<View style={styles.body}>
|
|
160
|
+
<View style={{ gap: 4 }}>
|
|
161
|
+
<View style={styles.titleRow}>
|
|
162
|
+
<Text size={full ? "xl" : "md"} weight="bold" numberOfLines={2} style={{ flex: 1 }}>
|
|
163
|
+
{title}
|
|
164
|
+
</Text>
|
|
165
|
+
<StatusBadge label={statusLabel} tone={statusTone} />
|
|
166
|
+
</View>
|
|
167
|
+
<AmountLockup amount={data.amount} assetId={data.asset} size="lg" suffix={price.period ? `/ ${price.period}` : undefined} />
|
|
168
|
+
</View>
|
|
169
|
+
|
|
170
|
+
{data.status === "active" && subscribe ? (
|
|
171
|
+
<SquishyPressable pressedScale={0.97} accessibilityRole="button" accessibilityLabel={`Subscribe to ${title}`} onPress={() => subscribe(data.owner, data.serviceId)}>
|
|
172
|
+
<LinearGradient colors={accent} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={styles.subscribe}>
|
|
173
|
+
<Text weight="bold" style={{ color: textOn(accent[0]) }}>
|
|
174
|
+
Subscribe
|
|
175
|
+
</Text>
|
|
176
|
+
</LinearGradient>
|
|
177
|
+
</SquishyPressable>
|
|
178
|
+
) : null}
|
|
179
|
+
|
|
180
|
+
{data.description ? (
|
|
181
|
+
<Text size="sm" numberOfLines={full ? undefined : 5} style={{ color: theme.colors.textDim }}>
|
|
182
|
+
{plainDescription(data.description)}
|
|
183
|
+
</Text>
|
|
184
|
+
) : null}
|
|
185
|
+
|
|
186
|
+
<CreatorIdentity address={data.owner} visible={visible} />
|
|
187
|
+
|
|
188
|
+
{data.subscriberCount !== undefined ? <Note>{plural(data.subscriberCount, "subscriber")}</Note> : null}
|
|
189
|
+
</View>
|
|
190
|
+
</Card>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const styles = StyleSheet.create({
|
|
195
|
+
card: { gap: 0, padding: 0 },
|
|
196
|
+
highlight: { alignItems: "center", justifyContent: "center", paddingHorizontal: 12, paddingVertical: 8 },
|
|
197
|
+
body: { gap: 14, paddingBottom: 18, paddingHorizontal: 18, paddingTop: 6 },
|
|
198
|
+
titleRow: { alignItems: "center", flexDirection: "row", gap: 12 },
|
|
199
|
+
subscribe: { alignItems: "center", borderRadius: 14, height: 48, justifyContent: "center" },
|
|
200
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { formatRelativeTime } from "@akita-protocol/algomd-core";
|
|
4
|
+
import { useTrade } from "@akita-protocol/algomd-core/react";
|
|
5
|
+
import { ContractMenu } from "../presentation/ContractMenu";
|
|
6
|
+
import { ArrowsRightLeftIcon, ChevronRightIcon } from "../presentation/icons";
|
|
7
|
+
import { Text, useAppTheme, usePresentation } from "../presentation/runtime";
|
|
8
|
+
import { AccountRef, PersonRow } from "./AccountRef";
|
|
9
|
+
import { ActionButton, Amount, ProvenanceNote, StatusChip } from "./contractParts";
|
|
10
|
+
import { Card, CardHeader, CardSkeleton, headerMedia, InlinePill, Inset, KindTile, Row, RowSkeleton, Section, Stat, StatRow, Title, Unavailable } from "./primitives";
|
|
11
|
+
import type { RefViewProps } from "./types";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A HyperSwap trade offer. The chain keeps only Merkle roots of the transfers,
|
|
15
|
+
* so the transfers themselves show only when a resolver or host supplies them.
|
|
16
|
+
*/
|
|
17
|
+
export function TradeRef({ id, size = "large", onPress, visible }: RefViewProps) {
|
|
18
|
+
const { theme } = useAppTheme();
|
|
19
|
+
const presentation = usePresentation();
|
|
20
|
+
const trade = useTrade(id, { visible });
|
|
21
|
+
const data = trade.data?.data ?? undefined;
|
|
22
|
+
const accept = presentation.actions?.acceptTrade;
|
|
23
|
+
const title = `Trade offer #${id}`;
|
|
24
|
+
const expiry = data && Number(data.expiration) ? formatRelativeTime(Number(data.expiration)) : undefined;
|
|
25
|
+
const retry = trade.isError ? () => void trade.refetch() : undefined;
|
|
26
|
+
|
|
27
|
+
if (size === "inline") {
|
|
28
|
+
return <InlinePill label={title} dim={trade.isPending} leading={<ArrowsRightLeftIcon size={12} color={theme.colors.primary} />} onPress={onPress} />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (size === "small") {
|
|
32
|
+
if (trade.isPending) return <RowSkeleton shape="rounded" />;
|
|
33
|
+
if (!data) return <Unavailable size="small" label={title} Icon={ArrowsRightLeftIcon} onRetry={retry} />;
|
|
34
|
+
return (
|
|
35
|
+
<Row
|
|
36
|
+
leading={<KindTile Icon={ArrowsRightLeftIcon} size={40} />}
|
|
37
|
+
title={<Title>{title}</Title>}
|
|
38
|
+
subtitle={`${data.legCount} transfers · ${data.participantCount} parties${expiry ? ` · expires ${expiry}` : ""}`}
|
|
39
|
+
trailing={<StatusChip status={data.state} />}
|
|
40
|
+
onPress={onPress}
|
|
41
|
+
accessibilityLabel={`Open ${title}`}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const full = size === "full";
|
|
47
|
+
if (trade.isPending) return <CardSkeleton media="rounded" blocks={2} full={full} />;
|
|
48
|
+
if (!data) return <Unavailable size={size} label={title} Icon={ArrowsRightLeftIcon} onRetry={retry} />;
|
|
49
|
+
const others = (data.participants ?? []).filter((p) => p !== data.creator);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Card>
|
|
53
|
+
<CardHeader
|
|
54
|
+
media={<KindTile Icon={ArrowsRightLeftIcon} size={headerMedia(full)} />}
|
|
55
|
+
title={title}
|
|
56
|
+
full={full}
|
|
57
|
+
status={<StatusChip status={data.state} />}
|
|
58
|
+
meta={expiry ? `Expires ${expiry}` : undefined}
|
|
59
|
+
menu={<ContractMenu appId={data.hyperSwapAppId} type="application" embedType="TradeOffer" embedProp="offerId" embedValue={id} />}
|
|
60
|
+
/>
|
|
61
|
+
<StatRow>
|
|
62
|
+
<Stat label="Accepted">{`${data.acceptances} of ${data.participantCount}`}</Stat>
|
|
63
|
+
<Stat label="In escrow" align="right">{`${data.escrowed} of ${data.legCount}`}</Stat>
|
|
64
|
+
</StatRow>
|
|
65
|
+
|
|
66
|
+
<View style={{ gap: 8 }}>
|
|
67
|
+
{data.creator ? <PersonRow address={data.creator} role="Offered by" visible={visible} /> : null}
|
|
68
|
+
{others.map((p) => (
|
|
69
|
+
<PersonRow key={p} address={p} role="With" visible={visible} />
|
|
70
|
+
))}
|
|
71
|
+
</View>
|
|
72
|
+
|
|
73
|
+
{data.legs?.length ? (
|
|
74
|
+
<Section label="Transfers">
|
|
75
|
+
<View style={{ gap: 8 }}>
|
|
76
|
+
{data.legs.map((leg, i) => (
|
|
77
|
+
<Inset key={i} style={{ paddingVertical: 10, gap: 6 }}>
|
|
78
|
+
<View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 4 }}>
|
|
79
|
+
<AccountRef id={leg.from} size="inline" />
|
|
80
|
+
<ChevronRightIcon size={14} color={theme.colors.textDim} />
|
|
81
|
+
<AccountRef id={leg.to} size="inline" />
|
|
82
|
+
</View>
|
|
83
|
+
<Amount amount={leg.amount} assetId={leg.asset} />
|
|
84
|
+
</Inset>
|
|
85
|
+
))}
|
|
86
|
+
</View>
|
|
87
|
+
</Section>
|
|
88
|
+
) : null}
|
|
89
|
+
|
|
90
|
+
{!data.legs?.length && full ? (
|
|
91
|
+
<Text size="xxs" style={{ color: theme.colors.textDim }}>
|
|
92
|
+
The chain keeps only a fingerprint of the transfers, so they can't be listed here.
|
|
93
|
+
</Text>
|
|
94
|
+
) : null}
|
|
95
|
+
|
|
96
|
+
<ProvenanceNote entity={trade.data} />
|
|
97
|
+
{data.state === "offered" && accept ? <ActionButton label="Review and accept" onPress={() => accept(id)} /> : null}
|
|
98
|
+
</Card>
|
|
99
|
+
);
|
|
100
|
+
}
|