-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
5,906 additions
and
135 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,17 @@ | ||
./modify_sh/modify_kt_file.sh | ||
./modify_sh/modify_token.sh | ||
./modify_sh/modify_deposit_msg1.sh | ||
./modify_sh/modify_deposit_msg_response.sh | ||
./modify_sh/modify_sign_first_request_payload.sh | ||
./modify_sh/modify_sign_first_response_payload.sh | ||
./modify_sh/modify_partial_signature_request_payload.sh | ||
./modify_sh/modify_partial_signature_response_payload.sh | ||
./modify_sh/modify_transfer_sender_request_payload.sh | ||
./modify_sh/modify_transfer_update_msg_request_payload.sh | ||
./modify_sh/modify_get_msg_addr_response_payload.sh | ||
./modify_sh/modify_key_update_response_payload.sh | ||
./modify_sh/modify_statechain_info.sh | ||
./modify_sh/modify_statechainInfo_response_payload.sh | ||
./modify_sh/modify_transfer_receiver_request_payload.sh | ||
./modify_sh/modify_transfer_receiver_response_payload.sh | ||
./modify_sh/modify_transfer_receiver_get_response_payload.sh |
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,39 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class DepositMsg1\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `authKey`:/ { | ||
print "\t@SerialName(\"auth_key\")" | ||
} | ||
in_data_class && /var `tokenId`:/ { | ||
print "\t@SerialName(\"token_id\")" | ||
} | ||
in_data_class && /var `signedTokenId`:/ { | ||
print "\t@SerialName(\"signed_token_id\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to DepositMsg1 successfully." |
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,36 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class DepositMsg1Response\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `serverPubkey`:/ { | ||
print "\t@SerialName(\"server_pubkey\")" | ||
} | ||
in_data_class && /var `statechainId`:/ { | ||
print "\t@SerialName(\"statechain_id\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to DepositMsg1Response successfully." |
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,33 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class GetMsgAddrResponsePayload\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `listEncTransferMsg`:/ { | ||
print "\t@SerialName(\"list_enc_transfer_msg\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to GetMsgAddrResponsePayload successfully." |
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,33 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class KeyUpdateResponsePayload\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `statechainId`:/ { | ||
print "\t@SerialName(\"statechain_id\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to KeyUpdateResponsePayload successfully." |
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,83 @@ | ||
#!/bin/bash | ||
|
||
# Directory where the files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (e.g., all Kotlin files) | ||
FILE_PATTERN="*.kt" | ||
|
||
# The text to find for adding @Serializable | ||
FIND_TEXT_SERVER_CONFIG="data class ServerConfig(" | ||
FIND_TEXT_WALLET="data class Wallet(" | ||
FIND_TEXT_TOKEN="data class Token(" | ||
FIND_TEXT_ACTIVITY="data class Activity(" | ||
FIND_TEXT_COIN="data class Coin(" | ||
FIND_TEXT_SETTINGS="data class Settings(" | ||
FIND_TEXT_DEPOSIT_MSG1="data class DepositMsg1(" | ||
FIND_TEXT_DEPOSIT_MSG1_RESPONSE="data class DepositMsg1Response(" | ||
FIND_TEXT_DEPOSIT_INIT_RESULT="data class DepositInitResult(" | ||
FIND_TEXT_AGGREGATED_PUBLIC_KEY="data class AggregatedPublicKey(" | ||
FIND_TEXT_SIGN_FIRST_REQUEST_PAYLOAD="data class SignFirstRequestPayload(" | ||
FIND_TEXT_SIGN_FIRST_RESPONSE_PAYLOAD="data class SignFirstResponsePayload(" | ||
FIND_TEXT_PARTIAL_SIGNATURE_REQUEST_PAYLOAD="data class PartialSignatureRequestPayload(" | ||
FIND_TEXT_PARTIAL_SIGNATURE_RESPONSE_PAYLOAD="data class PartialSignatureResponsePayload(" | ||
FIND_TEXT_BACKUP_TX="data class BackupTx(" | ||
FIND_TEXT_TRANSFER_SENDER_REQUEST_PAYLOAD="data class TransferSenderRequestPayload(" | ||
FIND_TEXT_TRANSFER_SENDER_RESPONSE_PAYLOAD="data class TransferSenderResponsePayload(" | ||
FIND_TEXT_TRANSFER_UPDATE_MSG_REQUEST_PAYLOAD="data class TransferUpdateMsgRequestPayload(" | ||
FIND_TEXT_TRANSFER_GET_MSG_ADDR_RESPONSE_PAYLOAD="data class GetMsgAddrResponsePayload(" | ||
FIND_TEXT_TRANSFER_KEY_UPDATE_RESPONSE_PAYLOAD="data class KeyUpdateResponsePayload(" | ||
FIND_TEXT_TRANSFER_STATECHAIN_INFO="data class StatechainInfo(" | ||
FIND_TEXT_TRANSFER_STATECHAIN_INFO_RESPONSE_PAYLOAD="data class StatechainInfoResponsePayload(" | ||
FIND_TEXT_TRANSFER_RECEIVER_REQUEST_PAYLOAD="data class TransferReceiverRequestPayload(" | ||
FIND_TEXT_TRANSFER_RECEIVER_RESPONSE_PAYLOAD="data class TransferReceiverResponsePayload(" | ||
FIND_TEXT_TRANSFER_GET_RECEIVER_RESPONSE_PAYLOAD="data class TransferReceiverGetResponsePayload(" | ||
|
||
# The text to add @Serializable | ||
ADD_TEXT="@Serializable" | ||
|
||
# Text to find for modifying imports | ||
IMPORT_FIND_TEXT="import com.sun.jna.ptr.*" | ||
|
||
# New import text to add | ||
IMPORT_ADD_SERIALIZABLE="import kotlinx.serialization.Serializable" | ||
IMPORT_ADD_SERIALNAME="import kotlinx.serialization.SerialName" | ||
|
||
# Import text to remove. This should be disabled when the folder struct is fixed | ||
PACKAGE_REMOVE_TEXT="package com.mercurylayer" | ||
|
||
# Using find to locate Kotlin files and sed to modify them | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec sed -i \ | ||
-e "/$FIND_TEXT_SERVER_CONFIG/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_WALLET/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TOKEN/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_ACTIVITY/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_COIN/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_SETTINGS/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_DEPOSIT_MSG1/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_DEPOSIT_MSG1_RESPONSE/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_DEPOSIT_INIT_RESULT/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_AGGREGATED_PUBLIC_KEY/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_SIGN_FIRST_REQUEST_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_SIGN_FIRST_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_PARTIAL_SIGNATURE_REQUEST_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_PARTIAL_SIGNATURE_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_BACKUP_TX/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_SENDER_REQUEST_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_SENDER_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_UPDATE_MSG_REQUEST_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_GET_MSG_ADDR_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_KEY_UPDATE_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_STATECHAIN_INFO/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_STATECHAIN_INFO_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_RECEIVER_REQUEST_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_RECEIVER_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$FIND_TEXT_TRANSFER_GET_RECEIVER_RESPONSE_PAYLOAD/i $ADD_TEXT" \ | ||
-e "/$IMPORT_FIND_TEXT$/ { | ||
n; | ||
/$IMPORT_ADD_SERIALIZABLE/!i $IMPORT_ADD_SERIALIZABLE | ||
/$IMPORT_ADD_SERIALNAME/!i $IMPORT_ADD_SERIALNAME | ||
}" \ | ||
-e "/$PACKAGE_REMOVE_TEXT/d" {} + | ||
|
||
echo "@Serializable annotations added successfully." |
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,42 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class PartialSignatureRequestPayload\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `statechainId`:/ { | ||
print "\t@SerialName(\"statechain_id\")" | ||
} | ||
in_data_class && /var `negateSeckey`:/ { | ||
print "\t@SerialName(\"negate_seckey\")" | ||
} | ||
in_data_class && /var `signedStatechainId`:/ { | ||
print "\t@SerialName(\"signed_statechain_id\")" | ||
} | ||
in_data_class && /var `serverPubNonce`:/ { | ||
print "\t@SerialName(\"server_pub_nonce\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to PartialSignatureRequestPayload successfully." |
33 changes: 33 additions & 0 deletions
33
lib/modify_sh/modify_partial_signature_response_payload.sh
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,33 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class PartialSignatureResponsePayload\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `partialSig`:/ { | ||
print "\t@SerialName(\"partial_sig\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to PartialSignatureResponsePayload successfully." |
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,36 @@ | ||
#!/bin/bash | ||
|
||
# Directory where Kotlin files are located | ||
SEARCH_DIR="out-kotlin/com/mercurylayer" | ||
|
||
# File pattern to search for (assuming all Kotlin files end with .kt) | ||
FILE_PATTERN="*.kt" | ||
|
||
# awk script to add @SerialName within data class Token | ||
add_serial_name() { | ||
local file_path="$1" # Path to the file being processed | ||
|
||
awk ' | ||
BEGIN { in_data_class = 0 } | ||
/data class SignFirstRequestPayload\(/ { in_data_class = 1 } | ||
/^}/ { if (in_data_class) in_data_class = 0 } | ||
in_data_class && /var `statechainId`:/ { | ||
print "\t@SerialName(\"statechain_id\")" | ||
} | ||
in_data_class && /var `signedStatechainId`:/ { | ||
print "\t@SerialName(\"signed_statechain_id\")" | ||
} | ||
{ print } | ||
' "$file_path" > tmp && mv tmp "$file_path" | ||
} | ||
|
||
# Export the function so it's available to the subshell spawned by find | ||
export -f add_serial_name | ||
|
||
# Use find to locate Kotlin files and process them with the add_serial_name function | ||
find "$SEARCH_DIR" -type f -name "$FILE_PATTERN" -exec bash -c 'add_serial_name "$0"' {} \; | ||
|
||
echo "@SerialName annotations added to SignFirstRequestPayload successfully." |
Oops, something went wrong.