npm.io
0.6.0 • Published 2 weeks ago

@hub3js/std

Licence
MIT
Version
0.6.0
Deps
1
Size
61 kB
Vulns
0
Weekly
0

@hub3js/std

Shared standard layer for @hub3js namespace packages. Provides operator primitives, shared action implementations, builders, hooks, and types that chain-specific namespace packages (@hub3js/evm, @hub3js/solana, …) build on top of.

Exposed via subpaths:

  • @hub3js/std/operators — before / after / and / or recommended hooks
  • @hub3js/std/actions — shared action implementations (e.g. disconnect)
  • @hub3js/std/builders — pre-wired ActionBuilder factories
  • @hub3js/std/hooks — reusable subscriber builders (e.g. ChangeAccountSubscriberBuilder)
  • @hub3js/std/types — foundational types (Namespace, CAIP accounts, common actions, InstanceMap)
  • @hub3js/std/utils — CAIP validation

Connect errors

End each connect chain with the standardizeAndThrowError or-hook from @hub3js/std/operators. It throws a Hub3Error typed PROVIDER_USER_REJECTED_REQUEST, PROVIDER_LOCKED or PROVIDER_UNEXPECTED (see @hub3js/core); a value without a message gives an empty message. It never produces PROVIDER_LOCKED itself: a wallet returns that type from an earlier or-hook, and it is passed through untouched.