Skip to content

Commit

Permalink
Add 'Preserve' compiler directive so that code, specifically those in… (
Browse files Browse the repository at this point in the history
#195)

* Add 'Preserve' compiler directive so that code, specifically those invoked via reflection by newtonsoft.json, is not stripped during builds

* Add more Preserve tags
  • Loading branch information
BellringerQuinn authored Nov 4, 2024
1 parent 19dc2c9 commit 36965ec
Show file tree
Hide file tree
Showing 67 changed files with 226 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[System.Serializable]
public class DelayedEncode : Transaction
{
Expand All @@ -9,6 +12,7 @@ public class DelayedEncode : Transaction
public string type = TypeIdentifier;
public string value;

[Preserve]
public DelayedEncode(string contractAddress, string value, DelayedEncodeData data)
{
this.to = contractAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
[JsonConverter(typeof(DelayedEncodeDataConverter))]
public class DelayedEncodeData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
Expand All @@ -10,6 +11,7 @@ public class Identity
public string sub;
public string email;

[Preserve]
public Identity(string type, string iss, string sub, string email)
{
this.type = type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataCloseSession
{
public string sessionId;

[Preserve]
public IntentDataCloseSession(string sessionId)
{
this.sessionId = sessionId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Newtonsoft.Json;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
public class IntentDataFederateAccount
{
public string answer;
Expand All @@ -10,6 +12,7 @@ public class IntentDataFederateAccount
public string verifier;
public string wallet;

[Preserve]
[JsonConstructor]
public IntentDataFederateAccount(string sessionId, string wallet, string identityType, string verifier, string answer)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System;
using Newtonsoft.Json;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
public class IntentDataFeeOptions
{
public string identifier;
public string network;
public Transaction[] transactions;
public string wallet;

[Preserve]
[JsonConstructor]
public IntentDataFeeOptions(string identifier, string network, Transaction[] transactions, string wallet)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataGetIdToken
{
public string sessionId;
public string wallet;
public string nonce;

[Preserve]
public IntentDataGetIdToken(string sessionId, string walletAddress, string nonce = null)
{
this.sessionId = sessionId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataGetSession
{
public string sessionId;
public string wallet;

[Preserve]
public IntentDataGetSession(string sessionId, string walletAddress)
{
this.sessionId = sessionId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
using System;
using Newtonsoft.Json;
using Sequence;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataGetTransactionReceipt
{
public string metaTxHash;
public string network;
public string wallet;

[Preserve]
[JsonConstructor]
public IntentDataGetTransactionReceipt(string metaTxHash, string network, string wallet)
{
this.metaTxHash = metaTxHash;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using Newtonsoft.Json;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
public class IntentDataInitiateAuth
{
public string identityType;
public string metadata;
public string sessionId;
public string verifier;

[Preserve]
[JsonConstructor]
public IntentDataInitiateAuth(string identityType, string metadata, string sessionId, string verifier)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using Newtonsoft.Json;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataListAccounts
{
public string wallet;

[Preserve]
public IntentDataListAccounts(string walletAddress)
{
this.wallet = walletAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataListSessions
{
public string wallet;

[Preserve]
public IntentDataListSessions(string walletAddress)
{
this.wallet = walletAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using Newtonsoft.Json;
using Sequence.Utils;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataOpenSession
{
Expand All @@ -13,6 +15,7 @@ public class IntentDataOpenSession
public string sessionId;
public string verifier;

[Preserve]
[JsonConstructor]
public IntentDataOpenSession(string answer, bool forceCreateAccount, string identityType, string sessionId, string verifier)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[System.Serializable]
public class IntentDataSendTransaction
{
Expand Down Expand Up @@ -37,6 +39,7 @@ public IntentDataSendTransaction(string walletAddress, Chain network, Transactio
}
}

[Preserve]
[JsonConstructor]
public IntentDataSendTransaction(string code, uint expires, uint issued, string network, JObject[] transactions, string transactionsFeeQuote, string wallet)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System;
using Newtonsoft.Json;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataSessionAuthProof
{
public string network;
public string nonce = null;
public string wallet;

[Preserve]
[JsonConstructor]
public IntentDataSessionAuthProof(string network, string wallet, string nonce)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Text;
using Sequence.Utils;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentDataSignMessage
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class IntentPayload
{
Expand All @@ -15,6 +17,7 @@ public class IntentPayload
public Signature[] signatures;
public string version;

[Preserve]
[JsonConstructor]
public IntentPayload(string version, string name, uint expiresAt, uint issuedAt, JObject data, Signature[] signatures)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[System.Serializable]
public class IsValidMessageSignatureArgs
{
Expand All @@ -8,6 +11,7 @@ public class IsValidMessageSignatureArgs
public string message;
public string signature;

[Preserve]
public IsValidMessageSignatureArgs(Chain chain, string walletAddress, string message, string signature)
{
this.chainId = chain.GetChainId();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[Serializable]
public class Payload
{
public string encryptedPayloadKey;
public string payloadCiphertext;
public string payloadSig;

[Preserve]
public Payload(string encryptedPayloadKey, string payloadCiphertext, string payloadSig)
{
this.encryptedPayloadKey = encryptedPayloadKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
using Newtonsoft.Json;
using Sequence.Contracts;
using Sequence.Transactions;
using UnityEngine.Scripting;
using StringExtensions = Sequence.Utils.StringExtensions;

namespace Sequence.EmbeddedWallet
{
[Preserve]
[System.Serializable]
public class RawTransaction : Transaction
{
Expand Down Expand Up @@ -63,6 +65,7 @@ public RawTransaction(CallContractFunction callContractFunction, string value =
this.data = callContractFunction.CallData;
}

[Preserve]
[JsonConstructor]
public RawTransaction(string data, string to, string type, string value)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Preserve]
public class RegisterSessionIntent
{
public IntentPayload intent;
public string friendlyName;

[Preserve]
public RegisterSessionIntent(string friendlyName, IntentPayload intent)
{
this.friendlyName = friendlyName;
Expand Down
Loading

0 comments on commit 36965ec

Please sign in to comment.