@hwlt/era-connect 0.2.0 → 0.4.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 (112) hide show
  1. package/README.md +6 -6
  2. package/cardano/package.json +6 -0
  3. package/cosmos/package.json +6 -0
  4. package/dist/{btc-DfQ0q79G.d.ts → btc-B8LfSEkv.d.ts} +11 -2
  5. package/dist/{btc-VyJKXq7d.js → btc-B_Nq2H4T.js} +16 -7
  6. package/dist/btc-B_Nq2H4T.js.map +1 -0
  7. package/dist/{btc-Fr6Jz4Fi.cjs → btc-ByzjzUKs.cjs} +19 -10
  8. package/dist/btc-ByzjzUKs.cjs.map +1 -0
  9. package/dist/{btc-Dn6_Y12c.d.cts → btc-C4dVkxHb.d.cts} +11 -2
  10. package/dist/btc.cjs +2 -2
  11. package/dist/btc.d.cts +1 -1
  12. package/dist/btc.d.ts +1 -1
  13. package/dist/btc.js +2 -2
  14. package/dist/cardano-BCT55gwf.js +95 -0
  15. package/dist/cardano-BCT55gwf.js.map +1 -0
  16. package/dist/cardano-CzYswGzK.cjs +106 -0
  17. package/dist/cardano-CzYswGzK.cjs.map +1 -0
  18. package/dist/cardano-Do1ahUlK.d.cts +62 -0
  19. package/dist/cardano-OzjWZHh6.d.ts +62 -0
  20. package/dist/cardano.cjs +10 -0
  21. package/dist/cardano.d.cts +3 -0
  22. package/dist/cardano.d.ts +3 -0
  23. package/dist/cardano.js +3 -0
  24. package/dist/cosmos-BYrhIqRk.d.cts +77 -0
  25. package/dist/cosmos-DDsgtUki.cjs +113 -0
  26. package/dist/cosmos-DDsgtUki.cjs.map +1 -0
  27. package/dist/cosmos-DqyjA6lg.d.ts +77 -0
  28. package/dist/cosmos-jUHNxgWC.js +102 -0
  29. package/dist/cosmos-jUHNxgWC.js.map +1 -0
  30. package/dist/cosmos.cjs +10 -0
  31. package/dist/cosmos.d.cts +3 -0
  32. package/dist/cosmos.d.ts +3 -0
  33. package/dist/cosmos.js +3 -0
  34. package/dist/derive-BayrpfJk.cjs +188 -0
  35. package/dist/derive-BayrpfJk.cjs.map +1 -0
  36. package/dist/derive-CK9Nc9Jc.js +123 -0
  37. package/dist/derive-CK9Nc9Jc.js.map +1 -0
  38. package/dist/{evm-kJb3-oiR.js → evm-CI1cuZsp.js} +3 -2
  39. package/dist/{evm-kJb3-oiR.js.map → evm-CI1cuZsp.js.map} +1 -1
  40. package/dist/{evm-BHj_2OTG.cjs → evm-yfKOc2dy.cjs} +6 -5
  41. package/dist/{evm-BHj_2OTG.cjs.map → evm-yfKOc2dy.cjs.map} +1 -1
  42. package/dist/evm.cjs +2 -2
  43. package/dist/evm.js +2 -2
  44. package/dist/index.cjs +156 -116
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +68 -9
  47. package/dist/index.d.ts +68 -9
  48. package/dist/index.js +125 -94
  49. package/dist/index.js.map +1 -1
  50. package/dist/keypath-Bvv_cfHt.js +75 -0
  51. package/dist/keypath-Bvv_cfHt.js.map +1 -0
  52. package/dist/keypath-pzm_YIfN.cjs +116 -0
  53. package/dist/keypath-pzm_YIfN.cjs.map +1 -0
  54. package/dist/{messages-BzcdWlg1.cjs → messages-BZXDY29v.cjs} +2 -2
  55. package/dist/{messages-BzcdWlg1.cjs.map → messages-BZXDY29v.cjs.map} +1 -1
  56. package/dist/{messages-17Oup0-Z.js → messages-DbnXy3dC.js} +2 -2
  57. package/dist/{messages-17Oup0-Z.js.map → messages-DbnXy3dC.js.map} +1 -1
  58. package/dist/{shared-B8Wc7ViU.js → shared-Bbgejrus.js} +2 -73
  59. package/dist/shared-Bbgejrus.js.map +1 -0
  60. package/dist/{shared-nISrEktU.cjs → shared-Cu2yynP9.cjs} +13 -114
  61. package/dist/shared-Cu2yynP9.cjs.map +1 -0
  62. package/dist/{solana-DdEn24X4.cjs → solana-BoQBy0hu.cjs} +6 -5
  63. package/dist/{solana-DdEn24X4.cjs.map → solana-BoQBy0hu.cjs.map} +1 -1
  64. package/dist/{solana-C7JQEAec.js → solana-BukH3AI3.js} +3 -2
  65. package/dist/{solana-C7JQEAec.js.map → solana-BukH3AI3.js.map} +1 -1
  66. package/dist/solana.cjs +2 -2
  67. package/dist/solana.js +2 -2
  68. package/dist/sui-6WX6VPlW.d.cts +49 -0
  69. package/dist/sui-BtbPG6Xt.js +71 -0
  70. package/dist/sui-BtbPG6Xt.js.map +1 -0
  71. package/dist/sui-CYRn331O.cjs +82 -0
  72. package/dist/sui-CYRn331O.cjs.map +1 -0
  73. package/dist/sui-DI0ruW7E.d.ts +49 -0
  74. package/dist/sui.cjs +10 -0
  75. package/dist/sui.d.cts +3 -0
  76. package/dist/sui.d.ts +3 -0
  77. package/dist/sui.js +3 -0
  78. package/dist/{ton-5Uvi5ifg.js → ton-BSPKU5B9.js} +3 -2
  79. package/dist/{ton-5Uvi5ifg.js.map → ton-BSPKU5B9.js.map} +1 -1
  80. package/dist/{ton-DUJGXdGa.cjs → ton-CI2s9puH.cjs} +6 -5
  81. package/dist/{ton-DUJGXdGa.cjs.map → ton-CI2s9puH.cjs.map} +1 -1
  82. package/dist/ton.cjs +2 -2
  83. package/dist/ton.js +2 -2
  84. package/dist/{tron-CQIEqjCA.cjs → tron-B9wXdzlA.cjs} +7 -6
  85. package/dist/{tron-CQIEqjCA.cjs.map → tron-B9wXdzlA.cjs.map} +1 -1
  86. package/dist/{tron-Bo9HnvVE.js → tron-fufBDNuQ.js} +4 -3
  87. package/dist/{tron-Bo9HnvVE.js.map → tron-fufBDNuQ.js.map} +1 -1
  88. package/dist/tron.cjs +3 -3
  89. package/dist/tron.js +3 -3
  90. package/dist/verify.cjs +335 -4
  91. package/dist/verify.cjs.map +1 -1
  92. package/dist/verify.d.cts +86 -1
  93. package/dist/verify.d.ts +86 -1
  94. package/dist/verify.js +333 -6
  95. package/dist/verify.js.map +1 -1
  96. package/dist/xrp-BXAeK4iH.d.cts +32 -0
  97. package/dist/xrp-BrHXUnX5.cjs +52 -0
  98. package/dist/xrp-BrHXUnX5.cjs.map +1 -0
  99. package/dist/xrp-C8LJO5b-.js +47 -0
  100. package/dist/xrp-C8LJO5b-.js.map +1 -0
  101. package/dist/xrp-DqCXGYEk.d.ts +32 -0
  102. package/dist/xrp.cjs +9 -0
  103. package/dist/xrp.d.cts +3 -0
  104. package/dist/xrp.d.ts +3 -0
  105. package/dist/xrp.js +3 -0
  106. package/package.json +49 -1
  107. package/sui/package.json +6 -0
  108. package/xrp/package.json +6 -0
  109. package/dist/btc-Fr6Jz4Fi.cjs.map +0 -1
  110. package/dist/btc-VyJKXq7d.js.map +0 -1
  111. package/dist/shared-B8Wc7ViU.js.map +0 -1
  112. package/dist/shared-nISrEktU.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shared = require("./shared-nISrEktU.cjs");
