-
Notifications
You must be signed in to change notification settings - Fork 116
Es add credential create #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
576a59b
disable partial payment validation errors
pbjc 04218c6
add tip for debugging parse errors
pbjc 5a4f6ab
add backdoor to avoid nested model export
pbjc b922fac
do not validate models by default
pbjc a5e9f3f
add unused AccountSet fields
pbjc 54f1afe
ignore unknown args when parsing
pbjc f109d96
Add clawback transaction type
vlad-trmlabs 2b65eb2
feat: add AMM support (#422)
khancode 7122d50
Merge pull request #5 from trmlabs/vladduta-bring-amm-transactions
vlad-trmlabs 131e974
try smart union
vlad-trmlabs f5f4a19
try xrp currency first
vlad-trmlabs bb1987c
Update root repo
oswidan97 cb5de58
Update root repo
oswidan97 7561502
Merge pull request #6 from trmlabs/osw-fix-ripple-2
oswidan97 1f378d9
Update type
oswidan97 ab94eb4
Merge pull request #7 from trmlabs/osw-make-type-any
oswidan97 1cff1ac
Pulling set_fee tx updates
sepandar-sepehr d2308bc
Merge pull request #9 from trmlabs/sepandar/ENG-20937-set-fee-fields
sepandar-sepehr 45e987b
Add default value of NULL for optional fields
oswidan97 9e94893
Merge pull request #10 from trmlabs/osw-add-default-field-values
oswidan97 723b115
codeowners file
dmay-trm e63b084
updated owner
dmay-trm 6390264
Merge pull request #11 from trmlabs/codeowners-file
dmay-trm 354e381
Add new transaction
oswidan97 14b3561
Merge pull request #12 from trmlabs/osw-add-nft-token-metadata
oswidan97 6d0c941
update ripple submodule to support CredentialCreate tx
EssamTrmlabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Set the default code owner for everything in the repository | ||
* @trmlabs/ci-blockchain-data | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
235 changes: 222 additions & 13 deletions
235
tests/unit/core/binarycodec/fixtures/data/codec-fixtures.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from unittest import TestCase | ||
|
||
from xrpl.models.currencies import XRP, IssuedCurrency | ||
from xrpl.models.requests import AMMInfo | ||
|
||
_ASSET = XRP() | ||
_ASSET_2 = IssuedCurrency(currency="USD", issuer="rN6zcSynkRnf8zcgTVrRL8K7r4ovE7J4Zj") | ||
|
||
|
||
class TestAMMInfo(TestCase): | ||
def test_asset_asset2(self): | ||
request = AMMInfo( | ||
asset=_ASSET, | ||
asset2=_ASSET_2, | ||
) | ||
self.assertTrue(request.is_valid()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from unittest import TestCase | ||
|
||
from xrpl.models.amounts import IssuedCurrencyAmount | ||
from xrpl.models.currencies import XRP, IssuedCurrency | ||
from xrpl.models.exceptions import XRPLModelException | ||
from xrpl.models.transactions import AMMBid, AuthAccount | ||
|
||
_ACCOUNT = "r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ" | ||
_ASSET = XRP() | ||
_ASSET2 = IssuedCurrency(currency="ETH", issuer="rpGtkFRXhgVaBzC5XCR7gyE2AZN5SN3SEW") | ||
_AUTH_ACCOUNTS = [ | ||
AuthAccount( | ||
account="rNZdsTBP5tH1M6GHC6bTreHAp6ouP8iZSh", | ||
), | ||
AuthAccount( | ||
account="rfpFv97Dwu89FTyUwPjtpZBbuZxTqqgTmH", | ||
), | ||
AuthAccount( | ||
account="rzzYHPGb8Pa64oqxCzmuffm122bitq3Vb", | ||
), | ||
AuthAccount( | ||
account="rhwxHxaHok86fe4LykBom1jSJ3RYQJs1h4", | ||
), | ||
] | ||
_LPTOKEN_CURRENCY = "5475B6C930B7BDD81CDA8FBA5CED962B11218E5A" | ||
_LPTOKEN_ISSUER = "r3628pXjRqfw5zfwGfhSusjZTvE3BoxEBw" | ||
|
||
|
||
class TestAMMBid(TestCase): | ||
def test_tx_valid(self): | ||
tx = AMMBid( | ||
account=_ACCOUNT, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
bid_min=IssuedCurrencyAmount( | ||
currency=_LPTOKEN_CURRENCY, | ||
issuer=_LPTOKEN_ISSUER, | ||
value="25", | ||
), | ||
bid_max=IssuedCurrencyAmount( | ||
currency=_LPTOKEN_CURRENCY, | ||
issuer=_LPTOKEN_ISSUER, | ||
value="35", | ||
), | ||
auth_accounts=_AUTH_ACCOUNTS, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_auth_accounts_length_error(self): | ||
auth_accounts = _AUTH_ACCOUNTS.copy() | ||
auth_accounts.append( | ||
AuthAccount( | ||
account="r3X6noRsvaLapAKCG78zAtWcbhB3sggS1s", | ||
), | ||
) | ||
with self.assertRaises(XRPLModelException) as error: | ||
AMMBid( | ||
account=_ACCOUNT, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
auth_accounts=auth_accounts, | ||
) | ||
self.assertEqual( | ||
error.exception.args[0], | ||
"{'auth_accounts': 'Length must not be greater than 4'}", | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from sys import maxsize | ||
from unittest import TestCase | ||
|
||
from xrpl.models.amounts import IssuedCurrencyAmount | ||
from xrpl.models.exceptions import XRPLModelException | ||
from xrpl.models.transactions import AMMCreate | ||
|
||
_ACCOUNT = "r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ" | ||
_IOU_ISSUER = "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9" | ||
|
||
|
||
class TestAMMCreate(TestCase): | ||
def test_tx_is_valid(self): | ||
tx = AMMCreate( | ||
account=_ACCOUNT, | ||
amount="1000", | ||
amount2=IssuedCurrencyAmount( | ||
currency="USD", issuer=_IOU_ISSUER, value="1000" | ||
), | ||
trading_fee=12, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_trading_fee_too_high(self): | ||
with self.assertRaises(XRPLModelException) as error: | ||
AMMCreate( | ||
account=_ACCOUNT, | ||
amount="1000", | ||
amount2=IssuedCurrencyAmount( | ||
currency="USD", issuer=_IOU_ISSUER, value="1000" | ||
), | ||
trading_fee=maxsize, | ||
) | ||
self.assertEqual( | ||
error.exception.args[0], | ||
"{'trading_fee': 'Must be between 0 and 1000'}", | ||
) | ||
|
||
def test_trading_fee_negative_number(self): | ||
with self.assertRaises(XRPLModelException) as error: | ||
AMMCreate( | ||
account=_ACCOUNT, | ||
amount="1000", | ||
amount2=IssuedCurrencyAmount( | ||
currency="USD", issuer=_IOU_ISSUER, value="1000" | ||
), | ||
trading_fee=-1, | ||
) | ||
self.assertEqual( | ||
error.exception.args[0], | ||
"{'trading_fee': 'Must be between 0 and 1000'}", | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from unittest import TestCase | ||
|
||
from xrpl.models.currencies import XRP, IssuedCurrency | ||
from xrpl.models.transactions import AMMDelete | ||
|
||
|
||
class TestAMMDeposit(TestCase): | ||
def test_tx_valid(self): | ||
tx = AMMDelete( | ||
account="r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ", | ||
sequence=1337, | ||
asset=XRP(), | ||
asset2=IssuedCurrency( | ||
currency="ETH", issuer="rpGtkFRXhgVaBzC5XCR7gyE2AZN5SN3SEW" | ||
), | ||
) | ||
self.assertTrue(tx.is_valid()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
from unittest import TestCase | ||
|
||
from xrpl.models.amounts import IssuedCurrencyAmount | ||
from xrpl.models.currencies import XRP, IssuedCurrency | ||
from xrpl.models.exceptions import XRPLModelException | ||
from xrpl.models.transactions import AMMDeposit | ||
from xrpl.models.transactions.amm_deposit import AMMDepositFlag | ||
|
||
_ACCOUNT = "r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ" | ||
_ASSET = XRP() | ||
_ASSET2 = IssuedCurrency(currency="ETH", issuer="rpGtkFRXhgVaBzC5XCR7gyE2AZN5SN3SEW") | ||
_AMOUNT = "1000" | ||
_LPTOKEN_CURRENCY = "B3813FCAB4EE68B3D0D735D6849465A9113EE048" | ||
_LPTOKEN_ISSUER = "rH438jEAzTs5PYtV6CHZqpDpwCKQmPW9Cg" | ||
|
||
|
||
class TestAMMDeposit(TestCase): | ||
def test_tx_valid_xrpl_lptokenout(self): | ||
tx = AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
lp_token_out=IssuedCurrencyAmount( | ||
currency=_LPTOKEN_CURRENCY, | ||
issuer=_LPTOKEN_ISSUER, | ||
value=_AMOUNT, | ||
), | ||
flags=AMMDepositFlag.TF_LP_TOKEN, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_tx_valid_amount(self): | ||
tx = AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
amount=_AMOUNT, | ||
flags=AMMDepositFlag.TF_SINGLE_ASSET, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_tx_valid_amount_amount2(self): | ||
tx = AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
amount=_AMOUNT, | ||
amount2=IssuedCurrencyAmount( | ||
currency=_ASSET2.currency, issuer=_ASSET2.issuer, value="500" | ||
), | ||
flags=AMMDepositFlag.TF_TWO_ASSET, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_tx_valid_amount_lptokenout(self): | ||
tx = AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
amount=_AMOUNT, | ||
lp_token_out=IssuedCurrencyAmount( | ||
currency=_LPTOKEN_CURRENCY, | ||
issuer=_LPTOKEN_ISSUER, | ||
value="500", | ||
), | ||
flags=AMMDepositFlag.TF_ONE_ASSET_LP_TOKEN, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_tx_valid_amount_eprice(self): | ||
tx = AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
amount=_AMOUNT, | ||
e_price="25", | ||
flags=AMMDepositFlag.TF_LIMIT_LP_TOKEN, | ||
) | ||
self.assertTrue(tx.is_valid()) | ||
|
||
def test_undefined_amount_undefined_lptokenout_invalid_combo(self): | ||
with self.assertRaises(XRPLModelException) as error: | ||
AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
) | ||
self.assertEqual( | ||
error.exception.args[0], | ||
"{'AMMDeposit': 'Must set at least `lp_token_out` or `amount`'}", | ||
) | ||
|
||
def test_undefined_amount_defined_amount2_invalid_combo(self): | ||
with self.assertRaises(XRPLModelException) as error: | ||
AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
amount2=IssuedCurrencyAmount( | ||
currency=_ASSET2.currency, issuer=_ASSET2.issuer, value="500" | ||
), | ||
) | ||
self.assertEqual( | ||
error.exception.args[0], | ||
"{'AMMDeposit': 'Must set `amount` with `amount2`'}", | ||
) | ||
|
||
def test_undefined_amount_defined_eprice_invalid_combo(self): | ||
with self.assertRaises(XRPLModelException) as error: | ||
AMMDeposit( | ||
account=_ACCOUNT, | ||
sequence=1337, | ||
asset=_ASSET, | ||
asset2=_ASSET2, | ||
e_price="25", | ||
) | ||
self.assertEqual( | ||
error.exception.args[0], | ||
"{'AMMDeposit': 'Must set `amount` with `e_price`'}", | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not rewrite historical release notes; move AMM entry to Unreleased
Adding AMM support under 1.7.0 (dated 2022-10-12) misrepresents history. Put the AMM bullet under Unreleased (or the next version) and preserve the Ed25519 bullet unchanged.
Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents