Comparing version 2.7.0-beta.0 to 2.8.0-beta.0
@@ -9,12 +9,8 @@ import { Amount, Issue, IssuedCurrencyAmount } from '../common'; | ||
interface AuthAccount { | ||
AuthAccount: { | ||
Account: string; | ||
}; | ||
account: string; | ||
} | ||
interface VoteEntry { | ||
VoteEntry: { | ||
Account: string; | ||
TradingFee: number; | ||
VoteWeight: number; | ||
}; | ||
account: string; | ||
trading_fee: number; | ||
vote_weight: number; | ||
} | ||
@@ -24,19 +20,21 @@ export interface AMMInfoResponse extends BaseResponse { | ||
amm: { | ||
AMMAccount: string; | ||
AMMID: string; | ||
Amount: Amount; | ||
Amount2: Amount; | ||
AuctionSlot?: { | ||
Account: string; | ||
AuthAccounts: AuthAccount[]; | ||
DiscountedFee: number; | ||
Expiration: string; | ||
Price: Amount; | ||
amm_account: string; | ||
amount: Amount; | ||
amount2: Amount; | ||
asset2_frozen: boolean; | ||
auction_slot?: { | ||
account: string; | ||
auth_accounts: AuthAccount[]; | ||
discounted_fee: number; | ||
expiration: string; | ||
price: Amount; | ||
time_interval: number; | ||
}; | ||
LPToken: IssuedCurrencyAmount; | ||
TradingFee: number; | ||
VoteSlots?: VoteEntry[]; | ||
ledger_current_index?: number; | ||
validated?: boolean; | ||
lp_token: IssuedCurrencyAmount; | ||
trading_fee: number; | ||
vote_slots?: VoteEntry[]; | ||
}; | ||
ledger_hash?: string; | ||
ledger_index?: number; | ||
validated?: boolean; | ||
}; | ||
@@ -43,0 +41,0 @@ } |
@@ -12,3 +12,3 @@ import { Amount, XChainBridge } from '../common'; | ||
AttestationRewardAccount: string; | ||
Destination: string; | ||
Destination?: string; | ||
PublicKey: string; | ||
@@ -15,0 +15,0 @@ Signature: string; |
import type { Client } from '..'; | ||
import Wallet from '.'; | ||
declare enum FaucetNetwork { | ||
Testnet = "faucet.altnet.rippletest.net", | ||
Devnet = "faucet.devnet.rippletest.net", | ||
NFTDevnet = "faucet-nft.ripple.com" | ||
} | ||
declare function fundWallet(this: Client, wallet?: Wallet | null, options?: { | ||
faucetHost?: string; | ||
faucetPath?: string; | ||
amount?: string; | ||
@@ -15,9 +11,3 @@ }): Promise<{ | ||
}>; | ||
declare function getFaucetHost(client: Client): FaucetNetwork | undefined; | ||
export default fundWallet; | ||
declare const _private: { | ||
FaucetNetwork: typeof FaucetNetwork; | ||
getFaucetHost: typeof getFaucetHost; | ||
}; | ||
export { _private }; | ||
//# sourceMappingURL=fundWallet.d.ts.map |
@@ -15,13 +15,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._private = void 0; | ||
const https_1 = require("https"); | ||
const ripple_address_codec_1 = require("ripple-address-codec"); | ||
const errors_1 = require("../errors"); | ||
const defaultFaucets_1 = require("./defaultFaucets"); | ||
const _1 = __importDefault(require(".")); | ||
var FaucetNetwork; | ||
(function (FaucetNetwork) { | ||
FaucetNetwork["Testnet"] = "faucet.altnet.rippletest.net"; | ||
FaucetNetwork["Devnet"] = "faucet.devnet.rippletest.net"; | ||
FaucetNetwork["NFTDevnet"] = "faucet-nft.ripple.com"; | ||
})(FaucetNetwork || (FaucetNetwork = {})); | ||
const INTERVAL_SECONDS = 1; | ||
@@ -47,3 +41,6 @@ const MAX_ATTEMPTS = 20; | ||
} | ||
const httpOptions = getHTTPOptions(this, postBody, options === null || options === void 0 ? void 0 : options.faucetHost); | ||
const httpOptions = getHTTPOptions(this, postBody, { | ||
hostname: options === null || options === void 0 ? void 0 : options.faucetHost, | ||
pathname: options === null || options === void 0 ? void 0 : options.faucetPath, | ||
}); | ||
return returnPromise(httpOptions, this, startingBalance, walletToFund, postBody); | ||
@@ -70,7 +67,10 @@ }); | ||
} | ||
function getHTTPOptions(client, postBody, hostname) { | ||
function getHTTPOptions(client, postBody, options) { | ||
var _a, _b; | ||
const finalHostname = (_a = options === null || options === void 0 ? void 0 : options.hostname) !== null && _a !== void 0 ? _a : (0, defaultFaucets_1.getFaucetHost)(client); | ||
const finalPathname = (_b = options === null || options === void 0 ? void 0 : options.pathname) !== null && _b !== void 0 ? _b : (0, defaultFaucets_1.getDefaultFaucetPath)(finalHostname); | ||
return { | ||
hostname: hostname !== null && hostname !== void 0 ? hostname : getFaucetHost(client), | ||
hostname: finalHostname, | ||
port: 443, | ||
path: '/accounts', | ||
path: finalPathname, | ||
method: 'POST', | ||
@@ -88,3 +88,5 @@ headers: { | ||
if ((_a = response.headers['content-type']) === null || _a === void 0 ? void 0 : _a.startsWith('application/json')) { | ||
yield processSuccessfulResponse(client, body, startingBalance, walletToFund, resolve, reject); | ||
const faucetWallet = JSON.parse(body); | ||
const classicAddress = faucetWallet.account.classicAddress; | ||
yield processSuccessfulResponse(client, classicAddress, walletToFund, startingBalance, resolve, reject); | ||
} | ||
@@ -100,6 +102,4 @@ else { | ||
} | ||
function processSuccessfulResponse(client, body, startingBalance, walletToFund, resolve, reject) { | ||
function processSuccessfulResponse(client, classicAddress, walletToFund, startingBalance, resolve, reject) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const faucetWallet = JSON.parse(body); | ||
const classicAddress = faucetWallet.account.classicAddress; | ||
if (!classicAddress) { | ||
@@ -164,21 +164,3 @@ reject(new errors_1.XRPLFaucetError(`The faucet account is undefined`)); | ||
} | ||
function getFaucetHost(client) { | ||
const connectionUrl = client.url; | ||
if (connectionUrl.includes('altnet') || connectionUrl.includes('testnet')) { | ||
return FaucetNetwork.Testnet; | ||
} | ||
if (connectionUrl.includes('devnet')) { | ||
return FaucetNetwork.Devnet; | ||
} | ||
if (connectionUrl.includes('xls20-sandbox')) { | ||
return FaucetNetwork.NFTDevnet; | ||
} | ||
throw new errors_1.XRPLFaucetError('Faucet URL is not defined or inferrable.'); | ||
} | ||
exports.default = fundWallet; | ||
const _private = { | ||
FaucetNetwork, | ||
getFaucetHost, | ||
}; | ||
exports._private = _private; | ||
//# sourceMappingURL=fundWallet.js.map |
{ | ||
"name": "xrpl", | ||
"version": "2.7.0-beta.0", | ||
"version": "2.8.0-beta.0", | ||
"license": "ISC", | ||
@@ -31,3 +31,3 @@ "description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser", | ||
"ripple-address-codec": "^4.2.4", | ||
"ripple-binary-codec": "^1.5.0-beta.2", | ||
"ripple-binary-codec": "^1.6.0-beta.0", | ||
"ripple-keypairs": "^1.1.4", | ||
@@ -54,3 +54,3 @@ "ws": "^8.2.2" | ||
"test": "nyc mocha --config=test/.mocharc.json --exit", | ||
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/integration/**/*.ts ./test/integration/*.ts", | ||
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/integration/**/*.test.ts ./test/integration/*.test.ts", | ||
"test:browser": "npm run build:browserTests && TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/browser/*.ts", | ||
@@ -74,3 +74,3 @@ "test:watch": "TS_NODE_PROJECT=src/tsconfig.json mocha --config=test/.mocharc.json --watch --reporter dot", | ||
}, | ||
"gitHead": "b61ce6daf56ba9277785d9a2ec040b235afdf0ca" | ||
"gitHead": "409bafd29a26e20dc8195f2b723c788332aa4e48" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10323515
616
77423
1