0.5.0-u20.0 • Published 10 months ago

@agoric/casting v0.5.0-u20.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 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-dev-26cd420.0

11 months ago

0.4.3-dev-fb70256.0

11 months ago

0.4.3-dev-3c81770.0

11 months ago

0.4.3-dev-722c90a.0

10 months ago

0.4.3-dev-44f473e.0

11 months ago

0.4.3-dev-fcb6c79.0

11 months ago

0.4.3-dev-decd4ff.0

12 months ago

0.4.3-dev-93d7fac.0

12 months ago

0.4.3-dev-1bb78b9.0

12 months ago

0.5.0-u20.0

12 months ago

0.4.3-dev-20168b0.0

12 months ago

0.4.3-dev-f8c06e6.0

11 months ago

0.4.3-dev-a8e6137.0

12 months ago

0.4.3-dev-316a778.0

11 months ago

0.4.3-dev-662598c.0

11 months ago

0.4.3-dev-7564f29.0

10 months ago

0.4.3-dev-e15db76.0

11 months ago

0.4.3-dev-b9091ce.0

11 months ago

0.4.3-dev-de9b2e7.0

12 months ago

0.4.3-dev-2fa8100.0

11 months ago

0.4.3-dev-8981e24.0

12 months ago

0.4.3-dev-a4ca914.0

10 months ago

0.4.3-dev-af493a9.0

11 months ago

0.4.3-dev-f795e6f.0

11 months ago

0.4.3-dev-db6d589.0

12 months ago

0.4.3-dev-a0bac63.0

10 months ago

0.4.3-dev-2ad9bd2.0

10 months ago

0.4.3-dev-7b3ac1e.0

12 months ago

0.4.3-dev-012ba00.0

12 months ago

0.4.3-dev-45185de.0

11 months ago

0.4.3-dev-64cd079.0

10 months ago

0.4.3-dev-77a85e2.0

12 months ago

0.4.3-dev-33eb3c9.0

11 months ago

0.4.3-dev-1578064.0

10 months ago

0.4.3-dev-70e543c.0

11 months ago

0.4.3-dev-7ed74d7.0

11 months ago

0.4.3-dev-8c6c8c2.0

10 months ago

0.4.3-dev-51b6790.0

10 months ago

0.4.3-dev-a56a132.0

10 months ago

0.4.3-dev-df81dca.0

10 months ago

0.4.3-dev-10ec2d9.0

11 months ago

0.4.3-dev-f9483e7.0

10 months ago

0.4.3-dev-7c12b02.0

12 months ago

0.4.3-dev-aa4385b.0

10 months ago

0.4.3-dev-19f1d8d.0

10 months ago

0.4.3-dev-19e7b87.0

11 months ago

0.4.3-dev-7dbb8b4.0

11 months ago

0.4.3-dev-8ac8ed6.0

10 months ago

0.4.3-dev-33a5708.0

12 months ago

0.4.3-dev-5372867.0

10 months ago

0.4.3-dev-c962ba0.0

11 months ago

0.4.3-dev-9f4b1ce.0

12 months ago

0.4.3-dev-be74a2b.0

10 months ago

0.4.3-dev-4926a13.0

12 months ago

0.4.3-dev-827ced0.0

12 months ago

0.4.3-dev-777e6a4.0

11 months ago

0.4.3-dev-4841c87.0

12 months ago

0.4.3-dev-1c730f2.0

11 months ago

0.4.3-dev-20db966.0

11 months ago

0.4.3-dev-04bd001.0

11 months ago

0.4.3-dev-3190128.0

12 months ago

0.4.3-dev-438955e.0

11 months ago

0.4.3-dev-60c3131.0

10 months ago

0.4.3-u18.5

1 year ago

0.4.3-u18.4

1 year ago

0.4.3-u18.3

1 year ago

0.4.3-u18.2

1 year ago

0.4.3-dev-7a15f90.0

11 months ago

0.4.3-u18.1

1 year ago

0.4.3-u18.0

1 year ago

0.4.3-dev-6751fc3.0

11 months ago

0.4.3-dev-eeb33f0.0

12 months ago

0.4.3-dev-b2bff24.0

12 months ago

0.4.3-dev-1d681c8.0

