New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xrpl-binary-codec-prerelease

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xrpl-binary-codec-prerelease - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

dist/nativeasset.d.ts

498

dist/enums/src/enums/definitions.json

@@ -24,2 +24,4 @@ {

"UInt512": 23,
"Issue": 24,
"XChainBridge": 25,
"Transaction": 10001,

@@ -38,4 +40,7 @@ "LedgerEntry": 10002,

"Offer": 111,
"Bridge": 105,
"LedgerHashes": 104,
"Amendments": 102,
"XChainOwnedClaimID": 113,
"XChainOwnedCreateAccountClaimID": 116,
"FeeSettings": 115,

@@ -49,2 +54,3 @@ "Escrow": 117,

"NFTokenOffer": 55,
"AMM": 121,
"Any": -3,

@@ -238,2 +244,12 @@ "Child": -2,

[
"WasLockingChainSend",
{
"nth": 19,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt8"
}
],
[
"LedgerEntryType",

@@ -279,2 +295,22 @@ {

[
"TradingFee",
{
"nth": 5,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt16"
}
],
[
"DiscountedFee",
{
"nth": 6,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt16"
}
],
[
"Version",

@@ -780,2 +816,22 @@ {

[
"VoteWeight",
{
"nth": 48,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt32"
}
],
[
"FirstNFTokenSequence",
{
"nth": 50,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt32"
}
],
[
"IndexNext",

@@ -951,2 +1007,32 @@ {

[
"XChainClaimID",
{
"nth": 20,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt64"
}
],
[
"XChainAccountCreateCount",
{
"nth": 21,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt64"
}
],
[
"XChainAccountClaimCount",
{
"nth": 22,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt64"
}
],
[
"EmailHash",

@@ -1132,2 +1218,12 @@ {

[
"AMMID",
{
"nth": 14,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Hash256"
}
],
[
"BookDirectory",

@@ -1403,2 +1499,32 @@ {

[
"Amount2",
{
"nth": 11,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"BidMin",
{
"nth": 12,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"BidMax",
{
"nth": 13,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"MinimumOffer",

@@ -1444,2 +1570,102 @@ {

[
"BaseFeeDrops",
{
"nth": 22,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"ReserveBaseDrops",
{
"nth": 23,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"ReserveIncrementDrops",
{
"nth": 24,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"LPTokenOut",
{
"nth": 25,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"LPTokenIn",
{
"nth": 26,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"EPrice",
{
"nth": 27,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"Price",
{
"nth": 28,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"SignatureReward",
{
"nth": 29,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"MinAccountCreateAmount",
{
"nth": 30,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"LPTokenBalance",
{
"nth": 31,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"PublicKey",

@@ -1785,2 +2011,62 @@ {

[
"OtherChainSource",
{
"nth": 18,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"OtherChainDestination",
{
"nth": 19,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"AttestationSignerAccount",
{
"nth": 20,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"AttestationRewardAccount",
{
"nth": 21,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"LockingChainDoor",
{
"nth": 22,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"IssuingChainDoor",
{
"nth": 23,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"Indexes",

@@ -1836,2 +2122,52 @@ {

[
"LockingChainIssue",
{
"nth": 1,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"IssuingChainIssue",
{
"nth": 2,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"Asset",
{
"nth": 3,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"Asset2",
{
"nth": 4,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"XChainBridge",
{
"nth": 1,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "XChainBridge"
}
],
[
"TransactionMetaData",

@@ -2047,2 +2383,72 @@ {

[
"VoteEntry",
{
"nth": 25,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"AuctionSlot",
{
"nth": 26,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"AuthAccount",
{
"nth": 27,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainClaimProofSig",
{
"nth": 28,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainCreateAccountProofSig",
{
"nth": 29,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainClaimAttestationCollectionElement",
{
"nth": 30,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainCreateAccountAttestationCollectionElement",
{
"nth": 31,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"Signers",

@@ -2138,2 +2544,12 @@ {

[
"VoteSlots",
{
"nth": 12,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
],
[
"Majorities",

@@ -2187,2 +2603,32 @@ {

}
],
[
"XChainClaimAttestations",
{
"nth": 21,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
],
[
"XChainCreateAccountAttestations",
{
"nth": 22,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
],
[
"AuthAccounts",
{
"nth": 25,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
]

@@ -2246,2 +2692,9 @@ ],

"temBAD_NFTOKEN_TRANSFER_FEE": -262,
"temBAD_AMM_TOKENS": -261,
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
"temXCHAIN_BAD_PROOF": -259,
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,

@@ -2282,2 +2735,4 @@ "tefFAILURE": -199,

"terPRE_TICKET": -88,
"terNO_AMM": -87,
"terSUBMITTED": -86,

@@ -2324,2 +2779,3 @@ "tesSUCCESS": 0,

"tecTOO_SOON": 152,
"tecHOOK_ERROR": 153,
"tecMAX_SEQUENCE_REACHED": 154,

@@ -2332,3 +2788,28 @@ "tecNO_SUITABLE_NFTOKEN_PAGE": 155,

"tecOBJECT_NOT_FOUND": 160,
"tecINSUFFICIENT_PAYMENT": 161
"tecINSUFFICIENT_PAYMENT": 161,
"tecUNFUNDED_AMM": 162,
"tecAMM_BALANCE": 163,
"tecAMM_FAILED": 164,
"tecAMM_INVALID_TOKENS": 165,
"tecAMM_EMPTY": 166,
"tecAMM_NOT_EMPTY": 167,
"tecAMM_ACCOUNT": 168,
"tecINCOMPLETE": 169,
"tecXCHAIN_BAD_TRANSFER_ISSUE": 170,
"tecXCHAIN_NO_CLAIM_ID": 171,
"tecXCHAIN_BAD_CLAIM_ID": 172,
"tecXCHAIN_CLAIM_NO_QUORUM": 173,
"tecXCHAIN_PROOF_UNKNOWN_KEY": 174,
"tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 175,
"tecXCHAIN_WRONG_CHAIN": 176,
"tecXCHAIN_REWARD_MISMATCH": 177,
"tecXCHAIN_NO_SIGNERS_LIST": 178,
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 179,
"tecXCHAIN_INSUFF_CREATE_AMOUNT": 180,
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
"tecXCHAIN_PAYMENT_FAILED": 183,
"tecXCHAIN_SELF_COMMIT": 184,
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186
},

@@ -2365,2 +2846,17 @@ "TRANSACTION_TYPES": {

"NFTokenAcceptOffer": 29,
"Clawback": 30,
"AMMCreate": 35,
"AMMDeposit": 36,
"AMMWithdraw": 37,
"AMMVote": 38,
"AMMBid": 39,
"AMMDelete": 40,
"XChainCreateClaimID": 41,
"XChainCommit": 42,
"XChainClaim": 43,
"XChainAccountCreateCommit": 44,
"XChainAddClaimAttestation": 45,
"XChainAddAccountCreateAttestation": 46,
"XChainModifyBridge": 47,
"XChainCreateBridge": 48,
"EnableAmendment": 100,

@@ -2367,0 +2863,0 @@ "SetFee": 101,

10

dist/types/amount.d.ts

@@ -40,8 +40,8 @@ import { BinaryParser } from '../serdes/binary-parser';

/**
* Validate XRP amount
* Validate Native Asset amount
*
* @param amount String representing XRP amount
* @param amount String representing Native Asset amount
* @returns void, but will throw if invalid amount
*/
private static assertXrpIsValid;
private static assertNativeAssetIsValid;
/**

@@ -63,5 +63,5 @@ * Validate IOU.value amount

/**
* Test if this amount is in units of Native Currency(XRP)
* Test if this amount is in units of Native Currency(Native Asset)
*
* @returns true if Native (XRP)
* @returns true if Native (Native Asset)
*/

@@ -68,0 +68,0 @@ private isNative;

@@ -18,3 +18,3 @@ "use strict";

const MAX_DROPS = new decimal_js_1.Decimal('1e17');
const MIN_XRP = new decimal_js_1.Decimal('1e-6');
const MIN_NATIVE_ASSET = new decimal_js_1.Decimal('1e-6');
const mask = bigInt(0x00000000ffffffff);

@@ -58,3 +58,3 @@ /**

if (typeof value === 'string') {
Amount.assertXrpIsValid(value);
Amount.assertNativeAssetIsValid(value);
const number = bigInt(value);

@@ -106,4 +106,4 @@ const intBuf = [buffer_1.Buffer.alloc(4), buffer_1.Buffer.alloc(4)];

static fromParser(parser) {
const isXRP = parser.peek() & 0x80;
const numBytes = isXRP ? 48 : 8;
const isNativeAsset = parser.peek() & 0x80;
const numBytes = isNativeAsset ? 48 : 8;
return new Amount(parser.read(numBytes));

@@ -149,8 +149,8 @@ }

/**
* Validate XRP amount
* Validate Native Asset amount
*
* @param amount String representing XRP amount
* @param amount String representing Native Asset amount
* @returns void, but will throw if invalid amount
*/
static assertXrpIsValid(amount) {
static assertNativeAssetIsValid(amount) {
if (amount.indexOf('.') !== -1) {

@@ -161,3 +161,3 @@ throw new Error(`${amount.toString()} is an illegal amount`);

if (!decimal.isZero()) {
if (decimal.lt(MIN_XRP) || decimal.gt(MAX_DROPS)) {
if (decimal.lt(MIN_NATIVE_ASSET) || decimal.gt(MAX_DROPS)) {
throw new Error(`${amount.toString()} is an illegal amount`);

@@ -202,5 +202,5 @@ }

/**
* Test if this amount is in units of Native Currency(XRP)
* Test if this amount is in units of Native Currency(Native Asset)
*
* @returns true if Native (XRP)
* @returns true if Native (Native Asset)
*/

@@ -207,0 +207,0 @@ isNative() {

@@ -7,3 +7,3 @@ import { Hash160 } from './hash-160';

declare class Currency extends Hash160 {
static readonly XRP: Currency;
static readonly NATIVE_ASSET: Currency;
private readonly _iso;

@@ -10,0 +10,0 @@ constructor(byteBuf: Buffer);

@@ -6,3 +6,4 @@ "use strict";

const buffer_1 = require("buffer/");
const XRP_HEX_REGEX = /^0{40}$/;
const nativeasset_1 = require("../nativeasset");
const NATIVE_ASSET_HEX_REGEX = /^0{40}$/;
const ISO_REGEX = /^[A-Z0-9a-z?!@#$%^&*(){}[\]|]{3}$/;

@@ -17,3 +18,3 @@ const HEX_REGEX = /^[A-F0-9]{40}$/;

const bytes = buffer_1.Buffer.alloc(20);
if (iso !== 'XRP') {
if (iso !== nativeasset_1.nativeAsset.get()) {
const isoBytes = iso.split('').map((c) => c.charCodeAt(0));

@@ -32,3 +33,3 @@ bytes.set(isoBytes, 12);

const iso = code.toString();
if (iso === 'XRP') {
if (iso === nativeasset_1.nativeAsset.get()) {
return null;

@@ -81,6 +82,6 @@ }

constructor(byteBuf) {
super(byteBuf !== null && byteBuf !== void 0 ? byteBuf : Currency.XRP.bytes);
super(byteBuf !== null && byteBuf !== void 0 ? byteBuf : Currency.NATIVE_ASSET.bytes);
const hex = this.bytes.toString('hex');
if (XRP_HEX_REGEX.test(hex)) {
this._iso = 'XRP';
if (NATIVE_ASSET_HEX_REGEX.test(hex)) {
this._iso = nativeasset_1.nativeAsset.get();
}

@@ -130,3 +131,3 @@ else if (STANDARD_FORMAT_HEX_REGEX.test(hex)) {

exports.Currency = Currency;
Currency.XRP = new Currency(buffer_1.Buffer.alloc(20));
Currency.NATIVE_ASSET = new Currency(buffer_1.Buffer.alloc(20));
//# sourceMappingURL=currency.js.map

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "Hash256", { enumerable: true, get: function () { return hash_256_1.Hash256; } });
const issue_1 = require("./issue");
const path_set_1 = require("./path-set");

@@ -35,2 +36,3 @@ Object.defineProperty(exports, "PathSet", { enumerable: true, get: function () { return path_set_1.PathSet; } });

Object.defineProperty(exports, "Vector256", { enumerable: true, get: function () { return vector_256_1.Vector256; } });
const xchain_bridge_1 = require("./xchain-bridge");
const enums_1 = require("../enums");

@@ -45,2 +47,3 @@ const coreTypes = {

Hash256: hash_256_1.Hash256,
Issue: issue_1.Issue,
PathSet: path_set_1.PathSet,

@@ -54,2 +57,3 @@ STArray: st_array_1.STArray,

Vector256: vector_256_1.Vector256,
XChainBridge: xchain_bridge_1.XChainBridge,
};

@@ -56,0 +60,0 @@ exports.coreTypes = coreTypes;

@@ -26,2 +26,3 @@ import { XrplDefinitionsBase } from '../enums';

*
* @param definitions optional, types and values to use to encode/decode a transaction
* @returns An Array of JSON objects

@@ -28,0 +29,0 @@ */

@@ -64,2 +64,3 @@ "use strict";

*
* @param definitions optional, types and values to use to encode/decode a transaction
* @returns An Array of JSON objects

@@ -66,0 +67,0 @@ */

{
"name": "xrpl-binary-codec-prerelease",
"version": "3.0.0",
"description": "XRP Ledger binary codec - PRERELEASE",
"version": "4.0.0",
"description": "XRP Ledger binary codec",
"files": [
"dist/*",
"bin/*",
"test/*"
"src/*"
],

@@ -20,3 +19,3 @@ "main": "dist/",

"decimal.js": "^10.2.0",
"ripple-address-codec": "^4.3.0"
"ripple-address-codec": "^4.3.1"
},

@@ -30,2 +29,8 @@ "scripts": {

},
"keywords": [
"ripple",
"xrp",
"xrp ledger",
"xrpl"
],
"repository": {

@@ -32,0 +37,0 @@ "type": "git",

# ripple-binary-codec [![NPM](https://img.shields.io/npm/v/ripple-binary-codec.svg)](https://npmjs.org/package/ripple-binary-codec)
## FORK, PRERELEASE
Functions to encode/decode to/from the ripple [binary serialization format](https://xrpl.org/serialization.html)

@@ -6,0 +4,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc