Skip to content
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

Adding more structs for list of compressed nft events. closes #20 #23

Merged
merged 4 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}
}

#[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 @@
#[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 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