remove references to the hooks testnet faucet in xrpl.js codebase (#2711)

This commit is contained in:
Chenna Keshava B S
2024-06-20 17:18:11 -07:00
committed by GitHub
parent d3b03a536d
commit 02e2b0e48e
6 changed files with 4 additions and 89 deletions

View File

@@ -3,6 +3,7 @@
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.
## Unreleased
* Remove references to the Hooks testnet faucet in the xrpl.js code repository.
### Added
* Add `nfts_by_issuer` clio-only API definition

View File

@@ -14,13 +14,11 @@ export interface FaucetWallet {
export enum FaucetNetwork {
Testnet = 'faucet.altnet.rippletest.net',
Devnet = 'faucet.devnet.rippletest.net',
HooksV3Testnet = 'hooks-testnet-v3.xrpl-labs.com',
}
export const FaucetNetworkPaths: Record<string, string> = {
[FaucetNetwork.Testnet]: '/accounts',
[FaucetNetwork.Devnet]: '/accounts',
[FaucetNetwork.HooksV3Testnet]: '/accounts',
}
/**
@@ -33,10 +31,6 @@ export const FaucetNetworkPaths: Record<string, string> = {
export function getFaucetHost(client: Client): FaucetNetwork | undefined {
const connectionUrl = client.url
if (connectionUrl.includes('hooks-testnet-v3')) {
return FaucetNetwork.HooksV3Testnet
}
// 'altnet' for Ripple Testnet server and 'testnet' for XRPL Labs Testnet server
if (connectionUrl.includes('altnet') || connectionUrl.includes('testnet')) {
return FaucetNetwork.Testnet

View File

@@ -17,7 +17,6 @@ const LEDGER_OFFSET = 20
// Mainnet and testnet are exceptions. More context: https://github.com/XRPLF/rippled/pull/4370
const RESTRICTED_NETWORKS = 1024
const REQUIRED_NETWORKID_VERSION = '1.11.0'
const HOOKS_TESTNET_ID = 21338
/**
* Determines whether the source rippled version is not later than the target rippled version.
@@ -87,8 +86,7 @@ function isNotLaterRippledVersion(source: string, target: string): boolean {
/**
* Determine if the transaction required a networkID to be valid.
* Transaction needs networkID if later than restricted ID and either the network is hooks testnet
* or build version is >= 1.11.0
* Transaction needs networkID if later than restricted ID and build version is >= 1.11.0
*
* @param client -- The connected client.
* @returns True if required networkID, false otherwise.
@@ -99,12 +97,8 @@ export function txNeedsNetworkID(client: Client): boolean {
client.networkID > RESTRICTED_NETWORKS
) {
if (
(client.buildVersion &&
isNotLaterRippledVersion(
REQUIRED_NETWORKID_VERSION,
client.buildVersion,
)) ||
client.networkID === HOOKS_TESTNET_ID
client.buildVersion &&
isNotLaterRippledVersion(REQUIRED_NETWORKID_VERSION, client.buildVersion)
) {
return true
}

View File

@@ -19,7 +19,6 @@ const NetworkID = 1025
const Fee = '10'
const Sequence = 1432
const LastLedgerSequence = 2908734
const HOOKS_TESTNET_ID = 21338
describe('client.autofill', function () {
let testContext: XrplTestContext
@@ -141,26 +140,6 @@ describe('client.autofill', function () {
assert.strictEqual(txResult.NetworkID, undefined)
})
// Hooks Testnet requires networkID in transaction regardless of version.
// More context: https://github.com/XRPLF/rippled/pull/4370
it('overrides network ID for hooks testnet', async function () {
await setupMockRippledVersionAndID('1.10.1', HOOKS_TESTNET_ID)
const tx: Payment = {
TransactionType: 'Payment',
Account: 'XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi',
Amount: '1234',
Destination: 'X7AcgcsBL6XDcUb289X4mJ8djcdyKaB5hJDWMArnXr61cqZ',
Fee,
Sequence,
LastLedgerSequence,
}
testContext.mockRippled!.addResponse('ledger', rippled.ledger.normal)
const txResult = await testContext.client.autofill(tx)
assert.strictEqual(txResult.NetworkID, HOOKS_TESTNET_ID)
})
it('converts Account & Destination X-address to their classic address', async function () {
const tx: Payment = {
TransactionType: 'Payment',

View File

@@ -83,40 +83,6 @@ describe('fundWallet', function () {
// )
// })
it(
'can generate wallet on hooks v3 testnet',
async function () {
const api = new Client('wss://hooks-testnet-v3.xrpl-labs.com')
await api.connect()
const { wallet, balance } = await api.fundWallet(null, {
usageContext: 'integration-test',
})
assert.notStrictEqual(wallet, undefined)
assert(isValidClassicAddress(wallet.classicAddress))
assert(isValidXAddress(wallet.getXAddress()))
const info = await api.request({
command: 'account_info',
account: wallet.classicAddress,
})
assert.equal(dropsToXrp(info.result.account_data.Balance), balance)
assert.equal(balance, 1000)
/*
* No test for fund given wallet because the hooks v3 testnet faucet
* requires 10 seconds between requests. Would significantly slow down
* the test suite.
*/
await api.disconnect()
},
TIMEOUT,
)
it(
'submit funds wallet with custom amount',
async function () {

View File

@@ -44,14 +44,6 @@ describe('Get Faucet host ', function () {
assert.strictEqual(getFaucetHost(testContext.client), expectedFaucet)
})
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.HooksV3Testnet
assert.strictEqual(getFaucetHost(testContext.client), expectedFaucet)
})
it('returns the correct faucetPath for Devnet host', function () {
const expectedFaucetPath = FaucetNetworkPaths[FaucetNetwork.Devnet]
// @ts-expect-error Intentionally modifying private data for test
@@ -63,17 +55,6 @@ describe('Get Faucet host ', function () {
)
})
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.HooksV3Testnet
assert.strictEqual(
getDefaultFaucetPath(getFaucetHost(testContext.client)),
expectedFaucetPath,
)
})
it('returns the correct faucetPath for undefined host', function () {
const expectedFaucetPath = '/accounts'