@akita-protocol/algomd-rn 0.0.0-stage → 1.0.0-alpha.0

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 (137) 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 +268 -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/HostRefs.tsx +82 -0
  104. package/src/refs/ListingRef.tsx +90 -0
  105. package/src/refs/NfdRef.tsx +96 -0
  106. package/src/refs/PollRef.tsx +120 -0
  107. package/src/refs/RaffleRef.tsx +101 -0
  108. package/src/refs/RewardRef.tsx +78 -0
  109. package/src/refs/StakingPoolRef.tsx +136 -0
  110. package/src/refs/SubscriptionRef.tsx +200 -0
  111. package/src/refs/TradeRef.tsx +100 -0
  112. package/src/refs/TransactionRef.tsx +156 -0
  113. package/src/refs/assetInfo.ts +49 -0
  114. package/src/refs/contractParts.tsx +159 -0
  115. package/src/refs/index.tsx +137 -0
  116. package/src/refs/primitives.tsx +588 -0
  117. package/src/refs/types.ts +13 -0
  118. package/src/types/algorand.ts +496 -0
  119. package/src/types/index.ts +1 -0
  120. package/src/ui/CopyButton.tsx +44 -0
  121. package/src/ui/DataStates.tsx +45 -0
  122. package/src/ui/ProgressBar.tsx +64 -0
  123. package/src/ui/SearchSheet.tsx +141 -0
  124. package/src/ui/SizeContainer.tsx +25 -0
  125. package/src/ui/StatusBadge.tsx +51 -0
  126. package/src/ui/index.ts +6 -0
  127. package/src/utils/algomdImageUrl.ts +20 -0
  128. package/src/utils/arc19.ts +120 -0
  129. package/src/utils/arc62.ts +246 -0
  130. package/src/utils/capacity.ts +26 -0
  131. package/src/utils/format.ts +181 -0
  132. package/src/utils/ids.ts +31 -0
  133. package/src/utils/index.ts +6 -0
  134. package/src/utils/nfdDisplay.ts +45 -0
  135. package/src/utils/search.ts +87 -0
  136. package/src/utils/stakingPool.ts +174 -0
  137. package/src/utils/stakingSnapshot.ts +132 -0
