diff --git a/src/constants/coins.ts b/src/constants/coins.ts index 43f70747..49c21898 100644 --- a/src/constants/coins.ts +++ b/src/constants/coins.ts @@ -3,6 +3,4 @@ * * @category Constants */ - -export const QI_COIN_TYPE = 969; -export const QUAI_COIN_TYPE = 994; \ No newline at end of file +export type AllowedCoinType = 969 | 994; \ No newline at end of file diff --git a/src/constants/index.ts b/src/constants/index.ts index c78ac459..a74fb74e 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -8,4 +8,4 @@ export { N, WeiPerEther, MaxUint256, MinInt256, MaxInt256 } from './numbers.js'; export { quaisymbol, MessagePrefix } from './strings.js'; export { toShard, Shard, ShardData } from './shards.js'; export { toZone, Zone, ZoneData } from './zones.js'; -export { QI_COIN_TYPE, QUAI_COIN_TYPE } from './coins.js'; +export { AllowedCoinType } from './coins.js'; diff --git a/src/wallet/hdwallet.ts b/src/wallet/hdwallet.ts index 6f9a8eef..acc73b88 100644 --- a/src/wallet/hdwallet.ts +++ b/src/wallet/hdwallet.ts @@ -6,6 +6,7 @@ import { randomBytes } from "../crypto/index.js"; import { getZoneForAddress, isQiAddress } from "../utils/index.js"; import { Zone } from '../constants/index.js'; import { TransactionRequest, Provider, TransactionResponse } from '../providers/index.js'; +import { AllowedCoinType } from "../constants/index.js"; export interface NeuteredAddressInfo { pubKey: string; @@ -20,7 +21,7 @@ export interface NeuteredAddressInfo { const MAX_ADDRESS_DERIVATION_ATTEMPTS = 10000000; export abstract class AbstractHDWallet { - protected static _coinType?: number = 969 || 994; + protected static _coinType?: AllowedCoinType; // Map of account number to HDNodeWallet protected _accounts: Map = new Map(); diff --git a/src/wallet/qi-hdwallet.ts b/src/wallet/qi-hdwallet.ts index 62aceea7..8a7f88e2 100644 --- a/src/wallet/qi-hdwallet.ts +++ b/src/wallet/qi-hdwallet.ts @@ -12,7 +12,7 @@ import { keccak_256 } from '@noble/hashes/sha3'; import { musigCrypto } from '../crypto/index.js'; import { Outpoint } from '../transaction/utxo.js'; import { getZoneForAddress } from '../utils/index.js'; -import { Zone } from '../constants/index.js'; +import { AllowedCoinType, Zone } from '../constants/index.js'; type OutpointInfo = { outpoint: Outpoint; @@ -25,7 +25,7 @@ export class QiHDWallet extends AbstractHDWallet { protected static _GAP_LIMIT: number = 20; - protected static _cointype: number = 969; + protected static _coinType: AllowedCoinType = 969; // Map of change addresses to address info protected _changeAddresses: Map = new Map(); diff --git a/src/wallet/quai-hdwallet.ts b/src/wallet/quai-hdwallet.ts index cfa76c9f..72a90c45 100644 --- a/src/wallet/quai-hdwallet.ts +++ b/src/wallet/quai-hdwallet.ts @@ -3,9 +3,10 @@ import { AbstractHDWallet } from './hdwallet'; import { HDNodeWallet } from "./hdnodewallet"; import { QuaiTransactionRequest, Provider, TransactionResponse } from '../providers/index.js'; import { resolveAddress } from '../address/index.js'; +import { AllowedCoinType } from "../constants/index.js"; export class QuaiHDWallet extends AbstractHDWallet { - protected static _cointype: number = 994; + protected static _coinType: AllowedCoinType = 994; private constructor(root: HDNodeWallet, provider?: Provider) { super(root, provider);