mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-12 13:11:01 +00:00
Add contracts to ui-keyring (#137)
* add contracts to keyring * genesisHash * requested changes + allPlus option type * remove duplicate fn * add contracts to keyring * genesisHash * requested changes + allPlus option type * remove duplicate fn * changes * contract key * prefixes
This commit is contained in:
@@ -7,6 +7,7 @@ import { decodeAddress } from '@polkadot/keyring';
|
||||
|
||||
const ACCOUNT_PREFIX = 'account:';
|
||||
const ADDRESS_PREFIX = 'address:';
|
||||
const CONTRACT_PREFIX = 'contract:';
|
||||
const MAX_PASS_LEN = 32;
|
||||
|
||||
function toHex (address: string): string {
|
||||
@@ -22,14 +23,21 @@ const accountKey = (address: string): string =>
|
||||
const addressKey = (address: string): string =>
|
||||
`${ADDRESS_PREFIX}${toHex(address)}`;
|
||||
|
||||
const accountRegex = new RegExp(`^${ACCOUNT_PREFIX}`, '');
|
||||
const contractKey = (address: string): string =>
|
||||
`${CONTRACT_PREFIX}${toHex(address)}`;
|
||||
|
||||
const addressRegex = new RegExp(`^${ADDRESS_PREFIX}`, '');
|
||||
const accountRegex = new RegExp(`^${ACCOUNT_PREFIX}0x[0-9a-f]*`, '');
|
||||
|
||||
const addressRegex = new RegExp(`^${ADDRESS_PREFIX}0x[0-9a-f]*`, '');
|
||||
|
||||
const contractRegex = new RegExp(`^${CONTRACT_PREFIX}0x[0-9a-f]*`, '');
|
||||
|
||||
export {
|
||||
accountKey,
|
||||
accountRegex,
|
||||
addressKey,
|
||||
addressRegex,
|
||||
contractKey,
|
||||
contractRegex,
|
||||
MAX_PASS_LEN
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user