3
- const require_btc = require("./btc-Fr6Jz4Fi.cjs");
4
- const require_evm = require("./evm-BHj_2OTG.cjs");
5
- const require_solana = require("./solana-DdEn24X4.cjs");
6
- const require_ton = require("./ton-DUJGXdGa.cjs");
7
- const require_tron = require("./tron-CQIEqjCA.cjs");
8
- let _noble_curves_secp256k1 = require("@noble/curves/secp256k1");
9
- let _noble_hashes_ripemd160 = require("@noble/hashes/ripemd160");
10
- let _noble_hashes_sha2 = require("@noble/hashes/sha2");
11
- let _noble_hashes_sha3 = require("@noble/hashes/sha3");
12
- let _scure_base = require("@scure/base");
13
- let _scure_bip32 = require("@scure/bip32");
2
+ const require_shared = require("./shared-Cu2yynP9.cjs");
3
+ const require_keypath = require("./keypath-pzm_YIfN.cjs");
4
+ const require_derive = require("./derive-BayrpfJk.cjs");
5
+ const require_btc = require("./btc-ByzjzUKs.cjs");
6
+ const require_cardano = require("./cardano-CzYswGzK.cjs");
7
+ const require_cosmos = require("./cosmos-DDsgtUki.cjs");
8
+ const require_evm = require("./evm-yfKOc2dy.cjs");
9
+ const require_solana = require("./solana-BoQBy0hu.cjs");
10
+ const require_sui = require("./sui-CYRn331O.cjs");
11
+ const require_ton = require("./ton-CI2s9puH.cjs");
12
+ const require_tron = require("./tron-B9wXdzlA.cjs");
13
+ const require_xrp = require("./xrp-BrHXUnX5.cjs");
14
14
  //#region src/registry/multi-accounts.ts
