-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.ts
23 lines (18 loc) · 891 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { RpcClient, Encoding, Resolver } from "./wasm/kaspa"
import Treasury from "./src/treasury"
import Templates from "./src/stratum/templates"
import Stratum from "./src/stratum"
import Pool from "./src/pool"
import config from "./config.json"
const rpc = new RpcClient({
resolver: new Resolver(),
encoding: Encoding.Borsh,
networkId: 'testnet-11'
})
await rpc.connect()
const serverInfo = await rpc.getServerInfo()
if (!serverInfo.isSynced || !serverInfo.hasUtxoIndex) throw Error('Provided node is either not synchronized or lacks the UTXO index.')
const treasury = new Treasury(rpc, serverInfo.networkId, config.treasury.privateKey, config.treasury.fee)
const templates = new Templates(rpc, treasury.address, config.stratum.templates.cacheSize)
const stratum = new Stratum(templates, config.stratum.port, config.stratum.difficulty)
const pool = new Pool(treasury, stratum)