Skip to content

Commit 9a976d8

Browse files
committed
support string chainid
1 parent f1260ff commit 9a976d8

File tree

4 files changed

+53
-15
lines changed

4 files changed

+53
-15
lines changed

Cargo.lock

Lines changed: 42 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ twmq = { version = "0.1.0", path = "../twmq" }
1818
thirdweb-core = { version = "0.1.0", path = "../thirdweb-core" }
1919
uuid = { version = "1.17.0", features = ["v4"] }
2020
utoipa = "5.4.0"
21+
serde_with = "3.13.0"

core/src/execution_options/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use schemars::JsonSchema;
22
use serde::de::{Error, IntoDeserializer};
33
use serde::{Deserialize, Deserializer, Serialize};
4+
use serde_with::{DisplayFromStr, serde_as};
45
use std::collections::HashMap;
56

67
use crate::transaction::InnerTransaction;
@@ -9,9 +10,11 @@ pub mod auto;
910

1011
// Base execution options for all transactions
1112
// All specific execution options share this
12-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
13+
#[serde_as]
14+
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
1315
#[serde(rename_all = "camelCase")]
1416
pub struct BaseExecutionOptions {
17+
#[serde_as(as = "DisplayFromStr")]
1518
pub chain_id: u64,
1619
#[serde(default = "default_idempotency_key")]
1720
pub idempotency_key: String,
@@ -56,7 +59,7 @@ where
5659

5760
/// This is the exposed API for execution options
5861
/// Base and specific execution options are both flattened together
59-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
62+
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
6063
pub struct ExecutionOptions {
6164
#[serde(flatten)]
6265
pub base: BaseExecutionOptions,
@@ -72,7 +75,7 @@ pub struct WebhookOptions {
7275

7376
/// Incoming transaction request, parsed into InnerTransaction
7477
/// Exposed API will have varying `params` but will all parse into InnerTransaction before execution
75-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
78+
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
7679
#[serde(rename_all = "camelCase")]
7780
pub struct SendTransactionRequest {
7881
pub execution_options: ExecutionOptions,
@@ -82,7 +85,7 @@ pub struct SendTransactionRequest {
8285

8386
/// # QueuedTransaction
8487
/// Response for any request that queues one or more transactions
85-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
88+
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
8689
#[serde(rename_all = "camelCase")]
8790
pub struct QueuedTransaction {
8891
/// The idempotency key this transaction was queued with
@@ -106,7 +109,7 @@ pub struct QueuedTransaction {
106109
pub transaction_params: Vec<InnerTransaction>,
107110
}
108111

109-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
112+
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
110113
pub struct QueuedTransactionsResponse {
111114
pub transactions: Vec<QueuedTransaction>,
112115
}

server/src/http/routes/contract_write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub struct ContractWrite {
4444
}
4545

4646
/// Request to execute write transactions to smart contracts
47-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
47+
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
4848
#[serde(rename_all = "camelCase")]
4949
pub struct WriteContractRequest {
5050
/// Execution configuration including chain, account, and transaction options
@@ -95,7 +95,7 @@ impl ContractWrite {
9595
)
9696
)]
9797
/// Write Contract
98-
///
98+
///
9999
/// Call a contract function with a transaction
100100
pub async fn write_contract(
101101
State(state): State<EngineServerState>,

0 commit comments

Comments
 (0)