@@ -0,0 +1,496 @@
1
+ // Core Algorand Types for React Native
2
+ export interface AlgorandAccount {
3
+ id: string;
4
+ address: string;
5
+ balance: number;
6
+ assets: ASA[];
7
+ apps: Application[];
8
+ createdAt: Date;
9
+ isOnline: boolean;
10
+ round: number;
11
+ /** How many assets hold a non-zero balance, when the lookup counted them. */
12
+ heldAssetCount?: number;
13
+ }
14
+
15
+ export interface NFDProfile {
16
+ id: string;
17
+ name: string;
18
+ address: string;
19
+ avatar?: string;
20
+ bio?: string;
21
+ properties: Record<string, string>;
22
+ verified: boolean;
23
+ /** An ARC-53 community profile, which the app draws with a square avatar and a gold check. */
24
+ isCommunity?: boolean;
25
+ createdAt: Date;
26
+ }
27
+
28
+ export interface ASA {
29
+ id: number;
30
+ name: string;
31
+ unitName: string;
32
+ total: number;
33
+ /** Exact raw total when the uint64 cannot be represented safely as a number. */
34
+ totalRaw?: string;
35
+ decimals: number;
36
+ defaultFrozen: boolean;
37
+ url?: string;
38
+ /** Resolved image URL (IPFS/HTTP, CDN-proxied). Set by data hooks after ARC-19 resolution. */
39
+ imageUrl?: string;
40
+ metadataHash?: string;
41
+ manager?: string;
42
+ reserve?: string;
43
+ freeze?: string;
44
+ clawback?: string;
45
+ creator: string;
46
+ createdAt: Date;
47
+ price?: number;
48
+ verified: boolean;
49
+ /** The collection a collectible belongs to, from the Akita backend. */
50
+ collection?: Pick<Collection, "id" | "name" | "avatarUrl">;
51
+ /** Circulating supply in base units, from ARC-62 or `total - reserve_balance`. */
52
+ circulatingSupplyRaw?: string;
53
+ /** Recent USD prices, oldest first, for a token's sparkline. */
54
+ usdPriceHistory?: AssetPricePoint[];
55
+ }
56
+
57
+ /** One price sample: `time` in milliseconds since the epoch, `price` in USD. */
58
+ export interface AssetPricePoint {
59
+ time: number;
60
+ price: number;
61
+ }
62
+
63
+ /**
64
+ * `stake` and `exchange` are retained for backward compatibility.
65
+ * New integrations should use the protocol names `mint` and `redeem`.
66
+ */
67
+ export type DualStakeAction = "stake" | "exchange" | "mint" | "redeem";
68
+
69
+ export interface DualStakeActionParams {
70
+ action: DualStakeAction;
71
+ /** ARC58 wallet app ID used by the DualStakePlugin. */
72
+ wallet: bigint | number;
73
+ /** Dual stake app / pool ID. */
74
+ appId: bigint | number;
75
+ /**
76
+ * Raw input amount: ALGO base units for mint/stake, or LST base units for
77
+ * redeem/exchange.
78
+ */
79
+ amount: bigint;
80
+ /** Whether the plugin should rekey the spending account back to the wallet. */
81
+ rekeyBack: boolean;
82
+ }
83
+
84
+ export interface DualStakePool {
85
+ id: string;
86
+ appId: number;
87
+ title?: string;
88
+ description?: string;
89
+ status?: "draft" | "upcoming" | "active" | "ended" | "unknown";
90
+ stakeAsset: ASA;
91
+ /** Legacy name for the paired ASA required during minting. */
92
+ rewardAsset?: ASA;
93
+ /** The minted liquid-staking token (LST). */
94
+ dualStakeAsset?: ASA;
95
+ rewardRate?: number;
96
+ rewardRatePrecision?: number;
97
+ totalStaked?: number;
98
+ userStaked?: number;
99
+ startsAt?: Date;
100
+ endsAt?: Date;
101
+ }
102
+
103
+ export type StakingPoolStatus =
104
+ | "draft"
105
+ | "upcoming"
106
+ | "signups"
107
+ | "active"
108
+ | "ended"
109
+ | "unknown";
110
+
111
+ export type StakingPoolStakingType =
112
+ | "none"
113
+ | "heartbeat"
114
+ | "soft"
115
+ | "hard"
116
+ | "lock"
117
+ | "unknown";
118
+
119
+ export type StakingPoolDistributionType =
120
+ | "percentage"
121
+ | "flat"
122
+ | "even"
123
+ | "shuffle"
124
+ | "unknown";
125
+
126
+ export interface StakingPoolReward {
127
+ id: number;
128
+ asset: ASA;
129
+ distribution: StakingPoolDistributionType;
130
+ /** Numeric convenience for the configured gross rate before protocol royalty. */
131
+ rate: number;
132
+ /** Exact configured gross rate before protocol royalty, in asset base units. */
133
+ rateRaw: string;
134
+ /** Claim-window duration in seconds after each disbursement, not a date. */
135
+ expiration: number;
136
+ /** Exact claim-window duration in seconds. */
137
+ expirationRaw: string;
138
+ /** Creator-run reward-cycle window length, in seconds. */
139
+ interval: number;
140
+ /** Exact creator-run reward-cycle window length in seconds. */
141
+ intervalRaw: string;
142
+ /** Shuffle-only number of selections from qualifying entries. */
143
+ winnerCount: number;
144
+ /** Exact shuffle-only selection count. */
145
+ winnerCountRaw: string;
146
+ /** Reward asset still reserved for this reward, in base units; absent on pools without budgets. */
147
+ budgetRaw?: string;
148
+ }
149
+
150
+ export interface StakingPool {
151
+ id: string;
152
+ appId: number;
153
+ title: string;
154
+ description?: string;
155
+ status: StakingPoolStatus;
156
+ stakingType: StakingPoolStakingType;
157
+ signupTime?: Date;
158
+ startTime?: Date;
159
+ endTime?: Date;
160
+ allowLateSignups?: boolean;
161
+ /** Nominal on-chain entry target; one final multi-entry batch may exceed it. */
162
+ maxEntries?: number;
163
+ /** Exact nominal entry target. Zero means unlimited on legacy pools. */
164
+ maxEntriesRaw?: string;
165
+ entryCount: number;
166
+ entryCountRaw?: string;
167
+ rewardCount: number;
168
+ rewardCountRaw?: string;
169
+ /** Optional aggregate stake. Deployed pool versions may not maintain it. */
170
+ totalStaked?: number;
171
+ totalStakedRaw?: string;
172
+ minimumStakeAmount: number;
173
+ minimumStakeAmountRaw?: string;
174
+ /**
175
+ * The staked asset's metadata, known only when the pool takes a single asset. A pool's
176
+ * asset list can mix decimals, so without it the minimum is shown per asset when joining.
177
+ */
178
+ stakeDecimals?: number;
179
+ stakeUnitName?: string;
180
+ /** Explicit eligibility metadata. Missing metadata must remain unknown. */
181
+ unrestricted?: boolean;
182
+ stakeKey?: {
183
+ address: string;
184
+ name: string;
185
+ };
186
+ gateAppId?: number;
187
+ creator: string;
188
+ rewards: StakingPoolReward[];
189
+ }
190
+
191
+ export interface PrizeBoxHolding {
192
+ asset: ASA;
193
+ /** Exact amount held by the Prize Box application account, in base units. */
194
+ amountRaw: string;
195
+ }
196
+
197
+ export interface PrizeBoxBundle {
198
+ /** Prize Box application ID, kept as a string to preserve uint64 precision. */
199
+ appId: string;
200
+ /** Application account address used to resolve the bundle contents. */
201
+ address?: string;
202
+ /** ASA balances currently held by the Prize Box application account. */
203
+ holdings: PrizeBoxHolding[];
204
+ /** Full account ALGO balance; includes the app account's minimum balance. */
205
+ accountAlgoBalanceRaw?: string;
206
+ }
207
+
208
+ export interface Collection {
209
+ voteCount?: number;
210
+ isNegative?: boolean;
211
+ id: string;
212
+ name: string;
213
+ description?: string;
214
+ avatar?: string | number;
215
+ avatarUrl?: string;
216
+ avatarMime?: string;
217
+ banner?: string | number;
218
+ network?: string;
219
+ explicit?: boolean;
220
+ prefixes?: string[];
221
+ artists?: string[];
222
+ nfdId?: number;
223
+ }
224
+
225
+ export interface Application {
226
+ id: number;
227
+ creator: string;
228
+ globalState: Record<string, unknown>;
229
+ localState: Record<string, unknown>;
230
+ params: {
231
+ globalNumUint: number;
232
+ globalNumByteSlice: number;
233
+ localNumUint: number;
234
+ localNumByteSlice: number;
235
+ };
236
+ createdAt: Date;
237
+ name?: string;
238
+ description?: string;
239
+ }
240
+
241
+ export interface TransactionDetails {
242
+ id: string;
243
+ type:
244
+ | "payment"
245
+ | "asset-transfer"
246
+ | "application-call"
247
+ | "asset-config"
248
+ | "key-registration"
249
+ | "asset-freeze";
250
+ from: string;
251
+ to?: string;
252
+ amount?: number;
253
+ asset?: ASA;
254
+ application?: Application;
255
+ note?: string;
256
+ fee: number;
257
+ round: number;
258
+ timestamp: Date;
259
+ confirmed: boolean;
260
+ signature: string;
261
+ context?: {
262
+ type:
263
+ | "nft-purchase"
264
+ | "auction-won"
265
+ | "raffle-entry"
266
+ | "trade-offer"
267
+ | "vote";
268
+ metadata: Record<string, unknown>;
269
+ };
270
+ }
271
+
272
+ // Social and Trading Types
273
+ export interface NFTListing {
274
+ id: string;
275
+ nft: ASA;
276
+ price: number;
277
+ priceAsset: ASA;
278
+ currency: string;
279
+ seller: string;
280
+ collection?: string;
281
+ authenticityBadge: boolean;
282
+ quantity: number;
283
+ reservedFor?: string;
284
+ gating?: GatingInfo;
285
+ /** Set when the listing sells a Prize Box bundle instead of a single asset. */
286
+ isPrizeBox?: boolean;
287
+ /** Prize Box application ID, kept as a string to preserve uint64 precision. */
288
+ prizeBoxAppId?: string;
289
+ /** The bundle for sale; `nft` then holds its lead asset for previews. */
290
+ prizeBox?: PrizeBoxBundle;
291
+ views: number;
292
+ favorites: number;
293
+ createdAt: Date;
294
+ listedAt: Date;
295
+ expiresAt?: Date;
296
+ /** Address of buyer (set locally after purchase, app is deleted on-chain) */
297
+ buyer?: string;
298
+ }
299
+
300
+ export interface RaffleListing {
301
+ id: string;
302
+ title: string;
303
+ description: string;
304
+ pricePerEntry: number;
305
+ /** Exact ticket unit in base units. Akita raffles use one base unit. */
306
+ pricePerEntryRaw?: string;
307
+ entryAsset: ASA;
308
+ startTime: Date;
309
+ endTime: Date;
310
+ prizes: ASA[];
311
+ /** Number of unique entries/participants. */
312
+ entryCount: number;
313
+ /**
314
+ * Total ticket weight in base units of `entryAsset`.
315
+ * Historically this field was treated as a capacity by the RN card; it is
316
+ * now mapped to the contract's `ticketCount` value.
317
+ */
318
+ ticketCount: number;
319
+ /** Explicit semantic aliases for consumers migrating from legacy fields. */
320
+ participantCount?: number;
321
+ participantCountRaw?: string;
322
+ totalTicketWeight?: number;
323
+ totalTicketWeightRaw?: string;
324
+ /** Minimum and maximum ticket weight allowed per participant, in base units. */
325
+ minTickets?: number;
326
+ maxTickets?: number;
327
+ minTicketsRaw?: string;
328
+ maxTicketsRaw?: string;
329
+ /** Optional true capacity for integrations that impose one off-chain. */
330
+ ticketCapacity?: number;
331
+ gating?: GatingInfo;
332
+ creator: string;
333
+ status: "upcoming" | "active" | "ended" | "claimed";
334
+ /** Address of the raffle winner */
335
+ winner?: string;
336
+ /**
337
+ * Where the draw stands once entries close. Drawing takes a few rounds:
338
+ * "waiting" until someone starts it, "drawing" while the randomness and the
339
+ * winner are settled, "won" once the winner is known.
340
+ */
341
+ drawStatus?: "waiting" | "drawing" | "won";
342
+ prizeClaimed?: boolean;
343
+ /** True when `prize` is a Prize Box application ID instead of an ASA ID. */
344
+ isPrizeBox?: boolean;
345
+ /** Convenience alias for persisted renderers that do not inspect `prizeBox`. */
346
+ prizeBoxAppId?: string;
347
+ prizeBox?: PrizeBoxBundle;
348
+ }
349
+
350
+ export interface AuctionListing {
351
+ id: string;
352
+ title: string;
353
+ description: string;
354
+ bidAsset: ASA;
355
+ currentHighestBid: number;
356
+ /** Exact current highest bid in bid-asset base units. */
357
+ currentHighestBidRaw?: string;
358
+ minimumNextBid: number;
359
+ /** Exact minimum next bid in bid-asset base units. */
360
+ minimumNextBidRaw?: string;
361
+ startTime: Date;
362
+ endTime: Date;
363
+ prizes: ASA[];
364
+ bidFeePercentage?: number;
365
+ currentBidFeePool: number;
366
+ /** Exact accumulated bid-fee pool in bid-asset base units. */
367
+ currentBidFeePoolRaw?: string;
368
+ bidCount: number;
369
+ bidCountRaw?: string;
370
+ timeExtended: boolean;
371
+ gating?: GatingInfo;
372
+ creator: string;
373
+ status: "upcoming" | "active" | "ended" | "claimed";
374
+ /** Address of the highest bidder (winner when ended/claimed) */
375
+ winner?: string;
376
+ /**
377
+ * The raffle among the other bidders that a bid fee pays for. Present only
378
+ * when the auction charges a bid fee. Drawing takes a few rounds after the
379
+ * auction ends: "waiting" until someone starts the draw, "drawing" while the
380
+ * randomness and the winner are being settled.
381
+ */
382
+ raffle?: AuctionRaffle;
383
+ /** True when `prize` is a Prize Box application ID instead of an ASA ID. */
384
+ isPrizeBox?: boolean;
385
+ /** Convenience alias for persisted renderers that do not inspect `prizeBox`. */
386
+ prizeBoxAppId?: string;
387
+ prizeBox?: PrizeBoxBundle;
388
+ }
389
+
390
+ export interface AuctionRaffle {
391
+ status: "waiting" | "drawing" | "won" | "claimed";
392
+ /** Raffle winner, once drawn. */
393
+ winner?: string;
394
+ /** Bid fees collected so far, in whole bid-asset units. */
395
+ amount: number;
396
+ /** Exact bid fees collected so far, in bid-asset base units. */
397
+ amountRaw?: string;
398
+ }
399
+
400
+ export interface TradeOffer {
401
+ id: string;
402
+ creator: string;
403
+ recipients: string[];
404
+ offering: (ASA | AlgorandAccount)[];
405
+ requesting: (ASA | AlgorandAccount)[];
406
+ message?: string;
407
+ expiresAt: Date;
408
+ status: "pending" | "accepted" | "rejected" | "expired";
409
+ createdAt: Date;
410
+ }
411
+
412
+ export interface Poll {
413
+ id: string;
414
+ question: string;
415
+ options: PollOption[];
416
+ creator: string;
417
+ createdAt: Date;
418
+ expiresAt?: Date;
419
+ totalVotes: number;
420
+ status: "active" | "ended";
421
+ gating?: GatingInfo;
422
+ }
423
+
424
+ export interface PollOption {
425
+ id: string;
426
+ text: string;
427
+ asset?: ASA;
428
+ collection?: string;
429
+ votes: number;
430
+ votingPower: number;
431
+ }
432
+
433
+ export interface GatingInfo {
434
+ type:
435
+ | "asset-holding"
436
+ | "nfd-verified"
437
+ | "application-optin"
438
+ | "custom"
439
+ | "token"
440
+ | "nft";
441
+ requirements: {
442
+ assets?: { assetId: number; minimumBalance: number }[];
443
+ nfdVerified?: boolean;
444
+ applications?: number[];
445
+ custom?: Record<string, unknown>;
446
+ };
447
+ requirement?: number;
448
+ asset?: string;
449
+ collection?: string;
450
+ /** The gate registry ID checked when the viewer acts. */
451
+ gateId?: string;
452
+ /** The gate's rules, decoded from the gate registry, when they could be read. */
453
+ rules?: GateRule[];
454
+ }
455
+
456
+ /** A comparison in a gate rule. */
457
+ export type GateOperator = "=" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not in";
458
+
459
+ /** One rule of an on-chain gate, with amounts kept as base-unit strings. */
460
+ export type GateRule =
461
+ | { type: "asset"; assetId: number; op: GateOperator; amountRaw: string; asset?: ASA }
462
+ | { type: "nfd" }
463
+ | { type: "nfd_root"; root: string }
464
+ | { type: "akita_referrer"; referrer: string }
465
+ | { type: "merkle_address" | "merkle_asset"; creator: string; name: string }
466
+ | { type: "poll"; pollId: string }
467
+ | { type: "social_activity" | "social_follower_count" | "social_impact" | "social_moderator"; op: GateOperator; value: string }
468
+ | { type: "social_follower_index"; user: string; op: GateOperator; value: string }
469
+ | { type: "staking_amount"; assetId: number; op: GateOperator; amountRaw: string; stakingType?: string; asset?: ASA }
470
+ | { type: "staking_power"; assetId: number; op: GateOperator; power: string; asset?: ASA }
471
+ | { type: "subscription"; merchant: string; serviceId: string }
472
+ | { type: "subscription_streak"; merchant: string; serviceId: string; op: GateOperator; streak: string };
473
+
474
+ // Search Types
475
+ export interface SearchResult<T> {
476
+ item: T;
477
+ score: number;
478
+ matches: string[];
479
+ }
480
+
481
+ export type SearchableEntity =
482
+ | AlgorandAccount
483
+ | NFDProfile
484
+ | ASA
485
+ | Collection
486
+ | Application
487
+ | TransactionDetails
488
+ | NFTListing
489
+ | RaffleListing
490
+ | AuctionListing
491
+ | TradeOffer
492
+ | Poll
493
+ | StakingPool;
494
+
495
+ // Component shared prop types
496
+ export type ComponentSize = "sm" | "md" | "lg" | "full" | "fullscreen";
@@ -0,0 +1 @@
1
+ export * from './algorand';
@@ -0,0 +1,44 @@
1
+ import React, { useCallback } from 'react';
2
+ import { Pressable } from 'react-native';
3
+ import * as Clipboard from 'expo-clipboard';
4
+ import * as Haptics from 'expo-haptics';
5
+ import Svg, { Path } from 'react-native-svg';
6
+
7
+ interface CopyButtonProps {
8
+ value: string;
9
+ size?: number;
10
+ color?: string;
11
+ className?: string;
12
+ onCopied?: () => void;
13
+ accessibilityLabel?: string;
14
+ }
15
+
16
+ function CopyIcon({ size = 16, color = '#a1a1aa' }: { size?: number; color?: string }) {
17
+ return (
18
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
19
+ <Path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" />
20
+ <Path d="M15 2H9a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1Z" />
21
+ </Svg>
22
+ );
23
+ }
24
+
25
+ export function CopyButton({ value, size = 16, color = '#a1a1aa', className, onCopied, accessibilityLabel }: CopyButtonProps) {
26
+ const handleCopy = useCallback(async () => {
27
+ await Clipboard.setStringAsync(value);
28
+ await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
29
+ onCopied?.();
30
+ }, [value, onCopied]);
31
+
32
+ return (
33
+ <Pressable
34
+ onPress={handleCopy}
35
+ className={`p-1.5 rounded-lg ${className ?? ''}`}
36
+ hitSlop={8}
37
+ accessibilityRole="button"
38
+ accessibilityLabel={accessibilityLabel ?? 'Copy to clipboard'}
39
+ accessibilityHint="Copies this value to the clipboard"
40
+ >
41
+ <CopyIcon size={size} color={color} />
42
+ </Pressable>
43
+ );
44
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { View, Text, ActivityIndicator } from 'react-native';
3
+
4
+ interface LoadingSkeletonProps {
5
+ name: string;
6
+ }
7
+
8
+ export function LoadingSkeleton({ name }: LoadingSkeletonProps) {
9
+ return (
10
+ <View
11
+ className="rounded-xl items-center justify-center bg-zinc-900/80"
12
+ style={{ padding: 20, minHeight: 80, borderWidth: 1, borderColor: '#27272a' }}
13
+ accessibilityLabel={`Loading ${name}`}
14
+ accessibilityState={{ busy: true }}
15
+ >
16
+ <ActivityIndicator size="small" color="#a1a1aa" />
17
+ <Text className="mt-2 text-xs text-zinc-500">
18
+ Loading {name}...
19
+ </Text>
20
+ </View>
21
+ );
22
+ }
23
+
24
+ interface ErrorStateProps {
25
+ name: string;
26
+ message: string;
27
+ }
28
+
29
+ export function ErrorState({ name, message }: ErrorStateProps) {
30
+ return (
31
+ <View
32
+ className="rounded-xl bg-zinc-900/80"
33
+ style={{ padding: 16, minHeight: 60, borderWidth: 1, borderColor: 'rgba(239,68,68,0.25)' }}
34
+ accessibilityRole="alert"
35
+ accessibilityLiveRegion="polite"
36
+ >
37
+ <Text className="text-xs font-semibold text-red-400">
38
+ Failed to load {name}
39
+ </Text>
40
+ <Text className="text-xs text-zinc-500 mt-1">
41
+ {message}
42
+ </Text>
43
+ </View>
44
+ );
45
+ }
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import Animated, {
4
+ useAnimatedStyle,
5
+ withTiming,
6
+ useDerivedValue,
7
+ ReduceMotion,
8
+ Easing,
9
+ } from 'react-native-reanimated';
10
+
11
+ interface ProgressBarProps {
12
+ /** A value between 0 and 100. */
13
+ percentage: number;
14
+ /** Height of the bar in Tailwind. Defaults to h-2. */
15
+ heightClass?: string;
16
+ /** Track background class. */
17
+ trackClass?: string;
18
+ /** Fill background class. */
19
+ fillClass?: string;
20
+ className?: string;
21
+ }
22
+
23
+ export function ProgressBar({
24
+ percentage,
25
+ heightClass = 'h-2',
26
+ trackClass = 'bg-zinc-700',
27
+ fillClass = 'bg-purple-500',
28
+ className,
29
+ }: ProgressBarProps) {
30
+ const clampedPct = useDerivedValue(() =>
31
+ Number.isFinite(percentage) ? Math.max(0, Math.min(100, percentage)) : 0,
32
+ );
33
+ const accessibilityPercentage = Number.isFinite(percentage)
34
+ ? Math.max(0, Math.min(100, percentage))
35
+ : 0;
36
+
37
+ const fillStyle = useAnimatedStyle(() => ({
38
+ position: 'absolute',
39
+ left: 0,
40
+ top: 0,
41
+ height: '100%',
42
+ width: withTiming(`${clampedPct.get()}%` as `${number}%`, {
43
+ duration: 200,
44
+ easing: Easing.linear,
45
+ reduceMotion: ReduceMotion.System,
46
+ }),
47
+ }));
48
+
49
+ return (
50
+ <View
51
+ className={`w-full rounded-full overflow-hidden ${trackClass} ${heightClass} ${className ?? ''}`}
52
+ accessibilityRole="progressbar"
53
+ accessibilityValue={{ min: 0, max: 100, now: accessibilityPercentage }}
54
+ aria-valuemin={0}
55
+ aria-valuemax={100}
56
+ aria-valuenow={accessibilityPercentage}
57
+ >
58
+ <Animated.View style={fillStyle}>
59
+ {/* Keep NativeWind classes on a core View; Reanimated drops them on web. */}
60
+ <View className={`${heightClass} rounded-full ${fillClass}`} />
61
+ </Animated.View>
62
+ </View>
63
+ );
64
+ }