@akita-protocol/algomd-rn 1.0.0-alpha.10 → 1.0.0-alpha.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akita-protocol/algomd-rn",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -39,7 +39,7 @@
39
39
  }
40
40
  },
41
41
  "devDependencies": {
42
- "@akita-protocol/sdk": "1.5.0-canary.0",
42
+ "@akita-protocol/sdk": "2.0.0",
43
43
  "@algorandfoundation/algokit-utils": "^9.2.2",
44
44
  "@gorhom/bottom-sheet": "^5.2.14",
45
45
  "@playwright/test": "^1.63.0",
@@ -79,7 +79,7 @@
79
79
  "vite": "^6.4.3"
80
80
  },
81
81
  "dependencies": {
82
- "@akita-protocol/algomd-core": "1.0.0-alpha.10"
82
+ "@akita-protocol/algomd-core": "1.0.0-alpha.11"
83
83
  },
84
84
  "exports": {
85
85
  ".": "./src/index.ts",
@@ -129,7 +129,8 @@ export interface AppPresentation {
129
129
  bid?: (appId: string) => void;
130
130
  enterRaffle?: (appId: string) => void;
131
131
  vote?: (appId: string, optionIndexes: number[]) => void;
132
- claimReward?: (disbursementId: string) => void;
132
+ /** Ids count per Rewards app, so the claim has to go to `rewardsAppId`. */
133
+ claimReward?: (disbursementId: string, rewardsAppId: string) => void;
133
134
  subscribe?: (owner: string, serviceId: string) => void;
134
135
  dualStakeMint?: (appId: string) => void;
135
136
  dualStakeRedeem?: (appId: string) => void;
@@ -149,7 +149,7 @@ function PlainAction({ action }: { action: GuildProposalAction }) {
149
149
  const { theme } = useAppTheme();
150
150
  const presentation = usePresentation();
151
151
  const plugin = action.pluginAppId ? presentation.applicationLabel?.(action.pluginAppId) ?? `#${action.pluginAppId}` : undefined;
152
- return (
152
+ const row = (
153
153
  <View style={styles.plainRow}>
154
154
  <View style={[styles.dot, { backgroundColor: theme.colors.primary }]} />
155
155
  <Text size="xs" style={{ flex: 1 }}>
@@ -158,6 +158,14 @@ function PlainAction({ action }: { action: GuildProposalAction }) {
158
158
  </Text>
159
159
  </View>
160
160
  );
161
+ if (!action.warnings?.length) return row;
162
+ // An action with no terms to open can still be one to think twice about, such as deleting an escrow.
163
+ return (
164
+ <View style={{ gap: 6 }}>
165
+ {row}
166
+ <Warnings warnings={action.warnings} />
167
+ </View>
168
+ );
161
169
  }
162
170
 
163
171
  /** Action headers use a small tile beside a one-line title. */
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { formatRelativeTime } from "@akita-protocol/algomd-core";
2
+ import { formatRelativeTime, splitRewardId } from "@akita-protocol/algomd-core";
3
3
  import { useReward } from "@akita-protocol/algomd-core/react";
4
4
  import { GiftIcon } from "../presentation/icons";
5
5
  import { Text, useAppTheme, usePresentation } from "../presentation/runtime";
@@ -16,7 +16,7 @@ function claimedShare(distributed: string, amount: string): string {
16
16
  return `${p >= 99.5 || p === 0 ? Math.round(p) : p < 1 ? "<1" : Math.round(p)}%`;
17
17
  }
18
18
 
19
- /** A reward disbursement in the Rewards singleton. */
19
+ /** A reward disbursement in a Rewards app. `id` is `<rewardsAppId>/<id>`, or the id alone from a tag that names no app. */
20
20
  export function RewardRef({ id, size = "large", onPress, visible }: RefViewProps) {
21
21
  const { theme } = useAppTheme();
22
22
  const presentation = usePresentation();
@@ -24,7 +24,7 @@ export function RewardRef({ id, size = "large", onPress, visible }: RefViewProps
24
24
  const data = reward.data?.data ?? undefined;
25
25
  const claim = presentation.actions?.claimReward;
26
26
  const press = onPress ?? (presentation.onOpenContract ? () => presentation.onOpenContract!("reward", id) : undefined);
27
- const title = data?.title || `Reward ${id}`;
27
+ const title = data?.title || `Reward ${splitRewardId(id).id}`;
28
28
  // A claimable disbursement with nothing left reads as done, not open.
29
29
  const status = data?.status === "claimable" && Number(data.allocations) === 0 ? "claimed" : data?.status ?? "";
30
30
  const retry = reward.isError ? () => void reward.refetch() : undefined;
@@ -72,7 +72,7 @@ export function RewardRef({ id, size = "large", onPress, visible }: RefViewProps
72
72
  </StatRow>
73
73
  {full && data.creator ? <PersonRow address={data.creator} role="From" visible={visible} /> : null}
74
74
  <ProvenanceNote entity={reward.data} />
75
- {data.status === "claimable" && open && claim ? <ActionButton label="Claim" onPress={() => claim(id)} /> : null}
75
+ {data.status === "claimable" && open && claim ? <ActionButton label="Claim" onPress={() => claim(data.id, data.rewardsAppId)} /> : null}
76
76
  </Card>
77
77
  );
78
78
  }