0.4.3-u12.0 • Published 6 months ago

@agoric/casting v0.4.3-u12.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

Agoric Casting

This Agoric Casting package follows ocap broadcasts in a flexible, future-proof way.

TL;DR: You can run yarn demo, or to follow a mailbox castingSpec do:

npx agoric follow -Bhttp://devnet.agoric.net/network-config :mailbox.agoric1foobarbaz -otext

An example of following an on-chain mailbox in code (using this package) is:

// First, obtain a Hardened JS environment via Endo.
import '@endo/init/pre-remoting.js'; // needed only for the next line
import '@agoric/castingSpec/node-fetch-shim.js'; // needed for Node.js
import '@endo/init';

import {
  iterateLatest,
  makeFollower,
  makeLeader,
  makeCastingSpec,
} from '@agoric/casting';

// Iterate over a mailbox follower on the devnet.
const leader = makeLeader('https://devnet.agoric.net/network-config');
const castingSpec = makeCastingSpec(':mailbox.agoric1foobarbaz');
const follower = makeFollower(leader, castingSpec);
for await (const { value } of iterateLatest(follower)) {
  console.log(`here's a mailbox value`, value);
}

Follower options

The followerOpts argument in makeFollower(leader, key, followerOpts) provides an optional bag of options:

  • the integrity option, which has three possibilities:
    • 'strict' - release data only after proving it was validated (may incur waits for one block's data to be validated in the next block),
    • 'optimistic' (default) - release data immediately, but may crash the follower in the future if an already-released value could not be proven,
    • 'none' - release data immediately without validation
  • the decode option is a function to translate buf: Uint8Array into data: string
    • (default) - interpret buf as a utf-8 string, then JSON.parse it
  • the unserializer option can be
    • (default) - release unserialized objects using @agoric/marshal's makeMarshal()
    • null - don't additionally unserialize data before releasing it
    • any unserializer object supporting E(unserializer).unserialize(data)
  • the crasher option can be
    • null (default) follower failures only propagate an exception/rejection
    • any crasher object supporting E(crasher).crash(reason)

Behind the scenes

  • the network config contains enough information to obtain Tendermint RPC nodes for a given Agoric network. You can use makeLeaderFromRpcAddresses directly if you want to avoid fetching a network-config.
  • each follower uses periodic CosmJS state polling (every X milliseconds) which can be refreshed more expediently via a Tendermint subscription to the corresponding state_change event
  • published (string) values are automatically unmarshalled, but without object references. a custom marshaller for your application.
  • the iterateRecent adapter transforms a follower into a local async iterator that produces only the last queried value (with no history reconstruction)

Status

This package currently depends on:

Short-term goals:

0.4.3-u12.0

6 months ago

0.4.3-dev-6e5b422.0

10 months ago

0.4.3-dev-22cbeb1.0

10 months ago

0.4.3-dev-3c22e86.0

10 months ago

0.4.3-dev-648d42f.0

10 months ago

0.4.3-dev-fb922d3.0

10 months ago

0.4.3-dev-6f740a4.0

10 months ago

0.4.3-dev-35576e9.0

10 months ago

0.4.3-dev-e96a12a.0

10 months ago

0.4.3-dev-e90f87b.0

10 months ago

0.4.3-dev-f5f34f4.0

10 months ago

0.4.3-dev-bd1190d.0

10 months ago

0.4.3-dev-c50ca19.0

10 months ago

0.4.3-dev-55ccfd2.0

10 months ago

0.4.3-u11wf.0

7 months ago

0.4.3-dev-284e2db.0

10 months ago

0.4.3-dev-ff1e301.0

10 months ago

0.4.3-dev-6c6b5a0.0

10 months ago

0.4.3-dev-aa8b3a1.0

10 months ago

0.4.3-dev-afe8a6e.0

10 months ago

0.4.3-dev-dfc712f.0

10 months ago

0.4.3-dev-1303537.0

10 months ago

0.4.3-u11.0

8 months ago

0.4.3-dev-5382a55.0

10 months ago

0.4.3-dev-af62279.0

10 months ago

0.4.3-dev-857e650.0

10 months ago

0.4.3-dev-b6b074d.0

10 months ago

0.4.3-dev-bcca849.0

10 months ago

0.4.3-dev-f010e07.0

10 months ago

0.4.3-dev-a6737cd.0

10 months ago

0.4.3-dev-3ae8bfc.0

11 months ago

0.4.3-dev-779b73d.0

11 months ago

0.4.1-dev-d42f8d0.0

11 months ago

0.4.3-dev-8690eb0.0

11 months ago

0.4.3-dev-9f34f9d.0

11 months ago

0.4.1-dev-effbf7f.0

11 months ago

0.4.3-dev-13050c2.0

11 months ago

0.4.3-dev-056a064.0

11 months ago

0.4.3-dev-b05c226.0

11 months ago

0.4.3-dev-2c5dd59.0

11 months ago

0.4.1-dev-72b0aa9.0

11 months ago

0.4.3-dev-4b79eb6.0

11 months ago

0.4.3-dev-69236fd.0

11 months ago

0.4.3-dev-dcddffd.0

10 months ago

0.4.3-dev-7632299.0

11 months ago

0.4.3-dev-046eb05.0

11 months ago

0.4.3-dev-f581a7e.0

11 months ago

0.4.3-dev-39b1586.0

11 months ago

0.4.3-dev-2baa932.0

10 months ago

0.4.1-dev-80bdc60.0

11 months ago

0.4.3-dev-657b621.0

11 months ago

0.4.1-dev-3b12eb6.0

11 months ago

0.4.3-dev-3a87a12.0

11 months ago

0.4.3-dev-5736604.0

11 months ago

0.4.3-dev-c50674b.0

11 months ago

0.4.3-dev-d589873.0

11 months ago

0.4.3-dev-ff36f02.0

11 months ago

0.4.3-dev-6bce049.0

10 months ago

0.4.1-dev-acefd94.0

11 months ago

0.4.3-dev-48da763.0

10 months ago

0.4.1-dev-c2ae5c0.0

11 months ago

0.4.3-dev-8c14632.0

11 months ago

0.4.3-dev-dd19d79.0

11 months ago

0.4.3-dev-3f11ae4.0

11 months ago

0.4.3-dev-4989f26.0

11 months ago

0.4.1-dev-13c169c.0

11 months ago

0.4.3-dev-51ee28f.0

11 months ago

0.4.3-dev-3353509.0

11 months ago

0.4.3-dev-26028d4.0

11 months ago

0.4.3-dev-b8d6697.0

11 months ago

0.4.3-dev-590740f.0

11 months ago

0.4.3-dev-6fece09.0

11 months ago

0.4.3-dev-b020abe.0

11 months ago

0.4.1-dev-f9596b4.0

11 months ago

0.4.3-dev-3c781f6.0

11 months ago

0.4.3-dev-2043349.0

11 months ago

0.4.2

11 months ago

0.4.3-dev-696f0a8.0

11 months ago

0.3.3-dev-0ce9545.0

12 months ago

0.3.3-dev-6a45c15.0

12 months ago

0.3.3-dev-8c6e4b2.0

12 months ago

0.3.3-dev-f6a48fd.0

12 months ago

0.3.3-dev-eb0553c.0

12 months ago

0.3.3-dev-3fa74c5.0

12 months ago

0.3.3-dev-2788f8d.0

12 months ago

0.3.3-dev-0fc1914.0

12 months ago

0.3.3-dev-c7c58c9.0

12 months ago

0.3.3-dev-09b993a.0

12 months ago

0.3.5-dev-d32a66a.0

12 months ago

0.3.3-dev-acc2db2.0

12 months ago

0.4.1-dev-74a0763.0

11 months ago

0.3.3-dev-35e5e30.0

12 months ago

0.3.3-dev-dd5d004.0

12 months ago

0.4.1-dev-bf4b59f.0

12 months ago

0.4.1-dev-4a0bf28.0

11 months ago

0.3.3-dev-b1a7a3a.0

12 months ago

0.3.3-dev-628de13.0

12 months ago

0.3.3-dev-0a2843b.0

12 months ago

0.3.3-dev-fa1e841.0

12 months ago

0.3.3-dev-ca22069.0

12 months ago

0.3.3-dev-930595b.0

12 months ago

0.3.3-dev-606cbd2.0

12 months ago

0.3.3-dev-cfa270b.0

12 months ago

0.3.3-dev-73ca139.0

12 months ago

0.3.3-dev-e816b60.0

12 months ago

0.3.3-dev-9d23380.0

12 months ago

0.4.1-dev-bf164a0.0

12 months ago

0.3.3-dev-03d1e1c.0

12 months ago

0.4.1-dev-fb2c249.0

11 months ago

0.3.3-dev-c0b16c2.0

12 months ago

0.3.3-dev-fb9d18f.0

12 months ago

0.3.3-dev-177d1e6.0

12 months ago

0.3.5-dev-800c2bb.0

12 months ago

0.3.3-dev-ffb9433.0

12 months ago

0.3.3-dev-82bd133.0

12 months ago

0.3.3-dev-a9d6a3b.0

12 months ago

0.3.3-dev-5a3d014.0

12 months ago

0.3.3-dev-09561e3.0

12 months ago

0.3.3-dev-f25bc81.0

12 months ago

0.3.3-dev-69003e6.0

12 months ago

0.3.3-dev-eb9fb38.0

12 months ago

0.3.3-dev-84f6373.0

12 months ago

0.3.3-dev-feb253e.0

12 months ago

0.3.3-dev-f5c3733.0

12 months ago

0.3.3-dev-9cebd87.0

12 months ago

0.3.3-dev-02e99df.0

12 months ago

0.3.3-dev-f75cfb8.0

12 months ago

0.3.3-dev-fa4a08d.0

12 months ago

0.4.1

11 months ago

0.4.0

12 months ago

0.3.3-dev-ab850a4.0

12 months ago

0.3.3-dev-e9260d3.0

12 months ago

0.3.3-dev-05bd95f.0

12 months ago

0.3.3-dev-ab7a341.0

12 months ago

0.3.3-dev-8d17cce.0

12 months ago

0.3.4

1 year ago

0.3.2

2 years ago

0.3.3

1 year ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.0

2 years ago