parent
28d70880c6
commit
1783054288
17
package.json
17
package.json
@ -1,7 +1,6 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/extension/issues",
|
||||
"engines": {},
|
||||
"homepage": "https://github.com/polkadot-js/extension#readme",
|
||||
"license": "Apache-2",
|
||||
"packageManager": "yarn@3.0.1",
|
||||
@ -35,19 +34,19 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.8",
|
||||
"@polkadot/dev": "^0.63.10",
|
||||
"@polkadot/dev": "^0.63.25",
|
||||
"@types/jest": "^27.0.2",
|
||||
"i18next-scanner": "^3.1.0",
|
||||
"sinon-chrome": "^3.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^6.5.3-1",
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/networks": "^7.6.1",
|
||||
"@polkadot/types": "^6.5.3-1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/x-fetch": "^7.6.1",
|
||||
"@polkadot/api": "^6.6.2-14",
|
||||
"@polkadot/keyring": "^7.7.2-6",
|
||||
"@polkadot/networks": "^7.7.2-6",
|
||||
"@polkadot/types": "^6.6.2-14",
|
||||
"@polkadot/util": "^7.7.2-6",
|
||||
"@polkadot/util-crypto": "^7.7.2-6",
|
||||
"@polkadot/x-fetch": "^7.7.2-6",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"safe-buffer": "^5.2.1",
|
||||
"typescript": "^4.4.4"
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api": "^6.5.3-1",
|
||||
"@polkadot/api": "^6.6.2-14",
|
||||
"@polkadot/extension-dapp": "^0.40.5-2",
|
||||
"@polkadot/extension-inject": "^0.40.5-2",
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/phishing": "^0.6.383",
|
||||
"@polkadot/ui-keyring": "^0.86.3-3"
|
||||
"@polkadot/keyring": "^7.7.2-6",
|
||||
"@polkadot/phishing": "^0.6.402",
|
||||
"@polkadot/ui-keyring": "^0.86.4-0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
import type { KeyringPair } from '@polkadot/keyring/types';
|
||||
import type { SignerPayloadRaw } from '@polkadot/types/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { RequestSign } from './types';
|
||||
|
||||
import { wrapBytes } from '@polkadot/extension-dapp/wrapBytes';
|
||||
@ -16,7 +17,7 @@ export default class RequestBytesSign implements RequestSign {
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
sign (_registry: TypeRegistry, pair: KeyringPair): { signature: string } {
|
||||
sign (_registry: TypeRegistry, pair: KeyringPair): { signature: HexString } {
|
||||
return {
|
||||
signature: u8aToHex(
|
||||
pair.sign(
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
import type { KeyringPair } from '@polkadot/keyring/types';
|
||||
import type { SignerPayloadJSON } from '@polkadot/types/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { RequestSign } from './types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
@ -14,7 +15,7 @@ export default class RequestExtrinsicSign implements RequestSign {
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
sign (registry: TypeRegistry, pair: KeyringPair): { signature: string } {
|
||||
sign (registry: TypeRegistry, pair: KeyringPair): { signature: HexString } {
|
||||
return registry
|
||||
.createType('ExtrinsicPayload', this.payload, { version: this.payload.version })
|
||||
.sign(pair);
|
||||
|
||||
@ -8,6 +8,7 @@ import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/
|
||||
import type { JsonRpcResponse } from '@polkadot/rpc-provider/types';
|
||||
import type { SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
|
||||
import type { KeyringPairs$Json } from '@polkadot/ui-keyring/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
@ -276,7 +277,7 @@ export interface RequestSigningApprovePassword {
|
||||
|
||||
export interface RequestSigningApproveSignature {
|
||||
id: string;
|
||||
signature: string;
|
||||
signature: HexString;
|
||||
}
|
||||
|
||||
export interface RequestSigningCancel {
|
||||
@ -334,7 +335,7 @@ export type TransportResponseMessage<TMessageType extends MessageTypes> =
|
||||
|
||||
export interface ResponseSigning {
|
||||
id: string;
|
||||
signature: string;
|
||||
signature: HexString;
|
||||
}
|
||||
|
||||
export interface ResponseDeriveValidate {
|
||||
@ -374,7 +375,7 @@ export type MessageTypesWithNoSubscriptions = Exclude<MessageTypes, keyof Subscr
|
||||
export interface RequestSign {
|
||||
readonly payload: SignerPayloadJSON | SignerPayloadRaw;
|
||||
|
||||
sign (registry: TypeRegistry, pair: KeyringPair): { signature: string };
|
||||
sign (registry: TypeRegistry, pair: KeyringPair): { signature: HexString };
|
||||
}
|
||||
|
||||
export interface RequestJsonRestore {
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/networks": "^7.6.1"
|
||||
"@polkadot/networks": "^7.7.2-6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/api": "*"
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@metamask/detect-provider": "^1.2.0",
|
||||
"@polkadot/extension-inject": "^0.40.5-2",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util": "^7.7.2-6",
|
||||
"web3": "^1.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
import type { Injected, InjectedAccount, InjectedWindow } from '@polkadot/extension-inject/types';
|
||||
import type { SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import detectEthereumProvider from '@metamask/detect-provider';
|
||||
import Web3 from 'web3';
|
||||
@ -74,7 +75,7 @@ function injectMetaMaskWeb3 (win: Web3Window): void {
|
||||
},
|
||||
signer: {
|
||||
signRaw: async (raw: SignerPayloadRaw): Promise<SignerResult> => {
|
||||
const signature = (await provider.request({ method: 'eth_sign', params: [raw.address, Web3.utils.sha3(raw.data)] })) as string;
|
||||
const signature = (await provider.request({ method: 'eth_sign', params: [raw.address, Web3.utils.sha3(raw.data)] })) as HexString;
|
||||
|
||||
return { id: 0, signature };
|
||||
}
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/extension-inject": "^0.40.5-2",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1"
|
||||
"@polkadot/util": "^7.7.2-6",
|
||||
"@polkadot/util-crypto": "^7.7.2-6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/api": "*",
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
"@polkadot/extension-base": "^0.40.5-2",
|
||||
"@polkadot/extension-dapp": "^0.40.5-2",
|
||||
"@polkadot/extension-inject": "^0.40.5-2",
|
||||
"@polkadot/hw-ledger": "^7.6.1",
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/networks": "^7.6.1",
|
||||
"@polkadot/react-identicon": "^0.86.3-3",
|
||||
"@polkadot/react-qr": "^0.86.3-3",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/hw-ledger": "^7.7.2-6",
|
||||
"@polkadot/keyring": "^7.7.2-6",
|
||||
"@polkadot/networks": "^7.7.2-6",
|
||||
"@polkadot/react-identicon": "^0.86.4-0",
|
||||
"@polkadot/react-qr": "^0.86.4-0",
|
||||
"@polkadot/util": "^7.7.2-6",
|
||||
"@polkadot/util-crypto": "^7.7.2-6",
|
||||
"file-saver": "^2.0.5",
|
||||
"i18next": "^21.3.3",
|
||||
"react": "^17.0.2",
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ExtrinsicPayload } from '@polkadot/types/interfaces';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import { faSync } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
@ -18,7 +19,7 @@ interface Props {
|
||||
className?: string;
|
||||
error: string | null;
|
||||
genesisHash?: string;
|
||||
onSignature?: ({ signature }: { signature: string }) => void;
|
||||
onSignature?: ({ signature }: { signature: HexString }) => void;
|
||||
payload?: ExtrinsicPayload;
|
||||
setError: (value: string | null) => void;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ExtrinsicPayload } from '@polkadot/types/interfaces';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
@ -19,7 +20,7 @@ interface Props {
|
||||
className?: string;
|
||||
cmd: number;
|
||||
genesisHash: string;
|
||||
onSignature: ({ signature }: { signature: string }) => void;
|
||||
onSignature: ({ signature }: { signature: HexString }) => void;
|
||||
payload: ExtrinsicPayload | string;
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
import type { AccountJson, RequestSign } from '@polkadot/extension-base/background/types';
|
||||
import type { ExtrinsicPayload } from '@polkadot/types/interfaces';
|
||||
import type { SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
@ -67,7 +68,7 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
}, [request]);
|
||||
|
||||
const _onSignature = useCallback(
|
||||
({ signature }: { signature: string }): Promise<void> =>
|
||||
({ signature }: { signature: HexString }): Promise<void> =>
|
||||
approveSignSignature(signId, signature)
|
||||
.then(() => onAction())
|
||||
.catch((error: Error): void => {
|
||||
|
||||
@ -6,6 +6,7 @@ import type { Message } from '@polkadot/extension-base/types';
|
||||
import type { Chain } from '@polkadot/extension-chains/types';
|
||||
import type { KeyringPair$Json } from '@polkadot/keyring/types';
|
||||
import type { KeyringPairs$Json } from '@polkadot/ui-keyring/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
|
||||
import { PORT_EXTENSION } from '@polkadot/extension-base/defaults';
|
||||
@ -115,7 +116,7 @@ export async function approveSignPassword (id: string, savePass: boolean, passwo
|
||||
return sendMessage('pri(signing.approve.password)', { id, password, savePass });
|
||||
}
|
||||
|
||||
export async function approveSignSignature (id: string, signature: string): Promise<boolean> {
|
||||
export async function approveSignSignature (id: string, signature: HexString): Promise<boolean> {
|
||||
return sendMessage('pri(signing.approve.signature)', { id, signature });
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
"@polkadot/extension-ui": "^0.40.5-2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.63.10",
|
||||
"@polkadot/dev": "^0.63.25",
|
||||
"babel-loader": "^8.2.3",
|
||||
"browser-resolve": "^2.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user