10 months ago

0.4.3-dev-fc871c0.0

10 months ago

0.4.3-dev-2422c58.0

12 months ago

0.4.3-dev-8914f38.0

11 months ago

0.4.3-dev-50a00cf.0

12 months ago

0.4.3-dev-e26d66b.0

10 months ago

0.4.3-dev-8234e6b.0

12 months ago

0.4.3-dev-9f8732f.0

12 months ago

0.4.3-dev-6d71e87.0

11 months ago

0.4.3-dev-76b2796.0

11 months ago

0.4.3-dev-5793e7d.0

11 months ago

0.4.3-dev-9c99b2d.0

10 months ago

0.4.3-dev-47a51f2.0

12 months ago

0.4.3-dev-f00912e.0

12 months ago

0.4.3-dev-4054171.0

12 months ago

0.4.3-dev-9811552.0

12 months ago

0.4.3-dev-1f8cef0.0

11 months ago

0.4.3-dev-5ad63ed.0

12 months ago

0.4.3-dev-ebe7d88.0

12 months ago

0.4.3-dev-1f93cea.0

11 months ago

0.4.3-dev-fb620c9.0

11 months ago

0.4.3-dev-31be299.0

12 months ago

0.4.3-dev-9f6644d.0

10 months ago

0.4.3-dev-7832dde.0

11 months ago

0.4.3-dev-bf2d699.0

10 months ago

0.4.3-dev-27cb6c4.0

11 months ago

0.4.3-dev-04140c1.0

12 months ago

0.4.3-dev-f80bb26.0

11 months ago

0.4.3-dev-47470c7.0

12 months ago

0.4.3-dev-59858c6.0

10 months ago

0.4.3-dev-08d306c.0

12 months ago

0.4.3-dev-fbea810.0

12 months ago

0.4.3-dev-cd45c09.0

11 months ago

0.4.3-dev-c0e75ad.0

10 months ago

0.4.3-dev-0467291.0

10 months ago

0.4.3-dev-280e215.0

12 months ago

0.4.3-dev-ed9fee7.0

12 months ago

0.4.3-dev-db3403c.0

11 months ago

0.4.3-dev-8a5cf5c.0

11 months ago

0.4.3-dev-228f08b.0

12 months ago

0.4.3-dev-f92b155.0

10 months ago

0.4.3-dev-4f0e6fd.0

10 months ago

0.4.3-dev-96659de.0

10 months ago

0.4.3-dev-0282f99.0

12 months ago

0.4.3-dev-b988686.0

12 months ago

0.4.3-dev-e77f936.0

10 months ago

0.4.3-dev-a0ff8b1.0

10 months ago

0.4.3-dev-28315fb.0

11 months ago

0.4.3-dev-af84c3d.0

12 months ago

0.4.3-dev-5051754.0

12 months ago

0.4.3-dev-438212f.0

11 months ago

0.4.3-dev-afbbd9a.0

12 months ago

0.4.3-dev-4850944.0

10 months ago

0.4.3-dev-276bcab.0

11 months ago

0.4.3-dev-4e35598.0

10 months ago

0.4.3-dev-84adeef.0

12 months ago

0.4.3-dev-921f991.0

12 months ago

0.4.3-u18a.0

1 year ago

0.4.3-dev-533d84a.0

11 months ago

0.4.3-dev-ee804eb.0

11 months ago

0.4.3-dev-1cee3dd.0

12 months ago

0.4.3-dev-0766b83.0

12 months ago

0.4.3-dev-a035a67.0

12 months ago

0.4.3-u19.2

1 year ago

0.4.3-u19.1

1 year ago

0.4.3-u19.0

1 year ago

0.4.3-dev-129bb20.0

12 months ago

0.4.3-u17.1

2 years ago

0.4.3-u17.0

2 years ago

0.4.3-u16.2

2 years ago

0.4.3-u16.1

2 years ago

0.4.3-u16.0

2 years ago

0.4.3-u13.0

2 years ago

0.4.3-u14.0

2 years ago

0.4.3-u12.0

2 years ago

0.4.3-u11wf.0

3 years ago

0.4.3-u11.0

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.4

3 years ago

0.3.2

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.0

4 years ago