DoubleDown.Double.Types (double_down v0.57.0)

Copy Markdown View Source

Shared type definitions for per-operation functions in DoubleDown.Double.

These types describe the function signatures accepted by expect/4, stub/3, and fake/3 — the per-operation Double API.

Summary

Types

A stateful expect responder with cross-contract state access: fn [args], state, all_states -> {result, new_state} end.

A per-operation fake function with cross-contract state access: fn [args], state, all_states -> {result, new_state} end.

Any expect responder (stateless, stateful, or cross-contract).

Any per-operation fake function (stateful or cross-contract).

A stateful expect responder reading the fallback's state: fn [args], state -> {result, new_state} end.

A per-operation fake function reading the fallback's state: fn [args], state -> {result, new_state} end.

A stateless expect responder: fn [args] -> result end.

A per-operation stub function: fn [args] -> result end. Always 1-arity (stateless).

Types

cross_contract_expect()

@type cross_contract_expect() :: ([term()], term(), map() -> {term(), term()})

A stateful expect responder with cross-contract state access: fn [args], state, all_states -> {result, new_state} end.

cross_contract_fake()

@type cross_contract_fake() :: ([term()], term(), map() -> {term(), term()})

A per-operation fake function with cross-contract state access: fn [args], state, all_states -> {result, new_state} end.

expect_fun()

@type expect_fun() :: stateless_expect() | stateful_expect() | cross_contract_expect()

Any expect responder (stateless, stateful, or cross-contract).

fake_fun()

@type fake_fun() :: stateful_fake() | cross_contract_fake()

Any per-operation fake function (stateful or cross-contract).

stateful_expect()

@type stateful_expect() :: ([term()], term() -> {term(), term()})

A stateful expect responder reading the fallback's state: fn [args], state -> {result, new_state} end.

stateful_fake()

@type stateful_fake() :: ([term()], term() -> {term(), term()})

A per-operation fake function reading the fallback's state: fn [args], state -> {result, new_state} end.

stateless_expect()

@type stateless_expect() :: ([term()] -> term())

A stateless expect responder: fn [args] -> result end.

stub_fun()

@type stub_fun() :: ([term()] -> term())

A per-operation stub function: fn [args] -> result end. Always 1-arity (stateless).