@moon-x/core 0.13.0 → 0.14.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.
@@ -62,10 +62,18 @@ type SolanaChainEntry = {
62
62
  /** Optional WebSocket (rpcSubscriptions) endpoint. */
63
63
  wsUrl?: string;
64
64
  };
65
+ type TronChainEntry = {
66
+ /** CAIP-2-style network id, e.g. "tron:mainnet" | "tron:nile". */
67
+ id: string;
68
+ /** Fullnode HTTP endpoint, e.g. "https://api.trongrid.io". */
69
+ rpcUrl: string;
70
+ /** Unused for tron (fullnode HTTP only); present for ChainEntry shape parity. */
71
+ wsUrl?: string;
72
+ };
65
73
  /** Normalized internal entry form (bare `Chain`s are coerced to `EvmChainEntry`). */
66
- type ChainEntry = EvmChainEntry | SolanaChainEntry;
74
+ type ChainEntry = EvmChainEntry | SolanaChainEntry | TronChainEntry;
67
75
  /** A single element of the public `chains` config array. */
68
- type ChainConfigItem = Chain | EvmChainEntry | SolanaChainEntry;
76
+ type ChainConfigItem = Chain | EvmChainEntry | SolanaChainEntry | TronChainEntry;
69
77
 
70
78
  interface PublicWallet {
71
79
  id: string;
@@ -191,7 +199,7 @@ type ContractUIOptions = {
191
199
  imgAltText?: string;
192
200
  imgSize?: "sm" | "lg";
193
201
  };
194
- type WalletType = "solana" | "ethereum";
202
+ type WalletType = "solana" | "ethereum" | "tron";
195
203
  type TransactionCommitment = "processed" | "confirmed" | "finalized";
196
204
  type TransactionEncoding = "base64" | "base58" | "json" | "jsonParsed";
197
205
  interface WalletError extends Error {
@@ -227,7 +235,7 @@ interface MoonPaySignRequest {
227
235
  accessToken: string;
228
236
  publicAddress: string;
229
237
  currencyCode: string;
230
- quoteCurrencyAmount: number;
238
+ quoteCurrencyAmount?: number;
231
239
  useSandbox?: boolean;
232
240
  }
233
241
  interface MoonPaySignResponse {
@@ -687,8 +695,90 @@ interface SolanaGetTokenAccountsByOwnerResult {
687
695
  tokenAccounts: any[];
688
696
  }
689
697
 
698
+ /**
699
+ * A TronWeb-built transaction (TransactionBuilder output). Structurally
700
+ * identical to @moon-x/signing-codec/tron's TronTransaction - kept as a
701
+ * standalone type because core doesn't depend on the internal codec.
702
+ * `raw_data_hex` is the protobuf-serialized bytes a signature covers;
703
+ * `txID` is their sha256.
704
+ */
705
+ interface TronTransactionJson {
706
+ visible?: boolean;
707
+ txID: string;
708
+ raw_data: unknown;
709
+ raw_data_hex: string;
710
+ signature?: string[];
711
+ }
712
+ interface TronSignMessageParams {
713
+ message: string;
714
+ wallet: PublicWallet;
715
+ options?: {
716
+ uiOptions?: {
717
+ title?: string;
718
+ description?: string;
719
+ showWalletUI?: boolean;
720
+ logoUrl?: string;
721
+ confirmButtonText?: string;
722
+ cancelButtonText?: string;
723
+ waitBeforeCloseTime?: number;
724
+ };
725
+ };
726
+ }
727
+ interface TronSignMessageResult {
728
+ /** 65-byte 0x-prefixed hex - verifies via TronWeb `Trx.verifyMessageV2`. */
729
+ signature: string;
730
+ }
731
+ interface TronSignTransactionParams {
732
+ transaction: TronTransactionJson;
733
+ wallet: PublicWallet;
734
+ options?: {
735
+ uiOptions?: {
736
+ title?: string;
737
+ description?: string;
738
+ showWalletUI?: boolean;
739
+ logoUrl?: string;
740
+ cancelButtonText?: string;
741
+ confirmButtonText?: string;
742
+ footerText?: string;
743
+ waitBeforeCloseTime?: number;
744
+ };
745
+ };
746
+ }
747
+ interface TronSignTransactionResult {
748
+ /** Broadcast-ready for `tronWeb.trx.sendRawTransaction`. */
749
+ signedTransaction: TronTransactionJson & {
750
+ signature: string[];
751
+ };
752
+ }
753
+ interface TronSendTransactionParams {
754
+ transaction: TronTransactionJson;
755
+ wallet: PublicWallet;
756
+ /** Fullnode HTTP endpoint, e.g. "https://api.trongrid.io". */
757
+ rpcUrl: string;
758
+ options?: TronSignTransactionParams["options"];
759
+ }
760
+ interface TronSendTransactionResult {
761
+ /** Transaction id accepted by the fullnode (== sha256 of raw_data). */
762
+ txid: string;
763
+ signedTransaction: TronTransactionJson & {
764
+ signature: string[];
765
+ };
766
+ }
767
+ interface TronGetBalanceParams {
768
+ wallet: PublicWallet;
769
+ /** Fullnode HTTP endpoint. */
770
+ rpcUrl: string;
771
+ }
772
+ interface TronGetBalanceResult {
773
+ /** SUN (1 TRX = 1e6 SUN). */
774
+ balanceBaseUnit: string;
775
+ balanceNativeUnit: string;
776
+ walletAddress: string;
777
+ network: string;
778
+ }
779
+
690
780
  type EphemeralSignerScheme = "ecdsa_secp256k1" | "eddsa_ed25519";
691
- type EphemeralSignerChain = "ethereum" | "solana";
781
+ type EphemeralSignerChain = "ethereum" | "solana" | "tron";
692
782
  interface ProvisionEphemeralSignerParams {
693
783
  /**
694
784
  * Wallet IDs (from `user.wallets[i].id`) the agent will be authorized
@@ -1055,7 +1145,7 @@ interface ExportKeyConfig {
1055
1145
  logoUrl?: string;
1056
1146
  };
1057
1147
  }
1058
- type WalletChain = "solana" | "ethereum";
1148
+ type WalletChain = "solana" | "ethereum" | "tron";
1059
1149
  interface MethodDetails {
1060
1150
  id: string;
1061
1151
  method_id: string;
@@ -1456,4 +1546,4 @@ interface WalletVerifyRequest {
1456
1546
  sessionExpiresIn: number;
1457
1547
  }
1458
1548
 
1459
- export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AppearanceBackdrop, type AppearanceBorderRadius, type AppearanceCard, type AppearanceColors, type AppearanceComponents, type AppearanceLogo, type AppearanceModeTokens, type AppearanceTypography, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainConfigItem, type ChainEntry, type ChainLikeWithId, type ComponentStyle, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type EvmChainEntry, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SessionWallet, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaChainEntry, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
1549
+ export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AppearanceBackdrop, type AppearanceBorderRadius, type AppearanceCard, type AppearanceColors, type AppearanceComponents, type AppearanceLogo, type AppearanceModeTokens, type AppearanceTypography, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainConfigItem, type ChainEntry, type ChainLikeWithId, type ComponentStyle, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type EvmChainEntry, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SessionWallet, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaChainEntry, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TronChainEntry, type TronGetBalanceParams, type TronGetBalanceResult, type TronSendTransactionParams, type TronSendTransactionResult, type TronSignMessageParams, type TronSignMessageResult, type TronSignTransactionParams, type TronSignTransactionResult, type TronTransactionJson, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
@@ -2,7 +2,7 @@ import {
2
2
  Network,
3
3
  WALLET_ERROR_CODES,
4
4
  WalletCreationError
5
- } from "../chunk-IMLBIIJ4.mjs";
5
+ } from "../chunk-CEL3U6EI.mjs";
6
6
  export {
7
7
  Network,
8
8
  WALLET_ERROR_CODES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moon-x/core",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "license": "UNLICENSED",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,6 +49,11 @@
49
49
  "types": "./dist/react/solana.d.ts",
50
50
  "import": "./dist/react/solana.mjs",
51
51
  "require": "./dist/react/solana.js"
52
+ },
53
+ "./react/tron": {
54
+ "types": "./dist/react/tron.d.ts",
55
+ "import": "./dist/react/tron.mjs",
56
+ "require": "./dist/react/tron.js"
52
57
  }
53
58
  },
54
59
  "files": [
File without changes