Skip to content

Commit

Permalink
corrected default testnet client
Browse files Browse the repository at this point in the history
  • Loading branch information
CluEleSsUK committed Sep 21, 2023
1 parent 2c9e8a5 commit 1cbc84d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
defaultChainUrl,
MAINNET_CHAIN_URL,
MAINNET_CHAIN_URL_NON_RFC,
TESTNET_CHAIN_URL
TESTNET_CHAIN_URL,
TESTNET_CHAIN_INFO
} from "./drand/defaults"
import {LIB_VERSION} from "./version"

Expand Down Expand Up @@ -46,8 +47,15 @@ export async function timelockDecrypt(
}

export function testnetClient(): HttpChainClient {
const chain = new HttpCachingChain(TESTNET_CHAIN_URL, defaultChainOptions)
return new HttpChainClient(chain, defaultChainOptions, {
const opts = {
...defaultChainOptions,
chainVerificationParams: {
chainHash: TESTNET_CHAIN_INFO.hash,
publicKey: TESTNET_CHAIN_INFO.public_key,
}
}
const chain = new HttpCachingChain(TESTNET_CHAIN_URL, opts)
return new HttpChainClient(chain, opts, {
userAgent: `tlock-js-${LIB_VERSION}`
})
}
Expand Down

0 comments on commit 1cbc84d

Please sign in to comment.