@digitalshieldfe/airgap-hot
v0.1.3
Published
Hot/watching air-gap SDK (parse multi-accounts, build sign requests) — scaffold
Readme
@digitalshieldfe/airgap-hot
Watch-only air-gap SDK (no private keys).
Core capabilities
- Import accounts —
importMultiAccounts/parseHDKey - Build sign requests —
encodeDemoTransfer(ETH / BTC·LTC·DOGE PSBT / SOL / TRON) - Parse cold signatures —
parseAirGapSignature - Assemble signed txs —
assembleSignedAirGap→ broadcastable raw payload - DS DeviceCall —
buildDeviceCall/parseDeviceCall(digitalshield-app-call-device)
DeviceCall (DS App)
const call = hot.buildDeviceCall({
method: "getMultiAccounts", // or "verifyAddress"
xfp: watchWallet.masterFingerprint,
deviceId: watchWallet.deviceId,
params: [{ chain: "eth", paths: ["m/44'/60'/0'"] }],
});
// call.frames → show as QR for cold to scangetMultiAccounts— cold returnscrypto-multi-accounts(must echo the samedeviceId)verifyAddress— cold returns a plaintext address QR (not a UR); hot scans it after「下一步」
OKX TRON uses cold-side keystone-sign-request / keystone-sign-result; hot wallets that speak standard tron-sign-request keep using the normal encode / assemble path.
See the root README §2.3 / §4.4.
Broadcasting
Not part of the SDK contract. Integrating wallets submit the assembled payload with their own RPC / infra.
Demo app only: packages/example/src/demoBroadcast.ts (demoBroadcastAssembled).
const parsed = hot.parseAirGapSignature(frames);
const assembled = hot.assembleSignedAirGap({ parsed, pending });
// wallet-owned:
await myRpc.sendRawTransaction(assembled.raw);Errors
Validation, UTXO selection, assemble, and parse failures throw AirGapError from @digitalshieldfe/airgap-core:
| Example code | Scenario |
|----------------|----------|
| HOT_MISSING_ETH_CONTEXT | Assemble ETH without pending context |
| HOT_UTXO_INSUFFICIENT_FUNDS | PSBT demo: inputs cannot cover amount + fee |
| HOT_INVALID_XFP | Malformed master fingerprint |
| HOT_PARSE_SIGNATURE_UNSUPPORTED | Unknown signature UR type |
import { AirGapError, isAirGapError } from "@digitalshieldfe/airgap-core";
try {
hot.assembleSignedAirGap({ parsed, pending });
} catch (e) {
if (isAirGapError(e)) {
showToast(i18n.t(e.code, e.params) ?? e.message);
}
}Full list: packages/airgap-core/src/errors.ts. Overview: root README §12.
RN QR UI
Display sign-request QR with @digitalshieldfe/airgap-qr-ui (AirGapSignRequestQr). Pass frames from encodeDemoTransfer / buildDeviceCall — do not pass the cold SDK into sign-request components.
