mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-13 17:15:49 +00:00
Compare commits
9 Commits
@transia/r
...
@transia/r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b054430406 | ||
|
|
c29f512345 | ||
|
|
d86cd8d813 | ||
|
|
40d9c2b1a1 | ||
|
|
6c25d08019 | ||
|
|
6f72189c13 | ||
|
|
5429930c0d | ||
|
|
f82872fe9f | ||
|
|
8d16592abb |
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -64,4 +64,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|||||||
4228
package-lock.json
generated
4228
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,10 +13,10 @@
|
|||||||
"update:confirm": "npx npm-check-updates --configFileName .ncurc.json -u"
|
"update:confirm": "npx npm-check-updates --configFileName .ncurc.json -u"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@transia/ripple-address-codec": "file:packages/ripple-address-codec",
|
"ripple-address-codec": "file:packages/ripple-address-codec",
|
||||||
"@transia/ripple-binary-codec": "file:packages/ripple-binary-codec",
|
"ripple-binary-codec": "file:packages/ripple-binary-codec",
|
||||||
"@transia/ripple-keypairs": "file:packages/ripple-keypairs",
|
"ripple-keypairs": "file:packages/ripple-keypairs",
|
||||||
"@transia/xrpl": "file:packages/xrpl"
|
"xrpl": "file:packages/xrpl"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/brorand": "^1.0.30",
|
"@types/brorand": "^1.0.30",
|
||||||
|
|||||||
4
packages/ripple-address-codec/package-lock.json
generated
4
packages/ripple-address-codec/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ripple-address-codec",
|
"name": "ripple-address-codec",
|
||||||
"version": "4.2.8-alpha.0",
|
"version": "4.2.7",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ripple-address-codec",
|
"name": "ripple-address-codec",
|
||||||
"version": "4.2.8-alpha.0",
|
"version": "4.2.7",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base-x": "^3.0.9",
|
"base-x": "^3.0.9",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@transia/ripple-address-codec",
|
"name": "@transia/ripple-address-codec",
|
||||||
"version": "4.2.8-alpha.0",
|
"version": "4.2.7",
|
||||||
"description": "encodes/decodes base58 encoded XRP Ledger identifiers",
|
"description": "encodes/decodes base58 encoded XRP Ledger identifiers",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/*",
|
"dist/*",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
|
"url": "git@github.com:Transia-RnD/xrpl.js.git"
|
||||||
},
|
},
|
||||||
"prepublish": "tsc -b",
|
"prepublish": "tsc -b",
|
||||||
"prepublishOnly": "tslint -b ./ && jest",
|
"prepublishOnly": "tslint -b ./ && jest",
|
||||||
@@ -28,5 +28,9 @@
|
|||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
|
},
|
||||||
|
"gitHead": "40d9c2b1a158ab480df7e8b1c7dc2ed3b88afc75",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@transia/ripple-binary-codec",
|
"name": "@transia/ripple-binary-codec",
|
||||||
"version": "1.4.6-alpha.0",
|
"version": "1.4.5",
|
||||||
"description": "XRP Ledger binary codec",
|
"description": "XRP Ledger binary codec",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/*",
|
"dist/*",
|
||||||
@@ -12,12 +12,12 @@
|
|||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@transia/ripple-address-codec": "^4.2.8-alpha.0",
|
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
"big-integer": "^1.6.48",
|
"big-integer": "^1.6.48",
|
||||||
"buffer": "5.6.0",
|
"buffer": "5.6.0",
|
||||||
"create-hash": "^1.2.0",
|
"create-hash": "^1.2.0",
|
||||||
"decimal.js": "^10.2.0"
|
"decimal.js": "^10.2.0",
|
||||||
|
"ripple-address-codec": "^4.2.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
"build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
||||||
@@ -28,16 +28,20 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
|
"url": "git@github.com:Transia-RnD/xrpl.js.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/XRPLF/xrpl.js/issues"
|
"url": "https://github.com/Transia-RnD/xrpl.js/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/XRPLF/xrpl.js/tree/main/packages/ripple-binary-codec#readme",
|
"homepage": "https://github.com/Transia-RnD/xrpl.js/tree/main/packages/ripple-binary-codec#readme",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
|
},
|
||||||
|
"gitHead": "6c25d08019d06534525a4a2bf41bf0e135a79849",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -779,7 +779,7 @@
|
|||||||
[
|
[
|
||||||
"LockCount",
|
"LockCount",
|
||||||
{
|
{
|
||||||
"nth": 49,
|
"nth": 47,
|
||||||
"isVLEncoded": false,
|
"isVLEncoded": false,
|
||||||
"isSerialized": true,
|
"isSerialized": true,
|
||||||
"isSigningField": true,
|
"isSigningField": true,
|
||||||
@@ -2315,10 +2315,10 @@
|
|||||||
"temSEQ_AND_TICKET": -263,
|
"temSEQ_AND_TICKET": -263,
|
||||||
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
||||||
"temAMM_BAD_TOKENS": -261,
|
"temAMM_BAD_TOKENS": -261,
|
||||||
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
|
"temEQUAL_DOOR_ACCOUNTS": -260,
|
||||||
"temXCHAIN_BAD_PROOF": -259,
|
"temBAD_XCHAIN_PROOF": -259,
|
||||||
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
|
"temSIDECHAIN_BAD_ISSUES": -258,
|
||||||
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
|
"temSIDECHAIN_NONDOOR_OWNER": -257,
|
||||||
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
||||||
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
||||||
"temXCHAIN_TOO_MANY_ATTESTATIONS": -254,
|
"temXCHAIN_TOO_MANY_ATTESTATIONS": -254,
|
||||||
@@ -2359,8 +2359,7 @@
|
|||||||
"terNO_RIPPLE": -90,
|
"terNO_RIPPLE": -90,
|
||||||
"terQUEUED": -89,
|
"terQUEUED": -89,
|
||||||
"terPRE_TICKET": -88,
|
"terPRE_TICKET": -88,
|
||||||
"terNO_AMM": -87,
|
"terNO_HOOK": -87,
|
||||||
"terNO_HOOK": -86,
|
|
||||||
|
|
||||||
"tesSUCCESS": 0,
|
"tesSUCCESS": 0,
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
encodeAccountID,
|
encodeAccountID,
|
||||||
isValidXAddress,
|
isValidXAddress,
|
||||||
xAddressToClassicAddress,
|
xAddressToClassicAddress,
|
||||||
} from '@transia/ripple-address-codec'
|
} from 'ripple-address-codec'
|
||||||
import { Hash160 } from './hash-160'
|
import { Hash160 } from './hash-160'
|
||||||
import { Buffer } from 'buffer/'
|
import { Buffer } from 'buffer/'
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
XrplDefinitionsBase,
|
XrplDefinitionsBase,
|
||||||
} from '../enums'
|
} from '../enums'
|
||||||
import { SerializedType, JsonObject } from './serialized-type'
|
import { SerializedType, JsonObject } from './serialized-type'
|
||||||
import { xAddressToClassicAddress, isValidXAddress } from '@transia/ripple-address-codec'
|
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
||||||
import { BinaryParser } from '../serdes/binary-parser'
|
import { BinaryParser } from '../serdes/binary-parser'
|
||||||
import { BinarySerializer, BytesList } from '../serdes/binary-serializer'
|
import { BinarySerializer, BytesList } from '../serdes/binary-serializer'
|
||||||
import { Buffer } from 'buffer/'
|
import { Buffer } from 'buffer/'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const { coreTypes } = require('../src/types')
|
const { coreTypes } = require('../src/types')
|
||||||
const Decimal = require('decimal.js')
|
const Decimal = require('decimal.js')
|
||||||
|
|
||||||
const { encodeAccountID } = require('@transia/ripple-address-codec')
|
const { encodeAccountID } = require('ripple-address-codec')
|
||||||
const { binary } = require('../src/coretypes')
|
const { binary } = require('../src/coretypes')
|
||||||
const { Amount, Hash160 } = coreTypes
|
const { Amount, Hash160 } = coreTypes
|
||||||
const { makeParser, readJSON } = binary
|
const { makeParser, readJSON } = binary
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@transia/ripple-keypairs",
|
"name": "@transia/ripple-keypairs",
|
||||||
"version": "1.1.8-alpha.0",
|
"version": "1.1.7",
|
||||||
"description": "Cryptographic key pairs for the XRP Ledger",
|
"description": "Cryptographic key pairs for the XRP Ledger",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -b",
|
"build": "tsc -b",
|
||||||
@@ -17,19 +17,23 @@
|
|||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@transia/ripple-address-codec": "^4.2.8-alpha.0",
|
|
||||||
"bn.js": "^5.1.1",
|
"bn.js": "^5.1.1",
|
||||||
"brorand": "^1.0.5",
|
"brorand": "^1.0.5",
|
||||||
"elliptic": "^6.5.4",
|
"elliptic": "^6.5.4",
|
||||||
"hash.js": "^1.0.3"
|
"hash.js": "^1.0.3",
|
||||||
|
"ripple-address-codec": "^4.2.5"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
|
"url": "git@github.com:Transia-RnD/xrpl.js.git"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
|
},
|
||||||
|
"gitHead": "40d9c2b1a158ab480df7e8b1c7dc2ed3b88afc75",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import brorand = require('brorand')
|
|||||||
import * as hashjs from 'hash.js'
|
import * as hashjs from 'hash.js'
|
||||||
import * as elliptic from 'elliptic'
|
import * as elliptic from 'elliptic'
|
||||||
|
|
||||||
import * as addressCodec from '@transia/ripple-address-codec'
|
import * as addressCodec from 'ripple-address-codec'
|
||||||
import { derivePrivateKey, accountPublicFromPublicGenerator } from './secp256k1'
|
import { derivePrivateKey, accountPublicFromPublicGenerator } from './secp256k1'
|
||||||
import * as utils from './utils'
|
import * as utils from './utils'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
import * as api from '@transia/ripple-address-codec'
|
import * as api from 'ripple-address-codec'
|
||||||
|
|
||||||
function toHex(bytes) {
|
function toHex(bytes) {
|
||||||
return Buffer.from(bytes).toString('hex').toUpperCase()
|
return Buffer.from(bytes).toString('hex').toUpperCase()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
import * as api from '@transia/ripple-address-codec'
|
import * as api from 'ripple-address-codec'
|
||||||
|
|
||||||
function toHex(bytes: Buffer) {
|
function toHex(bytes: Buffer) {
|
||||||
return Buffer.from(bytes).toString('hex').toUpperCase()
|
return Buffer.from(bytes).toString('hex').toUpperCase()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@transia/xrpl",
|
"name": "@transia/xrpl",
|
||||||
"version": "2.7.3-alpha.0",
|
"version": "2.7.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
|
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -22,14 +22,14 @@
|
|||||||
"https-proxy-agent": false
|
"https-proxy-agent": false
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@transia/ripple-address-codec": "^4.2.8-alpha.0",
|
|
||||||
"@transia/ripple-binary-codec": "^1.4.6-alpha.0",
|
|
||||||
"@transia/ripple-keypairs": "^1.1.8-alpha.0",
|
|
||||||
"bignumber.js": "^9.0.0",
|
"bignumber.js": "^9.0.0",
|
||||||
"bip32": "^2.0.6",
|
"bip32": "^2.0.6",
|
||||||
"bip39": "^3.0.4",
|
"bip39": "^3.0.4",
|
||||||
"https-proxy-agent": "^5.0.0",
|
"https-proxy-agent": "^5.0.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
|
"ripple-address-codec": "^4.2.5",
|
||||||
|
"ripple-binary-codec": "^1.4.3",
|
||||||
|
"ripple-keypairs": "^1.1.5",
|
||||||
"ws": "^8.2.2"
|
"ws": "^8.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -75,10 +75,14 @@
|
|||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
|
"url": "git@github.com:Transia-RnD/xrpl.js.git"
|
||||||
},
|
},
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.13.0"
|
"node": ">=10.13.0"
|
||||||
|
},
|
||||||
|
"gitHead": "40d9c2b1a158ab480df7e8b1c7dc2ed3b88afc75",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { IncomingMessage } from 'http'
|
import { IncomingMessage } from 'http'
|
||||||
import { request as httpsRequest, RequestOptions } from 'https'
|
import { request as httpsRequest, RequestOptions } from 'https'
|
||||||
|
|
||||||
import { isValidClassicAddress } from '@transia/ripple-address-codec'
|
import { isValidClassicAddress } from 'ripple-address-codec'
|
||||||
|
|
||||||
import type { Client } from '../client'
|
import type { Client } from '../client'
|
||||||
import { RippledError, XRPLFaucetError } from '../errors'
|
import { RippledError, XRPLFaucetError } from '../errors'
|
||||||
|
|||||||
@@ -9,20 +9,20 @@ import {
|
|||||||
isValidXAddress,
|
isValidXAddress,
|
||||||
xAddressToClassicAddress,
|
xAddressToClassicAddress,
|
||||||
encodeSeed,
|
encodeSeed,
|
||||||
} from '@transia/ripple-address-codec'
|
} from 'ripple-address-codec'
|
||||||
import {
|
import {
|
||||||
decode,
|
decode,
|
||||||
encodeForSigning,
|
encodeForSigning,
|
||||||
encodeForMultisigning,
|
encodeForMultisigning,
|
||||||
encode,
|
encode,
|
||||||
} from '@transia/ripple-binary-codec'
|
} from 'ripple-binary-codec'
|
||||||
import {
|
import {
|
||||||
deriveAddress,
|
deriveAddress,
|
||||||
deriveKeypair,
|
deriveKeypair,
|
||||||
generateSeed,
|
generateSeed,
|
||||||
verify,
|
verify,
|
||||||
sign,
|
sign,
|
||||||
} from '@transia/ripple-keypairs'
|
} from 'ripple-keypairs'
|
||||||
|
|
||||||
import ECDSA from '../ECDSA'
|
import ECDSA from '../ECDSA'
|
||||||
import { ValidationError, XrplError } from '../errors'
|
import { ValidationError, XrplError } from '../errors'
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { BigNumber } from 'bignumber.js'
|
import { BigNumber } from 'bignumber.js'
|
||||||
import { flatMap } from 'lodash'
|
import { flatMap } from 'lodash'
|
||||||
import { decodeAccountID } from '@transia/ripple-address-codec'
|
import { decodeAccountID } from 'ripple-address-codec'
|
||||||
import {
|
import {
|
||||||
decode,
|
decode,
|
||||||
encode,
|
encode,
|
||||||
encodeForSigning,
|
encodeForSigning,
|
||||||
encodeForSigningClaim,
|
encodeForSigningClaim,
|
||||||
} from '@transia/ripple-binary-codec'
|
} from 'ripple-binary-codec'
|
||||||
import { sign as signWithKeypair, verify } from '@transia/ripple-keypairs'
|
import { sign as signWithKeypair, verify } from 'ripple-keypairs'
|
||||||
|
|
||||||
import { ValidationError } from '../errors'
|
import { ValidationError } from '../errors'
|
||||||
import { Signer } from '../models/common'
|
import { Signer } from '../models/common'
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ import {
|
|||||||
getXrpBalance,
|
getXrpBalance,
|
||||||
submit,
|
submit,
|
||||||
submitAndWait,
|
submitAndWait,
|
||||||
getNetworkID,
|
|
||||||
} from '../sugar'
|
} from '../sugar'
|
||||||
import fundWallet from '../Wallet/fundWallet'
|
import fundWallet from '../Wallet/fundWallet'
|
||||||
|
|
||||||
@@ -201,13 +200,6 @@ class Client extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
public readonly maxFeeXRP: string
|
public readonly maxFeeXRP: string
|
||||||
|
|
||||||
/**
|
|
||||||
* Network ID of the server this sdk is connected to
|
|
||||||
*
|
|
||||||
* @category Fee
|
|
||||||
*/
|
|
||||||
public networkID: number
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Client with a websocket connection to a rippled server.
|
* Creates a new Client with a websocket connection to a rippled server.
|
||||||
*
|
*
|
||||||
@@ -226,7 +218,6 @@ class Client extends EventEmitter {
|
|||||||
|
|
||||||
this.feeCushion = options.feeCushion ?? DEFAULT_FEE_CUSHION
|
this.feeCushion = options.feeCushion ?? DEFAULT_FEE_CUSHION
|
||||||
this.maxFeeXRP = options.maxFeeXRP ?? DEFAULT_MAX_FEE_XRP
|
this.maxFeeXRP = options.maxFeeXRP ?? DEFAULT_MAX_FEE_XRP
|
||||||
this.networkID = 1
|
|
||||||
|
|
||||||
this.connection = new Connection(server, options)
|
this.connection = new Connection(server, options)
|
||||||
|
|
||||||
@@ -643,11 +634,6 @@ class Client extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
public getLedgerIndex = getLedgerIndex
|
public getLedgerIndex = getLedgerIndex
|
||||||
|
|
||||||
/**
|
|
||||||
* @category Abstraction
|
|
||||||
*/
|
|
||||||
public getNetworkID = getNetworkID
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Faucet
|
* @category Faucet
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { decode } from '@transia/ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AccountTxResponse,
|
AccountTxResponse,
|
||||||
|
|||||||
@@ -97,15 +97,14 @@ export interface Hook {
|
|||||||
* The object that describes the hook in Hooks.
|
* The object that describes the hook in Hooks.
|
||||||
*/
|
*/
|
||||||
Hook: {
|
Hook: {
|
||||||
HookHash?: string
|
|
||||||
/**
|
/**
|
||||||
* The code that is executed when the hook is triggered.
|
* The code that is executed when the hook is triggered.
|
||||||
*/
|
*/
|
||||||
CreateCode?: string
|
CreateCode: string
|
||||||
/**
|
/**
|
||||||
* The flags that are set on the hook.
|
* The flags that are set on the hook.
|
||||||
*/
|
*/
|
||||||
Flags?: number
|
Flags: number
|
||||||
/**
|
/**
|
||||||
* The transactions that triggers the hook. Represented as a 256Hash
|
* The transactions that triggers the hook. Represented as a 256Hash
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -136,10 +136,6 @@ export interface ServerInfoResponse extends BaseResponse {
|
|||||||
* overall network's load factor.
|
* overall network's load factor.
|
||||||
*/
|
*/
|
||||||
load_factor?: number
|
load_factor?: number
|
||||||
/**
|
|
||||||
* The network id of the server.
|
|
||||||
*/
|
|
||||||
network_id?: number
|
|
||||||
/**
|
/**
|
||||||
* Current multiplier to the transaction cost based on
|
* Current multiplier to the transaction cost based on
|
||||||
* load to this server.
|
* load to this server.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateAccountSet */
|
/* eslint-disable complexity -- Necessary for validateAccountSet */
|
||||||
|
|
||||||
import { isValidClassicAddress } from '@transia/ripple-address-codec'
|
import { isValidClassicAddress } from 'ripple-address-codec'
|
||||||
|
|
||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
/* eslint-disable max-lines-per-function -- Necessary for validateBaseTransaction */
|
/* eslint-disable max-lines-per-function -- Necessary for validateBaseTransaction */
|
||||||
/* eslint-disable complexity -- Necessary for validateBaseTransaction */
|
/* eslint-disable complexity -- Necessary for validateBaseTransaction */
|
||||||
/* eslint-disable max-statements -- Necessary for validateBaseTransaction */
|
/* eslint-disable max-statements -- Necessary for validateBaseTransaction */
|
||||||
import { TRANSACTION_TYPES } from '@transia/ripple-binary-codec'
|
import { TRANSACTION_TYPES } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
import {
|
import { Amount, IssuedCurrencyAmount, Memo, Signer } from '../common'
|
||||||
Amount,
|
|
||||||
HookParameter,
|
|
||||||
IssuedCurrencyAmount,
|
|
||||||
Memo,
|
|
||||||
Signer,
|
|
||||||
} from '../common'
|
|
||||||
import { onlyHasFields } from '../utils'
|
import { onlyHasFields } from '../utils'
|
||||||
|
|
||||||
const MEMO_SIZE = 3
|
const MEMO_SIZE = 3
|
||||||
@@ -165,14 +159,8 @@ export interface BaseTransaction {
|
|||||||
* account it says it is from.
|
* account it says it is from.
|
||||||
*/
|
*/
|
||||||
TxnSignature?: string
|
TxnSignature?: string
|
||||||
/**
|
|
||||||
* The network id of the transaction.
|
|
||||||
*/
|
|
||||||
NetworkID?: number
|
NetworkID?: number
|
||||||
/**
|
|
||||||
* The hook parameters of the transaction.
|
|
||||||
*/
|
|
||||||
HookParameters?: HookParameter[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,9 +254,6 @@ export function validateBaseTransaction(common: Record<string, unknown>): void {
|
|||||||
) {
|
) {
|
||||||
throw new ValidationError('BaseTransaction: invalid TxnSignature')
|
throw new ValidationError('BaseTransaction: invalid TxnSignature')
|
||||||
}
|
}
|
||||||
if (common.NetworkID !== undefined && typeof common.NetworkID !== 'number') {
|
|
||||||
throw new ValidationError('BaseTransaction: invalid NetworkID')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export {
|
|||||||
export { PaymentChannelCreate } from './paymentChannelCreate'
|
export { PaymentChannelCreate } from './paymentChannelCreate'
|
||||||
export { PaymentChannelFund } from './paymentChannelFund'
|
export { PaymentChannelFund } from './paymentChannelFund'
|
||||||
export { SetRegularKey } from './setRegularKey'
|
export { SetRegularKey } from './setRegularKey'
|
||||||
export { SetHookFlagsInterface, SetHookFlags, SetHook } from './setHook'
|
export { SetHook } from './setHook'
|
||||||
export { SignerListSet } from './signerListSet'
|
export { SignerListSet } from './signerListSet'
|
||||||
export { TicketCreate } from './ticketCreate'
|
export { TicketCreate } from './ticketCreate'
|
||||||
export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
|
export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ export interface Invoke extends BaseTransaction {
|
|||||||
* If present, invokes the Hook on the Destination account.
|
* If present, invokes the Hook on the Destination account.
|
||||||
*/
|
*/
|
||||||
Destination?: string
|
Destination?: string
|
||||||
/**
|
|
||||||
* Hex value representing a VL Blob.
|
|
||||||
*/
|
|
||||||
Blob?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
import { Amount } from '../common'
|
import { Amount } from '../common'
|
||||||
|
|
||||||
export interface HookExecution {
|
|
||||||
HookExecution: {
|
|
||||||
HookAccount: string
|
|
||||||
HookEmitCount: number
|
|
||||||
HookExecutionIndex: number
|
|
||||||
HookHash: string
|
|
||||||
HookInstructionCount: string
|
|
||||||
HookResult: number
|
|
||||||
HookReturnCode: number
|
|
||||||
HookReturnString: string
|
|
||||||
HookStateChangeCount: number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreatedNode {
|
export interface CreatedNode {
|
||||||
CreatedNode: {
|
CreatedNode: {
|
||||||
LedgerEntryType: string
|
LedgerEntryType: string
|
||||||
@@ -74,7 +60,6 @@ export function isDeletedNode(node: Node): node is DeletedNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TransactionMetadata {
|
export interface TransactionMetadata {
|
||||||
HookExecutions: HookExecution[]
|
|
||||||
AffectedNodes: Node[]
|
AffectedNodes: Node[]
|
||||||
DeliveredAmount?: Amount
|
DeliveredAmount?: Amount
|
||||||
// "unavailable" possible for transactions before 2014-01-20
|
// "unavailable" possible for transactions before 2014-01-20
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Hook } from '../common'
|
import { Hook } from '../common'
|
||||||
|
|
||||||
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
/**
|
|
||||||
* Enum representing values for Set Hook Transaction Flags.
|
|
||||||
*
|
|
||||||
* @category Transaction Flags
|
|
||||||
*/
|
|
||||||
export enum SetHookFlags {
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
hsfOverride = 0x00000001,
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
hsfNSDelete = 0x00000010,
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
hsfCollect = 0x00000100,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SetHookFlagsInterface extends GlobalFlags {
|
|
||||||
hsfOverride?: boolean
|
|
||||||
hsfNSDelete?: boolean
|
|
||||||
hsfCollect?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -37,8 +14,6 @@ export interface SetHook extends BaseTransaction {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Hooks: Hook[]
|
Hooks: Hook[]
|
||||||
|
|
||||||
Flags?: number | SetHookFlagsInterface
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_HOOKS = 4
|
const MAX_HOOKS = 4
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { DepositPreauth, validateDepositPreauth } from './depositPreauth'
|
|||||||
import { EscrowCancel, validateEscrowCancel } from './escrowCancel'
|
import { EscrowCancel, validateEscrowCancel } from './escrowCancel'
|
||||||
import { EscrowCreate, validateEscrowCreate } from './escrowCreate'
|
import { EscrowCreate, validateEscrowCreate } from './escrowCreate'
|
||||||
import { EscrowFinish, validateEscrowFinish } from './escrowFinish'
|
import { EscrowFinish, validateEscrowFinish } from './escrowFinish'
|
||||||
import { Invoke, validateInvoke } from './invoke'
|
|
||||||
import { TransactionMetadata } from './metadata'
|
import { TransactionMetadata } from './metadata'
|
||||||
import {
|
import {
|
||||||
NFTokenAcceptOffer,
|
NFTokenAcceptOffer,
|
||||||
@@ -63,7 +62,6 @@ export type Transaction =
|
|||||||
| EscrowCancel
|
| EscrowCancel
|
||||||
| EscrowCreate
|
| EscrowCreate
|
||||||
| EscrowFinish
|
| EscrowFinish
|
||||||
| Invoke
|
|
||||||
| NFTokenAcceptOffer
|
| NFTokenAcceptOffer
|
||||||
| NFTokenBurn
|
| NFTokenBurn
|
||||||
| NFTokenCancelOffer
|
| NFTokenCancelOffer
|
||||||
@@ -144,10 +142,6 @@ export function validate(transaction: Record<string, unknown>): void {
|
|||||||
validateEscrowFinish(tx)
|
validateEscrowFinish(tx)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'Invoke':
|
|
||||||
validateInvoke(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'NFTokenAcceptOffer':
|
case 'NFTokenAcceptOffer':
|
||||||
validateNFTokenAcceptOffer(tx)
|
validateNFTokenAcceptOffer(tx)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
PaymentChannelClaimFlagsInterface,
|
PaymentChannelClaimFlagsInterface,
|
||||||
PaymentChannelClaimFlags,
|
PaymentChannelClaimFlags,
|
||||||
} from '../transactions/paymentChannelClaim'
|
} from '../transactions/paymentChannelClaim'
|
||||||
import { SetHookFlagsInterface, SetHookFlags } from '../transactions/setHook'
|
|
||||||
import type { Transaction } from '../transactions/transaction'
|
import type { Transaction } from '../transactions/transaction'
|
||||||
import { TrustSetFlagsInterface, TrustSetFlags } from '../transactions/trustSet'
|
import { TrustSetFlagsInterface, TrustSetFlags } from '../transactions/trustSet'
|
||||||
|
|
||||||
@@ -76,15 +75,6 @@ export function setTransactionFlagsToNumber(tx: Transaction): void {
|
|||||||
case 'TrustSet':
|
case 'TrustSet':
|
||||||
tx.Flags = convertTrustSetFlagsToNumber(tx.Flags)
|
tx.Flags = convertTrustSetFlagsToNumber(tx.Flags)
|
||||||
return
|
return
|
||||||
case 'SetHook':
|
|
||||||
tx.Flags = convertSetHookFlagsToNumber(tx.Flags)
|
|
||||||
tx.Hooks.forEach((h) => {
|
|
||||||
h.Hook.Flags = convertSetHookFlagsToNumber(
|
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- idk
|
|
||||||
h.Hook.Flags as SetHookFlagsInterface,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
return
|
|
||||||
default:
|
default:
|
||||||
tx.Flags = 0
|
tx.Flags = 0
|
||||||
}
|
}
|
||||||
@@ -118,10 +108,6 @@ function convertTrustSetFlagsToNumber(flags: TrustSetFlagsInterface): number {
|
|||||||
return reduceFlags(flags, TrustSetFlags)
|
return reduceFlags(flags, TrustSetFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertSetHookFlagsToNumber(flags: SetHookFlagsInterface): number {
|
|
||||||
return reduceFlags(flags, SetHookFlags)
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- added ValidationError check for flagEnum
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- added ValidationError check for flagEnum
|
||||||
function reduceFlags(flags: GlobalFlags, flagEnum: any): number {
|
function reduceFlags(flags: GlobalFlags, flagEnum: any): number {
|
||||||
return Object.keys(flags).reduce((resultFlags, flag) => {
|
return Object.keys(flags).reduce((resultFlags, flag) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { xAddressToClassicAddress, isValidXAddress } from '@transia/ripple-address-codec'
|
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
||||||
|
|
||||||
import type { Client } from '..'
|
import type { Client } from '..'
|
||||||
import { ValidationError, XrplError } from '../errors'
|
import { ValidationError, XrplError } from '../errors'
|
||||||
@@ -12,7 +12,6 @@ import { getFeeXrp } from './getFeeXrp'
|
|||||||
|
|
||||||
// Expire unconfirmed transactions after 20 ledger versions, approximately 1 minute, by default
|
// Expire unconfirmed transactions after 20 ledger versions, approximately 1 minute, by default
|
||||||
const LEDGER_OFFSET = 20
|
const LEDGER_OFFSET = 20
|
||||||
const RESTRICTED_NETWORKS = 1024
|
|
||||||
interface ClassicAccountAndTag {
|
interface ClassicAccountAndTag {
|
||||||
classicAccount: string
|
classicAccount: string
|
||||||
tag: number | false | undefined
|
tag: number | false | undefined
|
||||||
@@ -40,10 +39,8 @@ async function autofill<T extends Transaction>(
|
|||||||
setValidAddresses(tx)
|
setValidAddresses(tx)
|
||||||
|
|
||||||
setTransactionFlagsToNumber(tx)
|
setTransactionFlagsToNumber(tx)
|
||||||
|
|
||||||
const promises: Array<Promise<void>> = []
|
const promises: Array<Promise<void>> = []
|
||||||
if (this.networkID > RESTRICTED_NETWORKS && tx.NetworkID == null) {
|
|
||||||
tx.NetworkID = this.networkID
|
|
||||||
}
|
|
||||||
if (tx.Sequence == null) {
|
if (tx.Sequence == null) {
|
||||||
promises.push(setNextValidSequenceNumber(this, tx))
|
promises.push(setNextValidSequenceNumber(this, tx))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import type { Client } from '..'
|
|
||||||
// import { XrplError } from '../errors'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the network ID of the rippled server.
|
|
||||||
*
|
|
||||||
* @param this - The Client used to connect to the ledger.
|
|
||||||
* @returns The network id.
|
|
||||||
*/
|
|
||||||
export default async function getNetworkID(this: Client): Promise<number> {
|
|
||||||
const response = await this.request({
|
|
||||||
command: 'server_info',
|
|
||||||
})
|
|
||||||
return response.result.info.network_id ?? 1
|
|
||||||
}
|
|
||||||
@@ -7,8 +7,6 @@ export { default as getLedgerIndex } from './getLedgerIndex'
|
|||||||
export { default as getOrderbook } from './getOrderbook'
|
export { default as getOrderbook } from './getOrderbook'
|
||||||
export { getFeeXrp, getFeeEstimateXrp } from './getFeeXrp'
|
export { getFeeXrp, getFeeEstimateXrp } from './getFeeXrp'
|
||||||
|
|
||||||
export { default as getNetworkID } from './getNetworkID'
|
|
||||||
|
|
||||||
export * from './submit'
|
export * from './submit'
|
||||||
|
|
||||||
export * from './utils'
|
export * from './utils'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { decode, encode } from '@transia/ripple-binary-codec'
|
import { decode, encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import type { Client, SubmitRequest, SubmitResponse, Wallet } from '..'
|
import type { Client, SubmitRequest, SubmitResponse, Wallet } from '..'
|
||||||
import { ValidationError, XrplError } from '../errors'
|
import { ValidationError, XrplError } from '../errors'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { xAddressToClassicAddress, isValidXAddress } from '@transia/ripple-address-codec'
|
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If an address is an X-Address, converts it to a classic address.
|
* If an address is an X-Address, converts it to a classic address.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { classicAddressToXAddress } from '@transia/ripple-address-codec'
|
import { classicAddressToXAddress } from 'ripple-address-codec'
|
||||||
import { deriveKeypair, deriveAddress } from '@transia/ripple-keypairs'
|
import { deriveKeypair, deriveAddress } from 'ripple-keypairs'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Derive an X-Address from a public key and a destination tag.
|
* Derive an X-Address from a public key and a destination tag.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
bitwise operators for and-ing numbers with a mask and bit shifting. */
|
bitwise operators for and-ing numbers with a mask and bit shifting. */
|
||||||
|
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { decode, encode } from '@transia/ripple-binary-codec'
|
import { decode, encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { ValidationError, XrplError } from '../../errors'
|
import { ValidationError, XrplError } from '../../errors'
|
||||||
import type { Ledger } from '../../models/ledger'
|
import type { Ledger } from '../../models/ledger'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
bitwise operators for and-ing numbers with a mask and bit shifting. */
|
bitwise operators for and-ing numbers with a mask and bit shifting. */
|
||||||
|
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { decodeAccountID } from '@transia/ripple-address-codec'
|
import { decodeAccountID } from 'ripple-address-codec'
|
||||||
|
|
||||||
import hashLedger, {
|
import hashLedger, {
|
||||||
hashLedgerHeader,
|
hashLedgerHeader,
|
||||||
|
|||||||
@@ -4,11 +4,9 @@
|
|||||||
* This module contains the transaction types and the function to calculate the hook on
|
* This module contains the transaction types and the function to calculate the hook on
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
// eslint-disable-next-line @typescript-eslint/no-require-imports -- Required
|
||||||
TRANSACTION_TYPES,
|
|
||||||
TRANSACTION_TYPE_MAP,
|
|
||||||
} from '@transia/ripple-binary-codec'
|
|
||||||
import createHash = require('create-hash')
|
import createHash = require('create-hash')
|
||||||
|
import { TRANSACTION_TYPES, TRANSACTION_TYPE_MAP } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { XrplError } from '../errors'
|
import { XrplError } from '../errors'
|
||||||
import { HookParameter } from '../models/common'
|
import { HookParameter } from '../models/common'
|
||||||
@@ -44,7 +42,7 @@ export function calculateHookOn(arr: Array<keyof TTS>): string {
|
|||||||
`invalid transaction type '${String(nth)}' in HookOn array`,
|
`invalid transaction type '${String(nth)}' in HookOn array`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Required
|
||||||
const tts: Record<string, number> = TRANSACTION_TYPE_MAP
|
const tts: Record<string, number> = TRANSACTION_TYPE_MAP
|
||||||
let value = BigInt(hash)
|
let value = BigInt(hash)
|
||||||
// eslint-disable-next-line no-bitwise -- Required
|
// eslint-disable-next-line no-bitwise -- Required
|
||||||
@@ -86,14 +84,6 @@ export async function hexNamespace(namespace: string): Promise<string> {
|
|||||||
return (await sha256(namespace)).toUpperCase()
|
return (await sha256(namespace)).toUpperCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
function isHex(value: string): boolean {
|
|
||||||
return /^[0-9A-F]+$/iu.test(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function hexValue(value: string): string {
|
|
||||||
return Buffer.from(value, 'utf8').toString('hex').toUpperCase()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the hex of the hook parameters
|
* Calculate the hex of the hook parameters
|
||||||
*
|
*
|
||||||
@@ -103,21 +93,20 @@ function hexValue(value: string): string {
|
|||||||
export function hexHookParameters(data: HookParameter[]): HookParameter[] {
|
export function hexHookParameters(data: HookParameter[]): HookParameter[] {
|
||||||
const hookParameters: HookParameter[] = []
|
const hookParameters: HookParameter[] = []
|
||||||
for (const parameter of data) {
|
for (const parameter of data) {
|
||||||
let hookPName = parameter.HookParameter.HookParameterName
|
|
||||||
let hookPValue = parameter.HookParameter.HookParameterValue
|
|
||||||
|
|
||||||
if (!isHex(hookPName)) {
|
|
||||||
hookPName = hexValue(hookPName)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isHex(hookPValue)) {
|
|
||||||
hookPValue = hexValue(hookPValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
hookParameters.push({
|
hookParameters.push({
|
||||||
HookParameter: {
|
HookParameter: {
|
||||||
HookParameterName: hookPName,
|
HookParameterName: Buffer.from(
|
||||||
HookParameterValue: hookPValue,
|
parameter.HookParameter.HookParameterName,
|
||||||
|
'utf8',
|
||||||
|
)
|
||||||
|
.toString('hex')
|
||||||
|
.toUpperCase(),
|
||||||
|
HookParameterValue: Buffer.from(
|
||||||
|
parameter.HookParameter.HookParameterValue,
|
||||||
|
'utf8',
|
||||||
|
)
|
||||||
|
.toString('hex')
|
||||||
|
.toUpperCase(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import {
|
|||||||
isValidClassicAddress,
|
isValidClassicAddress,
|
||||||
isValidXAddress,
|
isValidXAddress,
|
||||||
xAddressToClassicAddress,
|
xAddressToClassicAddress,
|
||||||
} from '@transia/ripple-address-codec'
|
} from 'ripple-address-codec'
|
||||||
import * as rbc from '@transia/ripple-binary-codec'
|
import * as rbc from 'ripple-binary-codec'
|
||||||
import { verify as verifyKeypairSignature } from '@transia/ripple-keypairs'
|
import { verify as verifyKeypairSignature } from 'ripple-keypairs'
|
||||||
|
|
||||||
import { LedgerEntry } from '../models/ledger'
|
import { LedgerEntry } from '../models/ledger'
|
||||||
import { Response } from '../models/methods'
|
import { Response } from '../models/methods'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-magic-numbers -- Doing hex string parsing. */
|
/* eslint-disable @typescript-eslint/no-magic-numbers -- Doing hex string parsing. */
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { encodeAccountID } from '@transia/ripple-address-codec'
|
import { encodeAccountID } from 'ripple-address-codec'
|
||||||
|
|
||||||
import { XrplError } from '../errors'
|
import { XrplError } from '../errors'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { encodeForSigningClaim } from '@transia/ripple-binary-codec'
|
import { encodeForSigningClaim } from 'ripple-binary-codec'
|
||||||
import { sign } from '@transia/ripple-keypairs'
|
import { sign } from 'ripple-keypairs'
|
||||||
|
|
||||||
import { xrpToDrops } from './xrpConversion'
|
import { xrpToDrops } from './xrpConversion'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { encodeForSigningClaim } from '@transia/ripple-binary-codec'
|
import { encodeForSigningClaim } from 'ripple-binary-codec'
|
||||||
import { verify } from '@transia/ripple-keypairs'
|
import { verify } from 'ripple-keypairs'
|
||||||
|
|
||||||
import { xrpToDrops } from './xrpConversion'
|
import { xrpToDrops } from './xrpConversion'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { decode } from '@transia/ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AccountSet,
|
AccountSet,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { decode } from '@transia/ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AccountSet,
|
AccountSet,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import omit from 'lodash/omit'
|
import omit from 'lodash/omit'
|
||||||
import throttle from 'lodash/throttle'
|
import throttle from 'lodash/throttle'
|
||||||
import { decode } from '@transia/ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Client,
|
Client,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import fs from 'fs'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { encode } from '@transia/ripple-binary-codec'
|
import { encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { OfferCreate, Transaction, ValidationError } from '../../src'
|
import { OfferCreate, Transaction, ValidationError } from '../../src'
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { decode } from '@transia/ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { NFTokenMint, Payment, Transaction } from '../../src'
|
import { NFTokenMint, Payment, Transaction } from '../../src'
|
||||||
import ECDSA from '../../src/ECDSA'
|
import ECDSA from '../../src/ECDSA'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { decode, encode } from '@transia/ripple-binary-codec'
|
import { decode, encode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { Transaction, ValidationError } from '../../src'
|
import { Transaction, ValidationError } from '../../src'
|
||||||
import Wallet from '../../src/Wallet'
|
import Wallet from '../../src/Wallet'
|
||||||
|
|||||||
Reference in New Issue
Block a user