Skip to content

Commit

Permalink
fix: airdrops release fixes (anoma#501)
Browse files Browse the repository at this point in the history
* fix: typos

* feat: group ethresearch

* fix: cr
  • Loading branch information
mateuszjasiuk authored Dec 6, 2023
1 parent b2f01bf commit 6a10637
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 10 deletions.
2 changes: 2 additions & 0 deletions apps/airdrop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dompurify": "^3.0.2",
"gsap": "^3.12.2",
"jotai": "^2.5.1",
"lodash.groupby": "^4.6.0",
"node-forge": "^1.3.1",
"react": "^17.0.2",
"react-device-detect": "^2.2.3",
Expand All @@ -39,6 +40,7 @@
"@keplr-wallet/types": "^0.10.19",
"@svgr/webpack": "^6.3.1",
"@types/dompurify": "^3.0.2",
"@types/lodash.groupby": "^4.6.9",
"@types/node-forge": "^1.3.6",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
Expand Down
40 changes: 30 additions & 10 deletions apps/airdrop/src/App/AirdropConfirmation.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import groupBy from "lodash.groupby";
import {
Heading,
InputVariants,
Expand Down Expand Up @@ -108,14 +109,33 @@ export const AirdropConfirmation: React.FC = () => {
}, 0);
setTotalMinNam(totalMinNam);

const breakdown = result.claims.map((claim) => {
return {
accountType: categoryAccountTypeMap[claim.category],
source: claim.value,
category: getCategory(claim.category, claim.eligible_for),
minNam: claim.token,
};
});
// We do this because we want to group 'ethresearch` under the ZKP category
const breakdown = Object.values(
groupBy(result.claims, (c) => `${c.category}-${c.value}`)
)
.map((claims) => {
const breakdown = claims.map((claim) => {
return {
accountType: categoryAccountTypeMap[claim.category],
source: claim.value,
category: getCategory(claim.category, claim.eligible_for),
minNam: claim.token,
};
});

const breakdownReduced = Object.values(
groupBy(breakdown, "category")
).map((v) =>
(v || []).reduce((acc, curr) => ({
...acc,
minNam: acc.minNam + curr.minNam,
}))
);

return breakdownReduced;
})
.flat();

setBreakdown(breakdown);
}
})();
Expand Down Expand Up @@ -219,7 +239,7 @@ export const AirdropConfirmation: React.FC = () => {
submitted
</AirdropConfirmationHeading>
<Text className="fade-in" themeColor={"utility1"}>
NAM will be available diretly in your wallet
NAM will be available directly in your wallet
<br /> at Namada Mainnet launch, subject to the
<br />{" "}
<LinkButton href="/terms-of-service" themeColor="utility1">
Expand Down Expand Up @@ -311,7 +331,7 @@ export const AirdropConfirmation: React.FC = () => {
Account Type
</TableCell>
<TableCell width="calc(100% - 540px)" align="center">
Accout/Address
Account/Address
</TableCell>
<TableCell width="190px" align="center">
Category
Expand Down
25 changes: 25 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6369,6 +6369,7 @@ __metadata:
"@namada/utils": "npm:0.1.0"
"@svgr/webpack": "npm:^6.3.1"
"@types/dompurify": "npm:^3.0.2"
"@types/lodash.groupby": "npm:^4.6.9"
"@types/node-forge": "npm:^1.3.6"
"@types/react": "npm:^17.0.39"
"@types/react-dom": "npm:^17.0.11"
Expand All @@ -6380,6 +6381,7 @@ __metadata:
gsap: "npm:^3.12.2"
jotai: "npm:^2.5.1"
local-cors-proxy: "npm:^1.1.0"
lodash.groupby: "npm:^4.6.0"
node-forge: "npm:^1.3.1"
react: "npm:^17.0.2"
react-device-detect: "npm:^2.2.3"
Expand Down Expand Up @@ -8255,6 +8257,22 @@ __metadata:
languageName: node
linkType: hard

"@types/lodash.groupby@npm:^4.6.9":
version: 4.6.9
resolution: "@types/lodash.groupby@npm:4.6.9"
dependencies:
"@types/lodash": "npm:*"
checksum: 1302531f76da99cc8f1bbd486a8c7048a833352b12c39eb5b2ded01173dd5fff76f2c7ace04f08b51c55840271170f1cfbffe4e454dde8597c3ee996e70d4e11
languageName: node
linkType: hard

"@types/lodash@npm:*":
version: 4.14.202
resolution: "@types/lodash@npm:4.14.202"
checksum: 6064d43c8f454170841bd67c8266cc9069d9e570a72ca63f06bceb484cb4a3ee60c9c1f305c1b9e3a87826049fd41124b8ef265c4dd08b00f6766609c7fe9973
languageName: node
linkType: hard

"@types/long@npm:^4.0.1":
version: 4.0.2
resolution: "@types/long@npm:4.0.2"
Expand Down Expand Up @@ -21931,6 +21949,13 @@ __metadata:
languageName: node
linkType: hard

"lodash.groupby@npm:^4.6.0":
version: 4.6.0
resolution: "lodash.groupby@npm:4.6.0"
checksum: 3d136cad438ad6c3a078984ef60e057a3498b1312aa3621b00246ecb99e8f2c4d447e2815460db7a0b661a4fe4e2eeee96c84cb661a824bad04b6cf1f7bc6e9b
languageName: node
linkType: hard

"lodash.isplainobject@npm:^4.0.6":
version: 4.0.6
resolution: "lodash.isplainobject@npm:4.0.6"
Expand Down

0 comments on commit 6a10637

Please sign in to comment.