Comparing version 2.2.3 to 2.3.0
@@ -158,2 +158,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.clearHeartbeatInterval(); | ||
if (this.reconnectTimeoutID !== null) { | ||
@@ -262,4 +263,14 @@ clearTimeout(this.reconnectTimeoutID); | ||
this.ws = null; | ||
this.emit('disconnected', code); | ||
if (code !== exports.INTENTIONAL_DISCONNECT_CODE) { | ||
if (code === undefined) { | ||
const reasonText = reason ? reason.toString() : 'undefined'; | ||
console.error(`Disconnected but the disconnect code was undefined (The given reason was ${reasonText}).` + | ||
`This could be caused by an exception being thrown during a 'connect' callback. ` + | ||
`Disconnecting with code 1011 to indicate an internal error has occurred.`); | ||
const internalErrorCode = 1011; | ||
this.emit('disconnected', internalErrorCode); | ||
} | ||
else { | ||
this.emit('disconnected', code); | ||
} | ||
if (code !== exports.INTENTIONAL_DISCONNECT_CODE && code !== undefined) { | ||
this.intentionalDisconnect(); | ||
@@ -266,0 +277,0 @@ } |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -12,3 +12,3 @@ import { Amount, LedgerIndex } from '../common'; | ||
} | ||
interface AccountOffer { | ||
export interface AccountOffer { | ||
flags: number; | ||
@@ -31,3 +31,2 @@ seq: number; | ||
} | ||
export {}; | ||
//# sourceMappingURL=accountOffers.d.ts.map |
@@ -7,3 +7,3 @@ import { AccountChannelsRequest, AccountChannelsResponse } from './accountChannels'; | ||
import { AccountObjectsRequest, AccountObjectsResponse } from './accountObjects'; | ||
import { AccountOffersRequest, AccountOffersResponse } from './accountOffers'; | ||
import { AccountOffer, AccountOffersRequest, AccountOffersResponse } from './accountOffers'; | ||
import { AccountTxRequest, AccountTxResponse } from './accountTx'; | ||
@@ -40,3 +40,3 @@ import { ErrorResponse } from './baseMethod'; | ||
declare type Response = AccountChannelsResponse | AccountCurrenciesResponse | AccountInfoResponse | AccountLinesResponse | AccountNFTsResponse | AccountObjectsResponse | AccountOffersResponse | AccountTxResponse | GatewayBalancesResponse | NoRippleCheckResponse | LedgerResponse | LedgerClosedResponse | LedgerCurrentResponse | LedgerDataResponse | LedgerEntryResponse | SubmitResponse | SubmitMultisignedResponse | TransactionEntryResponse | TxResponse | BookOffersResponse | DepositAuthorizedResponse | PathFindResponse | RipplePathFindResponse | ChannelVerifyResponse | SubscribeResponse | UnsubscribeResponse | FeeResponse | ManifestResponse | ServerInfoResponse | ServerStateResponse | PingResponse | RandomResponse | NFTBuyOffersResponse | NFTSellOffersResponse | FederatorInfoResponse; | ||
export { Request, Response, AccountChannelsRequest, AccountChannelsResponse, AccountCurrenciesRequest, AccountCurrenciesResponse, AccountInfoRequest, AccountInfoResponse, AccountLinesRequest, AccountLinesResponse, AccountNFTsRequest, AccountNFTsResponse, AccountObjectsRequest, AccountObjectsResponse, AccountOffersRequest, AccountOffersResponse, AccountTxRequest, AccountTxResponse, GatewayBalancesRequest, GatewayBalancesResponse, NoRippleCheckRequest, NoRippleCheckResponse, LedgerRequest, LedgerResponse, LedgerClosedRequest, LedgerClosedResponse, LedgerCurrentRequest, LedgerCurrentResponse, LedgerDataRequest, LedgerDataResponse, LedgerEntryRequest, LedgerEntryResponse, SubmitRequest, SubmitResponse, SubmitMultisignedRequest, SubmitMultisignedResponse, TransactionEntryRequest, TransactionEntryResponse, TxRequest, TxResponse, BookOffersRequest, BookOffer, BookOffersResponse, DepositAuthorizedRequest, DepositAuthorizedResponse, PathFindRequest, PathFindCreateRequest, PathFindCloseRequest, PathFindStatusRequest, PathFindResponse, RipplePathFindRequest, RipplePathFindResponse, ChannelVerifyRequest, ChannelVerifyResponse, SubscribeRequest, SubscribeResponse, Stream, LedgerStream, ValidationStream, TransactionStream, PathFindStream, PeerStatusStream, OrderBookStream, ConsensusStream, UnsubscribeRequest, UnsubscribeResponse, FeeRequest, FeeResponse, ManifestRequest, ManifestResponse, ServerInfoRequest, ServerInfoResponse, ServerStateRequest, ServerStateResponse, PingRequest, PingResponse, RandomRequest, RandomResponse, ErrorResponse, NFTBuyOffersRequest, NFTBuyOffersResponse, NFTSellOffersRequest, NFTSellOffersResponse, FederatorInfoRequest, FederatorInfoResponse, }; | ||
export { Request, Response, AccountChannelsRequest, AccountChannelsResponse, AccountCurrenciesRequest, AccountCurrenciesResponse, AccountInfoRequest, AccountInfoResponse, AccountLinesRequest, AccountLinesResponse, AccountNFTsRequest, AccountNFTsResponse, AccountObjectsRequest, AccountObjectsResponse, AccountOffer, AccountOffersRequest, AccountOffersResponse, AccountTxRequest, AccountTxResponse, GatewayBalancesRequest, GatewayBalancesResponse, NoRippleCheckRequest, NoRippleCheckResponse, LedgerRequest, LedgerResponse, LedgerClosedRequest, LedgerClosedResponse, LedgerCurrentRequest, LedgerCurrentResponse, LedgerDataRequest, LedgerDataResponse, LedgerEntryRequest, LedgerEntryResponse, SubmitRequest, SubmitResponse, SubmitMultisignedRequest, SubmitMultisignedResponse, TransactionEntryRequest, TransactionEntryResponse, TxRequest, TxResponse, BookOffersRequest, BookOffer, BookOffersResponse, DepositAuthorizedRequest, DepositAuthorizedResponse, PathFindRequest, PathFindCreateRequest, PathFindCloseRequest, PathFindStatusRequest, PathFindResponse, RipplePathFindRequest, RipplePathFindResponse, ChannelVerifyRequest, ChannelVerifyResponse, SubscribeRequest, SubscribeResponse, Stream, LedgerStream, ValidationStream, TransactionStream, PathFindStream, PeerStatusStream, OrderBookStream, ConsensusStream, UnsubscribeRequest, UnsubscribeResponse, FeeRequest, FeeResponse, ManifestRequest, ManifestResponse, ServerInfoRequest, ServerInfoResponse, ServerStateRequest, ServerStateResponse, PingRequest, PingResponse, RandomRequest, RandomResponse, ErrorResponse, NFTBuyOffersRequest, NFTBuyOffersResponse, NFTSellOffersRequest, NFTSellOffersResponse, FederatorInfoRequest, FederatorInfoResponse, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
const errors_1 = require("../../errors"); | ||
const utils_1 = require("../utils"); | ||
const common_1 = require("./common"); | ||
@@ -19,2 +20,5 @@ var NFTokenMintFlags; | ||
} | ||
if (typeof tx.URI === 'string' && !(0, utils_1.isHex)(tx.URI)) { | ||
throw new errors_1.ValidationError('NFTokenMint: URI must be in hex format'); | ||
} | ||
if (tx.NFTokenTaxon == null) { | ||
@@ -21,0 +25,0 @@ throw new errors_1.ValidationError('NFTokenMint: missing field NFTokenTaxon'); |
export declare function onlyHasFields(obj: Record<string, unknown>, fields: string[]): boolean; | ||
export declare function isFlagEnabled(Flags: number, checkFlag: number): boolean; | ||
export declare function isHex(str: string): boolean; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isFlagEnabled = exports.onlyHasFields = void 0; | ||
exports.isHex = exports.isFlagEnabled = exports.onlyHasFields = void 0; | ||
const HEX_REGEX = /^[0-9A-Fa-f]+$/u; | ||
function onlyHasFields(obj, fields) { | ||
@@ -12,2 +13,6 @@ return Object.keys(obj).every((key) => fields.includes(key)); | ||
exports.isFlagEnabled = isFlagEnabled; | ||
function isHex(str) { | ||
return HEX_REGEX.test(str); | ||
} | ||
exports.isHex = isHex; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -74,3 +74,4 @@ "use strict"; | ||
.catch((error) => __awaiter(this, void 0, void 0, function* () { | ||
const message = error.data.error; | ||
var _a; | ||
const message = (_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.error; | ||
if (message === 'txnNotFound') { | ||
@@ -77,0 +78,0 @@ return waitForFinalTransactionOutcome(client, txHash, lastLedger, submissionResult); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const bignumber_js_1 = __importDefault(require("bignumber.js")); | ||
const bip32_1 = require("bip32"); | ||
@@ -15,3 +16,4 @@ const bip39_1 = require("bip39"); | ||
const errors_1 = require("../errors"); | ||
const utils_1 = require("../sugar/utils"); | ||
const utils_1 = require("../models/utils"); | ||
const utils_2 = require("../sugar/utils"); | ||
const hashLedger_1 = require("../utils/hashes/hashLedger"); | ||
@@ -29,3 +31,3 @@ const rfc1751_1 = require("./rfc1751"); | ||
this.classicAddress = opts.masterAddress | ||
? (0, utils_1.ensureClassicAddress)(opts.masterAddress) | ||
? (0, utils_2.ensureClassicAddress)(opts.masterAddress) | ||
: (0, ripple_keypairs_1.deriveAddress)(publicKey); | ||
@@ -113,6 +115,8 @@ this.seed = opts.seed; | ||
} | ||
if (transaction.TxnSignature || transaction.Signers) { | ||
const tx = Object.assign({}, transaction); | ||
if (tx.TxnSignature || tx.Signers) { | ||
throw new errors_1.ValidationError('txJSON must not contain "TxnSignature" or "Signers" properties'); | ||
} | ||
const txToSignAndEncode = Object.assign({}, transaction); | ||
removeTrailingZeros(tx); | ||
const txToSignAndEncode = Object.assign({}, tx); | ||
txToSignAndEncode.SigningPubKey = multisignAddress ? '' : this.publicKey; | ||
@@ -131,3 +135,3 @@ if (multisignAddress) { | ||
const serialized = (0, ripple_binary_codec_1.encode)(txToSignAndEncode); | ||
this.checkTxSerialization(serialized, transaction); | ||
this.checkTxSerialization(serialized, tx); | ||
return { | ||
@@ -172,3 +176,9 @@ tx_blob: serialized, | ||
}); | ||
if (!lodash_1.default.isEqual(decoded, tx)) { | ||
if (txCopy.TransactionType === 'NFTokenMint' && txCopy.URI) { | ||
if (!(0, utils_1.isHex)(txCopy.URI)) { | ||
throw new errors_1.ValidationError('URI must be a hex value'); | ||
} | ||
txCopy.URI = txCopy.URI.toUpperCase(); | ||
} | ||
if (!lodash_1.default.isEqual(decoded, txCopy)) { | ||
const data = { | ||
@@ -193,3 +203,12 @@ decoded, | ||
} | ||
function removeTrailingZeros(tx) { | ||
if (tx.TransactionType === 'Payment' && | ||
typeof tx.Amount !== 'string' && | ||
tx.Amount.value.includes('.') && | ||
tx.Amount.value.endsWith('0')) { | ||
tx.Amount = Object.assign({}, tx.Amount); | ||
tx.Amount.value = new bignumber_js_1.default(tx.Amount.value).toString(); | ||
} | ||
} | ||
exports.default = Wallet; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "xrpl", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"license": "ISC", | ||
@@ -9,3 +9,5 @@ "description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser", | ||
"build/xrpl-latest-min.js", | ||
"build/xrpl-latest.js" | ||
"build/xrpl-latest-min.js.map", | ||
"build/xrpl-latest.js", | ||
"build/xrpl-latest.js.map" | ||
], | ||
@@ -29,3 +31,3 @@ "main": "dist/npm/", | ||
"ripple-address-codec": "^4.2.4", | ||
"ripple-binary-codec": "^1.4.0", | ||
"ripple-binary-codec": "^1.4.1", | ||
"ripple-keypairs": "^1.1.4", | ||
@@ -71,3 +73,3 @@ "ws": "^8.2.2" | ||
}, | ||
"gitHead": "17d57abcd04ece36a4c4b5d3145ce84e907b261f" | ||
"gitHead": "4fddd8f41d4caa1b8bc728705f232e9b211eabde" | ||
} |
Sorry, the diff of this file is too big to display
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
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10018124
556
75473
3
Updatedripple-binary-codec@^1.4.1