1#![allow(unused_imports, dead_code)]
2pub mod example;
3pub mod entry;
4
5use crate::entry::with_entry_decoder;
6use crate::example::example_contract_main;
7use extism_pdk::*;
8use redgold_schema::proto_serde::ProtoSerde;
9use redgold_schema::structs::{ExecutionInput, ExecutionResult};
10use redgold_schema::transaction::amount_data;
11use redgold_schema::util::lang_util::SameResult;
12use redgold_schema::RgResult;
13use serde::Serialize;
14
15const VOWELS: &[char] = &['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U'];
16
17#[derive(Serialize)]
18struct TestOutput {
19 pub count: i32,
20 pub config: String,
21 pub a: String,
22}
23pub fn proto_example_inner(input: Vec<u8>) -> RgResult<ExecutionResult> {
46 let _input = ExecutionInput::proto_deserialize(input)?;
47 let mut res = ExecutionResult::default();
48 res.valid = true;
49 res.data = amount_data(1);
50 Ok(res)
51}
52
53#[plugin_fn]
54pub fn proto_example(input: Vec<u8>) -> FnResult<Vec<u8>> {
55 let res = proto_example_inner(input)
56 .map_err(|e| ExecutionResult::from_error(e))
57 .combine();
58 Ok(res.proto_serialize())
59}
60
61
62#[plugin_fn]
63pub fn proto_example2(input: Vec<u8>) -> FnResult<Vec<u8>> {
64 let res = proto_example_inner(input)
65 .map_err(|e| ExecutionResult::from_error(e))
66 .combine();
67 Ok(res.proto_serialize())
68}
69
70
71#[plugin_fn]
72pub fn entrypoint(input: Vec<u8>) -> FnResult<Vec<u8>> {
73 with_entry_decoder(input, example_contract_main)
74}
75
76#[plugin_fn]
77pub fn entrypoint2(input: Vec<u8>) -> FnResult<Vec<u8>> {
78 with_entry_decoder(input, example_contract_main)
79}
80
81#[plugin_fn]
82pub fn entry(input: Vec<u8>) -> FnResult<Vec<u8>> {
83 with_entry_decoder(input, example_contract_main)
84}
85
86#[plugin_fn]
87pub fn entrypoint3(_input: Vec<u8>) -> FnResult<Vec<u8>> {
88 Ok(vec![])
89}
90
91
92#[test]
93pub fn debug() {
94 ()
95}