@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,79 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import Svg, { Path } from 'react-native-svg';
|
|
4
|
+
import type { Poll } from '../types/algorand';
|
|
5
|
+
import { formatRelativeTime } from '../utils/format';
|
|
6
|
+
import { SearchSheet } from '../ui/SearchSheet';
|
|
7
|
+
|
|
8
|
+
function VoteIcon({ size = 16, color = '#a1a1aa' }: { size?: number; color?: string }) {
|
|
9
|
+
return (
|
|
10
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
|
|
11
|
+
<Path d="m9 12 2 2 4-4" />
|
|
12
|
+
<Path d="M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z" />
|
|
13
|
+
<Path d="M22 19H2" />
|
|
14
|
+
</Svg>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface PollSearchProps {
|
|
19
|
+
data: Poll[];
|
|
20
|
+
onSelect?: (poll: Poll) => void;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function PollSearch({
|
|
26
|
+
data,
|
|
27
|
+
onSelect,
|
|
28
|
+
placeholder = 'Search polls...',
|
|
29
|
+
className,
|
|
30
|
+
}: PollSearchProps) {
|
|
31
|
+
const [selected, setSelected] = useState<Poll | null>(null);
|
|
32
|
+
|
|
33
|
+
const handleSelect = useCallback(
|
|
34
|
+
(poll: Poll) => {
|
|
35
|
+
setSelected(poll);
|
|
36
|
+
onSelect?.(poll);
|
|
37
|
+
},
|
|
38
|
+
[onSelect],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const renderItem = useCallback(
|
|
42
|
+
(poll: Poll) => (
|
|
43
|
+
<View className="flex-row items-center gap-3">
|
|
44
|
+
<VoteIcon size={16} color={poll.status === 'active' ? '#34d399' : '#71717a'} />
|
|
45
|
+
<View className="flex-1">
|
|
46
|
+
<Text className="text-sm font-medium text-white" numberOfLines={1}>
|
|
47
|
+
{poll.question}
|
|
48
|
+
</Text>
|
|
49
|
+
<Text className="text-xs text-zinc-400">
|
|
50
|
+
{poll.totalVotes} votes - {poll.options.length} options - {formatRelativeTime(poll.createdAt)}
|
|
51
|
+
</Text>
|
|
52
|
+
</View>
|
|
53
|
+
<View className={`px-2 py-0.5 rounded-full ${poll.status === 'active' ? 'bg-green-500/20' : 'bg-zinc-700'}`}>
|
|
54
|
+
<Text className={`text-xs font-medium ${poll.status === 'active' ? 'text-green-400' : 'text-zinc-400'}`}>
|
|
55
|
+
{poll.status.charAt(0).toUpperCase() + poll.status.slice(1)}
|
|
56
|
+
</Text>
|
|
57
|
+
</View>
|
|
58
|
+
</View>
|
|
59
|
+
),
|
|
60
|
+
[],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<View className={className}>
|
|
65
|
+
<SearchSheet
|
|
66
|
+
data={data}
|
|
67
|
+
placeholder={placeholder}
|
|
68
|
+
onSelect={handleSelect}
|
|
69
|
+
renderItem={renderItem}
|
|
70
|
+
/>
|
|
71
|
+
{selected && (
|
|
72
|
+
<View className="mt-3 p-3 rounded-lg bg-zinc-800 border border-zinc-700">
|
|
73
|
+
<Text className="text-xs font-medium text-zinc-400 mb-1">Selected Poll</Text>
|
|
74
|
+
{renderItem(selected)}
|
|
75
|
+
</View>
|
|
76
|
+
)}
|
|
77
|
+
</View>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PrizeBoxBundleContents } from "../presentation/PrizeBoxBundleDisplay";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isCompactReference, type ReferenceVariantProps } from "../presentation/variants";
|
|
2
|
+
import { CompactPillWithImage } from "../presentation/References";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import {
|
|
5
|
+
RaffleListingDisplay,
|
|
6
|
+
type RaffleListingDisplayProps,
|
|
7
|
+
} from "../presentation/RaffleListingDisplay";
|
|
8
|
+
import type { ComponentSize } from "../types/algorand";
|
|
9
|
+
import { SizeContainer } from "../ui/SizeContainer";
|
|
10
|
+
export interface RaffleListingProps extends RaffleListingDisplayProps, ReferenceVariantProps {
|
|
11
|
+
size?: ComponentSize;
|
|
12
|
+
className?: string;
|
|
13
|
+
showEntryButton?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export function RaffleListingComponent({
|
|
16
|
+
size = "full",
|
|
17
|
+
className,
|
|
18
|
+
compact,
|
|
19
|
+
inline,
|
|
20
|
+
data,
|
|
21
|
+
imageUrl,
|
|
22
|
+
showEntryButton = true,
|
|
23
|
+
onEnter,
|
|
24
|
+
...display
|
|
25
|
+
}: RaffleListingProps) {
|
|
26
|
+
if (isCompactReference({ size, compact, inline })) return <CompactPillWithImage label={data.title} imageUrl={imageUrl ?? data.prizes[0]?.imageUrl} inline={inline} />;
|
|
27
|
+
const card = (
|
|
28
|
+
<RaffleListingDisplay
|
|
29
|
+
{...display}
|
|
30
|
+
data={data}
|
|
31
|
+
imageUrl={imageUrl ?? data.prizes[0]?.imageUrl}
|
|
32
|
+
onEnter={showEntryButton ? onEnter : undefined}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
return (
|
|
36
|
+
<SizeContainer size={size} className={className}>
|
|
37
|
+
{card}
|
|
38
|
+
</SizeContainer>
|
|
39
|
+
);
|
|
40
|
+
}
|