Skip to content

Commit

Permalink
FIX: bug in coin type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoacosta74 committed Jun 12, 2024
1 parent 46b4407 commit 46ec1a8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/constants/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
*
* @category Constants
*/

export const QI_COIN_TYPE = 969;
export const QUAI_COIN_TYPE = 994;
export type AllowedCoinType = 969 | 994;
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
3 changes: 2 additions & 1 deletion src/wallet/hdwallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<number, HDNodeWallet> = new Map();
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/qi-hdwallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<string, NeuteredAddressInfo> = new Map();
Expand Down
3 changes: 2 additions & 1 deletion src/wallet/quai-hdwallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 46ec1a8

Please sign in to comment.