Compare commits

...

76 Commits

Author SHA1 Message Date
Mayukha Vadari
619ac30c0d Update package-lock.json 2023-02-16 14:25:26 -05:00
Mayukha Vadari
d540ace605 bump versions 2023-02-16 14:24:02 -05:00
Omar Khan
6cc617e604 Merge branch 'main' into beta3 2023-02-16 10:07:27 -05:00
Omar Khan
b9f2222671 resolve errors 2023-02-15 22:52:02 -05:00
Omar Khan
b842e61296 Merge branch 'amm' into beta3 2023-02-15 22:42:06 -05:00
dependabot[bot]
e6c7c88209 build(deps-dev): bump webpack-cli from 4.9.2 to 5.0.1 (#2165)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.9.2 to 5.0.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.9.2...webpack-cli@5.0.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-15 16:12:33 -08:00
Omar Khan
d2f7fe622b add missing asset_frozen field 2023-02-15 18:45:07 -05:00
Omar Khan
7e8427785c add Owner Reserve Fee for AMMCreate transaction 2023-02-15 18:21:30 -05:00
Omar Khan
287dc1acf8 rename test model names and fix lint errors 2023-02-15 18:18:07 -05:00
Omar Khan
88b82118a3 Merge branch 'main' into amm 2023-02-15 17:53:13 -05:00
Mayukha Vadari
7e6b213dae Merge pull request #2203 from Transia-RnD/iouescrow
[BETA] Amendment XLS-34d
2023-02-15 17:26:35 -05:00
Omar Khan
8cdeb2ba99 update time_interval description 2023-01-09 18:13:18 -05:00
Omar Khan
f3d6bd4be4 remove invalid fields from ammInfo.ts response model 2023-01-09 17:51:33 -05:00
Omar Khan
f61cf02618 Merge branch 'main' into amm 2023-01-09 17:47:11 -05:00
Omar Khan
e634db3dd2 update ammInfo.ts response model 2023-01-09 17:43:48 -05:00
Omar Khan
218ca005e1 update definitions.json with refactored error codes 2023-01-09 17:30:05 -05:00
Omar Khan
ec1d8b67a5 refactor amm_info response fields to match AMMDevnet 2022-12-15 13:06:39 -05:00
Omar Khan
2bb4d7712c Merge branch 'main' into amm 2022-12-15 12:46:56 -05:00
Omar Khan
98f8223b23 add one asset and withdraw all tests 2022-11-17 14:20:57 -05:00
Omar Khan
feafc0c91b update Issue type 2022-11-17 13:37:45 -05:00
Omar Khan
0970753790 add AMM codec-fixtures 2022-11-17 13:14:25 -05:00
Omar Khan
434ad71672 update unit tests 2022-11-17 09:34:40 -05:00
Omar Khan
7f2b40740a Merge branch 'main' into amm 2022-11-16 21:27:52 -05:00
Omar Khan
ff65441d33 fix lint errors 2022-11-16 21:24:40 -05:00
Omar Khan
e32db9dd39 update amm_info fields 2022-11-16 21:21:21 -05:00
Omar Khan
64e4242085 remove AMMID from amm_info and use Issue type 2022-11-16 21:03:08 -05:00
Omar Khan
0574fabf47 add Issue type and tests for Asset/Asset2 2022-11-16 20:58:57 -05:00
Omar Khan
40388cc1e5 update definitions 2022-11-16 14:02:24 -05:00
Omar Khan
007717a9d4 Merge branch 'main' into amm 2022-11-16 13:55:34 -05:00
Omar Khan
1c26e8b6d5 update definitions to change Asset & Asset2 nth values to 3 & 4 2022-11-09 15:20:37 -05:00
Omar Khan
eba8bd2ec1 rename MinBidPrice -> BidMin and MaxBidPrice -> BidMax 2022-11-09 15:09:33 -05:00
Omar Khan
bcdd8fe2cf rename FeeVal -> TradingFee in VoteEntry 2022-11-09 14:59:12 -05:00
Omar Khan
64d8a904f0 add Deposit/Withdraw flags 2022-11-09 13:37:20 -05:00
Omar Khan
6a67715a01 Merge branch 'main' into amm 2022-11-09 11:58:15 -05:00
Omar Khan
25752d77a4 Use Asset/Asset2 instead of AMMID for Deposit/Withdraw/Bid/Vote 2022-11-09 11:51:08 -05:00
Omar Khan
3120abc627 change AMM_MAX_TRADING_FEE to 1% 2022-11-09 10:27:57 -05:00
Omar Khan
c99aa048da fix typo 2022-11-09 10:21:14 -05:00
Omar Khan
54b86bc1d7 rename amm_info param asset1 -> asset 2022-11-09 10:16:25 -05:00
Omar Khan
acdfbd55e5 API name changes with updated definitions.json 2022-11-09 10:07:39 -05:00
Omar Khan
a76aeb2233 Change amm_info asset parameters to Currency type 2022-10-31 13:55:50 -04:00
Omar Khan
f04037859f Merge branch 'main' into amm 2022-10-31 13:36:57 -04:00
Omar Khan
a2bce8f513 update definitions.json with different AuthAccounts number 2022-09-15 15:24:42 -04:00
Omar Khan
a80f159e01 fix AMMBid ValidationError 2022-09-14 21:52:54 -04:00
Omar Khan
220d9fb1b0 fix deposit and withdraw tests 2022-09-13 13:53:44 -04:00
Omar Khan
25efafa371 Merge branch 'develop' into amm 2022-09-13 13:49:31 -04:00
Omar Khan
aed4353c6c update VoteEntry interface 2022-09-05 14:46:47 -04:00
Omar Khan
56b70aa845 add VoteSlots as optional param in AMMInfoResponse 2022-09-05 14:35:19 -04:00
Omar Khan
c0e0c15fc1 fix EPrice validation checks in AMMDeposit & AMMWithdraw 2022-09-02 00:18:45 -04:00
Omar Khan
533c8ab9ac add AMMID as optional param in ammInfo response 2022-09-02 00:05:48 -04:00
Omar Khan
a174d09489 fix ammInfo response 2022-09-01 23:13:13 -04:00
Omar Khan
85b8a3930b add negative TradingFee check 2022-08-30 19:09:55 -04:00
Omar Khan
6a06412b2d update wording on AMMDeposit & AMMWithdraw validation errors 2022-08-30 19:01:08 -04:00
Omar Khan
e9778ebcdb update HISTORY.md to specify XLS-30 2022-08-30 18:48:54 -04:00
Omar Khan
8ef2483e15 add negative FeeVal check 2022-08-30 18:45:34 -04:00
Omar Khan
6150d33a61 add missing test case Asset1Out and Asset2Out valid 2022-08-30 18:10:40 -04:00
Omar Khan
2796c2aeef add missing test case Asset1In and Asset2In valid 2022-08-30 18:07:22 -04:00
Omar Khan
e13b27e43f update definitions to fix AMM in LEDGER_ENTRY_TYPES 2022-08-30 17:45:22 -04:00
Omar Khan
0de755bb0b update EPrice validation error message and add missing tests 2022-08-30 16:49:48 -04:00
Omar Khan
ed7760c555 fix EPrice type to be Amount 2022-08-30 16:29:49 -04:00
Omar Khan
b8e4f2405a update amm_info docstrings 2022-08-30 10:59:03 -04:00
Omar Khan
c95f8afc21 add AMMID to AMMInfoResponse 2022-08-28 14:04:13 -04:00
Omar Khan
835dc67767 refactor tests 2022-08-20 10:54:14 -04:00
Omar Khan
4b18f06dbb add AuthAccount interface to AMMBid 2022-08-20 09:43:33 -04:00
Omar Khan
7a035afca1 add AMMBid 2022-08-20 09:33:53 -04:00
Omar Khan
78e0a866cd refactor MAX_TRADING_FEE to be in one place 2022-08-19 21:59:30 -04:00
Omar Khan
db6d32f98b add max trading fee check to AMMVote 2022-08-19 21:48:26 -04:00
Omar Khan
e79dcb5d2f fix lint error 2022-08-19 17:20:23 -04:00
Omar Khan
b794f909ad add AMMVote 2022-08-19 17:18:46 -04:00
Omar Khan
3617487c32 add AMMWithdraw 2022-08-18 23:51:16 -04:00
Omar Khan
35fef6512f use null check for missing fields 2022-08-18 23:11:24 -04:00
Omar Khan
e64a668ef6 add AMMDeposit 2022-08-18 22:19:50 -04:00
Omar Khan
3461fcc929 add amm_info RPC command 2022-08-18 16:00:25 -04:00
Omar Khan
ff60b547e3 update HISTORY.md 2022-08-18 14:14:30 -04:00
Omar Khan
6bcfc2be32 renamed LPTokens to LPToken in definitions.json 2022-08-18 13:38:44 -04:00
Omar Khan
2680c34689 add AMMInstanceCreate 2022-08-17 22:38:31 -04:00
Omar Khan
25bdb692cb update definitions.json 2022-08-16 14:57:07 -04:00
24 changed files with 1933 additions and 93 deletions

161
package-lock.json generated
View File

@@ -65,7 +65,7 @@
"url": "^0.11.0",
"webpack": "^5.6.0",
"webpack-bundle-analyzer": "^4.1.0",
"webpack-cli": "^4.2.0"
"webpack-cli": "^5.0.1"
},
"engines": {
"node": ">=12.0.0",
@@ -3339,34 +3339,42 @@
}
},
"node_modules/@webpack-cli/configtest": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz",
"integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz",
"integrity": "sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==",
"dev": true,
"engines": {
"node": ">=14.15.0"
},
"peerDependencies": {
"webpack": "4.x.x || 5.x.x",
"webpack-cli": "4.x.x"
"webpack": "5.x.x",
"webpack-cli": "5.x.x"
}
},
"node_modules/@webpack-cli/info": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz",
"integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz",
"integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==",
"dev": true,
"dependencies": {
"envinfo": "^7.7.3"
"engines": {
"node": ">=14.15.0"
},
"peerDependencies": {
"webpack-cli": "4.x.x"
"webpack": "5.x.x",
"webpack-cli": "5.x.x"
}
},
"node_modules/@webpack-cli/serve": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz",
"integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.1.tgz",
"integrity": "sha512-0G7tNyS+yW8TdgHwZKlDWYXFA6OJQnoLCQvYKkQP0Q2X205PSQ6RNUj0M+1OB/9gRQaUZ/ccYfaxd0nhaWKfjw==",
"dev": true,
"engines": {
"node": ">=14.15.0"
},
"peerDependencies": {
"webpack-cli": "4.x.x"
"webpack": "5.x.x",
"webpack-cli": "5.x.x"
},
"peerDependenciesMeta": {
"webpack-dev-server": {
@@ -8780,12 +8788,12 @@
}
},
"node_modules/interpret": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz",
"integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",
"integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",
"dev": true,
"engines": {
"node": ">= 0.10"
"node": ">=10.13.0"
}
},
"node_modules/ip": {
@@ -14220,15 +14228,15 @@
}
},
"node_modules/rechoir": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
"integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==",
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
"integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
"dev": true,
"dependencies": {
"resolve": "^1.9.0"
"resolve": "^1.20.0"
},
"engines": {
"node": ">= 0.10"
"node": ">= 10.13.0"
}
},
"node_modules/redent": {
@@ -16621,44 +16629,42 @@
}
},
"node_modules/webpack-cli": {
"version": "4.10.0",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz",
"integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.1.tgz",
"integrity": "sha512-S3KVAyfwUqr0Mo/ur3NzIp6jnerNpo7GUO6so51mxLi1spqsA17YcMXy0WOIJtBSnj748lthxC6XLbNKh/ZC+A==",
"dev": true,
"dependencies": {
"@discoveryjs/json-ext": "^0.5.0",
"@webpack-cli/configtest": "^1.2.0",
"@webpack-cli/info": "^1.5.0",
"@webpack-cli/serve": "^1.7.0",
"@webpack-cli/configtest": "^2.0.1",
"@webpack-cli/info": "^2.0.1",
"@webpack-cli/serve": "^2.0.1",
"colorette": "^2.0.14",
"commander": "^7.0.0",
"commander": "^9.4.1",
"cross-spawn": "^7.0.3",
"envinfo": "^7.7.3",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
"interpret": "^2.2.0",
"rechoir": "^0.7.0",
"interpret": "^3.1.1",
"rechoir": "^0.8.0",
"webpack-merge": "^5.7.3"
},
"bin": {
"webpack-cli": "bin/cli.js"
},
"engines": {
"node": ">=10.13.0"
"node": ">=14.15.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"peerDependencies": {
"webpack": "4.x.x || 5.x.x"
"webpack": "5.x.x"
},
"peerDependenciesMeta": {
"@webpack-cli/generators": {
"optional": true
},
"@webpack-cli/migrate": {
"optional": true
},
"webpack-bundle-analyzer": {
"optional": true
},
@@ -16668,12 +16674,12 @@
}
},
"node_modules/webpack-cli/node_modules/commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"dev": true,
"engines": {
"node": ">= 10"
"node": "^12.20.0 || >=14"
}
},
"node_modules/webpack-merge": {
@@ -17129,7 +17135,7 @@
}
},
"packages/ripple-binary-codec": {
"version": "1.5.0-beta.0",
"version": "1.5.0-beta.3",
"integrity": "sha512-XMRCbFXyG+dGp3x7tMs9IwA+FVWPPaGjdHYW2+g4Q/WQJqFp5MRED+jjOBOUafmrW4TUsOn1PEEdbB4ozWbDBw==",
"license": "ISC",
"dependencies": {
@@ -17167,7 +17173,7 @@
}
},
"packages/xrpl": {
"version": "2.6.0",
"version": "2.7.0-beta.1",
"license": "ISC",
"dependencies": {
"bignumber.js": "^9.0.0",
@@ -17176,7 +17182,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.5.0-beta.3",
"ripple-keypairs": "^1.1.4",
"ws": "^8.2.2"
},
@@ -19873,25 +19879,23 @@
}
},
"@webpack-cli/configtest": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz",
"integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz",
"integrity": "sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==",
"dev": true,
"requires": {}
},
"@webpack-cli/info": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz",
"integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz",
"integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==",
"dev": true,
"requires": {
"envinfo": "^7.7.3"
}
"requires": {}
},
"@webpack-cli/serve": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz",
"integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.1.tgz",
"integrity": "sha512-0G7tNyS+yW8TdgHwZKlDWYXFA6OJQnoLCQvYKkQP0Q2X205PSQ6RNUj0M+1OB/9gRQaUZ/ccYfaxd0nhaWKfjw==",
"dev": true,
"requires": {}
},
@@ -24134,9 +24138,9 @@
}
},
"interpret": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz",
"integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",
"integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",
"dev": true
},
"ip": {
@@ -28457,12 +28461,12 @@
}
},
"rechoir": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
"integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==",
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
"integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
"dev": true,
"requires": {
"resolve": "^1.9.0"
"resolve": "^1.20.0"
}
},
"redent": {
@@ -30285,29 +30289,30 @@
}
},
"webpack-cli": {
"version": "4.10.0",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz",
"integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.1.tgz",
"integrity": "sha512-S3KVAyfwUqr0Mo/ur3NzIp6jnerNpo7GUO6so51mxLi1spqsA17YcMXy0WOIJtBSnj748lthxC6XLbNKh/ZC+A==",
"dev": true,
"requires": {
"@discoveryjs/json-ext": "^0.5.0",
"@webpack-cli/configtest": "^1.2.0",
"@webpack-cli/info": "^1.5.0",
"@webpack-cli/serve": "^1.7.0",
"@webpack-cli/configtest": "^2.0.1",
"@webpack-cli/info": "^2.0.1",
"@webpack-cli/serve": "^2.0.1",
"colorette": "^2.0.14",
"commander": "^7.0.0",
"commander": "^9.4.1",
"cross-spawn": "^7.0.3",
"envinfo": "^7.7.3",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
"interpret": "^2.2.0",
"rechoir": "^0.7.0",
"interpret": "^3.1.1",
"rechoir": "^0.8.0",
"webpack-merge": "^5.7.3"
},
"dependencies": {
"commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"dev": true
}
}
@@ -30597,7 +30602,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.5.0-beta.3",
"ripple-keypairs": "^1.1.4",
"typedoc": "^0.23.24",
"ws": "^8.2.2"

