pages / example / sell_through_edge

example · sell_through_edge

canister coord://offchain/genie/program/sell_through_edge@v1/6341801a2fa7a968 · v1 · artifact root 0x6341801a2fa7a968868aab1d933f834d6ce068ace5da47eb12ef191bab970f27 · previous none (first version) · superroot at publish not sealed yet

sealed cases that reached it: 0 — sealed cases that reached this word (the store counts, never reads)

the words it says

its helpdesk graph

sell through edge (a .genie program) in the studio: 4 symptoms, 4 fixes

the source

// _GENIE_BINDINGS_v1_ — sell one task through a listed edge, written so anyone can copy it: find the edge of your class, call it,
// read whether its seller delivered. Every value a step sends comes from an answer bound before it (`as`, `into`) or from the run's
// input, never typed in. A row field is written row.<field> (row.class: class is also a genie word). The edges it picks are devnet edges (chain 36927): a call is metered in test units and moves no money.
// Run it: COORD_API_KEY=<a relayer key> node lang/genie/cli.mjs run lang/genie/examples/sell_through_edge.genie --input class=wire.reply --input task="…" [--send]
genie sell_through_edge v1
about "Find a listed edge that sells a job of your class and sell one task through it: its seller answers and the layer writes one meter line"

agent sale is "one task sold through the first devnet edge of its class that passed its check"
  states looking found sold delivered not_delivered no_edge
  start looking
  final delivered not_delivered no_edge
  failed not_delivered no_edge
  read GET /v1/exchanges as edge pick rows where row.chain_id == 36927 and row.class == input.class and row.state == "dry" and row.check.passed == true
  move looking -> found when edge.edge_id
  move looking -> no_edge
  move found -> sold op POST /v1/exchanges/:edge_id/call with edge_id from edge.edge_id with class from edge.class with task from input.task into sale effect record
  move sold -> delivered when sale.delivery.status == "ready"
  move sold -> not_delivered
  say found "A devnet edge of the class passed its check: its seller takes the task"
  say delivered "The seller answered through the edge; the layer wrote one meter line in test units"
  say not_delivered "The call went out and the seller did not answer ready; the meter line says why"
  say no_edge "No devnet edge of this class has passed its check; list one first"
  next looking found "Name a class that has a listed edge (GET /v1/exchanges)"
  next sold delivered "The seller answers the task through the edge"

knowledge
  symptom "the run ends at no_edge" caused_by "no devnet edge of the class passed its check" fixed_by "list a seller of the class (POST /v1/exchanges/edge) or pick a class GET /v1/exchanges shows"
  symptom "the run ends at not_delivered" caused_by "the seller did not answer ready" fixed_by "read sale.meter_line.status and the seller's endpoint"
  rule "a step's values come from an answer bound before it or from the run's input; none is typed into a program"