|
238 | 238 | </template> |
239 | 239 |
|
240 | 240 | <script lang="ts" setup> |
241 | | -import { networks } from "@/data"; |
| 241 | +import { DEFAULT_NETWORK, networks } from "@/data"; |
242 | 242 | import { PartDetails, Participation } from "@/types"; |
243 | 243 | import { b64, delay, execAtc, formatAddr } from "@/utils"; |
244 | 244 | import { mdiChevronDown, mdiClose, mdiContentCopy, mdiPlus } from "@mdi/js"; |
@@ -310,26 +310,15 @@ const statsClient = axios.create({ |
310 | 310 | const partStats = ref<any>({}); |
311 | 311 |
|
312 | 312 | async function getKeys(): Promise<Participation[]> { |
313 | | - const { data } = await partClient.get(""); |
314 | | - return ( |
315 | | - data |
316 | | - // TODO: there's got to be a better way algosdk! |
317 | | - ?.map((p: any) => ({ |
318 | | - ...p, |
319 | | - key: new modelsv2.AccountParticipation({ |
320 | | - voteParticipationKey: p.key["vote-participation-key"], |
321 | | - selectionParticipationKey: p.key["selection-participation-key"], |
322 | | - stateProofKey: p.key["state-proof-key"], |
323 | | - voteFirstValid: p.key["vote-first-valid"], |
324 | | - voteLastValid: p.key["vote-last-valid"], |
325 | | - voteKeyDilution: p.key["vote-key-dilution"], |
326 | | - }), |
327 | | - })) |
328 | | - .sort( |
329 | | - (a: Participation, b: Participation) => |
330 | | - Number(b.key.voteLastValid) - Number(a.key.voteLastValid) |
331 | | - ) |
332 | | - ); |
| 313 | + const { data }: { data: Participation[] } = await partClient.get(""); |
| 314 | + return data |
| 315 | + ?.map((p) => ({ |
| 316 | + ...p, |
| 317 | + key: modelsv2.AccountParticipation.fromEncodingData( |
| 318 | + new Map(Object.entries(p.key)) |
| 319 | + ), |
| 320 | + })) |
| 321 | + .sort((a, b) => Number(b.key.voteLastValid) - Number(a.key.voteLastValid)); |
333 | 322 | } |
334 | 323 |
|
335 | 324 | async function refreshData() { |
@@ -425,7 +414,7 @@ function isKeyActive(item: Participation) { |
425 | 414 | } |
426 | 415 |
|
427 | 416 | function incentiveIneligible(addr: string) { |
428 | | - if (activeNetwork.value !== "mainnet") |
| 417 | + if (activeNetwork.value !== DEFAULT_NETWORK) |
429 | 418 | return { val: false, reason: "Not Supported" }; |
430 | 419 | const acctInfo = acctInfos.value.find((ai) => ai.address === addr); |
431 | 420 | if ((acctInfo?.amount || 0) < 3 * 10 ** 10) |
|
0 commit comments