use crate::{Pack, ToKey, ToSchema, Unpack};
use async_graphql::{InputObject, SimpleObject};
use serde::{Deserialize, Serialize};
#[derive(
Copy,
Clone,
Debug,
Pack,
Unpack,
ToKey,
ToSchema,
Serialize,
Deserialize,
SimpleObject,
InputObject,
)]
#[fracpack(fracpack_mod = "crate::fracpack")]
#[to_key(psibase_mod = "crate")]
#[graphql(input_name = "ServiceMethodInput")]
pub struct ServiceMethod {
pub service: crate::AccountNumber,
pub method: crate::MethodNumber,
}
impl ServiceMethod {
pub fn new(service: crate::AccountNumber, method: crate::MethodNumber) -> Self {
Self { service, method }
}
}
type CallbackType = u32;
#[crate::service(
name = "example-auth",
actions = "AuthActions",
wrapper = "AuthWrapper",
structs = "auth_action_structs",
dispatch = false,
pub_constant = false,
psibase_mod = "crate"
)]
#[allow(non_snake_case, unused_variables)]
pub mod auth_interface {
use crate::services::transact::ServiceMethod;
pub const READ_ONLY_FLAG: u32 = 0x8000_0000;
pub const FIRST_AUTH_FLAG: u32 = 0x4000_0000;
pub const REQUEST_MASK: u32 = 0x0000_00ff;
pub const TOP_ACTION_REQ: u32 = 0x01;
pub const RUN_AS_REQUESTER_REQ: u32 = 0x02;
pub const RUN_AS_MATCHED_REQ: u32 = 0x03;
pub const RUN_AS_MATCHED_EXPANDED_REQ: u32 = 0x04;
pub const RUN_AS_OTHER_REQ: u32 = 0x05;
#[action]
fn checkAuthSys(
flags: u32,
requester: crate::AccountNumber,
action: crate::Action,
allowedActions: Vec<crate::services::transact::ServiceMethod>,
claims: Vec<crate::Claim>,
) {
unimplemented!()
}
#[action]
fn canAuthUserSys(user: crate::AccountNumber) {
unimplemented!()
}
#[action]
fn isAuthSys(
sender: crate::AccountNumber,
authorizers: Vec<crate::AccountNumber>,
method: Option<ServiceMethod>,
authSet: Option<Vec<crate::AccountNumber>>,
) -> bool {
unimplemented!()
}
#[action]
fn isRejectSys(
sender: crate::AccountNumber,
rejecters: Vec<crate::AccountNumber>,
method: Option<ServiceMethod>,
authSet: Option<Vec<crate::AccountNumber>>,
) -> bool {
unimplemented!()
}
}
#[crate::service(name = "transact", dispatch = false, psibase_mod = "crate")]
#[allow(non_snake_case, unused_variables)]
mod service {
use super::CallbackType;
use crate::{Action, Checksum256, Hex, Transaction};
use fracpack::Nested;
#[action]
fn startBoot(bootTransactions: Vec<crate::Checksum256>) {
unimplemented!();
}
#[action]
fn finishBoot() {
unimplemented!()
}
#[action]
fn startBlock() {
unimplemented!()
}
#[action]
fn execTrx(trx: Nested<Transaction>, speculative: bool) {
unimplemented!()
}
#[action]
fn setSnapTime(seconds: u32) {
unimplemented!()
}
#[action]
fn addCallback(type_: CallbackType, objective: bool, act: Action) {
unimplemented!()
}
#[action]
fn removeCallback(type_: CallbackType, objective: bool, act: Action) {
unimplemented!()
}
#[action]
fn regEvIdx(service: crate::AccountNumber) {
unimplemented!()
}
#[action]
fn runAs(
action: crate::Action,
allowedActions: Vec<crate::services::transact::ServiceMethod>,
) -> Hex<Vec<u8>> {
unimplemented!()
}
#[action]
fn checkFirstAuth(id: Checksum256, transaction: Transaction) -> bool {
unimplemented!()
}
#[action]
fn resMonitoring(enable: bool) {
unimplemented!()
}
#[action]
fn getTransaction() -> crate::Transaction {
unimplemented!()
}
#[action]
fn isTransaction() -> bool {
unimplemented!()
}
#[action]
fn currentBlock() -> crate::BlockHeader {
unimplemented!()
}
#[action]
fn headBlock() -> crate::BlockHeader {
unimplemented!()
}
#[action]
fn headBlockTime() -> crate::TimePointSec {
unimplemented!()
}
}
#[test]
fn verify_schema() {
crate::assert_schema_matches_package::<Wrapper>();
}