-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ANCHOR-422] Custody integration and RPC API (#1067)
### What - Custody Server: - new service; - ServiceRunner updates; - `Fireblocks` integration; - `Fireblocks` transactions reconciliation job; - run configuration for IntelliJ IDEA. - Anchor Config: - custody and `Fireblocks` configuration; - RPC configuration. - Kotlin Reference Server: - feature toggle to switch between RPC API and `PATCH /transactions` endpoint; - feature toggle to enable/disable custody mode. - RPC API: - RPC endpoint; - method handlers; - trustline check job; - RPC API support for Observer. - End2End tests: - `AnchorPlatformApiRpcEnd2EndTest`; - `AnchorPlatformCustodyApiRpcEnd2EndTest`; - `AnchorPlatformCustodyEnd2EndTest`; - run configurations for IntelliJ IDEA. - Integration tests: - `AnchorPlatformCustodyIntegrationTest`; - `AnchorPlatformIntegrationTest`. - DB migration scripts: - `custody_transaction` table; - `transaction_pending_trust` table. - Unit tests.
- Loading branch information
Showing
334 changed files
with
35,741 additions
and
1,090 deletions.
There are no files selected for viewing
This file contains 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 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 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,10 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Run - Custody Server - no Docker" type="JetRunConfigurationType"> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.run_profiles.RunCustodyServer" /> | ||
<module name="java-stellar-anchor-sdk.service-runner.main" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains 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 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,34 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Test - End2End Test - no fullstack" type="JUnit" factoryName="JUnit"> | ||
<module name="java-stellar-anchor-sdk.integration-tests.test" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="org.stellar.anchor.platform.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="org.stellar.anchor.platform" /> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.AnchorPlatformApiRpcEnd2EndTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<envs> | ||
<env name="TEST_PROFILE_NAME" value="default-rpc" /> | ||
<env name="run_all_servers" value="false" /> | ||
<env name="run_docker" value="false" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
34 changes: 34 additions & 0 deletions
34
.run/Test - End2End with RPC Test - with fullstack.run.xml
This file contains 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,34 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Test - End2End Test - with fullstack" type="JUnit" factoryName="JUnit"> | ||
<module name="java-stellar-anchor-sdk.integration-tests.test" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="org.stellar.anchor.platform.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="org.stellar.anchor.platform" /> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.AnchorPlatformApiRpcEnd2EndTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<envs> | ||
<env name="TEST_PROFILE_NAME" value="default-rpc" /> | ||
<env name="run_all_servers" value="true" /> | ||
<env name="run_docker" value="true" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
38 changes: 38 additions & 0 deletions
38
.run/Test - Fireblocks End2End Test - no fullstack.run.xml
This file contains 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,38 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Test - Fireblocks End2End Test - no fullstack" type="JUnit" factoryName="JUnit"> | ||
<module name="java-stellar-anchor-sdk.integration-tests.test" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="org.stellar.anchor.platform.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="org.stellar.anchor.platform" /> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.AnchorPlatformCustodyEnd2EndTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<envs> | ||
<env name="TEST_PROFILE_NAME" value="default-custody" /> | ||
<env name="run_all_servers" value="false" /> | ||
<env name="run_docker" value="false" /> | ||
<env name="CUSTODY_TYPE" value="fireblocks" /> | ||
<env name="CUSTODY_FIREBLOCKS_VAULT_ACCOUNT_ID" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_API_KEY" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_SECRET_KEY" value="stub" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
38 changes: 38 additions & 0 deletions
38
.run/Test - Fireblocks End2End Test - with fullstack.run.xml
This file contains 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,38 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Test - Fireblocks End2End Test - with fullstack" type="JUnit" factoryName="JUnit"> | ||
<module name="java-stellar-anchor-sdk.integration-tests.test" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="org.stellar.anchor.platform.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="org.stellar.anchor.platform" /> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.AnchorPlatformCustodyEnd2EndTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<envs> | ||
<env name="TEST_PROFILE_NAME" value="default-custody" /> | ||
<env name="run_all_servers" value="true" /> | ||
<env name="run_docker" value="true" /> | ||
<env name="CUSTODY_TYPE" value="fireblocks" /> | ||
<env name="CUSTODY_FIREBLOCKS_VAULT_ACCOUNT_ID" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_API_KEY" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_SECRET_KEY" value="stub" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
38 changes: 38 additions & 0 deletions
38
.run/Test - Fireblocks End2End with RPC Test - no fullstack.run.xml
This file contains 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,38 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Test - Fireblocks End2End Test - no fullstack" type="JUnit" factoryName="JUnit"> | ||
<module name="java-stellar-anchor-sdk.integration-tests.test" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="org.stellar.anchor.platform.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="org.stellar.anchor.platform" /> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.AnchorPlatformCustodyApiRpcEnd2EndTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<envs> | ||
<env name="TEST_PROFILE_NAME" value="default-custody-rpc" /> | ||
<env name="run_all_servers" value="false" /> | ||
<env name="run_docker" value="false" /> | ||
<env name="CUSTODY_TYPE" value="fireblocks" /> | ||
<env name="CUSTODY_FIREBLOCKS_VAULT_ACCOUNT_ID" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_API_KEY" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_SECRET_KEY" value="stub" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
38 changes: 38 additions & 0 deletions
38
.run/Test - Fireblocks End2End with RPC Test - with fullstack.run.xml
This file contains 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,38 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Test - Fireblocks End2End Test - with fullstack" type="JUnit" factoryName="JUnit"> | ||
<module name="java-stellar-anchor-sdk.integration-tests.test" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="org.stellar.anchor.platform.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="org.stellar.anchor.platform" /> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.AnchorPlatformCustodyApiRpcEnd2EndTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<envs> | ||
<env name="TEST_PROFILE_NAME" value="default-custody-rpc" /> | ||
<env name="run_all_servers" value="true" /> | ||
<env name="run_docker" value="true" /> | ||
<env name="CUSTODY_TYPE" value="fireblocks" /> | ||
<env name="CUSTODY_FIREBLOCKS_VAULT_ACCOUNT_ID" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_API_KEY" value="stub" /> | ||
<env name="SECRET_CUSTODY_FIREBLOCKS_SECRET_KEY" value="stub" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains 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
20 changes: 20 additions & 0 deletions
20
api-schema/src/main/java/org/stellar/anchor/api/custody/CreateCustodyTransactionRequest.java
This file contains 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,20 @@ | ||
package org.stellar.anchor.api.custody; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class CreateCustodyTransactionRequest { | ||
|
||
private String id; | ||
private String memo; | ||
private String memoType; | ||
private String protocol; | ||
private String fromAccount; | ||
private String toAccount; | ||
private String amount; | ||
private String amountFee; | ||
private String asset; | ||
private String kind; | ||
} |
10 changes: 10 additions & 0 deletions
10
...schema/src/main/java/org/stellar/anchor/api/custody/CreateTransactionPaymentResponse.java
This file contains 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,10 @@ | ||
package org.stellar.anchor.api.custody; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class CreateTransactionPaymentResponse { | ||
private String id; | ||
} |
13 changes: 13 additions & 0 deletions
13
api-schema/src/main/java/org/stellar/anchor/api/custody/CreateTransactionRefundRequest.java
This file contains 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,13 @@ | ||
package org.stellar.anchor.api.custody; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class CreateTransactionRefundRequest { | ||
private String memo; | ||
private String memoType; | ||
private String amount; | ||
private String amountFee; | ||
} |
12 changes: 12 additions & 0 deletions
12
api-schema/src/main/java/org/stellar/anchor/api/custody/CustodyExceptionResponse.java
This file contains 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,12 @@ | ||
package org.stellar.anchor.api.custody; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class CustodyExceptionResponse { | ||
String rawErrorMessage; | ||
|
||
public CustodyExceptionResponse(String rawErrorMessage) { | ||
this.rawErrorMessage = rawErrorMessage; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
api-schema/src/main/java/org/stellar/anchor/api/custody/GenerateDepositAddressResponse.java
This file contains 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,13 @@ | ||
package org.stellar.anchor.api.custody; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class GenerateDepositAddressResponse { | ||
|
||
private String address; | ||
private String memo; | ||
private String memoType; | ||
} |
9 changes: 9 additions & 0 deletions
9
api-schema/src/main/java/org/stellar/anchor/api/custody/fireblocks/AmlScreeningResult.java
This file contains 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,9 @@ | ||
package org.stellar.anchor.api.custody.fireblocks; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class AmlScreeningResult { | ||
private String provider; | ||
private String payload; | ||
} |
11 changes: 11 additions & 0 deletions
11
api-schema/src/main/java/org/stellar/anchor/api/custody/fireblocks/AmountInfo.java
This file contains 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,11 @@ | ||
package org.stellar.anchor.api.custody.fireblocks; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class AmountInfo { | ||
private String amount; | ||
private String requestedAmount; | ||
private String netAmount; | ||
private String amountUSD; | ||
} |
Oops, something went wrong.