Skip to content

Commit 253dd80

Browse files
committed
Merge branch 'main' into feat/snafu
2 parents 11ddb84 + 3388cc7 commit 253dd80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3473
-1060
lines changed

api/oas_generator/rust_oas_generator/templates/models/model.rs.j2

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ pub struct {{ schema.rust_struct_name }} {
9494
{% if property.description %}
9595
{{ property.description | rust_doc_comment(4) }}
9696
{% endif %}
97+
{% set is_account_related = schema.name in ['Account', 'AccountParticipation', 'AssetHolding', 'ApplicationLocalState', 'Application', 'Asset', 'AssetParams', 'ApplicationParams'] %}
98+
{% if schema.implements_algokit_msgpack and not is_account_related %}
9799
{% if property.is_base64_encoded %}
98100
{% if property.required %}
99-
#[serde_as(as = "serde_with::base64::Base64")]
101+
#[serde_as(as = "Bytes")]
100102
{% else %}
101-
#[serde_as(as = "Option<serde_with::base64::Base64>")]
103+
#[serde_as(as = "Option<Bytes>")]
102104
{% endif %}
103105
{% elif property.items and property.items.is_base64_encoded %}
104106
{% if property.required %}
@@ -107,6 +109,21 @@ pub struct {{ schema.rust_struct_name }} {
107109
#[serde_as(as = "Option<Vec<Bytes>>")]
108110
{% endif %}
109111
{% endif %}
112+
{% else %}
113+
{% if property.is_base64_encoded %}
114+
{% if property.required %}
115+
#[serde_as(as = "serde_with::base64::Base64")]
116+
{% else %}
117+
#[serde_as(as = "Option<serde_with::base64::Base64>")]
118+
{% endif %}
119+
{% elif property.items and property.items.is_base64_encoded %}
120+
{% if property.required %}
121+
#[serde_as(as = "Vec<serde_with::base64::Base64>")]
122+
{% else %}
123+
#[serde_as(as = "Option<Vec<serde_with::base64::Base64>>")]
124+
{% endif %}
125+
{% endif %}
126+
{% endif %}
110127
#[serde(rename = "{{ property.name }}"{% if not property.required %}, skip_serializing_if = "Option::is_none"{% endif %})]
111128
{% if property.is_signed_transaction %}
112129
pub {{ property.rust_field_name }}: {% if property.required %}{% if property.rust_type.startswith('Vec<') %}Vec<AlgokitSignedTransaction>{% else %}AlgokitSignedTransaction{% endif %}{% else %}Option<{% if property.rust_type.startswith('Vec<') %}Vec<AlgokitSignedTransaction>{% else %}AlgokitSignedTransaction{% endif %}>{% endif %},
@@ -225,4 +242,3 @@ impl {{ schema.rust_struct_name }} {
225242
{% endif %}
226243
}
227244
{% endif %}
228-

crates/algod_client/src/models/app_call_logs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use serde_with::{Bytes, serde_as};
1717
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
1818
pub struct AppCallLogs {
1919
/// An array of logs
20-
#[serde_as(as = "Vec<Bytes>")]
20+
#[serde_as(as = "Vec<serde_with::base64::Base64>")]
2121
#[serde(rename = "logs")]
2222
pub logs: Vec<Vec<u8>>,
2323
/// The application from which the logs were generated

crates/algod_client/src/models/application_state_operation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct ApplicationStateOperation {
2626
#[serde(rename = "app-state-type")]
2727
pub app_state_type: String,
2828
/// The key (name) of the global/local/box state.
29-
#[serde_as(as = "serde_with::base64::Base64")]
29+
#[serde_as(as = "Bytes")]
3030
#[serde(rename = "key")]
3131
pub key: Vec<u8>,
3232
#[serde(rename = "new-value", skip_serializing_if = "Option::is_none")]

crates/algod_client/src/models/avm_key_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::models::AvmValue;
1919
#[serde_as]
2020
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
2121
pub struct AvmKeyValue {
22-
#[serde_as(as = "serde_with::base64::Base64")]
22+
#[serde_as(as = "Bytes")]
2323
#[serde(rename = "key")]
2424
pub key: Vec<u8>,
2525
#[serde(rename = "value")]

crates/algod_client/src/models/box_reference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct BoxReference {
2121
#[serde(rename = "app")]
2222
pub app: u64,
2323
/// Base64 encoded box name
24-
#[serde_as(as = "serde_with::base64::Base64")]
24+
#[serde_as(as = "Bytes")]
2525
#[serde(rename = "name")]
2626
pub name: Vec<u8>,
2727
}

crates/algod_client/src/models/dryrun_txn_result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub struct DryrunTxnResult {
4141
pub global_delta: Option<StateDelta>,
4242
#[serde(rename = "local-deltas", skip_serializing_if = "Option::is_none")]
4343
pub local_deltas: Option<Vec<AccountStateDelta>>,
44-
#[serde_as(as = "Option<Vec<Bytes>>")]
44+
#[serde_as(as = "Option<Vec<serde_with::base64::Base64>>")]
4545
#[serde(rename = "logs", skip_serializing_if = "Option::is_none")]
4646
pub logs: Option<Vec<Vec<u8>>>,
4747
/// Budget added during execution of app call transaction.

crates/algod_client/src/models/simulation_transaction_exec_trace.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct SimulationTransactionExecTrace {
2626
)]
2727
pub approval_program_trace: Option<Vec<SimulationOpcodeTraceUnit>>,
2828
/// SHA512_256 hash digest of the approval program executed in transaction.
29-
#[serde_as(as = "Option<serde_with::base64::Base64>")]
29+
#[serde_as(as = "Option<Bytes>")]
3030
#[serde(
3131
rename = "approval-program-hash",
3232
skip_serializing_if = "Option::is_none"
@@ -39,7 +39,7 @@ pub struct SimulationTransactionExecTrace {
3939
)]
4040
pub clear_state_program_trace: Option<Vec<SimulationOpcodeTraceUnit>>,
4141
/// SHA512_256 hash digest of the clear state program executed in transaction.
42-
#[serde_as(as = "Option<serde_with::base64::Base64>")]
42+
#[serde_as(as = "Option<Bytes>")]
4343
#[serde(
4444
rename = "clear-state-program-hash",
4545
skip_serializing_if = "Option::is_none"
@@ -61,7 +61,7 @@ pub struct SimulationTransactionExecTrace {
6161
#[serde(rename = "logic-sig-trace", skip_serializing_if = "Option::is_none")]
6262
pub logic_sig_trace: Option<Vec<SimulationOpcodeTraceUnit>>,
6363
/// SHA512_256 hash digest of the logic sig executed in transaction.
64-
#[serde_as(as = "Option<serde_with::base64::Base64>")]
64+
#[serde_as(as = "Option<Bytes>")]
6565
#[serde(rename = "logic-sig-hash", skip_serializing_if = "Option::is_none")]
6666
pub logic_sig_hash: Option<Vec<u8>>,
6767
/// An array of SimulationTransactionExecTrace representing the execution trace of any inner transactions executed.

crates/algod_client/src/models/teal_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct TealValue {
2121
#[serde(rename = "type")]
2222
pub r#type: u64,
2323
/// \[tb\] bytes value.
24-
#[serde_as(as = "serde_with::base64::Base64")]
24+
#[serde_as(as = "Bytes")]
2525
#[serde(rename = "bytes")]
2626
pub bytes: Vec<u8>,
2727
/// \[ui\] uint value.

crates/algokit_transact/src/address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::str::FromStr;
2121
/// and provides methods for encoding to and decoding from the standard Algorand base32 string format.
2222
/// The checksum is automatically calculated and validated as part of parsing and formatting.
2323
#[serde_as]
24-
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
24+
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq)]
2525
#[serde(transparent)]
2626
pub struct Address(#[serde_as(as = "Bytes")] pub Byte32);
2727

crates/algokit_transact/src/constants.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,20 @@ pub const MAX_TX_GROUP_SIZE: usize = 16;
1111
pub const MULTISIG_DOMAIN_SEPARATOR: &str = "MultisigAddr";
1212
pub const EMPTY_SIGNATURE: [u8; ALGORAND_SIGNATURE_BYTE_LENGTH] =
1313
[0; ALGORAND_SIGNATURE_BYTE_LENGTH];
14+
15+
// Application program size constraints
16+
pub const MAX_EXTRA_PROGRAM_PAGES: u64 = 3;
17+
pub const PROGRAM_PAGE_SIZE: usize = 2048; // In bytes
18+
19+
// Application reference limits
20+
pub const MAX_APP_ARGS: usize = 16;
21+
pub const MAX_ARGS_SIZE: usize = 2048; // Maximum size in bytes of all args combined
22+
pub const MAX_OVERALL_REFERENCES: usize = 8;
23+
pub const MAX_ACCOUNT_REFERENCES: usize = 4;
24+
pub const MAX_APP_REFERENCES: usize = 8;
25+
pub const MAX_ASSET_REFERENCES: usize = 8;
26+
pub const MAX_BOX_REFERENCES: usize = 8;
27+
28+
// Application state schema limits
29+
pub const MAX_GLOBAL_STATE_KEYS: u64 = 64;
30+
pub const MAX_LOCAL_STATE_KEYS: u64 = 16;

0 commit comments

Comments
 (0)