Compare commits

..

22 Commits

Author SHA1 Message Date
Denis Angell
b054430406 Publish
- @transia/ripple-address-codec@4.2.7
 - @transia/ripple-binary-codec@1.4.5
 - @transia/ripple-keypairs@1.1.7
 - @transia/xrpl@2.7.2
2023-03-28 18:16:46 +00:00
Denis Angell
c29f512345 update readme links 2023-03-28 18:15:31 +00:00
Denis Angell
d86cd8d813 add public access 2023-03-28 17:51:21 +00:00
Denis Angell
40d9c2b1a1 update git head 2023-03-28 17:45:11 +00:00
Denis Angell
6c25d08019 Publish
- @transia/ripple-address-codec@4.2.6
 - @transia/ripple-binary-codec@1.4.4
 - @transia/ripple-keypairs@1.1.6
 - @transia/xrpl@2.7.1
2023-03-28 17:40:48 +00:00
Denis Angell
6f72189c13 update repo name 2023-03-28 17:39:37 +00:00
Denis Angell
5429930c0d update tests 2023-03-27 21:52:49 +00:00
Denis Angell
f82872fe9f add network id (req for sethook) 2023-03-27 21:48:58 +00:00
Denis Angell
8d16592abb add uritoken (req for hook on calc) 2023-03-27 21:48:43 +00:00
Denis Angell
f80d6e1747 update hook on calcaulator 2023-03-27 21:47:36 +00:00
Denis Angell
df1897be10 fixup unit test 2023-03-27 19:04:31 +00:00
Denis Angell
bcbba483c5 fix error 2023-03-27 18:58:49 +00:00
Denis Angell
0560a5867f lint 2023-03-27 18:57:11 +00:00
Denis Angell
f19466cabe export transaction type map from definitions 2023-03-27 18:31:22 +00:00
Denis Angell
f6a90a31c4 remove network id 2023-03-27 18:30:52 +00:00
Denis Angell
818d12d68c update definitions 2023-03-27 17:45:08 +00:00
Denis Angell
277288f1e9 remove sugar export 2023-03-27 17:17:56 +00:00
Denis Angell
ee59c64b65 ledger entry objects 2023-03-27 17:14:43 +00:00
Denis Angell
d36349e410 add invoke tx 2023-03-27 17:14:33 +00:00
Denis Angell
2e38cf54a8 update hookon transaction types 2023-03-27 17:14:15 +00:00
Denis Angell
3a2a0918f8 update hook
update hook

add test and validation

add estimate fee func

fix estimated fee error

add hook utils
2023-03-27 17:10:35 +00:00
Denis Angell
6d6b5a5863 feature Hooks
update definitions

add network id to base transaction

add set hook

update required

update definitions

make network id required
2023-03-27 17:10:26 +00:00
21 changed files with 43 additions and 727 deletions

View File

@@ -39,7 +39,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# 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).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -64,4 +64,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v1

214
package-lock.json generated
View File

