Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
Remove warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmychu0807 committed Oct 20, 2021
1 parent 519e937 commit bf9dd55
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
20 changes: 12 additions & 8 deletions packages/react-api/src/ApiSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

import { SubmittableResult } from '@polkadot/api';
import { Signer, SignerResult } from '@polkadot/api/types';
import { ClassOf } from '@polkadot/types';
// import { ClassOf } from '@polkadot/types';
import { Hash } from '@polkadot/types/interfaces';
import { SignerPayloadJSON } from '@polkadot/types/types';

import { QueueTxMessageSetStatus, QueueTxPayloadAdd, QueueTxStatus } from './Status/types';
import { registry } from '.';
// import { registry } from '.';

export default class ApiSigner implements Signer {
readonly #queuePayload: QueueTxPayloadAdd;
Expand All @@ -34,10 +33,15 @@ export default class ApiSigner implements Signer {
}

public update (id: number, result: Hash | SubmittableResult): void {
if (result instanceof ClassOf(registry, 'Hash')) {
this.#queueSetTxStatus(id, 'sent', result.toHex());
} else {
this.#queueSetTxStatus(id, result.status.type.toLowerCase() as QueueTxStatus, status);
}
// if (result instanceof ClassOf(registry, 'Hash')) {
// this.#queueSetTxStatus(id, 'sent', result.toHex());
// } else {
// this.#queueSetTxStatus(id, result.status.type.toLowerCase() as QueueTxStatus, status);
// }
this.#queueSetTxStatus(
id,
(result as SubmittableResult).status.type.toLowerCase() as QueueTxStatus,
status
);
}
}
9 changes: 5 additions & 4 deletions packages/react-params/src/Param/Amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ import { Props } from '@canvas-ui/react-components/types';
import BN from 'bn.js';
import React, { useCallback, useMemo } from 'react';

import { ClassOf } from '@polkadot/types';
// import { ClassOf } from '@polkadot/types';
import { bnToBn, formatNumber, isUndefined } from '@polkadot/util';

import Bare from './Bare';

function Amount ({ className = '', defaultValue: { value }, isDisabled, isError, label, onChange, onEnter, type, withLabel }: Props): React.ReactElement<Props> {
const defaultValue = useMemo(
() => isDisabled
? value instanceof ClassOf(registry, 'AccountIndex')
? value.toString()
: formatNumber(value as number)
// ? value instanceof ClassOf(registry, 'AccountIndex')
// ? value.toString()
// : formatNumber(value as number)
? formatNumber(value as number)
: bnToBn((value as number) || 0).toString(),
[isDisabled, value]
);
Expand Down
11 changes: 6 additions & 5 deletions packages/react-params/src/Param/VoteThreshold.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// and @canvas-ui/react-params authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { registry } from '@canvas-ui/react-api';
// import { registry } from '@canvas-ui/react-api';
import { Dropdown } from '@canvas-ui/react-components';
import { Props } from '@canvas-ui/react-components/types';
import React, { useCallback } from 'react';

import { ClassOf } from '@polkadot/types';
// import { ClassOf } from '@polkadot/types';
import { bnToBn } from '@polkadot/util';

import Bare from './Bare';
Expand All @@ -28,9 +28,10 @@ function VoteThresholdParam ({ className = '', defaultValue: { value }, isDisabl
[onChange]
);

const defaultValue = value instanceof ClassOf(registry, 'VoteThreshold')
? value.toNumber()
: bnToBn(value as number).toNumber();
// const defaultValue = value instanceof ClassOf(registry, 'VoteThreshold')
// ? value.toNumber()
// : bnToBn(value as number).toNumber();
const defaultValue = bnToBn(value as number).toNumber();

return (
<Bare className={className}>
Expand Down

0 comments on commit bf9dd55

Please sign in to comment.