15
15
  /** UR types a device links a watch-only wallet with. */
16
16
  const WALLET_UR_TYPES = /* @__PURE__ */ new Set([
@@ -54,7 +54,7 @@ function parseMultiAccountsUr(input) {
54
54
  const entry = tryParseEntry(decoded);
55
55
  if (!entry) throw new require_shared.EraSdkError("malformed-reply", "crypto-hdkey export carries no derivable account (missing origin keypath)");
56
56
  return {
57
- masterFingerprint: entry.xfp,
57
+ masterFingerprint: entry.xfp ?? 0,
58
58
  deviceName: null,
59
59
  deviceId: null,
60
60
  deviceVersion: null,
@@ -83,13 +83,14 @@ function tryParseEntry(item) {
83
83
  if (!map) return null;
84
84
  const origin = require_shared.asMap(require_shared.mapGet(map, 6));
85
85
  if (!origin) return null;
86
- const path = require_shared.parsePathComponents(require_shared.mapGet(origin, 1));
87
- const xfp = require_shared.asUint(require_shared.mapGet(origin, 2));
88
- if (!path || path.length === 0 || xfp === void 0 || xfp > 4294967295n) return null;
86
+ const path = require_keypath.parsePathComponents(require_shared.mapGet(origin, 1));
87
+ if (!path || path.length === 0) return null;
88
+ const xfpValue = require_shared.asUint(require_shared.mapGet(origin, 2));
89
+ const xfp = xfpValue !== void 0 && xfpValue <= 4294967295n ? Number(xfpValue) : null;
89
90
  const parentFp = require_shared.asUint(require_shared.mapGet(map, 8));
90
91
  return {
91
92
  path,
92
- xfp: Number(xfp),
93
+ xfp,
93
94
  publicKey: require_shared.asBytes(require_shared.mapGet(map, 3)) ?? null,
94
95
  chainCode: require_shared.asBytes(require_shared.mapGet(map, 4)) ?? null,
95
96
  parentFingerprint: parentFp !== void 0 && parentFp <= 4294967295n ? Number(parentFp) : null,
@@ -98,66 +99,6 @@ function tryParseEntry(item) {
98
99
  };
99
100
  }
100
101
  //#endregion
101
- //#region src/accounts/derive.ts
102
- const base58check = (0, _scure_base.createBase58check)(_noble_hashes_sha2.sha256);
103
- /** Non-hardened BIP-32 child public key from an account-level (publicKey, chainCode). */
104
- function derivePublicKey(publicKey, chainCode, change, index) {
105
- const child = new _scure_bip32.HDKey({
106
- publicKey,
107
- chainCode
108
- }).deriveChild(change).deriveChild(index);
109
- if (!child.publicKey) throw new require_shared.EraSdkError("invalid-props", "child derivation produced no public key");
110
- return child.publicKey;
111
- }
112
- function uncompressed(publicKey33) {
113
- return _noble_curves_secp256k1.secp256k1.ProjectivePoint.fromHex(publicKey33).toRawBytes(false);
114
- }
115
- /** EIP-55 checksummed address from a compressed secp256k1 public key. */
116
- function evmAddressFromPublicKey(publicKey33) {
117
- const hash = (0, _noble_hashes_sha3.keccak_256)(uncompressed(publicKey33).slice(1));
118
- const addr = require_shared.bytesToHex(hash.slice(12));
119
- const check = (0, _noble_hashes_sha3.keccak_256)(new Uint8Array([...addr].map((c) => c.charCodeAt(0))));
120
- let out = "";
121
- for (let i = 0; i < addr.length; i++) {
122
- const nibble = i % 2 === 0 ? check[i >> 1] >> 4 : check[i >> 1] & 15;
123
- out += nibble >= 8 ? addr[i].toUpperCase() : addr[i];
124
- }
125
- return `0x${out}`;
126
- }
127
- function hash160(data) {
128
- return (0, _noble_hashes_ripemd160.ripemd160)((0, _noble_hashes_sha2.sha256)(data));
129
- }
130
- /** P2WPKH (witness v0) bech32 address. */
131
- function btcP2wpkhAddressFromPublicKey(publicKey33, hrp = "bc") {
132
- return _scure_base.bech32.encode(hrp, [0, ..._scure_base.bech32.toWords(hash160(publicKey33))]);
133
- }
134
- /** Legacy P2PKH base58check address (`1...`) — the kind the device signs messages for. */
135
- function btcP2pkhAddressFromPublicKey(publicKey33, testnet = false) {
136
- return base58check.encode(require_shared.concatBytes(new Uint8Array([testnet ? 111 : 0]), hash160(publicKey33)));
137
- }
138
- /** Nested segwit (P2SH-P2WPKH) base58check address (`3...`). */
139
- function btcNestedSegwitAddressFromPublicKey(publicKey33, testnet = false) {
140
- const redeemScript = require_shared.concatBytes(new Uint8Array([0, 20]), hash160(publicKey33));
141
- return base58check.encode(require_shared.concatBytes(new Uint8Array([testnet ? 196 : 5]), hash160(redeemScript)));
142
- }
143
- /** Tron base58check address (0x41-prefixed keccak hash). */
144
- function tronAddressFromPublicKey(publicKey33) {
145
- const hash = (0, _noble_hashes_sha3.keccak_256)(uncompressed(publicKey33).slice(1));
146
- return base58check.encode(require_shared.concatBytes(new Uint8Array([65]), hash.slice(12)));
147
- }
148
- /** A Solana address IS the Ed25519 public key, base58. */
149
- function solanaAddressFromPublicKey(publicKey32) {
150
- return _scure_base.base58.encode(publicKey32);
151
- }
152
- const XPUB_VERSION = 76067358;
153
- const ZPUB_VERSION = 78792518;
154
- /** BIP-32 extended public key serialization. */
155
- function serializeExtendedPublicKey(args) {
156
- const { version = XPUB_VERSION, depth, parentFingerprint, childNumber, chainCode, publicKey } = args;
157
- if (chainCode.length !== 32 || publicKey.length !== 33) throw new require_shared.EraSdkError("invalid-props", "extended key needs a 32-byte chain code and 33-byte key");
158
- return base58check.encode(require_shared.concatBytes(require_shared.u32be(version), new Uint8Array([depth & 255]), require_shared.u32be(parentFingerprint), require_shared.u32be(childNumber), chainCode, publicKey));
159
- }
160
- //#endregion
161
102
  //#region src/accounts/accounts.ts
162
103
  function classify(path) {
163
104
  const p0 = path[0];
@@ -168,34 +109,38 @@ function classify(path) {
168
109
  if (p0.index === 44 && p1.index === 501) return "solana";
169
110
  if (p0.index === 44 && p1.index === 195) return "tron";
170
111
  if (p0.index === 44 && p1.index === 607) return "ton";
112
+ if (p0.index === 1852 && p1.index === 1815) return "cardano";
113
+ if (p0.index === 44 && p1.index === 784) return "sui";
114
+ if (p0.index === 44 && p1.index === 118) return "cosmos";
171
115
  return "unknown";
172
116
  }
173
117
  function withChainCode(entry) {
174
- if (!entry.chainCode) throw new require_shared.EraSdkError("account-not-found", `account ${require_shared.formatPath([...entry.path])} carries no chain code; cannot derive children`);
118
+ if (!entry.chainCode) throw new require_shared.EraSdkError("account-not-found", `account ${require_keypath.formatPath([...entry.path])} carries no chain code; cannot derive children`);
175
119
  return entry.chainCode;
176
120
  }
177
121
  /** The entry's key at the required length, or a typed refusal (derivation only). */
178
122
  function requireKey(entry, length) {
179
- if (!entry.publicKey || entry.publicKey.length !== length) throw new require_shared.EraSdkError("invalid-props", `account ${require_shared.formatPath([...entry.path])} carries no ${length}-byte public key; xfp lookup still works, address derivation does not`);
123
+ if (!entry.publicKey || entry.publicKey.length !== length) throw new require_shared.EraSdkError("invalid-props", `account ${require_keypath.formatPath([...entry.path])} carries no ${length}-byte public key; xfp lookup still works, address derivation does not`);
180
124
  return entry.publicKey;
181
125
  }
182
126
  /** EVM view over the linked wallet: one account xpub, addresses derived at `0/index`. */
183
127
  var EvmAccountView = class {
184
- constructor(entry) {
128
+ constructor(entry, resolvedXfp) {
185
129
  this.entry = entry;
130
+ this.resolvedXfp = resolvedXfp;
186
131
  }
187
132
  get xfp() {
188
- return require_shared.xfpToHex(this.entry.xfp);
133
+ return require_keypath.xfpToHex(this.resolvedXfp);
189
134
  }
190
135
  get accountPath() {
191
- return require_shared.formatPath([...this.entry.path]);
136
+ return require_keypath.formatPath([...this.entry.path]);
192
137
  }
193
138
  /** Signing path for address `index`: `<account>/0/<index>`. */
194
139
  pathFor(index) {
195
140
  return `${this.accountPath}/0/${index}`;
196
141
  }
197
142
  deriveAddress(index) {
198
- return evmAddressFromPublicKey(derivePublicKey(requireKey(this.entry, 33), withChainCode(this.entry), 0, index));
143
+ return require_derive.evmAddressFromPublicKey(require_derive.derivePublicKey(requireKey(this.entry, 33), withChainCode(this.entry), 0, index));
199
144
  }
200
145
  xpub() {
201
146
  return extendedKeyOf(this.entry);
@@ -208,16 +153,17 @@ var EvmAccountView = class {
208
153
  * 49 = nested segwit, 86 = taproot).
209
154
  */
210
155
  var BtcAccountView = class {
211
- constructor(entry, testnet, purpose) {
156
+ constructor(entry, testnet, purpose, resolvedXfp) {
212
157
  this.entry = entry;
213
158
  this.testnet = testnet;
214
159
  this.purpose = purpose;
160
+ this.resolvedXfp = resolvedXfp;
215
161
  }
216
162
  get xfp() {
217
- return require_shared.xfpToHex(this.entry.xfp);
163
+ return require_keypath.xfpToHex(this.resolvedXfp);
218
164
  }
219
165
  get accountPath() {
220
- return require_shared.formatPath([...this.entry.path]);
166
+ return require_keypath.formatPath([...this.entry.path]);
221
167
  }
222
168
  receivePath(index) {
223
169
  return `${this.accountPath}/0/${index}`;
@@ -227,11 +173,11 @@ var BtcAccountView = class {
227
173
  }
228
174
  deriveAddress(index, options) {
229
175
  const change = options?.change ? 1 : 0;
230
- const child = derivePublicKey(requireKey(this.entry, 33), withChainCode(this.entry), change, index);
176
+ const child = require_derive.derivePublicKey(requireKey(this.entry, 33), withChainCode(this.entry), change, index);
231
177
  switch (this.purpose) {
232
- case 84: return btcP2wpkhAddressFromPublicKey(child, this.testnet ? "tb" : "bc");
233
- case 44: return btcP2pkhAddressFromPublicKey(child, this.testnet);
234
- case 49: return btcNestedSegwitAddressFromPublicKey(child, this.testnet);
178
+ case 84: return require_derive.btcP2wpkhAddressFromPublicKey(child, this.testnet ? "tb" : "bc");
179
+ case 44: return require_derive.btcP2pkhAddressFromPublicKey(child, this.testnet);
180
+ case 49: return require_derive.btcNestedSegwitAddressFromPublicKey(child, this.testnet);
235
181
  case 86: throw new require_shared.EraSdkError("invalid-props", "taproot addresses need the BIP-341 output-key tweak; derive them from xpub() with your Bitcoin library");
236
182
  }
237
183
  }
@@ -241,25 +187,26 @@ var BtcAccountView = class {
241
187
  /** SLIP-132 zpub form of the BIP-84 key, for tools that require it. */
242
188
  zpub() {
243
189
  if (this.purpose !== 84) throw new require_shared.EraSdkError("invalid-props", "zpub is the SLIP-132 form of the BIP-84 account only");
244
- return extendedKeyOf(this.entry, ZPUB_VERSION);
190
+ return extendedKeyOf(this.entry, require_derive.ZPUB_VERSION);
245
191
  }
246
192
  };
247
193
  /** Tron view: addresses derived at `0/index`. */
248
194
  var TronAccountView = class {
249
- constructor(entry) {
195
+ constructor(entry, resolvedXfp) {
250
196
  this.entry = entry;
197
+ this.resolvedXfp = resolvedXfp;
251
198
  }
252
199
  get xfp() {
253
- return require_shared.xfpToHex(this.entry.xfp);
200
+ return require_keypath.xfpToHex(this.resolvedXfp);
254
201
  }
255
202
  get accountPath() {
256
- return require_shared.formatPath([...this.entry.path]);
203
+ return require_keypath.formatPath([...this.entry.path]);
257
204
  }
258
205
  pathFor(index) {
259
206
  return `${this.accountPath}/0/${index}`;
260
207
  }
261
208
  deriveAddress(index) {
262
- return tronAddressFromPublicKey(derivePublicKey(requireKey(this.entry, 33), withChainCode(this.entry), 0, index));
209
+ return require_derive.tronAddressFromPublicKey(require_derive.derivePublicKey(requireKey(this.entry, 33), withChainCode(this.entry), 0, index));
263
210
  }
264
211
  };
265
212
  /**
@@ -269,14 +216,15 @@ var TronAccountView = class {
269
216
  * with @ton/core or equivalent).
270
217
  */
271
218
  var TonAccountView = class {
272
- constructor(entry) {
219
+ constructor(entry, resolvedXfp) {
273
220
  this.entry = entry;
221
+ this.resolvedXfp = resolvedXfp;
274
222
  }
275
223
  get xfp() {
276
- return require_shared.xfpToHex(this.entry.xfp);
224
+ return require_keypath.xfpToHex(this.resolvedXfp);
277
225
  }
278
226
  get accountPath() {
279
- return require_shared.formatPath([...this.entry.path]);
227
+ return require_keypath.formatPath([...this.entry.path]);
280
228
  }
281
229
  /** 32-byte Ed25519 public key — the signer for both wallet-contract versions. */
282
230
  get publicKey() {
@@ -287,19 +235,73 @@ var TonAccountView = class {
287
235
  }
288
236
  };
289
237
  /**
238
+ * Cardano view (CIP-1852): the exported account key supports SOFT public
239
+ * derivation (BIP32-Ed25519), so payment (`0/i`), change (`1/i`) and stake
240
+ * (`2/0`) verification keys derive locally. Bech32 ADDRESS assembly is left
241
+ * to Cardano tooling — `deriveKey` hands you the raw vkeys it needs.
242
+ */
243
+ var CardanoAccountView = class {
244
+ constructor(entry, resolvedXfp) {
245
+ this.entry = entry;
246
+ this.resolvedXfp = resolvedXfp;
247
+ }
248
+ get xfp() {
249
+ return require_keypath.xfpToHex(this.resolvedXfp);
250
+ }
251
+ get accountPath() {
252
+ return require_keypath.formatPath([...this.entry.path]);
253
+ }
254
+ /** The account-level extended public key material. */
255
+ get publicKey() {
256
+ return requireKey(this.entry, 32);
257
+ }
258
+ get chainCode() {
259
+ return withChainCode(this.entry);
260
+ }
261
+ /** Signing path for `role/index`, e.g. `pathFor(0, 0)` → `.../0/0`. */
262
+ pathFor(role, index) {
263
+ return `${this.accountPath}/${role}/${index}`;
264
+ }
265
+ /** Soft-derived 32-byte verification key at `role/index` (0 payment, 1 change, 2 stake). */
266
+ deriveKey(role, index) {
267
+ return require_derive.cardanoSoftDerivePath(requireKey(this.entry, 32), withChainCode(this.entry), [role, index]);
268
+ }
269
+ };
270
+ /** Sui view: like Solana, each fully-hardened exported entry IS a signer. */
271
+ var SuiAccountView = class {
272
+ constructor(entry, resolvedXfp) {
273
+ this.entry = entry;
274
+ this.resolvedXfp = resolvedXfp;
275
+ }
276
+ get xfp() {
277
+ return require_keypath.xfpToHex(this.resolvedXfp);
278
+ }
279
+ get path() {
280
+ return require_keypath.formatPath([...this.entry.path]);
281
+ }
282
+ get publicKey() {
283
+ return requireKey(this.entry, 32);
284
+ }
285
+ /** `0x` Sui address: BLAKE2b-256 of `0x00 || publicKey`. */
286
+ get address() {
287
+ return require_derive.suiAddressFromPublicKey(requireKey(this.entry, 32));
288
+ }
289
+ };
290
+ /**
290
291
  * Solana view: Ed25519 has no public child derivation, so the device
291
292
  * pre-derives hardened accounts (`m/44'/501'/idx'`) and each entry IS a
292
293
  * signer. The public key, base58, IS the address.
293
294
  */
294
295
  var SolanaAccountView = class {
295
- constructor(entry) {
296
+ constructor(entry, resolvedXfp) {
296
297
  this.entry = entry;
298
+ this.resolvedXfp = resolvedXfp;
297
299
  }
298
300
  get xfp() {
299
- return require_shared.xfpToHex(this.entry.xfp);
301
+ return require_keypath.xfpToHex(this.resolvedXfp);
300
302
  }
301
303
  get path() {
302
- return require_shared.formatPath([...this.entry.path]);
304
+ return require_keypath.formatPath([...this.entry.path]);
303
305
  }
304
306
  /** The hardened account index (third path level). */
305
307
  get index() {
@@ -309,7 +311,7 @@ var SolanaAccountView = class {
309
311
  return requireKey(this.entry, 32);
310
312
  }
311
313
  get address() {
312
- return solanaAddressFromPublicKey(requireKey(this.entry, 32));
314
+ return require_derive.solanaAddressFromPublicKey(requireKey(this.entry, 32));
313
315
  }
314
316
  };
315
317
  function extendedKeyOf(entry, version) {
@@ -323,7 +325,7 @@ function extendedKeyOf(entry, version) {
323
325
  chainCode,
324
326
  publicKey
325
327
  };
326
- return version === void 0 ? serializeExtendedPublicKey(args) : serializeExtendedPublicKey({
328
+ return version === void 0 ? require_derive.serializeExtendedPublicKey(args) : require_derive.serializeExtendedPublicKey({
327
329
  ...args,
328
330
  version
329
331
  });
@@ -344,7 +346,7 @@ var EraAccounts = class EraAccounts {
344
346
  }
345
347
  /** Master fingerprint, lowercase 8-hex. */
346
348
  get masterFingerprint() {
347
- return require_shared.xfpToHex(this.raw.masterFingerprint);
349
+ return require_keypath.xfpToHex(this.raw.masterFingerprint);
348
350
  }
349
351
  get device() {
350
352
  return {
@@ -356,8 +358,8 @@ var EraAccounts = class EraAccounts {
356
358
  get keys() {
357
359
  return this.raw.entries.map((entry) => ({
358
360
  chain: classify(entry.path),
359
- path: require_shared.formatPath([...entry.path]),
360
- xfp: require_shared.xfpToHex(entry.xfp),
361
+ path: require_keypath.formatPath([...entry.path]),
362
+ xfp: require_keypath.xfpToHex(entry.xfp ?? this.raw.masterFingerprint),
361
363
  publicKey: entry.publicKey ?? void 0,
362
364
  chainCode: entry.chainCode ?? void 0,
363
365
  name: entry.name ?? void 0,
@@ -369,12 +371,16 @@ var EraAccounts = class EraAccounts {
369
371
  * equals `accountPath`. Throws `account-not-found` — never a silent zero.
370
372
  */
371
373
  xfpFor(accountPath) {
372
- return require_shared.xfpToHex(this.entryFor(accountPath).xfp);
374
+ return require_keypath.xfpToHex(this.resolveXfp(this.entryFor(accountPath)));
375
+ }
376
+ /** Entry xfp, falling back to the wrapper's master fingerprint (Cardano-style path-only origins). */
377
+ resolveXfp(entry) {
378
+ return entry.xfp ?? this.raw.masterFingerprint;
373
379
  }
374
380
  /** The EVM account (standard `m/44'/60'/...` scheme), if the export carries one. */
375
381
  evm() {
376
382
  const entry = this.raw.entries.find((e) => classify(e.path) === "evm" && (e.note === null || e.note === "account.standard")) ?? this.raw.entries.find((e) => classify(e.path) === "evm");
377
- return entry ? new EvmAccountView(entry) : void 0;
383
+ return entry ? new EvmAccountView(entry, this.resolveXfp(entry)) : void 0;
378
384
  }
379
385
  /**
380
386
  * A Bitcoin account view. Defaults to the BIP-84 native-segwit account;
@@ -384,24 +390,33 @@ var EraAccounts = class EraAccounts {
384
390
  btc(options) {
385
391
  const purpose = options?.purpose ?? 84;
386
392
  const entry = this.raw.entries.find((e) => classify(e.path) === "btc" && e.path[0]?.index === purpose);
387
- return entry ? new BtcAccountView(entry, options?.testnet ?? false, purpose) : void 0;
393
+ return entry ? new BtcAccountView(entry, options?.testnet ?? false, purpose, this.resolveXfp(entry)) : void 0;
388
394
  }
389
395
  tron() {
390
396
  const entry = this.raw.entries.find((e) => classify(e.path) === "tron");
391
- return entry ? new TronAccountView(entry) : void 0;
397
+ return entry ? new TronAccountView(entry, this.resolveXfp(entry)) : void 0;
392
398
  }
393
399
  /** The TON account (linked via the Tonkeeper-style `crypto-hdkey` export). */
394
400
  ton() {
395
401
  const entry = this.raw.entries.find((e) => classify(e.path) === "ton" && e.publicKey?.length === 32);
396
- return entry ? new TonAccountView(entry) : void 0;
402
+ return entry ? new TonAccountView(entry, this.resolveXfp(entry)) : void 0;
403
+ }
404
+ /** All exported Sui signers (fully hardened SLIP-10 entries). */
405
+ sui() {
406
+ return this.raw.entries.filter((e) => classify(e.path) === "sui" && e.publicKey?.length === 32).map((e) => new SuiAccountView(e, this.resolveXfp(e)));
407
+ }
408
+ /** The Cardano account (CIP-1852 Icarus export), if the export carries one. */
409
+ cardano() {
410
+ const entry = this.raw.entries.find((e) => classify(e.path) === "cardano" && e.publicKey?.length === 32);
411
+ return entry ? new CardanoAccountView(entry, this.resolveXfp(entry)) : void 0;
397
412
  }
398
413
  /** All pre-derived Solana signers (usually `m/44'/501'/0'..9'`). */
399
414
  solana() {
400
- return this.raw.entries.filter((e) => classify(e.path) === "solana" && e.publicKey?.length === 32).map((e) => new SolanaAccountView(e));
415
+ return this.raw.entries.filter((e) => classify(e.path) === "solana" && e.publicKey?.length === 32).map((e) => new SolanaAccountView(e, this.resolveXfp(e)));
401
416
  }
402
417
  entryFor(accountPath) {
403
- const levels = require_shared.parsePath(accountPath);
404
- const entry = this.raw.entries.find((e) => require_shared.pathEquals(e.path, levels));
418
+ const levels = require_keypath.parsePath(accountPath);
419
+ const entry = this.raw.entries.find((e) => require_keypath.pathEquals(e.path, levels));
405
420
  if (!entry) throw new require_shared.EraSdkError("account-not-found", `the linked wallet carries no account at ${accountPath}`, { path: accountPath });
406
421
  return entry;
407
422
  }
@@ -429,9 +444,9 @@ const ALGOS = {
429
444
  function generateKeyDerivationCall(context, props) {
430
445
  if (props.schemas.length === 0) throw new require_shared.EraSdkError("invalid-props", "at least one derivation schema is required");
431
446
  const schemas = props.schemas.map((schema) => {
432
- const levels = require_shared.parsePath(schema.path);
447
+ const levels = require_keypath.parsePath(schema.path);
433
448
  const entries = [
434
- [1, require_shared.keypath304(levels)],
449
+ [1, require_keypath.keypath304(levels)],
435
450
  [2, require_shared.cbUint(CURVES[schema.curve ?? "secp256k1"])],
436
451
  [3, require_shared.cbUint(ALGOS[schema.algo ?? "slip10"])]
437
452
  ];
@@ -522,6 +537,22 @@ var EraConnect = class {
522
537
  this._ton ?? (this._ton = new require_ton.TonChain(this.context));
523
538
  return this._ton;
524
539
  }
540
+ get cardano() {
541
+ this._cardano ?? (this._cardano = new require_cardano.CardanoChain(this.context));
542
+ return this._cardano;
543
+ }
544
+ get sui() {
545
+ this._sui ?? (this._sui = new require_sui.SuiChain(this.context));
546
+ return this._sui;
547
+ }
548
+ get cosmos() {
549
+ this._cosmos ?? (this._cosmos = new require_cosmos.CosmosChain(this.context));
550
+ return this._cosmos;
551
+ }
552
+ get xrp() {
553
+ this._xrp ?? (this._xrp = new require_xrp.XrpChain(this.context));
554
+ return this._xrp;
555
+ }
525
556
  /** Escape hatch for UR types without a dedicated module. */
526
557
  get raw() {
527
558
  this._raw ?? (this._raw = new RawModule(this.context));
@@ -551,6 +582,10 @@ var EraConnect = class {
551
582
  exports.AnimatedUr = require_shared.AnimatedUr;
552
583
  exports.BtcAccountView = BtcAccountView;
553
584
  exports.BtcChain = require_btc.BtcChain;
585
+ exports.CardanoAccountView = CardanoAccountView;
586
+ exports.CardanoChain = require_cardano.CardanoChain;
587
+ exports.CosmosChain = require_cosmos.CosmosChain;
588
+ exports.CosmosDataType = require_cosmos.CosmosDataType;
554
589
  exports.DEFAULT_FRAGMENT_LENGTH = require_shared.DEFAULT_FRAGMENT_LENGTH;
555
590
  exports.DEFAULT_ORIGIN = require_shared.DEFAULT_ORIGIN;
556
591
  exports.DeviceProfile = DeviceProfile;
@@ -564,6 +599,8 @@ exports.RawModule = RawModule;
564
599
  exports.SolSignType = require_solana.SolSignType;
565
600
  exports.SolanaAccountView = SolanaAccountView;
566
601
  exports.SolanaChain = require_solana.SolanaChain;
602
+ exports.SuiAccountView = SuiAccountView;
603
+ exports.SuiChain = require_sui.SuiChain;
567
604
  exports.TonAccountView = TonAccountView;
568
605
  exports.TonChain = require_ton.TonChain;
569
606
  exports.TonDataType = require_ton.TonDataType;
@@ -573,6 +610,9 @@ exports.TypedUrScanner = require_shared.TypedUrScanner;
573
610
  exports.Ur = require_shared.Ur;
574
611
  exports.UrLimits = require_shared.UrLimits;
575
612
  exports.UrScanner = require_shared.UrScanner;
613
+ exports.XrpChain = require_xrp.XrpChain;
614
+ exports.parseWitnessSet = require_cardano.parseWitnessSet;
615
+ exports.suiIntentDigest = require_sui.suiIntentDigest;
576
616
  exports.utf8Decode = require_shared.utf8Decode;
577
617
  exports.utf8Encode = require_shared.utf8Encode;
578
618