Skip to content

Commit 00f2b69

Browse files
committed
Remove migration page (by updating content)
1 parent 8ba095a commit 00f2b69

File tree

1 file changed

+3
-248
lines changed
  • packages/page-migration/src/Migration

1 file changed

+3
-248
lines changed

packages/page-migration/src/Migration/index.tsx

Lines changed: 3 additions & 248 deletions
Original file line numberDiff line numberDiff line change
@@ -1,265 +1,20 @@
11
// Copyright 2017-2022 @polkadot/app-rpc authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import React, { useState, useEffect } from 'react';
4+
import React from 'react';
55

6-
import type { DeriveBalancesAll } from '@polkadot/api-derive/types';
7-
import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces';
8-
9-
import { Available, Dropdown, InputAddressCheqd } from '@polkadot/react-components';
10-
import { InputAddress, MarkError, MarkWarning, TxButton, Button } from '@polkadot/react-components';
6+
import { MarkWarning } from '@polkadot/react-components';
117

128
import { useTranslation } from '../translate';
13-
import { isValidCheqdAddress, getCheqdAddressError } from '@polkadot/react-components/InputAddressCheqd';
14-
import { useApi, useCall } from '@polkadot/react-hooks';
15-
import { formatBalance, nextTick } from '@polkadot/util';
16-
17-
function convertDockToCheqd(dockBalance) {
18-
if (!dockBalance) {
19-
return 0;
20-
}
21-
const swapRatio = 18.5178;
22-
const dockAmt = dockBalance.toNumber() / 1000000;
23-
const cheqdBalance = dockAmt / swapRatio;
24-
return cheqdBalance;
25-
}
26-
27-
function hasAvailableBalance(dockBalance) {
28-
if (!dockBalance || !dockBalance.availableBalance) {
29-
return false;
30-
}
31-
return !dockBalance.availableBalance.isZero();
32-
}
33-
34-
function hasLockedBalance(dockBalance) {
35-
if (!dockBalance || !dockBalance.lockedBalance) {
36-
return false;
37-
}
38-
return !dockBalance.lockedBalance.isZero();
39-
}
409

