@moon-x/core 0.12.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.
- package/dist/{chunk-L7GL3PFM.mjs → chunk-7UGU27T3.mjs} +249 -7
- package/dist/{chunk-264CEGDS.mjs → chunk-HAEJD7NC.mjs} +4 -3
- package/dist/chunk-LP55IGPN.mjs +21 -0
- package/dist/{chunk-BJKWC4MG.mjs → chunk-PEIBEYMA.mjs} +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -10
- package/dist/index.mjs +5 -5
- package/dist/lib/index.d.mts +40 -4
- package/dist/lib/index.d.ts +40 -4
- package/dist/lib/index.js +258 -10
- package/dist/lib/index.mjs +12 -2
- package/dist/react/ethereum.js +9 -9
- package/dist/react/ethereum.mjs +9 -9
- package/dist/react/index.d.mts +14 -10
- package/dist/react/index.d.ts +14 -10
- package/dist/react/index.js +23 -15
- package/dist/react/index.mjs +16 -16
- package/dist/react/solana.js +6 -6
- package/dist/react/solana.mjs +6 -6
- package/dist/react/tron.d.mts +16 -0
- package/dist/react/tron.d.ts +16 -0
- package/dist/react/tron.js +95 -0
- package/dist/react/tron.mjs +55 -0
- package/dist/sdk/index.d.mts +17 -5
- package/dist/sdk/index.d.ts +17 -5
- package/dist/sdk/index.js +141 -0
- package/dist/sdk/index.mjs +107 -2
- package/dist/types/index.d.mts +98 -8
- package/dist/types/index.d.ts +98 -8
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +12 -10
- package/dist/utils/index.mjs +4 -4
- package/dist/web/index.js +5 -4
- package/dist/web/index.mjs +2 -2
- package/package.json +6 -1
- package/dist/chunk-GQKIA37O.mjs +0 -20
- /package/dist/{chunk-IMLBIIJ4.mjs → chunk-CEL3U6EI.mjs} +0 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
@@ -955,7 +1045,7 @@ interface AuthAppearance {
|
|
|
955
1045
|
dark?: AppearanceModeTokens;
|
|
956
1046
|
}
|
|
957
1047
|
/**
|
|
958
|
-
* Flexible theme type that accepts both strict
|
|
1048
|
+
* Flexible theme type that accepts both strict MoonXTheme and loose config theme objects.
|
|
959
1049
|
* Used for functions that need to work with various theme configuration formats.
|
|
960
1050
|
*/
|
|
961
1051
|
type FlexibleTheme = {
|
|
@@ -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 };
|
package/dist/types/index.mjs
CHANGED
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { F as FORWARDED_ERROR_FIELDS, P as PostMessageClient, a as PostMessageMethod, b as PostMessageServer, c as PostMessageType } from '../post-message-BR2NClJ5.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Get the appropriate
|
|
4
|
+
* Get the appropriate MoonX API URL based on environment configuration
|
|
5
5
|
*/
|
|
6
|
-
declare const
|
|
6
|
+
declare const getMoonXApiUrl: () => string;
|
|
7
7
|
|
|
8
8
|
declare const getIframeUrl: (path?: string) => string;
|
|
9
9
|
declare const getIframeOrigin: (url: string) => string;
|
|
@@ -20,4 +20,4 @@ declare const getIframeOrigin: (url: string) => string;
|
|
|
20
20
|
*/
|
|
21
21
|
declare const FONT_URLS_KEY = "__moonxFontUrls";
|
|
22
22
|
|
|
23
|
-
export { FONT_URLS_KEY, getIframeOrigin, getIframeUrl,
|
|
23
|
+
export { FONT_URLS_KEY, getIframeOrigin, getIframeUrl, getMoonXApiUrl };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { F as FORWARDED_ERROR_FIELDS, P as PostMessageClient, a as PostMessageMethod, b as PostMessageServer, c as PostMessageType } from '../post-message-BR2NClJ5.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Get the appropriate
|
|
4
|
+
* Get the appropriate MoonX API URL based on environment configuration
|
|
5
5
|
*/
|
|
6
|
-
declare const
|
|
6
|
+
declare const getMoonXApiUrl: () => string;
|
|
7
7
|
|
|
8
8
|
declare const getIframeUrl: (path?: string) => string;
|
|
9
9
|
declare const getIframeOrigin: (url: string) => string;
|
|
@@ -20,4 +20,4 @@ declare const getIframeOrigin: (url: string) => string;
|
|
|
20
20
|
*/
|
|
21
21
|
declare const FONT_URLS_KEY = "__moonxFontUrls";
|
|
22
22
|
|
|
23
|
-
export { FONT_URLS_KEY, getIframeOrigin, getIframeUrl,
|
|
23
|
+
export { FONT_URLS_KEY, getIframeOrigin, getIframeUrl, getMoonXApiUrl };
|
package/dist/utils/index.js
CHANGED
|
@@ -28,17 +28,18 @@ __export(utils_exports, {
|
|
|
28
28
|
PostMessageType: () => PostMessageType,
|
|
29
29
|
getIframeOrigin: () => getIframeOrigin,
|
|
30
30
|
getIframeUrl: () => getIframeUrl,
|
|
31
|
-
|
|
31
|
+
getMoonXApiUrl: () => getMoonXApiUrl
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(utils_exports);
|
|
34
34
|
|
|
35
35
|
// src/utils/get-api-url.ts
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
var getMoonXApiUrl = () => {
|
|
37
|
+
const apiUrlOverride = process.env?.NEXT_PUBLIC_MOONX_API_URL || process.env?.NEXT_PUBLIC_MOONKEY_API_URL;
|
|
38
|
+
if (apiUrlOverride) {
|
|
39
|
+
return apiUrlOverride;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
const iframeUrl = process.env?.NEXT_PUBLIC_MOONX_IFRAME_URL || process.env?.NEXT_PUBLIC_MOONKEY_IFRAME_URL;
|
|
42
|
+
if (iframeUrl) {
|
|
42
43
|
if (iframeUrl.includes("staging") || iframeUrl.includes("auth-staging")) {
|
|
43
44
|
return "https://api.moonx-dev.com";
|
|
44
45
|
}
|
|
@@ -69,15 +70,16 @@ var getIframeUrl = (path = "") => {
|
|
|
69
70
|
/^https?:\/\//,
|
|
70
71
|
""
|
|
71
72
|
).replace(/\/$/, "");
|
|
72
|
-
const iframeProjectName = process.env.NEXT_PUBLIC_MOONKEY_IFRAME_PROJECT_NAME || DEFAULT_IFRAME_PROJECT_NAME;
|
|
73
|
+
const iframeProjectName = process.env.NEXT_PUBLIC_MOONX_IFRAME_PROJECT_NAME || process.env.NEXT_PUBLIC_MOONKEY_IFRAME_PROJECT_NAME || DEFAULT_IFRAME_PROJECT_NAME;
|
|
73
74
|
const iframeUrl = /-git-/.test(vercelUrl) ? vercelUrl.replace(/^[^.]+?-git-/, `${iframeProjectName}-git-`) : (
|
|
74
75
|
// Fallback: legacy `{prefix}-{hash}.vercel.app` style
|
|
75
76
|
vercelUrl.replace(/^[^-]+-/, `${iframeProjectName}-`)
|
|
76
77
|
);
|
|
77
78
|
return withBypass(joinUrl(`https://${iframeUrl}`, path));
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const iframeUrlOverride = process.env.NEXT_PUBLIC_MOONX_IFRAME_URL || process.env.NEXT_PUBLIC_MOONKEY_IFRAME_URL;
|
|
81
|
+
if (iframeUrlOverride) {
|
|
82
|
+
return joinUrl(iframeUrlOverride, path);
|
|
81
83
|
}
|
|
82
84
|
return joinUrl("https://iframe.moonx-dev.com", path);
|
|
83
85
|
};
|
|
@@ -442,5 +444,5 @@ var FONT_URLS_KEY = "__moonxFontUrls";
|
|
|
442
444
|
PostMessageType,
|
|
443
445
|
getIframeOrigin,
|
|
444
446
|
getIframeUrl,
|
|
445
|
-
|
|
447
|
+
getMoonXApiUrl
|
|
446
448
|
});
|
package/dist/utils/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getIframeOrigin,
|
|
6
6
|
getIframeUrl
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-HAEJD7NC.mjs";
|
|
8
8
|
import {
|
|
9
9
|
FORWARDED_ERROR_FIELDS,
|
|
10
10
|
PostMessageClient,
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
PostMessageType
|
|
14
14
|
} from "../chunk-Z57WM6IO.mjs";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "../chunk-
|
|
16
|
+
getMoonXApiUrl
|
|
17
|
+
} from "../chunk-LP55IGPN.mjs";
|
|
18
18
|
export {
|
|
19
19
|
FONT_URLS_KEY,
|
|
20
20
|
FORWARDED_ERROR_FIELDS,
|
|
@@ -24,5 +24,5 @@ export {
|
|
|
24
24
|
PostMessageType,
|
|
25
25
|
getIframeOrigin,
|
|
26
26
|
getIframeUrl,
|
|
27
|
-
|
|
27
|
+
getMoonXApiUrl
|
|
28
28
|
};
|
package/dist/web/index.js
CHANGED
|
@@ -294,15 +294,16 @@ var getIframeUrl = (path = "") => {
|
|
|
294
294
|
/^https?:\/\//,
|
|
295
295
|
""
|
|
296
296
|
).replace(/\/$/, "");
|
|
297
|
-
const iframeProjectName = process.env.NEXT_PUBLIC_MOONKEY_IFRAME_PROJECT_NAME || DEFAULT_IFRAME_PROJECT_NAME;
|
|
297
|
+
const iframeProjectName = process.env.NEXT_PUBLIC_MOONX_IFRAME_PROJECT_NAME || process.env.NEXT_PUBLIC_MOONKEY_IFRAME_PROJECT_NAME || DEFAULT_IFRAME_PROJECT_NAME;
|
|
298
298
|
const iframeUrl = /-git-/.test(vercelUrl) ? vercelUrl.replace(/^[^.]+?-git-/, `${iframeProjectName}-git-`) : (
|
|
299
299
|
// Fallback: legacy `{prefix}-{hash}.vercel.app` style
|
|
300
300
|
vercelUrl.replace(/^[^-]+-/, `${iframeProjectName}-`)
|
|
301
301
|
);
|
|
302
302
|
return withBypass(joinUrl(`https://${iframeUrl}`, path));
|
|
303
303
|
}
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
const iframeUrlOverride = process.env.NEXT_PUBLIC_MOONX_IFRAME_URL || process.env.NEXT_PUBLIC_MOONKEY_IFRAME_URL;
|
|
305
|
+
if (iframeUrlOverride) {
|
|
306
|
+
return joinUrl(iframeUrlOverride, path);
|
|
306
307
|
}
|
|
307
308
|
return joinUrl("https://iframe.moonx-dev.com", path);
|
|
308
309
|
};
|
|
@@ -423,7 +424,7 @@ var createWebAuthnPasskey = () => ({
|
|
|
423
424
|
});
|
|
424
425
|
|
|
425
426
|
// src/web/local-storage-kv.ts
|
|
426
|
-
var createLocalStorageKv = (prefix = "
|
|
427
|
+
var createLocalStorageKv = (prefix = "moonx:") => ({
|
|
427
428
|
get: async (key) => {
|
|
428
429
|
if (typeof window === "undefined") return null;
|
|
429
430
|
try {
|
package/dist/web/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getIframeOrigin,
|
|
3
3
|
getIframeUrl
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-HAEJD7NC.mjs";
|
|
5
5
|
import {
|
|
6
6
|
PostMessageClient,
|
|
7
7
|
PostMessageServer
|
|
@@ -114,7 +114,7 @@ var createWebAuthnPasskey = () => ({
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// src/web/local-storage-kv.ts
|
|
117
|
-
var createLocalStorageKv = (prefix = "
|
|
117
|
+
var createLocalStorageKv = (prefix = "moonx:") => ({
|
|
118
118
|
get: async (key) => {
|
|
119
119
|
if (typeof window === "undefined") return null;
|
|
120
120
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moon-x/core",
|
|
3
|
-
"version": "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": [
|
package/dist/chunk-GQKIA37O.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/utils/get-api-url.ts
|
|
2
|
-
var getMoonKeyApiUrl = () => {
|
|
3
|
-
if (process.env?.NEXT_PUBLIC_MOONKEY_API_URL) {
|
|
4
|
-
return process.env.NEXT_PUBLIC_MOONKEY_API_URL;
|
|
5
|
-
}
|
|
6
|
-
if (process.env?.NEXT_PUBLIC_MOONKEY_IFRAME_URL) {
|
|
7
|
-
const iframeUrl = process.env.NEXT_PUBLIC_MOONKEY_IFRAME_URL;
|
|
8
|
-
if (iframeUrl.includes("staging") || iframeUrl.includes("auth-staging")) {
|
|
9
|
-
return "https://api.moonx-dev.com";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
if (process.env?.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
13
|
-
return "https://api.moonx-dev.com";
|
|
14
|
-
}
|
|
15
|
-
return "https://api.moonx-dev.com";
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
getMoonKeyApiUrl
|
|
20
|
-
};
|
|
File without changes
|