decane-connect-kit 2.4.0 → 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
@@ -185,6 +185,16 @@ declare class ApiClient {
185
185
  solanaAddress: string;
186
186
  tronAddress: string;
187
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[]>;
188
198
  getWebAuthnRegisterOptions(jwt: string, rpId: string, rpName: string): Promise<_simplewebauthn_browser.PublicKeyCredentialCreationOptionsJSON>;
189
199
  postWebAuthnRegister(jwt: string, response: _simplewebauthn_browser.RegistrationResponseJSON, origin: string): Promise<void>;
190
200
  /**
@@ -411,6 +421,29 @@ interface ConnectResult {
411
421
  };
412
422
  isNewUser: boolean;
413
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
+ }
414
447
  interface SignMessageRequest {
415
448
  chain: Chain;
416
449
  message: string | Uint8Array;
@@ -521,6 +554,15 @@ interface DecaneConnect {
521
554
  * the transaction's `signature` array and broadcast via TronWeb / a full node.
522
555
  */
523
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[]>;
524
566
  disconnect(): Promise<void>;
525
567
  getAddresses(): {
526
568
  evm?: string;
@@ -933,6 +975,8 @@ declare function useSocialWallet(): {
933
975
  }) => Promise<string>;
934
976
  signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
935
977
  signTronTransaction: (rawDataHex: string) => Promise<string>;
978
+ recordTransaction: (tx: RecordTransactionInput) => Promise<TransactionRecord>;
979
+ getTransactionHistory: (limit?: number) => Promise<TransactionRecord[]>;
936
980
  signTypedData: (req: {
937
981
  chain: string;
938
982
  domain: Record<string, unknown>;
@@ -1051,4 +1095,4 @@ declare function useSignTypedData(): {
1051
1095
  reset: () => void;
1052
1096
  };
1053
1097
 
1054
- 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
@@ -185,6 +185,16 @@ declare class ApiClient {
185
185
  solanaAddress: string;
186
186
  tronAddress: string;
187
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[]>;
188
198
  getWebAuthnRegisterOptions(jwt: string, rpId: string, rpName: string): Promise<_simplewebauthn_browser.PublicKeyCredentialCreationOptionsJSON>;
189
199
  postWebAuthnRegister(jwt: string, response: _simplewebauthn_browser.RegistrationResponseJSON, origin: string): Promise<void>;
190
200
  /**
@@ -411,6 +421,29 @@ interface ConnectResult {
411
421
  };
412
422
  isNewUser: boolean;
413
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
+ }
414
447
  interface SignMessageRequest {
415
448
  chain: Chain;
416
449
  message: string | Uint8Array;
@@ -521,6 +554,15 @@ interface DecaneConnect {
521
554
  * the transaction's `signature` array and broadcast via TronWeb / a full node.
522
555
  */
523
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[]>;
524
566
  disconnect(): Promise<void>;
525
567
  getAddresses(): {
526
568
  evm?: string;
@@ -933,6 +975,8 @@ declare function useSocialWallet(): {
933
975
  }) => Promise<string>;
934
976
  signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
935
977
  signTronTransaction: (rawDataHex: string) => Promise<string>;
978
+ recordTransaction: (tx: RecordTransactionInput) => Promise<TransactionRecord>;
979
+ getTransactionHistory: (limit?: number) => Promise<TransactionRecord[]>;
936
980
  signTypedData: (req: {
937
981
  chain: string;
938
982
  domain: Record<string, unknown>;
@@ -1051,4 +1095,4 @@ declare function useSignTypedData(): {
1051
1095
  reset: () => void;
1052
1096
  };
1053
1097
 
1054
- 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
@@ -1991,6 +1991,21 @@ var ApiClient = class {
1991
1991
  })
1992
1992
  });
1993
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
+ }
1994
2009
  // ── WebAuthn registration (additive to the PRF-only passkey flow) ─────────
1995
2010
  async getWebAuthnRegisterOptions(jwt, rpId, rpName) {
1996
2011
  return this._request(`/webauthn/register-options?rpId=${encodeURIComponent(rpId)}&rpName=${encodeURIComponent(rpName)}`, {
@@ -3733,6 +3748,16 @@ async function createDecaneConnect(config) {
3733
3748
  };
3734
3749
  const signedTx = await signEvmTransaction(tee, req.chain, tx, auth?.jwt);
3735
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
+ }
3736
3761
  return txResponse.hash;
3737
3762
  },
3738
3763
  async signTypedData(req) {
@@ -3765,6 +3790,14 @@ async function createDecaneConnect(config) {
3765
3790
  getAccessToken() {
3766
3791
  return auth?.jwt ?? null;
3767
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
+ },
3768
3801
  getEthereumProvider(opts) {
3769
3802
  if (!ethProvider) {
3770
3803
  const firstEvm = config.chains.find((c) => c.startsWith("evm:"));
@@ -5989,6 +6022,16 @@ function DecaneKit({ config, children }) {
5989
6022
  if (!sdk) throw new Error("Social wallet not connected");
5990
6023
  return sdk.signTronTransaction(rawDataHex);
5991
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
+ }, []);
5992
6035
  const socialSignTypedData = useCallback3(async (req) => {
5993
6036
  const sdk = socialRef.current;
5994
6037
  if (!sdk) throw new Error("Social wallet not connected");
@@ -6080,6 +6123,8 @@ function DecaneKit({ config, children }) {
6080
6123
  socialGetEthereumProvider,
6081
6124
  socialSignAuthorization,
6082
6125
  socialSignTronTransaction,
6126
+ socialRecordTransaction,
6127
+ socialGetTransactionHistory,
6083
6128
  socialGetAccessToken,
6084
6129
  socialSignSolanaTransaction,
6085
6130
  socialSignTypedData,
@@ -6301,6 +6346,8 @@ function useSocialWallet() {
6301
6346
  socialSendTransaction,
6302
6347
  socialSignSolanaTransaction,
6303
6348
  socialSignTronTransaction,
6349
+ socialRecordTransaction,
6350
+ socialGetTransactionHistory,
6304
6351
  socialSignTypedData,
6305
6352
  socialGetBalance,
6306
6353
  socialGetBalances,
@@ -6347,6 +6394,14 @@ function useSocialWallet() {
6347
6394
  (rawDataHex) => run(() => socialSignTronTransaction(rawDataHex)),
6348
6395
  [socialSignTronTransaction]
6349
6396
  );
6397
+ const recordTransaction = useCallback4(
6398
+ (tx) => run(() => socialRecordTransaction(tx)),
6399
+ [socialRecordTransaction]
6400
+ );
6401
+ const getTransactionHistory = useCallback4(
6402
+ (limit) => socialGetTransactionHistory(limit),
6403
+ [socialGetTransactionHistory]
6404
+ );
6350
6405
  const signTypedData = useCallback4(
6351
6406
  (req) => run(() => socialSignTypedData(req)),
6352
6407
  [socialSignTypedData]
@@ -6429,6 +6484,8 @@ function useSocialWallet() {
6429
6484
  sendTransaction,
6430
6485
  signSolanaTransaction: signSolanaTransaction2,
6431
6486
  signTronTransaction,
6487
+ recordTransaction,
6488
+ getTransactionHistory,
6432
6489
  signTypedData,
6433
6490
  // Balances (native token; read-only, works while locked)
6434
6491
  getBalance,