@hwlt/era-connect 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +9 -0
  3. package/README.md +101 -0
  4. package/btc/package.json +6 -0
  5. package/dist/btc-DfQ0q79G.d.ts +58 -0
  6. package/dist/btc-Dn6_Y12c.d.cts +58 -0
  7. package/dist/btc-Fr6Jz4Fi.cjs +104 -0
  8. package/dist/btc-Fr6Jz4Fi.cjs.map +1 -0
  9. package/dist/btc-VyJKXq7d.js +99 -0
  10. package/dist/btc-VyJKXq7d.js.map +1 -0
  11. package/dist/btc.cjs +9 -0
  12. package/dist/btc.d.cts +3 -0
  13. package/dist/btc.d.ts +3 -0
  14. package/dist/btc.js +3 -0
  15. package/dist/evm-BHj_2OTG.cjs +134 -0
  16. package/dist/evm-BHj_2OTG.cjs.map +1 -0
  17. package/dist/evm-DJxGGAbD.d.cts +76 -0
  18. package/dist/evm-KrV5wK08.d.ts +76 -0
  19. package/dist/evm-kJb3-oiR.js +117 -0
  20. package/dist/evm-kJb3-oiR.js.map +1 -0
  21. package/dist/evm.cjs +11 -0
  22. package/dist/evm.d.cts +3 -0
  23. package/dist/evm.d.ts +3 -0
  24. package/dist/evm.js +3 -0
  25. package/dist/index.cjs +530 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +285 -0
  28. package/dist/index.d.ts +285 -0
  29. package/dist/index.js +506 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/messages-17Oup0-Z.js +208 -0
  32. package/dist/messages-17Oup0-Z.js.map +1 -0
  33. package/dist/messages-BzcdWlg1.cjs +243 -0
  34. package/dist/messages-BzcdWlg1.cjs.map +1 -0
  35. package/dist/messages-DsPvW8Oi.d.cts +29 -0
  36. package/dist/messages-DsPvW8Oi.d.ts +29 -0
  37. package/dist/shared-B8Wc7ViU.js +1472 -0
  38. package/dist/shared-B8Wc7ViU.js.map +1 -0
  39. package/dist/shared-CI8zhQiE.d.cts +218 -0
  40. package/dist/shared-CI8zhQiE.d.ts +218 -0
  41. package/dist/shared-nISrEktU.cjs +1777 -0
  42. package/dist/shared-nISrEktU.cjs.map +1 -0
  43. package/dist/solana-8eOwz0gM.d.cts +49 -0
  44. package/dist/solana-C2Xm7w8a.d.ts +49 -0
  45. package/dist/solana-C7JQEAec.js +87 -0
  46. package/dist/solana-C7JQEAec.js.map +1 -0
  47. package/dist/solana-DdEn24X4.cjs +98 -0
  48. package/dist/solana-DdEn24X4.cjs.map +1 -0
  49. package/dist/solana.cjs +10 -0
  50. package/dist/solana.d.cts +3 -0
  51. package/dist/solana.d.ts +3 -0
  52. package/dist/solana.js +3 -0
  53. package/dist/tron-Bo9HnvVE.js +158 -0
  54. package/dist/tron-Bo9HnvVE.js.map +1 -0
  55. package/dist/tron-CQIEqjCA.cjs +163 -0
  56. package/dist/tron-CQIEqjCA.cjs.map +1 -0
  57. package/dist/tron-YllfTmx6.d.ts +63 -0
  58. package/dist/tron-gG51KMnX.d.cts +63 -0
  59. package/dist/tron.cjs +11 -0
  60. package/dist/tron.d.cts +4 -0
  61. package/dist/tron.d.ts +4 -0
  62. package/dist/tron.js +4 -0
  63. package/dist/verify.cjs +445 -0
  64. package/dist/verify.cjs.map +1 -0
  65. package/dist/verify.d.cts +162 -0
  66. package/dist/verify.d.ts +162 -0
  67. package/dist/verify.js +438 -0
  68. package/dist/verify.js.map +1 -0
  69. package/evm/package.json +6 -0
  70. package/package.json +140 -0
  71. package/proto/tron/base.proto +16 -0
  72. package/proto/tron/message.proto +12 -0
  73. package/proto/tron/payload.proto +35 -0
  74. package/proto/tron/sign_transaction_result.proto +10 -0
  75. package/proto/tron/sync.proto +21 -0
  76. package/proto/tron/transaction.proto +17 -0
  77. package/proto/tron/tron_transaction.proto +31 -0
  78. package/proto/tron/verify_address.proto +10 -0
  79. package/solana/package.json +6 -0
  80. package/tron/package.json +6 -0
  81. package/verify/package.json +6 -0
