Skip to content

Commit

Permalink
use ContractInterface type for contract_abi
Browse files Browse the repository at this point in the history
  • Loading branch information
MicaiahReid committed Aug 20, 2023
1 parent ef45ea7 commit 8576866
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,45 @@
"position": {
"index": 1
},
"contract_abi": "some abi data",
"contract_abi": {
"clarity_version": "Clarity2",
"epoch": "Epoch24",
"functions": [
{
"access": "private",
"args": [{ "name": "tid", "type": "uint128" }],
"name": "airdrop",
"outputs": { "type": "bool" }
}
],
"fungible_tokens": [{ "name": "MEME" }],
"maps": [
{
"key": {
"tuple": [
{
"name": "name",
"type": { "buffer": { "length": 48 } }
},
{
"name": "namespace",
"type": { "buffer": { "length": 20 } }
}
]
},
"name": "map_claimed_bns_note",
"value": "bool"
}
],
"non_fungible_tokens": [],
"variables": [
{
"access": "constant",
"name": "AIRDROP_COUNT_PER_MEMBER",
"type": "uint128"
}
]
},
"proof": null,
"raw_tx": "0x808000000004003e44ad50f99edc5e6cc5543b636284186894a008000000000000002100000000000b71b00000a84691e27fd2d46475230707a657ef7ddf6de7a4b06a1ac2049384c6474e73f85ee4ce205e0904160adaa160498df02db1782f898b5905db4d249b7025f6604c030100000000060218666169722d616d6172616e74682d7268696e6f6365726f73000005103b3b2068656c6c6f2d776f726c6420636f6e74726163740a0a28646566696e652d636f6e7374616e742073656e6465722027535a324a365a593438475631455a35563256355242394d5036365357383650594b4b51394836445052290a28646566696e652d636f6e7374616e7420726563697069656e742027534d324a365a593438475631455a35563256355242394d5036365357383650594b4b51565838583047290a0a28646566696e652d66756e6769626c652d746f6b656e206e6f76656c2d746f6b656e2d3139290a28626567696e202866742d6d696e743f206e6f76656c2d746f6b656e2d3139207531322073656e64657229290a28626567696e202866742d7472616e736665723f206e6f76656c2d746f6b656e2d31392075322073656e64657220726563697069656e7429290a0a28646566696e652d6e6f6e2d66756e6769626c652d746f6b656e2068656c6c6f2d6e66742075696e74290a28626567696e20286e66742d6d696e743f2068656c6c6f2d6e66742075312073656e64657229290a28626567696e20286e66742d6d696e743f2068656c6c6f2d6e66742075322073656e64657229290a28626567696e20286e66742d7472616e736665723f2068656c6c6f2d6e66742075312073656e64657220726563697069656e7429290a0a28646566696e652d7075626c69632028746573742d656d69742d6576656e74290a2020202028626567696e0a2020202020202020287072696e7420224576656e74212048656c6c6f20776f726c6422290a2020202020202020286f6b2075312929290a28626567696e2028746573742d656d69742d6576656e7429290a0a28646566696e652d7075626c69632028746573742d6576656e742d7479706573290a2020202028626567696e0a202020202020202028756e777261702d70616e6963202866742d6d696e743f206e6f76656c2d746f6b656e2d313920753320726563697069656e7429290a202020202020202028756e777261702d70616e696320286e66742d6d696e743f2068656c6c6f2d6e667420753220726563697069656e7429290a202020202020202028756e777261702d70616e696320287374782d7472616e736665723f207536302074782d73656e6465722027535a324a365a593438475631455a35563256355242394d5036365357383650594b4b5139483644505229290a202020202020202028756e777261702d70616e696320287374782d6275726e3f207532302074782d73656e64657229290a2020202020202020286f6b2075312929290a0a28646566696e652d6d61702073746f7265207b6b65793a202862756666203332297d207b76616c75653a202862756666203332297d290a28646566696e652d7075626c696320286765742d76616c756520286b65792028627566662033322929290a2020202028626567696e0a2020202020202020286d6174636820286d61702d6765743f2073746f7265207b6b65793a206b65797d290a202020202020202020202020656e74727920286f6b20286765742076616c756520656e74727929290a202020202020202020202020286572722030292929290a28646566696e652d7075626c696320287365742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a2020202028626567696e0a2020202020202020286d61702d7365742073746f7265207b6b65793a206b65797d207b76616c75653a2076616c75657d290a2020202020202020286f6b207531292929",
"receipt": {
Expand Down
5 changes: 3 additions & 2 deletions components/chainhook-sdk/src/indexer/stacks/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod blocks_pool;

pub use blocks_pool::StacksBlockPool;
use stacks_rpc_client::clarity::vm::analysis::contract_interface_builder::ContractInterface;

use crate::chainhooks::stacks::try_decode_clarity_value;
use crate::indexer::AssetClassCache;
Expand Down Expand Up @@ -76,7 +77,7 @@ pub struct NewTransaction {
pub raw_result: String,
pub raw_tx: String,
pub execution_cost: Option<StacksTransactionExecutionCost>,
pub contract_abi: Option<JsonValue>,
pub contract_abi: Option<ContractInterface>,
}

#[derive(Deserialize, Debug)]
Expand All @@ -90,7 +91,7 @@ pub struct NewMicroblockTransaction {
pub microblock_sequence: usize,
pub microblock_hash: String,
pub microblock_parent_hash: String,
pub contract_abi: Option<JsonValue>,
pub contract_abi: Option<ContractInterface>,
}

#[derive(Debug, Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions components/chainhook-types-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ serde_derive = "1"
strum = { version = "0.23.0", features = ["derive"] }
schemars = { version = "0.8.10", git = "https://github.com/hirosystems/schemars.git", branch = "feat-chainhook-fixes" }
hex = "0.4.3"
clarity-vm = "2.1.1"
4 changes: 2 additions & 2 deletions components/chainhook-types-rs/src/rosetta.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::bitcoin::{TxIn, TxOut};
use crate::events::*;
use clarity::vm::analysis::contract_interface_builder::ContractInterface;
use schemars::JsonSchema;
use serde_json::Value;
use std::cmp::Ordering;
use std::collections::HashSet;
use std::fmt::Display;
Expand Down Expand Up @@ -211,7 +211,7 @@ pub struct StacksTransactionMetadata {
pub position: StacksTransactionPosition,
pub proof: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub contract_abi: Option<Value>,
pub contract_abi: Option<ContractInterface>,
}

/// TODO
Expand Down

0 comments on commit 8576866

Please sign in to comment.