From 74a58e8279dd2488aa987b7dacf46ca2653a4455 Mon Sep 17 00:00:00 2001 From: alekswaslet <1346150+alekswaslet@users.noreply.github.com> Date: Wed, 29 May 2024 16:41:38 +0200 Subject: [PATCH] Set Mainnet as default HRP and added HRP setter --- package.json | 2 +- src/wallet/wallet.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ec3895f5..d32b2cf9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "juneojs", - "version": "0.0.95", + "version": "0.0.96", "description": "Juneo JS Library", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/wallet/wallet.ts b/src/wallet/wallet.ts index a8b61a48..33eb7819 100644 --- a/src/wallet/wallet.ts +++ b/src/wallet/wallet.ts @@ -1,5 +1,6 @@ -import { HDNodeWallet, Mnemonic, Wallet, randomBytes } from 'ethers' -import { JEVM_ID, type Blockchain, JVM_ID, PLATFORMVM_ID, type JEVMBlockchain } from '../chain' +import { HDNodeWallet, Mnemonic, randomBytes, Wallet } from 'ethers' +import { JEVM_ID, JVM_ID, PLATFORMVM_ID, type Blockchain, type JEVMBlockchain } from '../chain' +import { MainNetwork } from '../network' import { ECKeyPair, encodeJuneoAddress, @@ -9,7 +10,6 @@ import { WalletError } from '../utils' import * as encoding from '../utils/encoding' -import { TestNetwork } from '../network' const EVMHdPath = "m/44'/60'/0'/0" const JVMHdPath = "m/44'/9000'/0'/0" @@ -41,7 +41,7 @@ export class MCNWallet { privateKey?: string chainsWallets = new Map() - private constructor (hrp: string = TestNetwork.hrp) { + private constructor (hrp: string = MainNetwork.hrp) { this.hrp = hrp } @@ -71,6 +71,11 @@ export class MCNWallet { return wallets } + setHrp (hrp: string): void { + this.hrp = hrp + this.chainsWallets.clear() + } + private setChainWallet (chain: Blockchain): void { if (chain.vmId === JEVM_ID) { this.chainsWallets.set(chain.id, this.buildJEVMWallet(chain))