decane-connect-kit 2.3.1 → 2.5.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.
package/dist/index.d.cts CHANGED
@@ -175,6 +175,7 @@ declare class ApiClient {
175
175
  getAddresses(jwt: string): Promise<{
176
176
  evm: string | null;
177
177
  solana: string | null;
178
+ tron: string | null;
178
179
  }>;
179
180
  putShare(jwt: string, share: {
180
181
  ciphertext: Uint8Array;
@@ -182,7 +183,18 @@ declare class ApiClient {
182
183
  wrappedShareMeta: WrappedShareMeta;
183
184
  evmAddress: string;
184
185
  solanaAddress: string;
186
+ tronAddress: string;
185
187
  }): Promise<void>;
188
+ recordTransaction(jwt: string, tx: {
189
+ chain: string;
190
+ txHash?: string;
191
+ to?: string;
192
+ value?: string;
193
+ kind?: string;
194
+ status?: string;
195
+ metadata?: Record<string, unknown>;
196
+ }): Promise<TransactionRecord>;
197
+ getTransactions(jwt: string, limit?: number): Promise<TransactionRecord[]>;
186
198
  getWebAuthnRegisterOptions(jwt: string, rpId: string, rpName: string): Promise<_simplewebauthn_browser.PublicKeyCredentialCreationOptionsJSON>;
187
199
  postWebAuthnRegister(jwt: string, response: _simplewebauthn_browser.RegistrationResponseJSON, origin: string): Promise<void>;
188
200
  /**
@@ -327,7 +339,7 @@ interface SignedAuthorization {
327
339
  s: string;
328
340
  }
329
341
 
330
- type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
342
+ type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}` | `tron:${'mainnet' | 'shasta' | 'nile'}`;
331
343
  interface DecaneConnectConfig {
332
344
  /** Dashboard project ID (public). Sent with every request so the backend can
333
345
  * confirm the API key below actually belongs to this project. */
@@ -405,9 +417,33 @@ interface ConnectResult {
405
417
  addresses: {
406
418
  evm?: string;
407
419
  solana?: string;
420
+ tron?: string;
408
421
  };
409
422
  isNewUser: boolean;
410
423
  }
424
+ /** A recorded on-chain transaction in the user's history. */
425
+ interface TransactionRecord {
426
+ id: string;
427
+ chain: string;
428
+ kind: string;
429
+ txHash: string | null;
430
+ to: string | null;
431
+ value: string | null;
432
+ status: 'submitted' | 'confirmed' | 'failed' | string;
433
+ metadata: Record<string, unknown> | null;
434
+ createdAt: string;
435
+ updatedAt?: string;
436
+ }
437
+ /** What the dApp passes to record a transaction it broadcast. */
438
+ interface RecordTransactionInput {
439
+ chain: string;
440
+ txHash?: string;
441
+ to?: string;
442
+ value?: string;
443
+ kind?: string;
444
+ status?: string;
445
+ metadata?: Record<string, unknown>;
446
+ }
411
447
  interface SignMessageRequest {
412
448
  chain: Chain;
413
449
  message: string | Uint8Array;
@@ -510,10 +546,28 @@ interface DecaneConnect {
510
546
  */
511
547
  getAccessToken(): string | null;
512
548
  signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
549
+ /**
550
+ * Sign a Tron transaction. Pass the transaction's `raw_data_hex` (the value
551
+ * TronWeb puts on a built transaction). The enclave computes the txID
552
+ * (sha256(raw_data)) and signs it with the same secp256k1 key as the EVM
553
+ * wallet; returns the 65-byte recoverable signature as 0x-hex. Attach it to
554
+ * the transaction's `signature` array and broadcast via TronWeb / a full node.
555
+ */
556
+ signTronTransaction(rawDataHex: string): Promise<string>;
557
+ /**
558
+ * Record a transaction this wallet broadcast, so it appears in the user's
559
+ * history (and the developer dashboard). EVM `sendTransaction` records itself
560
+ * automatically; call this for Solana/Tron transactions your dApp broadcasts,
561
+ * or to attach a `confirmed`/`failed` status update to an existing hash.
562
+ */
563
+ recordTransaction(tx: RecordTransactionInput): Promise<TransactionRecord>;
564
+ /** The user's transaction history, most recent first. Requires a live session. */
565
+ getTransactionHistory(limit?: number): Promise<TransactionRecord[]>;
513
566
  disconnect(): Promise<void>;
514
567
  getAddresses(): {
515
568
  evm?: string;
516
569
  solana?: string;
570
+ tron?: string;
517
571
  } | null;
518
572
  /**
519
573
  * Native-token balance for a chain (defaults to the first configured EVM
@@ -780,6 +834,7 @@ interface SocialAuthState {
780
834
  addresses: {
781
835
  evm?: string;
782
836
  solana?: string;
837
+ tron?: string;
783
838
  } | null;
784
839
  isNewUser: boolean;
785
840
  isUnlocked: boolean;
@@ -864,6 +919,7 @@ declare function useSocialAuth(): {
864
919
  addresses: {
865
920
  evm?: string;
866
921
  solana?: string;
922
+ tron?: string;
867
923
  } | null;
868
924
  sessionExpiresAt: number | null;
869
925
  canUsePasskey: boolean;
@@ -897,6 +953,7 @@ declare function useSocialWallet(): {
897
953
  addresses: {
898
954
  evm?: string;
899
955
  solana?: string;
956
+ tron?: string;
900
957
  } | null;
901
958
  sessionExpiresAt: number | null;
902
959
  needsReconnect: boolean;
@@ -917,6 +974,9 @@ declare function useSocialWallet(): {
917
974
  gasPrice?: bigint;
918
975
  }) => Promise<string>;
919
976
  signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
977
+ signTronTransaction: (rawDataHex: string) => Promise<string>;
978
+ recordTransaction: (tx: RecordTransactionInput) => Promise<TransactionRecord>;
979
+ getTransactionHistory: (limit?: number) => Promise<TransactionRecord[]>;
920
980
  signTypedData: (req: {
921
981
  chain: string;
922
982
  domain: Record<string, unknown>;
@@ -1035,4 +1095,4 @@ declare function useSignTypedData(): {
1035
1095
  reset: () => void;
1036
1096
  };
1037
1097
 
1038
- export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
1098
+ export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, type RecordTransactionInput, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TransactionRecord, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
package/dist/index.d.ts CHANGED
@@ -175,6 +175,7 @@ declare class ApiClient {
175
175
  getAddresses(jwt: string): Promise<{
176
176
  evm: string | null;
177
177
  solana: string | null;
178
+ tron: string | null;
178
179
  }>;
179
180
  putShare(jwt: string, share: {
180
181
  ciphertext: Uint8Array;
@@ -182,7 +183,18 @@ declare class ApiClient {
182
183
  wrappedShareMeta: WrappedShareMeta;
183
184
  evmAddress: string;
184
185
  solanaAddress: string;
186
+ tronAddress: string;
185
187
  }): Promise<void>;
188
+ recordTransaction(jwt: string, tx: {
189
+ chain: string;
190
+ txHash?: string;
191
+ to?: string;
192
+ value?: string;
193
+ kind?: string;
194
+ status?: string;
195
+ metadata?: Record<string, unknown>;
196
+ }): Promise<TransactionRecord>;
197
+ getTransactions(jwt: string, limit?: number): Promise<TransactionRecord[]>;
186
198
  getWebAuthnRegisterOptions(jwt: string, rpId: string, rpName: string): Promise<_simplewebauthn_browser.PublicKeyCredentialCreationOptionsJSON>;
187
199
  postWebAuthnRegister(jwt: string, response: _simplewebauthn_browser.RegistrationResponseJSON, origin: string): Promise<void>;
188
200
  /**
@@ -327,7 +339,7 @@ interface SignedAuthorization {
327
339
  s: string;
328
340
  }
329
341
 
330
- type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
342
+ type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}` | `tron:${'mainnet' | 'shasta' | 'nile'}`;
331
343
  interface DecaneConnectConfig {
332
344
  /** Dashboard project ID (public). Sent with every request so the backend can
333
345
  * confirm the API key below actually belongs to this project. */
@@ -405,9 +417,33 @@ interface ConnectResult {
405
417
  addresses: {
406
418
  evm?: string;
407
419
  solana?: string;
420
+ tron?: string;
408
421
  };
409
422
  isNewUser: boolean;
410
423
  }
424
+ /** A recorded on-chain transaction in the user's history. */
425
+ interface TransactionRecord {
426
+ id: string;
427
+ chain: string;
428
+ kind: string;
429
+ txHash: string | null;
430
+ to: string | null;
431
+ value: string | null;
432
+ status: 'submitted' | 'confirmed' | 'failed' | string;
433
+ metadata: Record<string, unknown> | null;
434
+ createdAt: string;
435
+ updatedAt?: string;
436
+ }
437
+ /** What the dApp passes to record a transaction it broadcast. */
438
+ interface RecordTransactionInput {
439
+ chain: string;
440
+ txHash?: string;
441
+ to?: string;
442
+ value?: string;
443
+ kind?: string;
444
+ status?: string;
445
+ metadata?: Record<string, unknown>;
446
+ }
411
447
  interface SignMessageRequest {
412
448
  chain: Chain;
413
449
  message: string | Uint8Array;
@@ -510,10 +546,28 @@ interface DecaneConnect {
510
546
  */
511
547
  getAccessToken(): string | null;
512
548
  signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
549
+ /**
550
+ * Sign a Tron transaction. Pass the transaction's `raw_data_hex` (the value
551
+ * TronWeb puts on a built transaction). The enclave computes the txID
552
+ * (sha256(raw_data)) and signs it with the same secp256k1 key as the EVM
553
+ * wallet; returns the 65-byte recoverable signature as 0x-hex. Attach it to
554
+ * the transaction's `signature` array and broadcast via TronWeb / a full node.
555
+ */
556
+ signTronTransaction(rawDataHex: string): Promise<string>;
557
+ /**
558
+ * Record a transaction this wallet broadcast, so it appears in the user's
559
+ * history (and the developer dashboard). EVM `sendTransaction` records itself
560
+ * automatically; call this for Solana/Tron transactions your dApp broadcasts,
561
+ * or to attach a `confirmed`/`failed` status update to an existing hash.
562
+ */
563
+ recordTransaction(tx: RecordTransactionInput): Promise<TransactionRecord>;
564
+ /** The user's transaction history, most recent first. Requires a live session. */
565
+ getTransactionHistory(limit?: number): Promise<TransactionRecord[]>;
513
566
  disconnect(): Promise<void>;
514
567
  getAddresses(): {
515
568
  evm?: string;
516
569
  solana?: string;
570
+ tron?: string;
517
571
  } | null;
518
572
  /**
519
573
  * Native-token balance for a chain (defaults to the first configured EVM
@@ -780,6 +834,7 @@ interface SocialAuthState {
780
834
  addresses: {
781
835
  evm?: string;
782
836
  solana?: string;
837
+ tron?: string;
783
838
  } | null;
784
839
  isNewUser: boolean;
785
840
  isUnlocked: boolean;
@@ -864,6 +919,7 @@ declare function useSocialAuth(): {
864
919
  addresses: {
865
920
  evm?: string;
866
921
  solana?: string;
922
+ tron?: string;
867
923
  } | null;
868
924
  sessionExpiresAt: number | null;
869
925
  canUsePasskey: boolean;
@@ -897,6 +953,7 @@ declare function useSocialWallet(): {
897
953
  addresses: {
898
954
  evm?: string;
899
955
  solana?: string;
956
+ tron?: string;
900
957
  } | null;
901
958
  sessionExpiresAt: number | null;
902
959
  needsReconnect: boolean;
@@ -917,6 +974,9 @@ declare function useSocialWallet(): {
917
974
  gasPrice?: bigint;
918
975
  }) => Promise<string>;
919
976
  signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
977
+ signTronTransaction: (rawDataHex: string) => Promise<string>;
978
+ recordTransaction: (tx: RecordTransactionInput) => Promise<TransactionRecord>;
979
+ getTransactionHistory: (limit?: number) => Promise<TransactionRecord[]>;
920
980
  signTypedData: (req: {
921
981
  chain: string;
922
982
  domain: Record<string, unknown>;
@@ -1035,4 +1095,4 @@ declare function useSignTypedData(): {
1035
1095
  reset: () => void;
1036
1096
  };
1037
1097
 
1038
- export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
1098
+ export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, type RecordTransactionInput, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TransactionRecord, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
package/dist/index.js CHANGED
@@ -1892,7 +1892,7 @@ function createDecane(config) {
1892
1892
 
1893
1893
  // src/social/client.ts
1894
1894
  init_errors();
1895
- import { Wallet } from "ethers";
1895
+ import { Wallet, sha256 as sha2562, encodeBase58 as encodeBase582 } from "ethers";
1896
1896
  import { Transaction as Transaction2, VersionedTransaction, Keypair } from "@solana/web3.js";
1897
1897
 
1898
1898
  // src/social/events.ts
@@ -1986,10 +1986,26 @@ var ApiClient = class {
1986
1986
  iv: bytesToB64(share.iv),
1987
1987
  wrappedShareMeta: btoa(JSON.stringify(share.wrappedShareMeta)),
1988
1988
  evmAddress: share.evmAddress,
1989
- solanaAddress: share.solanaAddress
1989
+ solanaAddress: share.solanaAddress,
1990
+ tronAddress: share.tronAddress
1990
1991
  })
1991
1992
  });
1992
1993
  }
1994
+ // ── Transaction history ───────────────────────────────────────────────────
1995
+ async recordTransaction(jwt, tx) {
1996
+ const body = await this._request("/transactions", {
1997
+ method: "POST",
1998
+ headers: { Authorization: `Bearer ${jwt}` },
1999
+ body: JSON.stringify(tx)
2000
+ });
2001
+ return body.transaction;
2002
+ }
2003
+ async getTransactions(jwt, limit = 50) {
2004
+ const body = await this._request(`/transactions?limit=${encodeURIComponent(String(limit))}`, {
2005
+ headers: { Authorization: `Bearer ${jwt}` }
2006
+ });
2007
+ return body.transactions;
2008
+ }
1993
2009
  // ── WebAuthn registration (additive to the PRF-only passkey flow) ─────────
1994
2010
  async getWebAuthnRegisterOptions(jwt, rpId, rpName) {
1995
2011
  return this._request(`/webauthn/register-options?rpId=${encodeURIComponent(rpId)}&rpName=${encodeURIComponent(rpName)}`, {
@@ -2127,6 +2143,9 @@ var Storage = class {
2127
2143
  }
2128
2144
  };
2129
2145
 
2146
+ // src/social/session.ts
2147
+ import { sha256, encodeBase58 } from "ethers";
2148
+
2130
2149
  // src/social/teeClient.ts
2131
2150
  import { startAuthentication } from "@simplewebauthn/browser";
2132
2151
 
@@ -2407,6 +2426,11 @@ var TeeClient = class {
2407
2426
 
2408
2427
  // src/social/session.ts
2409
2428
  init_errors();
2429
+ function evmToTronAddress(evmAddress) {
2430
+ const hex41 = "41" + evmAddress.toLowerCase().replace(/^0x/, "");
2431
+ const checksum = sha256(sha256("0x" + hex41)).slice(2, 10);
2432
+ return encodeBase58("0x" + hex41 + checksum);
2433
+ }
2410
2434
  var SessionManager = class {
2411
2435
  constructor(events, durationMs, teeUrl, requireAssertionPerSignature = false) {
2412
2436
  this.events = events;
@@ -2416,6 +2440,7 @@ var SessionManager = class {
2416
2440
  this.tee = null;
2417
2441
  this.evmAddress = null;
2418
2442
  this.solanaAddress = null;
2443
+ this.tronAddress = null;
2419
2444
  this.expiresAt = null;
2420
2445
  this.timeoutId = null;
2421
2446
  }
@@ -2442,6 +2467,7 @@ var SessionManager = class {
2442
2467
  this.tee.adoptHandle(handle, this.requireAssertionPerSignature);
2443
2468
  this.evmAddress = addresses.evm;
2444
2469
  this.solanaAddress = addresses.solana;
2470
+ this.tronAddress = addresses.tron ?? evmToTronAddress(addresses.evm);
2445
2471
  this.expiresAt = expiresAtMs;
2446
2472
  this.setExpiryTimer(expiresAtMs - Date.now());
2447
2473
  this.events.emit("session-started");
@@ -2468,15 +2494,17 @@ var SessionManager = class {
2468
2494
  "requireAssertionPerSignature was requested but this signer does not support it \u2014 refusing to open a session with weaker authority than configured."
2469
2495
  );
2470
2496
  }
2471
- const addresses = verified ?? fallback;
2472
- if (!addresses) {
2497
+ const resolved = verified ?? fallback;
2498
+ if (!resolved) {
2473
2499
  this.tee = null;
2474
2500
  throw new Error(
2475
2501
  "No addresses available for this wallet \u2014 the signer could not derive them and none are recorded"
2476
2502
  );
2477
2503
  }
2504
+ const addresses = { evm: resolved.evm, solana: resolved.solana, tron: resolved.tron ?? evmToTronAddress(resolved.evm) };
2478
2505
  this.evmAddress = addresses.evm;
2479
2506
  this.solanaAddress = addresses.solana;
2507
+ this.tronAddress = addresses.tron;
2480
2508
  const serverTtlMs = this.tee.sessionExpiresIn();
2481
2509
  const effectiveMs = serverTtlMs != null ? Math.min(this.durationMs, serverTtlMs * 1e3) : this.durationMs;
2482
2510
  this.expiresAt = Date.now() + effectiveMs;
@@ -2493,6 +2521,7 @@ var SessionManager = class {
2493
2521
  this.tee = null;
2494
2522
  this.evmAddress = null;
2495
2523
  this.solanaAddress = null;
2524
+ this.tronAddress = null;
2496
2525
  this.expiresAt = null;
2497
2526
  if (this.timeoutId) {
2498
2527
  clearTimeout(this.timeoutId);
@@ -2511,7 +2540,11 @@ var SessionManager = class {
2511
2540
  }
2512
2541
  addresses() {
2513
2542
  if (!this.evmAddress || !this.solanaAddress) return null;
2514
- return { evm: this.evmAddress, solana: this.solanaAddress };
2543
+ return {
2544
+ evm: this.evmAddress,
2545
+ solana: this.solanaAddress,
2546
+ tron: this.tronAddress ?? evmToTronAddress(this.evmAddress)
2547
+ };
2515
2548
  }
2516
2549
  };
2517
2550
 
@@ -3364,9 +3397,11 @@ async function createDecaneConnect(config) {
3364
3397
  let shareSet;
3365
3398
  let evmAddress;
3366
3399
  let solanaAddress;
3400
+ let tronAddress;
3367
3401
  try {
3368
3402
  evmAddress = new Wallet(toHex2(master)).address;
3369
3403
  solanaAddress = Keypair.fromSeed(master).publicKey.toBase58();
3404
+ tronAddress = evmToTronAddress2(evmAddress);
3370
3405
  shareSet = await splitMaster(master, 1);
3371
3406
  } finally {
3372
3407
  zeroize(master);
@@ -3397,10 +3432,11 @@ async function createDecaneConnect(config) {
3397
3432
  // credential IDs, prfSalt, pinSalt stay on-device — never sent to server
3398
3433
  },
3399
3434
  evmAddress,
3400
- solanaAddress
3435
+ solanaAddress,
3436
+ tronAddress
3401
3437
  });
3402
3438
  zeroize(shareSet.server);
3403
- const addresses = { evm: evmAddress, solana: solanaAddress };
3439
+ const addresses = { evm: evmAddress, solana: solanaAddress, tron: tronAddress };
3404
3440
  if (unlockMethod === "passkey" && meta.credentialId && meta.prfSalt) {
3405
3441
  try {
3406
3442
  await api.putRecoveryBackup(jwt, {
@@ -3423,6 +3459,7 @@ async function createDecaneConnect(config) {
3423
3459
  }
3424
3460
  addresses.evm = evmAddress = confirmed.evm;
3425
3461
  addresses.solana = solanaAddress = confirmed.solana;
3462
+ addresses.tron = tronAddress = confirmed.tron ?? evmToTronAddress2(confirmed.evm);
3426
3463
  if (config.offerRecoveryAtSignup !== false && config.onRecoveryShareOffer) {
3427
3464
  try {
3428
3465
  const choice = await config.onRecoveryShareOffer({ evmAddress, solanaAddress });
@@ -3446,7 +3483,7 @@ async function createDecaneConnect(config) {
3446
3483
  }
3447
3484
  async function returningUserUnlock(userId, jwt) {
3448
3485
  const rawAddresses = await api.getAddresses(jwt);
3449
- const recordedAddresses = rawAddresses.evm && rawAddresses.solana ? { evm: rawAddresses.evm, solana: rawAddresses.solana } : null;
3486
+ const recordedAddresses = rawAddresses.evm && rawAddresses.solana ? { evm: rawAddresses.evm, solana: rawAddresses.solana, tron: rawAddresses.tron ?? evmToTronAddress2(rawAddresses.evm) } : null;
3450
3487
  const stored = await storage.getShare(userId);
3451
3488
  let deviceShare;
3452
3489
  if (!stored) {
@@ -3528,7 +3565,7 @@ async function createDecaneConnect(config) {
3528
3565
  throw new ShareCorruptedError();
3529
3566
  }
3530
3567
  const rawAddresses = await api.getAddresses(result.jwt);
3531
- const recordedAddresses = rawAddresses.evm && rawAddresses.solana ? { evm: rawAddresses.evm, solana: rawAddresses.solana } : null;
3568
+ const recordedAddresses = rawAddresses.evm && rawAddresses.solana ? { evm: rawAddresses.evm, solana: rawAddresses.solana, tron: rawAddresses.tron ?? evmToTronAddress2(rawAddresses.evm) } : null;
3532
3569
  const addresses = await session.start(deviceShare, result.jwt, recordedAddresses);
3533
3570
  zeroize(deviceShare);
3534
3571
  auth = { jwt: result.jwt, userId, addresses };
@@ -3660,6 +3697,10 @@ async function createDecaneConnect(config) {
3660
3697
  const sig = await signSolanaMessage(tee, req.chain, msg, auth?.jwt);
3661
3698
  return bufferToB64u(sig);
3662
3699
  }
3700
+ if (req.chain.startsWith("tron:")) {
3701
+ const msg = typeof req.message === "string" ? req.message : new TextDecoder().decode(req.message);
3702
+ return tee.sign({ chain: req.chain, kind: "message", payload: msg }, auth?.jwt);
3703
+ }
3663
3704
  throw new CallSequenceError(`Unsupported chain: ${req.chain}`);
3664
3705
  },
3665
3706
  async sendTransaction(req) {
@@ -3707,6 +3748,16 @@ async function createDecaneConnect(config) {
3707
3748
  };
3708
3749
  const signedTx = await signEvmTransaction(tee, req.chain, tx, auth?.jwt);
3709
3750
  const txResponse = await provider.broadcastTransaction(signedTx);
3751
+ if (auth?.jwt) {
3752
+ void api.recordTransaction(auth.jwt, {
3753
+ chain: req.chain,
3754
+ txHash: txResponse.hash,
3755
+ to: req.to,
3756
+ value: (req.value ?? 0n).toString(),
3757
+ kind: "send"
3758
+ }).catch(() => {
3759
+ });
3760
+ }
3710
3761
  return txResponse.hash;
3711
3762
  },
3712
3763
  async signTypedData(req) {
@@ -3739,6 +3790,14 @@ async function createDecaneConnect(config) {
3739
3790
  getAccessToken() {
3740
3791
  return auth?.jwt ?? null;
3741
3792
  },
3793
+ async recordTransaction(tx) {
3794
+ if (!auth?.jwt) throw new CallSequenceError("Not connected \u2014 call connect() first");
3795
+ return api.recordTransaction(auth.jwt, tx);
3796
+ },
3797
+ async getTransactionHistory(limit = 50) {
3798
+ if (!auth?.jwt) throw new CallSequenceError("Not connected \u2014 call connect() first");
3799
+ return api.getTransactions(auth.jwt, limit);
3800
+ },
3742
3801
  getEthereumProvider(opts) {
3743
3802
  if (!ethProvider) {
3744
3803
  const firstEvm = config.chains.find((c) => c.startsWith("evm:"));
@@ -3761,6 +3820,14 @@ async function createDecaneConnect(config) {
3761
3820
  const solChain = config.chains.find((c) => c.startsWith("solana:")) ?? "solana:mainnet";
3762
3821
  return signSolanaTransaction(tee, solChain, tx, auth?.jwt);
3763
3822
  },
3823
+ async signTronTransaction(rawDataHex) {
3824
+ const tee = session.requireActive();
3825
+ const tronChain = config.chains.find((c) => c.startsWith("tron:")) ?? "tron:mainnet";
3826
+ return tee.sign(
3827
+ { chain: tronChain, kind: "transaction", payload: rawDataHex.replace(/^0x/, "") },
3828
+ auth?.jwt
3829
+ );
3830
+ },
3764
3831
  async disconnect() {
3765
3832
  session.end();
3766
3833
  if (auth?.jwt) {
@@ -3916,12 +3983,19 @@ function b64uToBuffer(b64u) {
3916
3983
  function toHex2(bytes) {
3917
3984
  return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
3918
3985
  }
3986
+ function evmToTronAddress2(evmAddress) {
3987
+ const hex41 = "41" + evmAddress.toLowerCase().replace(/^0x/, "");
3988
+ const checksum = sha2562(sha2562("0x" + hex41)).slice(2, 10);
3989
+ return encodeBase582("0x" + hex41 + checksum);
3990
+ }
3919
3991
  async function deriveAddressesFromShares(a, b) {
3920
3992
  const master = await combineShares(a, b);
3921
3993
  try {
3994
+ const evm = new Wallet(toHex2(master)).address;
3922
3995
  return {
3923
- evm: new Wallet(toHex2(master)).address,
3924
- solana: Keypair.fromSeed(master).publicKey.toBase58()
3996
+ evm,
3997
+ solana: Keypair.fromSeed(master).publicKey.toBase58(),
3998
+ tron: evmToTronAddress2(evm)
3925
3999
  };
3926
4000
  } finally {
3927
4001
  zeroize(master);
@@ -5943,6 +6017,21 @@ function DecaneKit({ config, children }) {
5943
6017
  if (!sdk) throw new Error("Social wallet not connected");
5944
6018
  return sdk.signSolanaTransaction(tx);
5945
6019
  }, []);
6020
+ const socialSignTronTransaction = useCallback3(async (rawDataHex) => {
6021
+ const sdk = socialRef.current;
6022
+ if (!sdk) throw new Error("Social wallet not connected");
6023
+ return sdk.signTronTransaction(rawDataHex);
6024
+ }, []);
6025
+ const socialRecordTransaction = useCallback3(async (tx) => {
6026
+ const sdk = socialRef.current;
6027
+ if (!sdk) throw new Error("Social wallet not connected");
6028
+ return sdk.recordTransaction(tx);
6029
+ }, []);
6030
+ const socialGetTransactionHistory = useCallback3(async (limit) => {
6031
+ const sdk = socialRef.current;
6032
+ if (!sdk) throw new Error("Social wallet not connected");
6033
+ return sdk.getTransactionHistory(limit);
6034
+ }, []);
5946
6035
  const socialSignTypedData = useCallback3(async (req) => {
5947
6036
  const sdk = socialRef.current;
5948
6037
  if (!sdk) throw new Error("Social wallet not connected");
@@ -6033,6 +6122,9 @@ function DecaneKit({ config, children }) {
6033
6122
  socialGetBalances,
6034
6123
  socialGetEthereumProvider,
6035
6124
  socialSignAuthorization,
6125
+ socialSignTronTransaction,
6126
+ socialRecordTransaction,
6127
+ socialGetTransactionHistory,
6036
6128
  socialGetAccessToken,
6037
6129
  socialSignSolanaTransaction,
6038
6130
  socialSignTypedData,
@@ -6253,6 +6345,9 @@ function useSocialWallet() {
6253
6345
  socialSignMessage,
6254
6346
  socialSendTransaction,
6255
6347
  socialSignSolanaTransaction,
6348
+ socialSignTronTransaction,
6349
+ socialRecordTransaction,
6350
+ socialGetTransactionHistory,
6256
6351
  socialSignTypedData,
6257
6352
  socialGetBalance,
6258
6353
  socialGetBalances,
@@ -6295,6 +6390,18 @@ function useSocialWallet() {
6295
6390
  (tx) => run(() => socialSignSolanaTransaction(tx)),
6296
6391
  [socialSignSolanaTransaction]
6297
6392
  );
6393
+ const signTronTransaction = useCallback4(
6394
+ (rawDataHex) => run(() => socialSignTronTransaction(rawDataHex)),
6395
+ [socialSignTronTransaction]
6396
+ );
6397
+ const recordTransaction = useCallback4(
6398
+ (tx) => run(() => socialRecordTransaction(tx)),
6399
+ [socialRecordTransaction]
6400
+ );
6401
+ const getTransactionHistory = useCallback4(
6402
+ (limit) => socialGetTransactionHistory(limit),
6403
+ [socialGetTransactionHistory]
6404
+ );
6298
6405
  const signTypedData = useCallback4(
6299
6406
  (req) => run(() => socialSignTypedData(req)),
6300
6407
  [socialSignTypedData]
@@ -6376,6 +6483,9 @@ function useSocialWallet() {
6376
6483
  signMessage,
6377
6484
  sendTransaction,
6378
6485
  signSolanaTransaction: signSolanaTransaction2,
6486
+ signTronTransaction,
6487
+ recordTransaction,
6488
+ getTransactionHistory,
6379
6489
  signTypedData,
6380
6490
  // Balances (native token; read-only, works while locked)
6381
6491
  getBalance,