View File

@@ -69,7 +69,7 @@
"url": "^0.11.0",
"webpack": "^5.6.0",
"webpack-bundle-analyzer": "^4.1.0",
"webpack-cli": "^4.2.0"
"webpack-cli": "^5.0.1"
},
"workspaces": [
"./packages/*"

View File

@@ -1,6 +1,6 @@
{
"name": "ripple-binary-codec",
"version": "1.5.0-beta.0",
"version": "1.5.0-beta.3",
"description": "XRP Ledger binary codec",
"files": [
"dist/*",

View File

@@ -49,6 +49,7 @@
"NegativeUNL": 78,
"NFTokenPage": 80,
"NFTokenOffer": 55,
"AMM": 121,
"Any": -3,
"Child": -2,
"Nickname": 110,
@@ -286,6 +287,16 @@
"type": "UInt16"
}
],
[
"TradingFee",
{
"nth": 5,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt16"
}
],
[
"Version",
{
@@ -776,6 +787,26 @@
"type": "UInt32"
}
],
[
"VoteWeight",
{
"nth": 47,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt32"
}
],
[
"DiscountedFee",
{
"nth": 48,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt32"
}
],
[
"LockCount",
{
@@ -1166,6 +1197,16 @@
"type": "Hash256"
}
],
[
"AMMID",
{
"nth": 14,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Hash256"
}
],
[
"BookDirectory",
{
@@ -1436,6 +1477,36 @@
"type": "Amount"
}
],
[
"Amount2",
{
"nth": 11,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"BidMin",
{
"nth": 12,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"BidMax",
{
"nth": 13,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"MinimumOffer",
{
@@ -1476,6 +1547,56 @@
"type": "Amount"
}
],
[
"LPTokenOut",
{
"nth": 20,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"LPTokenIn",
{
"nth": 21,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"EPrice",
{
"nth": 22,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"Price",
{
"nth": 23,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"LPTokenBalance",
{
"nth": 24,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"SignatureReward",
{
@@ -1836,6 +1957,16 @@
"type": "AccountID"
}
],
[
"AMMAccount",
{
"nth": 11,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"HookAccount",
{
@@ -1976,6 +2107,26 @@
"type": "Issue"
}
],
[
"Asset",
{
"nth": 3,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"Asset2",
{
"nth": 4,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"XChainBridge",
{
@@ -2196,6 +2347,36 @@
"type": "STObject"
}
],
[
"VoteEntry",
{
"nth": 25,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"AuctionSlot",
{
"nth": 27,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"AuthAccount",
{
"nth": 28,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainClaimProofSig",
{
@@ -2326,6 +2507,16 @@
"type": "STArray"
}
],
[
"VoteSlots",
{
"nth": 14,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
],
[
"Majorities",
{
@@ -2415,6 +2606,16 @@
"isSigningField": true,
"type": "STArray"
}
],
[
"AuthAccounts",
{
"nth": 26,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
]
],
"TRANSACTION_RESULTS": {
@@ -2470,8 +2671,7 @@
"temUNKNOWN": -264,
"temSEQ_AND_TICKET": -263,
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
"temBAD_AMM_OPTIONS": -261,
"temBAD_AMM_TOKENS": -260,
"temAMM_BAD_TOKENS": -261,
"temEQUAL_DOOR_ACCOUNTS": -259,
"temBAD_XCHAIN_PROOF": -258,
"temSIDECHAIN_BAD_ISSUES": -257,
@@ -2514,6 +2714,7 @@
"terNO_RIPPLE": -90,
"terQUEUED": -89,
"terPRE_TICKET": -88,
"terNO_AMM": -87,
"tesSUCCESS": 0,
@@ -2563,15 +2764,13 @@
"tecINSUFFICIENT_FUNDS": 159,
"tecOBJECT_NOT_FOUND": 160,
"tecINSUFFICIENT_PAYMENT": 161,
"tecUNFUNDED_AMM": 162,
"tecAMM_UNFUNDED": 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,
"tecAMM_FAILED_BID": 167,
"tecAMM_FAILED_VOTE": 168,
"tecBAD_XCHAIN_TRANSFER_ISSUE": 171,
"tecXCHAIN_NO_CLAIM_ID": 172,
"tecXCHAIN_BAD_CLAIM_ID": 173,
@@ -2620,6 +2819,11 @@
"NFTokenCreateOffer": 27,
"NFTokenCancelOffer": 28,
"NFTokenAcceptOffer": 29,
"AMMCreate": 35,
"AMMDeposit": 36,
"AMMWithdraw": 37,
"AMMVote": 38,
"AMMBid": 39,
"XChainCreateBridge": 40,
"XChainCreateClaimID": 41,
"XChainCommit": 42,

View File

@@ -4634,6 +4634,213 @@
},
"XChainClaimID": "0000000000000001"
}
},
{
"binary": "12002315000A220000000024000000026140000000000027106840000000000000016BD5838D7EA4C680000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440913E39EC2BA0E5BC4C5DF1222B1AE9E76758F2B8FFEF1F056076147BB0ADC8117CD0296360DA08B3D48BE9EFC8693C03A253E0D9F166C19CA8D936F9E61A1100811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMCreate",
"TxnSignature": "913E39EC2BA0E5BC4C5DF1222B1AE9E76758F2B8FFEF1F056076147BB0ADC8117CD0296360DA08B3D48BE9EFC8693C03A253E0D9F166C19CA8D936F9E61A1100",
"Amount": "10000",
"Amount2": {
"currency": "ETH",
"issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9",
"value": "10000"
},
"TradingFee": 10,
"Fee": "1",
"Flags": 0,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0"
}
},
{
"binary": "120024220001000024000000026840000000000000016014D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D074409EEE8CF88C668B955E7EEAB1B4A1B059EDF4F51B7F1546810F87E3E48B09237F015C651E37FB40A979E00EA21361D4E18D7A33DB7DD23070CEEAB2648AB3BB0D811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMDeposit",
"TxnSignature": "9EEE8CF88C668B955E7EEAB1B4A1B059EDF4F51B7F1546810F87E3E48B09237F015C651E37FB40A979E00EA21361D4E18D7A33DB7DD23070CEEAB2648AB3BB0D",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"LPTokenOut": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
"Fee": "1",
"Flags": 65536,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0"
}
},
{
"binary": "120024220008000024000000026140000000000003E86840000000000000017321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440BD18A6E2B10B451F61CFADC32B59A0243702DC5DAAE556D51CB9C79981D40C78101FFA9DE6163CFBDF6E7578DF02F2AE3B8A5AB60697E0746D65064D91E8F90A811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMDeposit",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"Fee": "1",
"Flags": 524288,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "BD18A6E2B10B451F61CFADC32B59A0243702DC5DAAE556D51CB9C79981D40C78101FFA9DE6163CFBDF6E7578DF02F2AE3B8A5AB60697E0746D65064D91E8F90A"
}
},
{
"binary": "120024220010000024000000026140000000000003E86840000000000000016BD511C37937E080000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440E0B1AE32A0F731BF0CEF0D019295BD7F35B22F11A5962F65FA99EE4D38993B14B53DB11C15E36D756E282812E9015D38A6F225940A157693F43F9B795C59950F811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMDeposit",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"Amount2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9", "value": "500"},
"Fee": "1",
"Flags": 1048576,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "E0B1AE32A0F731BF0CEF0D019295BD7F35B22F11A5962F65FA99EE4D38993B14B53DB11C15E36D756E282812E9015D38A6F225940A157693F43F9B795C59950F"
}
},
{
"binary": "120024220020000024000000026140000000000003E86840000000000000016014D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440452BC59F9EE12C224EC983EFDF580F20C4A50E897105FD1FB13520D9753CFB02BD210599181574DF6AD0DB6A42C1EA48D9E48FC3D11B9008E4C76FBB163D5B00811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMDeposit",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"LPTokenOut": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
"Fee": "1",
"Flags": 2097152,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "452BC59F9EE12C224EC983EFDF580F20C4A50E897105FD1FB13520D9753CFB02BD210599181574DF6AD0DB6A42C1EA48D9E48FC3D11B9008E4C76FBB163D5B00"
}
},
{
"binary": "120024220040000024000000026140000000000003E8684000000000000001601640000000000000197321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440DD6685DC586FAA6AD2D50D785900122EB147D4AC09A55D7080267A9B38180F87CEC44B823359FC3F0AC0104D47B53FFC6B80415664C3C4582672420A0100F70C811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMDeposit",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"EPrice": "25",
"Fee": "1",
"Flags": 4194304,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "DD6685DC586FAA6AD2D50D785900122EB147D4AC09A55D7080267A9B38180F87CEC44B823359FC3F0AC0104D47B53FFC6B80415664C3C4582672420A0100F70C"
}
},
{
"binary": "120025220001000024000000026840000000000000016015D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744066944797E9F03808C9A00AAEFF786AD74FEB2E64B51A9601E89ABA820AAA15927C2E961A9CCA22C4B0D2A2B55E342BD6E297BD765B6F4D3FDCA578A3416BB505811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMWithdraw",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"LPTokenIn": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
"Fee": "1",
"Flags": 65536,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "66944797E9F03808C9A00AAEFF786AD74FEB2E64B51A9601E89ABA820AAA15927C2E961A9CCA22C4B0D2A2B55E342BD6E297BD765B6F4D3FDCA578A3416BB505"
}
},
{
"binary": "120025220008000024000000026140000000000003E86840000000000000017321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440E30397CE7E99B13D35FFB5C66725B17F4F103675E10293C7B1D63C1BE3FA81B884BD3FBD31B52F6B811F99C5FBB5102D170EC379C268DF80DABF04E7F2DD4F0C811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMWithdraw",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"Fee": "1",
"Flags": 524288,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "E30397CE7E99B13D35FFB5C66725B17F4F103675E10293C7B1D63C1BE3FA81B884BD3FBD31B52F6B811F99C5FBB5102D170EC379C268DF80DABF04E7F2DD4F0C"
}
},
{
"binary": "120025220010000024000000026140000000000003E86840000000000000016BD511C37937E080000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D07440C0818312B269A4EF16C1C7EBBB74EFD1852A288BB214A714B8BE3B5F4B2F9CFDFF4F66C931B8434244A8016035B9EC9493B7CF5E0ACF4570A88DF808D79E4300811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMWithdraw",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"Amount2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9", "value": "500"},
"Fee": "1",
"Flags": 1048576,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "C0818312B269A4EF16C1C7EBBB74EFD1852A288BB214A714B8BE3B5F4B2F9CFDFF4F66C931B8434244A8016035B9EC9493B7CF5E0ACF4570A88DF808D79E4300"
}
},
{
"binary": "120025220020000024000000026140000000000003E86840000000000000016015D5438D7EA4C68000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744073552B3DC7AE99DDF4E4FF0D60E6D0BE4688E3474D363603FA25DA6AD8BBA8F0E4E3EA82ADB2B57F5B9A6C379969E00095546DDA0E74FF3D0F0689351C2F8C06811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMWithdraw",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"LPTokenIn": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "1000"},
"Fee": "1",
"Flags": 2097152,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "73552B3DC7AE99DDF4E4FF0D60E6D0BE4688E3474D363603FA25DA6AD8BBA8F0E4E3EA82ADB2B57F5B9A6C379969E00095546DDA0E74FF3D0F0689351C2F8C06"
}
},
{
"binary": "120025220040000024000000026140000000000003E8684000000000000001601640000000000000197321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744023BAFE5BFE58E7BF0B02B5875983D007C10796C8E62A190BF688EBE5D8A104DAD2DE7EDE995FE2E494883FD8140F38E22E3376A2F49C50EFCAA00C7499A4690E811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMWithdraw",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"Amount": "1000",
"EPrice": "25",
"Fee": "1",
"Flags": 4194304,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "23BAFE5BFE58E7BF0B02B5875983D007C10796C8E62A190BF688EBE5D8A104DAD2DE7EDE995FE2E494883FD8140F38E22E3376A2F49C50EFCAA00C7499A4690E"
}
},
{
"binary": "120027220000000024000000026840000000000000016CD4C8E1BC9BF04000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0486DD4CC6F3B40B6C000B3813FCAB4EE68B3D0D735D6849465A9113EE048B3813FCAB4EE68B3D0D735D6849465A9113EE0487321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D074406B2A1548E6DC14681356C27CCBE7072CAB2AD8C72D0D7A045916FB0E0DBE6BF71A429CC519E9200172829D3EEF79100899D3A8710C1C3C1A2B664FD64086AD0A811462D4D845D20B4F09CFEA8BB4C01063D99FC9673EF01AE01C81149A91957F8F16BC57F3F200CD8C98375BF1791586E1F10318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMBid",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"AuthAccounts": [{"AuthAccount": {"Account": "rEaHTti4HZsMBpxTAF4ncWxkcdqDh1h6P7"}}],
"BidMax": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "35"},
"BidMin": {"currency": "B3813FCAB4EE68B3D0D735D6849465A9113EE048", "issuer": "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg", "value": "25"},
"Fee": "1",
"Flags": 0,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "6B2A1548E6DC14681356C27CCBE7072CAB2AD8C72D0D7A045916FB0E0DBE6BF71A429CC519E9200172829D3EEF79100899D3A8710C1C3C1A2B664FD64086AD0A"
}
},
{
"binary": "1200261500EA220000000024000000026840000000000000017321ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0744072767CF9A0F5E9C9DA6BBB6E84905B0ECDF122D3E2D730843EFD377521E8E73664AD809D0A54E8C75CD1735ACB64E310BB49FDED10913FA150B8C006D4ACEC00811462D4D845D20B4F09CFEA8BB4C01063D99FC9673E0318000000000000000000000000000000000000000004180000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C",
"json": {
"Account": "rwr2UWxNwoBdysPSiDDraTQjAQKZEeZAcV",
"TransactionType": "AMMVote",
"Asset": {"currency": "XRP"},
"Asset2": {"currency": "ETH", "issuer": "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"},
"TradingFee": 234,
"Fee": "1",
"Flags": 0,
"Sequence": 2,
"SigningPubKey": "ED8A00C1D29E762266576408B08D583B987673550655F930635678B436D5CDF7D0",
"TxnSignature": "72767CF9A0F5E9C9DA6BBB6E84905B0ECDF122D3E2D730843EFD377521E8E73664AD809D0A54E8C75CD1735ACB64E310BB49FDED10913FA150B8C006D4ACEC00"
}
}
],
"ledgerData": [{

View File

@@ -48,6 +48,9 @@ Wallet.fromMmnemonic()
* `Wallet.fromMnemonic` detects when an invalid encoding is provided, and throws an error
* Made unexpected errors in `submitAndWait` more verbose to make them easier to debug.
### Added
* Support for Automated Market Maker (AMM) transactions and requests as defined in XLS-30.
## 2.3.1 (2022-06-27)
### Fixed
* Signing tx with standard currency codes with lowercase and allowed symbols causing an error on decode.

View File

@@ -1,6 +1,6 @@
{
"name": "xrpl",
"version": "2.6.0",
"version": "2.7.0-beta.1",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
@@ -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.5.0-beta.3",
"ripple-keypairs": "^1.1.4",
"ws": "^8.2.2"
},

View File

@@ -25,6 +25,9 @@ import {
AccountOffersResponse,
AccountTxRequest,
AccountTxResponse,
// AMM methods
AMMInfoRequest,
AMMInfoResponse,
GatewayBalancesRequest,
GatewayBalancesResponse,
NoRippleCheckRequest,
@@ -299,6 +302,7 @@ class Client extends EventEmitter {
): Promise<AccountObjectsResponse>
public async request(r: AccountOffersRequest): Promise<AccountOffersResponse>
public async request(r: AccountTxRequest): Promise<AccountTxResponse>
public async request(r: AMMInfoRequest): Promise<AMMInfoResponse>
public async request(r: BookOffersRequest): Promise<BookOffersResponse>
public async request(r: ChannelVerifyRequest): Promise<ChannelVerifyResponse>
public async request(

View File

@@ -0,0 +1,147 @@
import { Amount, IssuedCurrency, IssuedCurrencyAmount } from '../common'
import { BaseRequest, BaseResponse } from './baseMethod'
/**
* The `amm_info` command retrieves information about an AMM instance.
* Returns an {@link AMMInfoResponse}.
*
* @category Requests
*/
export interface AMMInfoRequest extends BaseRequest {
command: 'amm_info'
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
* Both asset and asset2 must be defined to specify an AMM instance.
*/
asset?: IssuedCurrency
/**
* Specifies the other pool asset of the AMM instance.
* Both asset and asset2 must be defined to specify an AMM instance.
*/
asset2?: IssuedCurrency
}
interface AuthAccount {
account: string
}
interface VoteEntry {
account: string
trading_fee: number
vote_weight: number
}
/**
* Response expected from an {@link AMMInfoRequest}.
*
* @category Responses
*/
export interface AMMInfoResponse extends BaseResponse {
result: {
amm: {
/**
* The account that tracks the balance of LPTokens between the AMM instance via Trustline.
*/
amm_account: string
/**
* One of the pool assets (XRP or token) of the AMM instance.
*/
amount: Amount
/**
* The other pool asset of the AMM instance.
*/
amount2: Amount
/**
* (Omitted for XRP) If true, the amount currency is currently frozen for asset.
*/
asset_frozen: boolean
/**
* (Omitted for XRP) If true, the amount currency is currently frozen for asset2.
*/
asset2_frozen: boolean
/**
* Details of the current owner of the auction slot.
*/
auction_slot?: {
/**
* The current owner of this auction slot.
*/
account: string
/**
* A list of at most 4 additional accounts that are authorized to trade at the discounted fee for this AMM instance.
*/
auth_accounts: AuthAccount[]
/**
* The trading fee to be charged to the auction owner, in the same format as TradingFee.
* By default this is 0, meaning that the auction owner can trade at no fee instead of the standard fee for this AMM.
*/
discounted_fee: number
/**
* The time when this slot expires, in seconds since the Ripple Epoch.
*/
expiration: string
/**
* The amount the auction owner paid to win this slot, in LPTokens.
*/
price: Amount
/**
* Total slot time of 24-hours is divided into 20 equal time intervals.
*/
time_interval: number
}
/**
* The total outstanding balance of liquidity provider tokens from this AMM instance.
* The holders of these tokens can vote on the AMM's trading fee in proportion to their holdings,
* or redeem the tokens for a share of the AMM's assets which grows with the trading fees collected.
*/
lp_token: IssuedCurrencyAmount
/**
* Specifies the fee, in basis point, to be charged to the traders for the trades
* executed against the AMM instance. Trading fee is a percentage of the trading volume.
* Valid values for this field are between 0 and 1000 inclusive.
* A value of 1 is equivalent to 1/10 bps or 0.001%, allowing trading fee
* between 0% and 1%. This field is required.
*/
trading_fee: number
/**
* Keeps a track of up to eight active votes for the instance.
*/
vote_slots?: VoteEntry[]
}
/**
* The identifying hash of the ledger that was used to generate this
* response.
*/
ledger_hash?: string
/**
* The ledger index of the ledger version that was used to generate this
* response.
*/
ledger_index?: number
/**
* If included and set to true, the information in this response comes from
* a validated ledger version. Otherwise, the information is subject to
* change.
*/
validated?: boolean
}
}

View File

@@ -16,6 +16,7 @@ import {
AccountOffersResponse,
} from './accountOffers'
import { AccountTxRequest, AccountTxResponse } from './accountTx'
import { AMMInfoRequest, AMMInfoResponse } from './ammInfo'
import { ErrorResponse } from './baseMethod'
import { BookOffersRequest, BookOffer, BookOffersResponse } from './bookOffers'
import { ChannelVerifyRequest, ChannelVerifyResponse } from './channelVerify'
@@ -87,6 +88,7 @@ type Request =
| AccountObjectsRequest
| AccountOffersRequest
| AccountTxRequest
| AMMInfoRequest
| GatewayBalancesRequest
| NoRippleCheckRequest
// ledger methods
@@ -137,6 +139,7 @@ type Response =
| AccountObjectsResponse
| AccountOffersResponse
| AccountTxResponse
| AMMInfoResponse
| GatewayBalancesResponse
| NoRippleCheckResponse
// ledger methods
@@ -195,6 +198,8 @@ export {
AccountOffersResponse,
AccountTxRequest,
AccountTxResponse,
AMMInfoRequest,
AMMInfoResponse,
GatewayBalancesRequest,
GatewayBalancesResponse,
NoRippleCheckRequest,

View File

@@ -0,0 +1,106 @@
/* eslint-disable complexity -- required for validateAMMBid */
import { ValidationError } from '../../errors'
import { Amount, IssuedCurrency } from '../common'
import {
BaseTransaction,
isAmount,
isIssue,
validateBaseTransaction,
} from './common'
const MAX_AUTH_ACCOUNTS = 4
interface AuthAccount {
AuthAccount: {
Account: string
}
}
/**
* AMMBid is used for submitting a vote for the trading fee of an AMM Instance.
*
* Any XRPL account that holds LPToken for an AMM instance may submit this
* transaction to vote for the trading fee for that instance.
*/
export interface AMMBid extends BaseTransaction {
TransactionType: 'AMMBid'
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
/**
* This field represents the minimum price that the bidder wants to pay for the slot.
* It is specified in units of LPToken. If specified let BidMin be X and let
* the slot-price computed by price scheduling algorithm be Y, then bidder always pays
* the max(X, Y).
*/
BidMin?: Amount
/**
* This field represents the maximum price that the bidder wants to pay for the slot.
* It is specified in units of LPToken.
*/
BidMax?: Amount
/**
* This field represents an array of XRPL account IDs that are authorized to trade
* at the discounted fee against the AMM instance.
* A maximum of four accounts can be provided.
*/
AuthAccounts?: AuthAccount[]
}
/**
* Verify the form and type of an AMMBid at runtime.
*
* @param tx - An AMMBid Transaction.
* @throws When the AMMBid is Malformed.
*/
export function validateAMMBid(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.Asset == null) {
throw new ValidationError('AMMBid: missing field Asset')
}
if (!isIssue(tx.Asset)) {
throw new ValidationError('AMMBid: Asset must be an Issue')
}
if (tx.Asset2 == null) {
throw new ValidationError('AMMBid: missing field Asset2')
}
if (!isIssue(tx.Asset2)) {
throw new ValidationError('AMMBid: Asset2 must be an Issue')
}
if (tx.BidMin != null && !isAmount(tx.BidMin)) {
throw new ValidationError('AMMBid: BidMin must be an Amount')
}
if (tx.BidMax != null && !isAmount(tx.BidMax)) {
throw new ValidationError('AMMBid: BidMax must be an Amount')
}
if (tx.AuthAccounts != null) {
if (!Array.isArray(tx.AuthAccounts)) {
throw new ValidationError(
`AMMBid: AuthAccounts must be an AuthAccount array`,
)
}
if (tx.AuthAccounts.length > MAX_AUTH_ACCOUNTS) {
throw new ValidationError(
`AMMBid: AuthAccounts length must not be greater than ${MAX_AUTH_ACCOUNTS}`,
)
}
}
}

View File

@@ -0,0 +1,76 @@
import { ValidationError } from '../../errors'
import { Amount } from '../common'
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
export const AMM_MAX_TRADING_FEE = 1000
/**
* AMMCreate is used to create AccountRoot and the corresponding
* AMM ledger entries.
*
* This allows for the creation of only one AMM instance per unique asset pair.
*/
export interface AMMCreate extends BaseTransaction {
TransactionType: 'AMMCreate'
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Amount: Amount
/**
* Specifies the other pool asset of the AMM instance.
*/
Amount2: Amount
/**
* Specifies the fee, in basis point, to be charged
* to the traders for the trades executed against the AMM instance.
* Trading fee is a percentage of the trading volume.
* Valid values for this field are between 0 and 1000 inclusive.
* A value of 1 is equivalent to 1/10 bps or 0.001%, allowing trading fee
* between 0% and 1%.
*/
TradingFee: number
}
/**
* Verify the form and type of an AMMCreate at runtime.
*
* @param tx - An AMMCreate Transaction.
* @throws When the AMMCreate is Malformed.
*/
export function validateAMMCreate(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.Amount == null) {
throw new ValidationError('AMMCreate: missing field Amount')
}
if (!isAmount(tx.Amount)) {
throw new ValidationError('AMMCreate: Amount must be an Amount')
}
if (tx.Amount2 == null) {
throw new ValidationError('AMMCreate: missing field Amount2')
}
if (!isAmount(tx.Amount2)) {
throw new ValidationError('AMMCreate: Amount2 must be an Amount')
}
if (tx.TradingFee == null) {
throw new ValidationError('AMMCreate: missing field TradingFee')
}
if (typeof tx.TradingFee !== 'number') {
throw new ValidationError('AMMCreate: TradingFee must be a number')
}
if (tx.TradingFee < 0 || tx.TradingFee > AMM_MAX_TRADING_FEE) {
throw new ValidationError(
`AMMCreate: TradingFee must be between 0 and ${AMM_MAX_TRADING_FEE}`,
)
}
}

View File

@@ -0,0 +1,135 @@
/* eslint-disable complexity -- required for validateAMMDeposit */
import { ValidationError } from '../../errors'
import { Amount, IssuedCurrency, IssuedCurrencyAmount } from '../common'
import {
BaseTransaction,
GlobalFlags,
isAmount,
isIssue,
isIssuedCurrency,
validateBaseTransaction,
} from './common'
/**
* Enum representing values for AMMDeposit Transaction Flags.
*
* @category Transaction Flags
*/
export enum AMMDepositFlags {
tfLPToken = 0x00010000,
tfSingleAsset = 0x00080000,
tfTwoAsset = 0x00100000,
tfOneAssetLPToken = 0x00200000,
tfLimitLPToken = 0x00400000,
}
export interface AMMDepositFlagsInterface extends GlobalFlags {
tfLPToken?: boolean
tfSingleAsset?: boolean
tfTwoAsset?: boolean
tfOneAssetLPToken?: boolean
tfLimitLPToken?: boolean
}
/**
* AMMDeposit is the deposit transaction used to add liquidity to the AMM instance pool,
* thus obtaining some share of the instance's pools in the form of LPTokenOut.
*
* The following are the recommended valid combinations:
* - LPTokenOut
* - Amount
* - Amount and Amount2
* - Amount and LPTokenOut
* - Amount and EPrice
*/
export interface AMMDeposit extends BaseTransaction {
TransactionType: 'AMMDeposit'
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
/**
* Specifies the amount of shares of the AMM instance pools that the trader
* wants to redeem or trade in.
*/
LPTokenOut?: IssuedCurrencyAmount
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance to
* deposit more of its value.
*/
Amount?: Amount
/**
* Specifies the other pool asset of the AMM instance to deposit more of
* its value.
*/
Amount2?: Amount
/**
* Specifies the maximum effective-price that LPTokenOut can be traded out.
*/
EPrice?: Amount
}
/**
* Verify the form and type of an AMMDeposit at runtime.
*
* @param tx - An AMMDeposit Transaction.
* @throws When the AMMDeposit is Malformed.
*/
export function validateAMMDeposit(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.Asset == null) {
throw new ValidationError('AMMDeposit: missing field Asset')
}
if (!isIssue(tx.Asset)) {
throw new ValidationError('AMMDeposit: Asset must be an Issue')
}
if (tx.Asset2 == null) {
throw new ValidationError('AMMDeposit: missing field Asset2')
}
if (!isIssue(tx.Asset2)) {
throw new ValidationError('AMMDeposit: Asset2 must be an Issue')
}
if (tx.Amount2 != null && tx.Amount == null) {
throw new ValidationError('AMMDeposit: must set Amount with Amount2')
} else if (tx.EPrice != null && tx.Amount == null) {
throw new ValidationError('AMMDeposit: must set Amount with EPrice')
} else if (tx.LPTokenOut == null && tx.Amount == null) {
throw new ValidationError(
'AMMDeposit: must set at least LPTokenOut or Amount',
)
}
if (tx.LPTokenOut != null && !isIssuedCurrency(tx.LPTokenOut)) {
throw new ValidationError(
'AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount',
)
}
if (tx.Amount != null && !isAmount(tx.Amount)) {
throw new ValidationError('AMMDeposit: Amount must be an Amount')
}
if (tx.Amount2 != null && !isAmount(tx.Amount2)) {
throw new ValidationError('AMMDeposit: Amount2 must be an Amount')
}
if (tx.EPrice != null && !isAmount(tx.EPrice)) {
throw new ValidationError('AMMDeposit: EPrice must be an Amount')
}
}

View File

@@ -0,0 +1,73 @@
import { ValidationError } from '../../errors'
import { IssuedCurrency } from '../common'
import { AMM_MAX_TRADING_FEE } from './AMMCreate'
import { BaseTransaction, isIssue, validateBaseTransaction } from './common'
/**
* AMMVote is used for submitting a vote for the trading fee of an AMM Instance.
*
* Any XRPL account that holds LPToken for an AMM instance may submit this
* transaction to vote for the trading fee for that instance.
*/
export interface AMMVote extends BaseTransaction {
TransactionType: 'AMMVote'
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
/**
* Specifies the fee, in basis point.
* Valid values for this field are between 0 and 1000 inclusive.
* A value of 1 is equivalent to 1/10 bps or 0.001%, allowing trading fee
* between 0% and 1%. This field is required.
*/
TradingFee: number
}
/**
* Verify the form and type of an AMMVote at runtime.
*
* @param tx - An AMMVote Transaction.
* @throws When the AMMVote is Malformed.
*/
export function validateAMMVote(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.Asset == null) {
throw new ValidationError('AMMVote: missing field Asset')
}
if (!isIssue(tx.Asset)) {
throw new ValidationError('AMMVote: Asset must be an Issue')
}
if (tx.Asset2 == null) {
throw new ValidationError('AMMVote: missing field Asset2')
}
if (!isIssue(tx.Asset2)) {
throw new ValidationError('AMMVote: Asset2 must be an Issue')
}
if (tx.TradingFee == null) {
throw new ValidationError('AMMVote: missing field TradingFee')
}
if (typeof tx.TradingFee !== 'number') {
throw new ValidationError('AMMVote: TradingFee must be a number')
}
if (tx.TradingFee < 0 || tx.TradingFee > AMM_MAX_TRADING_FEE) {
throw new ValidationError(
`AMMVote: TradingFee must be between 0 and ${AMM_MAX_TRADING_FEE}`,
)
}
}

View File

@@ -0,0 +1,137 @@
/* eslint-disable complexity -- required for validateAMMWithdraw */
import { ValidationError } from '../../errors'
import { Amount, IssuedCurrency, IssuedCurrencyAmount } from '../common'
import {
BaseTransaction,
GlobalFlags,
isAmount,
isIssue,
isIssuedCurrency,
validateBaseTransaction,
} from './common'
/**
* Enum representing values for AMMWithdrawFlags Transaction Flags.
*
* @category Transaction Flags
*/
export enum AMMWithdrawFlags {
tfLPToken = 0x00010000,
tfWithdrawAll = 0x00020000,
tfOneAssetWithdrawAll = 0x00040000,
tfSingleAsset = 0x00080000,
tfTwoAsset = 0x00100000,
tfOneAssetLPToken = 0x00200000,
tfLimitLPToken = 0x00400000,
}
export interface AMMWithdrawFlagsInterface extends GlobalFlags {
tfLPToken?: boolean
tfWithdrawAll?: boolean
tfOneAssetWithdrawAll?: boolean
tfSingleAsset?: boolean
tfTwoAsset?: boolean
tfOneAssetLPToken?: boolean
tfLimitLPToken?: boolean
}
/**
* AMMWithdraw is the withdraw transaction used to remove liquidity from the AMM
* instance pool, thus redeeming some share of the pools that one owns in the form
* of LPTokenIn.
*
* The following are the recommended valid combinations:
* - LPTokenIn
* - Amount
* - Amount and Amount2
* - Amount and LPTokenIn
* - Amount and EPrice
*/
export interface AMMWithdraw extends BaseTransaction {
TransactionType: 'AMMWithdraw'
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
/**
* Specifies the amount of shares of the AMM instance pools that the trader
* wants to redeem or trade in.
*/
LPTokenIn?: IssuedCurrencyAmount
/**
* Specifies one of the pools assets that the trader wants to remove.
* If the asset is XRP, then the Amount is a string specifying the number of drops.
* Otherwise it is an IssuedCurrencyAmount object.
*/
Amount?: Amount
/**
* Specifies the other pool asset that the trader wants to remove.
*/
Amount2?: Amount
/**
* Specifies the effective-price of the token out after successful execution of
* the transaction.
*/
EPrice?: Amount
}
/**
* Verify the form and type of an AMMWithdraw at runtime.
*
* @param tx - An AMMWithdraw Transaction.
* @throws When the AMMWithdraw is Malformed.
*/
export function validateAMMWithdraw(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.Asset == null) {
throw new ValidationError('AMMWithdraw: missing field Asset')
}
if (!isIssue(tx.Asset)) {
throw new ValidationError('AMMWithdraw: Asset must be an Issue')
}
if (tx.Asset2 == null) {
throw new ValidationError('AMMWithdraw: missing field Asset2')
}
if (!isIssue(tx.Asset2)) {
throw new ValidationError('AMMWithdraw: Asset2 must be an Issue')
}
if (tx.Amount2 != null && tx.Amount == null) {
throw new ValidationError('AMMWithdraw: must set Amount with Amount2')
} else if (tx.EPrice != null && tx.Amount == null) {
throw new ValidationError('AMMWithdraw: must set Amount with EPrice')
}
if (tx.LPTokenIn != null && !isIssuedCurrency(tx.LPTokenIn)) {
throw new ValidationError(
'AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount',
)
}
if (tx.Amount != null && !isAmount(tx.Amount)) {
throw new ValidationError('AMMWithdraw: Amount must be an Amount')
}
if (tx.Amount2 != null && !isAmount(tx.Amount2)) {
throw new ValidationError('AMMWithdraw: Amount2 must be an Amount')
}
if (tx.EPrice != null && !isAmount(tx.EPrice)) {
throw new ValidationError('AMMWithdraw: EPrice must be an Amount')
}
}

