@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.
Files changed (138) hide show
  1. package/README.md +137 -2
  2. package/package.json +118 -3
  3. package/src/adapters/index.ts +4 -0
  4. package/src/adapters/txn-graph.ts +138 -0
  5. package/src/components/ASA.tsx +38 -0
  6. package/src/components/ASASearch.tsx +79 -0
  7. package/src/components/Account.tsx +42 -0
  8. package/src/components/AccountSearch.tsx +75 -0
  9. package/src/components/AuctionListing.tsx +40 -0
  10. package/src/components/Collection.tsx +42 -0
  11. package/src/components/DualStakePool.tsx +244 -0
  12. package/src/components/NFDProfile.tsx +45 -0
  13. package/src/components/NFDSearch.tsx +81 -0
  14. package/src/components/NFTListing.tsx +73 -0
  15. package/src/components/NFTSearch.tsx +68 -0
  16. package/src/components/Poll.tsx +39 -0
  17. package/src/components/PollSearch.tsx +79 -0
  18. package/src/components/PrizeBoxBundle.tsx +1 -0
  19. package/src/components/RaffleListing.tsx +40 -0
  20. package/src/components/SelfFetching.tsx +1048 -0
  21. package/src/components/StakingPool.tsx +134 -0
  22. package/src/components/TradeOffer.tsx +47 -0
  23. package/src/components/TradeSearch.tsx +103 -0
  24. package/src/components/TransactionDetails.tsx +37 -0
  25. package/src/components/TransactionSearch.tsx +102 -0
  26. package/src/components/TransactionsGraph.tsx +60 -0
  27. package/src/components/index.ts +41 -0
  28. package/src/fonts/OFL.txt +93 -0
  29. package/src/fonts/SpaceGrotesk_300Light.ttf +0 -0
  30. package/src/fonts/SpaceGrotesk_400Regular.ttf +0 -0
  31. package/src/fonts/SpaceGrotesk_500Medium.ttf +0 -0
  32. package/src/fonts/SpaceGrotesk_600SemiBold.ttf +0 -0
  33. package/src/fonts/SpaceGrotesk_700Bold.ttf +0 -0
  34. package/src/fonts/app.css +5 -0
  35. package/src/graph.ts +3 -0
  36. package/src/hooks/index.ts +17 -0
  37. package/src/hooks/useAlgomdData.ts +1539 -0
  38. package/src/hooks/useAlgorandClient.ts +54 -0
  39. package/src/index.ts +147 -0
  40. package/src/presentation/ASADisplay.tsx +380 -0
  41. package/src/presentation/AccountDisplay.tsx +132 -0
  42. package/src/presentation/AccountMentionInline.tsx +38 -0
  43. package/src/presentation/AccountMentionText.tsx +80 -0
  44. package/src/presentation/AdaptiveImage.tsx +314 -0
  45. package/src/presentation/AssetMention.tsx +87 -0
  46. package/src/presentation/AuctionListingDisplay.tsx +428 -0
  47. package/src/presentation/BundleContents.tsx +228 -0
  48. package/src/presentation/CardContainer.tsx +61 -0
  49. package/src/presentation/CardEntrance.tsx +21 -0
  50. package/src/presentation/CollectionDisplay.tsx +168 -0
  51. package/src/presentation/ContractMenu.tsx +243 -0
  52. package/src/presentation/DualStakePoolDisplay.tsx +335 -0
  53. package/src/presentation/Embeds.tsx +300 -0
  54. package/src/presentation/GateRequirements.tsx +334 -0
  55. package/src/presentation/HEROICONS-LICENSE.txt +21 -0
  56. package/src/presentation/NFDProfileDisplay.tsx +194 -0
  57. package/src/presentation/NFTListingDisplay.tsx +284 -0
  58. package/src/presentation/OnChainActionCard.tsx +557 -0
  59. package/src/presentation/PollDisplay.tsx +222 -0
  60. package/src/presentation/PrizeBoxBundleDisplay.tsx +103 -0
  61. package/src/presentation/PrizeBoxMedia.tsx +46 -0
  62. package/src/presentation/PrizePreview.tsx +296 -0
  63. package/src/presentation/ProgressBar.tsx +50 -0
  64. package/src/presentation/RaffleListingDisplay.tsx +399 -0
  65. package/src/presentation/References.tsx +310 -0
  66. package/src/presentation/ReservedNotice.tsx +73 -0
  67. package/src/presentation/ResultsPanel.tsx +241 -0
  68. package/src/presentation/Sparkline.tsx +70 -0
  69. package/src/presentation/SquishyPressable.tsx +145 -0
  70. package/src/presentation/StakingPoolDisplay.tsx +419 -0
  71. package/src/presentation/StatusBadge.tsx +56 -0
  72. package/src/presentation/TradeOfferDisplay.tsx +275 -0
  73. package/src/presentation/TransactionDisplay.tsx +262 -0
  74. package/src/presentation/WinnerBadge.tsx +58 -0
  75. package/src/presentation/assetHelpers.ts +36 -0
  76. package/src/presentation/assets.ts +7 -0
  77. package/src/presentation/explorer.ts +95 -0
  78. package/src/presentation/format.ts +90 -0
  79. package/src/presentation/gates.ts +100 -0
  80. package/src/presentation/icons.tsx +1178 -0
  81. package/src/presentation/identity.tsx +175 -0
  82. package/src/presentation/index.ts +88 -0
  83. package/src/presentation/media.ts +70 -0
  84. package/src/presentation/pluginColors.ts +8 -0
  85. package/src/presentation/runtime.tsx +280 -0
  86. package/src/presentation/sheets.tsx +7 -0
  87. package/src/presentation/subject.tsx +31 -0
  88. package/src/presentation/textTheme.ts +17 -0
  89. package/src/presentation/themes.json +158 -0
  90. package/src/presentation/variants.ts +14 -0
  91. package/src/provider/AlgomdProvider.tsx +45 -0
  92. package/src/provider/context.ts +18 -0
  93. package/src/provider/imageResolver.ts +12 -0
  94. package/src/provider/index.ts +5 -0
  95. package/src/provider/networks.ts +23 -0
  96. package/src/provider/types.ts +29 -0
  97. package/src/refs/AccountRef.tsx +226 -0
  98. package/src/refs/ApplicationRef.tsx +72 -0
  99. package/src/refs/AssetRef.tsx +142 -0
  100. package/src/refs/AuctionRef.tsx +108 -0
  101. package/src/refs/CollectionRef.tsx +70 -0
  102. package/src/refs/DualStakeRef.tsx +88 -0
  103. package/src/refs/GuildProposalRef.tsx +285 -0
  104. package/src/refs/HostRefs.tsx +82 -0
  105. package/src/refs/ListingRef.tsx +90 -0
  106. package/src/refs/NfdRef.tsx +96 -0
  107. package/src/refs/PollRef.tsx +120 -0
  108. package/src/refs/RaffleRef.tsx +101 -0
  109. package/src/refs/RewardRef.tsx +78 -0
  110. package/src/refs/StakingPoolRef.tsx +136 -0
  111. package/src/refs/SubscriptionRef.tsx +200 -0
  112. package/src/refs/TradeRef.tsx +100 -0
  113. package/src/refs/TransactionRef.tsx +156 -0
  114. package/src/refs/assetInfo.ts +49 -0
  115. package/src/refs/contractParts.tsx +159 -0
  116. package/src/refs/index.tsx +140 -0
  117. package/src/refs/primitives.tsx +588 -0
  118. package/src/refs/types.ts +13 -0
  119. package/src/types/algorand.ts +496 -0
  120. package/src/types/index.ts +1 -0
  121. package/src/ui/CopyButton.tsx +44 -0
  122. package/src/ui/DataStates.tsx +45 -0
  123. package/src/ui/ProgressBar.tsx +64 -0
  124. package/src/ui/SearchSheet.tsx +141 -0
  125. package/src/ui/SizeContainer.tsx +25 -0
  126. package/src/ui/StatusBadge.tsx +51 -0
  127. package/src/ui/index.ts +6 -0
  128. package/src/utils/algomdImageUrl.ts +20 -0
  129. package/src/utils/arc19.ts +120 -0
  130. package/src/utils/arc62.ts +246 -0
  131. package/src/utils/capacity.ts +26 -0
  132. package/src/utils/format.ts +181 -0
  133. package/src/utils/ids.ts +31 -0
  134. package/src/utils/index.ts +6 -0
  135. package/src/utils/nfdDisplay.ts +45 -0
  136. package/src/utils/search.ts +87 -0
  137. package/src/utils/stakingPool.ts +174 -0
  138. 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
+ }