mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Add NFT Devnet as an inferable faucet (#2024)
* Add NFT Devnet to implicit fundWallet
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
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.
|
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
|
## Unreleased
|
||||||
|
### Added
|
||||||
|
* When connected to nft-devnet, Client.fundWallet now defaults to using the nft-devnet faucet instead of requiring specification.
|
||||||
|
|
||||||
## 2.3.0 (2022-06-02)
|
## 2.3.0 (2022-06-02)
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ interface FaucetWallet {
|
|||||||
enum FaucetNetwork {
|
enum FaucetNetwork {
|
||||||
Testnet = 'faucet.altnet.rippletest.net',
|
Testnet = 'faucet.altnet.rippletest.net',
|
||||||
Devnet = 'faucet.devnet.rippletest.net',
|
Devnet = 'faucet.devnet.rippletest.net',
|
||||||
|
NFTDevnet = 'faucet-nft.ripple.com',
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interval to check an account balance
|
// Interval to check an account balance
|
||||||
@@ -312,6 +313,10 @@ function getFaucetHost(client: Client): FaucetNetwork | undefined {
|
|||||||
return FaucetNetwork.Devnet
|
return FaucetNetwork.Devnet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (connectionUrl.includes('xls20-sandbox')) {
|
||||||
|
return FaucetNetwork.NFTDevnet
|
||||||
|
}
|
||||||
|
|
||||||
throw new XRPLFaucetError('Faucet URL is not defined or inferrable.')
|
throw new XRPLFaucetError('Faucet URL is not defined or inferrable.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,35 @@ describe('fundWallet', function () {
|
|||||||
await api.disconnect()
|
await api.disconnect()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('can generate and fund wallets on nft-devnet', async function () {
|
||||||
|
const api = new Client('ws://xls20-sandbox.rippletest.net:51233')
|
||||||
|
|
||||||
|
await api.connect()
|
||||||
|
const { wallet, balance } = await api.fundWallet()
|
||||||
|
assert.notEqual(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)
|
||||||
|
|
||||||
|
const { balance: newBalance } = await api.fundWallet(wallet, {
|
||||||
|
faucetHost: 'faucet-nft.ripple.com',
|
||||||
|
})
|
||||||
|
|
||||||
|
const afterSent = await api.request({
|
||||||
|
command: 'account_info',
|
||||||
|
account: wallet.classicAddress,
|
||||||
|
})
|
||||||
|
assert.equal(dropsToXrp(afterSent.result.account_data.Balance), newBalance)
|
||||||
|
|
||||||
|
await api.disconnect()
|
||||||
|
})
|
||||||
|
|
||||||
it('can generate and fund wallets using a custom host', async function () {
|
it('can generate and fund wallets using a custom host', async function () {
|
||||||
const api = new Client('ws://xls20-sandbox.rippletest.net:51233')
|
const api = new Client('ws://xls20-sandbox.rippletest.net:51233')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user