@@ -17141,7 +17141,7 @@
},
"packages/ripple-address-codec": {
"name": "@transia/ripple-address-codec",
"version": "4.2.6-alpha.0",
"version": "4.2.7",
"license": "ISC",
"dependencies": {
"base-x": "^3.0.9",
@@ -17153,7 +17153,7 @@
},
"packages/ripple-binary-codec": {
"name": "@transia/ripple-binary-codec",
"version": "1.4.4-alpha.0",
"version": "1.4.5",
"license": "ISC",
"dependencies": {
"assert": "^2.0.0",
@@ -17175,21 +17175,9 @@
"ieee754": "^1.1.4"
}
},
"packages/ripple-binary-codec/node_modules/ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"dependencies": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
},
"engines": {
"node": ">= 10"
}
},
"packages/ripple-keypairs": {
"name": "@transia/ripple-keypairs",
"version": "1.1.6-alpha.0",
"version": "1.1.7",
"license": "ISC",
"dependencies": {
"bn.js": "^5.1.1",
@@ -17202,21 +17190,9 @@
"node": ">= 10"
}
},
"packages/ripple-keypairs/node_modules/ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"dependencies": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
},
"engines": {
"node": ">= 10"
}
},
"packages/xrpl": {
"name": "@transia/xrpl",
"version": "2.7.1-alpha.1",
"version": "2.7.2",
"license": "ISC",
"dependencies": {
"bignumber.js": "^9.0.0",
@@ -17247,58 +17223,6 @@
"engines": {
"node": ">=10.13.0"
}
},
"packages/xrpl/node_modules/buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"dependencies": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"packages/xrpl/node_modules/ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"dependencies": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
},
"engines": {
"node": ">= 10"
}
},
"packages/xrpl/node_modules/ripple-binary-codec": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-1.4.3.tgz",
"integrity": "sha512-P4ALjAJWBJpRApTQO+dJCrHE6mZxm7ypZot9OS0a3RCKOWTReNw0pDWfdhCGh1qXh71TeQnAk4CHdMLwR/76oQ==",
"dependencies": {
"assert": "^2.0.0",
"big-integer": "^1.6.48",
"buffer": "5.6.0",
"create-hash": "^1.2.0",
"decimal.js": "^10.2.0",
"ripple-address-codec": "^4.2.5"
},
"engines": {
"node": ">= 10"
}
},
"packages/xrpl/node_modules/ripple-keypairs": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-1.1.5.tgz",
"integrity": "sha512-wLJXIBsMVazn2Yp/7oP4PvgA4Gd1HtuZLftdEJFNOLgraf82phqa2AnNK3t9f3XeQnApW1jAe/FcFFOY6QUn5w==",
"dependencies": {
"bn.js": "^5.1.1",
"brorand": "^1.0.5",
"elliptic": "^6.5.4",
"hash.js": "^1.0.3",
"ripple-address-codec": "^4.2.5"
},
"engines": {
"node": ">= 10"
}
}
},
"dependencies": {
@@ -19470,15 +19394,6 @@
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"requires": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
}
}
}
},
@@ -19490,17 +19405,6 @@
"elliptic": "^6.5.4",
"hash.js": "^1.0.3",
"ripple-address-codec": "^4.2.5"
},
"dependencies": {
"ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"requires": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
}
}
}
},
"@transia/xrpl": {
@@ -19528,51 +19432,6 @@
"ripple-keypairs": "^1.1.5",
"typedoc": "^0.23.24",
"ws": "^8.2.2"
},
"dependencies": {
"buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"requires": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
}
},
"ripple-binary-codec": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-1.4.3.tgz",
"integrity": "sha512-P4ALjAJWBJpRApTQO+dJCrHE6mZxm7ypZot9OS0a3RCKOWTReNw0pDWfdhCGh1qXh71TeQnAk4CHdMLwR/76oQ==",
"requires": {
"assert": "^2.0.0",
"big-integer": "^1.6.48",
"buffer": "5.6.0",
"create-hash": "^1.2.0",
"decimal.js": "^10.2.0",
"ripple-address-codec": "^4.2.5"
}
},
"ripple-keypairs": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-1.1.5.tgz",
"integrity": "sha512-wLJXIBsMVazn2Yp/7oP4PvgA4Gd1HtuZLftdEJFNOLgraf82phqa2AnNK3t9f3XeQnApW1jAe/FcFFOY6QUn5w==",
"requires": {
"bn.js": "^5.1.1",
"brorand": "^1.0.5",
"elliptic": "^6.5.4",
"hash.js": "^1.0.3",
"ripple-address-codec": "^4.2.5"
}
}
}
},
"@tsconfig/node10": {
@@ -28906,15 +28765,6 @@
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"requires": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
}
}
}
},
@@ -28926,17 +28776,6 @@
"elliptic": "^6.5.4",
"hash.js": "^1.0.3",
"ripple-address-codec": "^4.2.5"
},
"dependencies": {
"ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"requires": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
}
}
}
},
"run-async": {
@@ -30850,51 +30689,6 @@
"ripple-keypairs": "^1.1.5",
"typedoc": "^0.23.24",
"ws": "^8.2.2"
},
"dependencies": {
"buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"ripple-address-codec": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.2.5.tgz",
"integrity": "sha512-SZ96zZH+0REeyEcYVFl0vqcsGRXiFXS2RUgHupHhtVkOEk6men53vngVjJwBrSnY+oa6Cri15q1zSni3DEoxNw==",
"requires": {
"base-x": "^3.0.9",
"create-hash": "^1.1.2"
}
},
"ripple-binary-codec": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-1.4.3.tgz",
"integrity": "sha512-P4ALjAJWBJpRApTQO+dJCrHE6mZxm7ypZot9OS0a3RCKOWTReNw0pDWfdhCGh1qXh71TeQnAk4CHdMLwR/76oQ==",
"requires": {
"assert": "^2.0.0",
"big-integer": "^1.6.48",
"buffer": "5.6.0",
"create-hash": "^1.2.0",
"decimal.js": "^10.2.0",
"ripple-address-codec": "^4.2.5"
}
},
"ripple-keypairs": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-1.1.5.tgz",
"integrity": "sha512-wLJXIBsMVazn2Yp/7oP4PvgA4Gd1HtuZLftdEJFNOLgraf82phqa2AnNK3t9f3XeQnApW1jAe/FcFFOY6QUn5w==",
"requires": {
"bn.js": "^5.1.1",
"brorand": "^1.0.5",
"elliptic": "^6.5.4",
"hash.js": "^1.0.3",
"ripple-address-codec": "^4.2.5"
}
}
}
},
"xtend": {

View File

@@ -1,12 +1,12 @@
{
"name": "ripple-address-codec",
"version": "4.2.6-alpha.0",
"version": "4.2.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ripple-address-codec",
"version": "4.2.6-alpha.0",
"version": "4.2.7",
"license": "ISC",
"dependencies": {
"base-x": "^3.0.9",

View File

@@ -1,9 +1,6 @@
{
"name": "@transia/ripple-address-codec",
"publishConfig": {
"access": "public"
},
"version": "4.2.6-alpha.0",
"version": "4.2.7",
"description": "encodes/decodes base58 encoded XRP Ledger identifiers",
"files": [
"dist/*",
@@ -18,7 +15,7 @@
},
"repository": {
"type": "git",
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
"url": "git@github.com:Transia-RnD/xrpl.js.git"
},
"prepublish": "tsc -b",
"prepublishOnly": "tslint -b ./ && jest",
@@ -31,5 +28,9 @@
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 10"
},
"gitHead": "40d9c2b1a158ab480df7e8b1c7dc2ed3b88afc75",
"publishConfig": {
"access": "public"
}
}

View File

@@ -1,9 +1,6 @@
{
"name": "@transia/ripple-binary-codec",
"publishConfig": {
"access": "public"
},
"version": "1.4.4-alpha.0",
"version": "1.4.5",
"description": "XRP Ledger binary codec",
"files": [
"dist/*",
@@ -31,16 +28,20 @@
},
"repository": {
"type": "git",
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
"url": "git@github.com:Transia-RnD/xrpl.js.git"
},
"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",
"readmeFilename": "README.md",
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 10"
},
"gitHead": "6c25d08019d06534525a4a2bf41bf0e135a79849",
"publishConfig": {
"access": "public"
}
}

View File

@@ -779,7 +779,7 @@
[
"LockCount",
{
"nth": 49,
"nth": 47,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
@@ -2315,10 +2315,10 @@
"temSEQ_AND_TICKET": -263,
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
"temAMM_BAD_TOKENS": -261,
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
"temXCHAIN_BAD_PROOF": -259,
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
"temEQUAL_DOOR_ACCOUNTS": -260,
"temBAD_XCHAIN_PROOF": -259,
"temSIDECHAIN_BAD_ISSUES": -258,
"temSIDECHAIN_NONDOOR_OWNER": -257,
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
"temXCHAIN_TOO_MANY_ATTESTATIONS": -254,
@@ -2359,8 +2359,7 @@
"terNO_RIPPLE": -90,
"terQUEUED": -89,
"terPRE_TICKET": -88,
"terNO_AMM": -87,
"terNO_HOOK": -86,
"terNO_HOOK": -87,
"tesSUCCESS": 0,

View File

@@ -1,9 +1,6 @@
{
"name": "@transia/ripple-keypairs",
"publishConfig": {
"access": "public"
},
"version": "1.1.6-alpha.0",
"version": "1.1.7",
"description": "Cryptographic key pairs for the XRP Ledger",
"scripts": {
"build": "tsc -b",
@@ -28,11 +25,15 @@
},
"repository": {
"type": "git",
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
"url": "git@github.com:Transia-RnD/xrpl.js.git"
},
"license": "ISC",
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 10"
},
"gitHead": "40d9c2b1a158ab480df7e8b1c7dc2ed3b88afc75",
"publishConfig": {
"access": "public"
}
}

View File

@@ -1,9 +1,6 @@
{
"name": "@transia/xrpl",
"publishConfig": {
"access": "public"
},
"version": "2.7.1-alpha.1",
"version": "2.7.2",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
@@ -78,10 +75,14 @@
"prettier": "@xrplf/prettier-config",
"repository": {
"type": "git",
"url": "git@github.com/Transia-RnD/xrpl.js/tree/beta"
"url": "git@github.com:Transia-RnD/xrpl.js.git"
},
"readmeFilename": "README.md",
"engines": {
"node": ">=10.13.0"
},
"gitHead": "40d9c2b1a158ab480df7e8b1c7dc2ed3b88afc75",
"publishConfig": {
"access": "public"
}
}

View File

@@ -101,7 +101,6 @@ import {
getXrpBalance,
submit,
submitAndWait,
getNetworkID,
} from '../sugar'
import fundWallet from '../Wallet/fundWallet'
@@ -201,13 +200,6 @@ class Client extends EventEmitter {
*/
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.
*
@@ -226,7 +218,6 @@ class Client extends EventEmitter {
this.feeCushion = options.feeCushion ?? DEFAULT_FEE_CUSHION
this.maxFeeXRP = options.maxFeeXRP ?? DEFAULT_MAX_FEE_XRP
this.networkID = 1
this.connection = new Connection(server, options)
@@ -643,11 +634,6 @@ class Client extends EventEmitter {
*/
public getLedgerIndex = getLedgerIndex
/**
* @category Abstraction
*/
public getNetworkID = getNetworkID
/**
* @category Faucet
*/

View File

@@ -136,10 +136,6 @@ export interface ServerInfoResponse extends BaseResponse {
* overall network's load factor.
*/
load_factor?: number
/**
* The network id of the server.
*/
network_id?: number
/**
* Current multiplier to the transaction cost based on
* load to this server.

View File

@@ -159,9 +159,7 @@ export interface BaseTransaction {
* account it says it is from.
*/
TxnSignature?: string
/**
* The network id of the transaction.
*/
NetworkID?: number
}
@@ -256,9 +254,6 @@ export function validateBaseTransaction(common: Record<string, unknown>): void {
) {
throw new ValidationError('BaseTransaction: invalid TxnSignature')
}
if (common.NetworkID !== undefined && typeof common.NetworkID !== 'number') {
throw new ValidationError('BaseTransaction: invalid NetworkID')
}
}
/**

View File

@@ -47,12 +47,3 @@ export { SetHook } from './setHook'
export { SignerListSet } from './signerListSet'
export { TicketCreate } from './ticketCreate'
export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
export {
URITokenMintFlagsInterface,
URITokenMintFlags,
URITokenMint,
} from './uriTokenMint'
export { URITokenBurn } from './uriTokenBurn'
export { URITokenCreateSellOffer } from './uriTokenCreateSellOffer'
export { URITokenBuy } from './uriTokenBuy'
export { URITokenCancelSellOffer } from './uriTokenCancelSellOffer'

View File

@@ -48,17 +48,6 @@ import { SetRegularKey, validateSetRegularKey } from './setRegularKey'
import { SignerListSet, validateSignerListSet } from './signerListSet'
import { TicketCreate, validateTicketCreate } from './ticketCreate'
import { TrustSet, validateTrustSet } from './trustSet'
import { URITokenBurn, validateURITokenBurn } from './uriTokenBurn'
import { URITokenBuy, validateURITokenBuy } from './uriTokenBuy'
import {
URITokenCancelSellOffer,
validateURITokenCancelSellOffer,
} from './uriTokenCancelSellOffer'
import {
URITokenCreateSellOffer,
validateURITokenCreateSellOffer,
} from './uriTokenCreateSellOffer'
import { URITokenMint, validateURITokenMint } from './uriTokenMint'
/**
* @category Transaction Models
@@ -89,11 +78,6 @@ export type Transaction =
| SignerListSet
| TicketCreate
| TrustSet
| URITokenBurn
| URITokenBuy
| URITokenCancelSellOffer
| URITokenMint
| URITokenCreateSellOffer
/**
* @category Transaction Models
@@ -222,26 +206,6 @@ export function validate(transaction: Record<string, unknown>): void {
validateTrustSet(tx)
break
case 'URITokenMint':
validateURITokenMint(tx)
break
case 'URITokenBurn':
validateURITokenBurn(tx)
break
case 'URITokenCreateSellOffer':
validateURITokenCreateSellOffer(tx)
break
case 'URITokenBuy':
validateURITokenBuy(tx)
break
case 'URITokenCancelSellOffer':
validateURITokenCancelSellOffer(tx)
break
default:
throw new ValidationError(
`Invalid field TransactionType: ${tx.TransactionType}`,

View File

@@ -1,60 +0,0 @@
import { ValidationError } from '../../errors'
import { BaseTransaction, validateBaseTransaction } from './common'
/**
* Map of flags to boolean values representing {@link URITokenBurn} transaction
* flags.
*
* @category Transaction Flags
*
* @example
* ```typescript
* const tx: URITokenBurn = {
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* TransactionType: 'URITokenBurn',
* }
*
* // Autofill the tx to see how flags actually look compared to the interface usage.
* const autofilledTx = await client.autofill(tx)
* console.log(autofilledTx)
* // {
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* // TransactionType: 'URITokenBurn',
* // Sequence: 21970384,
* // Fee: '12',
* // LastLedgerSequence: 21970404
* // }
* ```
*/
/**
* An URITokenBurn transaction is effectively a limit order . It defines an
* intent to exchange currencies, and creates an Offer object if not completely.
* Fulfilled when placed. Offers can be partially fulfilled.
*
* @category Transaction Models
*/
export interface URITokenBurn extends BaseTransaction {
TransactionType: 'URITokenBurn'
/**
* Identifies the URIToken object to be removed by the transaction.
*/
URITokenID: string
}
/**
* Verify the form and type of an URITokenBurn at runtime.
*
* @param tx - An URITokenBurn Transaction.
* @throws When the URITokenBurn is Malformed.
*/
export function validateURITokenBurn(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.URITokenID == null) {
throw new ValidationError('NFTokenBurn: missing field URITokenID')
}
}

View File

@@ -1,83 +0,0 @@
import { ValidationError } from '../../errors'
import { Amount } from '../common'
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
/**
* Map of flags to boolean values representing {@link URITokenBuy} transaction
* flags.
*
* @category Transaction Flags
*
* @example
* ```typescript
* const tx: URITokenBuy = {
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* Amount: '1000000',
* TransactionType: 'URITokenBuy',
* }
*
* // Autofill the tx to see how flags actually look compared to the interface usage.
* const autofilledTx = await client.autofill(tx)
* console.log(autofilledTx)
* // {
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* // Amount: '1000000',
* // TransactionType: 'URITokenBuy',
* // Sequence: 21970384,
* // Fee: '12',
* // LastLedgerSequence: 21970404
* // }
* ```
*/
/**
* An URITokenBuy transaction is effectively a limit order . It defines an
* intent to exchange currencies, and creates an Offer object if not completely.
* Fulfilled when placed. Offers can be partially fulfilled.
*
* @category Transaction Models
*/
export interface URITokenBuy extends BaseTransaction {
TransactionType: 'URITokenBuy'
/**
* Identifies the URITokenID of the NFToken object that the
* offer references.
*/
URITokenID: string
/**
* Indicates the amount expected or offered for the Token.
*
* The amount must be non-zero, except when this is a sell
* offer and the asset is XRP. This would indicate that the current
* owner of the token is giving it away free, either to anyone at all,
* or to the account identified by the Destination field.
*/
Amount: Amount
}
/**
* Verify the form and type of an URITokenBuy at runtime.
*
* @param tx - An URITokenBuy Transaction.
* @throws When the URITokenBuy is Malformed.
*/
export function validateURITokenBuy(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.Account === tx.Destination) {
throw new ValidationError(
'URITokenBuy: Destination and Account must not be equal',
)
}
if (tx.URITokenID == null) {
throw new ValidationError('URITokenBuy: missing field URITokenID')
}
if (!isAmount(tx.Amount)) {
throw new ValidationError('URITokenBuy: invalid Amount')
}
}

View File

@@ -1,65 +0,0 @@
import { ValidationError } from '../../errors'
import { BaseTransaction, validateBaseTransaction } from './common'
/**
* Map of flags to boolean values representing {@link URITokenCancelSellOffer} transaction
* flags.
*
* @category Transaction Flags
*
* @example
* ```typescript
* const tx: URITokenCancelSellOffer = {
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* TransactionType: 'URITokenCancelSellOffer',
* }
*
* // Autofill the tx to see how flags actually look compared to the interface usage.
* const autofilledTx = await client.autofill(tx)
* console.log(autofilledTx)
* // {
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* // TransactionType: 'URITokenCancelSellOffer',
* // Sequence: 21970384,
* // Fee: '12',
* // LastLedgerSequence: 21970404
* // }
* ```
*/
/**
* An URITokenCancelSellOffer transaction is effectively a limit order . It defines an
* intent to exchange currencies, and creates an Offer object if not completely.
* Fulfilled when placed. Offers can be partially fulfilled.
*
* @category Transaction Models
*/
export interface URITokenCancelSellOffer extends BaseTransaction {
TransactionType: 'URITokenCancelSellOffer'
/**
* Identifies the URITokenID of the NFToken object that the
* offer references.
*/
URITokenID: string
}
/**
* Verify the form and type of an URITokenCancelSellOffer at runtime.
*
* @param tx - An URITokenCancelSellOffer Transaction.
* @throws When the URITokenCancelSellOffer is Malformed.
*/
export function validateURITokenCancelSellOffer(
tx: Record<string, unknown>,
): void {
validateBaseTransaction(tx)
if (tx.URITokenID == null) {
throw new ValidationError(
'URITokenCancelSellOffer: missing field URITokenID',
)
}
}

View File

@@ -1,93 +0,0 @@
import { ValidationError } from '../../errors'
import { Amount } from '../common'
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
/**
* Map of flags to boolean values representing {@link URITokenCreateSellOffer} transaction
* flags.
*
* @category Transaction Flags
*
* @example
* ```typescript
* const tx: URITokenCreateSellOffer = {
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* Amount: '1000000',
* TransactionType: 'URITokenCreateSellOffer',
* }
*
* // Autofill the tx to see how flags actually look compared to the interface usage.
* const autofilledTx = await client.autofill(tx)
* console.log(autofilledTx)
* // {
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
* // Amount: '1000000',
* // TransactionType: 'URITokenCreateSellOffer',
* // Sequence: 21970384,
* // Fee: '12',
* // LastLedgerSequence: 21970404
* // }
* ```
*/
/**
* An URITokenCreateSellOffer transaction is effectively a limit order . It defines an
* intent to exchange currencies, and creates an Offer object if not completely.
* Fulfilled when placed. Offers can be partially fulfilled.
*
* @category Transaction Models
*/
export interface URITokenCreateSellOffer extends BaseTransaction {
TransactionType: 'URITokenCreateSellOffer'
/**
* Identifies the URITokenID of the NFToken object that the
* offer references.
*/
URITokenID: string
/**
* Indicates the amount expected or offered for the Token.
*
* The amount must be non-zero, except when this is a sell
* offer and the asset is XRP. This would indicate that the current
* owner of the token is giving it away free, either to anyone at all,
* or to the account identified by the Destination field.
*/
Amount: Amount
/**
* If present, indicates that this offer may only be
* accepted by the specified account. Attempts by other
* accounts to accept this offer MUST fail.
*/
Destination?: string
}
/**
* Verify the form and type of an URITokenCreateSellOffer at runtime.
*
* @param tx - An URITokenCreateSellOffer Transaction.
* @throws When the URITokenCreateSellOffer is Malformed.
*/
export function validateURITokenCreateSellOffer(
tx: Record<string, unknown>,
): void {
validateBaseTransaction(tx)
if (tx.Account === tx.Destination) {
throw new ValidationError(
'URITokenCreateSellOffer: Destination and Account must not be equal',
)
}
if (tx.URITokenID == null) {
throw new ValidationError(
'URITokenCreateSellOffer: missing field URITokenID',
)
}
if (!isAmount(tx.Amount)) {
throw new ValidationError('URITokenCreateSellOffer: invalid Amount')
}
}

View File

@@ -1,92 +0,0 @@
import { ValidationError } from '../../errors'
import { isHex } from '../utils'
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
/**
* Transaction Flags for an URITokenMint Transaction.
*
* @category Transaction Flags
*/
export enum URITokenMintFlags {
/**
* If set, indicates that the minted token may be burned by the issuer even
* if the issuer does not currently hold the token. The current holder of
* the token may always burn it.
*/
tfBurnable = 0x00000001,
}
/**
* Map of flags to boolean values representing {@link URITokenMint} transaction
* flags.
*
* @category Transaction Flags
*
* @example
* ```typescript
* const tx: URITokenMint = {
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* URI: '697066733A2F2F434944',
* TransactionType: 'URITokenMint',
* Flags: {
* tfBurnable: true,
* },
* }
*
* // Autofill the tx to see how flags actually look compared to the interface usage.
* const autofilledTx = await client.autofill(tx)
* console.log(autofilledTx)
* // {
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
* // URI: '697066733A2F2F434944',
* // TransactionType: 'URITokenMint',
* // Flags: 0,
* // Sequence: 21970384,
* // Fee: '12',
* // LastLedgerSequence: 21970404
* // }
* ```
*/
export interface URITokenMintFlagsInterface extends GlobalFlags {
tfBurnable?: boolean
}
/**
* An URITokenMint transaction is effectively a limit order . It defines an
* intent to exchange currencies, and creates an Offer object if not completely.
* Fulfilled when placed. Offers can be partially fulfilled.
*
* @category Transaction Models
*/
export interface URITokenMint extends BaseTransaction {
TransactionType: 'URITokenMint'
Flags?: number | URITokenMintFlagsInterface
/**
* URI that points to the data and/or metadata associated with the NFT.
* This field need not be an HTTP or HTTPS URL; it could be an IPFS URI, a
* magnet link, immediate data encoded as an RFC2379 "data" URL, or even an
* opaque issuer-specific encoding. The URI is NOT checked for validity, but
* the field is limited to a maximum length of 256 bytes.
*
* This field must be hex-encoded. You can use `convertStringToHex` to
* convert this field to the proper encoding.
*/
URI: string
Digest?: string
}
/**
* Verify the form and type of an URITokenMint at runtime.
*
* @param tx - An URITokenMint Transaction.
* @throws When the URITokenMint is Malformed.
*/
export function validateURITokenMint(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (typeof tx.URI === 'string' && !isHex(tx.URI)) {
throw new ValidationError('URITokenMint: URI must be in hex format')
}
}

View File

@@ -12,7 +12,6 @@ import { getFeeXrp } from './getFeeXrp'
// Expire unconfirmed transactions after 20 ledger versions, approximately 1 minute, by default
const LEDGER_OFFSET = 20
const RESTRICTED_NETWORKS = 1024
interface ClassicAccountAndTag {
classicAccount: string
tag: number | false | undefined
@@ -40,10 +39,8 @@ async function autofill<T extends Transaction>(
setValidAddresses(tx)
setTransactionFlagsToNumber(tx)
const promises: Array<Promise<void>> = []
if (this.networkID > RESTRICTED_NETWORKS && tx.NetworkID == null) {
tx.NetworkID = this.networkID
}
if (tx.Sequence == null) {
promises.push(setNextValidSequenceNumber(this, tx))
}

View File

@@ -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
}

View File

@@ -7,8 +7,6 @@ export { default as getLedgerIndex } from './getLedgerIndex'
export { default as getOrderbook } from './getOrderbook'
export { getFeeXrp, getFeeEstimateXrp } from './getFeeXrp'
export { default as getNetworkID } from './getNetworkID'
export * from './submit'
export * from './utils'