Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/xrpl/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions packages/xrpl/src/Wallet/defaultFaucets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}

/**
Expand All @@ -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
Expand Down
12 changes: 3 additions & 9 deletions packages/xrpl/src/sugar/autofill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const LEDGER_OFFSET = 20
// Mainnet and testnet are exceptions. More context: https:/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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
21 changes: 0 additions & 21 deletions packages/xrpl/test/client/autofill.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:/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',
Expand Down
34 changes: 0 additions & 34 deletions packages/xrpl/test/integration/fundWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
19 changes: 0 additions & 19 deletions packages/xrpl/test/wallet/fundWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand Down
Loading