Skip to content

Commit

Permalink
Set Mainnet as default HRP and added HRP setter
Browse files Browse the repository at this point in the history
  • Loading branch information
alekswaslet committed May 29, 2024
1 parent e88c81b commit 74a58e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
13 changes: 9 additions & 4 deletions src/wallet/wallet.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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"
Expand Down Expand Up @@ -41,7 +41,7 @@ export class MCNWallet {
privateKey?: string
chainsWallets = new Map<string, VMWallet>()

private constructor (hrp: string = TestNetwork.hrp) {
private constructor (hrp: string = MainNetwork.hrp) {
this.hrp = hrp
}

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 74a58e8

Please sign in to comment.