@@ -0,0 +1,285 @@
1
+ import { _ as Ur, a as SignRequest, c as TypedUrScanner, d as EraErrorCode, f as EraSdkError, g as RandomBytesFn, h as DEFAULT_FRAGMENT_LENGTH, i as ExpectedReply, l as UrScanner, m as AnimatedUrOptions, n as DEFAULT_ORIGIN, o as ScanFeedResult, p as AnimatedUr, r as EraConnectConfig, s as ScanRejection, t as ChainContext, u as UrScannerOptions } from "./shared-CI8zhQiE.cjs";
2
+ import { a as BtcPsbtSignRequestProps, i as BtcPsbtResult, n as BtcMessageSignRequestProps, r as BtcMessageSignatureResult, t as BtcChain } from "./btc-Dn6_Y12c.cjs";
3
+ import { i as EvmSignatureResult, n as EvmDataType, r as EvmSignRequestProps, t as EvmChain } from "./evm-DJxGGAbD.cjs";
4
+ import { i as SolanaChain, n as SolSignType, r as SolSignatureResult, t as SolSignRequestProps } from "./solana-8eOwz0gM.cjs";
5
+ import { n as TronLatestBlock } from "./messages-DsPvW8Oi.cjs";
6
+ import { n as TronSignRequestProps, r as TronSignatureResult, t as TronChain } from "./tron-gG51KMnX.cjs";
7
+ //#region src/registry/keypath.d.ts
8
+ /** One BIP-32 derivation level: child index plus the hardened flag (`'`). */
9
+ interface PathLevel {
10
+ readonly index: number;
11
+ readonly hardened: boolean;
12
+ }
13
+ //#endregion
14
+ //#region src/registry/multi-accounts.d.ts
15
+ /**
16
+ * Raw account entry parsed from a `crypto-multi-accounts` (1103) export.
17
+ *
18
+ * `xfp` is the entry's ORIGIN source fingerprint (`crypto-keypath` key 2) —
19
+ * the value a `*-sign-request` keypath must carry. It is NOT the top-level
20
+ * master fingerprint, although the two often coincide.
21
+ */
22
+ interface RawAccountEntry {
23
+ readonly path: readonly PathLevel[];
24
+ readonly xfp: number;
25
+ /**
26
+ * Nullable and length-unconstrained, as in the reference implementation: an
27
+ * entry without a usable key still resolves its xfp for signing — only the
28
+ * address-derivation views require the 33/32-byte forms.
29
+ */
30
+ readonly publicKey: Uint8Array | null;
31
+ readonly chainCode: Uint8Array | null;
32
+ readonly parentFingerprint: number | null;
33
+ readonly name: string | null;
34
+ /** A label string (`account.standard`, ...) — NEVER chain metadata. */
35
+ readonly note: string | null;
36
+ }
37
+ //#endregion
38
+ //#region src/accounts/accounts.d.ts
39
+ /** Chain family of an exported account, matched by its derivation path — never by the note label. */
40
+ type AccountChain = 'evm' | 'btc' | 'solana' | 'tron' | 'unknown';
41
+ interface AccountKey {
42
+ readonly chain: AccountChain;
43
+ /** Account-level derivation path, e.g. `m/44'/60'/0'`. */
44
+ readonly path: string;
45
+ /**
46
+ * The source fingerprint a `*-sign-request` keypath must carry for this
47
+ * account (lowercase 8-hex). NOT necessarily the master fingerprint.
48
+ */
49
+ readonly xfp: string;
50
+ /** 33-byte compressed secp256k1, or 32-byte Ed25519 (Solana); absent when the export omitted it. */
51
+ readonly publicKey: Uint8Array | undefined;
52
+ readonly chainCode: Uint8Array | undefined;
53
+ readonly name: string | undefined;
54
+ /** Derivation-scheme label (`account.standard`, ...) — display only. */
55
+ readonly note: string | undefined;
56
+ }
57
+ interface DeviceInfo {
58
+ readonly name: string | undefined;
59
+ readonly id: string | undefined;
60
+ readonly firmwareVersion: string | undefined;
61
+ }
62
+ /** EVM view over the linked wallet: one account xpub, addresses derived at `0/index`. */
63
+ declare class EvmAccountView {
64
+ private readonly entry;
65
+ constructor(entry: RawAccountEntry);
66
+ get xfp(): string;
67
+ get accountPath(): string;
68
+ /** Signing path for address `index`: `<account>/0/<index>`. */
69
+ pathFor(index: number): string;
70
+ deriveAddress(index: number): `0x${string}`;
71
+ xpub(): string;
72
+ }
73
+ type BtcPurpose = 44 | 49 | 84 | 86;
74
+ /**
75
+ * Bitcoin view over one exported account. The default is the BIP-84
76
+ * native-segwit account; pass `purpose` to reach the other script types the
77
+ * device exports (44 = legacy P2PKH — the kind the device signs MESSAGES for,
78
+ * 49 = nested segwit, 86 = taproot).
79
+ */
80
+ declare class BtcAccountView {
81
+ private readonly entry;
82
+ private readonly testnet;
83
+ readonly purpose: BtcPurpose;
84
+ constructor(entry: RawAccountEntry, testnet: boolean, purpose: BtcPurpose);
85
+ get xfp(): string;
86
+ get accountPath(): string;
87
+ receivePath(index: number): string;
88
+ changePath(index: number): string;
89
+ deriveAddress(index: number, options?: {
90
+ change?: boolean;
91
+ }): string;
92
+ xpub(): string;
93
+ /** SLIP-132 zpub form of the BIP-84 key, for tools that require it. */
94
+ zpub(): string;
95
+ }
96
+ /** Tron view: addresses derived at `0/index`. */
97
+ declare class TronAccountView {
98
+ private readonly entry;
99
+ constructor(entry: RawAccountEntry);
100
+ get xfp(): string;
101
+ get accountPath(): string;
102
+ pathFor(index: number): string;
103
+ deriveAddress(index: number): string;
104
+ }
105
+ /**
106
+ * Solana view: Ed25519 has no public child derivation, so the device
107
+ * pre-derives hardened accounts (`m/44'/501'/idx'`) and each entry IS a
108
+ * signer. The public key, base58, IS the address.
109
+ */
110
+ declare class SolanaAccountView {
111
+ private readonly entry;
112
+ constructor(entry: RawAccountEntry);
113
+ get xfp(): string;
114
+ get path(): string;
115
+ /** The hardened account index (third path level). */
116
+ get index(): number;
117
+ get publicKey(): Uint8Array;
118
+ get address(): string;
119
+ }
120
+ /**
121
+ * The linked wallet: everything a software wallet extracts from the device's
122
+ * `crypto-multi-accounts` QR. Parse once, store the source UR string, derive
123
+ * addresses locally — the device is not needed again until signing.
124
+ */
125
+ declare class EraAccounts {
126
+ private readonly raw;
127
+ readonly sourceUr: string | undefined;
128
+ private constructor();
129
+ static fromUr(input: Ur | string): EraAccounts;
130
+ /** Master fingerprint, lowercase 8-hex. */
131
+ get masterFingerprint(): string;
132
+ get device(): DeviceInfo;
133
+ get keys(): AccountKey[];
134
+ /**
135
+ * The xfp a sign request must carry for the account whose path exactly
136
+ * equals `accountPath`. Throws `account-not-found` — never a silent zero.
137
+ */
138
+ xfpFor(accountPath: string): string;
139
+ /** The EVM account (standard `m/44'/60'/...` scheme), if the export carries one. */
140
+ evm(): EvmAccountView | undefined;
141
+ /**
142
+ * A Bitcoin account view. Defaults to the BIP-84 native-segwit account;
143
+ * pass `purpose: 44` for the legacy P2PKH account (message signing), 49 for
144
+ * nested segwit, 86 for taproot — if the export carries them.
145
+ */
146
+ btc(options?: {
147
+ testnet?: boolean;
148
+ purpose?: BtcPurpose;
149
+ }): BtcAccountView | undefined;
150
+ tron(): TronAccountView | undefined;
151
+ /** All pre-derived Solana signers (usually `m/44'/501'/0'..9'`). */
152
+ solana(): SolanaAccountView[];
153
+ private entryFor;
154
+ }
155
+ //#endregion
156
+ //#region src/hardware-call/key-derivation.d.ts
157
+ type DerivationCurve = 'secp256k1' | 'ed25519';
158
+ type DerivationAlgorithm = 'slip10' | 'bip32ed25519';
159
+ interface KeyDerivationSchema {
160
+ /** The derivation path to request, e.g. `m/44'/60'/0'`. */
161
+ readonly path: string;
162
+ /** Defaults to `secp256k1`. */
163
+ readonly curve?: DerivationCurve;
164
+ /** Defaults to `slip10`. */
165
+ readonly algo?: DerivationAlgorithm;
166
+ /** Optional chain hint shown by the device. */
167
+ readonly chainType?: string;
168
+ }
169
+ interface KeyDerivationCallProps {
170
+ readonly schemas: readonly KeyDerivationSchema[];
171
+ readonly origin?: string;
172
+ }
173
+ /** The pull-model linking request: display it, then scan the device's account export back. */
174
+ interface HardwareCallRequest {
175
+ readonly ur: Ur;
176
+ readonly replyTypes: readonly string[];
177
+ toAnimated(options?: AnimatedUrOptions): AnimatedUr;
178
+ scanner(): TypedUrScanner<EraAccounts>;
179
+ }
180
+ //#endregion
181
+ //#region src/raw.d.ts
182
+ /**
183
+ * Escape hatch for UR types this SDK has no dedicated module for (future
184
+ * chains, custom registry items). You bring the CBOR; the SDK brings the UR
185
+ * plumbing, fountain frames and the hardened scanner
186
+ * (`EraConnect.scanner({expectedTypes})`).
187
+ */
188
+ declare class RawModule {
189
+ private readonly context;
190
+ constructor(context: ChainContext);
191
+ /** Wrap raw CBOR bytes in a UR of the given registry type. */
192
+ ur(type: string, cbor: Uint8Array): Ur;
193
+ /** Parse a single-part `ur:` string into a Ur. */
194
+ parse(text: string): Ur;
195
+ /** Fragment + animate any UR. */
196
+ animate(ur: Ur, options?: AnimatedUrOptions): AnimatedUr;
197
+ }
198
+ //#endregion
199
+ //#region src/core/bytes.d.ts
200
+ /** UTF-8 encode without TextEncoder (absent on older Hermes). */
201
+ declare function utf8Encode(text: string): Uint8Array;
202
+ /**
203
+ * STRICT UTF-8 decode without TextDecoder (absent on older Hermes). Throws on
204
+ * malformed input, including overlong encodings, surrogate code points and
205
+ * values past U+10FFFF — a lenient decoder would let a hostile reply smuggle
206
+ * bytes that render as different text than they compare as.
207
+ */
208
+ declare function utf8Decode(bytes: Uint8Array): string;
209
+ //#endregion
210
+ //#region src/ur/limits.d.ts
211
+ /**
212
+ * Bounds every field a scanned UR fragment can dictate, BEFORE that field is
213
+ * allowed to size an allocation or a loop.
214
+ *
215
+ * A QR in the camera frame is attacker-controlled input: a sticker on the
216
+ * device, a second screen, a poster. Without these bounds the fragment
217
+ * header's `seqLength` goes straight into array allocation and into a
218
+ * quadratic index shuffle, so ~60 characters of QR can ask the host for
219
+ * gigabytes or minutes of work — no gzip, no multi-frame assembly, one frame.
220
+ *
221
+ * The numbers are generous headroom over real device traffic, NOT tight
222
+ * protocol bounds: a cap that refuses a genuine reply is worse than the
223
+ * denial of service it prevents.
224
+ */
225
+ declare const UrLimits: {
226
+ /** Largest reassembled UR payload, in bytes. */
227
+ readonly maxMessageBytes: number;
228
+ /** Largest number of source fragments a multi-part UR may declare. */
229
+ readonly maxFragmentCount: 2048;
230
+ /** Largest single fragment payload, in bytes (QR v40 tops out at 2953). */
231
+ readonly maxFragmentBytes: 4096;
232
+ /** Largest value for any u32 header field (`seqNum`, `checksum`). */
233
+ readonly maxUint32: 4294967295;
234
+ };
235
+ //#endregion
236
+ //#region src/index.d.ts
237
+ /** Timing/size constants of the device's own QR pipeline, for progress UI and timeouts. */
238
+ declare const DeviceProfile: {
239
+ /** What the phone displays to the device: ~200 wire bytes per frame at 8 fps. */
240
+ readonly phoneToDevice: {
241
+ readonly fragmentBytesOnWire: 200;
242
+ readonly payloadBytes: 180;
243
+ readonly frameIntervalMs: 125;
244
+ };
245
+ /**
246
+ * What the device displays back: 150-byte fragments at 2.5 fps. Receiving
247
+ * is SLOWER than sending — budget scan timeouts accordingly.
248
+ */
249
+ readonly deviceToPhone: {
250
+ readonly fragmentBytesOnWire: 150;
251
+ readonly frameIntervalMs: 400;
252
+ };
253
+ };
254
+ /** The SDK facade. Cheap to construct; chain modules are created lazily. */
255
+ declare class EraConnect {
256
+ private readonly context;
257
+ private _evm;
258
+ private _btc;
259
+ private _solana;
260
+ private _tron;
261
+ private _raw;
262
+ constructor(config?: EraConnectConfig);
263
+ get evm(): EvmChain;
264
+ get btc(): BtcChain;
265
+ get solana(): SolanaChain;
266
+ get tron(): TronChain;
267
+ /** Escape hatch for UR types without a dedicated module. */
268
+ get raw(): RawModule;
269
+ /**
270
+ * Linking: parse the device's `crypto-multi-accounts` export (a `Ur` from a
271
+ * scanner, or a single-part `ur:` string).
272
+ */
273
+ parseAccounts(input: Ur | string): EraAccounts;
274
+ /**
275
+ * Pull-model linking: ask the device for SPECIFIC derivations
276
+ * (`qr-hardware-call` 1201). The device answers with a
277
+ * `crypto-multi-accounts` export.
278
+ */
279
+ generateKeyDerivationCall(props: KeyDerivationCallProps): HardwareCallRequest;
280
+ /** A type-agnostic hardened scanner (linking flows, raw flows). */
281
+ scanner(options?: UrScannerOptions): UrScanner;
282
+ }
283
+ //#endregion
284
+ export { type AccountChain, type AccountKey, AnimatedUr, type AnimatedUrOptions, BtcAccountView, BtcChain, type BtcMessageSignRequestProps, type BtcMessageSignatureResult, type BtcPsbtResult, type BtcPsbtSignRequestProps, type BtcPurpose, type ChainContext, DEFAULT_FRAGMENT_LENGTH, DEFAULT_ORIGIN, type DerivationAlgorithm, type DerivationCurve, type DeviceInfo, DeviceProfile, EraAccounts, EraConnect, type EraConnectConfig, type EraErrorCode, EraSdkError, EvmAccountView, EvmChain, EvmDataType, type EvmSignRequestProps, type EvmSignatureResult, type ExpectedReply, type HardwareCallRequest, type KeyDerivationCallProps, type KeyDerivationSchema, type RandomBytesFn, RawModule, type ScanFeedResult, type ScanRejection, type SignRequest, type SolSignRequestProps, SolSignType, type SolSignatureResult, SolanaAccountView, SolanaChain, TronAccountView, TronChain, type TronLatestBlock, type TronSignRequestProps, type TronSignatureResult, TypedUrScanner, Ur, UrLimits, UrScanner, type UrScannerOptions, utf8Decode, utf8Encode };
285
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1,285 @@
1
+ import { _ as Ur, a as SignRequest, c as TypedUrScanner, d as EraErrorCode, f as EraSdkError, g as RandomBytesFn, h as DEFAULT_FRAGMENT_LENGTH, i as ExpectedReply, l as UrScanner, m as AnimatedUrOptions, n as DEFAULT_ORIGIN, o as ScanFeedResult, p as AnimatedUr, r as EraConnectConfig, s as ScanRejection, t as ChainContext, u as UrScannerOptions } from "./shared-CI8zhQiE.js";
2
+ import { a as BtcPsbtSignRequestProps, i as BtcPsbtResult, n as BtcMessageSignRequestProps, r as BtcMessageSignatureResult, t as BtcChain } from "./btc-DfQ0q79G.js";
3
+ import { i as EvmSignatureResult, n as EvmDataType, r as EvmSignRequestProps, t as EvmChain } from "./evm-KrV5wK08.js";
4
+ import { i as SolanaChain, n as SolSignType, r as SolSignatureResult, t as SolSignRequestProps } from "./solana-C2Xm7w8a.js";
5
+ import { n as TronLatestBlock } from "./messages-DsPvW8Oi.js";
6
+ import { n as TronSignRequestProps, r as TronSignatureResult, t as TronChain } from "./tron-YllfTmx6.js";
7
+ //#region src/registry/keypath.d.ts
8
+ /** One BIP-32 derivation level: child index plus the hardened flag (`'`). */
9
+ interface PathLevel {
10
+ readonly index: number;
11
+ readonly hardened: boolean;
12
+ }
13
+ //#endregion
14
+ //#region src/registry/multi-accounts.d.ts
15
+ /**
16
+ * Raw account entry parsed from a `crypto-multi-accounts` (1103) export.
17
+ *
18
+ * `xfp` is the entry's ORIGIN source fingerprint (`crypto-keypath` key 2) —
19
+ * the value a `*-sign-request` keypath must carry. It is NOT the top-level
20
+ * master fingerprint, although the two often coincide.
21
+ */
22
+ interface RawAccountEntry {
23
+ readonly path: readonly PathLevel[];
24
+ readonly xfp: number;
25
+ /**
26
+ * Nullable and length-unconstrained, as in the reference implementation: an
27
+ * entry without a usable key still resolves its xfp for signing — only the
28
+ * address-derivation views require the 33/32-byte forms.
29
+ */
30
+ readonly publicKey: Uint8Array | null;
31
+ readonly chainCode: Uint8Array | null;
32
+ readonly parentFingerprint: number | null;
33
+ readonly name: string | null;
34
+ /** A label string (`account.standard`, ...) — NEVER chain metadata. */
35
+ readonly note: string | null;
36
+ }
37
+ //#endregion
38
+ //#region src/accounts/accounts.d.ts
39
+ /** Chain family of an exported account, matched by its derivation path — never by the note label. */
40
+ type AccountChain = 'evm' | 'btc' | 'solana' | 'tron' | 'unknown';
41
+ interface AccountKey {
42
+ readonly chain: AccountChain;
43
+ /** Account-level derivation path, e.g. `m/44'/60'/0'`. */
44
+ readonly path: string;
45
+ /**
46
+ * The source fingerprint a `*-sign-request` keypath must carry for this
47
+ * account (lowercase 8-hex). NOT necessarily the master fingerprint.
48
+ */
49
+ readonly xfp: string;
50
+ /** 33-byte compressed secp256k1, or 32-byte Ed25519 (Solana); absent when the export omitted it. */
51
+ readonly publicKey: Uint8Array | undefined;
52
+ readonly chainCode: Uint8Array | undefined;
53
+ readonly name: string | undefined;
54
+ /** Derivation-scheme label (`account.standard`, ...) — display only. */
55
+ readonly note: string | undefined;
56
+ }
57
+ interface DeviceInfo {
58
+ readonly name: string | undefined;
59
+ readonly id: string | undefined;
60
+ readonly firmwareVersion: string | undefined;
61
+ }
62
+ /** EVM view over the linked wallet: one account xpub, addresses derived at `0/index`. */
63
+ declare class EvmAccountView {
64
+ private readonly entry;
65
+ constructor(entry: RawAccountEntry);
66
+ get xfp(): string;
67
+ get accountPath(): string;
68
+ /** Signing path for address `index`: `<account>/0/<index>`. */
69
+ pathFor(index: number): string;
70
+ deriveAddress(index: number): `0x${string}`;
71
+ xpub(): string;
72
+ }
73
+ type BtcPurpose = 44 | 49 | 84 | 86;
74
+ /**
75
+ * Bitcoin view over one exported account. The default is the BIP-84
76
+ * native-segwit account; pass `purpose` to reach the other script types the
77
+ * device exports (44 = legacy P2PKH — the kind the device signs MESSAGES for,
78
+ * 49 = nested segwit, 86 = taproot).
79
+ */
80
+ declare class BtcAccountView {
81
+ private readonly entry;
82
+ private readonly testnet;
83
+ readonly purpose: BtcPurpose;
84
+ constructor(entry: RawAccountEntry, testnet: boolean, purpose: BtcPurpose);
85
+ get xfp(): string;
86
+ get accountPath(): string;
87
+ receivePath(index: number): string;
88
+ changePath(index: number): string;
89
+ deriveAddress(index: number, options?: {
90
+ change?: boolean;
91
+ }): string;
92
+ xpub(): string;
93
+ /** SLIP-132 zpub form of the BIP-84 key, for tools that require it. */
94
+ zpub(): string;
95
+ }
96
+ /** Tron view: addresses derived at `0/index`. */
97
+ declare class TronAccountView {
98
+ private readonly entry;
99
+ constructor(entry: RawAccountEntry);
100
+ get xfp(): string;
101
+ get accountPath(): string;
102
+ pathFor(index: number): string;
103
+ deriveAddress(index: number): string;
104
+ }
105
+ /**
106
+ * Solana view: Ed25519 has no public child derivation, so the device
107
+ * pre-derives hardened accounts (`m/44'/501'/idx'`) and each entry IS a
108
+ * signer. The public key, base58, IS the address.
109
+ */
110
+ declare class SolanaAccountView {
111
+ private readonly entry;
112
+ constructor(entry: RawAccountEntry);
113
+ get xfp(): string;
114
+ get path(): string;
115
+ /** The hardened account index (third path level). */
116
+ get index(): number;
117
+ get publicKey(): Uint8Array;
118
+ get address(): string;
119
+ }
120
+ /**
121
+ * The linked wallet: everything a software wallet extracts from the device's
122
+ * `crypto-multi-accounts` QR. Parse once, store the source UR string, derive
123
+ * addresses locally — the device is not needed again until signing.
124
+ */
125
+ declare class EraAccounts {
126
+ private readonly raw;
127
+ readonly sourceUr: string | undefined;
128
+ private constructor();
129
+ static fromUr(input: Ur | string): EraAccounts;
130
+ /** Master fingerprint, lowercase 8-hex. */
131
+ get masterFingerprint(): string;
132
+ get device(): DeviceInfo;
133
+ get keys(): AccountKey[];
134
+ /**
135
+ * The xfp a sign request must carry for the account whose path exactly
136
+ * equals `accountPath`. Throws `account-not-found` — never a silent zero.
137
+ */
138
+ xfpFor(accountPath: string): string;
139
+ /** The EVM account (standard `m/44'/60'/...` scheme), if the export carries one. */
140
+ evm(): EvmAccountView | undefined;
141
+ /**
142
+ * A Bitcoin account view. Defaults to the BIP-84 native-segwit account;
143
+ * pass `purpose: 44` for the legacy P2PKH account (message signing), 49 for
144
+ * nested segwit, 86 for taproot — if the export carries them.
145
+ */
146
+ btc(options?: {
147
+ testnet?: boolean;
148
+ purpose?: BtcPurpose;
149
+ }): BtcAccountView | undefined;
150
+ tron(): TronAccountView | undefined;
151
+ /** All pre-derived Solana signers (usually `m/44'/501'/0'..9'`). */
152
+ solana(): SolanaAccountView[];
153
+ private entryFor;
154
+ }
155
+ //#endregion
156
+ //#region src/hardware-call/key-derivation.d.ts
157
+ type DerivationCurve = 'secp256k1' | 'ed25519';
158
+ type DerivationAlgorithm = 'slip10' | 'bip32ed25519';
159
+ interface KeyDerivationSchema {
160
+ /** The derivation path to request, e.g. `m/44'/60'/0'`. */
161
+ readonly path: string;
162
+ /** Defaults to `secp256k1`. */
163
+ readonly curve?: DerivationCurve;
164
+ /** Defaults to `slip10`. */
165
+ readonly algo?: DerivationAlgorithm;
166
+ /** Optional chain hint shown by the device. */
167
+ readonly chainType?: string;
168
+ }
169
+ interface KeyDerivationCallProps {
170
+ readonly schemas: readonly KeyDerivationSchema[];
171
+ readonly origin?: string;
172
+ }
173
+ /** The pull-model linking request: display it, then scan the device's account export back. */
174
+ interface HardwareCallRequest {
175
+ readonly ur: Ur;
176
+ readonly replyTypes: readonly string[];
177
+ toAnimated(options?: AnimatedUrOptions): AnimatedUr;
178
+ scanner(): TypedUrScanner<EraAccounts>;
179
+ }
180
+ //#endregion
181
+ //#region src/raw.d.ts
182
+ /**
183
+ * Escape hatch for UR types this SDK has no dedicated module for (future
184
+ * chains, custom registry items). You bring the CBOR; the SDK brings the UR
185
+ * plumbing, fountain frames and the hardened scanner
186
+ * (`EraConnect.scanner({expectedTypes})`).
187
+ */
188
+ declare class RawModule {
189
+ private readonly context;
190
+ constructor(context: ChainContext);
191
+ /** Wrap raw CBOR bytes in a UR of the given registry type. */
192
+ ur(type: string, cbor: Uint8Array): Ur;
193
+ /** Parse a single-part `ur:` string into a Ur. */
194
+ parse(text: string): Ur;
195
+ /** Fragment + animate any UR. */
196
+ animate(ur: Ur, options?: AnimatedUrOptions): AnimatedUr;
197
+ }
198
+ //#endregion
199
+ //#region src/core/bytes.d.ts
200
+ /** UTF-8 encode without TextEncoder (absent on older Hermes). */
201
+ declare function utf8Encode(text: string): Uint8Array;
202
+ /**
203
+ * STRICT UTF-8 decode without TextDecoder (absent on older Hermes). Throws on
204
+ * malformed input, including overlong encodings, surrogate code points and
205
+ * values past U+10FFFF — a lenient decoder would let a hostile reply smuggle
206
+ * bytes that render as different text than they compare as.
207
+ */
208
+ declare function utf8Decode(bytes: Uint8Array): string;
209
+ //#endregion
210
+ //#region src/ur/limits.d.ts
211
+ /**
212
+ * Bounds every field a scanned UR fragment can dictate, BEFORE that field is
213
+ * allowed to size an allocation or a loop.
214
+ *
215
+ * A QR in the camera frame is attacker-controlled input: a sticker on the
216
+ * device, a second screen, a poster. Without these bounds the fragment
217
+ * header's `seqLength` goes straight into array allocation and into a
218
+ * quadratic index shuffle, so ~60 characters of QR can ask the host for
219
+ * gigabytes or minutes of work — no gzip, no multi-frame assembly, one frame.
220
+ *
221
+ * The numbers are generous headroom over real device traffic, NOT tight
222
+ * protocol bounds: a cap that refuses a genuine reply is worse than the
223
+ * denial of service it prevents.
224
+ */
225
+ declare const UrLimits: {
226
+ /** Largest reassembled UR payload, in bytes. */
227
+ readonly maxMessageBytes: number;
228
+ /** Largest number of source fragments a multi-part UR may declare. */
229
+ readonly maxFragmentCount: 2048;
230
+ /** Largest single fragment payload, in bytes (QR v40 tops out at 2953). */
231
+ readonly maxFragmentBytes: 4096;
232
+ /** Largest value for any u32 header field (`seqNum`, `checksum`). */
233
+ readonly maxUint32: 4294967295;
234
+ };
235
+ //#endregion
236
+ //#region src/index.d.ts
237
+ /** Timing/size constants of the device's own QR pipeline, for progress UI and timeouts. */
238
+ declare const DeviceProfile: {
239
+ /** What the phone displays to the device: ~200 wire bytes per frame at 8 fps. */
240
+ readonly phoneToDevice: {
241
+ readonly fragmentBytesOnWire: 200;
242
+ readonly payloadBytes: 180;
243
+ readonly frameIntervalMs: 125;
244
+ };
245
+ /**
246
+ * What the device displays back: 150-byte fragments at 2.5 fps. Receiving
247
+ * is SLOWER than sending — budget scan timeouts accordingly.
248
+ */
249
+ readonly deviceToPhone: {
250
+ readonly fragmentBytesOnWire: 150;
251
+ readonly frameIntervalMs: 400;
252
+ };
253
+ };
254
+ /** The SDK facade. Cheap to construct; chain modules are created lazily. */
255
+ declare class EraConnect {
256
+ private readonly context;
257
+ private _evm;
258
+ private _btc;
259
+ private _solana;
260
+ private _tron;
261
+ private _raw;
262
+ constructor(config?: EraConnectConfig);
263
+ get evm(): EvmChain;
264
+ get btc(): BtcChain;
265
+ get solana(): SolanaChain;
266
+ get tron(): TronChain;
267
+ /** Escape hatch for UR types without a dedicated module. */
268
+ get raw(): RawModule;
269
+ /**
270
+ * Linking: parse the device's `crypto-multi-accounts` export (a `Ur` from a
271
+ * scanner, or a single-part `ur:` string).
272
+ */
273
+ parseAccounts(input: Ur | string): EraAccounts;
274
+ /**
275
+ * Pull-model linking: ask the device for SPECIFIC derivations
276
+ * (`qr-hardware-call` 1201). The device answers with a
277
+ * `crypto-multi-accounts` export.
278
+ */
279
+ generateKeyDerivationCall(props: KeyDerivationCallProps): HardwareCallRequest;
280
+ /** A type-agnostic hardened scanner (linking flows, raw flows). */
281
+ scanner(options?: UrScannerOptions): UrScanner;
282
+ }
283
+ //#endregion
284
+ export { type AccountChain, type AccountKey, AnimatedUr, type AnimatedUrOptions, BtcAccountView, BtcChain, type BtcMessageSignRequestProps, type BtcMessageSignatureResult, type BtcPsbtResult, type BtcPsbtSignRequestProps, type BtcPurpose, type ChainContext, DEFAULT_FRAGMENT_LENGTH, DEFAULT_ORIGIN, type DerivationAlgorithm, type DerivationCurve, type DeviceInfo, DeviceProfile, EraAccounts, EraConnect, type EraConnectConfig, type EraErrorCode, EraSdkError, EvmAccountView, EvmChain, EvmDataType, type EvmSignRequestProps, type EvmSignatureResult, type ExpectedReply, type HardwareCallRequest, type KeyDerivationCallProps, type KeyDerivationSchema, type RandomBytesFn, RawModule, type ScanFeedResult, type ScanRejection, type SignRequest, type SolSignRequestProps, SolSignType, type SolSignatureResult, SolanaAccountView, SolanaChain, TronAccountView, TronChain, type TronLatestBlock, type TronSignRequestProps, type TronSignatureResult, TypedUrScanner, Ur, UrLimits, UrScanner, type UrScannerOptions, utf8Decode, utf8Encode };
285
+ //# sourceMappingURL=index.d.ts.map