Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid CoreMask issue #77

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Elements/ListingCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const ListingCardInner = ({
>
<Typography fontSize={'1rem'}>Price/timeslice:</Typography>
<Typography variant='h2'>
{`${formatBalance(listing.timeslicePrice.toString(),true)} ${symbol}`}
{`${formatBalance(listing.timeslicePrice.toString(), true)} ${symbol}`}
</Typography>
</Box>
<Box
Expand Down
4 changes: 3 additions & 1 deletion src/components/Modals/Sell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const SellModal = ({
regionMetadata,
}: SellModalProps) => {
const { activeAccount, api } = useInkathon();
const {state: {symbol}} = useCoretimeApi();
const {
state: { symbol },
} = useCoretimeApi();

const { fetchRegions } = useRegions();
const { toastError, toastSuccess } = useToast();
Expand Down
34 changes: 15 additions & 19 deletions src/contexts/regions/native/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,24 @@ export const fetchRegions = async (

const brokerRegions: Array<Region> = brokerEntries
.map(([key, value]) => {
const keyTuple: any = key.toHuman();
const keyTuple: any = key.toHuman(undefined, true);
const { begin, core, mask } = keyTuple[0] as any;
const { end, owner, paid } = value.toHuman() as any;

try {
const regionId = {
begin: parseHNString(begin.toString()),
core: parseHNString(core.toString()),
mask: new CoreMask(mask),
};
return new Region(
regionId,
{
end: parseHNString(end),
owner,
paid: paid ? parseHNString(paid) : null,
},
0
);
} catch (_e) {
/** */
}
const regionId = {
begin: parseHNString(begin.toString()),
core: parseHNString(core.toString()),
mask: new CoreMask(mask),
};
return new Region(
regionId,
{
end: parseHNString(end),
owner,
paid: paid ? parseHNString(paid) : null,
},
0
);
})
.filter((entry) => !!entry) as Array<Region>;
return brokerRegions;
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/tasks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const TaskDataProvider = ({ children }: Props) => {

for await (const [key, value] of workplan) {
const [[begin, core]] = key.toHuman() as [[number, number]];
const records = value.toHuman() as ScheduleItem[];
const records = value.toHuman(undefined, true) as ScheduleItem[];

records.forEach((record) => {
const {
Expand Down
Loading