mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-05 05:15:48 +00:00
fix: move to hooks v3 testnet (#2319)
This commit is contained in:
@@ -15,14 +15,14 @@ export enum FaucetNetwork {
|
||||
Testnet = 'faucet.altnet.rippletest.net',
|
||||
Devnet = 'faucet.devnet.rippletest.net',
|
||||
AMMDevnet = 'ammfaucet.devnet.rippletest.net',
|
||||
HooksV2Testnet = 'hooks-testnet-v2.xrpl-labs.com',
|
||||
HooksV3Testnet = 'hooks-testnet-v3.xrpl-labs.com',
|
||||
}
|
||||
|
||||
export const FaucetNetworkPaths: Record<string, string> = {
|
||||
[FaucetNetwork.Testnet]: '/accounts',
|
||||
[FaucetNetwork.Devnet]: '/accounts',
|
||||
[FaucetNetwork.AMMDevnet]: '/accounts',
|
||||
[FaucetNetwork.HooksV2Testnet]: '/accounts',
|
||||
[FaucetNetwork.HooksV3Testnet]: '/accounts',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,8 +35,8 @@ export const FaucetNetworkPaths: Record<string, string> = {
|
||||
export function getFaucetHost(client: Client): FaucetNetwork | undefined {
|
||||
const connectionUrl = client.url
|
||||
|
||||
if (connectionUrl.includes('hooks-testnet-v2')) {
|
||||
return FaucetNetwork.HooksV2Testnet
|
||||
if (connectionUrl.includes('hooks-testnet-v3')) {
|
||||
return FaucetNetwork.HooksV3Testnet
|
||||
}
|
||||
|
||||
// 'altnet' for Ripple Testnet server and 'testnet' for XRPL Labs Testnet server
|
||||
|
||||
@@ -67,12 +67,12 @@ const MAX_ATTEMPTS = 20
|
||||
* @param wallet - An existing XRPL Wallet to fund. If undefined or null, a new Wallet will be created.
|
||||
* @param options - See below.
|
||||
* @param options.faucetHost - A custom host for a faucet server. On devnet,
|
||||
* testnet, AMM devnet, and HooksV2 testnet, `fundWallet` will
|
||||
* testnet, AMM devnet, and HooksV3 testnet, `fundWallet` will
|
||||
* attempt to determine the correct server automatically. In other environments,
|
||||
* or if you would like to customize the faucet host in devnet or testnet,
|
||||
* you should provide the host using this option.
|
||||
* @param options.faucetPath - A custom path for a faucet server. On devnet,
|
||||
* testnet, AMM devnet, and HooksV2 testnet, `fundWallet` will
|
||||
* testnet, AMM devnet, and HooksV3 testnet, `fundWallet` will
|
||||
* attempt to determine the correct path automatically. In other environments,
|
||||
* or if you would like to customize the faucet path in devnet or testnet,
|
||||
* you should provide the path using this option.
|
||||
|
||||
@@ -91,9 +91,9 @@ describe('fundWallet', function () {
|
||||
)
|
||||
|
||||
it(
|
||||
'can generate wallet on hooks v2 testnet',
|
||||
'can generate wallet on hooks v3 testnet',
|
||||
async function () {
|
||||
const api = new Client('wss://hooks-testnet-v2.xrpl-labs.com')
|
||||
const api = new Client('wss://hooks-testnet-v3.xrpl-labs.com')
|
||||
|
||||
await api.connect()
|
||||
|
||||
@@ -112,7 +112,7 @@ describe('fundWallet', function () {
|
||||
assert.equal(balance, 10000)
|
||||
|
||||
/*
|
||||
* No test for fund given wallet because the hooks v2 testnet faucet
|
||||
* No test for fund given wallet because the hooks v3 testnet faucet
|
||||
* requires 10 seconds between requests. Would significantly slow down
|
||||
* the test suite.
|
||||
*/
|
||||
|
||||
@@ -54,10 +54,10 @@ describe('Get Faucet host ', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it('returns the Hooks V2 Testnet host', function () {
|
||||
const expectedFaucet = FaucetNetwork.HooksV2Testnet
|
||||
it('returns the Hooks V3 Testnet host', function () {
|
||||
const expectedFaucet = FaucetNetwork.HooksV3Testnet
|
||||
// @ts-expect-error Intentionally modifying private data for test
|
||||
testContext.client.connection.url = FaucetNetwork.HooksV2Testnet
|
||||
testContext.client.connection.url = FaucetNetwork.HooksV3Testnet
|
||||
|
||||
assert.strictEqual(
|
||||
getFaucetHost(testContext.client as Client),
|
||||
@@ -76,10 +76,10 @@ describe('Get Faucet host ', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it('returns the correct faucetPath for Hooks V2 Testnet host', function () {
|
||||
const expectedFaucetPath = FaucetNetworkPaths[FaucetNetwork.HooksV2Testnet]
|
||||
it('returns the correct faucetPath for Hooks V3 Testnet host', function () {
|
||||
const expectedFaucetPath = FaucetNetworkPaths[FaucetNetwork.HooksV3Testnet]
|
||||
// @ts-expect-error Intentionally modifying private data for test
|
||||
testContext.client.connection.url = FaucetNetwork.HooksV2Testnet
|
||||
testContext.client.connection.url = FaucetNetwork.HooksV3Testnet
|
||||
|
||||
assert.strictEqual(
|
||||
getDefaultFaucetPath(getFaucetHost(testContext.client as Client)),
|
||||
|
||||
Reference in New Issue
Block a user