Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonsubin committed Jan 18, 2022
1 parent 7ad46f1 commit bf20270
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/apps/public/locales/en/apps-routing.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"nav.claims": "Claim Tokens",
"nav.contracts": "Contracts",
"nav.council": "Council",
"nav.custom-signature": "Custom Signature",
"nav.crowdloan": "Crowdloan",
"nav.custom-signature": "Custom Signature",
"nav.democracy": "Democracy",
"nav.explorer": "Explorer",
"nav.extrinsics": "Extrinsics",
Expand All @@ -28,4 +28,4 @@
"nav.teleport": "Teleport",
"nav.transfer": "Transfer",
"nav.treasury": "Treasury"
}
}
3 changes: 1 addition & 2 deletions packages/apps/public/locales/en/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"app-contracts.json",
"app-council.json",
"app-custom-signature.json",
"app-crowdloan.json",
"app-democracy.json",
"app-explorer.json",
"app-extrinsics.json",
Expand All @@ -32,4 +31,4 @@
"react-params.json",
"react-query.json",
"react-signer.json"
]
]
17 changes: 12 additions & 5 deletions packages/page-custom-signature/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"author": "Stake Technologies <[email protected]>",
"bugs": "https://github.com/polkadot-js/apps/issues",
"description": "A basic app for using the custom-signature Substrate Pallet",
"homepage": "https://github.com/polkadot-js/apps/tree/master/packages/page-custom-signature#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/app-custom-signature",
"private": true,
"repository": {
"directory": "packages/page-custom-signature",
"type": "git",
"url": "https://github.com/polkadot-js/apps.git"
},
"sideEffects": false,
"version": "0.98.2-30",
"description": "A basic app for using the custom-signature Substrate Pallet",
"main": "index.js",
"scripts": {},
"author": "Stake Technologies <[email protected]>",
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/react-components": "^0.98.2-30",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ function CustomSignTx ({ className, signer }: Props): React.ReactElement<Props>
<Modal
className='app--accounts-Modal'
header={t<string>('Transaction Confirmation')}
onClose={toggleModalView}
size='large'
>
<Modal.Content>
<Modal.Columns>
<p>{t<string>('Submit the signed transaction to the chain.')}</p>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={toggleModalView}>
<Modal.Actions>
<TxButton
icon='paper-plane'
isDisabled={!callSignature}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styled from 'styled-components';
// note: this pull the chain metadata from the settings page to make the code shorter
import useChainInfo from '@polkadot/app-settings/useChainInfo';
import { AddressMini, Button, Icon } from '@polkadot/react-components';
import { useApi } from '@polkadot/react-hooks';

import { useTranslation } from '../translate';
import { EcdsaAddressFormat } from '../types';
Expand All @@ -22,6 +23,7 @@ function EcdsaAccount ({ className = '', onAccountChanged }: Props): React.React
const { t } = useTranslation();
const { activateMetaMask, loadedAccounts, requestSignature } = useMetaMask();
const chainInfo = useChainInfo();
const { api } = useApi();
// internal message state
const [errorMessage, setErrorMessage] = useState<Error>();
// note: currently, MetaMask will only export one account at a time.
Expand Down Expand Up @@ -62,13 +64,16 @@ function EcdsaAccount ({ className = '', onAccountChanged }: Props): React.React
// note: the default prefix is `42`, which is for the dev node
const ss58Address = utils.ecdsaPubKeyToSs58(pubKey, chainInfo?.ss58Format);

setEcdsaAccounts({ ethereum: loadingAddr, ss58: ss58Address });
// quick solution for reading the account nonce
const { nonce } = await api.query.system.account(ss58Address);

setEcdsaAccounts({ ethereum: loadingAddr, nonce: nonce.toNumber(), ss58: ss58Address });
} catch (err) {
setErrorMessage(err as Error);
} finally {
setIsBusy(false);
}
}, [activateMetaMask, chainInfo, errorMessage, requestSignature]);
}, [activateMetaMask, api.query.system, chainInfo, errorMessage, requestSignature]);

// reset the account cache if the user changes their account in MetaMask
useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions packages/page-custom-signature/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface EthereumProvider {
export interface EcdsaAddressFormat {
ethereum: string;
ss58: string;
nonce: number;
}

declare global {
Expand Down

0 comments on commit bf20270

Please sign in to comment.