From 8564bd7e9512144e359c60731228ec62a85d43b5 Mon Sep 17 00:00:00 2001 From: Tomer Levy Date: Tue, 28 May 2024 02:26:52 +0300 Subject: [PATCH] Added support for testnet --- README.md | 1 + src/lib/users.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d6c6d61..21701ab 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ The file is of the following structure: ```json { "kaspad_address": , + "network": <"kaspa" | "kaspatest" | "kaspadev" - determines the key derivation and default port> "custodial": , "storeType": <"firestore" or "keyv" (direct control)>, diff --git a/src/lib/users.js b/src/lib/users.js index ae0363a..f5dfd6b 100644 --- a/src/lib/users.js +++ b/src/lib/users.js @@ -14,7 +14,7 @@ const openWallets = new Map(); let awaitingBlockCallbacks = []; let awaitingDaaScoreCallbacks = [] -const network = "kaspa"; +const network = config.network; const { port } = Wallet.networkTypes[network]; let rpc = null; const custodialWallet = {publicAddress: null, wallet: null}; @@ -45,7 +45,7 @@ const checkUser = async (user) => { } const walletInit = async (address, custodialMnemonic) => { - rpc = new RPC({ clientConfig: { host: address + ":" + port }}) + rpc = new RPC({ clientConfig: { host: address.includes(":") ? address : address + ":" + port }}) await initKaspaFramework(); custodialWallet.wallet = Wallet.fromMnemonic(custodialMnemonic, {network, rpc}, {disableAddressDerivation: true, syncOnce: false});