mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-18 03:05:48 +00:00
Compare commits
7 Commits
xrpl@2.7.0
...
network-id
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5deee1274 | ||
|
|
294c1cb083 | ||
|
|
69c705874f | ||
|
|
e36912c60a | ||
|
|
3d06185867 | ||
|
|
b241779f10 | ||
|
|
c809bd87e4 |
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"hostid",
|
|
||||||
"Multisigned",
|
"Multisigned",
|
||||||
"preauthorization",
|
|
||||||
"secp256k1",
|
|
||||||
"Setf",
|
"Setf",
|
||||||
"xchain"
|
"hostid",
|
||||||
|
"preauthorization",
|
||||||
|
"secp256k1"
|
||||||
],
|
],
|
||||||
"[javascript]": {
|
"[javascript]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
|||||||
@@ -1,118 +0,0 @@
|
|||||||
"""
|
|
||||||
Helper script to write `validate` methods for transactions.
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
NORMAL_TYPES = ["number", "string"]
|
|
||||||
NUMBERS = ["0", "1"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
model_name = sys.argv[1]
|
|
||||||
filename = f"./packages/xrpl/src/models/transactions/{model_name}.ts"
|
|
||||||
model, tx_name = get_model(filename)
|
|
||||||
return process_model(model, tx_name)
|
|
||||||
|
|
||||||
|
|
||||||
# Extract just the model from the file
|
|
||||||
def get_model(filename):
|
|
||||||
model = ""
|
|
||||||
started = False
|
|
||||||
ended = False
|
|
||||||
with open(filename) as f:
|
|
||||||
for line in f:
|
|
||||||
if ended:
|
|
||||||
continue
|
|
||||||
if not started and not line.startswith("export"):
|
|
||||||
continue
|
|
||||||
if not started and "Flags" in line:
|
|
||||||
continue
|
|
||||||
if not started:
|
|
||||||
started = True
|
|
||||||
model += line
|
|
||||||
if line == '}\n':
|
|
||||||
ended = True
|
|
||||||
|
|
||||||
lines = model.split("\n")
|
|
||||||
name_line = lines[0].split(" ")
|
|
||||||
tx_name = name_line[2]
|
|
||||||
return model, tx_name
|
|
||||||
|
|
||||||
# Process the model and build the `validate` method
|
|
||||||
|
|
||||||
def get_if_line_param_part(param: str, param_type: str):
|
|
||||||
if param_type in NORMAL_TYPES:
|
|
||||||
return f"typeof tx.{param} !== \"{param_type}\""
|
|
||||||
elif param_type in NUMBERS:
|
|
||||||
return f"tx.{param} !== {param_type}"
|
|
||||||
else:
|
|
||||||
return f"!is{param_type}(tx.{param})"
|
|
||||||
|
|
||||||
|
|
||||||
def process_model(model, tx_name):
|
|
||||||
output = ""
|
|
||||||
|
|
||||||
for line in model.split("\n"):
|
|
||||||
if line == "":
|
|
||||||
continue
|
|
||||||
if line.startswith("export"):
|
|
||||||
continue
|
|
||||||
if line == "}":
|
|
||||||
continue
|
|
||||||
line = line.strip()
|
|
||||||
|
|
||||||
if line.startswith("TransactionType"):
|
|
||||||
continue
|
|
||||||
if line.startswith("Flags"):
|
|
||||||
continue
|
|
||||||
|
|
||||||
split = line.split(" ")
|
|
||||||
param = split[0].strip("?:")
|
|
||||||
param_types = split[1:]
|
|
||||||
optional = split[0].endswith("?:")
|
|
||||||
|
|
||||||
if optional:
|
|
||||||
if_line = f" if(tx.{param} !== undefined && "
|
|
||||||
else:
|
|
||||||
output += f" if (tx.{param} == null) {{\n"
|
|
||||||
output += f" throw new ValidationError('{tx_name}: missing field {param}')\n"
|
|
||||||
output += " }\n\n"
|
|
||||||
if_line = " if("
|
|
||||||
|
|
||||||
if len(param_types) == 1:
|
|
||||||
param_type = param_types[0]
|
|
||||||
if_line += get_if_line_param_part(param, param_type)
|
|
||||||
else:
|
|
||||||
i = 0
|
|
||||||
if_outputs = []
|
|
||||||
while i < len(param_types):
|
|
||||||
param_type = param_types[i]
|
|
||||||
if_outputs.append(get_if_line_param_part(param, param_type))
|
|
||||||
i += 2
|
|
||||||
if_line += "(" + " && ".join(if_outputs) + ")"
|
|
||||||
if_line += ") {\n"
|
|
||||||
|
|
||||||
output += if_line
|
|
||||||
output += f" throw new ValidationError('{tx_name}: invalid field {param}')\n"
|
|
||||||
output += " }\n\n"
|
|
||||||
|
|
||||||
output = output[:-1]
|
|
||||||
output += "}\n"
|
|
||||||
|
|
||||||
output = f"""/**
|
|
||||||
* Verify the form and type of a {tx_name} at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A {tx_name} Transaction.
|
|
||||||
* @throws When the {tx_name} is malformed.
|
|
||||||
*/
|
|
||||||
export function validate{tx_name}(tx: Record<string, unknown>): void {{
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
""" + output
|
|
||||||
|
|
||||||
return output
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
print(main())
|
|
||||||
15
package-lock.json
generated
15
package-lock.json
generated
@@ -17135,8 +17135,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/ripple-binary-codec": {
|
"packages/ripple-binary-codec": {
|
||||||
"version": "1.5.0-beta.3",
|
"version": "1.4.2",
|
||||||
"integrity": "sha512-XMRCbFXyG+dGp3x7tMs9IwA+FVWPPaGjdHYW2+g4Q/WQJqFp5MRED+jjOBOUafmrW4TUsOn1PEEdbB4ozWbDBw==",
|
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
@@ -17159,7 +17158,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/ripple-keypairs": {
|
"packages/ripple-keypairs": {
|
||||||
"version": "1.2.0",
|
"version": "1.1.4",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bn.js": "^5.1.1",
|
"bn.js": "^5.1.1",
|
||||||
@@ -17173,7 +17172,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/xrpl": {
|
"packages/xrpl": {
|
||||||
"version": "2.7.0-beta.3",
|
"version": "2.6.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bignumber.js": "^9.0.0",
|
"bignumber.js": "^9.0.0",
|
||||||
@@ -17182,8 +17181,8 @@
|
|||||||
"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.4",
|
"ripple-address-codec": "^4.2.4",
|
||||||
"ripple-binary-codec": "^1.5.0-beta.3",
|
"ripple-binary-codec": "^1.4.2",
|
||||||
"ripple-keypairs": "^1.2.0",
|
"ripple-keypairs": "^1.1.4",
|
||||||
"ws": "^8.2.2"
|
"ws": "^8.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -30602,8 +30601,8 @@
|
|||||||
"node-polyfill-webpack-plugin": "^2.0.1",
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"ripple-address-codec": "^4.2.4",
|
"ripple-address-codec": "^4.2.4",
|
||||||
"ripple-binary-codec": "^1.5.0-beta.3",
|
"ripple-binary-codec": "^1.4.2",
|
||||||
"ripple-keypairs": "^1.2.0",
|
"ripple-keypairs": "^1.1.4",
|
||||||
"typedoc": "^0.23.24",
|
"typedoc": "^0.23.24",
|
||||||
"ws": "^8.2.2"
|
"ws": "^8.2.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ripple-binary-codec",
|
"name": "ripple-binary-codec",
|
||||||
"version": "1.5.0-beta.3",
|
"version": "1.4.2",
|
||||||
"description": "XRP Ledger binary codec",
|
"description": "XRP Ledger binary codec",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/*",
|
"dist/*",
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
"build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
||||||
"clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
|
"clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
|
||||||
"prepare": "npm test",
|
"prepare": "npm run build && npm test",
|
||||||
"test": "npm run build && jest --verbose false --silent=false ./test/*.test.js",
|
"test": "jest --verbose false --silent=false ./test/*.test.js",
|
||||||
"lint": "eslint . --ext .ts --ext .test.js"
|
"lint": "eslint . --ext .ts --ext .test.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { STObject } from './types/st-object'
|
|||||||
import { JsonObject } from './types/serialized-type'
|
import { JsonObject } from './types/serialized-type'
|
||||||
import { Buffer } from 'buffer/'
|
import { Buffer } from 'buffer/'
|
||||||
import bigInt = require('big-integer')
|
import bigInt = require('big-integer')
|
||||||
import { AmountObject } from './types/amount'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a BinaryParser
|
* Construct a BinaryParser
|
||||||
@@ -96,7 +95,7 @@ function signingData(
|
|||||||
*/
|
*/
|
||||||
interface ClaimObject extends JsonObject {
|
interface ClaimObject extends JsonObject {
|
||||||
channel: string
|
channel: string
|
||||||
amount: AmountObject
|
amount: string | number
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,19 +105,16 @@ interface ClaimObject extends JsonObject {
|
|||||||
* @returns the serialized object with appropriate prefix
|
* @returns the serialized object with appropriate prefix
|
||||||
*/
|
*/
|
||||||
function signingClaimData(claim: ClaimObject): Buffer {
|
function signingClaimData(claim: ClaimObject): Buffer {
|
||||||
|
const num = bigInt(String(claim.amount))
|
||||||
const prefix = HashPrefix.paymentChannelClaim
|
const prefix = HashPrefix.paymentChannelClaim
|
||||||
const channel = coreTypes.Hash256.from(claim.channel).toBytes()
|
const channel = coreTypes.Hash256.from(claim.channel).toBytes()
|
||||||
|
const amount = coreTypes.UInt64.from(num).toBytes()
|
||||||
|
|
||||||
const bytesList = new BytesList()
|
const bytesList = new BytesList()
|
||||||
|
|
||||||
bytesList.put(prefix)
|
bytesList.put(prefix)
|
||||||
bytesList.put(channel)
|
bytesList.put(channel)
|
||||||
if (typeof claim.amount === 'string') {
|
bytesList.put(amount)
|
||||||
const num = bigInt(String(claim.amount))
|
|
||||||
const amount = coreTypes.UInt64.from(num).toBytes()
|
|
||||||
bytesList.put(amount)
|
|
||||||
} else {
|
|
||||||
const amount = coreTypes.Amount.from(claim.amount).toBytes()
|
|
||||||
bytesList.put(amount)
|
|
||||||
}
|
|
||||||
return bytesList.toBytes()
|
return bytesList.toBytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
"UInt192": 21,
|
"UInt192": 21,
|
||||||
"UInt384": 22,
|
"UInt384": 22,
|
||||||
"UInt512": 23,
|
"UInt512": 23,
|
||||||
"Issue": 24,
|
|
||||||
"XChainBridge": 25,
|
|
||||||
"Transaction": 10001,
|
"Transaction": 10001,
|
||||||
"LedgerEntry": 10002,
|
"LedgerEntry": 10002,
|
||||||
"Validation": 10003,
|
"Validation": 10003,
|
||||||
@@ -36,11 +34,8 @@
|
|||||||
"Ticket": 84,
|
"Ticket": 84,
|
||||||
"SignerList": 83,
|
"SignerList": 83,
|
||||||
"Offer": 111,
|
"Offer": 111,
|
||||||
"Bridge": 105,
|
|
||||||
"LedgerHashes": 104,
|
"LedgerHashes": 104,
|
||||||
"Amendments": 102,
|
"Amendments": 102,
|
||||||
"XChainClaimID": 113,
|
|
||||||
"XChainCreateAccountClaimID": 116,
|
|
||||||
"FeeSettings": 115,
|
"FeeSettings": 115,
|
||||||
"Escrow": 117,
|
"Escrow": 117,
|
||||||
"PayChannel": 120,
|
"PayChannel": 120,
|
||||||
@@ -49,7 +44,6 @@
|
|||||||
"NegativeUNL": 78,
|
"NegativeUNL": 78,
|
||||||
"NFTokenPage": 80,
|
"NFTokenPage": 80,
|
||||||
"NFTokenOffer": 55,
|
"NFTokenOffer": 55,
|
||||||
"AMM": 121,
|
|
||||||
"Any": -3,
|
"Any": -3,
|
||||||
"Child": -2,
|
"Child": -2,
|
||||||
"Nickname": 110,
|
"Nickname": 110,
|
||||||
@@ -237,16 +231,6 @@
|
|||||||
"type": "UInt8"
|
"type": "UInt8"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"WasLockingChainSend",
|
|
||||||
{
|
|
||||||
"nth": 19,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "UInt8"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"LedgerEntryType",
|
"LedgerEntryType",
|
||||||
{
|
{
|
||||||
@@ -287,16 +271,6 @@
|
|||||||
"type": "UInt16"
|
"type": "UInt16"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"TradingFee",
|
|
||||||
{
|
|
||||||
"nth": 5,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "UInt16"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Version",
|
"Version",
|
||||||
{
|
{
|
||||||
@@ -347,6 +321,16 @@
|
|||||||
"type": "UInt16"
|
"type": "UInt16"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"NetworkID",
|
||||||
|
{
|
||||||
|
"nth": 1,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "UInt32"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"Flags",
|
"Flags",
|
||||||
{
|
{
|
||||||
@@ -787,36 +771,6 @@
|
|||||||
"type": "UInt32"
|
"type": "UInt32"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"VoteWeight",
|
|
||||||
{
|
|
||||||
"nth": 47,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "UInt32"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"DiscountedFee",
|
|
||||||
{
|
|
||||||
"nth": 48,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "UInt32"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"LockCount",
|
|
||||||
{
|
|
||||||
"nth": 49,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "UInt32"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"IndexNext",
|
"IndexNext",
|
||||||
{
|
{
|
||||||
@@ -987,36 +941,6 @@
|
|||||||
"type": "UInt64"
|
"type": "UInt64"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"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",
|
"EmailHash",
|
||||||
{
|
{
|
||||||
@@ -1197,16 +1121,6 @@
|
|||||||
"type": "Hash256"
|
"type": "Hash256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"AMMID",
|
|
||||||
{
|
|
||||||
"nth": 14,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "Hash256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"BookDirectory",
|
"BookDirectory",
|
||||||
{
|
{
|
||||||
@@ -1477,36 +1391,6 @@
|
|||||||
"type": "Amount"
|
"type": "Amount"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"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",
|
"MinimumOffer",
|
||||||
{
|
{
|
||||||
@@ -1547,86 +1431,6 @@
|
|||||||
"type": "Amount"
|
"type": "Amount"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"LPTokenOut",
|
|
||||||
{
|
|
||||||
"nth": 20,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "Amount"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"LPTokenIn",
|
|
||||||
{
|
|
||||||
"nth": 21,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "Amount"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"EPrice",
|
|
||||||
{
|
|
||||||
"nth": 22,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "Amount"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Price",
|
|
||||||
{
|
|
||||||
"nth": 23,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "Amount"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"LPTokenBalance",
|
|
||||||
{
|
|
||||||
"nth": 24,
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"LockedBalance",
|
|
||||||
{
|
|
||||||
"nth": 31,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "Amount"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"PublicKey",
|
"PublicKey",
|
||||||
{
|
{
|
||||||
@@ -1957,16 +1761,6 @@
|
|||||||
"type": "AccountID"
|
"type": "AccountID"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"AMMAccount",
|
|
||||||
{
|
|
||||||
"nth": 11,
|
|
||||||
"isVLEncoded": true,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "AccountID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"HookAccount",
|
"HookAccount",
|
||||||
{
|
{
|
||||||
@@ -1977,66 +1771,6 @@
|
|||||||
"type": "AccountID"
|
"type": "AccountID"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"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",
|
"Indexes",
|
||||||
{
|
{
|
||||||
@@ -2087,56 +1821,6 @@
|
|||||||
"type": "PathSet"
|
"type": "PathSet"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"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",
|
"TransactionMetaData",
|
||||||
{
|
{
|
||||||
@@ -2347,76 +2031,6 @@
|
|||||||
"type": "STObject"
|
"type": "STObject"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"VoteEntry",
|
|
||||||
{
|
|
||||||
"nth": 25,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"AuctionSlot",
|
|
||||||
{
|
|
||||||
"nth": 27,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"AuthAccount",
|
|
||||||
{
|
|
||||||
"nth": 28,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainClaimProofSig",
|
|
||||||
{
|
|
||||||
"nth": 32,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainCreateAccountProofSig",
|
|
||||||
{
|
|
||||||
"nth": 33,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainClaimAttestationBatchElement",
|
|
||||||
{
|
|
||||||
"nth": 34,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainCreateAccountAttestationBatchElement",
|
|
||||||
{
|
|
||||||
"nth": 35,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STObject"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Signers",
|
"Signers",
|
||||||
{
|
{
|
||||||
@@ -2507,16 +2121,6 @@
|
|||||||
"type": "STArray"
|
"type": "STArray"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"VoteSlots",
|
|
||||||
{
|
|
||||||
"nth": 14,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STArray"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"Majorities",
|
"Majorities",
|
||||||
{
|
{
|
||||||
@@ -2566,56 +2170,6 @@
|
|||||||
"isSigningField": true,
|
"isSigningField": true,
|
||||||
"type": "STArray"
|
"type": "STArray"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainClaimAttestationBatch",
|
|
||||||
{
|
|
||||||
"nth": 21,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STArray"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainCreateAccountAttestationBatch",
|
|
||||||
{
|
|
||||||
"nth": 22,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STArray"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainClaimAttestations",
|
|
||||||
{
|
|
||||||
"nth": 23,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STArray"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"XChainCreateAccountAttestations",
|
|
||||||
{
|
|
||||||
"nth": 24,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STArray"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"AuthAccounts",
|
|
||||||
{
|
|
||||||
"nth": 26,
|
|
||||||
"isVLEncoded": false,
|
|
||||||
"isSerialized": true,
|
|
||||||
"isSigningField": true,
|
|
||||||
"type": "STArray"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"TRANSACTION_RESULTS": {
|
"TRANSACTION_RESULTS": {
|
||||||
@@ -2632,6 +2186,9 @@
|
|||||||
"telCAN_NOT_QUEUE_BLOCKED": -389,
|
"telCAN_NOT_QUEUE_BLOCKED": -389,
|
||||||
"telCAN_NOT_QUEUE_FEE": -388,
|
"telCAN_NOT_QUEUE_FEE": -388,
|
||||||
"telCAN_NOT_QUEUE_FULL": -387,
|
"telCAN_NOT_QUEUE_FULL": -387,
|
||||||
|
"telWRONG_NETWORK": -386,
|
||||||
|
"telREQUIRES_NETWORK_ID": -385,
|
||||||
|
"telNETWORK_ID_MAKES_TX_NON_CANONICAL": -384,
|
||||||
|
|
||||||
"temMALFORMED": -299,
|
"temMALFORMED": -299,
|
||||||
"temBAD_AMOUNT": -298,
|
"temBAD_AMOUNT": -298,
|
||||||
@@ -2671,14 +2228,6 @@
|
|||||||
"temUNKNOWN": -264,
|
"temUNKNOWN": -264,
|
||||||
"temSEQ_AND_TICKET": -263,
|
"temSEQ_AND_TICKET": -263,
|
||||||
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
||||||
"temAMM_BAD_TOKENS": -261,
|
|
||||||
"temEQUAL_DOOR_ACCOUNTS": -259,
|
|
||||||
"temBAD_XCHAIN_PROOF": -258,
|
|
||||||
"temSIDECHAIN_BAD_ISSUES": -257,
|
|
||||||
"temSIDECHAIN_NONDOOR_OWNER": -256,
|
|
||||||
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -255,
|
|
||||||
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -254,
|
|
||||||
"temXCHAIN_TOO_MANY_ATTESTATIONS": -253,
|
|
||||||
|
|
||||||
"tefFAILURE": -199,
|
"tefFAILURE": -199,
|
||||||
"tefALREADY": -198,
|
"tefALREADY": -198,
|
||||||
@@ -2714,7 +2263,6 @@
|
|||||||
"terNO_RIPPLE": -90,
|
"terNO_RIPPLE": -90,
|
||||||
"terQUEUED": -89,
|
"terQUEUED": -89,
|
||||||
"terPRE_TICKET": -88,
|
"terPRE_TICKET": -88,
|
||||||
"terNO_AMM": -87,
|
|
||||||
|
|
||||||
"tesSUCCESS": 0,
|
"tesSUCCESS": 0,
|
||||||
|
|
||||||
@@ -2763,31 +2311,7 @@
|
|||||||
"tecCANT_ACCEPT_OWN_NFTOKEN_OFFER": 158,
|
"tecCANT_ACCEPT_OWN_NFTOKEN_OFFER": 158,
|
||||||
"tecINSUFFICIENT_FUNDS": 159,
|
"tecINSUFFICIENT_FUNDS": 159,
|
||||||
"tecOBJECT_NOT_FOUND": 160,
|
"tecOBJECT_NOT_FOUND": 160,
|
||||||
"tecINSUFFICIENT_PAYMENT": 161,
|
"tecINSUFFICIENT_PAYMENT": 161
|
||||||
"tecAMM_UNFUNDED": 162,
|
|
||||||
"tecAMM_BALANCE": 163,
|
|
||||||
"tecAMM_FAILED_DEPOSIT": 164,
|
|
||||||
"tecAMM_FAILED_WITHDRAW": 165,
|
|
||||||
"tecAMM_INVALID_TOKENS": 166,
|
|
||||||
"tecAMM_FAILED_BID": 167,
|
|
||||||
"tecAMM_FAILED_VOTE": 168,
|
|
||||||
"tecBAD_XCHAIN_TRANSFER_ISSUE": 171,
|
|
||||||
"tecXCHAIN_NO_CLAIM_ID": 172,
|
|
||||||
"tecXCHAIN_BAD_CLAIM_ID": 173,
|
|
||||||
"tecXCHAIN_CLAIM_NO_QUORUM": 174,
|
|
||||||
"tecXCHAIN_PROOF_UNKNOWN_KEY": 175,
|
|
||||||
"tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 176,
|
|
||||||
"tecXCHAIN_WRONG_CHAIN": 177,
|
|
||||||
"tecXCHAIN_REWARD_MISMATCH": 178,
|
|
||||||
"tecXCHAIN_NO_SIGNERS_LIST": 179,
|
|
||||||
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 180,
|
|
||||||
"tecXCHAIN_INSUFF_CREATE_AMOUNT": 181,
|
|
||||||
"tecXCHAIN_ACCOUNT_CREATE_PAST": 182,
|
|
||||||
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 183,
|
|
||||||
"tecXCHAIN_PAYMENT_FAILED": 184,
|
|
||||||
"tecXCHAIN_SELF_COMMIT": 185,
|
|
||||||
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 186,
|
|
||||||
"tecPRECISION_LOSS": 187
|
|
||||||
},
|
},
|
||||||
"TRANSACTION_TYPES": {
|
"TRANSACTION_TYPES": {
|
||||||
"Invalid": -1,
|
"Invalid": -1,
|
||||||
@@ -2819,19 +2343,6 @@
|
|||||||
"NFTokenCreateOffer": 27,
|
"NFTokenCreateOffer": 27,
|
||||||
"NFTokenCancelOffer": 28,
|
"NFTokenCancelOffer": 28,
|
||||||
"NFTokenAcceptOffer": 29,
|
"NFTokenAcceptOffer": 29,
|
||||||
"AMMCreate": 35,
|
|
||||||
"AMMDeposit": 36,
|
|
||||||
"AMMWithdraw": 37,
|
|
||||||
"AMMVote": 38,
|
|
||||||
"AMMBid": 39,
|
|
||||||
"XChainCreateBridge": 40,
|
|
||||||
"XChainCreateClaimID": 41,
|
|
||||||
"XChainCommit": 42,
|
|
||||||
"XChainClaim": 43,
|
|
||||||
"XChainAccountCreateCommit": 44,
|
|
||||||
"XChainAddClaimAttestation": 45,
|
|
||||||
"XChainAddAccountCreateAttestation": 46,
|
|
||||||
"XChainModifyBridge": 47,
|
|
||||||
"EnableAmendment": 100,
|
"EnableAmendment": 100,
|
||||||
"SetFee": 101,
|
"SetFee": 101,
|
||||||
"UNLModify": 102
|
"UNLModify": 102
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { Currency } from './currency'
|
|||||||
import { Hash128 } from './hash-128'
|
import { Hash128 } from './hash-128'
|
||||||
import { Hash160 } from './hash-160'
|
import { Hash160 } from './hash-160'
|
||||||
import { Hash256 } from './hash-256'
|
import { Hash256 } from './hash-256'
|
||||||
import { Issue } from './issue'
|
|
||||||
import { PathSet } from './path-set'
|
import { PathSet } from './path-set'
|
||||||
import { STArray } from './st-array'
|
import { STArray } from './st-array'
|
||||||
import { STObject } from './st-object'
|
import { STObject } from './st-object'
|
||||||
@@ -20,7 +19,6 @@ import { UInt32 } from './uint-32'
|
|||||||
import { UInt64 } from './uint-64'
|
import { UInt64 } from './uint-64'
|
||||||
import { UInt8 } from './uint-8'
|
import { UInt8 } from './uint-8'
|
||||||
import { Vector256 } from './vector-256'
|
import { Vector256 } from './vector-256'
|
||||||
import { XChainBridge } from './xchain-bridge'
|
|
||||||
|
|
||||||
const coreTypes = {
|
const coreTypes = {
|
||||||
AccountID,
|
AccountID,
|
||||||
@@ -30,7 +28,6 @@ const coreTypes = {
|
|||||||
Hash128,
|
Hash128,
|
||||||
Hash160,
|
Hash160,
|
||||||
Hash256,
|
Hash256,
|
||||||
Issue,
|
|
||||||
PathSet,
|
PathSet,
|
||||||
STArray,
|
STArray,
|
||||||
STObject,
|
STObject,
|
||||||
@@ -39,7 +36,6 @@ const coreTypes = {
|
|||||||
UInt32,
|
UInt32,
|
||||||
UInt64,
|
UInt64,
|
||||||
Vector256,
|
Vector256,
|
||||||
XChainBridge,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.values(Field).forEach((field) => {
|
Object.values(Field).forEach((field) => {
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
import { BinaryParser } from '../serdes/binary-parser'
|
|
||||||
|
|
||||||
import { AccountID } from './account-id'
|
|
||||||
import { Currency } from './currency'
|
|
||||||
import { JsonObject, SerializedType } from './serialized-type'
|
|
||||||
import { Buffer } from 'buffer/'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for JSON objects that represent amounts
|
|
||||||
*/
|
|
||||||
interface IssueObject extends JsonObject {
|
|
||||||
currency: string
|
|
||||||
issuer?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard for AmountObject
|
|
||||||
*/
|
|
||||||
function isIssueObject(arg): arg is IssueObject {
|
|
||||||
const keys = Object.keys(arg).sort()
|
|
||||||
if (keys.length === 1) {
|
|
||||||
return keys[0] === 'currency'
|
|
||||||
}
|
|
||||||
return keys.length === 2 && keys[0] === 'currency' && keys[1] === 'issuer'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for serializing/Deserializing Amounts
|
|
||||||
*/
|
|
||||||
class Issue extends SerializedType {
|
|
||||||
static readonly ZERO_ISSUED_CURRENCY: Issue = new Issue(Buffer.alloc(20))
|
|
||||||
|
|
||||||
constructor(bytes: Buffer) {
|
|
||||||
super(bytes ?? Issue.ZERO_ISSUED_CURRENCY.bytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an amount from an IOU or string amount
|
|
||||||
*
|
|
||||||
* @param value An Amount, object representing an IOU, or a string
|
|
||||||
* representing an integer amount
|
|
||||||
* @returns An Amount object
|
|
||||||
*/
|
|
||||||
static from<T extends Issue | IssueObject>(value: T): Issue {
|
|
||||||
if (value instanceof Issue) {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isIssueObject(value)) {
|
|
||||||
const currency = Currency.from(value.currency).toBytes()
|
|
||||||
if (value.issuer == null) {
|
|
||||||
return new Issue(currency)
|
|
||||||
}
|
|
||||||
const issuer = AccountID.from(value.issuer).toBytes()
|
|
||||||
return new Issue(Buffer.concat([currency, issuer]))
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error('Invalid type to construct an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read an amount from a BinaryParser
|
|
||||||
*
|
|
||||||
* @param parser BinaryParser to read the Amount from
|
|
||||||
* @returns An Amount object
|
|
||||||
*/
|
|
||||||
static fromParser(parser: BinaryParser): Issue {
|
|
||||||
const currency = parser.read(20)
|
|
||||||
if (new Currency(currency).toJSON() === 'XRP') {
|
|
||||||
return new Issue(currency)
|
|
||||||
}
|
|
||||||
const currencyAndIssuer = [currency, parser.read(20)]
|
|
||||||
return new Issue(Buffer.concat(currencyAndIssuer))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the JSON representation of this Amount
|
|
||||||
*
|
|
||||||
* @returns the JSON interpretation of this.bytes
|
|
||||||
*/
|
|
||||||
toJSON(): IssueObject {
|
|
||||||
const parser = new BinaryParser(this.toString())
|
|
||||||
const currency = Currency.fromParser(parser) as Currency
|
|
||||||
if (currency.toJSON() === 'XRP') {
|
|
||||||
return { currency: currency.toJSON() }
|
|
||||||
}
|
|
||||||
const issuer = AccountID.fromParser(parser) as AccountID
|
|
||||||
|
|
||||||
return {
|
|
||||||
currency: currency.toJSON(),
|
|
||||||
issuer: issuer.toJSON(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Issue, IssueObject }
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
import { BinaryParser } from '../serdes/binary-parser'
|
|
||||||
|
|
||||||
import { AccountID } from './account-id'
|
|
||||||
import { JsonObject, SerializedType } from './serialized-type'
|
|
||||||
import { Buffer } from 'buffer/'
|
|
||||||
import { Issue, IssueObject } from './issue'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for JSON objects that represent cross-chain bridges
|
|
||||||
*/
|
|
||||||
interface XChainBridgeObject extends JsonObject {
|
|
||||||
LockingChainDoor: string
|
|
||||||
LockingChainIssue: IssueObject | string
|
|
||||||
IssuingChainDoor: string
|
|
||||||
IssuingChainIssue: IssueObject | string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard for XChainBridgeObject
|
|
||||||
*/
|
|
||||||
function isXChainBridgeObject(arg): arg is XChainBridgeObject {
|
|
||||||
const keys = Object.keys(arg).sort()
|
|
||||||
return (
|
|
||||||
keys.length === 4 &&
|
|
||||||
keys[0] === 'IssuingChainDoor' &&
|
|
||||||
keys[1] === 'IssuingChainIssue' &&
|
|
||||||
keys[2] === 'LockingChainDoor' &&
|
|
||||||
keys[3] === 'LockingChainIssue'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for serializing/deserializing XChainBridges
|
|
||||||
*/
|
|
||||||
class XChainBridge extends SerializedType {
|
|
||||||
static readonly ZERO_XCHAIN_BRIDGE: XChainBridge = new XChainBridge(
|
|
||||||
Buffer.concat([
|
|
||||||
Buffer.from([0x14]),
|
|
||||||
Buffer.alloc(40),
|
|
||||||
Buffer.from([0x14]),
|
|
||||||
Buffer.alloc(40),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
|
|
||||||
static readonly TYPE_ORDER: { name: string; type: typeof SerializedType }[] =
|
|
||||||
[
|
|
||||||
{ name: 'LockingChainDoor', type: AccountID },
|
|
||||||
{ name: 'LockingChainIssue', type: Issue },
|
|
||||||
{ name: 'IssuingChainDoor', type: AccountID },
|
|
||||||
{ name: 'IssuingChainIssue', type: Issue },
|
|
||||||
]
|
|
||||||
|
|
||||||
constructor(bytes: Buffer) {
|
|
||||||
super(bytes ?? XChainBridge.ZERO_XCHAIN_BRIDGE.bytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a cross-chain bridge from a JSON
|
|
||||||
*
|
|
||||||
* @param value XChainBridge or JSON to parse into a XChainBridge
|
|
||||||
* @returns A XChainBridge object
|
|
||||||
*/
|
|
||||||
static from<T extends XChainBridge | XChainBridgeObject>(
|
|
||||||
value: T,
|
|
||||||
): XChainBridge {
|
|
||||||
if (value instanceof XChainBridge) {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isXChainBridgeObject(value)) {
|
|
||||||
const bytes: Array<Buffer> = []
|
|
||||||
this.TYPE_ORDER.forEach((item) => {
|
|
||||||
const { name, type } = item
|
|
||||||
if (type === AccountID) {
|
|
||||||
bytes.push(Buffer.from([0x14]))
|
|
||||||
}
|
|
||||||
const object = type.from(value[name])
|
|
||||||
bytes.push(object.toBytes())
|
|
||||||
})
|
|
||||||
return new XChainBridge(Buffer.concat(bytes))
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error('Invalid type to construct a XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read a XChainBridge from a BinaryParser
|
|
||||||
*
|
|
||||||
* @param parser BinaryParser to read the XChainBridge from
|
|
||||||
* @returns A XChainBridge object
|
|
||||||
*/
|
|
||||||
static fromParser(parser: BinaryParser): XChainBridge {
|
|
||||||
const bytes: Array<Buffer> = []
|
|
||||||
|
|
||||||
this.TYPE_ORDER.forEach((item) => {
|
|
||||||
const { type } = item
|
|
||||||
if (type === AccountID) {
|
|
||||||
parser.skip(1)
|
|
||||||
bytes.push(Buffer.from([0x14]))
|
|
||||||
}
|
|
||||||
const object = type.fromParser(parser)
|
|
||||||
bytes.push(object.toBytes())
|
|
||||||
})
|
|
||||||
|
|
||||||
return new XChainBridge(Buffer.concat(bytes))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the JSON representation of this XChainBridge
|
|
||||||
*
|
|
||||||
* @returns the JSON interpretation of this.bytes
|
|
||||||
*/
|
|
||||||
toJSON(): XChainBridgeObject {
|
|
||||||
const parser = new BinaryParser(this.toString())
|
|
||||||
const json = {}
|
|
||||||
XChainBridge.TYPE_ORDER.forEach((item) => {
|
|
||||||
const { name, type } = item
|
|
||||||
if (type === AccountID) {
|
|
||||||
parser.skip(1)
|
|
||||||
}
|
|
||||||
const object = type.fromParser(parser).toJSON()
|
|
||||||
json[name] = object
|
|
||||||
})
|
|
||||||
return json as XChainBridgeObject
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { XChainBridge, XChainBridgeObject }
|
|
||||||
@@ -4435,414 +4435,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transactions": [
|
"transactions": [{
|
||||||
{
|
"binary": "1200002200000000240000003E6140000002540BE40068400000000000000A7321034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E74473045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F17962646398114550FC62003E785DC231A1058A05E56E3F09CF4E68314D4CC8AB5B21D86A82C3E9E8D0ECF2404B77FECBA",
|
||||||
"binary": "1200002200000000240000003E6140000002540BE40068400000000000000A7321034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E74473045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F17962646398114550FC62003E785DC231A1058A05E56E3F09CF4E68314D4CC8AB5B21D86A82C3E9E8D0ECF2404B77FECBA",
|
"json": {
|
||||||
"json": {
|
"Account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
||||||
"Account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
"Destination": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
|
||||||
"Destination": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
|
"TransactionType": "Payment",
|
||||||
"TransactionType": "Payment",
|
"TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
|
||||||
"TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
|
"SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
|
||||||
"SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
|
"Amount": "10000000000",
|
||||||
"Amount": "10000000000",
|
"Fee": "10",
|
||||||
"Fee": "10",
|
"Flags": 0,
|
||||||
"Flags": 0,
|
"Sequence": 62
|
||||||
"Sequence": 62
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "1200282200000000240000000168400000000000000A601D40000000000003E8601E400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020744630440220101BCA4B5B5A37C6F44480F9A34752C9AA8B2CDF5AD47E3CB424DEDC21C06DB702206EEB257E82A89B1F46A0A2C7F070B0BD181D980FF86FE4269E369F6FC7A270918114B5F762798A53D543A014CAF8B297CFF8F2F937E8011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"XChainBridge": {
|
|
||||||
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"LockingChainIssue": {"currency": "XRP"},
|
|
||||||
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"IssuingChainIssue": {"currency": "XRP"}
|
|
||||||
},
|
|
||||||
"Fee": "10",
|
|
||||||
"Flags": 0,
|
|
||||||
"MinAccountCreateAmount": "10000",
|
|
||||||
"Sequence": 1,
|
|
||||||
"SignatureReward": "1000",
|
|
||||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
|
||||||
"TransactionType": "XChainCreateBridge",
|
|
||||||
"TxnSignature": "30440220101BCA4B5B5A37C6F44480F9A34752C9AA8B2CDF5AD47E3CB424DEDC21C06DB702206EEB257E82A89B1F46A0A2C7F070B0BD181D980FF86FE4269E369F6FC7A27091"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002F2200000000240000000168400000000000000A601D40000000000003E8601E400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100D2CABC1B0E0635A8EE2E6554F6D474C49BC292C995C5C9F83179F4A60634B04C02205D1DB569D9593136F2FBEA7140010C8F46794D653AFDBEA8D30B8750BA4805E58114B5F762798A53D543A014CAF8B297CFF8F2F937E8011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"XChainBridge": {
|
|
||||||
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"LockingChainIssue": {"currency": "XRP"},
|
|
||||||
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"IssuingChainIssue": {"currency": "XRP"}
|
|
||||||
},
|
|
||||||
"Fee": "10",
|
|
||||||
"Flags": 0,
|
|
||||||
"MinAccountCreateAmount": "10000",
|
|
||||||
"Sequence": 1,
|
|
||||||
"SignatureReward": "1000",
|
|
||||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
|
||||||
"TransactionType": "XChainModifyBridge",
|
|
||||||
"TxnSignature": "3045022100D2CABC1B0E0635A8EE2E6554F6D474C49BC292C995C5C9F83179F4A60634B04C02205D1DB569D9593136F2FBEA7140010C8F46794D653AFDBEA8D30B8750BA4805E5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "1200292280000000240000000168400000000000000A601D400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020744630440220247B20A1B9C48E21A374CB9B3E1FE2A7C528151868DF8D307E9FBE15237E531A02207C20C092DDCC525E583EF4AB7CB91E862A6DED19426997D3F0A2C84E2BE8C5DD8114B5F762798A53D543A014CAF8B297CFF8F2F937E8801214AF80285F637EE4AF3C20378F9DFB12511ACB8D27011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"XChainBridge": {
|
|
||||||
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"LockingChainIssue": {"currency": "XRP"},
|
|
||||||
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"IssuingChainIssue": {"currency": "XRP"}
|
|
||||||
},
|
|
||||||
"Fee": "10",
|
|
||||||
"Flags": 2147483648,
|
|
||||||
"OtherChainSource": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"Sequence": 1,
|
|
||||||
"SignatureReward": "10000",
|
|
||||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
|
||||||
"TransactionType": "XChainCreateClaimID",
|
|
||||||
"TxnSignature": "30440220247B20A1B9C48E21A374CB9B3E1FE2A7C528151868DF8D307E9FBE15237E531A02207C20C092DDCC525E583EF4AB7CB91E862A6DED19426997D3F0A2C84E2BE8C5DD"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002A228000000024000000013014000000000000000161400000000000271068400000000000000A73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074453043021F177323F0D93612C82A4393A99B23905A7E675753FD80C52997AFAB13F5F9D002203BFFAF457E90BDA65AABE8F8762BD96162FAD98A0C030CCD69B06EE9B12BBFFE8114B5F762798A53D543A014CAF8B297CFF8F2F937E8011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"Amount": "10000",
|
|
||||||
"XChainBridge": {
|
|
||||||
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"LockingChainIssue": {"currency": "XRP"},
|
|
||||||
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"IssuingChainIssue": {"currency": "XRP"}
|
|
||||||
},
|
|
||||||
"Fee": "10",
|
|
||||||
"Flags": 2147483648,
|
|
||||||
"Sequence": 1,
|
|
||||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
|
||||||
"TransactionType": "XChainCommit",
|
|
||||||
"TxnSignature": "3043021F177323F0D93612C82A4393A99B23905A7E675753FD80C52997AFAB13F5F9D002203BFFAF457E90BDA65AABE8F8762BD96162FAD98A0C030CCD69B06EE9B12BBFFE",
|
|
||||||
"XChainClaimID": "0000000000000001"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002B228000000024000000013014000000000000000161400000000000271068400000000000000A73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020744630440220445F7469FDA401787D9EE8A9B6E24DFF81E94F4C09FD311D2C0A58FCC02C684A022029E2EF34A5EA35F50D5BB57AC6320AD3AE12C13C8D1379B255A486D72CED142E8114B5F762798A53D543A014CAF8B297CFF8F2F937E88314550FC62003E785DC231A1058A05E56E3F09CF4E6011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"Amount": "10000",
|
|
||||||
"XChainBridge": {
|
|
||||||
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"LockingChainIssue": {"currency": "XRP"},
|
|
||||||
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"IssuingChainIssue": {"currency": "XRP"}
|
|
||||||
},
|
|
||||||
"Destination": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"Fee": "10",
|
|
||||||
"Flags": 2147483648,
|
|
||||||
"Sequence": 1,
|
|
||||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
|
||||||
"TransactionType": "XChainClaim",
|
|
||||||
"TxnSignature": "30440220445F7469FDA401787D9EE8A9B6E24DFF81E94F4C09FD311D2C0A58FCC02C684A022029E2EF34A5EA35F50D5BB57AC6320AD3AE12C13C8D1379B255A486D72CED142E",
|
|
||||||
"XChainClaimID": "0000000000000001"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002C228000000024000000016140000000000F424068400000000000000A601D400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402202984DDE7F0B566F081F7953D7212BF031ACBF8860FE114102E9512C4C8768C77022070113F4630B1DC3045E4A98DDD648CEBC31B12774F7B44A1B8123CD2C9F5CF188114B5F762798A53D543A014CAF8B297CFF8F2F937E88314AF80285F637EE4AF3C20378F9DFB12511ACB8D27011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"XChainBridge": {
|
|
||||||
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"LockingChainIssue": {"currency": "XRP"},
|
|
||||||
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
|
||||||
"IssuingChainIssue": {"currency": "XRP"}
|
|
||||||
},
|
|
||||||
"Amount": "1000000",
|
|
||||||
"Fee": "10",
|
|
||||||
"Flags": 2147483648,
|
|
||||||
"Destination": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
|
|
||||||
"Sequence": 1,
|
|
||||||
"SignatureReward": "10000",
|
|
||||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
|
||||||
"TransactionType": "XChainAccountCreateCommit",
|
|
||||||
"TxnSignature": "304402202984DDE7F0B566F081F7953D7212BF031ACBF8860FE114102E9512C4C8768C77022070113F4630B1DC3045E4A98DDD648CEBC31B12774F7B44A1B8123CD2C9F5CF18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002E2400000005201B0000000D30150000000000000006614000000000989680684000000000000014601D40000000000000647121ED1F4A024ACFEBDB6C7AA88DEDE3364E060487EA31B14CC9E0D610D152B31AADC27321EDF54108BA2E0A0D3DC2AE3897F8BE0EFE776AE8D0F9FB0D0B9D64233084A8DDD1744003E74AEF1F585F156786429D2FC87A89E5C6B5A56D68BFC9A6A329F3AC67CBF2B6958283C663A4522278CA162C69B23CF75149AF022B410EA0508C16F42058007640EEFCFA3DC2AB4AB7C4D2EBBC168CB621A11B82BABD86534DFC8EFA72439A49662D744073CD848E7A587A95B35162CDF9A69BB237E72C9537A987F5B8C394F30D81145E7A3E3D7200A794FA801C66CE3775B6416EE4128314C15F113E49BCC4B9FFF43CD0366C23ACD82F75638012143FD9ED9A79DEA67CB5D585111FEF0A29203FA0408014145E7A3E3D7200A794FA801C66CE3775B6416EE4128015145E7A3E3D7200A794FA801C66CE3775B6416EE4120010130101191486F0B1126CE1205E59FDFDD2661A9FB7505CA70F000000000000000000000000000000000000000014B5F762798A53D543A014CAF8B297CFF8F2F937E80000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "r9cYxdjQsoXAEz3qQJc961SNLaXRkWXCvT",
|
|
||||||
"Amount": "10000000",
|
|
||||||
"AttestationRewardAccount": "r9cYxdjQsoXAEz3qQJc961SNLaXRkWXCvT",
|
|
||||||
"AttestationSignerAccount": "r9cYxdjQsoXAEz3qQJc961SNLaXRkWXCvT",
|
|
||||||
"Destination": "rJdTJRJZ6GXCCRaamHJgEqVzB7Zy4557Pi",
|
|
||||||
"Fee": "20",
|
|
||||||
"LastLedgerSequence": 13,
|
|
||||||
"OtherChainSource": "raFcdz1g8LWJDJWJE2ZKLRGdmUmsTyxaym",
|
|
||||||
"PublicKey": "ED1F4A024ACFEBDB6C7AA88DEDE3364E060487EA31B14CC9E0D610D152B31AADC2",
|
|
||||||
"Sequence": 5,
|
|
||||||
"Signature": "EEFCFA3DC2AB4AB7C4D2EBBC168CB621A11B82BABD86534DFC8EFA72439A49662D744073CD848E7A587A95B35162CDF9A69BB237E72C9537A987F5B8C394F30D",
|
|
||||||
"SignatureReward": "100",
|
|
||||||
"SigningPubKey": "EDF54108BA2E0A0D3DC2AE3897F8BE0EFE776AE8D0F9FB0D0B9D64233084A8DDD1",
|
|
||||||
"TransactionType": "XChainAddAccountCreateAttestation",
|
|
||||||
"TxnSignature": "03E74AEF1F585F156786429D2FC87A89E5C6B5A56D68BFC9A6A329F3AC67CBF2B6958283C663A4522278CA162C69B23CF75149AF022B410EA0508C16F4205800",
|
|
||||||
"WasLockingChainSend": 1,
|
|
||||||
"XChainAccountCreateCount": "0000000000000006",
|
|
||||||
"XChainBridge": {
|
|
||||||
"IssuingChainDoor": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"IssuingChainIssue": {
|
|
||||||
"currency": "XRP"
|
|
||||||
},
|
|
||||||
"LockingChainDoor": "rDJVtEuDKr4rj1B3qtW7R5TVWdXV2DY7Qg",
|
|
||||||
"LockingChainIssue": {
|
|
||||||
"currency": "XRP"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002D2400000009201B00000013301400000000000000016140000000009896806840000000000000147121ED7541DEC700470F54276C90C333A13CDBB5D341FD43C60CEA12170F6D6D4E11367321ED0406B134786FE0751717226657F7BF8AFE96442C05D28ACEC66FB64852BA604C7440D0423649E48A44F181262CF5FC08A68E7FA5CD9E55843E4F09014B76E602574741E8553383A4B43CABD194BB96713647FC0B885BE248E4FFA068FA3E6994CF0476407C175050B08000AD35EEB2D87E16CD3F95A0AEEBF2A049474275153D9D4DD44528FE99AA50E71660A15B0B768E1B90E609BBD5DC7AFAFD45D9705D72D40EA10C81141F30A4D728AB98B0950EC3B9815E6C8D43A7D5598314C15F113E49BCC4B9FFF43CD0366C23ACD82F75638012143FD9ED9A79DEA67CB5D585111FEF0A29203FA0408014141F30A4D728AB98B0950EC3B9815E6C8D43A7D5598015141F30A4D728AB98B0950EC3B9815E6C8D43A7D5590010130101191486F0B1126CE1205E59FDFDD2661A9FB7505CA70F000000000000000000000000000000000000000014B5F762798A53D543A014CAF8B297CFF8F2F937E80000000000000000000000000000000000000000",
|
|
||||||
"json": {
|
|
||||||
"Account": "rsqvD8WFFEBBv4nztpoW9YYXJ7eRzLrtc3",
|
|
||||||
"Amount": "10000000",
|
|
||||||
"AttestationRewardAccount": "rsqvD8WFFEBBv4nztpoW9YYXJ7eRzLrtc3",
|
|
||||||
"AttestationSignerAccount": "rsqvD8WFFEBBv4nztpoW9YYXJ7eRzLrtc3",
|
|
||||||
"Destination": "rJdTJRJZ6GXCCRaamHJgEqVzB7Zy4557Pi",
|
|
||||||
"Fee": "20",
|
|
||||||
"LastLedgerSequence": 19,
|
|
||||||
"OtherChainSource": "raFcdz1g8LWJDJWJE2ZKLRGdmUmsTyxaym",
|
|
||||||
"PublicKey": "ED7541DEC700470F54276C90C333A13CDBB5D341FD43C60CEA12170F6D6D4E1136",
|
|
||||||
"Sequence": 9,
|
|
||||||
"Signature": "7C175050B08000AD35EEB2D87E16CD3F95A0AEEBF2A049474275153D9D4DD44528FE99AA50E71660A15B0B768E1B90E609BBD5DC7AFAFD45D9705D72D40EA10C",
|
|
||||||
"SigningPubKey": "ED0406B134786FE0751717226657F7BF8AFE96442C05D28ACEC66FB64852BA604C",
|
|
||||||
"TransactionType": "XChainAddClaimAttestation",
|
|
||||||
"TxnSignature": "D0423649E48A44F181262CF5FC08A68E7FA5CD9E55843E4F09014B76E602574741E8553383A4B43CABD194BB96713647FC0B885BE248E4FFA068FA3E6994CF04",
|
|
||||||
"WasLockingChainSend": 1,
|
|
||||||
"XChainBridge": {
|
|
||||||
"IssuingChainDoor": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
|
||||||
"IssuingChainIssue": {
|
|
||||||
"currency": "XRP"
|
|
||||||
},
|
|
||||||
"LockingChainDoor": "rDJVtEuDKr4rj1B3qtW7R5TVWdXV2DY7Qg",
|
|
||||||
"LockingChainIssue": {
|
|
||||||
"currency": "XRP"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"XChainClaimID": "0000000000000001"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "12002315000A220000000024000000026140000000000027106840000000000000016BD5838D7EA4C680000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440913E39EC2BA0E5BC4C5DF1222B1AE9E76758F2B8FFEF1F056076147BB0ADC8117CD0296360DA08B3D48BE9EFC8693C03A253E0D9F166C19CA8D936F9E61A1100811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMCreate",
|
|
||||||
"TxnSignature": "913E39EC2BA0E5BC4C5DF1222B1AE9E76758F2B8FFEF1F056076147BB0ADC8117CD0296360DA08B3D48BE9EFC8693C03A253E0D9F166C19CA8D936F9E61A1100",
|
|
||||||
"Amount": "10000",
|
|
||||||
"Amount2": {
|
|
||||||
"currency": "ETH",
|
|
||||||
"issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9",
|
|
||||||
"value": "10000"
|
|
||||||
},
|
|
||||||
"TradingFee": 10,
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 0,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120024220001000024000000026840000000000000016014D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D074409EEE8CF88C668B955E7EEAB1B4A1B059EDF4F51B7F1546810F87E3E48B09237F015C651E37FB40A979E00EA21361D4E18D7A33DB7DD23070CEEAB2648AB3BB0D811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMDeposit",
|
|
||||||
"TxnSignature": "9EEE8CF88C668B955E7EEAB1B4A1B059EDF4F51B7F1546810F87E3E48B09237F015C651E37FB40A979E00EA21361D4E18D7A33DB7DD23070CEEAB2648AB3BB0D",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"LPTokenOut": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 65536,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120024220008000024000000026140000000000003E86840000000000000017321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440BD18A6E2B10B451F61CFADC32B59A0243702DC5DAAE556D51CB9C79981D40C78101FFA9DE6163CFBDF6E7578DF02F2AE3B8A5AB60697E0746D65064D91E8F90A811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMDeposit",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 524288,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "BD18A6E2B10B451F61CFADC32B59A0243702DC5DAAE556D51CB9C79981D40C78101FFA9DE6163CFBDF6E7578DF02F2AE3B8A5AB60697E0746D65064D91E8F90A"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120024220010000024000000026140000000000003E86840000000000000016BD511C37937E080000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440E0B1AE32A0F731BF0CEF0D019295BD7F35B22F11A5962F65FA99EE4D38993B14B53DB11C15E36D756E282812E9015D38A6F225940A157693F43F9B795C59950F811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMDeposit",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"Amount2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9", "value": "500"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 1048576,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "E0B1AE32A0F731BF0CEF0D019295BD7F35B22F11A5962F65FA99EE4D38993B14B53DB11C15E36D756E282812E9015D38A6F225940A157693F43F9B795C59950F"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120024220020000024000000026140000000000003E86840000000000000016014D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440452BC59F9EE12C224EC983EFDF580F20C4A50E897105FD1FB13520D9753CFB02BD210599181574DF6AD0DB6A42C1EA48D9E48FC3D11B9008E4C76FBB163D5B00811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMDeposit",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"LPTokenOut": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 2097152,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "452BC59F9EE12C224EC983EFDF580F20C4A50E897105FD1FB13520D9753CFB02BD210599181574DF6AD0DB6A42C1EA48D9E48FC3D11B9008E4C76FBB163D5B00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120024220040000024000000026140000000000003E8684000000000000001601640000000000000197321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440DD6685DC586FAA6AD2D50D785900122EB147D4AC09A55D7080267A9B38180F87CEC44B823359FC3F0AC0104D47B53FFC6B80415664C3C4582672420A0100F70C811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMDeposit",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"EPrice": "25",
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 4194304,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "DD6685DC586FAA6AD2D50D785900122EB147D4AC09A55D7080267A9B38180F87CEC44B823359FC3F0AC0104D47B53FFC6B80415664C3C4582672420A0100F70C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120025220001000024000000026840000000000000016015D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744066944797E9F03808C9A00AAEFF786AD74FEB2E64B51A9601E89ABA820AAA15927C2E961A9CCA22C4B0D2A2B55E342BD6E297BD765B6F4D3FDCA578A3416BB505811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMWithdraw",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"LPTokenIn": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 65536,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "66944797E9F03808C9A00AAEFF786AD74FEB2E64B51A9601E89ABA820AAA15927C2E961A9CCA22C4B0D2A2B55E342BD6E297BD765B6F4D3FDCA578A3416BB505"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120025220008000024000000026140000000000003E86840000000000000017321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440E30397CE7E99B13D35FFB5C66725B17F4F103675E10293C7B1D63C1BE3FA81B884BD3FBD31B52F6B811F99C5FBB5102D170EC379C268DF80DABF04E7F2DD4F0C811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMWithdraw",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 524288,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "E30397CE7E99B13D35FFB5C66725B17F4F103675E10293C7B1D63C1BE3FA81B884BD3FBD31B52F6B811F99C5FBB5102D170EC379C268DF80DABF04E7F2DD4F0C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120025220010000024000000026140000000000003E86840000000000000016BD511C37937E080000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440C0818312B269A4EF16C1C7EBBB74EFD1852A288BB214A714B8BE3B5F4B2F9CFDFF4F66C931B8434244A8016035B9EC9493B7CF5E0ACF4570A88DF808D79E4300811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMWithdraw",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"Amount2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9", "value": "500"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 1048576,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "C0818312B269A4EF16C1C7EBBB74EFD1852A288BB214A714B8BE3B5F4B2F9CFDFF4F66C931B8434244A8016035B9EC9493B7CF5E0ACF4570A88DF808D79E4300"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120025220020000024000000026140000000000003E86840000000000000016015D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744073552B3DC7AE99DDF4E4FF0D60E6D0BE4688E3474D363603FA25DA6AD8BBA8F0E4E3EA82ADB2B57F5B9A6C379969E00095546DDA0E74FF3D0F0689351C2F8C06811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMWithdraw",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"LPTokenIn": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 2097152,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "73552B3DC7AE99DDF4E4FF0D60E6D0BE4688E3474D363603FA25DA6AD8BBA8F0E4E3EA82ADB2B57F5B9A6C379969E00095546DDA0E74FF3D0F0689351C2F8C06"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120025220040000024000000026140000000000003E8684000000000000001601640000000000000197321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744023BAFE5BFE58E7BF0B02B5875983D007C10796C8E62A190BF688EBE5D8A104DAD2DE7EDE995FE2E494883FD8140F38E22E3376A2F49C50EFCAA00C7499A4690E811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMWithdraw",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"Amount": "1000",
|
|
||||||
"EPrice": "25",
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 4194304,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "23BAFE5BFE58E7BF0B02B5875983D007C10796C8E62A190BF688EBE5D8A104DAD2DE7EDE995FE2E494883FD8140F38E22E3376A2F49C50EFCAA00C7499A4690E"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "120027220000000024000000026840000000000000016CD4C8E1BC9BF04000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0486DD4CC6F3B40B6C000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D074406B2A1548E6DC14681356C27CCBE7072CAB2AD8C72D0D7A045916FB0E0DBE6BF71A429CC519E9200172829D3EEF79100899D3A8710C1C3C1A2B664FD64086AD0A811462D4D845D20B4F09CFEA8BB4C01063D99FC9673EF01AE01C81149A91957F8F16BC57F3F200CD8C98375BF1791586E1F10318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMBid",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"AuthAccounts": [{"AuthAccount": {"Account": "rEaHTti4HZsMBpxTAF4ncWxkcdqDh1h6P7"}}],
|
|
||||||
"BidMax": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "35"},
|
|
||||||
"BidMin": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "25"},
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 0,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "6B2A1548E6DC14681356C27CCBE7072CAB2AD8C72D0D7A045916FB0E0DBE6BF71A429CC519E9200172829D3EEF79100899D3A8710C1C3C1A2B664FD64086AD0A"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"binary": "1200261500EA220000000024000000026840000000000000017321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744072767CF9A0F5E9C9DA6BBB6E84905B0ECDF122D3E2D730843EFD377521E8E73664AD809D0A54E8C75CD1735ACB64E310BB49FDED10913FA150B8C006D4ACEC00811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
|
|
||||||
"json": {
|
|
||||||
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
|
|
||||||
"TransactionType": "AMMVote",
|
|
||||||
"Asset": {"currency": "XRP"},
|
|
||||||
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
|
|
||||||
"TradingFee": 234,
|
|
||||||
"Fee": "1",
|
|
||||||
"Flags": 0,
|
|
||||||
"Sequence": 2,
|
|
||||||
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
|
|
||||||
"TxnSignature": "72767CF9A0F5E9C9DA6BBB6E84905B0ECDF122D3E2D730843EFD377521E8E73664AD809D0A54E8C75CD1735ACB64E310BB49FDED10913FA150B8C006D4ACEC00"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
}],
|
||||||
"ledgerData": [{
|
"ledgerData": [{
|
||||||
"binary": "01E91435016340767BF1C4A3EACEB081770D8ADE216C85445DD6FB002C6B5A2930F2DECE006DA18150CB18F6DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F873B5C3E520634D343EF5D9D9A4246643D64DAD278BA95DC0EAC6EB5350CF970D521276CDE21276CE60A00",
|
"binary": "01E91435016340767BF1C4A3EACEB081770D8ADE216C85445DD6FB002C6B5A2930F2DECE006DA18150CB18F6DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F873B5C3E520634D343EF5D9D9A4246643D64DAD278BA95DC0EAC6EB5350CF970D521276CDE21276CE60A00",
|
||||||
"json": {
|
"json": {
|
||||||
@@ -4857,4 +4463,4 @@
|
|||||||
"transaction_hash": "DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F87"
|
"transaction_hash": "DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F87"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ describe('Signing data', function () {
|
|||||||
].join(''),
|
].join(''),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
test('can create native claim blob', function () {
|
test('can create claim blob', function () {
|
||||||
const channel =
|
const channel =
|
||||||
'43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1'
|
'43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1'
|
||||||
const amount = '1000'
|
const amount = '1000'
|
||||||
@@ -137,27 +137,4 @@ describe('Signing data', function () {
|
|||||||
].join(''),
|
].join(''),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
test('can create ic claim blob', function () {
|
|
||||||
const channel =
|
|
||||||
'43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1'
|
|
||||||
const amount = {
|
|
||||||
issuer: 'rJZdUusLDtY9NEsGea7ijqhVrXv98rYBYN',
|
|
||||||
currency: 'USD',
|
|
||||||
value: '10',
|
|
||||||
}
|
|
||||||
const json = { channel, amount }
|
|
||||||
const actual = encodeForSigningClaim(json)
|
|
||||||
expect(actual).toBe(
|
|
||||||
[
|
|
||||||
// hash prefix
|
|
||||||
'434C4D00',
|
|
||||||
// channel ID
|
|
||||||
'43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1',
|
|
||||||
// amount as a uint64
|
|
||||||
'D4C38D7EA4C680000000000000000000000000005553440000000000C0A5ABEF',
|
|
||||||
// amount as a uint64
|
|
||||||
'242802EFED4B041E8F2D4A8CC86AE3D1',
|
|
||||||
].join(''),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ripple-keypairs",
|
"name": "ripple-keypairs",
|
||||||
"version": "1.2.0",
|
"version": "1.1.4",
|
||||||
"description": "Cryptographic key pairs for the XRP Ledger",
|
"description": "Cryptographic key pairs for the XRP Ledger",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -b",
|
"build": "tsc -b",
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ Wallet.fromMmnemonic()
|
|||||||
### Added
|
### Added
|
||||||
* Optional custom amount field to `fundWallet`.
|
* Optional custom amount field to `fundWallet`.
|
||||||
* Support for `disallowIncoming` account set flags (e.g. `asfDisallowIncomingTrustline`)
|
* Support for `disallowIncoming` account set flags (e.g. `asfDisallowIncomingTrustline`)
|
||||||
* Support for the cross-chain bridge feature.
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Add support for Transaction objects in `verifyTransaction`
|
* Add support for Transaction objects in `verifyTransaction`
|
||||||
@@ -50,9 +49,6 @@ Wallet.fromMmnemonic()
|
|||||||
* `Wallet.fromMnemonic` detects when an invalid encoding is provided, and throws an error
|
* `Wallet.fromMnemonic` detects when an invalid encoding is provided, and throws an error
|
||||||
* Made unexpected errors in `submitAndWait` more verbose to make them easier to debug.
|
* Made unexpected errors in `submitAndWait` more verbose to make them easier to debug.
|
||||||
|
|
||||||
### Added
|
|
||||||
* Support for Automated Market Maker (AMM) transactions and requests as defined in XLS-30.
|
|
||||||
|
|
||||||
## 2.3.1 (2022-06-27)
|
## 2.3.1 (2022-06-27)
|
||||||
### Fixed
|
### Fixed
|
||||||
* Signing tx with standard currency codes with lowercase and allowed symbols causing an error on decode.
|
* Signing tx with standard currency codes with lowercase and allowed symbols causing an error on decode.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xrpl",
|
"name": "xrpl",
|
||||||
"version": "2.7.0-beta.3",
|
"version": "2.6.0",
|
||||||
"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": [
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
"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.4",
|
"ripple-address-codec": "^4.2.4",
|
||||||
"ripple-binary-codec": "^1.5.0-beta.3",
|
"ripple-binary-codec": "^1.4.2",
|
||||||
"ripple-keypairs": "^1.2.0",
|
"ripple-keypairs": "^1.1.4",
|
||||||
"ws": "^8.2.2"
|
"ws": "^8.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import {
|
|||||||
AccountOffersResponse,
|
AccountOffersResponse,
|
||||||
AccountTxRequest,
|
AccountTxRequest,
|
||||||
AccountTxResponse,
|
AccountTxResponse,
|
||||||
// AMM methods
|
|
||||||
AMMInfoRequest,
|
|
||||||
AMMInfoResponse,
|
|
||||||
GatewayBalancesRequest,
|
GatewayBalancesRequest,
|
||||||
GatewayBalancesResponse,
|
GatewayBalancesResponse,
|
||||||
NoRippleCheckRequest,
|
NoRippleCheckRequest,
|
||||||
@@ -302,7 +299,6 @@ class Client extends EventEmitter {
|
|||||||
): Promise<AccountObjectsResponse>
|
): Promise<AccountObjectsResponse>
|
||||||
public async request(r: AccountOffersRequest): Promise<AccountOffersResponse>
|
public async request(r: AccountOffersRequest): Promise<AccountOffersResponse>
|
||||||
public async request(r: AccountTxRequest): Promise<AccountTxResponse>
|
public async request(r: AccountTxRequest): Promise<AccountTxResponse>
|
||||||
public async request(r: AMMInfoRequest): Promise<AMMInfoResponse>
|
|
||||||
public async request(r: BookOffersRequest): Promise<BookOffersResponse>
|
public async request(r: BookOffersRequest): Promise<BookOffersResponse>
|
||||||
public async request(r: ChannelVerifyRequest): Promise<ChannelVerifyResponse>
|
public async request(r: ChannelVerifyRequest): Promise<ChannelVerifyResponse>
|
||||||
public async request(
|
public async request(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ interface XRP {
|
|||||||
currency: 'XRP'
|
currency: 'XRP'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IssuedCurrency {
|
interface IssuedCurrency {
|
||||||
currency: string
|
currency: string
|
||||||
issuer: string
|
issuer: string
|
||||||
}
|
}
|
||||||
@@ -117,10 +117,3 @@ export interface NFTOffer {
|
|||||||
destination?: string
|
destination?: string
|
||||||
expiration?: number
|
expiration?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface XChainBridge {
|
|
||||||
LockingChainDoor: string
|
|
||||||
LockingChainIssue: Currency
|
|
||||||
IssuingChainDoor: string
|
|
||||||
IssuingChainIssue: Currency
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
|
||||||
|
|
||||||
export default interface Bridge extends BaseLedgerEntry {
|
|
||||||
LedgerEntryType: 'Bridge'
|
|
||||||
|
|
||||||
Account: string
|
|
||||||
|
|
||||||
SignatureReward: Amount
|
|
||||||
|
|
||||||
MinAccountCreateAmount?: string
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
XChainClaimID: string
|
|
||||||
|
|
||||||
XChainAccountCreateCount: number
|
|
||||||
|
|
||||||
XChainAccountClaimCount: Amount
|
|
||||||
/**
|
|
||||||
* A bit-map of boolean flags. No flags are defined for Bridges, so this value
|
|
||||||
* is always 0.
|
|
||||||
*/
|
|
||||||
Flags: 0
|
|
||||||
/**
|
|
||||||
* A hint indicating which page of the sender's owner directory links to this
|
|
||||||
* object, in case the directory consists of multiple pages.
|
|
||||||
*/
|
|
||||||
OwnerNode: string
|
|
||||||
/**
|
|
||||||
* The identifying hash of the transaction that most recently modified this
|
|
||||||
* object.
|
|
||||||
*/
|
|
||||||
PreviousTxnID: string
|
|
||||||
/**
|
|
||||||
* The index of the ledger that contains the transaction that most recently
|
|
||||||
* modified this object.
|
|
||||||
*/
|
|
||||||
PreviousTxnLgrSeq: number
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
import BaseLedgerEntry from './BaseLedgerEntry'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Escrow object type represents a held payment waiting to be
|
* The Escrow object type represents a held payment of XRP waiting to be
|
||||||
* executed or canceled.
|
* executed or canceled.
|
||||||
*
|
*
|
||||||
* @category Ledger Entries
|
* @category Ledger Entries
|
||||||
@@ -12,17 +10,17 @@ export default interface Escrow extends BaseLedgerEntry {
|
|||||||
LedgerEntryType: 'Escrow'
|
LedgerEntryType: 'Escrow'
|
||||||
/**
|
/**
|
||||||
* The address of the owner (sender) of this held payment. This is the
|
* The address of the owner (sender) of this held payment. This is the
|
||||||
* account that provided the amounts, and gets it back if the held payment is
|
* account that provided the XRP, and gets it back if the held payment is
|
||||||
* canceled.
|
* canceled.
|
||||||
*/
|
*/
|
||||||
Account: string
|
Account: string
|
||||||
/**
|
/**
|
||||||
* The destination address where the amounts are paid if the held payment is
|
* The destination address where the XRP is paid if the held payment is
|
||||||
* successful.
|
* successful.
|
||||||
*/
|
*/
|
||||||
Destination: string
|
Destination: string
|
||||||
/** The amount to be delivered by the held payment. */
|
/** The amount of XRP, in drops, to be delivered by the held payment. */
|
||||||
Amount: Amount
|
Amount: string
|
||||||
/**
|
/**
|
||||||
* A PREIMAGE-SHA-256 crypto-condition, as hexadecimal. If present, the
|
* A PREIMAGE-SHA-256 crypto-condition, as hexadecimal. If present, the
|
||||||
* EscrowFinish transaction must contain a fulfillment that satisfies this
|
* EscrowFinish transaction must contain a fulfillment that satisfies this
|
||||||
@@ -73,9 +71,4 @@ export default interface Escrow extends BaseLedgerEntry {
|
|||||||
* modified this object.
|
* modified this object.
|
||||||
*/
|
*/
|
||||||
PreviousTxnLgrSeq: number
|
PreviousTxnLgrSeq: number
|
||||||
/**
|
|
||||||
* The fee to charge when users finish an escrow, initially set on the
|
|
||||||
* creation of an escrow contract, and updated on subsequent finish transactions
|
|
||||||
*/
|
|
||||||
TransferRate?: number
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
import BaseLedgerEntry from './BaseLedgerEntry'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PayChannel object type represents a payment channel. Payment channels
|
* The PayChannel object type represents a payment channel. Payment channels
|
||||||
* enable small, rapid off-ledger payments that can be later reconciled
|
* enable small, rapid off-ledger payments of XRP that can be later reconciled
|
||||||
* with the consensus ledger. A payment channel holds a balance that can
|
* with the consensus ledger. A payment channel holds a balance of XRP that can
|
||||||
* only be paid out to a specific destination address until the channel is
|
* only be paid out to a specific destination address until the channel is
|
||||||
* closed.
|
* closed.
|
||||||
*
|
*
|
||||||
@@ -20,37 +18,37 @@ export default interface PayChannel extends BaseLedgerEntry {
|
|||||||
Account: string
|
Account: string
|
||||||
/**
|
/**
|
||||||
* The destination address for this payment channel. While the payment
|
* The destination address for this payment channel. While the payment
|
||||||
* channel is open, this address is the only one that can receive amounts from the
|
* channel is open, this address is the only one that can receive XRP from the
|
||||||
* channel. This comes from the Destination field of the transaction that
|
* channel. This comes from the Destination field of the transaction that
|
||||||
* created the channel.
|
* created the channel.
|
||||||
*/
|
*/
|
||||||
Destination: string
|
Destination: string
|
||||||
/**
|
/**
|
||||||
* Total amount that has been allocated to this channel. This includes amounts
|
* Total XRP, in drops, that has been allocated to this channel. This
|
||||||
* that have been paid to the destination address. This is initially set by the
|
* includes XRP that has been paid to the destination address. This is
|
||||||
* transaction that created the channel and can be increased if the source
|
* initially set by the transaction that created the channel and can be
|
||||||
* address sends a PaymentChannelFund transaction.
|
* increased if the source address sends a PaymentChannelFund transaction.
|
||||||
*/
|
*/
|
||||||
Amount: Amount
|
Amount: string
|
||||||
/**
|
/**
|
||||||
* Total amount already paid out by the channel. The difference between this value
|
* Total XRP, in drops, already paid out by the channel. The difference
|
||||||
* and the Amount field is how much can still be paid to the destination address
|
* between this value and the Amount field is how much XRP can still be paid
|
||||||
* with PaymentChannelClaim transactions. If the channel closes, the remaining
|
* to the destination address with PaymentChannelClaim transactions. If the
|
||||||
* difference is returned to the source address.
|
* channel closes, the remaining difference is returned to the source address.
|
||||||
*/
|
*/
|
||||||
Balance: Amount
|
Balance: string
|
||||||
/**
|
/**
|
||||||
* Public key, in hexadecimal, of the key pair that can be used to sign
|
* Public key, in hexadecimal, of the key pair that can be used to sign
|
||||||
* claims against this channel. This can be any valid secp256k1 or Ed25519
|
* claims against this channel. This can be any valid secp256k1 or Ed25519
|
||||||
* public key. This is set by the transaction that created the channel and
|
* public key. This is set by the transaction that created the channel and
|
||||||
* must match the public key used in claims against the channel. The channel
|
* must match the public key used in claims against the channel. The channel
|
||||||
* source address can also send amounts from this channel to the destination
|
* source address can also send XRP from this channel to the destination
|
||||||
* without signed claims.
|
* without signed claims.
|
||||||
*/
|
*/
|
||||||
PublicKey: string
|
PublicKey: string
|
||||||
/**
|
/**
|
||||||
* Number of seconds the source address must wait to close the channel if
|
* Number of seconds the source address must wait to close the channel if
|
||||||
* it still has any amount in it. Smaller values mean that the destination
|
* it still has any XRP in it. Smaller values mean that the destination
|
||||||
* address has less time to redeem any outstanding claims after the source
|
* address has less time to redeem any outstanding claims after the source
|
||||||
* address requests to close the channel. Can be any value that fits in a
|
* address requests to close the channel. Can be any value that fits in a
|
||||||
* 32-bit unsigned integer (0 to 2^32-1). This is set by the transaction that
|
* 32-bit unsigned integer (0 to 2^32-1). This is set by the transaction that
|
||||||
@@ -106,10 +104,4 @@ export default interface PayChannel extends BaseLedgerEntry {
|
|||||||
* this object, in case the directory consists of multiple pages.
|
* this object, in case the directory consists of multiple pages.
|
||||||
*/
|
*/
|
||||||
DestinationNode?: string
|
DestinationNode?: string
|
||||||
/**
|
|
||||||
* The fee to charge when users make claims on a payment channel, initially
|
|
||||||
* set on the creation of a payment channel and updated on subsequent funding
|
|
||||||
* or claim transactions.
|
|
||||||
*/
|
|
||||||
TransferRate?: number
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
import { XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
|
||||||
|
|
||||||
export default interface XChainOwnedClaimID extends BaseLedgerEntry {
|
|
||||||
LedgerEntryType: 'XChainOwnedClaimID'
|
|
||||||
|
|
||||||
Account: string
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
XChainClaimID: string
|
|
||||||
|
|
||||||
OtherChainSource: string
|
|
||||||
// TODO: type this better
|
|
||||||
XChainClaimAttestations: object[]
|
|
||||||
|
|
||||||
SignatureReward: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A bit-map of boolean flags. No flags are defined for XChainOwnedClaimIDs,
|
|
||||||
* so this value is always 0.
|
|
||||||
*/
|
|
||||||
Flags: 0
|
|
||||||
/**
|
|
||||||
* A hint indicating which page of the sender's owner directory links to this
|
|
||||||
* object, in case the directory consists of multiple pages.
|
|
||||||
*/
|
|
||||||
OwnerNode: string
|
|
||||||
/**
|
|
||||||
* The identifying hash of the transaction that most recently modified this
|
|
||||||
* object.
|
|
||||||
*/
|
|
||||||
PreviousTxnID: string
|
|
||||||
/**
|
|
||||||
* The index of the ledger that contains the transaction that most recently
|
|
||||||
* modified this object.
|
|
||||||
*/
|
|
||||||
PreviousTxnLgrSeq: number
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
|
||||||
|
|
||||||
export default interface XChainOwnedCreateAccountClaimID
|
|
||||||
extends BaseLedgerEntry {
|
|
||||||
LedgerEntryType: 'XChainOwnedCreateAccountClaimID'
|
|
||||||
|
|
||||||
Account: string
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
XChainAccountCreateCount: number
|
|
||||||
// TODO: type this better
|
|
||||||
XChainCreateAccountAttestations: object[]
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A bit-map of boolean flags. No flags are defined for,
|
|
||||||
* XChainOwnedCreateAccountClaimIDs, so this value is always 0.
|
|
||||||
*/
|
|
||||||
Flags: 0
|
|
||||||
/**
|
|
||||||
* A hint indicating which page of the sender's owner directory links to this
|
|
||||||
* object, in case the directory consists of multiple pages.
|
|
||||||
*/
|
|
||||||
OwnerNode: string
|
|
||||||
/**
|
|
||||||
* The identifying hash of the transaction that most recently modified this
|
|
||||||
* object.
|
|
||||||
*/
|
|
||||||
PreviousTxnID: string
|
|
||||||
/**
|
|
||||||
* The index of the ledger that contains the transaction that most recently
|
|
||||||
* modified this object.
|
|
||||||
*/
|
|
||||||
PreviousTxnLgrSeq: number
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ import AccountRoot, {
|
|||||||
AccountRootFlagsInterface,
|
AccountRootFlagsInterface,
|
||||||
} from './AccountRoot'
|
} from './AccountRoot'
|
||||||
import Amendments from './Amendments'
|
import Amendments from './Amendments'
|
||||||
import Bridge from './Bridge'
|
|
||||||
import Check from './Check'
|
import Check from './Check'
|
||||||
import DepositPreauth from './DepositPreauth'
|
import DepositPreauth from './DepositPreauth'
|
||||||
import DirectoryNode from './DirectoryNode'
|
import DirectoryNode from './DirectoryNode'
|
||||||
@@ -18,15 +17,12 @@ import PayChannel from './PayChannel'
|
|||||||
import RippleState, { RippleStateFlags } from './RippleState'
|
import RippleState, { RippleStateFlags } from './RippleState'
|
||||||
import SignerList, { SignerListFlags } from './SignerList'
|
import SignerList, { SignerListFlags } from './SignerList'
|
||||||
import Ticket from './Ticket'
|
import Ticket from './Ticket'
|
||||||
import XChainOwnedClaimID from './XChainOwnedClaimID'
|
|
||||||
import XChainOwnedCreateAccountClaimID from './XChainOwnedCreateAccountClaimID'
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AccountRoot,
|
AccountRoot,
|
||||||
AccountRootFlags,
|
AccountRootFlags,
|
||||||
AccountRootFlagsInterface,
|
AccountRootFlagsInterface,
|
||||||
Amendments,
|
Amendments,
|
||||||
Bridge,
|
|
||||||
Check,
|
Check,
|
||||||
DepositPreauth,
|
DepositPreauth,
|
||||||
DirectoryNode,
|
DirectoryNode,
|
||||||
@@ -44,6 +40,4 @@ export {
|
|||||||
SignerList,
|
SignerList,
|
||||||
SignerListFlags,
|
SignerListFlags,
|
||||||
Ticket,
|
Ticket,
|
||||||
XChainOwnedClaimID,
|
|
||||||
XChainOwnedCreateAccountClaimID,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Amount, LedgerIndex } from '../common'
|
import { LedgerIndex } from '../common'
|
||||||
|
|
||||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
interface Channel {
|
interface Channel {
|
||||||
account: string
|
account: string
|
||||||
amount: Amount
|
amount: string
|
||||||
balance: string
|
balance: string
|
||||||
channel_id: string
|
channel_id: string
|
||||||
destination_account: string
|
destination_account: string
|
||||||
@@ -15,7 +15,6 @@ interface Channel {
|
|||||||
cancel_after?: number
|
cancel_after?: number
|
||||||
source_tab?: number
|
source_tab?: number
|
||||||
destination_tag?: number
|
destination_tag?: number
|
||||||
transfer_rate?: number
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Amount, LedgerIndex } from '../common'
|
import { LedgerIndex } from '../common'
|
||||||
|
|
||||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
@@ -64,14 +64,6 @@ export interface Trustline {
|
|||||||
* false.
|
* false.
|
||||||
*/
|
*/
|
||||||
freeze_peer?: boolean
|
freeze_peer?: boolean
|
||||||
/**
|
|
||||||
* The total amount of FT, in drops/Amount locked in payment channels or escrow.
|
|
||||||
*/
|
|
||||||
locked_balance?: Amount
|
|
||||||
/**
|
|
||||||
* The total number of lock balances on a RippleState ledger object.
|
|
||||||
*/
|
|
||||||
lock_count?: number
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import {
|
|||||||
RippleState,
|
RippleState,
|
||||||
SignerList,
|
SignerList,
|
||||||
Ticket,
|
Ticket,
|
||||||
XChainOwnedClaimID,
|
|
||||||
XChainOwnedCreateAccountClaimID,
|
|
||||||
} from '../ledger'
|
} from '../ledger'
|
||||||
|
|
||||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
@@ -24,8 +22,6 @@ type AccountObjectType =
|
|||||||
| 'signer_list'
|
| 'signer_list'
|
||||||
| 'state'
|
| 'state'
|
||||||
| 'ticket'
|
| 'ticket'
|
||||||
| 'xchain_create_account_claim_id'
|
|
||||||
| 'xchain_claim_id'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The account_objects command returns the raw ledger format for all objects
|
* The account_objects command returns the raw ledger format for all objects
|
||||||
@@ -82,8 +78,6 @@ type AccountObject =
|
|||||||
| SignerList
|
| SignerList
|
||||||
| RippleState
|
| RippleState
|
||||||
| Ticket
|
| Ticket
|
||||||
| XChainOwnedClaimID
|
|
||||||
| XChainOwnedCreateAccountClaimID
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response expected from an {@link AccountObjectsRequest}.
|
* Response expected from an {@link AccountObjectsRequest}.
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
import { Amount, Currency, IssuedCurrencyAmount } from '../common'
|
|
||||||
|
|
||||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The `amm_info` command retrieves information about an AMM instance.
|
|
||||||
* Returns an {@link AMMInfoResponse}.
|
|
||||||
*
|
|
||||||
* @category Requests
|
|
||||||
*/
|
|
||||||
export interface AMMInfoRequest extends BaseRequest {
|
|
||||||
command: 'amm_info'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
* Both asset and asset2 must be defined to specify an AMM instance.
|
|
||||||
*/
|
|
||||||
asset: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance.
|
|
||||||
* Both asset and asset2 must be defined to specify an AMM instance.
|
|
||||||
*/
|
|
||||||
asset2: Currency
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AuthAccount {
|
|
||||||
account: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface VoteEntry {
|
|
||||||
account: string
|
|
||||||
trading_fee: number
|
|
||||||
vote_weight: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Response expected from an {@link AMMInfoRequest}.
|
|
||||||
*
|
|
||||||
* @category Responses
|
|
||||||
*/
|
|
||||||
export interface AMMInfoResponse extends BaseResponse {
|
|
||||||
result: {
|
|
||||||
amm: {
|
|
||||||
/**
|
|
||||||
* The account that tracks the balance of LPTokens between the AMM instance via Trustline.
|
|
||||||
*/
|
|
||||||
amm_account: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
*/
|
|
||||||
amount: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The other pool asset of the AMM instance.
|
|
||||||
*/
|
|
||||||
amount2: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Omitted for XRP) If true, the amount currency is currently frozen for asset.
|
|
||||||
*/
|
|
||||||
asset_frozen: boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Omitted for XRP) If true, the amount currency is currently frozen for asset2.
|
|
||||||
*/
|
|
||||||
asset2_frozen: boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Details of the current owner of the auction slot.
|
|
||||||
*/
|
|
||||||
auction_slot?: {
|
|
||||||
/**
|
|
||||||
* The current owner of this auction slot.
|
|
||||||
*/
|
|
||||||
account: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of at most 4 additional accounts that are authorized to trade at the discounted fee for this AMM instance.
|
|
||||||
*/
|
|
||||||
auth_accounts: AuthAccount[]
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The trading fee to be charged to the auction owner, in the same format as TradingFee.
|
|
||||||
* By default this is 0, meaning that the auction owner can trade at no fee instead of the standard fee for this AMM.
|
|
||||||
*/
|
|
||||||
discounted_fee: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time when this slot expires, in seconds since the Ripple Epoch.
|
|
||||||
*/
|
|
||||||
expiration: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The amount the auction owner paid to win this slot, in LPTokens.
|
|
||||||
*/
|
|
||||||
price: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Total slot time of 24-hours is divided into 20 equal time intervals.
|
|
||||||
*/
|
|
||||||
time_interval: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The total outstanding balance of liquidity provider tokens from this AMM instance.
|
|
||||||
* The holders of these tokens can vote on the AMM's trading fee in proportion to their holdings,
|
|
||||||
* or redeem the tokens for a share of the AMM's assets which grows with the trading fees collected.
|
|
||||||
*/
|
|
||||||
lp_token: IssuedCurrencyAmount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the fee, in basis point, to be charged to the traders for the trades
|
|
||||||
* executed against the AMM instance. Trading fee is a percentage of the trading volume.
|
|
||||||
* Valid values for this field are between 0 and 1000 inclusive.
|
|
||||||
* A value of 1 is equivalent to 1/10 bps or 0.001%, allowing trading fee
|
|
||||||
* between 0% and 1%. This field is required.
|
|
||||||
*/
|
|
||||||
trading_fee: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Keeps a track of up to eight active votes for the instance.
|
|
||||||
*/
|
|
||||||
vote_slots?: VoteEntry[]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The identifying hash of the ledger that was used to generate this
|
|
||||||
* response.
|
|
||||||
*/
|
|
||||||
ledger_hash?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ledger index of the ledger version that was used to generate this
|
|
||||||
* response.
|
|
||||||
*/
|
|
||||||
ledger_index?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If included and set to true, the information in this response comes from
|
|
||||||
* a validated ledger version. Otherwise, the information is subject to
|
|
||||||
* change.
|
|
||||||
*/
|
|
||||||
validated?: boolean
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ import { BaseRequest, BaseResponse } from './baseMethod'
|
|||||||
*/
|
*/
|
||||||
export interface ChannelVerifyRequest extends BaseRequest {
|
export interface ChannelVerifyRequest extends BaseRequest {
|
||||||
command: 'channel_verify'
|
command: 'channel_verify'
|
||||||
/** The amount the provided signature authorizes. */
|
/** The amount of XRP, in drops, the provided signature authorizes. */
|
||||||
amount: string
|
amount: string
|
||||||
/**
|
/**
|
||||||
* The Channel ID of the channel that provides the XRP. This is a
|
* The Channel ID of the channel that provides the XRP. This is a
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
AccountOffersResponse,
|
AccountOffersResponse,
|
||||||
} from './accountOffers'
|
} from './accountOffers'
|
||||||
import { AccountTxRequest, AccountTxResponse } from './accountTx'
|
import { AccountTxRequest, AccountTxResponse } from './accountTx'
|
||||||
import { AMMInfoRequest, AMMInfoResponse } from './ammInfo'
|
|
||||||
import { ErrorResponse } from './baseMethod'
|
import { ErrorResponse } from './baseMethod'
|
||||||
import { BookOffersRequest, BookOffer, BookOffersResponse } from './bookOffers'
|
import { BookOffersRequest, BookOffer, BookOffersResponse } from './bookOffers'
|
||||||
import { ChannelVerifyRequest, ChannelVerifyResponse } from './channelVerify'
|
import { ChannelVerifyRequest, ChannelVerifyResponse } from './channelVerify'
|
||||||
@@ -88,7 +87,6 @@ type Request =
|
|||||||
| AccountObjectsRequest
|
| AccountObjectsRequest
|
||||||
| AccountOffersRequest
|
| AccountOffersRequest
|
||||||
| AccountTxRequest
|
| AccountTxRequest
|
||||||
| AMMInfoRequest
|
|
||||||
| GatewayBalancesRequest
|
| GatewayBalancesRequest
|
||||||
| NoRippleCheckRequest
|
| NoRippleCheckRequest
|
||||||
// ledger methods
|
// ledger methods
|
||||||
@@ -139,7 +137,6 @@ type Response =
|
|||||||
| AccountObjectsResponse
|
| AccountObjectsResponse
|
||||||
| AccountOffersResponse
|
| AccountOffersResponse
|
||||||
| AccountTxResponse
|
| AccountTxResponse
|
||||||
| AMMInfoResponse
|
|
||||||
| GatewayBalancesResponse
|
| GatewayBalancesResponse
|
||||||
| NoRippleCheckResponse
|
| NoRippleCheckResponse
|
||||||
// ledger methods
|
// ledger methods
|
||||||
@@ -198,8 +195,6 @@ export {
|
|||||||
AccountOffersResponse,
|
AccountOffersResponse,
|
||||||
AccountTxRequest,
|
AccountTxRequest,
|
||||||
AccountTxResponse,
|
AccountTxResponse,
|
||||||
AMMInfoRequest,
|
|
||||||
AMMInfoResponse,
|
|
||||||
GatewayBalancesRequest,
|
GatewayBalancesRequest,
|
||||||
GatewayBalancesResponse,
|
GatewayBalancesResponse,
|
||||||
NoRippleCheckRequest,
|
NoRippleCheckRequest,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Currency, LedgerIndex } from '../common'
|
import { LedgerIndex } from '../common'
|
||||||
import { LedgerEntry } from '../ledger'
|
import { LedgerEntry } from '../ledger'
|
||||||
|
|
||||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
@@ -137,28 +137,6 @@ export interface LedgerEntryRequest extends BaseRequest {
|
|||||||
ticket_sequence: number
|
ticket_sequence: number
|
||||||
}
|
}
|
||||||
| string
|
| string
|
||||||
|
|
||||||
bridge_account?: string
|
|
||||||
|
|
||||||
xchain_claim_id?:
|
|
||||||
| {
|
|
||||||
locking_chain_door: string
|
|
||||||
locking_chain_issue: Currency
|
|
||||||
issuing_chain_door: string
|
|
||||||
issuing_chain_issue: Currency
|
|
||||||
xchain_claim_id: string | number
|
|
||||||
}
|
|
||||||
| string
|
|
||||||
|
|
||||||
xchain_create_account_claim_id?:
|
|
||||||
| {
|
|
||||||
locking_chain_door: string
|
|
||||||
locking_chain_issue: Currency
|
|
||||||
issuing_chain_door: string
|
|
||||||
issuing_chain_issue: Currency
|
|
||||||
xchain_create_account_claim_id: string | number
|
|
||||||
}
|
|
||||||
| string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -136,6 +136,10 @@ 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,106 +0,0 @@
|
|||||||
/* eslint-disable complexity -- required for validateAMMBid */
|
|
||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, Currency } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isCurrency,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
const MAX_AUTH_ACCOUNTS = 4
|
|
||||||
|
|
||||||
interface AuthAccount {
|
|
||||||
AuthAccount: {
|
|
||||||
Account: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMBid is used for submitting a vote for the trading fee of an AMM Instance.
|
|
||||||
*
|
|
||||||
* Any XRPL account that holds LPToken for an AMM instance may submit this
|
|
||||||
* transaction to vote for the trading fee for that instance.
|
|
||||||
*/
|
|
||||||
export interface AMMBid extends BaseTransaction {
|
|
||||||
TransactionType: 'AMMBid'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset2: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This field represents the minimum price that the bidder wants to pay for the slot.
|
|
||||||
* It is specified in units of LPToken. If specified let BidMin be X and let
|
|
||||||
* the slot-price computed by price scheduling algorithm be Y, then bidder always pays
|
|
||||||
* the max(X, Y).
|
|
||||||
*/
|
|
||||||
BidMin?: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This field represents the maximum price that the bidder wants to pay for the slot.
|
|
||||||
* It is specified in units of LPToken.
|
|
||||||
*/
|
|
||||||
BidMax?: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This field represents an array of XRPL account IDs that are authorized to trade
|
|
||||||
* at the discounted fee against the AMM instance.
|
|
||||||
* A maximum of four accounts can be provided.
|
|
||||||
*/
|
|
||||||
AuthAccounts?: AuthAccount[]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an AMMBid at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - An AMMBid Transaction.
|
|
||||||
* @throws When the AMMBid is Malformed.
|
|
||||||
*/
|
|
||||||
export function validateAMMBid(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Asset == null) {
|
|
||||||
throw new ValidationError('AMMBid: missing field Asset')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset)) {
|
|
||||||
throw new ValidationError('AMMBid: Asset must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Asset2 == null) {
|
|
||||||
throw new ValidationError('AMMBid: missing field Asset2')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset2)) {
|
|
||||||
throw new ValidationError('AMMBid: Asset2 must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.BidMin != null && !isAmount(tx.BidMin)) {
|
|
||||||
throw new ValidationError('AMMBid: BidMin must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.BidMax != null && !isAmount(tx.BidMax)) {
|
|
||||||
throw new ValidationError('AMMBid: BidMax must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.AuthAccounts != null) {
|
|
||||||
if (!Array.isArray(tx.AuthAccounts)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
`AMMBid: AuthAccounts must be an AuthAccount array`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (tx.AuthAccounts.length > MAX_AUTH_ACCOUNTS) {
|
|
||||||
throw new ValidationError(
|
|
||||||
`AMMBid: AuthAccounts length must not be greater than ${MAX_AUTH_ACCOUNTS}`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
|
|
||||||
|
|
||||||
export const AMM_MAX_TRADING_FEE = 1000
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMCreate is used to create AccountRoot and the corresponding
|
|
||||||
* AMM ledger entries.
|
|
||||||
*
|
|
||||||
* This allows for the creation of only one AMM instance per unique asset pair.
|
|
||||||
*/
|
|
||||||
export interface AMMCreate extends BaseTransaction {
|
|
||||||
TransactionType: 'AMMCreate'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
*/
|
|
||||||
Amount: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance.
|
|
||||||
*/
|
|
||||||
Amount2: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the fee, in basis point, to be charged
|
|
||||||
* to the traders for the trades executed against the AMM instance.
|
|
||||||
* Trading fee is a percentage of the trading volume.
|
|
||||||
* Valid values for this field are between 0 and 1000 inclusive.
|
|
||||||
* A value of 1 is equivalent to 1/10 bps or 0.001%, allowing trading fee
|
|
||||||
* between 0% and 1%.
|
|
||||||
*/
|
|
||||||
TradingFee: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an AMMCreate at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - An AMMCreate Transaction.
|
|
||||||
* @throws When the AMMCreate is Malformed.
|
|
||||||
*/
|
|
||||||
export function validateAMMCreate(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Amount == null) {
|
|
||||||
throw new ValidationError('AMMCreate: missing field Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('AMMCreate: Amount must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount2 == null) {
|
|
||||||
throw new ValidationError('AMMCreate: missing field Amount2')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount2)) {
|
|
||||||
throw new ValidationError('AMMCreate: Amount2 must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.TradingFee == null) {
|
|
||||||
throw new ValidationError('AMMCreate: missing field TradingFee')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.TradingFee !== 'number') {
|
|
||||||
throw new ValidationError('AMMCreate: TradingFee must be a number')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.TradingFee < 0 || tx.TradingFee > AMM_MAX_TRADING_FEE) {
|
|
||||||
throw new ValidationError(
|
|
||||||
`AMMCreate: TradingFee must be between 0 and ${AMM_MAX_TRADING_FEE}`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
/* eslint-disable complexity -- required for validateAMMDeposit */
|
|
||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, Currency, IssuedCurrencyAmount } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
GlobalFlags,
|
|
||||||
isAmount,
|
|
||||||
isCurrency,
|
|
||||||
isIssuedCurrency,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enum representing values for AMMDeposit Transaction Flags.
|
|
||||||
*
|
|
||||||
* @category Transaction Flags
|
|
||||||
*/
|
|
||||||
export enum AMMDepositFlags {
|
|
||||||
tfLPToken = 0x00010000,
|
|
||||||
tfSingleAsset = 0x00080000,
|
|
||||||
tfTwoAsset = 0x00100000,
|
|
||||||
tfOneAssetLPToken = 0x00200000,
|
|
||||||
tfLimitLPToken = 0x00400000,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AMMDepositFlagsInterface extends GlobalFlags {
|
|
||||||
tfLPToken?: boolean
|
|
||||||
tfSingleAsset?: boolean
|
|
||||||
tfTwoAsset?: boolean
|
|
||||||
tfOneAssetLPToken?: boolean
|
|
||||||
tfLimitLPToken?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMDeposit is the deposit transaction used to add liquidity to the AMM instance pool,
|
|
||||||
* thus obtaining some share of the instance's pools in the form of LPTokenOut.
|
|
||||||
*
|
|
||||||
* The following are the recommended valid combinations:
|
|
||||||
* - LPTokenOut
|
|
||||||
* - Amount
|
|
||||||
* - Amount and Amount2
|
|
||||||
* - Amount and LPTokenOut
|
|
||||||
* - Amount and EPrice
|
|
||||||
*/
|
|
||||||
export interface AMMDeposit extends BaseTransaction {
|
|
||||||
TransactionType: 'AMMDeposit'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset2: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the amount of shares of the AMM instance pools that the trader
|
|
||||||
* wants to redeem or trade in.
|
|
||||||
*/
|
|
||||||
LPTokenOut?: IssuedCurrencyAmount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance to
|
|
||||||
* deposit more of its value.
|
|
||||||
*/
|
|
||||||
Amount?: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance to deposit more of
|
|
||||||
* its value.
|
|
||||||
*/
|
|
||||||
Amount2?: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the maximum effective-price that LPTokenOut can be traded out.
|
|
||||||
*/
|
|
||||||
EPrice?: Amount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an AMMDeposit at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - An AMMDeposit Transaction.
|
|
||||||
* @throws When the AMMDeposit is Malformed.
|
|
||||||
*/
|
|
||||||
export function validateAMMDeposit(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Asset == null) {
|
|
||||||
throw new ValidationError('AMMDeposit: missing field Asset')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset)) {
|
|
||||||
throw new ValidationError('AMMDeposit: Asset must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Asset2 == null) {
|
|
||||||
throw new ValidationError('AMMDeposit: missing field Asset2')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset2)) {
|
|
||||||
throw new ValidationError('AMMDeposit: Asset2 must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount2 != null && tx.Amount == null) {
|
|
||||||
throw new ValidationError('AMMDeposit: must set Amount with Amount2')
|
|
||||||
} else if (tx.EPrice != null && tx.Amount == null) {
|
|
||||||
throw new ValidationError('AMMDeposit: must set Amount with EPrice')
|
|
||||||
} else if (tx.LPTokenOut == null && tx.Amount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'AMMDeposit: must set at least LPTokenOut or Amount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.LPTokenOut != null && !isIssuedCurrency(tx.LPTokenOut)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount != null && !isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('AMMDeposit: Amount must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount2 != null && !isAmount(tx.Amount2)) {
|
|
||||||
throw new ValidationError('AMMDeposit: Amount2 must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.EPrice != null && !isAmount(tx.EPrice)) {
|
|
||||||
throw new ValidationError('AMMDeposit: EPrice must be an Amount')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Currency } from '../common'
|
|
||||||
|
|
||||||
import { AMM_MAX_TRADING_FEE } from './AMMCreate'
|
|
||||||
import { BaseTransaction, isCurrency, validateBaseTransaction } from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMVote is used for submitting a vote for the trading fee of an AMM Instance.
|
|
||||||
*
|
|
||||||
* Any XRPL account that holds LPToken for an AMM instance may submit this
|
|
||||||
* transaction to vote for the trading fee for that instance.
|
|
||||||
*/
|
|
||||||
export interface AMMVote extends BaseTransaction {
|
|
||||||
TransactionType: 'AMMVote'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset2: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the fee, in basis point.
|
|
||||||
* Valid values for this field are between 0 and 1000 inclusive.
|
|
||||||
* A value of 1 is equivalent to 1/10 bps or 0.001%, allowing trading fee
|
|
||||||
* between 0% and 1%. This field is required.
|
|
||||||
*/
|
|
||||||
TradingFee: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an AMMVote at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - An AMMVote Transaction.
|
|
||||||
* @throws When the AMMVote is Malformed.
|
|
||||||
*/
|
|
||||||
export function validateAMMVote(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Asset == null) {
|
|
||||||
throw new ValidationError('AMMVote: missing field Asset')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset)) {
|
|
||||||
throw new ValidationError('AMMVote: Asset must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Asset2 == null) {
|
|
||||||
throw new ValidationError('AMMVote: missing field Asset2')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset2)) {
|
|
||||||
throw new ValidationError('AMMVote: Asset2 must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.TradingFee == null) {
|
|
||||||
throw new ValidationError('AMMVote: missing field TradingFee')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.TradingFee !== 'number') {
|
|
||||||
throw new ValidationError('AMMVote: TradingFee must be a number')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.TradingFee < 0 || tx.TradingFee > AMM_MAX_TRADING_FEE) {
|
|
||||||
throw new ValidationError(
|
|
||||||
`AMMVote: TradingFee must be between 0 and ${AMM_MAX_TRADING_FEE}`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
/* eslint-disable complexity -- required for validateAMMWithdraw */
|
|
||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, Currency, IssuedCurrencyAmount } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
GlobalFlags,
|
|
||||||
isAmount,
|
|
||||||
isCurrency,
|
|
||||||
isIssuedCurrency,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enum representing values for AMMWithdrawFlags Transaction Flags.
|
|
||||||
*
|
|
||||||
* @category Transaction Flags
|
|
||||||
*/
|
|
||||||
export enum AMMWithdrawFlags {
|
|
||||||
tfLPToken = 0x00010000,
|
|
||||||
tfWithdrawAll = 0x00020000,
|
|
||||||
tfOneAssetWithdrawAll = 0x00040000,
|
|
||||||
tfSingleAsset = 0x00080000,
|
|
||||||
tfTwoAsset = 0x00100000,
|
|
||||||
tfOneAssetLPToken = 0x00200000,
|
|
||||||
tfLimitLPToken = 0x00400000,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AMMWithdrawFlagsInterface extends GlobalFlags {
|
|
||||||
tfLPToken?: boolean
|
|
||||||
tfWithdrawAll?: boolean
|
|
||||||
tfOneAssetWithdrawAll?: boolean
|
|
||||||
tfSingleAsset?: boolean
|
|
||||||
tfTwoAsset?: boolean
|
|
||||||
tfOneAssetLPToken?: boolean
|
|
||||||
tfLimitLPToken?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMWithdraw is the withdraw transaction used to remove liquidity from the AMM
|
|
||||||
* instance pool, thus redeeming some share of the pools that one owns in the form
|
|
||||||
* of LPTokenIn.
|
|
||||||
*
|
|
||||||
* The following are the recommended valid combinations:
|
|
||||||
* - LPTokenIn
|
|
||||||
* - Amount
|
|
||||||
* - Amount and Amount2
|
|
||||||
* - Amount and LPTokenIn
|
|
||||||
* - Amount and EPrice
|
|
||||||
*/
|
|
||||||
export interface AMMWithdraw extends BaseTransaction {
|
|
||||||
TransactionType: 'AMMWithdraw'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pool assets (XRP or token) of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset of the AMM instance.
|
|
||||||
*/
|
|
||||||
Asset2: Currency
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the amount of shares of the AMM instance pools that the trader
|
|
||||||
* wants to redeem or trade in.
|
|
||||||
*/
|
|
||||||
LPTokenIn?: IssuedCurrencyAmount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies one of the pools assets that the trader wants to remove.
|
|
||||||
* If the asset is XRP, then the Amount is a string specifying the number of drops.
|
|
||||||
* Otherwise it is an IssuedCurrencyAmount object.
|
|
||||||
*/
|
|
||||||
Amount?: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the other pool asset that the trader wants to remove.
|
|
||||||
*/
|
|
||||||
Amount2?: Amount
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the effective-price of the token out after successful execution of
|
|
||||||
* the transaction.
|
|
||||||
*/
|
|
||||||
EPrice?: Amount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an AMMWithdraw at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - An AMMWithdraw Transaction.
|
|
||||||
* @throws When the AMMWithdraw is Malformed.
|
|
||||||
*/
|
|
||||||
export function validateAMMWithdraw(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Asset == null) {
|
|
||||||
throw new ValidationError('AMMWithdraw: missing field Asset')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset)) {
|
|
||||||
throw new ValidationError('AMMWithdraw: Asset must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Asset2 == null) {
|
|
||||||
throw new ValidationError('AMMWithdraw: missing field Asset2')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCurrency(tx.Asset2)) {
|
|
||||||
throw new ValidationError('AMMWithdraw: Asset2 must be an Issue')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount2 != null && tx.Amount == null) {
|
|
||||||
throw new ValidationError('AMMWithdraw: must set Amount with Amount2')
|
|
||||||
} else if (tx.EPrice != null && tx.Amount == null) {
|
|
||||||
throw new ValidationError('AMMWithdraw: must set Amount with EPrice')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.LPTokenIn != null && !isIssuedCurrency(tx.LPTokenIn)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount != null && !isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('AMMWithdraw: Amount must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount2 != null && !isAmount(tx.Amount2)) {
|
|
||||||
throw new ValidationError('AMMWithdraw: Amount2 must be an Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.EPrice != null && !isAmount(tx.EPrice)) {
|
|
||||||
throw new ValidationError('AMMWithdraw: EPrice must be an Amount')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainAccountCreateCommit extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainAccountCreateCommit'
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
SignatureReward: number | string
|
|
||||||
|
|
||||||
Destination: string
|
|
||||||
|
|
||||||
Amount: Amount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainAccountCreateCommit at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainAccountCreateCommit Transaction.
|
|
||||||
* @throws When the XChainAccountCreateCommit is malformed.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line max-lines-per-function -- okay for this function, there's a lot of things to check
|
|
||||||
export function validateXChainAccountCreateCommit(
|
|
||||||
tx: Record<string, unknown>,
|
|
||||||
): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAccountCreateCommit: missing field XChainBridge',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAccountCreateCommit: invalid field XChainBridge',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.SignatureReward == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAccountCreateCommit: missing field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof tx.SignatureReward !== 'number' &&
|
|
||||||
typeof tx.SignatureReward !== 'string'
|
|
||||||
) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAccountCreateCommit: invalid field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Destination == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAccountCreateCommit: missing field Destination',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.Destination !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAccountCreateCommit: invalid field Destination',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount == null) {
|
|
||||||
throw new ValidationError('XChainAccountCreateCommit: missing field Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('XChainAccountCreateCommit: invalid field Amount')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainAddAccountCreateAttestation extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainAddAccountCreateAttestation'
|
|
||||||
|
|
||||||
Amount: Amount
|
|
||||||
|
|
||||||
AttestationRewardAccount: string
|
|
||||||
|
|
||||||
AttestationSignerAccount: string
|
|
||||||
|
|
||||||
Destination: string
|
|
||||||
|
|
||||||
OtherChainSource: string
|
|
||||||
|
|
||||||
PublicKey: string
|
|
||||||
|
|
||||||
Signature: string
|
|
||||||
|
|
||||||
SignatureReward: Amount
|
|
||||||
|
|
||||||
WasLockingChainSend: 0 | 1
|
|
||||||
|
|
||||||
XChainAccountCreateCount: string
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainAddAccountCreateAttestation at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainAddAccountCreateAttestation Transaction.
|
|
||||||
* @throws When the XChainAddAccountCreateAttestation is malformed.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line max-lines-per-function, max-statements, complexity -- okay for this function, lots of things to check
|
|
||||||
export function validateXChainAddAccountCreateAttestation(
|
|
||||||
tx: Record<string, unknown>,
|
|
||||||
): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Amount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field Amount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field Amount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.AttestationRewardAccount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field AttestationRewardAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.AttestationRewardAccount !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field AttestationRewardAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.AttestationSignerAccount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field AttestationSignerAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.AttestationSignerAccount !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field AttestationSignerAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Destination == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field Destination',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.Destination !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field Destination',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.OtherChainSource == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field OtherChainSource',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.OtherChainSource !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field OtherChainSource',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.PublicKey == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field PublicKey',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.PublicKey !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field PublicKey',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Signature == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field Signature',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.Signature !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field Signature',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.SignatureReward == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.SignatureReward)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.WasLockingChainSend == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field WasLockingChainSend',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.WasLockingChainSend !== 0 && tx.WasLockingChainSend !== 1) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field WasLockingChainSend',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.XChainAccountCreateCount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field XChainAccountCreateCount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.XChainAccountCreateCount !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field XChainAccountCreateCount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: missing field XChainBridge',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddAccountCreateAttestation: invalid field XChainBridge',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,160 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainAddClaimAttestation extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainAddClaimAttestation'
|
|
||||||
|
|
||||||
Amount: Amount
|
|
||||||
|
|
||||||
AttestationRewardAccount: string
|
|
||||||
|
|
||||||
AttestationSignerAccount: string
|
|
||||||
|
|
||||||
Destination?: string
|
|
||||||
|
|
||||||
OtherChainSource: string
|
|
||||||
|
|
||||||
PublicKey: string
|
|
||||||
|
|
||||||
Signature: string
|
|
||||||
|
|
||||||
WasLockingChainSend: 0 | 1
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
XChainClaimID: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainAddClaimAttestation at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainAddClaimAttestation Transaction.
|
|
||||||
* @throws When the XChainAddClaimAttestation is malformed.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line max-lines-per-function, max-statements, complexity -- okay for this function, lots of things to check
|
|
||||||
export function validateXChainAddClaimAttestation(
|
|
||||||
tx: Record<string, unknown>,
|
|
||||||
): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.Amount == null) {
|
|
||||||
throw new ValidationError('XChainAddClaimAttestation: missing field Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('XChainAddClaimAttestation: invalid field Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.AttestationRewardAccount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field AttestationRewardAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.AttestationRewardAccount !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field AttestationRewardAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.AttestationSignerAccount == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field AttestationSignerAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.AttestationSignerAccount !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field AttestationSignerAccount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Destination !== undefined && typeof tx.Destination !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field Destination',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.OtherChainSource == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field OtherChainSource',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.OtherChainSource !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field OtherChainSource',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.PublicKey == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field PublicKey',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.PublicKey !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field PublicKey',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Signature == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field Signature',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.Signature !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field Signature',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.WasLockingChainSend == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field WasLockingChainSend',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.WasLockingChainSend !== 0 && tx.WasLockingChainSend !== 1) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field WasLockingChainSend',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field XChainBridge',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field XChainBridge',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.XChainClaimID == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: missing field XChainClaimID',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.XChainClaimID !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainAddClaimAttestation: invalid field XChainClaimID',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainClaim extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainClaim'
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
XChainClaimID: number | string
|
|
||||||
|
|
||||||
Destination: string
|
|
||||||
|
|
||||||
DestinationTag?: number
|
|
||||||
|
|
||||||
Amount: Amount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainClaim at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainClaim Transaction.
|
|
||||||
* @throws When the XChainClaim is malformed.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line complexity -- okay for this function, lots of things to check
|
|
||||||
export function validateXChainClaim(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError('XChainClaim: missing field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError('XChainClaim: invalid field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.XChainClaimID == null) {
|
|
||||||
throw new ValidationError('XChainClaim: missing field XChainClaimID')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof tx.XChainClaimID !== 'number' &&
|
|
||||||
typeof tx.XChainClaimID !== 'string'
|
|
||||||
) {
|
|
||||||
throw new ValidationError('XChainClaim: invalid field XChainClaimID')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Destination == null) {
|
|
||||||
throw new ValidationError('XChainClaim: missing field Destination')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.Destination !== 'string') {
|
|
||||||
throw new ValidationError('XChainClaim: invalid field Destination')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
tx.DestinationTag !== undefined &&
|
|
||||||
typeof tx.DestinationTag !== 'number'
|
|
||||||
) {
|
|
||||||
throw new ValidationError('XChainClaim: invalid field DestinationTag')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount == null) {
|
|
||||||
throw new ValidationError('XChainClaim: missing field Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('XChainClaim: invalid field Amount')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainCommit extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainCommit'
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
XChainClaimID: number | string
|
|
||||||
|
|
||||||
OtherChainDestination?: string
|
|
||||||
|
|
||||||
Amount: Amount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainCommit at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainCommit Transaction.
|
|
||||||
* @throws When the XChainCommit is malformed.
|
|
||||||
*/
|
|
||||||
export function validateXChainCommit(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError('XChainCommit: missing field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError('XChainCommit: invalid field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.XChainClaimID == null) {
|
|
||||||
throw new ValidationError('XChainCommit: missing field XChainClaimID')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof tx.XChainClaimID !== 'number' &&
|
|
||||||
typeof tx.XChainClaimID !== 'string'
|
|
||||||
) {
|
|
||||||
throw new ValidationError('XChainCommit: invalid field XChainClaimID')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
tx.OtherChainDestination !== undefined &&
|
|
||||||
typeof tx.OtherChainDestination !== 'string'
|
|
||||||
) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCommit: invalid field OtherChainDestination',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.Amount == null) {
|
|
||||||
throw new ValidationError('XChainCommit: missing field Amount')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.Amount)) {
|
|
||||||
throw new ValidationError('XChainCommit: invalid field Amount')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainCreateBridge extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainCreateBridge'
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
SignatureReward: Amount
|
|
||||||
|
|
||||||
MinAccountCreateAmount?: Amount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainCreateBridge at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainCreateBridge Transaction.
|
|
||||||
* @throws When the XChainCreateBridge is malformed.
|
|
||||||
*/
|
|
||||||
export function validateXChainCreateBridge(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError('XChainCreateBridge: missing field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError('XChainCreateBridge: invalid field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.SignatureReward == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateBridge: missing field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.SignatureReward)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateBridge: invalid field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
tx.MinAccountCreateAmount !== undefined &&
|
|
||||||
!isAmount(tx.MinAccountCreateAmount)
|
|
||||||
) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateBridge: invalid field MinAccountCreateAmount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainCreateClaimID extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainCreateClaimID'
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
SignatureReward: Amount
|
|
||||||
|
|
||||||
OtherChainSource: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainCreateClaimID at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainCreateClaimID Transaction.
|
|
||||||
* @throws When the XChainCreateClaimID is malformed.
|
|
||||||
*/
|
|
||||||
export function validateXChainCreateClaimID(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError('XChainCreateClaimID: missing field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError('XChainCreateClaimID: invalid field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.SignatureReward == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateClaimID: missing field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAmount(tx.SignatureReward)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateClaimID: invalid field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.OtherChainSource == null) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateClaimID: missing field OtherChainSource',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof tx.OtherChainSource !== 'string') {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainCreateClaimID: invalid field OtherChainSource',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
import { ValidationError } from '../../errors'
|
|
||||||
import { Amount, XChainBridge } from '../common'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseTransaction,
|
|
||||||
GlobalFlags,
|
|
||||||
isAmount,
|
|
||||||
isXChainBridge,
|
|
||||||
validateBaseTransaction,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
export enum XChainModifyBridgeFlags {
|
|
||||||
tfClearAccountCreateAmount = 0x00010000,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface XChainModifyBridgeFlagsInterface extends GlobalFlags {
|
|
||||||
tfClearAccountCreateAmount?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @category Transaction Models
|
|
||||||
*/
|
|
||||||
export interface XChainModifyBridge extends BaseTransaction {
|
|
||||||
TransactionType: 'XChainModifyBridge'
|
|
||||||
|
|
||||||
XChainBridge: XChainBridge
|
|
||||||
|
|
||||||
SignatureReward?: Amount
|
|
||||||
|
|
||||||
MinAccountCreateAmount?: Amount
|
|
||||||
|
|
||||||
Flags?: number | XChainModifyBridgeFlagsInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of a XChainModifyBridge at runtime.
|
|
||||||
*
|
|
||||||
* @param tx - A XChainModifyBridge Transaction.
|
|
||||||
* @throws When the XChainModifyBridge is malformed.
|
|
||||||
*/
|
|
||||||
export function validateXChainModifyBridge(tx: Record<string, unknown>): void {
|
|
||||||
validateBaseTransaction(tx)
|
|
||||||
|
|
||||||
if (tx.XChainBridge == null) {
|
|
||||||
throw new ValidationError('XChainModifyBridge: missing field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isXChainBridge(tx.XChainBridge)) {
|
|
||||||
throw new ValidationError('XChainModifyBridge: invalid field XChainBridge')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx.SignatureReward !== undefined && !isAmount(tx.SignatureReward)) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainModifyBridge: invalid field SignatureReward',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
tx.MinAccountCreateAmount !== undefined &&
|
|
||||||
!isAmount(tx.MinAccountCreateAmount)
|
|
||||||
) {
|
|
||||||
throw new ValidationError(
|
|
||||||
'XChainModifyBridge: invalid field MinAccountCreateAmount',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,14 +4,7 @@
|
|||||||
import { TRANSACTION_TYPES } from '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,
|
|
||||||
Currency,
|
|
||||||
IssuedCurrencyAmount,
|
|
||||||
Memo,
|
|
||||||
Signer,
|
|
||||||
XChainBridge,
|
|
||||||
} from '../common'
|
|
||||||
import { onlyHasFields } from '../utils'
|
import { onlyHasFields } from '../utils'
|
||||||
|
|
||||||
const MEMO_SIZE = 3
|
const MEMO_SIZE = 3
|
||||||
@@ -57,37 +50,17 @@ function isSigner(obj: unknown): boolean {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const XRP_CURRENCY_SIZE = 1
|
|
||||||
const ISSUE_SIZE = 2
|
|
||||||
const ISSUED_CURRENCY_SIZE = 3
|
const ISSUED_CURRENCY_SIZE = 3
|
||||||
const XCHAIN_BRIDGE_SIZE = 4
|
|
||||||
|
|
||||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||||
return value !== null && typeof value === 'object'
|
return value !== null && typeof value === 'object'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an IssuedCurrency at runtime.
|
|
||||||
*
|
|
||||||
* @param input - The input to check the form and type of.
|
|
||||||
* @returns Whether the IssuedCurrency is properly formed.
|
|
||||||
*/
|
|
||||||
export function isCurrency(input: unknown): input is Currency {
|
|
||||||
return (
|
|
||||||
isRecord(input) &&
|
|
||||||
((Object.keys(input).length === ISSUE_SIZE &&
|
|
||||||
typeof input.issuer === 'string' &&
|
|
||||||
typeof input.currency === 'string') ||
|
|
||||||
(Object.keys(input).length === XRP_CURRENCY_SIZE &&
|
|
||||||
input.currency === 'XRP'))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify the form and type of an IssuedCurrencyAmount at runtime.
|
* Verify the form and type of an IssuedCurrencyAmount at runtime.
|
||||||
*
|
*
|
||||||
* @param input - The input to check the form and type of.
|
* @param input - The input to check the form and type of.
|
||||||
* @returns Whether the IssuedCurrencyAmount is properly formed.
|
* @returns Whether the IssuedCurrencyAmount is malformed.
|
||||||
*/
|
*/
|
||||||
export function isIssuedCurrency(
|
export function isIssuedCurrency(
|
||||||
input: unknown,
|
input: unknown,
|
||||||
@@ -105,29 +78,12 @@ export function isIssuedCurrency(
|
|||||||
* Verify the form and type of an Amount at runtime.
|
* Verify the form and type of an Amount at runtime.
|
||||||
*
|
*
|
||||||
* @param amount - The object to check the form and type of.
|
* @param amount - The object to check the form and type of.
|
||||||
* @returns Whether the Amount is properly formed.
|
* @returns Whether the Amount is malformed.
|
||||||
*/
|
*/
|
||||||
export function isAmount(amount: unknown): amount is Amount {
|
export function isAmount(amount: unknown): amount is Amount {
|
||||||
return typeof amount === 'string' || isIssuedCurrency(amount)
|
return typeof amount === 'string' || isIssuedCurrency(amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the form and type of an XChainBridge at runtime.
|
|
||||||
*
|
|
||||||
* @param input - The input to check the form and type of.
|
|
||||||
* @returns Whether the XChainBridge is properly formed.
|
|
||||||
*/
|
|
||||||
export function isXChainBridge(input: unknown): input is XChainBridge {
|
|
||||||
return (
|
|
||||||
isRecord(input) &&
|
|
||||||
Object.keys(input).length === XCHAIN_BRIDGE_SIZE &&
|
|
||||||
typeof input.LockingChainDoor === 'string' &&
|
|
||||||
isCurrency(input.LockingChainIssue) &&
|
|
||||||
typeof input.IssuingChainDoor === 'string' &&
|
|
||||||
isCurrency(input.IssuingChainIssue)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- no global flags right now, so this is fine
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- no global flags right now, so this is fine
|
||||||
export interface GlobalFlags {}
|
export interface GlobalFlags {}
|
||||||
|
|
||||||
@@ -203,6 +159,10 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -296,6 +256,9 @@ 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')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ValidationError } from '../../errors'
|
|||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return escrowed amount to the sender.
|
* Return escrowed XRP to the sender.
|
||||||
*
|
*
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validateEscrowCreate */
|
/* eslint-disable complexity -- Necessary for validateEscrowCreate */
|
||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sequester amount until the escrow process either finishes or is canceled.
|
* Sequester XRP until the escrow process either finishes or is canceled.
|
||||||
*
|
*
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
*/
|
*/
|
||||||
export interface EscrowCreate extends BaseTransaction {
|
export interface EscrowCreate extends BaseTransaction {
|
||||||
TransactionType: 'EscrowCreate'
|
TransactionType: 'EscrowCreate'
|
||||||
/**
|
/**
|
||||||
* Amount to deduct from the sender's balance and escrow. Once escrowed, the
|
* Amount of XRP, in drops, to deduct from the sender's balance and escrow.
|
||||||
* amount can either go to the Destination address (after the FinishAfter time)
|
* Once escrowed, the XRP can either go to the Destination address (after the.
|
||||||
* or returned to the sender (after the CancelAfter time).
|
* FinishAfter time) or returned to the sender (after the CancelAfter time).
|
||||||
*/
|
*/
|
||||||
Amount: Amount
|
Amount: string
|
||||||
/** Address to receive escrowed amount. */
|
/** Address to receive escrowed XRP. */
|
||||||
Destination: string
|
Destination: string
|
||||||
/**
|
/**
|
||||||
* The time, in seconds since the Ripple Epoch, when this escrow expires.
|
* The time, in seconds since the Ripple Epoch, when this escrow expires.
|
||||||
@@ -26,7 +25,7 @@ export interface EscrowCreate extends BaseTransaction {
|
|||||||
*/
|
*/
|
||||||
CancelAfter?: number
|
CancelAfter?: number
|
||||||
/**
|
/**
|
||||||
* The time, in seconds since the Ripple Epoch, when the escrowed amount can be
|
* The time, in seconds since the Ripple Epoch, when the escrowed XRP can be
|
||||||
* released to the recipient. This value is immutable; the funds cannot move.
|
* released to the recipient. This value is immutable; the funds cannot move.
|
||||||
* until this time is reached.
|
* until this time is reached.
|
||||||
*/
|
*/
|
||||||
@@ -56,8 +55,8 @@ export function validateEscrowCreate(tx: Record<string, unknown>): void {
|
|||||||
throw new ValidationError('EscrowCreate: missing field Amount')
|
throw new ValidationError('EscrowCreate: missing field Amount')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof tx.Amount !== 'string' && !isAmount(tx.Amount)) {
|
if (typeof tx.Amount !== 'string') {
|
||||||
throw new ValidationError('EscrowCreate: Amount must be an Amount')
|
throw new ValidationError('EscrowCreate: Amount must be a string')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.Destination === undefined) {
|
if (tx.Destination === undefined) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ValidationError } from '../../errors'
|
|||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deliver amount from a held payment to the recipient.
|
* Deliver XRP from a held payment to the recipient.
|
||||||
*
|
*
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,19 +7,6 @@ export {
|
|||||||
AccountSet,
|
AccountSet,
|
||||||
} from './accountSet'
|
} from './accountSet'
|
||||||
export { AccountDelete } from './accountDelete'
|
export { AccountDelete } from './accountDelete'
|
||||||
export { AMMBid } from './AMMBid'
|
|
||||||
export {
|
|
||||||
AMMDepositFlags,
|
|
||||||
AMMDepositFlagsInterface,
|
|
||||||
AMMDeposit,
|
|
||||||
} from './AMMDeposit'
|
|
||||||
export { AMMCreate } from './AMMCreate'
|
|
||||||
export { AMMVote } from './AMMVote'
|
|
||||||
export {
|
|
||||||
AMMWithdrawFlags,
|
|
||||||
AMMWithdrawFlagsInterface,
|
|
||||||
AMMWithdraw,
|
|
||||||
} from './AMMWithdraw'
|
|
||||||
export { CheckCancel } from './checkCancel'
|
export { CheckCancel } from './checkCancel'
|
||||||
export { CheckCash } from './checkCash'
|
export { CheckCash } from './checkCash'
|
||||||
export { CheckCreate } from './checkCreate'
|
export { CheckCreate } from './checkCreate'
|
||||||
@@ -58,15 +45,3 @@ export { SetRegularKey } from './setRegularKey'
|
|||||||
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'
|
||||||
export { XChainAddAccountCreateAttestation } from './XChainAddAccountCreateAttestation'
|
|
||||||
export { XChainAddClaimAttestation } from './XChainAddClaimAttestation'
|
|
||||||
export { XChainClaim } from './XChainClaim'
|
|
||||||
export { XChainCommit } from './XChainCommit'
|
|
||||||
export { XChainCreateBridge } from './XChainCreateBridge'
|
|
||||||
export { XChainCreateClaimID } from './XChainCreateClaimID'
|
|
||||||
export { XChainAccountCreateCommit } from './XChainAccountCreateCommit'
|
|
||||||
export {
|
|
||||||
XChainModifyBridge,
|
|
||||||
XChainModifyBridgeFlags,
|
|
||||||
XChainModifyBridgeFlagsInterface,
|
|
||||||
} from './XChainModifyBridge'
|
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validatePaymentChannelClaim */
|
/* eslint-disable complexity -- Necessary for validatePaymentChannelClaim */
|
||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import {
|
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
|
||||||
BaseTransaction,
|
|
||||||
GlobalFlags,
|
|
||||||
validateBaseTransaction,
|
|
||||||
isAmount,
|
|
||||||
} from './common'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum representing values for PaymentChannelClaim transaction flags.
|
* Enum representing values for PaymentChannelClaim transaction flags.
|
||||||
@@ -24,15 +18,15 @@ export enum PaymentChannelClaimFlags {
|
|||||||
/**
|
/**
|
||||||
* Request to close the channel. Only the channel source and destination
|
* Request to close the channel. Only the channel source and destination
|
||||||
* addresses can use this flag. This flag closes the channel immediately if it
|
* addresses can use this flag. This flag closes the channel immediately if it
|
||||||
* has no more funds allocated to it after processing the current claim, or if
|
* has no more XRP allocated to it after processing the current claim, or if
|
||||||
* the destination address uses it. If the source address uses this flag when
|
* the destination address uses it. If the source address uses this flag when
|
||||||
* the channel still holds an amount, this schedules the channel to close after
|
* the channel still holds XRP, this schedules the channel to close after
|
||||||
* SettleDelay seconds have passed. (Specifically, this sets the Expiration of
|
* SettleDelay seconds have passed. (Specifically, this sets the Expiration of
|
||||||
* the channel to the close time of the previous ledger plus the channel's
|
* the channel to the close time of the previous ledger plus the channel's
|
||||||
* SettleDelay time, unless the channel already has an earlier Expiration
|
* SettleDelay time, unless the channel already has an earlier Expiration
|
||||||
* time.) If the destination address uses this flag when the channel still
|
* time.) If the destination address uses this flag when the channel still
|
||||||
* holds an amount, any amount that remains after processing the claim is
|
* holds XRP, any XRP that remains after processing the claim is returned to
|
||||||
* returned to the source address.
|
* the source address.
|
||||||
*/
|
*/
|
||||||
tfClose = 0x00020000,
|
tfClose = 0x00020000,
|
||||||
}
|
}
|
||||||
@@ -84,21 +78,21 @@ export interface PaymentChannelClaimFlagsInterface extends GlobalFlags {
|
|||||||
/**
|
/**
|
||||||
* Request to close the channel. Only the channel source and destination
|
* Request to close the channel. Only the channel source and destination
|
||||||
* addresses can use this flag. This flag closes the channel immediately if it
|
* addresses can use this flag. This flag closes the channel immediately if it
|
||||||
* has no more funds allocated to it after processing the current claim, or if
|
* has no more XRP allocated to it after processing the current claim, or if
|
||||||
* the destination address uses it. If the source address uses this flag when
|
* the destination address uses it. If the source address uses this flag when
|
||||||
* the channel still holds an amount, this schedules the channel to close after
|
* the channel still holds XRP, this schedules the channel to close after
|
||||||
* SettleDelay seconds have passed. (Specifically, this sets the Expiration of
|
* SettleDelay seconds have passed. (Specifically, this sets the Expiration of
|
||||||
* the channel to the close time of the previous ledger plus the channel's
|
* the channel to the close time of the previous ledger plus the channel's
|
||||||
* SettleDelay time, unless the channel already has an earlier Expiration
|
* SettleDelay time, unless the channel already has an earlier Expiration
|
||||||
* time.) If the destination address uses this flag when the channel still
|
* time.) If the destination address uses this flag when the channel still
|
||||||
* holds an amount, any amount that remains after processing the claim is
|
* holds XRP, any XRP that remains after processing the claim is returned to
|
||||||
* returned to the source address.
|
* the source address.
|
||||||
*/
|
*/
|
||||||
tfClose?: boolean
|
tfClose?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Claim amount from a payment channel, adjust the payment channel's expiration,
|
* Claim XRP from a payment channel, adjust the payment channel's expiration,
|
||||||
* or both.
|
* or both.
|
||||||
*
|
*
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
@@ -109,18 +103,18 @@ export interface PaymentChannelClaim extends BaseTransaction {
|
|||||||
/** The unique ID of the channel as a 64-character hexadecimal string. */
|
/** The unique ID of the channel as a 64-character hexadecimal string. */
|
||||||
Channel: string
|
Channel: string
|
||||||
/**
|
/**
|
||||||
* Total amount delivered by this channel after processing this claim. Required
|
* Total amount of XRP, in drops, delivered by this channel after processing
|
||||||
* to deliver amount. Must be more than the total amount delivered by the channel
|
* this claim. Required to deliver XRP. Must be more than the total amount
|
||||||
* so far, but not greater than the Amount of the signed claim. Must be provided
|
* delivered by the channel so far, but not greater than the Amount of the
|
||||||
* except when closing the channel.
|
* signed claim. Must be provided except when closing the channel.
|
||||||
*/
|
*/
|
||||||
Balance?: Amount
|
Balance?: string
|
||||||
/**
|
/**
|
||||||
* The amount authorized by the Signature. This must match the amount in the
|
* The amount of XRP, in drops, authorized by the Signature. This must match
|
||||||
* signed message. This is the cumulative amount that can be dispensed by the
|
* the amount in the signed message. This is the cumulative amount of XRP that
|
||||||
* channel, including amounts previously redeemed. Required unless closing the channel.
|
* can be dispensed by the channel, including XRP previously redeemed.
|
||||||
*/
|
*/
|
||||||
Amount?: Amount
|
Amount?: string
|
||||||
/**
|
/**
|
||||||
* The signature of this claim, as hexadecimal. The signed message contains
|
* The signature of this claim, as hexadecimal. The signed message contains
|
||||||
* the channel ID and the amount of the claim. Required unless the sender of
|
* the channel ID and the amount of the claim. Required unless the sender of
|
||||||
@@ -153,12 +147,12 @@ export function validatePaymentChannelClaim(tx: Record<string, unknown>): void {
|
|||||||
throw new ValidationError('PaymentChannelClaim: Channel must be a string')
|
throw new ValidationError('PaymentChannelClaim: Channel must be a string')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.Balance !== undefined && !isAmount(tx.Balance)) {
|
if (tx.Balance !== undefined && typeof tx.Balance !== 'string') {
|
||||||
throw new ValidationError('PaymentChannelClaim: Balance must be an Amount')
|
throw new ValidationError('PaymentChannelClaim: Balance must be a string')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.Amount !== undefined && !isAmount(tx.Amount)) {
|
if (tx.Amount !== undefined && typeof tx.Amount !== 'string') {
|
||||||
throw new ValidationError('PaymentChannelClaim: Amount must be an Amount')
|
throw new ValidationError('PaymentChannelClaim: Amount must be a string')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.Signature !== undefined && typeof tx.Signature !== 'string') {
|
if (tx.Signature !== undefined && typeof tx.Signature !== 'string') {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction, isAmount } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a unidirectional channel and fund it. The address sending
|
* Create a unidirectional channel and fund it with XRP. The address sending
|
||||||
* this transaction becomes the "source address" of the payment channel.
|
* this transaction becomes the "source address" of the payment channel.
|
||||||
*
|
*
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
@@ -13,20 +12,20 @@ import { BaseTransaction, validateBaseTransaction, isAmount } from './common'
|
|||||||
export interface PaymentChannelCreate extends BaseTransaction {
|
export interface PaymentChannelCreate extends BaseTransaction {
|
||||||
TransactionType: 'PaymentChannelCreate'
|
TransactionType: 'PaymentChannelCreate'
|
||||||
/**
|
/**
|
||||||
* Amount to deduct from the sender's balance and set aside in this channel.
|
* Amount of XRP, in drops, to deduct from the sender's balance and set aside
|
||||||
* While the channel is open, the amount can only go to the Destination
|
* in this channel. While the channel is open, the XRP can only go to the
|
||||||
* address. When the channel closes, any unclaimed amount is returned to
|
* Destination address. When the channel closes, any unclaimed XRP is returned
|
||||||
* the source address's balance.
|
* to the source address's balance.
|
||||||
*/
|
*/
|
||||||
Amount: Amount
|
Amount: string
|
||||||
/**
|
/**
|
||||||
* Address to receive claims against this channel. This is also known as
|
* Address to receive XRP claims against this channel. This is also known as
|
||||||
* the "destination address" for the channel.
|
* the "destination address" for the channel.
|
||||||
*/
|
*/
|
||||||
Destination: string
|
Destination: string
|
||||||
/**
|
/**
|
||||||
* Amount of time the source address must wait before closing the channel if
|
* Amount of time the source address must wait before closing the channel if
|
||||||
* it has unclaimed amount.
|
* it has unclaimed XRP.
|
||||||
*/
|
*/
|
||||||
SettleDelay: number
|
SettleDelay: number
|
||||||
/**
|
/**
|
||||||
@@ -66,8 +65,8 @@ export function validatePaymentChannelCreate(
|
|||||||
throw new ValidationError('PaymentChannelCreate: missing Amount')
|
throw new ValidationError('PaymentChannelCreate: missing Amount')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof tx.Amount !== 'string' && !isAmount(tx.Amount)) {
|
if (typeof tx.Amount !== 'string') {
|
||||||
throw new ValidationError('PaymentChannelCreate: Amount must be an Amount')
|
throw new ValidationError('PaymentChannelCreate: Amount must be a string')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.Destination === undefined) {
|
if (tx.Destination === undefined) {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
import { Amount } from '../common'
|
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction, isAmount } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add additional amount to an open payment channel, and optionally update the
|
* Add additional XRP to an open payment channel, and optionally update the
|
||||||
* expiration time of the channel. Only the source address of the channel can
|
* expiration time of the channel. Only the source address of the channel can
|
||||||
* use this transaction.
|
* use this transaction.
|
||||||
*
|
*
|
||||||
@@ -18,15 +17,16 @@ export interface PaymentChannelFund extends BaseTransaction {
|
|||||||
*/
|
*/
|
||||||
Channel: string
|
Channel: string
|
||||||
/**
|
/**
|
||||||
* Amount to add to the channel. Must be a positive amount
|
* Amount of XRP in drops to add to the channel. Must be a positive amount
|
||||||
|
* of XRP.
|
||||||
*/
|
*/
|
||||||
Amount: Amount
|
Amount: string
|
||||||
/**
|
/**
|
||||||
* New Expiration time to set for the channel in seconds since the Ripple
|
* New Expiration time to set for the channel in seconds since the Ripple
|
||||||
* Epoch. This must be later than either the current time plus the SettleDelay
|
* Epoch. This must be later than either the current time plus the SettleDelay
|
||||||
* of the channel, or the existing Expiration of the channel. After the
|
* of the channel, or the existing Expiration of the channel. After the
|
||||||
* Expiration time, any transaction that would access the channel closes the
|
* Expiration time, any transaction that would access the channel closes the
|
||||||
* channel without taking its normal action. Any unspent amount is returned to
|
* channel without taking its normal action. Any unspent XRP is returned to
|
||||||
* the source address when the channel closes. (Expiration is separate from
|
* the source address when the channel closes. (Expiration is separate from
|
||||||
* the channel's immutable CancelAfter time.) For more information, see the
|
* the channel's immutable CancelAfter time.) For more information, see the
|
||||||
* PayChannel ledger object type.
|
* PayChannel ledger object type.
|
||||||
@@ -55,8 +55,8 @@ export function validatePaymentChannelFund(tx: Record<string, unknown>): void {
|
|||||||
throw new ValidationError('PaymentChannelFund: missing Amount')
|
throw new ValidationError('PaymentChannelFund: missing Amount')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof tx.Amount !== 'string' && !isAmount(tx.Amount)) {
|
if (typeof tx.Amount !== 'string') {
|
||||||
throw new ValidationError('PaymentChannelFund: Amount must be an Amount')
|
throw new ValidationError('PaymentChannelFund: Amount must be a string')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx.Expiration !== undefined && typeof tx.Expiration !== 'number') {
|
if (tx.Expiration !== undefined && typeof tx.Expiration !== 'number') {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable max-lines -- necessary to support all transactions */
|
|
||||||
/* eslint-disable complexity -- verifies 19 tx types hence a lot of checks needed */
|
/* eslint-disable complexity -- verifies 19 tx types hence a lot of checks needed */
|
||||||
/* eslint-disable max-lines-per-function -- need to work with a lot of Tx verifications */
|
/* eslint-disable max-lines-per-function -- need to work with a lot of Tx verifications */
|
||||||
|
|
||||||
@@ -11,11 +10,6 @@ import { setTransactionFlagsToNumber } from '../utils/flags'
|
|||||||
|
|
||||||
import { AccountDelete, validateAccountDelete } from './accountDelete'
|
import { AccountDelete, validateAccountDelete } from './accountDelete'
|
||||||
import { AccountSet, validateAccountSet } from './accountSet'
|
import { AccountSet, validateAccountSet } from './accountSet'
|
||||||
import { AMMBid, validateAMMBid } from './AMMBid'
|
|
||||||
import { AMMCreate, validateAMMCreate } from './AMMCreate'
|
|
||||||
import { AMMDeposit, validateAMMDeposit } from './AMMDeposit'
|
|
||||||
import { AMMVote, validateAMMVote } from './AMMVote'
|
|
||||||
import { AMMWithdraw, validateAMMWithdraw } from './AMMWithdraw'
|
|
||||||
import { CheckCancel, validateCheckCancel } from './checkCancel'
|
import { CheckCancel, validateCheckCancel } from './checkCancel'
|
||||||
import { CheckCash, validateCheckCash } from './checkCash'
|
import { CheckCash, validateCheckCash } from './checkCash'
|
||||||
import { CheckCreate, validateCheckCreate } from './checkCreate'
|
import { CheckCreate, validateCheckCreate } from './checkCreate'
|
||||||
@@ -57,32 +51,6 @@ import { SetRegularKey, validateSetRegularKey } from './setRegularKey'
|
|||||||
import { SignerListSet, validateSignerListSet } from './signerListSet'
|
import { SignerListSet, validateSignerListSet } from './signerListSet'
|
||||||
import { TicketCreate, validateTicketCreate } from './ticketCreate'
|
import { TicketCreate, validateTicketCreate } from './ticketCreate'
|
||||||
import { TrustSet, validateTrustSet } from './trustSet'
|
import { TrustSet, validateTrustSet } from './trustSet'
|
||||||
import {
|
|
||||||
XChainAccountCreateCommit,
|
|
||||||
validateXChainAccountCreateCommit,
|
|
||||||
} from './XChainAccountCreateCommit'
|
|
||||||
import {
|
|
||||||
XChainAddAccountCreateAttestation,
|
|
||||||
validateXChainAddAccountCreateAttestation,
|
|
||||||
} from './XChainAddAccountCreateAttestation'
|
|
||||||
import {
|
|
||||||
XChainAddClaimAttestation,
|
|
||||||
validateXChainAddClaimAttestation,
|
|
||||||
} from './XChainAddClaimAttestation'
|
|
||||||
import { XChainClaim, validateXChainClaim } from './XChainClaim'
|
|
||||||
import { XChainCommit, validateXChainCommit } from './XChainCommit'
|
|
||||||
import {
|
|
||||||
XChainCreateBridge,
|
|
||||||
validateXChainCreateBridge,
|
|
||||||
} from './XChainCreateBridge'
|
|
||||||
import {
|
|
||||||
XChainCreateClaimID,
|
|
||||||
validateXChainCreateClaimID,
|
|
||||||
} from './XChainCreateClaimID'
|
|
||||||
import {
|
|
||||||
XChainModifyBridge,
|
|
||||||
validateXChainModifyBridge,
|
|
||||||
} from './XChainModifyBridge'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
@@ -90,11 +58,6 @@ import {
|
|||||||
export type Transaction =
|
export type Transaction =
|
||||||
| AccountDelete
|
| AccountDelete
|
||||||
| AccountSet
|
| AccountSet
|
||||||
| AMMBid
|
|
||||||
| AMMDeposit
|
|
||||||
| AMMCreate
|
|
||||||
| AMMVote
|
|
||||||
| AMMWithdraw
|
|
||||||
| CheckCancel
|
| CheckCancel
|
||||||
| CheckCash
|
| CheckCash
|
||||||
| CheckCreate
|
| CheckCreate
|
||||||
@@ -117,14 +80,6 @@ export type Transaction =
|
|||||||
| SignerListSet
|
| SignerListSet
|
||||||
| TicketCreate
|
| TicketCreate
|
||||||
| TrustSet
|
| TrustSet
|
||||||
| XChainAddAccountCreateAttestation
|
|
||||||
| XChainAddClaimAttestation
|
|
||||||
| XChainClaim
|
|
||||||
| XChainCommit
|
|
||||||
| XChainCreateBridge
|
|
||||||
| XChainCreateClaimID
|
|
||||||
| XChainAccountCreateCommit
|
|
||||||
| XChainModifyBridge
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Transaction Models
|
* @category Transaction Models
|
||||||
@@ -161,26 +116,6 @@ export function validate(transaction: Record<string, unknown>): void {
|
|||||||
validateAccountSet(tx)
|
validateAccountSet(tx)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'AMMBid':
|
|
||||||
validateAMMBid(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'AMMDeposit':
|
|
||||||
validateAMMDeposit(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'AMMCreate':
|
|
||||||
validateAMMCreate(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'AMMVote':
|
|
||||||
validateAMMVote(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'AMMWithdraw':
|
|
||||||
validateAMMWithdraw(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'CheckCancel':
|
case 'CheckCancel':
|
||||||
validateCheckCancel(tx)
|
validateCheckCancel(tx)
|
||||||
break
|
break
|
||||||
@@ -269,38 +204,6 @@ export function validate(transaction: Record<string, unknown>): void {
|
|||||||
validateTrustSet(tx)
|
validateTrustSet(tx)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'XChainAddAccountCreateAttestation':
|
|
||||||
validateXChainAddAccountCreateAttestation(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainAddClaimAttestation':
|
|
||||||
validateXChainAddClaimAttestation(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainClaim':
|
|
||||||
validateXChainClaim(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainCommit':
|
|
||||||
validateXChainCommit(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainCreateBridge':
|
|
||||||
validateXChainCreateBridge(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainCreateClaimID':
|
|
||||||
validateXChainCreateClaimID(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainAccountCreateCommit':
|
|
||||||
validateXChainAccountCreateCommit(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'XChainModifyBridge':
|
|
||||||
validateXChainModifyBridge(tx)
|
|
||||||
break
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new ValidationError(
|
throw new ValidationError(
|
||||||
`Invalid field TransactionType: ${tx.TransactionType}`,
|
`Invalid field TransactionType: ${tx.TransactionType}`,
|
||||||
|
|||||||
@@ -6,16 +6,22 @@ import {
|
|||||||
AccountRootFlagsInterface,
|
AccountRootFlagsInterface,
|
||||||
AccountRootFlags,
|
AccountRootFlags,
|
||||||
} from '../ledger/AccountRoot'
|
} from '../ledger/AccountRoot'
|
||||||
import { AccountSetTfFlags } from '../transactions/accountSet'
|
import {
|
||||||
import { AMMDepositFlags } from '../transactions/AMMDeposit'
|
AccountSetFlagsInterface,
|
||||||
import { AMMWithdrawFlags } from '../transactions/AMMWithdraw'
|
AccountSetTfFlags,
|
||||||
|
} from '../transactions/accountSet'
|
||||||
import { GlobalFlags } from '../transactions/common'
|
import { GlobalFlags } from '../transactions/common'
|
||||||
import { OfferCreateFlags } from '../transactions/offerCreate'
|
import {
|
||||||
import { PaymentFlags } from '../transactions/payment'
|
OfferCreateFlagsInterface,
|
||||||
import { PaymentChannelClaimFlags } from '../transactions/paymentChannelClaim'
|
OfferCreateFlags,
|
||||||
|
} from '../transactions/offerCreate'
|
||||||
|
import { PaymentFlagsInterface, PaymentFlags } from '../transactions/payment'
|
||||||
|
import {
|
||||||
|
PaymentChannelClaimFlagsInterface,
|
||||||
|
PaymentChannelClaimFlags,
|
||||||
|
} from '../transactions/paymentChannelClaim'
|
||||||
import type { Transaction } from '../transactions/transaction'
|
import type { Transaction } from '../transactions/transaction'
|
||||||
import { TrustSetFlags } from '../transactions/trustSet'
|
import { TrustSetFlagsInterface, TrustSetFlags } from '../transactions/trustSet'
|
||||||
import { XChainModifyBridgeFlags } from '../transactions/XChainModifyBridge'
|
|
||||||
|
|
||||||
import { isFlagEnabled } from '.'
|
import { isFlagEnabled } from '.'
|
||||||
|
|
||||||
@@ -44,7 +50,6 @@ export function parseAccountRootFlags(
|
|||||||
*
|
*
|
||||||
* @param tx - A transaction to set its flags to its numeric representation.
|
* @param tx - A transaction to set its flags to its numeric representation.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line complexity -- necessary
|
|
||||||
export function setTransactionFlagsToNumber(tx: Transaction): void {
|
export function setTransactionFlagsToNumber(tx: Transaction): void {
|
||||||
if (tx.Flags == null) {
|
if (tx.Flags == null) {
|
||||||
tx.Flags = 0
|
tx.Flags = 0
|
||||||
@@ -56,36 +61,55 @@ export function setTransactionFlagsToNumber(tx: Transaction): void {
|
|||||||
|
|
||||||
switch (tx.TransactionType) {
|
switch (tx.TransactionType) {
|
||||||
case 'AccountSet':
|
case 'AccountSet':
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, AccountSetTfFlags)
|
tx.Flags = convertAccountSetFlagsToNumber(tx.Flags)
|
||||||
return
|
|
||||||
case 'AMMDeposit':
|
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, AMMDepositFlags)
|
|
||||||
return
|
|
||||||
case 'AMMWithdraw':
|
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, AMMWithdrawFlags)
|
|
||||||
return
|
return
|
||||||
case 'OfferCreate':
|
case 'OfferCreate':
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, OfferCreateFlags)
|
tx.Flags = convertOfferCreateFlagsToNumber(tx.Flags)
|
||||||
return
|
return
|
||||||
case 'PaymentChannelClaim':
|
case 'PaymentChannelClaim':
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, PaymentChannelClaimFlags)
|
tx.Flags = convertPaymentChannelClaimFlagsToNumber(tx.Flags)
|
||||||
return
|
return
|
||||||
case 'Payment':
|
case 'Payment':
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, PaymentFlags)
|
tx.Flags = convertPaymentTransactionFlagsToNumber(tx.Flags)
|
||||||
return
|
return
|
||||||
case 'TrustSet':
|
case 'TrustSet':
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, TrustSetFlags)
|
tx.Flags = convertTrustSetFlagsToNumber(tx.Flags)
|
||||||
return
|
|
||||||
case 'XChainModifyBridge':
|
|
||||||
tx.Flags = convertFlagsToNumber(tx.Flags, XChainModifyBridgeFlags)
|
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
tx.Flags = 0
|
tx.Flags = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function convertAccountSetFlagsToNumber(
|
||||||
|
flags: AccountSetFlagsInterface,
|
||||||
|
): number {
|
||||||
|
return reduceFlags(flags, AccountSetTfFlags)
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertOfferCreateFlagsToNumber(
|
||||||
|
flags: OfferCreateFlagsInterface,
|
||||||
|
): number {
|
||||||
|
return reduceFlags(flags, OfferCreateFlags)
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertPaymentChannelClaimFlagsToNumber(
|
||||||
|
flags: PaymentChannelClaimFlagsInterface,
|
||||||
|
): number {
|
||||||
|
return reduceFlags(flags, PaymentChannelClaimFlags)
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertPaymentTransactionFlagsToNumber(
|
||||||
|
flags: PaymentFlagsInterface,
|
||||||
|
): number {
|
||||||
|
return reduceFlags(flags, PaymentFlags)
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertTrustSetFlagsToNumber(flags: TrustSetFlagsInterface): number {
|
||||||
|
return reduceFlags(flags, TrustSetFlags)
|
||||||
|
}
|
||||||
|
|
||||||
// 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 convertFlagsToNumber(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) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- safe member access
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- safe member access
|
||||||
if (flagEnum[flag] == null) {
|
if (flagEnum[flag] == null) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { setTransactionFlagsToNumber } from '../models/utils/flags'
|
|||||||
import { xrpToDrops } from '../utils'
|
import { xrpToDrops } from '../utils'
|
||||||
|
|
||||||
import getFeeXrp from './getFeeXrp'
|
import getFeeXrp from './getFeeXrp'
|
||||||
|
import getNetworkID from './getNetworkID'
|
||||||
|
|
||||||
// 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
|
||||||
@@ -39,8 +40,10 @@ 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 (tx.NetworkID == null) {
|
||||||
|
promises.push(setNetworkID(this, tx))
|
||||||
|
}
|
||||||
if (tx.Sequence == null) {
|
if (tx.Sequence == null) {
|
||||||
promises.push(setNextValidSequenceNumber(this, tx))
|
promises.push(setNextValidSequenceNumber(this, tx))
|
||||||
}
|
}
|
||||||
@@ -140,7 +143,7 @@ async function setNextValidSequenceNumber(
|
|||||||
tx.Sequence = data.result.account_data.Sequence
|
tx.Sequence = data.result.account_data.Sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchOwnerReserveFee(client: Client): Promise<BigNumber> {
|
async function fetchAccountDeleteFee(client: Client): Promise<BigNumber> {
|
||||||
const response = await client.request({ command: 'server_state' })
|
const response = await client.request({ command: 'server_state' })
|
||||||
const fee = response.result.state.validated_ledger?.reserve_inc
|
const fee = response.result.state.validated_ledger?.reserve_inc
|
||||||
|
|
||||||
@@ -172,11 +175,9 @@ async function calculateFeePerTransactionType(
|
|||||||
baseFee = product.dp(0, BigNumber.ROUND_CEIL)
|
baseFee = product.dp(0, BigNumber.ROUND_CEIL)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// AccountDelete Transaction
|
||||||
tx.TransactionType === 'AccountDelete' ||
|
if (tx.TransactionType === 'AccountDelete') {
|
||||||
tx.TransactionType === 'AMMCreate'
|
baseFee = await fetchAccountDeleteFee(client)
|
||||||
) {
|
|
||||||
baseFee = await fetchOwnerReserveFee(client)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -202,6 +203,12 @@ function scaleValue(value, multiplier): string {
|
|||||||
return new BigNumber(value).times(multiplier).toString()
|
return new BigNumber(value).times(multiplier).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setNetworkID(client: Client, tx: Transaction): Promise<void> {
|
||||||
|
const id = await getNetworkID(client)
|
||||||
|
// eslint-disable-next-line no-param-reassign -- param reassign is safe
|
||||||
|
tx.NetworkID = id
|
||||||
|
}
|
||||||
|
|
||||||
async function setLatestValidatedLedgerSequence(
|
async function setLatestValidatedLedgerSequence(
|
||||||
client: Client,
|
client: Client,
|
||||||
tx: Transaction,
|
tx: Transaction,
|
||||||
|
|||||||
22
packages/xrpl/src/sugar/getNetworkID.ts
Normal file
22
packages/xrpl/src/sugar/getNetworkID.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
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.
|
||||||
|
* @param client
|
||||||
|
* @returns The network id.
|
||||||
|
*/
|
||||||
|
export default async function getNetworkID(client: Client): Promise<number> {
|
||||||
|
const response = await client.request({
|
||||||
|
command: 'server_info',
|
||||||
|
})
|
||||||
|
const networkID = response.result.info.network_id
|
||||||
|
if (networkID == null) {
|
||||||
|
throw new XrplError(
|
||||||
|
'getNetworkID: Could not get network_id from server_info',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return networkID
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import { assertRejects } from '../testUtils'
|
|||||||
const Fee = '10'
|
const Fee = '10'
|
||||||
const Sequence = 1432
|
const Sequence = 1432
|
||||||
const LastLedgerSequence = 2908734
|
const LastLedgerSequence = 2908734
|
||||||
|
const NetworkID = 21338
|
||||||
|
|
||||||
describe('client.autofill', function () {
|
describe('client.autofill', function () {
|
||||||
let testContext: XrplTestContext
|
let testContext: XrplTestContext
|
||||||
@@ -35,12 +36,14 @@ describe('client.autofill', function () {
|
|||||||
Fee,
|
Fee,
|
||||||
Sequence,
|
Sequence,
|
||||||
LastLedgerSequence,
|
LastLedgerSequence,
|
||||||
|
NetworkID,
|
||||||
}
|
}
|
||||||
const txResult = await testContext.client.autofill(tx)
|
const txResult = await testContext.client.autofill(tx)
|
||||||
|
|
||||||
assert.strictEqual(txResult.Fee, Fee)
|
assert.strictEqual(txResult.Fee, Fee)
|
||||||
assert.strictEqual(txResult.Sequence, Sequence)
|
assert.strictEqual(txResult.Sequence, Sequence)
|
||||||
assert.strictEqual(txResult.LastLedgerSequence, LastLedgerSequence)
|
assert.strictEqual(txResult.LastLedgerSequence, LastLedgerSequence)
|
||||||
|
assert.strictEqual(txResult.NetworkID, NetworkID)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('converts Account & Destination X-address to their classic address', async function () {
|
it('converts Account & Destination X-address to their classic address', async function () {
|
||||||
@@ -58,6 +61,10 @@ describe('client.autofill', function () {
|
|||||||
'server_info',
|
'server_info',
|
||||||
rippled.server_info.normal,
|
rippled.server_info.normal,
|
||||||
)
|
)
|
||||||
|
testContext.mockRippled!.addResponse(
|
||||||
|
'server_info',
|
||||||
|
rippled.server_info.normal,
|
||||||
|
)
|
||||||
testContext.mockRippled!.addResponse('ledger', rippled.ledger.normal)
|
testContext.mockRippled!.addResponse('ledger', rippled.ledger.normal)
|
||||||
|
|
||||||
const txResult = await testContext.client.autofill(tx)
|
const txResult = await testContext.client.autofill(tx)
|
||||||
@@ -76,6 +83,7 @@ describe('client.autofill', function () {
|
|||||||
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
||||||
Fee,
|
Fee,
|
||||||
LastLedgerSequence,
|
LastLedgerSequence,
|
||||||
|
NetworkID,
|
||||||
}
|
}
|
||||||
testContext.mockRippled!.addResponse('account_info', {
|
testContext.mockRippled!.addResponse('account_info', {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
@@ -101,6 +109,10 @@ describe('client.autofill', function () {
|
|||||||
'server_info',
|
'server_info',
|
||||||
rippled.server_info.normal,
|
rippled.server_info.normal,
|
||||||
)
|
)
|
||||||
|
testContext.mockRippled!.addResponse(
|
||||||
|
'server_info',
|
||||||
|
rippled.server_info.normal,
|
||||||
|
)
|
||||||
testContext.mockRippled!.addResponse(
|
testContext.mockRippled!.addResponse(
|
||||||
'account_objects',
|
'account_objects',
|
||||||
rippled.account_objects.normal,
|
rippled.account_objects.normal,
|
||||||
@@ -113,6 +125,7 @@ describe('client.autofill', function () {
|
|||||||
Fee,
|
Fee,
|
||||||
Sequence,
|
Sequence,
|
||||||
LastLedgerSequence,
|
LastLedgerSequence,
|
||||||
|
NetworkID,
|
||||||
}
|
}
|
||||||
|
|
||||||
await assertRejects(testContext.client.autofill(tx), XrplError)
|
await assertRejects(testContext.client.autofill(tx), XrplError)
|
||||||
@@ -126,6 +139,7 @@ describe('client.autofill', function () {
|
|||||||
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
||||||
Sequence,
|
Sequence,
|
||||||
LastLedgerSequence,
|
LastLedgerSequence,
|
||||||
|
NetworkID,
|
||||||
}
|
}
|
||||||
testContext.mockRippled!.addResponse(
|
testContext.mockRippled!.addResponse(
|
||||||
'server_info',
|
'server_info',
|
||||||
@@ -155,6 +169,10 @@ describe('client.autofill', function () {
|
|||||||
'server_info',
|
'server_info',
|
||||||
rippled.server_info.normal,
|
rippled.server_info.normal,
|
||||||
)
|
)
|
||||||
|
testContext.mockRippled!.addResponse(
|
||||||
|
'server_info',
|
||||||
|
rippled.server_info.normal,
|
||||||
|
)
|
||||||
|
|
||||||
const txResult = await testContext.client.autofill(tx)
|
const txResult = await testContext.client.autofill(tx)
|
||||||
assert.strictEqual(txResult.Fee, '399')
|
assert.strictEqual(txResult.Fee, '399')
|
||||||
@@ -171,6 +189,10 @@ describe('client.autofill', function () {
|
|||||||
rippled.account_info.normal,
|
rippled.account_info.normal,
|
||||||
)
|
)
|
||||||
testContext.mockRippled!.addResponse('ledger', rippled.ledger.normal)
|
testContext.mockRippled!.addResponse('ledger', rippled.ledger.normal)
|
||||||
|
testContext.mockRippled!.addResponse(
|
||||||
|
'server_info',
|
||||||
|
rippled.server_info.normal,
|
||||||
|
)
|
||||||
testContext.mockRippled!.addResponse('server_state', {
|
testContext.mockRippled!.addResponse('server_state', {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
type: 'response',
|
type: 'response',
|
||||||
@@ -214,6 +236,10 @@ describe('client.autofill', function () {
|
|||||||
'server_info',
|
'server_info',
|
||||||
rippled.server_info.normal,
|
rippled.server_info.normal,
|
||||||
)
|
)
|
||||||
|
testContext.mockRippled!.addResponse(
|
||||||
|
'server_info',
|
||||||
|
rippled.server_info.normal,
|
||||||
|
)
|
||||||
const txResult = await testContext.client.autofill(tx, 4)
|
const txResult = await testContext.client.autofill(tx, 4)
|
||||||
|
|
||||||
assert.strictEqual(txResult.Fee, '459')
|
assert.strictEqual(txResult.Fee, '459')
|
||||||
@@ -227,6 +253,7 @@ describe('client.autofill', function () {
|
|||||||
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
||||||
Fee,
|
Fee,
|
||||||
Sequence,
|
Sequence,
|
||||||
|
NetworkID,
|
||||||
}
|
}
|
||||||
testContext.mockRippled!.addResponse('ledger', {
|
testContext.mockRippled!.addResponse('ledger', {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
@@ -272,9 +299,37 @@ describe('client.autofill', function () {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
testContext.mockRippled!.addResponse(
|
||||||
|
'server_info',
|
||||||
|
rippled.server_info.normal,
|
||||||
|
)
|
||||||
const txResult = await testContext.client.autofill(tx)
|
const txResult = await testContext.client.autofill(tx)
|
||||||
assert.strictEqual(txResult.Fee, '12')
|
assert.strictEqual(txResult.Fee, '12')
|
||||||
assert.strictEqual(txResult.Sequence, 23)
|
assert.strictEqual(txResult.Sequence, 23)
|
||||||
assert.strictEqual(txResult.LastLedgerSequence, 9038234)
|
assert.strictEqual(txResult.LastLedgerSequence, 9038234)
|
||||||
|
assert.strictEqual(txResult.NetworkID, 21338)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should autofill NetworkID when it's missing", async function () {
|
||||||
|
const tx: Transaction = {
|
||||||
|
TransactionType: 'DepositPreauth',
|
||||||
|
Account: 'rGWrZyQqhTp9Xu7G5Pkayo7bXjH4k4QYpf',
|
||||||
|
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
||||||
|
Fee,
|
||||||
|
LastLedgerSequence,
|
||||||
|
Sequence,
|
||||||
|
}
|
||||||
|
testContext.mockRippled!.addResponse('server_info', {
|
||||||
|
status: 'success',
|
||||||
|
type: 'response',
|
||||||
|
result: {
|
||||||
|
info: {
|
||||||
|
network_id: 21338,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const txResult = await testContext.client.autofill(tx)
|
||||||
|
|
||||||
|
assert.strictEqual(txResult.NetworkID, 21338)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ describe('client.submit', function () {
|
|||||||
Sequence: 1,
|
Sequence: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
LastLedgerSequence: 12312,
|
LastLedgerSequence: 12312,
|
||||||
|
NetworkID: 21338,
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should submit an unsigned transaction', async function () {
|
it('should submit an unsigned transaction', async function () {
|
||||||
@@ -83,6 +84,7 @@ describe('client.submit', function () {
|
|||||||
LastLedgerSequence: 12312,
|
LastLedgerSequence: 12312,
|
||||||
Amount: '20000000',
|
Amount: '20000000',
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
SigningPubKey:
|
SigningPubKey:
|
||||||
'030E58CDD076E798C84755590AAF6237CA8FAE821070A59F648B517A30DC6F589D',
|
'030E58CDD076E798C84755590AAF6237CA8FAE821070A59F648B517A30DC6F589D',
|
||||||
TxnSignature:
|
TxnSignature:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"converge_time_s": 2.007,
|
"converge_time_s": 2.007,
|
||||||
"proposers": 4
|
"proposers": 4
|
||||||
},
|
},
|
||||||
|
"network_id": 21338,
|
||||||
"load_factor": 1,
|
"load_factor": 1,
|
||||||
"peers": 53,
|
"peers": 53,
|
||||||
"pubkey_node": "n94wWvFUmaKGYrKUGgpv1DyYgDeXRGdACkNQaSe7zJiy5Znio7UC",
|
"pubkey_node": "n94wWvFUmaKGYrKUGgpv1DyYgDeXRGdACkNQaSe7zJiy5Znio7UC",
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
import { assert } from 'chai'
|
|
||||||
|
|
||||||
import { validate, ValidationError } from '../../src'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMBid Transaction Verification Testing.
|
|
||||||
*
|
|
||||||
* Providing runtime verification testing for each specific transaction type.
|
|
||||||
*/
|
|
||||||
describe('AMMBid', function () {
|
|
||||||
let bid
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
bid = {
|
|
||||||
TransactionType: 'AMMBid',
|
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
||||||
Asset: {
|
|
||||||
currency: 'XRP',
|
|
||||||
},
|
|
||||||
Asset2: {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
},
|
|
||||||
BidMin: '5',
|
|
||||||
BidMax: '10',
|
|
||||||
AuthAccounts: [
|
|
||||||
{
|
|
||||||
AuthAccount: {
|
|
||||||
Account: 'rNZdsTBP5tH1M6GHC6bTreHAp6ouP8iZSh',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
AuthAccount: {
|
|
||||||
Account: 'rfpFv97Dwu89FTyUwPjtpZBbuZxTqqgTmH',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
AuthAccount: {
|
|
||||||
Account: 'rzzYHPGb8Pa64oqxCzmuffm122bitq3Vb',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
AuthAccount: {
|
|
||||||
Account: 'rhwxHxaHok86fe4LykBom1jSJ3RYQJs1h4',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Sequence: 1337,
|
|
||||||
} as any
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMBid`, function () {
|
|
||||||
assert.doesNotThrow(() => validate(bid))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset`, function () {
|
|
||||||
delete bid.Asset
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: missing field Asset',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset must be an Issue`, function () {
|
|
||||||
bid.Asset = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: Asset must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset2`, function () {
|
|
||||||
delete bid.Asset2
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: missing field Asset2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset2 must be an Issue`, function () {
|
|
||||||
bid.Asset2 = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: Asset2 must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ BidMin must be an Amount`, function () {
|
|
||||||
bid.BidMin = 5
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: BidMin must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ BidMax must be an Amount`, function () {
|
|
||||||
bid.BidMax = 10
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: BidMax must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ AuthAccounts length must not be greater than 4`, function () {
|
|
||||||
bid.AuthAccounts.push({
|
|
||||||
AuthAccount: {
|
|
||||||
Account: 'r3X6noRsvaLapAKCG78zAtWcbhB3sggS1s',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
assert.throws(
|
|
||||||
() => validate(bid),
|
|
||||||
ValidationError,
|
|
||||||
'AMMBid: AuthAccounts length must not be greater than 4',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
import { assert } from 'chai'
|
|
||||||
|
|
||||||
import { validate, ValidationError } from '../../src'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMCreate Transaction Verification Testing.
|
|
||||||
*
|
|
||||||
* Providing runtime verification testing for each specific transaction type.
|
|
||||||
*/
|
|
||||||
describe('AMMCreate', function () {
|
|
||||||
let ammCreate
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
ammCreate = {
|
|
||||||
TransactionType: 'AMMCreate',
|
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
||||||
Amount: '1000',
|
|
||||||
Amount2: {
|
|
||||||
currency: 'USD',
|
|
||||||
issuer: 'rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9',
|
|
||||||
value: '1000',
|
|
||||||
},
|
|
||||||
TradingFee: 12,
|
|
||||||
Sequence: 1337,
|
|
||||||
} as any
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMCreate`, function () {
|
|
||||||
assert.doesNotThrow(() => validate(ammCreate))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing Amount`, function () {
|
|
||||||
delete ammCreate.Amount
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
'AMMCreate: missing field Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Amount must be an Amount`, function () {
|
|
||||||
ammCreate.Amount = 1000
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
'AMMCreate: Amount must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing Amount2`, function () {
|
|
||||||
delete ammCreate.Amount2
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
'AMMCreate: missing field Amount2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Amount2 must be an Amount`, function () {
|
|
||||||
ammCreate.Amount2 = 1000
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
'AMMCreate: Amount2 must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing TradingFee`, function () {
|
|
||||||
delete ammCreate.TradingFee
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
'AMMCreate: missing field TradingFee',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ TradingFee must be a number`, function () {
|
|
||||||
ammCreate.TradingFee = '12'
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
'AMMCreate: TradingFee must be a number',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws when TradingFee is greater than 1000`, function () {
|
|
||||||
ammCreate.TradingFee = 1001
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
`AMMCreate: TradingFee must be between 0 and 1000`,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws when TradingFee is a negative number`, function () {
|
|
||||||
ammCreate.TradingFee = -1
|
|
||||||
assert.throws(
|
|
||||||
() => validate(ammCreate),
|
|
||||||
ValidationError,
|
|
||||||
`AMMCreate: TradingFee must be between 0 and 1000`,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
/* eslint-disable no-bitwise -- bitwise necessary for enabling flags */
|
|
||||||
import { assert } from 'chai'
|
|
||||||
|
|
||||||
import { AMMDepositFlags, validate, ValidationError } from '../../src'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMDeposit Transaction Verification Testing.
|
|
||||||
*
|
|
||||||
* Providing runtime verification testing for each specific transaction type.
|
|
||||||
*/
|
|
||||||
describe('AMMDeposit', function () {
|
|
||||||
const LPTokenOut = {
|
|
||||||
currency: 'B3813FCAB4EE68B3D0D735D6849465A9113EE048',
|
|
||||||
issuer: 'rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg',
|
|
||||||
value: '1000',
|
|
||||||
}
|
|
||||||
let deposit
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
deposit = {
|
|
||||||
TransactionType: 'AMMDeposit',
|
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
||||||
Asset: {
|
|
||||||
currency: 'XRP',
|
|
||||||
},
|
|
||||||
Asset2: {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
},
|
|
||||||
Sequence: 1337,
|
|
||||||
Flags: 0,
|
|
||||||
} as any
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMDeposit with LPTokenOut`, function () {
|
|
||||||
deposit.LPTokenOut = LPTokenOut
|
|
||||||
deposit.Flags |= AMMDepositFlags.tfLPToken
|
|
||||||
assert.doesNotThrow(() => validate(deposit))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMDeposit with Amount`, function () {
|
|
||||||
deposit.Amount = '1000'
|
|
||||||
deposit.Flags |= AMMDepositFlags.tfSingleAsset
|
|
||||||
assert.doesNotThrow(() => validate(deposit))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMDeposit with Amount and Amount2`, function () {
|
|
||||||
deposit.Amount = '1000'
|
|
||||||
deposit.Amount2 = {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
value: '2.5',
|
|
||||||
}
|
|
||||||
deposit.Flags |= AMMDepositFlags.tfTwoAsset
|
|
||||||
assert.doesNotThrow(() => validate(deposit))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMDeposit with Amount and LPTokenOut`, function () {
|
|
||||||
deposit.Amount = '1000'
|
|
||||||
deposit.LPTokenOut = LPTokenOut
|
|
||||||
deposit.Flags |= AMMDepositFlags.tfOneAssetLPToken
|
|
||||||
assert.doesNotThrow(() => validate(deposit))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMDeposit with Amount and EPrice`, function () {
|
|
||||||
deposit.Amount = '1000'
|
|
||||||
deposit.EPrice = '25'
|
|
||||||
deposit.Flags |= AMMDepositFlags.tfLimitLPToken
|
|
||||||
assert.doesNotThrow(() => validate(deposit))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset`, function () {
|
|
||||||
delete deposit.Asset
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: missing field Asset',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset must be an Issue`, function () {
|
|
||||||
deposit.Asset = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: Asset must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset2`, function () {
|
|
||||||
delete deposit.Asset2
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: missing field Asset2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset2 must be an Issue`, function () {
|
|
||||||
deposit.Asset2 = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: Asset2 must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ must set at least LPTokenOut or Amount`, function () {
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: must set at least LPTokenOut or Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ must set Amount with Amount2`, function () {
|
|
||||||
deposit.Amount2 = {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
value: '2.5',
|
|
||||||
}
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: must set Amount with Amount2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ must set Amount with EPrice`, function () {
|
|
||||||
deposit.EPrice = '25'
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: must set Amount with EPrice',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ LPTokenOut must be an IssuedCurrencyAmount`, function () {
|
|
||||||
deposit.LPTokenOut = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Amount must be an Amount`, function () {
|
|
||||||
deposit.Amount = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: Amount must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Amount2 must be an Amount`, function () {
|
|
||||||
deposit.Amount = '1000'
|
|
||||||
deposit.Amount2 = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: Amount2 must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ EPrice must be an Amount`, function () {
|
|
||||||
deposit.Amount = '1000'
|
|
||||||
deposit.EPrice = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(deposit),
|
|
||||||
ValidationError,
|
|
||||||
'AMMDeposit: EPrice must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
import { assert } from 'chai'
|
|
||||||
|
|
||||||
import { validate, ValidationError } from '../../src'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMVote Transaction Verification Testing.
|
|
||||||
*
|
|
||||||
* Providing runtime verification testing for each specific transaction type.
|
|
||||||
*/
|
|
||||||
describe('AMMVote', function () {
|
|
||||||
let vote
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
vote = {
|
|
||||||
TransactionType: 'AMMVote',
|
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
||||||
Asset: {
|
|
||||||
currency: 'XRP',
|
|
||||||
},
|
|
||||||
Asset2: {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
},
|
|
||||||
TradingFee: 25,
|
|
||||||
Sequence: 1337,
|
|
||||||
} as any
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMVote`, function () {
|
|
||||||
assert.doesNotThrow(() => validate(vote))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset`, function () {
|
|
||||||
delete vote.Asset
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: missing field Asset',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset must be an Issue`, function () {
|
|
||||||
vote.Asset = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: Asset must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset2`, function () {
|
|
||||||
delete vote.Asset2
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: missing field Asset2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset2 must be an Issue`, function () {
|
|
||||||
vote.Asset2 = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: Asset2 must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field TradingFee`, function () {
|
|
||||||
delete vote.TradingFee
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: missing field TradingFee',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ TradingFee must be a number`, function () {
|
|
||||||
vote.TradingFee = '25'
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: TradingFee must be a number',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws when TradingFee is greater than AMM_MAX_TRADING_FEE`, function () {
|
|
||||||
vote.TradingFee = 1001
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: TradingFee must be between 0 and 1000',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws when TradingFee is a negative number`, function () {
|
|
||||||
vote.TradingFee = -1
|
|
||||||
assert.throws(
|
|
||||||
() => validate(vote),
|
|
||||||
ValidationError,
|
|
||||||
'AMMVote: TradingFee must be between 0 and 1000',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
/* eslint-disable no-bitwise -- bitwise necessary for enabling flags */
|
|
||||||
import { assert } from 'chai'
|
|
||||||
|
|
||||||
import { AMMWithdrawFlags, validate, ValidationError } from '../../src'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMMWithdraw Transaction Verification Testing.
|
|
||||||
*
|
|
||||||
* Providing runtime verification testing for each specific transaction type.
|
|
||||||
*/
|
|
||||||
describe('AMMWithdraw', function () {
|
|
||||||
const LPTokenIn = {
|
|
||||||
currency: 'B3813FCAB4EE68B3D0D735D6849465A9113EE048',
|
|
||||||
issuer: 'rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg',
|
|
||||||
value: '1000',
|
|
||||||
}
|
|
||||||
let withdraw
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
withdraw = {
|
|
||||||
TransactionType: 'AMMWithdraw',
|
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
||||||
Asset: {
|
|
||||||
currency: 'XRP',
|
|
||||||
},
|
|
||||||
Asset2: {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
},
|
|
||||||
Sequence: 1337,
|
|
||||||
Flags: 0,
|
|
||||||
} as any
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw with LPTokenIn`, function () {
|
|
||||||
withdraw.LPTokenIn = LPTokenIn
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfLPToken
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw with Amount`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfSingleAsset
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw with Amount and Amount2`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.Amount2 = {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
value: '2.5',
|
|
||||||
}
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfTwoAsset
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw with Amount and LPTokenIn`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.LPTokenIn = LPTokenIn
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfOneAssetLPToken
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw with Amount and EPrice`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.EPrice = '25'
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfLimitLPToken
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw one asset withdraw all`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfOneAssetWithdrawAll
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`verifies valid AMMWithdraw withdraw all`, function () {
|
|
||||||
withdraw.Flags |= AMMWithdrawFlags.tfWithdrawAll
|
|
||||||
assert.doesNotThrow(() => validate(withdraw))
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset`, function () {
|
|
||||||
delete withdraw.Asset
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: missing field Asset',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset must be an Issue`, function () {
|
|
||||||
withdraw.Asset = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: Asset must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ missing field Asset2`, function () {
|
|
||||||
delete withdraw.Asset2
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: missing field Asset2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Asset2 must be an Issue`, function () {
|
|
||||||
withdraw.Asset2 = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: Asset2 must be an Issue',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ must set Amount with Amount2`, function () {
|
|
||||||
withdraw.Amount2 = {
|
|
||||||
currency: 'ETH',
|
|
||||||
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
|
|
||||||
value: '2.5',
|
|
||||||
}
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: must set Amount with Amount2',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ must set Amount with EPrice`, function () {
|
|
||||||
withdraw.EPrice = '25'
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: must set Amount with EPrice',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ LPTokenIn must be an IssuedCurrencyAmount`, function () {
|
|
||||||
withdraw.LPTokenIn = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Amount must be an Amount`, function () {
|
|
||||||
withdraw.Amount = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: Amount must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ Amount2 must be an Amount`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.Amount2 = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: Amount2 must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it(`throws w/ EPrice must be an Amount`, function () {
|
|
||||||
withdraw.Amount = '1000'
|
|
||||||
withdraw.EPrice = 1234
|
|
||||||
assert.throws(
|
|
||||||
() => validate(withdraw),
|
|
||||||
ValidationError,
|
|
||||||
'AMMWithdraw: EPrice must be an Amount',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -19,6 +19,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -32,6 +33,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenSellOffer: NFTOKEN_SELL_OFFER,
|
NFTokenSellOffer: NFTOKEN_SELL_OFFER,
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -44,6 +46,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
TransactionType: 'NFTokenAcceptOffer',
|
TransactionType: 'NFTokenAcceptOffer',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -62,6 +65,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
||||||
NFTokenBrokerFee: '1',
|
NFTokenBrokerFee: '1',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -80,6 +84,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenSellOffer: NFTOKEN_SELL_OFFER,
|
NFTokenSellOffer: NFTOKEN_SELL_OFFER,
|
||||||
NFTokenBrokerFee: '1',
|
NFTokenBrokerFee: '1',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -98,6 +103,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -113,6 +119,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBrokerFee: '1',
|
NFTokenBrokerFee: '1',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -128,6 +135,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
||||||
NFTokenBrokerFee: '0',
|
NFTokenBrokerFee: '0',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -147,6 +155,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
||||||
NFTokenBrokerFee: '-1',
|
NFTokenBrokerFee: '-1',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -166,6 +175,7 @@ describe('NFTokenAcceptOffer', function () {
|
|||||||
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
NFTokenBuyOffer: NFTOKEN_BUY_OFFER,
|
||||||
NFTokenBrokerFee: 1,
|
NFTokenBrokerFee: 1,
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ describe('NFTokenBurn', function () {
|
|||||||
NFTokenID: TOKEN_ID,
|
NFTokenID: TOKEN_ID,
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
@@ -29,6 +30,7 @@ describe('NFTokenBurn', function () {
|
|||||||
TransactionType: 'NFTokenBurn',
|
TransactionType: 'NFTokenBurn',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
} as any
|
} as any
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ describe('NFTokenCancelOffer', function () {
|
|||||||
it(`verifies valid NFTokenCancelOffer`, function () {
|
it(`verifies valid NFTokenCancelOffer`, function () {
|
||||||
const validNFTokenCancelOffer = {
|
const validNFTokenCancelOffer = {
|
||||||
TransactionType: 'NFTokenCancelOffer',
|
TransactionType: 'NFTokenCancelOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenOffers: [BUY_OFFER],
|
NFTokenOffers: [BUY_OFFER],
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
@@ -28,6 +29,7 @@ describe('NFTokenCancelOffer', function () {
|
|||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCancelOffer',
|
TransactionType: 'NFTokenCancelOffer',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
|
NetworkID: 21338,
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
@@ -44,6 +46,7 @@ describe('NFTokenCancelOffer', function () {
|
|||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCancelOffer',
|
TransactionType: 'NFTokenCancelOffer',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenOffers: [],
|
NFTokenOffers: [],
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`verifies valid NFTokenCreateOffer buyside`, function () {
|
it(`verifies valid NFTokenCreateOffer buyside`, function () {
|
||||||
const validNFTokenCreateOffer = {
|
const validNFTokenCreateOffer = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
Amount: '1',
|
Amount: '1',
|
||||||
Owner: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
Owner: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
||||||
@@ -30,6 +31,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`verifies valid NFTokenCreateOffer sellside`, function () {
|
it(`verifies valid NFTokenCreateOffer sellside`, function () {
|
||||||
const validNFTokenCreateOffer = {
|
const validNFTokenCreateOffer = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
Amount: '1',
|
Amount: '1',
|
||||||
Flags: NFTokenCreateOfferFlags.tfSellNFToken,
|
Flags: NFTokenCreateOfferFlags.tfSellNFToken,
|
||||||
@@ -46,6 +48,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`verifies w/ 0 Amount NFTokenCreateOffer sellside`, function () {
|
it(`verifies w/ 0 Amount NFTokenCreateOffer sellside`, function () {
|
||||||
const validNFTokenCreateOffer = {
|
const validNFTokenCreateOffer = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
Amount: '0',
|
Amount: '0',
|
||||||
Flags: NFTokenCreateOfferFlags.tfSellNFToken,
|
Flags: NFTokenCreateOfferFlags.tfSellNFToken,
|
||||||
@@ -62,6 +65,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/ Account === Owner`, function () {
|
it(`throws w/ Account === Owner`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
Amount: '1',
|
Amount: '1',
|
||||||
Expiration: 1000,
|
Expiration: 1000,
|
||||||
@@ -81,6 +85,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/ Account === Destination`, function () {
|
it(`throws w/ Account === Destination`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
Amount: '1',
|
Amount: '1',
|
||||||
Flags: NFTokenCreateOfferFlags.tfSellNFToken,
|
Flags: NFTokenCreateOfferFlags.tfSellNFToken,
|
||||||
@@ -101,6 +106,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/out NFTokenID`, function () {
|
it(`throws w/out NFTokenID`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: '1',
|
Amount: '1',
|
||||||
Owner: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXe',
|
Owner: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXe',
|
||||||
Expiration: 1000,
|
Expiration: 1000,
|
||||||
@@ -120,6 +126,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/ invalid Amount`, function () {
|
it(`throws w/ invalid Amount`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
Amount: 1,
|
Amount: 1,
|
||||||
Owner: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXe',
|
Owner: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXe',
|
||||||
@@ -140,6 +147,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/ missing Amount`, function () {
|
it(`throws w/ missing Amount`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
Owner: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXe',
|
Owner: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXe',
|
||||||
Expiration: 1000,
|
Expiration: 1000,
|
||||||
NFTokenID: NFTOKEN_ID,
|
NFTokenID: NFTOKEN_ID,
|
||||||
@@ -159,6 +167,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/ Owner for sell offer`, function () {
|
it(`throws w/ Owner for sell offer`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
Expiration: 1000,
|
Expiration: 1000,
|
||||||
Owner: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
Owner: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
@@ -179,6 +188,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/out Owner for buy offer`, function () {
|
it(`throws w/out Owner for buy offer`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
Expiration: 1000,
|
Expiration: 1000,
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Amount: '1',
|
Amount: '1',
|
||||||
@@ -197,6 +207,7 @@ describe('NFTokenCreateOffer', function () {
|
|||||||
it(`throws w/ 0 Amount for buy offer`, function () {
|
it(`throws w/ 0 Amount for buy offer`, function () {
|
||||||
const invalid = {
|
const invalid = {
|
||||||
TransactionType: 'NFTokenCreateOffer',
|
TransactionType: 'NFTokenCreateOffer',
|
||||||
|
NetworkID: 21338,
|
||||||
Expiration: 1000,
|
Expiration: 1000,
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Owner: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
Owner: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ describe('NFTokenMint', function () {
|
|||||||
TransactionType: 'NFTokenMint',
|
TransactionType: 'NFTokenMint',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: NFTokenMintFlags.tfTransferable,
|
Flags: NFTokenMintFlags.tfTransferable,
|
||||||
NFTokenTaxon: 0,
|
NFTokenTaxon: 0,
|
||||||
@@ -34,6 +35,7 @@ describe('NFTokenMint', function () {
|
|||||||
TransactionType: 'NFTokenMint',
|
TransactionType: 'NFTokenMint',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: NFTokenMintFlags.tfTransferable,
|
Flags: NFTokenMintFlags.tfTransferable,
|
||||||
Issuer: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
Issuer: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
||||||
@@ -53,6 +55,7 @@ describe('NFTokenMint', function () {
|
|||||||
TransactionType: 'NFTokenMint',
|
TransactionType: 'NFTokenMint',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: NFTokenMintFlags.tfTransferable,
|
Flags: NFTokenMintFlags.tfTransferable,
|
||||||
Issuer: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Issuer: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
@@ -73,6 +76,7 @@ describe('NFTokenMint', function () {
|
|||||||
TransactionType: 'NFTokenMint',
|
TransactionType: 'NFTokenMint',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: NFTokenMintFlags.tfTransferable,
|
Flags: NFTokenMintFlags.tfTransferable,
|
||||||
NFTokenTaxon: 0,
|
NFTokenTaxon: 0,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ describe('AccountDelete', function () {
|
|||||||
const validAccountDelete = {
|
const validAccountDelete = {
|
||||||
TransactionType: 'AccountDelete',
|
TransactionType: 'AccountDelete',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
|
NetworkID: 21338,
|
||||||
Destination: 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe',
|
Destination: 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe',
|
||||||
DestinationTag: 13,
|
DestinationTag: 13,
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
@@ -27,6 +28,7 @@ describe('AccountDelete', function () {
|
|||||||
const invalidDestination = {
|
const invalidDestination = {
|
||||||
TransactionType: 'AccountDelete',
|
TransactionType: 'AccountDelete',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
|
NetworkID: 21338,
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
@@ -49,6 +51,7 @@ describe('AccountDelete', function () {
|
|||||||
const invalidDestination = {
|
const invalidDestination = {
|
||||||
TransactionType: 'AccountDelete',
|
TransactionType: 'AccountDelete',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
|
NetworkID: 21338,
|
||||||
Destination: 65478965,
|
Destination: 65478965,
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
Sequence: 2470665,
|
Sequence: 2470665,
|
||||||
@@ -71,6 +74,7 @@ describe('AccountDelete', function () {
|
|||||||
const invalidDestinationTag = {
|
const invalidDestinationTag = {
|
||||||
TransactionType: 'AccountDelete',
|
TransactionType: 'AccountDelete',
|
||||||
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
||||||
|
NetworkID: 21338,
|
||||||
Destination: 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe',
|
Destination: 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe',
|
||||||
DestinationTag: 'gvftyujnbv',
|
DestinationTag: 'gvftyujnbv',
|
||||||
Fee: '5000000',
|
Fee: '5000000',
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('AccountSet', function () {
|
|||||||
account = {
|
account = {
|
||||||
TransactionType: 'AccountSet',
|
TransactionType: 'AccountSet',
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
|
NetworkID: 21338,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
Sequence: 5,
|
Sequence: 5,
|
||||||
Domain: '6578616D706C652E636F6D',
|
Domain: '6578616D706C652E636F6D',
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ describe('BaseTransaction', function () {
|
|||||||
const txJson = {
|
const txJson = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
Sequence: 100,
|
Sequence: 100,
|
||||||
AccountTxnID: 'DEADBEEF',
|
AccountTxnID: 'DEADBEEF',
|
||||||
@@ -63,6 +64,7 @@ describe('BaseTransaction', function () {
|
|||||||
const txJson = {
|
const txJson = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.doesNotThrow(() => validateBaseTransaction(txJson))
|
assert.doesNotThrow(() => validateBaseTransaction(txJson))
|
||||||
@@ -72,6 +74,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidFee = {
|
const invalidFee = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
Fee: 1000,
|
Fee: 1000,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -86,6 +89,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidSeq = {
|
const invalidSeq = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
Sequence: '145',
|
Sequence: '145',
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -100,6 +104,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidID = {
|
const invalidID = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
AccountTxnID: ['WRONG'],
|
AccountTxnID: ['WRONG'],
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -114,6 +119,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidLastLedgerSequence = {
|
const invalidLastLedgerSequence = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
LastLedgerSequence: '1000',
|
LastLedgerSequence: '1000',
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -128,6 +134,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidSourceTag = {
|
const invalidSourceTag = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
SourceTag: ['ARRAY'],
|
SourceTag: ['ARRAY'],
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -142,6 +149,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidSigningPubKey = {
|
const invalidSigningPubKey = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
SigningPubKey: 1000,
|
SigningPubKey: 1000,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -156,6 +164,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidTicketSequence = {
|
const invalidTicketSequence = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
TicketSequence: '1000',
|
TicketSequence: '1000',
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -170,6 +179,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidTxnSignature = {
|
const invalidTxnSignature = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
TxnSignature: 1000,
|
TxnSignature: 1000,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -180,10 +190,25 @@ describe('BaseTransaction', function () {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it(`Handles invalid NetworkID`, function () {
|
||||||
|
const invalidTxnSignature = {
|
||||||
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: '21338',
|
||||||
|
} as any
|
||||||
|
|
||||||
|
assert.throws(
|
||||||
|
() => validateBaseTransaction(invalidTxnSignature),
|
||||||
|
ValidationError,
|
||||||
|
'BaseTransaction: invalid NetworkID',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it(`Handles invalid Signers`, function () {
|
it(`Handles invalid Signers`, function () {
|
||||||
const invalidSigners = {
|
const invalidSigners = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
Signers: [],
|
Signers: [],
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
@@ -196,6 +221,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidSigners2 = {
|
const invalidSigners2 = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
Signers: [
|
Signers: [
|
||||||
{
|
{
|
||||||
Signer: {
|
Signer: {
|
||||||
@@ -216,6 +242,7 @@ describe('BaseTransaction', function () {
|
|||||||
const invalidMemo = {
|
const invalidMemo = {
|
||||||
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
Account: 'r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe',
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
|
NetworkID: 21338,
|
||||||
Memos: [
|
Memos: [
|
||||||
{
|
{
|
||||||
Memo: {
|
Memo: {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ describe('CheckCancel', function () {
|
|||||||
const validCheckCancel = {
|
const validCheckCancel = {
|
||||||
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
||||||
TransactionType: 'CheckCancel',
|
TransactionType: 'CheckCancel',
|
||||||
|
NetworkID: 21338,
|
||||||
CheckID:
|
CheckID:
|
||||||
'49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0',
|
'49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0',
|
||||||
} as any
|
} as any
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ describe('CheckCash', function () {
|
|||||||
const validCheckCash = {
|
const validCheckCash = {
|
||||||
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
TransactionType: 'CheckCash',
|
TransactionType: 'CheckCash',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: '100000000',
|
Amount: '100000000',
|
||||||
CheckID:
|
CheckID:
|
||||||
'838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334',
|
'838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334',
|
||||||
@@ -27,6 +28,7 @@ describe('CheckCash', function () {
|
|||||||
const invalidCheckID = {
|
const invalidCheckID = {
|
||||||
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
TransactionType: 'CheckCash',
|
TransactionType: 'CheckCash',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: '100000000',
|
Amount: '100000000',
|
||||||
CheckID: 83876645678567890,
|
CheckID: 83876645678567890,
|
||||||
} as any
|
} as any
|
||||||
@@ -47,6 +49,7 @@ describe('CheckCash', function () {
|
|||||||
const invalidAmount = {
|
const invalidAmount = {
|
||||||
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
TransactionType: 'CheckCash',
|
TransactionType: 'CheckCash',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: 100000000,
|
Amount: 100000000,
|
||||||
CheckID:
|
CheckID:
|
||||||
'838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334',
|
'838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334',
|
||||||
@@ -68,6 +71,7 @@ describe('CheckCash', function () {
|
|||||||
const invalidDeliverMin = {
|
const invalidDeliverMin = {
|
||||||
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
TransactionType: 'CheckCash',
|
TransactionType: 'CheckCash',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: '100000000',
|
Amount: '100000000',
|
||||||
DeliverMin: 852156963,
|
DeliverMin: 852156963,
|
||||||
CheckID:
|
CheckID:
|
||||||
@@ -90,6 +94,7 @@ describe('CheckCash', function () {
|
|||||||
const invalidDeliverMin = {
|
const invalidDeliverMin = {
|
||||||
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Account: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
TransactionType: 'CheckCash',
|
TransactionType: 'CheckCash',
|
||||||
|
NetworkID: 21338,
|
||||||
DeliverMin: 852156963,
|
DeliverMin: 852156963,
|
||||||
CheckID:
|
CheckID:
|
||||||
'838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334',
|
'838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334',
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ describe('CheckCreate', function () {
|
|||||||
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
||||||
DestinationTag: 1,
|
DestinationTag: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
assert.doesNotThrow(() => validateCheckCreate(validCheck))
|
assert.doesNotThrow(() => validateCheckCreate(validCheck))
|
||||||
@@ -37,6 +38,7 @@ describe('CheckCreate', function () {
|
|||||||
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
||||||
DestinationTag: 1,
|
DestinationTag: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
@@ -62,6 +64,7 @@ describe('CheckCreate', function () {
|
|||||||
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
||||||
DestinationTag: 1,
|
DestinationTag: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
@@ -80,6 +83,7 @@ describe('CheckCreate', function () {
|
|||||||
const invalidDestinationTag = {
|
const invalidDestinationTag = {
|
||||||
TransactionType: 'CheckCreate',
|
TransactionType: 'CheckCreate',
|
||||||
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
||||||
|
NetworkID: 21338,
|
||||||
Destination: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Destination: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
SendMax: '100000000',
|
SendMax: '100000000',
|
||||||
Expiration: 570113521,
|
Expiration: 570113521,
|
||||||
@@ -112,6 +116,7 @@ describe('CheckCreate', function () {
|
|||||||
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
'6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B',
|
||||||
DestinationTag: 1,
|
DestinationTag: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
@@ -136,6 +141,7 @@ describe('CheckCreate', function () {
|
|||||||
InvoiceID: 789656963258531,
|
InvoiceID: 789656963258531,
|
||||||
DestinationTag: 1,
|
DestinationTag: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
} as any
|
} as any
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('DepositPreauth', function () {
|
|||||||
depositPreauth = {
|
depositPreauth = {
|
||||||
TransactionType: 'DepositPreauth',
|
TransactionType: 'DepositPreauth',
|
||||||
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
||||||
|
NetworkID: 21338,
|
||||||
} as any
|
} as any
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ describe('EscrowCancel', function () {
|
|||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
Owner: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Owner: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
OfferSequence: 7,
|
OfferSequence: 7,
|
||||||
|
NetworkID: 21338,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('EscrowCreate', function () {
|
|||||||
escrow = {
|
escrow = {
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
TransactionType: 'EscrowCreate',
|
TransactionType: 'EscrowCreate',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: '10000',
|
Amount: '10000',
|
||||||
Destination: 'rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW',
|
Destination: 'rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW',
|
||||||
CancelAfter: 533257958,
|
CancelAfter: 533257958,
|
||||||
@@ -82,12 +83,12 @@ describe('EscrowCreate', function () {
|
|||||||
assert.throws(
|
assert.throws(
|
||||||
() => validateEscrowCreate(escrow),
|
() => validateEscrowCreate(escrow),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'EscrowCreate: Amount must be an Amount',
|
'EscrowCreate: Amount must be a string',
|
||||||
)
|
)
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validate(escrow),
|
() => validate(escrow),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'EscrowCreate: Amount must be an Amount',
|
'EscrowCreate: Amount must be a string',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('EscrowFinish', function () {
|
|||||||
escrow = {
|
escrow = {
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
TransactionType: 'EscrowFinish',
|
TransactionType: 'EscrowFinish',
|
||||||
|
NetworkID: 21338,
|
||||||
Owner: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Owner: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
OfferSequence: 7,
|
OfferSequence: 7,
|
||||||
Condition:
|
Condition:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('OfferCancel', function () {
|
|||||||
offer = {
|
offer = {
|
||||||
Account: 'rnKiczmiQkZFiDES8THYyLA2pQohC5C6EF',
|
Account: 'rnKiczmiQkZFiDES8THYyLA2pQohC5C6EF',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
LastLedgerSequence: 65477334,
|
LastLedgerSequence: 65477334,
|
||||||
OfferSequence: 60797528,
|
OfferSequence: 60797528,
|
||||||
Sequence: 60797535,
|
Sequence: 60797535,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer = {
|
const offer = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
@@ -37,6 +38,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer2 = {
|
const offer2 = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
@@ -59,6 +61,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer3 = {
|
const offer3 = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
@@ -87,6 +90,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer = {
|
const offer = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
@@ -120,6 +124,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer = {
|
const offer = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
@@ -153,6 +158,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer = {
|
const offer = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
@@ -182,6 +188,7 @@ describe('OfferCreate', function () {
|
|||||||
const offer = {
|
const offer = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
LastLedgerSequence: 65453019,
|
LastLedgerSequence: 65453019,
|
||||||
Sequence: 40949322,
|
Sequence: 40949322,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ describe('Payment', function () {
|
|||||||
Destination: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
Destination: 'rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy',
|
||||||
DestinationTag: 1,
|
DestinationTag: 1,
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 2147483648,
|
Flags: 2147483648,
|
||||||
LastLedgerSequence: 65953073,
|
LastLedgerSequence: 65953073,
|
||||||
Sequence: 65923914,
|
Sequence: 65923914,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('PaymentChannelClaim', function () {
|
|||||||
channel = {
|
channel = {
|
||||||
Account: 'rB5Ux4Lv2nRx6eeoAAsZmtctnBQ2LiACnk',
|
Account: 'rB5Ux4Lv2nRx6eeoAAsZmtctnBQ2LiACnk',
|
||||||
TransactionType: 'PaymentChannelClaim',
|
TransactionType: 'PaymentChannelClaim',
|
||||||
|
NetworkID: 21338,
|
||||||
Channel:
|
Channel:
|
||||||
'C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198',
|
'C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198',
|
||||||
Balance: '1000000',
|
Balance: '1000000',
|
||||||
@@ -77,12 +78,12 @@ describe('PaymentChannelClaim', function () {
|
|||||||
assert.throws(
|
assert.throws(
|
||||||
() => validatePaymentChannelClaim(channel),
|
() => validatePaymentChannelClaim(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelClaim: Balance must be an Amount',
|
'PaymentChannelClaim: Balance must be a string',
|
||||||
)
|
)
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validate(channel),
|
() => validate(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelClaim: Balance must be an Amount',
|
'PaymentChannelClaim: Balance must be a string',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -92,12 +93,12 @@ describe('PaymentChannelClaim', function () {
|
|||||||
assert.throws(
|
assert.throws(
|
||||||
() => validatePaymentChannelClaim(channel),
|
() => validatePaymentChannelClaim(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelClaim: Amount must be an Amount',
|
'PaymentChannelClaim: Amount must be a string',
|
||||||
)
|
)
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validate(channel),
|
() => validate(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelClaim: Amount must be an Amount',
|
'PaymentChannelClaim: Amount must be a string',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('PaymentChannelCreate', function () {
|
|||||||
channel = {
|
channel = {
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
TransactionType: 'PaymentChannelCreate',
|
TransactionType: 'PaymentChannelCreate',
|
||||||
|
NetworkID: 21338,
|
||||||
Amount: '10000',
|
Amount: '10000',
|
||||||
Destination: 'rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW',
|
Destination: 'rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW',
|
||||||
SettleDelay: 86400,
|
SettleDelay: 86400,
|
||||||
@@ -106,12 +107,12 @@ describe('PaymentChannelCreate', function () {
|
|||||||
assert.throws(
|
assert.throws(
|
||||||
() => validatePaymentChannelCreate(channel),
|
() => validatePaymentChannelCreate(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelCreate: Amount must be an Amount',
|
'PaymentChannelCreate: Amount must be a string',
|
||||||
)
|
)
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validate(channel),
|
() => validate(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelCreate: Amount must be an Amount',
|
'PaymentChannelCreate: Amount must be a string',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('PaymentChannelFund', function () {
|
|||||||
channel = {
|
channel = {
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
TransactionType: 'PaymentChannelFund',
|
TransactionType: 'PaymentChannelFund',
|
||||||
|
NetworkID: 21338,
|
||||||
Channel:
|
Channel:
|
||||||
'C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198',
|
'C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198',
|
||||||
Amount: '200000',
|
Amount: '200000',
|
||||||
@@ -70,12 +71,12 @@ describe('PaymentChannelFund', function () {
|
|||||||
assert.throws(
|
assert.throws(
|
||||||
() => validatePaymentChannelFund(channel),
|
() => validatePaymentChannelFund(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelFund: Amount must be an Amount',
|
'PaymentChannelFund: Amount must be a string',
|
||||||
)
|
)
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validate(channel),
|
() => validate(channel),
|
||||||
ValidationError,
|
ValidationError,
|
||||||
'PaymentChannelFund: Amount must be an Amount',
|
'PaymentChannelFund: Amount must be a string',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ describe('SetRegularKey', function () {
|
|||||||
TransactionType: 'SetRegularKey',
|
TransactionType: 'SetRegularKey',
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
RegularKey: 'rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD',
|
RegularKey: 'rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD',
|
||||||
} as any
|
} as any
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ describe('SignerListSet', function () {
|
|||||||
TransactionType: 'SignerListSet',
|
TransactionType: 'SignerListSet',
|
||||||
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
||||||
Fee: '12',
|
Fee: '12',
|
||||||
|
NetworkID: 21338,
|
||||||
SignerQuorum: 3,
|
SignerQuorum: 3,
|
||||||
SignerEntries: [
|
SignerEntries: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('TicketCreate', function () {
|
|||||||
ticketCreate = {
|
ticketCreate = {
|
||||||
TransactionType: 'TicketCreate',
|
TransactionType: 'TicketCreate',
|
||||||
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
||||||
|
NetworkID: 21338,
|
||||||
TicketCount: 150,
|
TicketCount: 150,
|
||||||
} as any
|
} as any
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('TrustSet', function () {
|
|||||||
trustSet = {
|
trustSet = {
|
||||||
TransactionType: 'TrustSet',
|
TransactionType: 'TrustSet',
|
||||||
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
||||||
|
NetworkID: 21338,
|
||||||
LimitAmount: {
|
LimitAmount: {
|
||||||
currency: 'XRP',
|
currency: 'XRP',
|
||||||
issuer: 'rcXY84C4g14iFp6taFXjjQGVeHqSCh9RX',
|
issuer: 'rcXY84C4g14iFp6taFXjjQGVeHqSCh9RX',
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ describe('Models Utils', function () {
|
|||||||
const tx: OfferCreate = {
|
const tx: OfferCreate = {
|
||||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
|
NetworkID: 21338,
|
||||||
TakerGets: {
|
TakerGets: {
|
||||||
currency: 'DSH',
|
currency: 'DSH',
|
||||||
issuer: 'rcXY84C4g14iFp6taFXjjQGVeHqSCh9RX',
|
issuer: 'rcXY84C4g14iFp6taFXjjQGVeHqSCh9RX',
|
||||||
|
|||||||
Reference in New Issue
Block a user