4110
function MigrationApp ({ className }): React.ReactElement {
4211
const { t } = useTranslation();
43-
const [senderId, setSenderId] = useState<string | null>(null);
44-
const [cheqdId, setCheqdId] = useState<string>('');
45-
const [selectFromDropdown, setSelectFromDropdown] = useState<boolean>(false);
46-
const [cheqdAddresses, setCheqdAddresses] = useState<string[]>([]);
47-
const [dispatchInfo, setDispatchInfo] = useState<RuntimeDispatchInfo | null>(null);
48-
const { api } = useApi();
49-
const allBalances = useCall<DeriveBalancesAll>(api.derive.balances?.all, [senderId]);
50-
const values = [cheqdId];
51-
const extrinsic = api && api.tx && api.tx.cheqdMigration && api.tx.cheqdMigration.migrate(values);
52-
const isValid = senderId && cheqdId && isValidCheqdAddress(cheqdId);
53-
const totalMigrationBalance = allBalances ? (dispatchInfo ? allBalances.availableBalance.sub(dispatchInfo.partialFee) : allBalances.availableBalance) : 0;
54-
55-
useEffect((): void => {
56-
senderId && extrinsic && api.call.transactionPaymentApi &&
57-
nextTick(async (): Promise<void> => {
58-
try {
59-
const info = await extrinsic.paymentInfo(senderId);
60-
setDispatchInfo(info);
61-
} catch (error) {
62-
console.error(error);
63-
}
64-
});
65-
}, [api, senderId, extrinsic]);
66-
67-
function handleSuccess() {
68-
window.location = 'https://www.dock.io/token-migration-success';
69-
}
70-
71-
async function getExtensionAddresses() {
72-
const chainId = 'cheqd-mainnet-1';
73-
const walletObj = window.keplr || window.leap;
74-
75-
await walletObj.enable(chainId);
76-
77-
const offlineSigner = walletObj.getOfflineSigner(chainId);
78-
const accounts = await offlineSigner.getAccounts();
79-
setCheqdAddresses([...cheqdAddresses, ...accounts.map(({ address }) => address)]);
80-
setSelectFromDropdown(accounts.length > 0);
81-
}
82-
83-
useEffect(() => {
84-
if (window.keplr || window.leap) {
85-
getExtensionAddresses();
86-
}
87-
}, []);
88-
8912
return (
9013
<div className={`staking--Overview ${className}`}>
9114
<MarkWarning
9215
className='warning centered'
93-
content={t<string>('Migrating your Dock balance to cheqd will zero the balance on your Dock account.')}
16+
content={t<string>('The DOCK -> CHEQD token migration has ended as of March 15th, 2025')}
9417
/>
95-
96-
<p style={{
97-
fontSize: '18px',
98-
marginBottom: '20px',
99-
}}>
100-
The Dock network is migrating its functionality and all tokens to the cheqd blockchain. This migration will allow Dock to leverage cheqd’s advanced infrastructure and bring enhanced value to both ecosystems. Existing $DOCK tokens will be converted into $CHEQ tokens, ensuring a smooth transition for all token holders.
101-
</p>
102-
103-
<p style={{
104-
fontSize: '18px',
105-
marginBottom: '20px',
106-
}}>
107-
Before you start the process make sure you have a cheqd account. If you do not currently have one, <a href="https://docs.cheqd.io/product/network/wallets" target="_blank">see instructions on how to create one</a>.
108-
</p>
109-
110-
<p style={{
111-
fontSize: '18px',
112-
}}>
113-
To migrate your $DOCK tokens:
114-
</p>
115-
<ol
116-
style={{
117-
fontSize: '18px',
118-
marginBottom: '20px',
119-
lineHeight: '34px',
120-
}}>
121-
<li>
122-
Select your Dock account. If it isn't there follow <a href="https://docs.dock.io/dock-token/dock-token-migration/adding-account-to-the-dock-browser-wallet" target="_blank">these instructions</a>.
123-
</li>
124-
<li>
125-
Connect your cheqd wallet or enter your cheqd account manually. Connecting a Leap wallet will allow us to confirm that the tokens are going to the cheqd account that you control.
126-
</li>
127-
<li>
128-
Accept T&Cs and click <strong>Submit</strong>
129-
</li>
130-
<li>
131-
Authorize the transaction by entering your account password. Click <strong>Sign & Submit</strong>
132-
</li>
133-
</ol>
134-
135-
<p style={{
136-
fontSize: '18px',
137-
marginBottom: '20px',
138-
}}>
139-
The entire amount of the account will be migrated at once. After the migration request is submitted your $DOCK tokens will be burnt and you will be sent the converted CHEQD amount with <strong>Swap Ratio</strong>: 18.5178 $DOCK to 1 $CHEQ. The migration will take up to 1-2 business days to complete, after that the converted $CHEQ amount will be available in the indicated cheqd wallet.
140-
</p>
141-
142-
<p style={{
143-
fontSize: '18px',
144-
marginBottom: '20px',
145-
}}>
146-
The migration service will only be available until <strong>March 15, 2025</strong>.
147-
<br />
148-
Please follow these instructions carefully and contact our team with any questions at <a href="mailto:support@dock.io">support@dock.io</a>.
149-
</p>
150-
151-
<InputAddress
152-
help={t<string>('The account you will migrate to Cheqd.')}
153-
label={t<string>('migrate account')}
154-
labelExtra={
155-
<Available
156-
label={t<string>('transferrable')}
157-
params={senderId}
158-
/>
159-
}
160-
value={senderId}
161-
onChange={setSenderId}
162-
type='account'
163-
/>
164-
165-
<br />
166-
167-
{selectFromDropdown ? (
168-
<>
169-
<Dropdown
170-
className={`ui--InputAddress ${className}`}
171-
help={t<string>('The cheqd account your tokens will be migrated to.')}
172-
label={t<string>('cheqd extension account')}
173-
isMultiple={false}
174-
onChange={setCheqdId}
175-
options={cheqdAddresses.map((cheqdAddress) => ({
176-
value: cheqdAddress,
177-
text: cheqdAddress,
178-
}))}
179-
value={cheqdId}
180-
/>
181-
<a href="#" onClick={(e) => {
182-
e.preventDefault();
183-
setSelectFromDropdown(false);
184-
}}>Enter address manually</a>
185-
</>
186-
) : (
187-
<>
188-
<InputAddressCheqd
189-
help={t<string>('The cheqd account your tokens will be migrated to.')}
190-
label={t<string>('cheqd account')}
191-
value={cheqdId}
192-
onChange={setCheqdId}
193-
type='account'
194-
/>
195-
{cheqdAddresses.length > 0 && (
196-
<>
197-
<a href="#" onClick={(e) => {
198-
e.preventDefault();
199-
setSelectFromDropdown(true);
200-
}}>Select from wallet extension</a>
201-
</>
202-
)}
203-
</>
204-
)}
205-
206-
{cheqdId && !isValidCheqdAddress(cheqdId) && (
207-
<MarkError
208-
className='error centered'
209-
content={t<string>(getCheqdAddressError(cheqdId) || 'This cheqd address is invalid, please check it before continuing.')}
210-
/>
211-
)}
212-
213-
<br /><br />
214-
215-
{(senderId && allBalances) ? (
216-
<p style={{
217-
fontSize: '18px',
218-
}}>
219-
{hasAvailableBalance(allBalances) ? (
220-
hasLockedBalance(allBalances) ? (
221-
<>
222-
This Dock account has <strong>locked or staked</strong> funds, please <a href="https://docs.dock.io/dock-token/staking/how-to-unbond-and-rebond" target="_blank">unbond</a> to migrate.
223-
</>
224-
) : ((
225-
<>
226-
After the migration is complete, your <strong>{formatBalance(totalMigrationBalance)}</strong> (total available minus chain fees) will be converted into <strong>{convertDockToCheqd(totalMigrationBalance)} CHEQD</strong>.
227-
</>
228-
)
229-
)
230-
) : (
231-
<>
232-
This Dock account has <strong>no available balance</strong> to migrate.
233-
</>
234-
)}
235-
</p>
236-
) : (
237-
<p style={{
238-
fontSize: '18px',
239-
}}>
240-
241-
Enter a sender and receiver address to see the total CHEQD you will receive.
242-
</p>
243-
)}
244-
245-
<p style={{
246-
fontSize: '18px',
247-
}}>
248-
By submitting this transaction you agree to the <a href="https://docs.dock.io/dock-token/dock-token-migration/migration-terms-and-conditions">migration terms and conditions</a>.
249-
</p>
250-
251-
<br />
252-
253-
<Button.Group>
254-
<TxButton
255-
accountId={senderId}
256-
extrinsic={extrinsic}
257-
icon='sign-in-alt'
258-
isDisabled={!isValid || !hasAvailableBalance(allBalances) || hasLockedBalance(allBalances)}
259-
onSuccess={handleSuccess}
260-
label={t<string>('Submit Transaction')}
261-
/>
262-
</Button.Group>
26318
</div>
26419
);
26520
}

0 commit comments

Comments
 (0)