Skip to content

Commit

Permalink
clean up interlacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Apr 3, 2024
1 parent 01f6d79 commit 751aa77
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [master]

jobs:
build:
build-and-test:
runs-on: ubuntu-latest

steps:
Expand Down
10 changes: 3 additions & 7 deletions src/components/Modals/Interlace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,16 @@ export const InterlaceModal = ({
const { fetchRegions } = useRegions();

const currentMask = regionMetadata.region.getMask().toBin();
// Represents the first active bit in the bitmap.
const oneStart = currentMask.indexOf('1');
// Represents the last active bit in the bitmap.
const oneEnd = currentMask.lastIndexOf('1');
const activeBits = oneEnd - oneStart + 1;

const [working, setWorking] = useState(false);
const [position, setPosition] = useState(oneStart);

const generateMask = (position: number): string => {
const mask = Array(COREMASK_BIT_LEN).fill('0');
for (let i = oneStart; i <= position; ++i) mask[i] = '1';
return mask.join('');
};

const newMask = generateMask(position);
const newMask = CoreMask.fromChunk(oneStart, position + 1).toBin();

const onInterlace = async () => {
if (!api || !activeAccount || !activeSigner) return;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/purchase/index.tsx → src/pages/purchase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
getSaleEndInBlocks,
getSaleProgress,
getSaleStartInBlocks,
} from '../../utils/sale/util';
} from '../utils/sale/utils';

const Purchase = () => {
const theme = useTheme();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getSaleEndInBlocks,
getSaleProgress,
getSaleStartInBlocks,
} from './util';
} from './utils';

describe('Purchase page', () => {
const mockSaleInfo: SaleInfo = {
Expand Down
File renamed without changes.

0 comments on commit 751aa77

Please sign in to comment.