-
Notifications
You must be signed in to change notification settings - Fork 5
Add ServerWallet implementation and deprecate EngineWallet #153
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
145 changes: 145 additions & 0 deletions
145
Thirdweb/Thirdweb.Wallets/ServerWallet/ServerWallet.Types.cs
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,145 @@ | ||
using System.Numerics; | ||
using Newtonsoft.Json; | ||
|
||
namespace Thirdweb; | ||
|
||
/// <summary> | ||
/// Base class for execution options | ||
/// </summary> | ||
[JsonObject] | ||
public class ExecutionOptions | ||
{ | ||
[JsonProperty("chainId")] | ||
public BigInteger? ChainId { get; set; } = null; | ||
|
||
[JsonProperty("idempotencyKey")] | ||
public string IdempotencyKey { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Auto determine execution options | ||
/// </summary> | ||
[JsonObject] | ||
public class AutoExecutionOptions : ExecutionOptions | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } = "auto"; | ||
|
||
[JsonProperty("from")] | ||
public string From { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Externally Owned Account (EOA) execution options | ||
/// </summary> | ||
[JsonObject] | ||
public class EIP7702ExecutionOptions : ExecutionOptions | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } = "EIP7702"; | ||
|
||
[JsonProperty("from")] | ||
public string From { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Externally Owned Account (EOA) execution options | ||
/// </summary> | ||
[JsonObject] | ||
public class EOAExecutionOptions : ExecutionOptions | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } = "EOA"; | ||
|
||
[JsonProperty("from")] | ||
public string From { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// ERC-4337 execution options | ||
/// </summary> | ||
[JsonObject] | ||
public class ERC4337ExecutionOptions : ExecutionOptions | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } = "ERC4337"; | ||
|
||
[JsonProperty("signerAddress")] | ||
public string SignerAddress { get; set; } | ||
|
||
[JsonProperty("accountSalt")] | ||
public string AccountSalt { get; set; } | ||
|
||
[JsonProperty("smartAccountAddress")] | ||
public string SmartAccountAddress { get; set; } | ||
|
||
[JsonProperty("entrypointAddress")] | ||
public string EntrypointAddress { get; set; } | ||
|
||
[JsonProperty("entrypointVersion")] | ||
public string EntrypointVersion { get; set; } | ||
|
||
[JsonProperty("factoryAddress")] | ||
public string FactoryAddress { get; set; } | ||
|
||
public ERC4337ExecutionOptions(BigInteger chainId, string signerAddress) | ||
{ | ||
this.ChainId = chainId; | ||
this.SignerAddress = signerAddress; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Response wrapper for queued transactions | ||
/// </summary> | ||
[JsonObject] | ||
internal class QueuedTransactionResponse | ||
{ | ||
[JsonProperty("result")] | ||
public QueuedTransactionResult Result { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Result containing the transactions array | ||
/// </summary> | ||
[JsonObject] | ||
internal class QueuedTransactionResult | ||
{ | ||
[JsonProperty("transactions")] | ||
public QueuedTransaction[] Transactions { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Queued transaction response | ||
/// </summary> | ||
[JsonObject] | ||
internal class QueuedTransaction | ||
{ | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("batchIndex")] | ||
public long BatchIndex { get; set; } | ||
|
||
[JsonProperty("executionParams")] | ||
public ExecutionOptions ExecutionParams { get; set; } | ||
|
||
[JsonProperty("transactionParams")] | ||
public InnerTransaction[] TransactionParams { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Inner transaction data | ||
/// </summary> | ||
[JsonObject] | ||
internal class InnerTransaction | ||
{ | ||
[JsonProperty("to")] | ||
public string To { get; set; } | ||
|
||
[JsonProperty("data")] | ||
public string Data { get; set; } | ||
|
||
[JsonProperty("value")] | ||
public string Value { get; set; } | ||
} |
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.
Security: Remove hardcoded secret key.
The hardcoded secret key should not be committed to version control, even in example code. This poses a security risk and sets a bad precedent for developers.
Revert to using the environment variable:
📝 Committable suggestion
🧰 Tools
🪛 Gitleaks (8.27.2)
30-30: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🤖 Prompt for AI Agents