Skip to content
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

#576: Add support for AMMClawback #601

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8c0896e
generate definitions.json from xrpl.js script
Feb 9, 2025
f7ede3e
add amm clawback transaction and transaction flags
Feb 9, 2025
6208633
add ammclawback to signature utils
Feb 17, 2025
ad2caee
set up tests, almost full flow working
Feb 17, 2025
ccee59b
cleanup test
Feb 17, 2025
e526d46
remove extra print lines
Feb 17, 2025
c8aab1f
make enable rippling private again
Feb 17, 2025
b1f8c42
enable AMMClawback amendment, create two integration tests
Feb 19, 2025
3149b86
add one more integration test
Feb 19, 2025
ee8054c
add comment for unset flag
Feb 19, 2025
21b1e9d
add some comments to AmmClawback class
Feb 19, 2025
fcd0407
merge main into this branch
Feb 19, 2025
10b2b50
fix build by addressing TransactionFlags reference
Feb 26, 2025
850fa74
add Address import to AmmClawback class
Feb 26, 2025
b030ff5
fix all checkstyle issues, successful build
Feb 26, 2025
16dc361
address issues in unit test
Feb 26, 2025
ec0c5d2
address changes for currencies used
Feb 26, 2025
60396cd
add new empty method and add tests for AmmClawbackFlags
Feb 28, 2025
1c92ba8
change default for AmmClawbackFlags to empty instead of Unset
Feb 28, 2025
0513be4
add multi signature transaction helper test for signature utils
Feb 28, 2025
7d8f95d
update rippled version and fix checkstyle issues
Feb 28, 2025
6f41e95
fix amm clawback test class failing test
Feb 28, 2025
d699102
remove failing data driven test types
Mar 3, 2025
f06efc0
go back to version 2.3.0 rippled container
Mar 4, 2025
8984374
remove extra address import
Mar 10, 2025
3c03a3a
apply formatting for files changes
Mar 25, 2025
aaeba34
fix indenting and build
Mar 25, 2025
f67ba31
fix more formatting
Mar 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add new empty method and add tests for AmmClawbackFlags
Angel Gutierrez committed Feb 28, 2025
commit 60396cd916602d61c91c70e00bdd23f690ebad70
Original file line number Diff line number Diff line change
@@ -39,6 +39,18 @@ public class AmmClawbackFlags extends TransactionFlags {
private AmmClawbackFlags(long value) {
super(value);
}
private AmmClawbackFlags() {
}

/**
* Construct an empty instance of {@link AmmClawbackFlags}. Transactions with empty flags will
* not be serialized with a {@code Flags} field.
*
* @return An empty {@link AmmClawbackFlags}.
*/
public static AmmClawbackFlags empty() {
return new AmmClawbackFlags();
}

/**
* Whether the {@code tfClawTwoAssets} flag is set.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.xrpl.xrpl4j.model.flags;

import static org.assertj.core.api.Assertions.assertThat;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.json.JSONException;
import org.junit.jupiter.api.Test;

class AmmClawbackFlagsTest extends AbstractFlagsTest {

@Test
void testFlagWithValue() {
AmmClawbackFlags flags = AmmClawbackFlags.CLAW_TWO_ASSETS;
assertThat(flags.isEmpty()).isFalse();

assertThat(flags.tfClawTwoAssets()).isTrue();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.getValue()).isEqualTo(1L);
}

@Test
void testEmptyFlags() {
AmmClawbackFlags flags = AmmClawbackFlags.empty();
assertThat(flags.isEmpty()).isTrue();

assertThat(flags.tfClawTwoAssets()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.getValue()).isZero();
}

@Test
void testJson() throws JSONException, JsonProcessingException {
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(AmmClawbackFlags.CLAW_TWO_ASSETS);
String json = String.format("{\n" +
" \"flags\": %s\n" +
"}", AmmClawbackFlags.CLAW_TWO_ASSETS.getValue());

assertCanSerializeAndDeserialize(wrapper, json);
}
@Test
void testEmptyJson() throws JSONException, JsonProcessingException {
AmmClawbackFlags flags = AmmClawbackFlags.empty();
AbstractFlagsTest.TransactionFlagsWrapper wrapper = AbstractFlagsTest.TransactionFlagsWrapper.of(flags);
String json = "{\n" +
"}";

assertCanSerializeAndDeserialize(wrapper, json);
}
}