bch library
Subpath library: package:era_connect/bch.dart — the bch chain module
plus the shared request/scan plumbing, without the rest of the SDK.
Classes
- AnimatedUr
- Frame source for rendering a UR as an animated QR.
- AnimatedUrOptions
- Options for AnimatedUr.
- BchChain
-
Bitcoin Cash signing rides the structured
keystone-sign-request(6101) envelope, NOT the PSBT path: the device's PSBT signer cannot apply theSIGHASH_FORKID(0x41) sighash BCH consensus requires, so a dedicated FORKID signer sits behind this envelope instead. The SDK therefore builds the transaction container from structured inputs/outputs here — the one chain where it is more than a transport. - BchSignatureResult
-
A parsed
keystone-sign-resultreply. - BchSignRequestProps
- Inputs for BchChain.generateSignRequest.
- BchTxInput
- One UTXO the transaction spends. P2PKH only — that is what the device signs.
- BchTxOutput
- One output of a BCH sign request.
- CashAddrPayload
- A decoded CashAddr: script kind, hash160 and the prefix it carried.
- ChainContext
- Resolved SDK configuration handed to every chain module.
- EraConnectConfig
- SDK configuration. Everything is optional; the SDK performs NO network I/O ever.
- ExpectedReply
- Optional expectations when parsing a reply standalone (outside SignRequest.scanner).
- ScanComplete
- The scan is complete; ur is the assembled UR.
- ScanDuplicate
- A frame already seen this session (camera framerate re-reads).
- ScanFeedResult
- One outcome of feeding a frame to UrScanner.receivePart.
- ScanProgress
- The frame was consumed; the scan is not complete yet.
- ScanRejected
- The frame was turned away; see rejection.
- ScanRejection
- Why a scanned frame was turned away.
-
SignRequest<
TResult> - A built sign request: the UR to display plus everything needed to consume the reply. The request id is minted at CONSTRUCTION so the same object that renders the QR also validates the echo — a reply carrying a different id (from an earlier, cancelled flow re-presented to the camera) is refused instead of accepted.
-
TypedUrScanner<
TResult> - A scanner whose completed UR parses into a typed result (a chain signature).
- Ur
- An immutable Uniform Resource: a registry type string plus its CBOR payload.
- UrScanner
- Accumulates camera frames into a UR. Synchronous and non-throwing on the feed path (safe to call from camera callbacks); malformed frames come back as typed rejections, never exceptions.
- UrScannerOptions
- Options for UrScanner.
Enums
- CashAddrType
- The two script kinds the device builds outputs for.
Constants
- cashaddrPrefix → const String
- The default (mainnet) human-readable prefix.
- defaultFragmentLength → const int
- Default payload bytes per animated-QR fragment.
Functions
-
decodeCashAddr(
String address, [String expectedPrefix = cashaddrPrefix]) → CashAddrPayload -
Decode a CashAddr, with or without its
prefix:. Only 20-byte P2PKH and P2SH payloads are accepted — those are the two script kinds the device builds outputs for. -
encodeCashAddr(
CashAddrType type, Uint8List hash, {String? prefix, bool? withPrefix}) → String - Encode a 20-byte hash160 as a CashAddr. Returns the bare form by default.
-
resolveContext(
[EraConnectConfig? config]) → ChainContext - Resolve a (possibly absent) config into the context chain modules consume.
Exceptions / Errors
- EraSdkError
- Every error thrown by this SDK.