View File

@@ -7,6 +7,19 @@ export {
AccountSet,
} from './accountSet'
export { AccountDelete } from './accountDelete'
export { AMMBid } from './AMMBid'
export {
AMMDepositFlags,
AMMDepositFlagsInterface,
AMMDeposit,
} from './AMMDeposit'
export { AMMCreate } from './AMMCreate'
export { AMMVote } from './AMMVote'
export {
AMMWithdrawFlags,
AMMWithdrawFlagsInterface,
AMMWithdraw,
} from './AMMWithdraw'
export { CheckCancel } from './checkCancel'
export { CheckCash } from './checkCash'
export { CheckCreate } from './checkCreate'

View File

@@ -1,3 +1,4 @@
/* eslint-disable max-lines -- necessary to support all transactions */
/* eslint-disable complexity -- verifies 19 tx types hence a lot of checks needed */
/* eslint-disable max-lines-per-function -- need to work with a lot of Tx verifications */
@@ -10,6 +11,11 @@ import { setTransactionFlagsToNumber } from '../utils/flags'
import { AccountDelete, validateAccountDelete } from './accountDelete'
import { AccountSet, validateAccountSet } from './accountSet'
import { AMMBid, validateAMMBid } from './AMMBid'
import { AMMCreate, validateAMMCreate } from './AMMCreate'
import { AMMDeposit, validateAMMDeposit } from './AMMDeposit'
import { AMMVote, validateAMMVote } from './AMMVote'
import { AMMWithdraw, validateAMMWithdraw } from './AMMWithdraw'
import { CheckCancel, validateCheckCancel } from './checkCancel'
import { CheckCash, validateCheckCash } from './checkCash'
import { CheckCreate, validateCheckCreate } from './checkCreate'
@@ -84,6 +90,11 @@ import {
export type Transaction =
| AccountDelete
| AccountSet
| AMMBid
| AMMDeposit
| AMMCreate
| AMMVote
| AMMWithdraw
| CheckCancel
| CheckCash
| CheckCreate
@@ -150,6 +161,26 @@ export function validate(transaction: Record<string, unknown>): void {
validateAccountSet(tx)
break
case 'AMMBid':
validateAMMBid(tx)
break
case 'AMMDeposit':
validateAMMDeposit(tx)
break
case 'AMMCreate':
validateAMMCreate(tx)
break
case 'AMMVote':
validateAMMVote(tx)
break
case 'AMMWithdraw':
validateAMMWithdraw(tx)
break
case 'CheckCancel':
validateCheckCancel(tx)
break

View File

@@ -7,6 +7,8 @@ import {
AccountRootFlags,
} from '../ledger/AccountRoot'
import { AccountSetTfFlags } from '../transactions/accountSet'
import { AMMDepositFlags } from '../transactions/AMMDeposit'
import { AMMWithdrawFlags } from '../transactions/AMMWithdraw'
import { GlobalFlags } from '../transactions/common'
import { OfferCreateFlags } from '../transactions/offerCreate'
import { PaymentFlags } from '../transactions/payment'
@@ -42,6 +44,7 @@ export function parseAccountRootFlags(
*
* @param tx - A transaction to set its flags to its numeric representation.
*/
// eslint-disable-next-line complexity -- necessary
export function setTransactionFlagsToNumber(tx: Transaction): void {
if (tx.Flags == null) {
tx.Flags = 0
@@ -55,6 +58,12 @@ export function setTransactionFlagsToNumber(tx: Transaction): void {
case 'AccountSet':
tx.Flags = convertFlagsToNumber(tx.Flags, AccountSetTfFlags)
return
case 'AMMDeposit':
tx.Flags = convertFlagsToNumber(tx.Flags, AMMDepositFlags)
return
case 'AMMWithdraw':
tx.Flags = convertFlagsToNumber(tx.Flags, AMMWithdrawFlags)
return
case 'OfferCreate':
tx.Flags = convertFlagsToNumber(tx.Flags, OfferCreateFlags)
return

View File

@@ -140,7 +140,7 @@ async function setNextValidSequenceNumber(
tx.Sequence = data.result.account_data.Sequence
}
async function fetchAccountDeleteFee(client: Client): Promise<BigNumber> {
async function fetchOwnerReserveFee(client: Client): Promise<BigNumber> {
const response = await client.request({ command: 'server_state' })
const fee = response.result.state.validated_ledger?.reserve_inc
@@ -172,9 +172,11 @@ async function calculateFeePerTransactionType(
baseFee = product.dp(0, BigNumber.ROUND_CEIL)
}
// AccountDelete Transaction
if (tx.TransactionType === 'AccountDelete') {
baseFee = await fetchAccountDeleteFee(client)
if (
tx.TransactionType === 'AccountDelete' ||
tx.TransactionType === 'AMMCreate'
) {
baseFee = await fetchOwnerReserveFee(client)
}
/*

View File

@@ -0,0 +1,123 @@
import { assert } from 'chai'
import { validate, ValidationError } from '../../src'
/**
* AMMBid Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('AMMBid', function () {
let bid
beforeEach(function () {
bid = {
TransactionType: 'AMMBid',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
Asset: {
currency: 'XRP',
},
Asset2: {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
},
BidMin: '5',
BidMax: '10',
AuthAccounts: [
{
AuthAccount: {
Account: 'rNZdsTBP5tH1M6GHC6bTreHAp6ouP8iZSh',
},
},
{
AuthAccount: {
Account: 'rfpFv97Dwu89FTyUwPjtpZBbuZxTqqgTmH',
},
},
{
AuthAccount: {
Account: 'rzzYHPGb8Pa64oqxCzmuffm122bitq3Vb',
},
},
{
AuthAccount: {
Account: 'rhwxHxaHok86fe4LykBom1jSJ3RYQJs1h4',
},
},
],
Sequence: 1337,
} as any
})
it(`verifies valid AMMBid`, function () {
assert.doesNotThrow(() => validate(bid))
})
it(`throws w/ missing field Asset`, function () {
delete bid.Asset
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: missing field Asset',
)
})
it(`throws w/ Asset must be an Issue`, function () {
bid.Asset = 1234
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: Asset must be an Issue',
)
})
it(`throws w/ missing field Asset2`, function () {
delete bid.Asset2
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: missing field Asset2',
)
})
it(`throws w/ Asset2 must be an Issue`, function () {
bid.Asset2 = 1234
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: Asset2 must be an Issue',
)
})
it(`throws w/ BidMin must be an Amount`, function () {
bid.BidMin = 5
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: BidMin must be an Amount',
)
})
it(`throws w/ BidMax must be an Amount`, function () {
bid.BidMax = 10
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: BidMax must be an Amount',
)
})
it(`throws w/ AuthAccounts length must not be greater than 4`, function () {
bid.AuthAccounts.push({
AuthAccount: {
Account: 'r3X6noRsvaLapAKCG78zAtWcbhB3sggS1s',
},
})
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: AuthAccounts length must not be greater than 4',
)
})
})

View File

@@ -0,0 +1,103 @@
import { assert } from 'chai'
import { validate, ValidationError } from '../../src'
/**
* AMMCreate Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('AMMCreate', function () {
let ammCreate
beforeEach(function () {
ammCreate = {
TransactionType: 'AMMCreate',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
Amount: '1000',
Amount2: {
currency: 'USD',
issuer: 'rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9',
value: '1000',
},
TradingFee: 12,
Sequence: 1337,
} as any
})
it(`verifies valid AMMCreate`, function () {
assert.doesNotThrow(() => validate(ammCreate))
})
it(`throws w/ missing Amount`, function () {
delete ammCreate.Amount
assert.throws(
() => validate(ammCreate),
ValidationError,
'AMMCreate: missing field Amount',
)
})
it(`throws w/ Amount must be an Amount`, function () {
ammCreate.Amount = 1000
assert.throws(
() => validate(ammCreate),
ValidationError,
'AMMCreate: Amount must be an Amount',
)
})
it(`throws w/ missing Amount2`, function () {
delete ammCreate.Amount2
assert.throws(
() => validate(ammCreate),
ValidationError,
'AMMCreate: missing field Amount2',
)
})
it(`throws w/ Amount2 must be an Amount`, function () {
ammCreate.Amount2 = 1000
assert.throws(
() => validate(ammCreate),
ValidationError,
'AMMCreate: Amount2 must be an Amount',
)
})
it(`throws w/ missing TradingFee`, function () {
delete ammCreate.TradingFee
assert.throws(
() => validate(ammCreate),
ValidationError,
'AMMCreate: missing field TradingFee',
)
})
it(`throws w/ TradingFee must be a number`, function () {
ammCreate.TradingFee = '12'
assert.throws(
() => validate(ammCreate),
ValidationError,
'AMMCreate: TradingFee must be a number',
)
})
it(`throws when TradingFee is greater than 1000`, function () {
ammCreate.TradingFee = 1001
assert.throws(
() => validate(ammCreate),
ValidationError,
`AMMCreate: TradingFee must be between 0 and 1000`,
)
})
it(`throws when TradingFee is a negative number`, function () {
ammCreate.TradingFee = -1
assert.throws(
() => validate(ammCreate),
ValidationError,
`AMMCreate: TradingFee must be between 0 and 1000`,
)
})
})

View File

@@ -0,0 +1,175 @@
/* eslint-disable no-bitwise -- bitwise necessary for enabling flags */
import { assert } from 'chai'
import { AMMDepositFlags, validate, ValidationError } from '../../src'
/**
* AMMDeposit Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('AMMDeposit', function () {
const LPTokenOut = {
currency: 'B3813FCAB4EE68B3D0D735D6849465A9113EE048',
issuer: 'rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg',
value: '1000',
}
let deposit
beforeEach(function () {
deposit = {
TransactionType: 'AMMDeposit',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
Asset: {
currency: 'XRP',
},
Asset2: {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
},
Sequence: 1337,
Flags: 0,
} as any
})
it(`verifies valid AMMDeposit with LPTokenOut`, function () {
deposit.LPTokenOut = LPTokenOut
deposit.Flags |= AMMDepositFlags.tfLPToken
assert.doesNotThrow(() => validate(deposit))
})
it(`verifies valid AMMDeposit with Amount`, function () {
deposit.Amount = '1000'
deposit.Flags |= AMMDepositFlags.tfSingleAsset
assert.doesNotThrow(() => validate(deposit))
})
it(`verifies valid AMMDeposit with Amount and Amount2`, function () {
deposit.Amount = '1000'
deposit.Amount2 = {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
value: '2.5',
}
deposit.Flags |= AMMDepositFlags.tfTwoAsset
assert.doesNotThrow(() => validate(deposit))
})
it(`verifies valid AMMDeposit with Amount and LPTokenOut`, function () {
deposit.Amount = '1000'
deposit.LPTokenOut = LPTokenOut
deposit.Flags |= AMMDepositFlags.tfOneAssetLPToken
assert.doesNotThrow(() => validate(deposit))
})
it(`verifies valid AMMDeposit with Amount and EPrice`, function () {
deposit.Amount = '1000'
deposit.EPrice = '25'
deposit.Flags |= AMMDepositFlags.tfLimitLPToken
assert.doesNotThrow(() => validate(deposit))
})
it(`throws w/ missing field Asset`, function () {
delete deposit.Asset
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: missing field Asset',
)
})
it(`throws w/ Asset must be an Issue`, function () {
deposit.Asset = 1234
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: Asset must be an Issue',
)
})
it(`throws w/ missing field Asset2`, function () {
delete deposit.Asset2
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: missing field Asset2',
)
})
it(`throws w/ Asset2 must be an Issue`, function () {
deposit.Asset2 = 1234
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: Asset2 must be an Issue',
)
})
it(`throws w/ must set at least LPTokenOut or Amount`, function () {
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: must set at least LPTokenOut or Amount',
)
})
it(`throws w/ must set Amount with Amount2`, function () {
deposit.Amount2 = {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
value: '2.5',
}
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: must set Amount with Amount2',
)
})
it(`throws w/ must set Amount with EPrice`, function () {
deposit.EPrice = '25'
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: must set Amount with EPrice',
)
})
it(`throws w/ LPTokenOut must be an IssuedCurrencyAmount`, function () {
deposit.LPTokenOut = 1234
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount',
)
})
it(`throws w/ Amount must be an Amount`, function () {
deposit.Amount = 1234
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: Amount must be an Amount',
)
})
it(`throws w/ Amount2 must be an Amount`, function () {
deposit.Amount = '1000'
deposit.Amount2 = 1234
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: Amount2 must be an Amount',
)
})
it(`throws w/ EPrice must be an Amount`, function () {
deposit.Amount = '1000'
deposit.EPrice = 1234
assert.throws(
() => validate(deposit),
ValidationError,
'AMMDeposit: EPrice must be an Amount',
)
})
})

View File

@@ -0,0 +1,104 @@
import { assert } from 'chai'
import { validate, ValidationError } from '../../src'
/**
* AMMVote Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('AMMVote', function () {
let vote
beforeEach(function () {
vote = {
TransactionType: 'AMMVote',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
Asset: {
currency: 'XRP',
},
Asset2: {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
},
TradingFee: 25,
Sequence: 1337,
} as any
})
it(`verifies valid AMMVote`, function () {
assert.doesNotThrow(() => validate(vote))
})
it(`throws w/ missing field Asset`, function () {
delete vote.Asset
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: missing field Asset',
)
})
it(`throws w/ Asset must be an Issue`, function () {
vote.Asset = 1234
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: Asset must be an Issue',
)
})
it(`throws w/ missing field Asset2`, function () {
delete vote.Asset2
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: missing field Asset2',
)
})
it(`throws w/ Asset2 must be an Issue`, function () {
vote.Asset2 = 1234
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: Asset2 must be an Issue',
)
})
it(`throws w/ missing field TradingFee`, function () {
delete vote.TradingFee
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: missing field TradingFee',
)
})
it(`throws w/ TradingFee must be a number`, function () {
vote.TradingFee = '25'
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: TradingFee must be a number',
)
})
it(`throws when TradingFee is greater than AMM_MAX_TRADING_FEE`, function () {
vote.TradingFee = 1001
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: TradingFee must be between 0 and 1000',
)
})
it(`throws when TradingFee is a negative number`, function () {
vote.TradingFee = -1
assert.throws(
() => validate(vote),
ValidationError,
'AMMVote: TradingFee must be between 0 and 1000',
)
})
})

View File

@@ -0,0 +1,178 @@
/* eslint-disable no-bitwise -- bitwise necessary for enabling flags */
import { assert } from 'chai'
import { AMMWithdrawFlags, validate, ValidationError } from '../../src'
/**
* AMMWithdraw Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('AMMWithdraw', function () {
const LPTokenIn = {
currency: 'B3813FCAB4EE68B3D0D735D6849465A9113EE048',
issuer: 'rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg',
value: '1000',
}
let withdraw
beforeEach(function () {
withdraw = {
TransactionType: 'AMMWithdraw',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
Asset: {
currency: 'XRP',
},
Asset2: {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
},
Sequence: 1337,
Flags: 0,
} as any
})
it(`verifies valid AMMWithdraw with LPTokenIn`, function () {
withdraw.LPTokenIn = LPTokenIn
withdraw.Flags |= AMMWithdrawFlags.tfLPToken
assert.doesNotThrow(() => validate(withdraw))
})
it(`verifies valid AMMWithdraw with Amount`, function () {
withdraw.Amount = '1000'
withdraw.Flags |= AMMWithdrawFlags.tfSingleAsset
assert.doesNotThrow(() => validate(withdraw))
})
it(`verifies valid AMMWithdraw with Amount and Amount2`, function () {
withdraw.Amount = '1000'
withdraw.Amount2 = {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
value: '2.5',
}
withdraw.Flags |= AMMWithdrawFlags.tfTwoAsset
assert.doesNotThrow(() => validate(withdraw))
})
it(`verifies valid AMMWithdraw with Amount and LPTokenIn`, function () {
withdraw.Amount = '1000'
withdraw.LPTokenIn = LPTokenIn
withdraw.Flags |= AMMWithdrawFlags.tfOneAssetLPToken
assert.doesNotThrow(() => validate(withdraw))
})
it(`verifies valid AMMWithdraw with Amount and EPrice`, function () {
withdraw.Amount = '1000'
withdraw.EPrice = '25'
withdraw.Flags |= AMMWithdrawFlags.tfLimitLPToken
assert.doesNotThrow(() => validate(withdraw))
})
it(`verifies valid AMMWithdraw one asset withdraw all`, function () {
withdraw.Amount = '1000'
withdraw.Flags |= AMMWithdrawFlags.tfOneAssetWithdrawAll
assert.doesNotThrow(() => validate(withdraw))
})
it(`verifies valid AMMWithdraw withdraw all`, function () {
withdraw.Flags |= AMMWithdrawFlags.tfWithdrawAll
assert.doesNotThrow(() => validate(withdraw))
})
it(`throws w/ missing field Asset`, function () {
delete withdraw.Asset
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: missing field Asset',
)
})
it(`throws w/ Asset must be an Issue`, function () {
withdraw.Asset = 1234
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: Asset must be an Issue',
)
})
it(`throws w/ missing field Asset2`, function () {
delete withdraw.Asset2
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: missing field Asset2',
)
})
it(`throws w/ Asset2 must be an Issue`, function () {
withdraw.Asset2 = 1234
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: Asset2 must be an Issue',
)
})
it(`throws w/ must set Amount with Amount2`, function () {
withdraw.Amount2 = {
currency: 'ETH',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
value: '2.5',
}
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: must set Amount with Amount2',
)
})
it(`throws w/ must set Amount with EPrice`, function () {
withdraw.EPrice = '25'
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: must set Amount with EPrice',
)
})
it(`throws w/ LPTokenIn must be an IssuedCurrencyAmount`, function () {
withdraw.LPTokenIn = 1234
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount',
)
})
it(`throws w/ Amount must be an Amount`, function () {
withdraw.Amount = 1234
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: Amount must be an Amount',
)
})
it(`throws w/ Amount2 must be an Amount`, function () {
withdraw.Amount = '1000'
withdraw.Amount2 = 1234
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: Amount2 must be an Amount',
)
})
it(`throws w/ EPrice must be an Amount`, function () {
withdraw.Amount = '1000'
withdraw.EPrice = 1234
assert.throws(
() => validate(withdraw),
ValidationError,
'AMMWithdraw: EPrice must be an Amount',
)
})
})