Skip to content

Commit

Permalink
Adding more structs for list of compressed nft events. closes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
dougEfresh committed Mar 3, 2024
1 parent 541c307 commit e5c8de1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
53 changes: 46 additions & 7 deletions src/api/types/enhanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ impl ParseTransactionsRequest {
}
}

#[derive(Deserialize, Serialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Default)]
#[serde(rename_all = "camelCase")]
pub struct TransactionEvent {
pub nft: Option<NFTEvent>,
pub swap: Option<SwapEvent>,
pub compressed: Option<CompressedNftEvent>,
pub compressed: Option<Vec<CompressedNftEvent>>,
pub set_authority: Option<Vec<Authority>>,
}

#[derive(Deserialize, Serialize, Debug)]
Expand All @@ -51,13 +52,18 @@ pub struct CompressedNftEvent {
#[serde(rename = "type")]
pub transaction_type: TransactionType,
pub tree_id: String,
pub leaf_index: Option<Number>,
pub seq: Option<Number>,
pub asset_id: Option<String>,
pub instruction_index: Option<Number>,
pub inner_instruction_index: Option<Number>,
pub leaf_index: Option<i32>,
pub seq: Option<i32>,
pub asset_id: String,
pub instruction_index: Option<i32>,
pub inner_instruction_index: Option<i32>,
pub new_leaf_owner: Option<String>,
pub old_leaf_owner: Option<String>,
pub new_leaf_delegate: Option<String>,
pub old_leaf_delegate: Option<serde_json::Value>,
pub tree_delegate: Option<String>,
pub metadata: Option<Metadata>,
pub update_args: Option<serde_json::Value>,
}

#[derive(Deserialize, Serialize, Debug)]
Expand Down Expand Up @@ -198,3 +204,36 @@ pub struct InnerInstruction {
pub data: String,
pub program_id: String,
}

#[derive(Serialize, Deserialize, Debug)]

Check warning on line 208 in src/api/types/enhanced.rs

View check run for this annotation

Codecov / codecov/patch

src/api/types/enhanced.rs#L208

Added line #L208 was not covered by tests
pub struct Collection {
pub key: String,
pub verified: bool,
}

#[derive(Serialize, Deserialize, Debug)]

Check warning on line 214 in src/api/types/enhanced.rs

View check run for this annotation

Codecov / codecov/patch

src/api/types/enhanced.rs#L214

Added line #L214 was not covered by tests
#[serde(rename_all = "camelCase")]
pub struct Metadata {
pub name: String,
pub symbol: String,
pub uri: String,
pub seller_fee_basis_points: i32,
pub primary_sale_happened: bool,
#[serde(rename = "isMutable")]
pub mutable: bool,
pub edition_nonce: Option<i32>,
pub token_standard: Option<String>,
pub collection: Option<Collection>,
pub token_program_version: String,
pub creators: Option<Vec<serde_json::Value>>,
}

#[derive(Serialize, Deserialize, Debug)]

Check warning on line 231 in src/api/types/enhanced.rs

View check run for this annotation

Codecov / codecov/patch

src/api/types/enhanced.rs#L231

Added line #L231 was not covered by tests
#[serde(rename_all = "camelCase")]
pub struct Authority {
pub account: String,
pub from: String,
pub to: String,
pub instruction_index: i32,
pub inner_instruction_index: i32,
}
2 changes: 2 additions & 0 deletions src/api/types/webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ pub struct WebhookData {
pub webhook_type: WebhookType,
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_header: Option<String>,
#[serde(default)]
pub txn_status: TxnStatus,
#[serde(default)]
pub encoding: AccountWebhookEncoding,
}

Expand Down

0 comments on commit e5c8de1

Please sign in to comment.