mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
Compare commits
3 Commits
sidechain-
...
denis-urit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7efc525fa2 | ||
|
|
f3ec0f654e | ||
|
|
4b63c2bd95 |
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"editor.tabSize": 2,
|
||||
"cSpell.words": [
|
||||
"hostid",
|
||||
"Multisigned",
|
||||
"preauthorization",
|
||||
"secp256k1",
|
||||
"Setf",
|
||||
"xchain"
|
||||
"hostid",
|
||||
"preauthorization",
|
||||
"secp256k1"
|
||||
],
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
|
||||
@@ -177,33 +177,32 @@ npm uninstall abbrev -w xrpl
|
||||
|
||||
NOW WE ARE READY TO PUBLISH! No new code changes happen manually now.
|
||||
|
||||
2. Checkout `main` (or your beta branch) and `git pull`.
|
||||
3. Create a new branch (`git checkout -b <BRANCH_NAME>`) to capture updates that take place during this process.
|
||||
2. Checkout `main` and `git pull`.
|
||||
3. Create a new branch to capture updates that take place during this process. `git checkout -b <BRANCH_NAME>`
|
||||
4. Update `HISTORY.md` to reflect release changes.
|
||||
5. Run `npm run docgen` if the docs were modified in this release to update them (skip this step for a beta).
|
||||
5. Run `npm run docgen` if the docs were modified in this release to update them.
|
||||
6. Run `npm run build` to triple check the build still works
|
||||
7. Run `npx lerna version --no-git-tag-version` - This creates a draft PR and bumps the versions of the packages.
|
||||
* For each changed package, pick what the new version should be. Lerna will bump the versions, commit version bumps to `main`, and create a new git tag for each published package.
|
||||
* If publishing a beta, make sure that the versions are all of the form `a.b.c-beta.d`, where `a`, `b`, and `c` are identical to the last normal release except for one, which has been incremented by 1.
|
||||
8. Run `npm i` to update the package-lock with the updated versions
|
||||
9. Create a new PR from this branch into `main` and merge it (you can directly merge into the beta branch for a beta).
|
||||
10. Checkout `main` and `git pull` (you can skip this step for a beta since you already have the latest version of the beta branch).
|
||||
11. Run `npx lerna publish from-package --yes` - This will actually publish the packages.
|
||||
* NOTE: if you're releasing a beta, run `npx lerna publish from-package --dist-tag beta --yes` instead.
|
||||
* If it asks for it, enter your [npmjs.com](https://npmjs.com) OTP (one-time password) to complete publication.
|
||||
12. Create a new branch (`git checkout -b <BRANCH_NAME>`)to capture the updated packages from the release. Merge those changes into `main`. (You can skip this step on a beta release).
|
||||
7. Run `npx lerna version --no-git-tag-version` - This creates a draft PR and release tags for the new version.
|
||||
8. For each changed package, pick what the new version should be. Lerna will bump the versions, commit version bumps to `main`, and create a new git tag for each published package.
|
||||
9. Run `npm i` to update the package-lock with the updated versions
|
||||
10. Create a new PR from this branch into `main` and merge it.
|
||||
11. Checkout `main` and `git pull`
|
||||
12. Run `npx lerna publish from-package --yes` - This will actually publish the packages.
|
||||
13. If it asks for it, enter your [npmjs.com](https://npmjs.com) OTP (one-time password) to complete publication.
|
||||
14. Create a new branch to capture the updated packages from the release (`git checkout -b <BRANCH_NAME>`)
|
||||
15. Make a PR to merge those changes into `main`
|
||||
|
||||
NOW YOU HAVE PUBLISHED! But you're not done; we have to notify people!
|
||||
|
||||
13. Pull the most recent changes to main locally.
|
||||
14. Run `git tag <tagname> -m <tagname>`, where `<tagname>` is the new package and version (e.g. `xrpl@2.1.1`), for each version released.
|
||||
15. Run `git push --follow-tags`, to push the tags to Github.
|
||||
16. On Github, click the "releases" link on the right-hand side of the page.
|
||||
17. Click "Draft a new release"
|
||||
18. Click "Choose a tag", and choose a tag that you just created.
|
||||
19. Edit the name of the release to match the tag (IE \<package\>@\<version\>) and edit the description as you see fit.
|
||||
20. Repeat steps 17-19 for each release.
|
||||
21. Send an email to [xrpl-announce](https://groups.google.com/g/xrpl-announce).
|
||||
16. Pull the most recent changes to main locally.
|
||||
17. Run `git tag <tagname> -m <tagname>`, where `<tagname>` is the new package and version (e.g. `xrpl@2.1.1`), for each version released.
|
||||
18. Run `git push --follow-tags`, to push the tags to Github.
|
||||
19. On Github, click the "releases" link on the right-hand side of the page.
|
||||
20. Click "Draft a new release"
|
||||
21. Click "Choose a tag", and choose a tag that you just created.
|
||||
22. Edit the name of the release to match the tag (IE \<package\>@\<version\>) and edit the description as you see fit.
|
||||
23. Repeat steps 19-21 for each release.
|
||||
24. Send an email to [xrpl-announce](https://groups.google.com/g/xrpl-announce).
|
||||
|
||||
## Mailing Lists
|
||||
|
||||
|
||||
@@ -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())
|
||||
172
package-lock.json
generated
172
package-lock.json
generated
@@ -65,7 +65,7 @@
|
||||
"url": "^0.11.0",
|
||||
"webpack": "^5.6.0",
|
||||
"webpack-bundle-analyzer": "^4.1.0",
|
||||
"webpack-cli": "^5.0.1"
|
||||
"webpack-cli": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0",
|
||||
@@ -3339,42 +3339,34 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@webpack-cli/configtest": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz",
|
||||
"integrity": "sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz",
|
||||
"integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "5.x.x",
|
||||
"webpack-cli": "5.x.x"
|
||||
"webpack": "4.x.x || 5.x.x",
|
||||
"webpack-cli": "4.x.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@webpack-cli/info": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz",
|
||||
"integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz",
|
||||
"integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
"dependencies": {
|
||||
"envinfo": "^7.7.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "5.x.x",
|
||||
"webpack-cli": "5.x.x"
|
||||
"webpack-cli": "4.x.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@webpack-cli/serve": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.1.tgz",
|
||||
"integrity": "sha512-0G7tNyS+yW8TdgHwZKlDWYXFA6OJQnoLCQvYKkQP0Q2X205PSQ6RNUj0M+1OB/9gRQaUZ/ccYfaxd0nhaWKfjw==",
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz",
|
||||
"integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "5.x.x",
|
||||
"webpack-cli": "5.x.x"
|
||||
"webpack-cli": "4.x.x"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"webpack-dev-server": {
|
||||
@@ -8788,12 +8780,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/interpret": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",
|
||||
"integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz",
|
||||
"integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/ip": {
|
||||
@@ -13447,9 +13439,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz",
|
||||
"integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==",
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz",
|
||||
"integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
@@ -14228,15 +14220,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rechoir": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
|
||||
"integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
|
||||
"integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"resolve": "^1.20.0"
|
||||
"resolve": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/redent": {
|
||||
@@ -16629,42 +16621,44 @@
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-cli": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.1.tgz",
|
||||
"integrity": "sha512-S3KVAyfwUqr0Mo/ur3NzIp6jnerNpo7GUO6so51mxLi1spqsA17YcMXy0WOIJtBSnj748lthxC6XLbNKh/ZC+A==",
|
||||
"version": "4.10.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz",
|
||||
"integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@discoveryjs/json-ext": "^0.5.0",
|
||||
"@webpack-cli/configtest": "^2.0.1",
|
||||
"@webpack-cli/info": "^2.0.1",
|
||||
"@webpack-cli/serve": "^2.0.1",
|
||||
"@webpack-cli/configtest": "^1.2.0",
|
||||
"@webpack-cli/info": "^1.5.0",
|
||||
"@webpack-cli/serve": "^1.7.0",
|
||||
"colorette": "^2.0.14",
|
||||
"commander": "^9.4.1",
|
||||
"commander": "^7.0.0",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"envinfo": "^7.7.3",
|
||||
"fastest-levenshtein": "^1.0.12",
|
||||
"import-local": "^3.0.2",
|
||||
"interpret": "^3.1.1",
|
||||
"rechoir": "^0.8.0",
|
||||
"interpret": "^2.2.0",
|
||||
"rechoir": "^0.7.0",
|
||||
"webpack-merge": "^5.7.3"
|
||||
},
|
||||
"bin": {
|
||||
"webpack-cli": "bin/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "5.x.x"
|
||||
"webpack": "4.x.x || 5.x.x"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@webpack-cli/generators": {
|
||||
"optional": true
|
||||
},
|
||||
"@webpack-cli/migrate": {
|
||||
"optional": true
|
||||
},
|
||||
"webpack-bundle-analyzer": {
|
||||
"optional": true
|
||||
},
|
||||
@@ -16674,12 +16668,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-cli/node_modules/commander": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-merge": {
|
||||
@@ -17135,8 +17129,7 @@
|
||||
}
|
||||
},
|
||||
"packages/ripple-binary-codec": {
|
||||
"version": "1.5.0-beta.0",
|
||||
"integrity": "sha512-XMRCbFXyG+dGp3x7tMs9IwA+FVWPPaGjdHYW2+g4Q/WQJqFp5MRED+jjOBOUafmrW4TUsOn1PEEdbB4ozWbDBw==",
|
||||
"version": "1.4.2",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"assert": "^2.0.0",
|
||||
@@ -17182,7 +17175,7 @@
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"ripple-address-codec": "^4.2.4",
|
||||
"ripple-binary-codec": "^1.5.0-beta.0",
|
||||
"ripple-binary-codec": "^1.4.2",
|
||||
"ripple-keypairs": "^1.1.4",
|
||||
"ws": "^8.2.2"
|
||||
},
|
||||
@@ -19879,23 +19872,25 @@
|
||||
}
|
||||
},
|
||||
"@webpack-cli/configtest": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz",
|
||||
"integrity": "sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz",
|
||||
"integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"@webpack-cli/info": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz",
|
||||
"integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz",
|
||||
"integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"requires": {
|
||||
"envinfo": "^7.7.3"
|
||||
}
|
||||
},
|
||||
"@webpack-cli/serve": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.1.tgz",
|
||||
"integrity": "sha512-0G7tNyS+yW8TdgHwZKlDWYXFA6OJQnoLCQvYKkQP0Q2X205PSQ6RNUj0M+1OB/9gRQaUZ/ccYfaxd0nhaWKfjw==",
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz",
|
||||
"integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
@@ -24138,9 +24133,9 @@
|
||||
}
|
||||
},
|
||||
"interpret": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",
|
||||
"integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz",
|
||||
"integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==",
|
||||
"dev": true
|
||||
},
|
||||
"ip": {
|
||||
@@ -27842,9 +27837,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz",
|
||||
"integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==",
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz",
|
||||
"integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-linter-helpers": {
|
||||
@@ -28461,12 +28456,12 @@
|
||||
}
|
||||
},
|
||||
"rechoir": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
|
||||
"integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
|
||||
"integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"resolve": "^1.20.0"
|
||||
"resolve": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"redent": {
|
||||
@@ -30289,30 +30284,29 @@
|
||||
}
|
||||
},
|
||||
"webpack-cli": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.1.tgz",
|
||||
"integrity": "sha512-S3KVAyfwUqr0Mo/ur3NzIp6jnerNpo7GUO6so51mxLi1spqsA17YcMXy0WOIJtBSnj748lthxC6XLbNKh/ZC+A==",
|
||||
"version": "4.10.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz",
|
||||
"integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@discoveryjs/json-ext": "^0.5.0",
|
||||
"@webpack-cli/configtest": "^2.0.1",
|
||||
"@webpack-cli/info": "^2.0.1",
|
||||
"@webpack-cli/serve": "^2.0.1",
|
||||
"@webpack-cli/configtest": "^1.2.0",
|
||||
"@webpack-cli/info": "^1.5.0",
|
||||
"@webpack-cli/serve": "^1.7.0",
|
||||
"colorette": "^2.0.14",
|
||||
"commander": "^9.4.1",
|
||||
"commander": "^7.0.0",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"envinfo": "^7.7.3",
|
||||
"fastest-levenshtein": "^1.0.12",
|
||||
"import-local": "^3.0.2",
|
||||
"interpret": "^3.1.1",
|
||||
"rechoir": "^0.8.0",
|
||||
"interpret": "^2.2.0",
|
||||
"rechoir": "^0.7.0",
|
||||
"webpack-merge": "^5.7.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
@@ -30602,7 +30596,7 @@
|
||||
"node-polyfill-webpack-plugin": "^2.0.1",
|
||||
"react": "^18.2.0",
|
||||
"ripple-address-codec": "^4.2.4",
|
||||
"ripple-binary-codec": "^1.5.0-beta.0",
|
||||
"ripple-binary-codec": "^1.4.2",
|
||||
"ripple-keypairs": "^1.1.4",
|
||||
"typedoc": "^0.23.24",
|
||||
"ws": "^8.2.2"
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
"url": "^0.11.0",
|
||||
"webpack": "^5.6.0",
|
||||
"webpack-bundle-analyzer": "^4.1.0",
|
||||
"webpack-cli": "^5.0.1"
|
||||
"webpack-cli": "^4.2.0"
|
||||
},
|
||||
"workspaces": [
|
||||
"./packages/*"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ripple-binary-codec",
|
||||
"version": "1.5.0-beta.0",
|
||||
"version": "1.4.2",
|
||||
"description": "XRP Ledger binary codec",
|
||||
"files": [
|
||||
"dist/*",
|
||||
@@ -22,8 +22,8 @@
|
||||
"scripts": {
|
||||
"build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
||||
"clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
|
||||
"prepare": "npm test",
|
||||
"test": "npm run build && jest --verbose false --silent=false ./test/*.test.js",
|
||||
"prepare": "npm run build && npm test",
|
||||
"test": "jest --verbose false --silent=false ./test/*.test.js",
|
||||
"lint": "eslint . --ext .ts --ext .test.js"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
"UInt192": 21,
|
||||
"UInt384": 22,
|
||||
"UInt512": 23,
|
||||
"Issue": 24,
|
||||
"XChainBridge": 25,
|
||||
"Transaction": 10001,
|
||||
"LedgerEntry": 10002,
|
||||
"Validation": 10003,
|
||||
@@ -36,11 +34,8 @@
|
||||
"Ticket": 84,
|
||||
"SignerList": 83,
|
||||
"Offer": 111,
|
||||
"Bridge": 105,
|
||||
"LedgerHashes": 104,
|
||||
"Amendments": 102,
|
||||
"XChainClaimID": 113,
|
||||
"XChainCreateAccountClaimID": 116,
|
||||
"FeeSettings": 115,
|
||||
"Escrow": 117,
|
||||
"PayChannel": 120,
|
||||
@@ -49,6 +44,7 @@
|
||||
"NegativeUNL": 78,
|
||||
"NFTokenPage": 80,
|
||||
"NFTokenOffer": 55,
|
||||
"URIToken": 85,
|
||||
"Any": -3,
|
||||
"Child": -2,
|
||||
"Nickname": 110,
|
||||
@@ -236,16 +232,6 @@
|
||||
"type": "UInt8"
|
||||
}
|
||||
],
|
||||
[
|
||||
"WasLockingChainSend",
|
||||
{
|
||||
"nth": 19,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "UInt8"
|
||||
}
|
||||
],
|
||||
[
|
||||
"LedgerEntryType",
|
||||
{
|
||||
@@ -946,36 +932,6 @@
|
||||
"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",
|
||||
{
|
||||
@@ -1326,6 +1282,16 @@
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"URITokenID",
|
||||
{
|
||||
"nth": 36,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"Amount",
|
||||
{
|
||||
@@ -1466,26 +1432,6 @@
|
||||
"type": "Amount"
|
||||
}
|
||||
],
|
||||
[
|
||||
"SignatureReward",
|
||||
{
|
||||
"nth": 29,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Amount"
|
||||
}
|
||||
],
|
||||
[
|
||||
"MinAccountCreateAmount",
|
||||
{
|
||||
"nth": 30,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Amount"
|
||||
}
|
||||
],
|
||||
[
|
||||
"PublicKey",
|
||||
{
|
||||
@@ -1826,66 +1772,6 @@
|
||||
"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",
|
||||
{
|
||||
@@ -1936,36 +1822,6 @@
|
||||
"type": "PathSet"
|
||||
}
|
||||
],
|
||||
[
|
||||
"LockingChainIssue",
|
||||
{
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Issue"
|
||||
}
|
||||
],
|
||||
[
|
||||
"IssuingChainIssue",
|
||||
{
|
||||
"nth": 2,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Issue"
|
||||
}
|
||||
],
|
||||
[
|
||||
"XChainBridge",
|
||||
{
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "XChainBridge"
|
||||
}
|
||||
],
|
||||
[
|
||||
"TransactionMetaData",
|
||||
{
|
||||
@@ -2176,46 +2032,6 @@
|
||||
"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",
|
||||
{
|
||||
@@ -2355,46 +2171,6 @@
|
||||
"isSigningField": true,
|
||||
"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"
|
||||
}
|
||||
]
|
||||
],
|
||||
"TRANSACTION_RESULTS": {
|
||||
@@ -2450,15 +2226,6 @@
|
||||
"temUNKNOWN": -264,
|
||||
"temSEQ_AND_TICKET": -263,
|
||||
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
||||
"temBAD_AMM_OPTIONS": -261,
|
||||
"temBAD_AMM_TOKENS": -260,
|
||||
"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,
|
||||
"tefALREADY": -198,
|
||||
@@ -2542,32 +2309,7 @@
|
||||
"tecCANT_ACCEPT_OWN_NFTOKEN_OFFER": 158,
|
||||
"tecINSUFFICIENT_FUNDS": 159,
|
||||
"tecOBJECT_NOT_FOUND": 160,
|
||||
"tecINSUFFICIENT_PAYMENT": 161,
|
||||
"tecUNFUNDED_AMM": 162,
|
||||
"tecAMM_BALANCE": 163,
|
||||
"tecAMM_FAILED_DEPOSIT": 164,
|
||||
"tecAMM_FAILED_WITHDRAW": 165,
|
||||
"tecAMM_INVALID_TOKENS": 166,
|
||||
"tecAMM_EXISTS": 167,
|
||||
"tecAMM_FAILED_BID": 168,
|
||||
"tecAMM_DIRECT_PAYMENT": 169,
|
||||
"tecAMM_FAILED_VOTE": 170,
|
||||
"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
|
||||
"tecINSUFFICIENT_PAYMENT": 161
|
||||
},
|
||||
"TRANSACTION_TYPES": {
|
||||
"Invalid": -1,
|
||||
@@ -2599,14 +2341,11 @@
|
||||
"NFTokenCreateOffer": 27,
|
||||
"NFTokenCancelOffer": 28,
|
||||
"NFTokenAcceptOffer": 29,
|
||||
"XChainCreateBridge": 40,
|
||||
"XChainCreateClaimID": 41,
|
||||
"XChainCommit": 42,
|
||||
"XChainClaim": 43,
|
||||
"XChainAccountCreateCommit": 44,
|
||||
"XChainAddClaimAttestation": 45,
|
||||
"XChainAddAccountCreateAttestation": 46,
|
||||
"XChainModifyBridge": 47,
|
||||
"URITokenMint": 45,
|
||||
"URITokenBurn": 46,
|
||||
"URITokenBuy": 47,
|
||||
"URITokenCreateSellOffer": 48,
|
||||
"URITokenCancelSellOffer": 49,
|
||||
"EnableAmendment": 100,
|
||||
"SetFee": 101,
|
||||
"UNLModify": 102
|
||||
|
||||
@@ -11,7 +11,6 @@ import { Currency } from './currency'
|
||||
import { Hash128 } from './hash-128'
|
||||
import { Hash160 } from './hash-160'
|
||||
import { Hash256 } from './hash-256'
|
||||
import { Issue } from './issue'
|
||||
import { PathSet } from './path-set'
|
||||
import { STArray } from './st-array'
|
||||
import { STObject } from './st-object'
|
||||
@@ -20,7 +19,6 @@ import { UInt32 } from './uint-32'
|
||||
import { UInt64 } from './uint-64'
|
||||
import { UInt8 } from './uint-8'
|
||||
import { Vector256 } from './vector-256'
|
||||
import { XChainBridge } from './xchain-bridge'
|
||||
|
||||
const coreTypes = {
|
||||
AccountID,
|
||||
@@ -30,7 +28,6 @@ const coreTypes = {
|
||||
Hash128,
|
||||
Hash160,
|
||||
Hash256,
|
||||
Issue,
|
||||
PathSet,
|
||||
STArray,
|
||||
STObject,
|
||||
@@ -39,7 +36,6 @@ const coreTypes = {
|
||||
UInt32,
|
||||
UInt64,
|
||||
Vector256,
|
||||
XChainBridge,
|
||||
}
|
||||
|
||||
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,207 +4435,20 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"transactions": [
|
||||
{
|
||||
"binary": "1200002200000000240000003E6140000002540BE40068400000000000000A7321034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E74473045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F17962646398114550FC62003E785DC231A1058A05E56E3F09CF4E68314D4CC8AB5B21D86A82C3E9E8D0ECF2404B77FECBA",
|
||||
"json": {
|
||||
"Account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
||||
"Destination": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
|
||||
"SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
|
||||
"Amount": "10000000000",
|
||||
"Fee": "10",
|
||||
"Flags": 0,
|
||||
"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"
|
||||
}
|
||||
"transactions": [{
|
||||
"binary": "1200002200000000240000003E6140000002540BE40068400000000000000A7321034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E74473045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F17962646398114550FC62003E785DC231A1058A05E56E3F09CF4E68314D4CC8AB5B21D86A82C3E9E8D0ECF2404B77FECBA",
|
||||
"json": {
|
||||
"Account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
||||
"Destination": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
|
||||
"SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
|
||||
"Amount": "10000000000",
|
||||
"Fee": "10",
|
||||
"Flags": 0,
|
||||
"Sequence": 62
|
||||
}
|
||||
],
|
||||
}],
|
||||
"ledgerData": [{
|
||||
"binary": "01E91435016340767BF1C4A3EACEB081770D8ADE216C85445DD6FB002C6B5A2930F2DECE006DA18150CB18F6DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F873B5C3E520634D343EF5D9D9A4246643D64DAD278BA95DC0EAC6EB5350CF970D521276CDE21276CE60A00",
|
||||
"json": {
|
||||
@@ -4650,4 +4463,4 @@
|
||||
"transaction_hash": "DD33F6F0990754C962A7CCE62F332FF9C13939B03B864117F0BDA86B6E9B4F87"
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,6 @@ Wallet.fromMmnemonic()
|
||||
|
||||
### Added
|
||||
* Optional custom amount field to `fundWallet`.
|
||||
* Support for `disallowIncoming` account set flags (e.g. `asfDisallowIncomingTrustline`)
|
||||
* Support for the cross-chain bridge feature.
|
||||
|
||||
### Changed
|
||||
* Add support for Transaction objects in `verifyTransaction`
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"ripple-address-codec": "^4.2.4",
|
||||
"ripple-binary-codec": "^1.5.0-beta.0",
|
||||
"ripple-binary-codec": "^1.4.2",
|
||||
"ripple-keypairs": "^1.1.4",
|
||||
"ws": "^8.2.2"
|
||||
},
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
export type LedgerIndex = number | ('validated' | 'closed' | 'current')
|
||||
|
||||
export type AccountObjectType =
|
||||
| 'check'
|
||||
| 'deposit_preauth'
|
||||
| 'escrow'
|
||||
| 'nft_offer'
|
||||
| 'offer'
|
||||
| 'payment_channel'
|
||||
| 'signer_list'
|
||||
| 'ticket'
|
||||
| 'state'
|
||||
|
||||
interface XRP {
|
||||
currency: 'XRP'
|
||||
}
|
||||
|
||||
export interface IssuedCurrency {
|
||||
interface IssuedCurrency {
|
||||
currency: string
|
||||
issuer: string
|
||||
}
|
||||
@@ -117,10 +128,3 @@ export interface NFTOffer {
|
||||
destination?: string
|
||||
expiration?: number
|
||||
}
|
||||
|
||||
export interface XChainBridge {
|
||||
LockingChainDoor: string
|
||||
LockingChainIssue: Currency
|
||||
IssuingChainDoor: string
|
||||
IssuingChainIssue: Currency
|
||||
}
|
||||
|
||||
@@ -116,22 +116,6 @@ export interface AccountRootFlagsInterface {
|
||||
* (It has DepositAuth enabled.)
|
||||
*/
|
||||
lsfDepositAuth?: boolean
|
||||
/**
|
||||
* Disallow incoming NFTOffers from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingNFTOffer?: boolean
|
||||
/**
|
||||
* Disallow incoming Checks from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingCheck?: boolean
|
||||
/**
|
||||
* Disallow incoming PayChannels from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingPayChan?: boolean
|
||||
/**
|
||||
* Disallow incoming Trustlines from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingTrustline?: boolean
|
||||
}
|
||||
|
||||
export enum AccountRootFlags {
|
||||
@@ -172,20 +156,4 @@ export enum AccountRootFlags {
|
||||
* (It has DepositAuth enabled.)
|
||||
*/
|
||||
lsfDepositAuth = 0x01000000,
|
||||
/**
|
||||
* Disallow incoming NFTOffers from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingNFTOffer = 0x04000000,
|
||||
/**
|
||||
* Disallow incoming Checks from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingCheck = 0x08000000,
|
||||
/**
|
||||
* Disallow incoming PayChannels from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingPayChan = 0x10000000,
|
||||
/**
|
||||
* Disallow incoming Trustlines from other accounts.
|
||||
*/
|
||||
lsfDisallowIncomingTrustline = 0x20000000,
|
||||
}
|
||||
|
||||
@@ -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,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,
|
||||
} from './AccountRoot'
|
||||
import Amendments from './Amendments'
|
||||
import Bridge from './Bridge'
|
||||
import Check from './Check'
|
||||
import DepositPreauth from './DepositPreauth'
|
||||
import DirectoryNode from './DirectoryNode'
|
||||
@@ -18,15 +17,12 @@ import PayChannel from './PayChannel'
|
||||
import RippleState, { RippleStateFlags } from './RippleState'
|
||||
import SignerList, { SignerListFlags } from './SignerList'
|
||||
import Ticket from './Ticket'
|
||||
import XChainOwnedClaimID from './XChainOwnedClaimID'
|
||||
import XChainOwnedCreateAccountClaimID from './XChainOwnedCreateAccountClaimID'
|
||||
|
||||
export {
|
||||
AccountRoot,
|
||||
AccountRootFlags,
|
||||
AccountRootFlagsInterface,
|
||||
Amendments,
|
||||
Bridge,
|
||||
Check,
|
||||
DepositPreauth,
|
||||
DirectoryNode,
|
||||
@@ -44,6 +40,4 @@ export {
|
||||
SignerList,
|
||||
SignerListFlags,
|
||||
Ticket,
|
||||
XChainOwnedClaimID,
|
||||
XChainOwnedCreateAccountClaimID,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LedgerIndex } from '../common'
|
||||
import { AccountObjectType, LedgerIndex } from '../common'
|
||||
import {
|
||||
Check,
|
||||
DepositPreauth,
|
||||
@@ -8,25 +8,10 @@ import {
|
||||
RippleState,
|
||||
SignerList,
|
||||
Ticket,
|
||||
XChainOwnedClaimID,
|
||||
XChainOwnedCreateAccountClaimID,
|
||||
} from '../ledger'
|
||||
|
||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||
|
||||
type AccountObjectType =
|
||||
| 'check'
|
||||
| 'deposit_preauth'
|
||||
| 'escrow'
|
||||
| 'nft_offer'
|
||||
| 'offer'
|
||||
| 'payment_channel'
|
||||
| 'signer_list'
|
||||
| 'state'
|
||||
| 'ticket'
|
||||
| 'xchain_create_account_claim_id'
|
||||
| 'xchain_claim_id'
|
||||
|
||||
/**
|
||||
* The account_objects command returns the raw ledger format for all objects
|
||||
* owned by an account. For a higher-level view of an account's trust lines and
|
||||
@@ -80,10 +65,8 @@ type AccountObject =
|
||||
| Offer
|
||||
| PayChannel
|
||||
| SignerList
|
||||
| RippleState
|
||||
| Ticket
|
||||
| XChainOwnedClaimID
|
||||
| XChainOwnedCreateAccountClaimID
|
||||
| RippleState
|
||||
|
||||
/**
|
||||
* Response expected from an {@link AccountObjectsRequest}.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Currency, LedgerIndex } from '../common'
|
||||
import { LedgerIndex } from '../common'
|
||||
import { LedgerEntry } from '../ledger'
|
||||
|
||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||
@@ -46,23 +46,6 @@ export interface LedgerEntryRequest extends BaseRequest {
|
||||
*/
|
||||
account_root?: string
|
||||
|
||||
/** The object ID of a Check object to retrieve. */
|
||||
check?: string
|
||||
|
||||
/**
|
||||
* Specify a DepositPreauth object to retrieve. If a string, must be the
|
||||
* object ID of the DepositPreauth object, as hexadecimal. If an object,
|
||||
* requires owner and authorized sub-fields.
|
||||
*/
|
||||
deposit_preauth?:
|
||||
| {
|
||||
/** The account that provided the preauthorization. */
|
||||
owner: string
|
||||
/** The account that received the preauthorization. */
|
||||
authorized: string
|
||||
}
|
||||
| string
|
||||
|
||||
/**
|
||||
* The DirectoryNode to retrieve. If a string, must be the object ID of the
|
||||
* directory, as hexadecimal. If an object, requires either `dir_root` o
|
||||
@@ -79,19 +62,6 @@ export interface LedgerEntryRequest extends BaseRequest {
|
||||
}
|
||||
| string
|
||||
|
||||
/**
|
||||
* The Escrow object to retrieve. If a string, must be the object ID of the
|
||||
* escrow, as hexadecimal. If an object, requires owner and seq sub-fields.
|
||||
*/
|
||||
escrow?:
|
||||
| {
|
||||
/** The owner (sender) of the Escrow object. */
|
||||
owner: string
|
||||
/** Sequence Number of the transaction that created the Escrow object. */
|
||||
seq: number
|
||||
}
|
||||
| string
|
||||
|
||||
/**
|
||||
* The Offer object to retrieve. If a string, interpret as the unique object
|
||||
* ID to the Offer. If an object, requires the sub-fields `account` and `seq`
|
||||
@@ -106,9 +76,6 @@ export interface LedgerEntryRequest extends BaseRequest {
|
||||
}
|
||||
| string
|
||||
|
||||
/** The object ID of a PayChannel object to retrieve. */
|
||||
payment_channel?: string
|
||||
|
||||
/**
|
||||
* Object specifying the RippleState (trust line) object to retrieve. The
|
||||
* accounts and currency sub-fields are required to uniquely specify the
|
||||
@@ -124,6 +91,39 @@ export interface LedgerEntryRequest extends BaseRequest {
|
||||
currency: string
|
||||
}
|
||||
|
||||
/** The object ID of a Check object to retrieve. */
|
||||
check?: string
|
||||
|
||||
/**
|
||||
* The Escrow object to retrieve. If a string, must be the object ID of the
|
||||
* escrow, as hexadecimal. If an object, requires owner and seq sub-fields.
|
||||
*/
|
||||
escrow?:
|
||||
| {
|
||||
/** The owner (sender) of the Escrow object. */
|
||||
owner: string
|
||||
/** Sequence Number of the transaction that created the Escrow object. */
|
||||
seq: number
|
||||
}
|
||||
| string
|
||||
|
||||
/** The object ID of a PayChannel object to retrieve. */
|
||||
payment_channel?: string
|
||||
|
||||
/**
|
||||
* Specify a DepositPreauth object to retrieve. If a string, must be the
|
||||
* object ID of the DepositPreauth object, as hexadecimal. If an object,
|
||||
* requires owner and authorized sub-fields.
|
||||
*/
|
||||
deposit_preauth?:
|
||||
| {
|
||||
/** The account that provided the preauthorization. */
|
||||
owner: string
|
||||
/** The account that received the preauthorization. */
|
||||
authorized: string
|
||||
}
|
||||
| string
|
||||
|
||||
/**
|
||||
* The Ticket object to retrieve. If a string, must be the object ID of the
|
||||
* Ticket, as hexadecimal. If an object, the `owner` and `ticket_sequence`
|
||||
@@ -137,28 +137,6 @@ export interface LedgerEntryRequest extends BaseRequest {
|
||||
ticket_sequence: number
|
||||
}
|
||||
| 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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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',
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -44,15 +44,6 @@ export enum AccountSetAsfFlags {
|
||||
* Allow another account to mint and burn tokens on behalf of this account.
|
||||
*/
|
||||
asfAuthorizedNFTokenMinter = 10,
|
||||
/** asf 11 is reserved for Hooks amendment */
|
||||
/** Disallow other accounts from creating incoming NFTOffers */
|
||||
asfDisallowIncomingNFTOffer = 12,
|
||||
/** Disallow other accounts from creating incoming Checks */
|
||||
asfDisallowIncomingCheck = 13,
|
||||
/** Disallow other accounts from creating incoming PayChannels */
|
||||
asfDisallowIncomingPayChan = 14,
|
||||
/** Disallow other accounts from creating incoming Trustlines */
|
||||
asfDisallowIncomingTrustline = 15,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,14 +4,7 @@
|
||||
import { TRANSACTION_TYPES } from 'ripple-binary-codec'
|
||||
|
||||
import { ValidationError } from '../../errors'
|
||||
import {
|
||||
Amount,
|
||||
Currency,
|
||||
IssuedCurrencyAmount,
|
||||
Memo,
|
||||
Signer,
|
||||
XChainBridge,
|
||||
} from '../common'
|
||||
import { Amount, IssuedCurrencyAmount, Memo, Signer } from '../common'
|
||||
import { onlyHasFields } from '../utils'
|
||||
|
||||
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 XCHAIN_BRIDGE_SIZE = 4
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
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.
|
||||
*
|
||||
* @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(
|
||||
input: unknown,
|
||||
@@ -105,29 +78,12 @@ export function isIssuedCurrency(
|
||||
* Verify the form and type of an Amount at runtime.
|
||||
*
|
||||
* @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 {
|
||||
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
|
||||
export interface GlobalFlags {}
|
||||
|
||||
|
||||
@@ -45,15 +45,12 @@ export { SetRegularKey } from './setRegularKey'
|
||||
export { SignerListSet } from './signerListSet'
|
||||
export { TicketCreate } from './ticketCreate'
|
||||
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'
|
||||
URITokenMintFlagsInterface,
|
||||
URITokenMintFlags,
|
||||
URITokenMint,
|
||||
} from './uriTokenMint'
|
||||
export { URITokenBurn } from './uriTokenBurn'
|
||||
export { URITokenSell } from './uriTokenSell'
|
||||
export { URITokenBuy } from './uriTokenBuy'
|
||||
export { URITokenClear } from './uriTokenClear'
|
||||
|
||||
@@ -51,32 +51,11 @@ import { SetRegularKey, validateSetRegularKey } from './setRegularKey'
|
||||
import { SignerListSet, validateSignerListSet } from './signerListSet'
|
||||
import { TicketCreate, validateTicketCreate } from './ticketCreate'
|
||||
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'
|
||||
import { URITokenBurn, validateURITokenBurn } from './uriTokenBurn'
|
||||
import { URITokenBuy, validateURITokenBuy } from './uriTokenBuy'
|
||||
import { URITokenClear, validateURITokenClear } from './uriTokenClear'
|
||||
import { URITokenMint, validateURITokenMint } from './uriTokenMint'
|
||||
import { URITokenSell, validateURITokenSell } from './uriTokenSell'
|
||||
|
||||
/**
|
||||
* @category Transaction Models
|
||||
@@ -106,14 +85,11 @@ export type Transaction =
|
||||
| SignerListSet
|
||||
| TicketCreate
|
||||
| TrustSet
|
||||
| XChainAddAccountCreateAttestation
|
||||
| XChainAddClaimAttestation
|
||||
| XChainClaim
|
||||
| XChainCommit
|
||||
| XChainCreateBridge
|
||||
| XChainCreateClaimID
|
||||
| XChainAccountCreateCommit
|
||||
| XChainModifyBridge
|
||||
| URITokenBurn
|
||||
| URITokenBuy
|
||||
| URITokenClear
|
||||
| URITokenMint
|
||||
| URITokenSell
|
||||
|
||||
/**
|
||||
* @category Transaction Models
|
||||
@@ -238,36 +214,24 @@ export function validate(transaction: Record<string, unknown>): void {
|
||||
validateTrustSet(tx)
|
||||
break
|
||||
|
||||
case 'XChainAddAccountCreateAttestation':
|
||||
validateXChainAddAccountCreateAttestation(tx)
|
||||
case 'URITokenMint':
|
||||
validateURITokenMint(tx)
|
||||
break
|
||||
|
||||
case 'XChainAddClaimAttestation':
|
||||
validateXChainAddClaimAttestation(tx)
|
||||
case 'URITokenBurn':
|
||||
validateURITokenBurn(tx)
|
||||
break
|
||||
|
||||
case 'XChainClaim':
|
||||
validateXChainClaim(tx)
|
||||
case 'URITokenCreateSellOffer':
|
||||
validateURITokenSell(tx)
|
||||
break
|
||||
|
||||
case 'XChainCommit':
|
||||
validateXChainCommit(tx)
|
||||
case 'URITokenBuy':
|
||||
validateURITokenBuy(tx)
|
||||
break
|
||||
|
||||
case 'XChainCreateBridge':
|
||||
validateXChainCreateBridge(tx)
|
||||
break
|
||||
|
||||
case 'XChainCreateClaimID':
|
||||
validateXChainCreateClaimID(tx)
|
||||
break
|
||||
|
||||
case 'XChainAccountCreateCommit':
|
||||
validateXChainAccountCreateCommit(tx)
|
||||
break
|
||||
|
||||
case 'XChainModifyBridge':
|
||||
validateXChainModifyBridge(tx)
|
||||
case 'URITokenCancelSellOffer':
|
||||
validateURITokenClear(tx)
|
||||
break
|
||||
|
||||
default:
|
||||
|
||||
60
packages/xrpl/src/models/transactions/uriTokenBurn.ts
Normal file
60
packages/xrpl/src/models/transactions/uriTokenBurn.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
|
||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||
|
||||
/**
|
||||
* Map of flags to boolean values representing {@link URITokenBurn} transaction
|
||||
* flags.
|
||||
*
|
||||
* @category Transaction Flags
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const tx: URITokenBurn = {
|
||||
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* TransactionType: 'URITokenBurn',
|
||||
* }
|
||||
*
|
||||
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
||||
* const autofilledTx = await client.autofill(tx)
|
||||
* console.log(autofilledTx)
|
||||
* // {
|
||||
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* // TransactionType: 'URITokenBurn',
|
||||
* // Sequence: 21970384,
|
||||
* // Fee: '12',
|
||||
* // LastLedgerSequence: 21970404
|
||||
* // }
|
||||
* ```
|
||||
*/
|
||||
|
||||
/**
|
||||
* An URITokenBurn transaction is effectively a limit order . It defines an
|
||||
* intent to exchange currencies, and creates an Offer object if not completely.
|
||||
* Fulfilled when placed. Offers can be partially fulfilled.
|
||||
*
|
||||
* @category Transaction Models
|
||||
*/
|
||||
export interface URITokenBurn extends BaseTransaction {
|
||||
TransactionType: 'URITokenBurn'
|
||||
/**
|
||||
* Identifies the URIToken object to be removed by the transaction.
|
||||
*/
|
||||
URITokenID: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of an URITokenBurn at runtime.
|
||||
*
|
||||
* @param tx - An URITokenBurn Transaction.
|
||||
* @throws When the URITokenBurn is Malformed.
|
||||
*/
|
||||
export function validateURITokenBurn(tx: Record<string, unknown>): void {
|
||||
validateBaseTransaction(tx)
|
||||
|
||||
if (tx.URITokenID == null) {
|
||||
throw new ValidationError('NFTokenBurn: missing field URITokenID')
|
||||
}
|
||||
}
|
||||
83
packages/xrpl/src/models/transactions/uriTokenBuy.ts
Normal file
83
packages/xrpl/src/models/transactions/uriTokenBuy.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
import { Amount } from '../common'
|
||||
|
||||
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
|
||||
|
||||
/**
|
||||
* Map of flags to boolean values representing {@link URITokenBuy} transaction
|
||||
* flags.
|
||||
*
|
||||
* @category Transaction Flags
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const tx: URITokenBuy = {
|
||||
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* Amount: '1000000',
|
||||
* TransactionType: 'URITokenBuy',
|
||||
* }
|
||||
*
|
||||
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
||||
* const autofilledTx = await client.autofill(tx)
|
||||
* console.log(autofilledTx)
|
||||
* // {
|
||||
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* // Amount: '1000000',
|
||||
* // TransactionType: 'URITokenBuy',
|
||||
* // Sequence: 21970384,
|
||||
* // Fee: '12',
|
||||
* // LastLedgerSequence: 21970404
|
||||
* // }
|
||||
* ```
|
||||
*/
|
||||
|
||||
/**
|
||||
* An URITokenBuy transaction is effectively a limit order . It defines an
|
||||
* intent to exchange currencies, and creates an Offer object if not completely.
|
||||
* Fulfilled when placed. Offers can be partially fulfilled.
|
||||
*
|
||||
* @category Transaction Models
|
||||
*/
|
||||
export interface URITokenBuy extends BaseTransaction {
|
||||
TransactionType: 'URITokenBuy'
|
||||
/**
|
||||
* Identifies the URITokenID of the NFToken object that the
|
||||
* offer references.
|
||||
*/
|
||||
URITokenID: string
|
||||
/**
|
||||
* Indicates the amount expected or offered for the Token.
|
||||
*
|
||||
* The amount must be non-zero, except when this is a sell
|
||||
* offer and the asset is XRP. This would indicate that the current
|
||||
* owner of the token is giving it away free, either to anyone at all,
|
||||
* or to the account identified by the Destination field.
|
||||
*/
|
||||
Amount: Amount
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of an URITokenBuy at runtime.
|
||||
*
|
||||
* @param tx - An URITokenBuy Transaction.
|
||||
* @throws When the URITokenBuy is Malformed.
|
||||
*/
|
||||
export function validateURITokenBuy(tx: Record<string, unknown>): void {
|
||||
validateBaseTransaction(tx)
|
||||
|
||||
if (tx.Account === tx.Destination) {
|
||||
throw new ValidationError(
|
||||
'URITokenBuy: Destination and Account must not be equal',
|
||||
)
|
||||
}
|
||||
|
||||
if (tx.URITokenID == null) {
|
||||
throw new ValidationError('URITokenBuy: missing field URITokenID')
|
||||
}
|
||||
|
||||
if (!isAmount(tx.Amount)) {
|
||||
throw new ValidationError('URITokenBuy: invalid Amount')
|
||||
}
|
||||
}
|
||||
61
packages/xrpl/src/models/transactions/uriTokenClear.ts
Normal file
61
packages/xrpl/src/models/transactions/uriTokenClear.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
|
||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||
|
||||
/**
|
||||
* Map of flags to boolean values representing {@link URITokenClear} transaction
|
||||
* flags.
|
||||
*
|
||||
* @category Transaction Flags
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const tx: URITokenClear = {
|
||||
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* TransactionType: 'URITokenCancelSellOffer',
|
||||
* }
|
||||
*
|
||||
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
||||
* const autofilledTx = await client.autofill(tx)
|
||||
* console.log(autofilledTx)
|
||||
* // {
|
||||
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* // TransactionType: 'URITokenCancelSellOffer',
|
||||
* // Sequence: 21970384,
|
||||
* // Fee: '12',
|
||||
* // LastLedgerSequence: 21970404
|
||||
* // }
|
||||
* ```
|
||||
*/
|
||||
|
||||
/**
|
||||
* An URITokenClear transaction is effectively a limit order . It defines an
|
||||
* intent to exchange currencies, and creates an Offer object if not completely.
|
||||
* Fulfilled when placed. Offers can be partially fulfilled.
|
||||
*
|
||||
* @category Transaction Models
|
||||
*/
|
||||
export interface URITokenClear extends BaseTransaction {
|
||||
TransactionType: 'URITokenCancelSellOffer'
|
||||
/**
|
||||
* Identifies the URITokenID of the NFToken object that the
|
||||
* offer references.
|
||||
*/
|
||||
URITokenID: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of an URITokenClear at runtime.
|
||||
*
|
||||
* @param tx - An URITokenClear Transaction.
|
||||
* @throws When the URITokenClear is Malformed.
|
||||
*/
|
||||
export function validateURITokenClear(tx: Record<string, unknown>): void {
|
||||
validateBaseTransaction(tx)
|
||||
|
||||
if (tx.URITokenID == null) {
|
||||
throw new ValidationError('URITokenClear: missing field URITokenID')
|
||||
}
|
||||
}
|
||||
92
packages/xrpl/src/models/transactions/uriTokenMint.ts
Normal file
92
packages/xrpl/src/models/transactions/uriTokenMint.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
import { isHex } from '../utils'
|
||||
|
||||
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
|
||||
|
||||
/**
|
||||
* Transaction Flags for an URITokenMint Transaction.
|
||||
*
|
||||
* @category Transaction Flags
|
||||
*/
|
||||
export enum URITokenMintFlags {
|
||||
/**
|
||||
* If set, indicates that the minted token may be burned by the issuer even
|
||||
* if the issuer does not currently hold the token. The current holder of
|
||||
* the token may always burn it.
|
||||
*/
|
||||
tfBurnable = 0x00000001,
|
||||
}
|
||||
|
||||
/**
|
||||
* Map of flags to boolean values representing {@link URITokenMint} transaction
|
||||
* flags.
|
||||
*
|
||||
* @category Transaction Flags
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const tx: URITokenMint = {
|
||||
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* URI: '697066733A2F2F434944',
|
||||
* TransactionType: 'URITokenMint',
|
||||
* Flags: {
|
||||
* tfBurnable: true,
|
||||
* },
|
||||
* }
|
||||
*
|
||||
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
||||
* const autofilledTx = await client.autofill(tx)
|
||||
* console.log(autofilledTx)
|
||||
* // {
|
||||
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* // URI: '697066733A2F2F434944',
|
||||
* // TransactionType: 'URITokenMint',
|
||||
* // Flags: 0,
|
||||
* // Sequence: 21970384,
|
||||
* // Fee: '12',
|
||||
* // LastLedgerSequence: 21970404
|
||||
* // }
|
||||
* ```
|
||||
*/
|
||||
export interface URITokenMintFlagsInterface extends GlobalFlags {
|
||||
tfBurnable?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* An URITokenMint transaction is effectively a limit order . It defines an
|
||||
* intent to exchange currencies, and creates an Offer object if not completely.
|
||||
* Fulfilled when placed. Offers can be partially fulfilled.
|
||||
*
|
||||
* @category Transaction Models
|
||||
*/
|
||||
export interface URITokenMint extends BaseTransaction {
|
||||
TransactionType: 'URITokenMint'
|
||||
Flags?: number | URITokenMintFlagsInterface
|
||||
/**
|
||||
* URI that points to the data and/or metadata associated with the NFT.
|
||||
* This field need not be an HTTP or HTTPS URL; it could be an IPFS URI, a
|
||||
* magnet link, immediate data encoded as an RFC2379 "data" URL, or even an
|
||||
* opaque issuer-specific encoding. The URI is NOT checked for validity, but
|
||||
* the field is limited to a maximum length of 256 bytes.
|
||||
*
|
||||
* This field must be hex-encoded. You can use `convertStringToHex` to
|
||||
* convert this field to the proper encoding.
|
||||
*/
|
||||
URI: string
|
||||
|
||||
Digest?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of an URITokenMint at runtime.
|
||||
*
|
||||
* @param tx - An URITokenMint Transaction.
|
||||
* @throws When the URITokenMint is Malformed.
|
||||
*/
|
||||
export function validateURITokenMint(tx: Record<string, unknown>): void {
|
||||
validateBaseTransaction(tx)
|
||||
|
||||
if (typeof tx.URI === 'string' && !isHex(tx.URI)) {
|
||||
throw new ValidationError('URITokenMint: URI must be in hex format')
|
||||
}
|
||||
}
|
||||
89
packages/xrpl/src/models/transactions/uriTokenSell.ts
Normal file
89
packages/xrpl/src/models/transactions/uriTokenSell.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
import { Amount } from '../common'
|
||||
|
||||
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
|
||||
|
||||
/**
|
||||
* Map of flags to boolean values representing {@link URITokenSell} transaction
|
||||
* flags.
|
||||
*
|
||||
* @category Transaction Flags
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const tx: URITokenSell = {
|
||||
* Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* Amount: '1000000',
|
||||
* TransactionType: 'URITokenCreateSellOffer',
|
||||
* }
|
||||
*
|
||||
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
||||
* const autofilledTx = await client.autofill(tx)
|
||||
* console.log(autofilledTx)
|
||||
* // {
|
||||
* // Account: 'rhFcpWDHLqpBmX4ezWiA5VLSS4e1BHqhHd',
|
||||
* // URITokenID: '7AFCE32EBA8BD310CC2D00BE10B76E2183337EA20444D4580E4DBDB396C101FB',
|
||||
* // Amount: '1000000',
|
||||
* // TransactionType: 'URITokenCreateSellOffer',
|
||||
* // Sequence: 21970384,
|
||||
* // Fee: '12',
|
||||
* // LastLedgerSequence: 21970404
|
||||
* // }
|
||||
* ```
|
||||
*/
|
||||
|
||||
/**
|
||||
* An URITokenSell transaction is effectively a limit order . It defines an
|
||||
* intent to exchange currencies, and creates an Offer object if not completely.
|
||||
* Fulfilled when placed. Offers can be partially fulfilled.
|
||||
*
|
||||
* @category Transaction Models
|
||||
*/
|
||||
export interface URITokenSell extends BaseTransaction {
|
||||
TransactionType: 'URITokenCreateSellOffer'
|
||||
/**
|
||||
* Identifies the URITokenID of the NFToken object that the
|
||||
* offer references.
|
||||
*/
|
||||
URITokenID: string
|
||||
/**
|
||||
* Indicates the amount expected or offered for the Token.
|
||||
*
|
||||
* The amount must be non-zero, except when this is a sell
|
||||
* offer and the asset is XRP. This would indicate that the current
|
||||
* owner of the token is giving it away free, either to anyone at all,
|
||||
* or to the account identified by the Destination field.
|
||||
*/
|
||||
Amount: Amount
|
||||
/**
|
||||
* If present, indicates that this offer may only be
|
||||
* accepted by the specified account. Attempts by other
|
||||
* accounts to accept this offer MUST fail.
|
||||
*/
|
||||
Destination?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of an URITokenSell at runtime.
|
||||
*
|
||||
* @param tx - An URITokenSell Transaction.
|
||||
* @throws When the URITokenSell is Malformed.
|
||||
*/
|
||||
export function validateURITokenSell(tx: Record<string, unknown>): void {
|
||||
validateBaseTransaction(tx)
|
||||
|
||||
if (tx.Account === tx.Destination) {
|
||||
throw new ValidationError(
|
||||
'URITokenSell: Destination and Account must not be equal',
|
||||
)
|
||||
}
|
||||
|
||||
if (tx.URITokenID == null) {
|
||||
throw new ValidationError('URITokenSell: missing field URITokenID')
|
||||
}
|
||||
|
||||
if (!isAmount(tx.Amount)) {
|
||||
throw new ValidationError('URITokenSell: invalid Amount')
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,22 @@ import {
|
||||
AccountRootFlagsInterface,
|
||||
AccountRootFlags,
|
||||
} from '../ledger/AccountRoot'
|
||||
import { AccountSetTfFlags } from '../transactions/accountSet'
|
||||
import {
|
||||
AccountSetFlagsInterface,
|
||||
AccountSetTfFlags,
|
||||
} from '../transactions/accountSet'
|
||||
import { GlobalFlags } from '../transactions/common'
|
||||
import { OfferCreateFlags } from '../transactions/offerCreate'
|
||||
import { PaymentFlags } from '../transactions/payment'
|
||||
import { PaymentChannelClaimFlags } from '../transactions/paymentChannelClaim'
|
||||
import {
|
||||
OfferCreateFlagsInterface,
|
||||
OfferCreateFlags,
|
||||
} from '../transactions/offerCreate'
|
||||
import { PaymentFlagsInterface, PaymentFlags } from '../transactions/payment'
|
||||
import {
|
||||
PaymentChannelClaimFlagsInterface,
|
||||
PaymentChannelClaimFlags,
|
||||
} from '../transactions/paymentChannelClaim'
|
||||
import type { Transaction } from '../transactions/transaction'
|
||||
import { TrustSetFlags } from '../transactions/trustSet'
|
||||
import { XChainModifyBridgeFlags } from '../transactions/XChainModifyBridge'
|
||||
import { TrustSetFlagsInterface, TrustSetFlags } from '../transactions/trustSet'
|
||||
|
||||
import { isFlagEnabled } from '.'
|
||||
|
||||
@@ -53,30 +61,55 @@ export function setTransactionFlagsToNumber(tx: Transaction): void {
|
||||
|
||||
switch (tx.TransactionType) {
|
||||
case 'AccountSet':
|
||||
tx.Flags = convertFlagsToNumber(tx.Flags, AccountSetTfFlags)
|
||||
tx.Flags = convertAccountSetFlagsToNumber(tx.Flags)
|
||||
return
|
||||
case 'OfferCreate':
|
||||
tx.Flags = convertFlagsToNumber(tx.Flags, OfferCreateFlags)
|
||||
tx.Flags = convertOfferCreateFlagsToNumber(tx.Flags)
|
||||
return
|
||||
case 'PaymentChannelClaim':
|
||||
tx.Flags = convertFlagsToNumber(tx.Flags, PaymentChannelClaimFlags)
|
||||
tx.Flags = convertPaymentChannelClaimFlagsToNumber(tx.Flags)
|
||||
return
|
||||
case 'Payment':
|
||||
tx.Flags = convertFlagsToNumber(tx.Flags, PaymentFlags)
|
||||
tx.Flags = convertPaymentTransactionFlagsToNumber(tx.Flags)
|
||||
return
|
||||
case 'TrustSet':
|
||||
tx.Flags = convertFlagsToNumber(tx.Flags, TrustSetFlags)
|
||||
return
|
||||
case 'XChainModifyBridge':
|
||||
tx.Flags = convertFlagsToNumber(tx.Flags, XChainModifyBridgeFlags)
|
||||
tx.Flags = convertTrustSetFlagsToNumber(tx.Flags)
|
||||
return
|
||||
default:
|
||||
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
|
||||
function convertFlagsToNumber(flags: GlobalFlags, flagEnum: any): number {
|
||||
function reduceFlags(flags: GlobalFlags, flagEnum: any): number {
|
||||
return Object.keys(flags).reduce((resultFlags, flag) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- safe member access
|
||||
if (flagEnum[flag] == null) {
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { convertStringToHex, URITokenMint, URITokenBurn } from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('URITokenMint', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const tx: URITokenMint = {
|
||||
TransactionType: 'URITokenMint',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URI: convertStringToHex('ipfs://CID'),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// check that the object was actually created
|
||||
const mintResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
assert.equal(mintResponse.result.account_objects.length, 1)
|
||||
|
||||
const uriTokenID = mintResponse.result.account_objects[0].index
|
||||
assert.isString(uriTokenID)
|
||||
|
||||
const burnTx: URITokenBurn = {
|
||||
TransactionType: 'URITokenBurn',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URITokenID: uriTokenID,
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, burnTx, testContext.wallet)
|
||||
|
||||
// check that the object was actually created
|
||||
assert.equal(
|
||||
(
|
||||
await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
).result.account_objects.length,
|
||||
0,
|
||||
)
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,95 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { URITokenBuy } from '../../../dist/npm'
|
||||
import {
|
||||
convertStringToHex,
|
||||
URITokenMint,
|
||||
URITokenSell,
|
||||
xrpToDrops,
|
||||
} from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { generateFundedWallet, testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('URITokenSell', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const wallet1 = await generateFundedWallet(testContext.client)
|
||||
|
||||
const tx: URITokenMint = {
|
||||
TransactionType: 'URITokenMint',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URI: convertStringToHex('ipfs://CID'),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// check that the object was actually created
|
||||
const mintResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
assert.equal(mintResponse.result.account_objects.length, 1)
|
||||
|
||||
const uriTokenID = mintResponse.result.account_objects[0].index
|
||||
assert.isString(uriTokenID)
|
||||
|
||||
const sellTx: URITokenSell = {
|
||||
TransactionType: 'URITokenCreateSellOffer',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URITokenID: uriTokenID,
|
||||
Amount: xrpToDrops(10),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, sellTx, testContext.wallet)
|
||||
|
||||
// verify amount is on le
|
||||
|
||||
const buyTx: URITokenBuy = {
|
||||
TransactionType: 'URITokenBuy',
|
||||
Account: wallet1.classicAddress,
|
||||
URITokenID: uriTokenID,
|
||||
Amount: xrpToDrops(10),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, buyTx, wallet1)
|
||||
|
||||
// check that wallet1 owns uritoken
|
||||
assert.equal(
|
||||
(
|
||||
await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: wallet1.classicAddress,
|
||||
})
|
||||
).result.account_objects.length,
|
||||
1,
|
||||
)
|
||||
// check that wallet1 does not own uritoken
|
||||
assert.equal(
|
||||
(
|
||||
await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
).result.account_objects.length,
|
||||
0,
|
||||
)
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,72 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { URITokenClear } from '../../../dist/npm'
|
||||
import {
|
||||
convertStringToHex,
|
||||
URITokenMint,
|
||||
URITokenSell,
|
||||
xrpToDrops,
|
||||
} from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('URITokenSell', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const tx: URITokenMint = {
|
||||
TransactionType: 'URITokenMint',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URI: convertStringToHex('ipfs://CID'),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// check that the object was actually created
|
||||
const mintResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
assert.equal(mintResponse.result.account_objects.length, 1)
|
||||
|
||||
const uriTokenID = mintResponse.result.account_objects[0].index
|
||||
assert.isString(uriTokenID)
|
||||
|
||||
const sellTx: URITokenSell = {
|
||||
TransactionType: 'URITokenCreateSellOffer',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URITokenID: uriTokenID,
|
||||
Amount: xrpToDrops(10),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, sellTx, testContext.wallet)
|
||||
|
||||
// verify amount is on le
|
||||
|
||||
const clearTx: URITokenClear = {
|
||||
TransactionType: 'URITokenCancelSellOffer',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URITokenID: uriTokenID,
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, clearTx, testContext.wallet)
|
||||
// verify amount is not on le
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,47 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { convertStringToHex, URITokenMint } from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('URITokenMint', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const tx: URITokenMint = {
|
||||
TransactionType: 'URITokenMint',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URI: convertStringToHex('ipfs://CID'),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// check that the object was actually created
|
||||
assert.equal(
|
||||
(
|
||||
await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
).result.account_objects.length,
|
||||
1,
|
||||
)
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,62 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import {
|
||||
convertStringToHex,
|
||||
URITokenMint,
|
||||
URITokenSell,
|
||||
xrpToDrops,
|
||||
} from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('URITokenSell', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const tx: URITokenMint = {
|
||||
TransactionType: 'URITokenMint',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URI: convertStringToHex('ipfs://CID'),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// check that the object was actually created
|
||||
const mintResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
})
|
||||
assert.equal(mintResponse.result.account_objects.length, 1)
|
||||
|
||||
const uriTokenID = mintResponse.result.account_objects[0].index
|
||||
assert.isString(uriTokenID)
|
||||
|
||||
const sellTx: URITokenSell = {
|
||||
TransactionType: 'URITokenCreateSellOffer',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
URITokenID: uriTokenID,
|
||||
Amount: xrpToDrops(10),
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, sellTx, testContext.wallet)
|
||||
|
||||
// verify amount is on le
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
@@ -30,7 +30,7 @@ describe('AccountSet', function () {
|
||||
})
|
||||
|
||||
it(`throws w/ invalid SetFlag (out of range)`, function () {
|
||||
account.SetFlag = 20
|
||||
account.SetFlag = 12
|
||||
|
||||
assert.throws(
|
||||
() => validateAccountSet(account),
|
||||
@@ -60,7 +60,7 @@ describe('AccountSet', function () {
|
||||
})
|
||||
|
||||
it(`throws w/ invalid ClearFlag`, function () {
|
||||
account.ClearFlag = 20
|
||||
account.ClearFlag = 12
|
||||
|
||||
assert.throws(
|
||||
() => validateAccountSet(account),
|
||||
|
||||
@@ -151,7 +151,6 @@ describe('Models Utils', function () {
|
||||
assert.strictEqual(tx.Flags, 0)
|
||||
})
|
||||
|
||||
// eslint-disable-next-line complexity -- Simpler to list them all out at once.
|
||||
it('parseAccountRootFlags all enabled', function () {
|
||||
const accountRootFlags =
|
||||
AccountRootFlags.lsfDefaultRipple |
|
||||
@@ -162,11 +161,7 @@ describe('Models Utils', function () {
|
||||
AccountRootFlags.lsfNoFreeze |
|
||||
AccountRootFlags.lsfPasswordSpent |
|
||||
AccountRootFlags.lsfRequireAuth |
|
||||
AccountRootFlags.lsfRequireDestTag |
|
||||
AccountRootFlags.lsfDisallowIncomingNFTOffer |
|
||||
AccountRootFlags.lsfDisallowIncomingCheck |
|
||||
AccountRootFlags.lsfDisallowIncomingPayChan |
|
||||
AccountRootFlags.lsfDisallowIncomingTrustline
|
||||
AccountRootFlags.lsfRequireDestTag
|
||||
|
||||
const parsed = parseAccountRootFlags(accountRootFlags)
|
||||
|
||||
@@ -179,11 +174,7 @@ describe('Models Utils', function () {
|
||||
parsed.lsfNoFreeze &&
|
||||
parsed.lsfPasswordSpent &&
|
||||
parsed.lsfRequireAuth &&
|
||||
parsed.lsfRequireDestTag &&
|
||||
parsed.lsfDisallowIncomingNFTOffer &&
|
||||
parsed.lsfDisallowIncomingCheck &&
|
||||
parsed.lsfDisallowIncomingPayChan &&
|
||||
parsed.lsfDisallowIncomingTrustline,
|
||||
parsed.lsfRequireDestTag,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -199,10 +190,6 @@ describe('Models Utils', function () {
|
||||
assert.isUndefined(parsed.lsfPasswordSpent)
|
||||
assert.isUndefined(parsed.lsfRequireAuth)
|
||||
assert.isUndefined(parsed.lsfRequireDestTag)
|
||||
assert.isUndefined(parsed.lsfDisallowIncomingNFTOffer)
|
||||
assert.isUndefined(parsed.lsfDisallowIncomingCheck)
|
||||
assert.isUndefined(parsed.lsfDisallowIncomingPayChan)
|
||||
assert.isUndefined(parsed.lsfDisallowIncomingTrustline)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user