| Crates.io | strike-actions |
| lib.rs | strike-actions |
| version | 0.1.0 |
| created_at | 2025-08-19 14:47:12.803415+00 |
| updated_at | 2025-08-19 14:47:12.803415+00 |
| description | A library for generating Strike Action metadata for blockchain interactions |
| homepage | |
| repository | https://github.com/yourusername/strike-actions |
| max_upload_size | |
| id | 1802065 |
| size | 40,117 |
A Rust library for generating Strike Action metadata for blockchain interactions, specifically designed for prediction markets and betting platforms.
Add this to your Cargo.toml:
[dependencies]
strike-actions = "0.1.0"
use strike_actions::{Market, MarketOption, StrikeActionMetadata};
// Create a market with options
let market = Market {
id: "market1".to_string(),
title: "Will Bitcoin reach $100k by 2024?".to_string(),
description: "A prediction market about Bitcoin price".to_string(),
image: "bitcoin-image.png".to_string(),
options: vec![
MarketOption {
option: "Yes".to_string(),
yes_token_amount: 1000,
no_token_amount: 500,
yes_bet_amount: 5000,
no_bet_amount: 2500,
}
],
};
// Convert to Strike Action metadata
let strike_metadata: StrikeActionMetadata = market.into();
// Customize with your canister ID
let strike_metadata = strike_metadata
.with_canister_id("your-canister-id".to_string())
.with_label("My Betting Platform".to_string());
// Serialize to JSON
let json = serde_json::to_string(&strike_metadata).unwrap();
println!("{}", json);
Represents a prediction market with multiple options.
The main metadata structure that contains all information needed for Strike Actions.
Individual actions that users can perform (betting Yes/No on options).
Wrapper around Candid's TypeInner for proper serialization.
Run the tests with:
cargo test
MIT License