@moon-x/core 0.2.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/README.md +39 -0
- package/dist/chain-C9dvKXUY.d.mts +48 -0
- package/dist/chain-C9dvKXUY.d.ts +48 -0
- package/dist/chunk-264CEGDS.mjs +46 -0
- package/dist/chunk-CDT4MC7S.mjs +1532 -0
- package/dist/chunk-CMYR6AOY.mjs +0 -0
- package/dist/chunk-GQKIA37O.mjs +20 -0
- package/dist/chunk-IMLBIIJ4.mjs +36 -0
- package/dist/chunk-MOREUKOG.mjs +18 -0
- package/dist/chunk-SOKLPX7V.mjs +270 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +402 -0
- package/dist/index.mjs +33 -0
- package/dist/interfaces-9k0eKCc4.d.ts +120 -0
- package/dist/interfaces-fNhwnCeY.d.mts +120 -0
- package/dist/lib/index.d.mts +410 -0
- package/dist/lib/index.d.ts +410 -0
- package/dist/lib/index.js +1622 -0
- package/dist/lib/index.mjs +89 -0
- package/dist/passkey-cache-B9PT3AWX.d.mts +47 -0
- package/dist/passkey-cache-B9PT3AWX.d.ts +47 -0
- package/dist/passkey-metadata-QqFF2SWQ.d.mts +25 -0
- package/dist/passkey-metadata-QqFF2SWQ.d.ts +25 -0
- package/dist/post-message-C_99BCBh.d.mts +70 -0
- package/dist/post-message-C_99BCBh.d.ts +70 -0
- package/dist/react/ethereum.d.mts +26 -0
- package/dist/react/ethereum.d.ts +26 -0
- package/dist/react/ethereum.js +99 -0
- package/dist/react/ethereum.mjs +56 -0
- package/dist/react/index.d.mts +182 -0
- package/dist/react/index.d.ts +182 -0
- package/dist/react/index.js +586 -0
- package/dist/react/index.mjs +328 -0
- package/dist/react/solana.d.mts +17 -0
- package/dist/react/solana.d.ts +17 -0
- package/dist/react/solana.js +75 -0
- package/dist/react/solana.mjs +35 -0
- package/dist/sdk/index.d.mts +126 -0
- package/dist/sdk/index.d.ts +126 -0
- package/dist/sdk/index.js +864 -0
- package/dist/sdk/index.mjs +579 -0
- package/dist/types/index.d.mts +1190 -0
- package/dist/types/index.d.ts +1190 -0
- package/dist/types/index.js +64 -0
- package/dist/types/index.mjs +10 -0
- package/dist/utils/index.d.mts +11 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +365 -0
- package/dist/utils/index.mjs +25 -0
- package/dist/web/index.d.mts +20 -0
- package/dist/web/index.d.ts +20 -0
- package/dist/web/index.js +470 -0
- package/dist/web/index.mjs +155 -0
- package/package.json +111 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
export { C as CachedAssertion, c as clearParentAssertCache, g as generatePasskeyUserId, a as getAssertCacheTtlMs, r as readParentAssertCache, s as setAssertCacheTtlMs, w as withClearOnFailure, b as writeParentAssertCache } from '../passkey-cache-B9PT3AWX.mjs';
|
|
2
|
+
export { a as PasskeyFormFactor, P as PasskeyMetadata, b as PasskeyMetadataInput, f as formatPasskeyLabel, r as resolvePasskeyMetadata } from '../passkey-metadata-QqFF2SWQ.mjs';
|
|
3
|
+
import { C as Chain } from '../chain-C9dvKXUY.mjs';
|
|
4
|
+
import { SiweMessage } from 'siwe';
|
|
5
|
+
import { Connection, PublicKey } from '@solana/web3.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Tiny in-memory store for the email currently mid-OTP-flow.
|
|
9
|
+
* Singleton — the SDK creates exactly one and uses it to remember the
|
|
10
|
+
* email between `sendCode` and `loginWithCode`.
|
|
11
|
+
*/
|
|
12
|
+
declare class AuthenticationState {
|
|
13
|
+
private email;
|
|
14
|
+
setEmail(email: string): void;
|
|
15
|
+
getEmail(): string | null;
|
|
16
|
+
clearEmail(): void;
|
|
17
|
+
clear(): void;
|
|
18
|
+
}
|
|
19
|
+
declare const authState: AuthenticationState;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sanitize user data to only include public profile information.
|
|
23
|
+
* Removes session-related fields to match the response from verifyIdToken.
|
|
24
|
+
*
|
|
25
|
+
* @param userData - Raw user data that may contain session information
|
|
26
|
+
* @returns Public user object safe for provider state
|
|
27
|
+
*/
|
|
28
|
+
declare function sanitizeUserData(userData: any): any;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Verify ID token with MoonKey API and retrieve user info.
|
|
32
|
+
*/
|
|
33
|
+
interface VerifyIdTokenResponse {
|
|
34
|
+
success: boolean;
|
|
35
|
+
user?: any;
|
|
36
|
+
error?: string;
|
|
37
|
+
statusCode?: number;
|
|
38
|
+
}
|
|
39
|
+
declare const verifyIdToken: (publishableKey: string, idToken: string) => Promise<VerifyIdTokenResponse>;
|
|
40
|
+
|
|
41
|
+
declare const fromB64url: (b64url: string) => Uint8Array;
|
|
42
|
+
declare const toB64url: (bytes: Uint8Array) => string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Chain utilities for MoonKey
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Set a custom RPC URL for a chain
|
|
50
|
+
* @param chain - The chain to configure
|
|
51
|
+
* @param rpcUrl - The custom RPC URL
|
|
52
|
+
* @returns A new chain object with the custom RPC URL
|
|
53
|
+
*/
|
|
54
|
+
declare function setChainRpcUrl(chain: Chain, rpcUrl: string): Chain;
|
|
55
|
+
/**
|
|
56
|
+
* Get the RPC URL for a chain
|
|
57
|
+
* @param chain - The chain to get the RPC URL for
|
|
58
|
+
* @returns The HTTP RPC URL
|
|
59
|
+
*/
|
|
60
|
+
declare function getRpcUrl(chain: Chain): string;
|
|
61
|
+
/**
|
|
62
|
+
* Call `eth_maxPriorityFeePerGas` against an EVM RPC. Returns the
|
|
63
|
+
* chain's current recommended priority-fee (tip) as a bigint (wei).
|
|
64
|
+
*
|
|
65
|
+
* Asking the chain itself sidesteps per-chain network-enforced tip
|
|
66
|
+
* floors — Polygon, for example, rejects txs below 25 gwei with
|
|
67
|
+
* `gas tip cap below minimum`.
|
|
68
|
+
*
|
|
69
|
+
* Not all RPCs expose this method; callers should treat a thrown
|
|
70
|
+
* error as "use a fallback".
|
|
71
|
+
*/
|
|
72
|
+
declare function getEvmMaxPriorityFeePerGas(rpcUrl: string): Promise<bigint>;
|
|
73
|
+
/**
|
|
74
|
+
* Call `eth_gasPrice` against an EVM RPC. Returns the chain's current
|
|
75
|
+
* legacy gas price as a bigint (wei). Used by useSendTransaction to
|
|
76
|
+
* size sensible EIP-1559 maxFeePerGas / maxPriorityFeePerGas values
|
|
77
|
+
* per chain — without this, hardcoded mainnet defaults (22 gwei) blow
|
|
78
|
+
* past the balance check on L2s where real prices are sub-gwei.
|
|
79
|
+
*/
|
|
80
|
+
declare function getEvmGasPrice(rpcUrl: string): Promise<bigint>;
|
|
81
|
+
/**
|
|
82
|
+
* Call `eth_estimateGas` against an EVM RPC for the given tx. Used by
|
|
83
|
+
* useSendTransaction to fill in `gas` when the caller doesn't provide
|
|
84
|
+
* it. Throws on RPC error / would-revert; the caller is expected to
|
|
85
|
+
* fall back to a generous default.
|
|
86
|
+
*/
|
|
87
|
+
declare function estimateEvmGas(rpcUrl: string, tx: {
|
|
88
|
+
from: string;
|
|
89
|
+
to?: string;
|
|
90
|
+
data?: string;
|
|
91
|
+
value?: string | number | bigint;
|
|
92
|
+
}): Promise<bigint>;
|
|
93
|
+
/**
|
|
94
|
+
* Call `eth_getTransactionCount` with `pending` block tag against an
|
|
95
|
+
* EVM RPC. Returns the next nonce a wallet should use, including any
|
|
96
|
+
* txs the user has already broadcast but that haven't been mined yet.
|
|
97
|
+
*
|
|
98
|
+
* Used by useSendTransaction to fill `nonce` when the caller doesn't
|
|
99
|
+
* supply one. Critical for back-to-back sends (approve → swap, etc.)
|
|
100
|
+
* — without this the downstream serializer leaves nonce undefined and
|
|
101
|
+
* viem defaults it to 0, so any tx after the wallet's first lands as
|
|
102
|
+
* `nonce too low: next nonce N, tx nonce 0` at the RPC.
|
|
103
|
+
*
|
|
104
|
+
* Reading from the same `rpcUrl` we'll later broadcast against keeps
|
|
105
|
+
* the read and write internally consistent — separate viem public
|
|
106
|
+
* clients elsewhere can hit different load-balanced nodes and return
|
|
107
|
+
* a count that's a block stale relative to the broadcast endpoint.
|
|
108
|
+
*/
|
|
109
|
+
declare function getEvmNonce(rpcUrl: string, address: string): Promise<number>;
|
|
110
|
+
/**
|
|
111
|
+
* Estimate the user's pre-flight native-fee reserve for a swap on
|
|
112
|
+
* this chain: `gas units × eth_gasPrice × bufferBps / 10000`, returned
|
|
113
|
+
* in human units (ETH / POL / BNB — all 18-decimal natives).
|
|
114
|
+
*
|
|
115
|
+
* The default 1.5x cushion mirrors the SDK's max-fee auto-fill so the
|
|
116
|
+
* reserve covers `balance >= value + gas × maxFeePerGas` even when
|
|
117
|
+
* gas drifts between estimation and inclusion. Reads `eth_gasPrice`
|
|
118
|
+
* from the same RPC the SDK broadcasts to.
|
|
119
|
+
*/
|
|
120
|
+
declare function estimateEvmGasReserve(rpcUrl: string, chainId: number, opts?: {
|
|
121
|
+
gasUnits?: bigint;
|
|
122
|
+
bufferBps?: number;
|
|
123
|
+
}): Promise<number>;
|
|
124
|
+
/**
|
|
125
|
+
* Find a chain by its ID
|
|
126
|
+
* @param chains - Array of chains to search
|
|
127
|
+
* @param chainId - The chain ID to find
|
|
128
|
+
* @returns The matching chain or undefined
|
|
129
|
+
*/
|
|
130
|
+
declare function getChainById(chains: Chain[], chainId: number): Chain | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Check if a chain is supported
|
|
133
|
+
* @param chains - Array of supported chains
|
|
134
|
+
* @param chainId - The chain ID to check
|
|
135
|
+
* @returns True if the chain is supported
|
|
136
|
+
*/
|
|
137
|
+
declare function isChainSupported(chains: Chain[], chainId: number): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Validate chain configuration
|
|
140
|
+
* Throws an error if configuration is invalid
|
|
141
|
+
*/
|
|
142
|
+
declare function validateChainConfig(config: {
|
|
143
|
+
defaultChain?: Chain;
|
|
144
|
+
supportedChains?: Chain[];
|
|
145
|
+
}): void;
|
|
146
|
+
/**
|
|
147
|
+
* Get the default chain from config
|
|
148
|
+
* If no defaultChain is set but supportedChains is set, returns the first supported chain
|
|
149
|
+
*/
|
|
150
|
+
declare function getDefaultChain(config: {
|
|
151
|
+
defaultChain?: Chain;
|
|
152
|
+
supportedChains?: Chain[];
|
|
153
|
+
}): Chain | undefined;
|
|
154
|
+
|
|
155
|
+
interface EthereumSiweMessageProps {
|
|
156
|
+
nonce: string;
|
|
157
|
+
domain: string;
|
|
158
|
+
address: string;
|
|
159
|
+
uri?: string;
|
|
160
|
+
version?: string;
|
|
161
|
+
chainId?: number;
|
|
162
|
+
statement?: string;
|
|
163
|
+
issuedAt?: string;
|
|
164
|
+
expirationTime?: string;
|
|
165
|
+
notBefore?: string;
|
|
166
|
+
requestId?: string;
|
|
167
|
+
resources?: string[];
|
|
168
|
+
}
|
|
169
|
+
interface ManualSiweMessageProps {
|
|
170
|
+
nonce: string;
|
|
171
|
+
domain: string;
|
|
172
|
+
address: string;
|
|
173
|
+
uri?: string;
|
|
174
|
+
version?: string;
|
|
175
|
+
chainId?: number;
|
|
176
|
+
statement?: string;
|
|
177
|
+
issuedAt?: string;
|
|
178
|
+
walletName?: string;
|
|
179
|
+
}
|
|
180
|
+
declare class EthereumSiweMessage {
|
|
181
|
+
private siweMessage;
|
|
182
|
+
constructor({ nonce, domain, address, uri, version, chainId, statement, issuedAt, expirationTime, notBefore, requestId, resources }: EthereumSiweMessageProps);
|
|
183
|
+
prepareMessage(): string;
|
|
184
|
+
getMessage(): SiweMessage;
|
|
185
|
+
}
|
|
186
|
+
declare function createManualSiweMessage({ nonce, domain, address, uri, version, chainId, statement, issuedAt, walletName }: ManualSiweMessageProps): string;
|
|
187
|
+
|
|
188
|
+
/** Loose input transaction — accepts every shape callers throw at it. */
|
|
189
|
+
interface EvmTransactionInput {
|
|
190
|
+
to?: string;
|
|
191
|
+
value?: string | number | bigint;
|
|
192
|
+
nonce?: string | number | bigint;
|
|
193
|
+
gasLimit?: string | number | bigint;
|
|
194
|
+
gas?: string | number | bigint;
|
|
195
|
+
gasPrice?: string | number | bigint;
|
|
196
|
+
data?: string;
|
|
197
|
+
chainId?: number;
|
|
198
|
+
type?: number | "legacy" | "eip2930" | "eip1559";
|
|
199
|
+
maxPriorityFeePerGas?: string | number | bigint;
|
|
200
|
+
maxFeePerGas?: string | number | bigint;
|
|
201
|
+
}
|
|
202
|
+
/** Minimal wallet shape `tx-prep` needs (avoids reaching for full PublicWallet). */
|
|
203
|
+
interface EvmTxPrepWallet {
|
|
204
|
+
public_address: string;
|
|
205
|
+
chainId?: number;
|
|
206
|
+
}
|
|
207
|
+
interface ChainResolutionInput {
|
|
208
|
+
/** Pull from the input transaction's `chainId` if the caller was explicit. */
|
|
209
|
+
requestedChainId?: number;
|
|
210
|
+
/** Wallet's bound chain, if any. */
|
|
211
|
+
walletChainId?: number;
|
|
212
|
+
supportedChains?: Chain[];
|
|
213
|
+
defaultChain?: Chain;
|
|
214
|
+
/**
|
|
215
|
+
* When true, reject if requestedChainId is not in supportedChains.
|
|
216
|
+
* Sign-only paths leave this false (best-effort fallback to default).
|
|
217
|
+
* Send paths set it true so a Base tx never silently broadcasts to mainnet.
|
|
218
|
+
*/
|
|
219
|
+
strict?: boolean;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Resolve which chain to use for the operation.
|
|
223
|
+
*
|
|
224
|
+
* Priority:
|
|
225
|
+
* 1. `requestedChainId` from the transaction (caller is explicit).
|
|
226
|
+
* 2. `walletChainId` from the wallet's bound chain.
|
|
227
|
+
* 3. `defaultChain` from provider config.
|
|
228
|
+
*
|
|
229
|
+
* Under `strict: true`, an explicit `requestedChainId` outside the
|
|
230
|
+
* configured `supportedChains` throws — sending a Base tx through a
|
|
231
|
+
* mainnet RPC would otherwise silently land on the wrong chain. Sign-
|
|
232
|
+
* only flows (where there's no broadcast) leave strict off so the
|
|
233
|
+
* fallback to defaultChain is allowed.
|
|
234
|
+
*/
|
|
235
|
+
declare function resolveEvmChain({ requestedChainId, walletChainId, supportedChains, defaultChain, strict, }: ChainResolutionInput): Chain;
|
|
236
|
+
/**
|
|
237
|
+
* Sign-path prep. Converts an input transaction (string or object) into
|
|
238
|
+
* the serialized RLP string the iframe-side signer expects. Handles
|
|
239
|
+
* value/fee parsing (bigint, hex, decimal-ether) and gas-type branching.
|
|
240
|
+
*
|
|
241
|
+
* No RPC calls — caller can sign now and broadcast later. Returns the
|
|
242
|
+
* resolved chain too so the hook can stash it if needed.
|
|
243
|
+
*/
|
|
244
|
+
declare function prepareEvmSignTransaction({ transaction, wallet, supportedChains, defaultChain, }: {
|
|
245
|
+
transaction: string | EvmTransactionInput;
|
|
246
|
+
wallet: EvmTxPrepWallet;
|
|
247
|
+
supportedChains?: Chain[];
|
|
248
|
+
defaultChain?: Chain;
|
|
249
|
+
}): Promise<{
|
|
250
|
+
serializedTransaction: string;
|
|
251
|
+
chain: Chain | undefined;
|
|
252
|
+
}>;
|
|
253
|
+
/**
|
|
254
|
+
* Send-path prep. Resolves the broadcast chain + RPC URL, then
|
|
255
|
+
* auto-fills missing nonce, gas, and EIP-1559 fee fields from the
|
|
256
|
+
* chain itself. Returns the prepared transaction object (NOT
|
|
257
|
+
* serialized — the iframe-side signer re-serializes after signing)
|
|
258
|
+
* along with the chain and RPC URL.
|
|
259
|
+
*
|
|
260
|
+
* Auto-fill behavior:
|
|
261
|
+
* - nonce: `eth_getTransactionCount(addr, "pending")`. Critical for
|
|
262
|
+
* back-to-back sends; without it viem defaults to nonce=0 and the
|
|
263
|
+
* second tx of any session is rejected as "nonce too low."
|
|
264
|
+
* - gas: `eth_estimateGas` with a 20% safety buffer; falls back to
|
|
265
|
+
* 800k if estimation fails (would-revert tx, RPC hiccup) so the
|
|
266
|
+
* user gets a real on-chain failure rather than "intrinsic gas too
|
|
267
|
+
* low" at the mempool.
|
|
268
|
+
* - EIP-1559 fees: `eth_gasPrice` + `eth_maxPriorityFeePerGas`. Tip
|
|
269
|
+
* gets a 20% bump for inclusion safety; maxFee floors at tip + 1
|
|
270
|
+
* wei so the chain doesn't reject `maxFee < tip`. Emits hex (wei)
|
|
271
|
+
* because the downstream serializer treats plain decimal strings
|
|
272
|
+
* as gwei.
|
|
273
|
+
*
|
|
274
|
+
* RPC hiccups are swallowed deliberately: leave the field unset and
|
|
275
|
+
* let the downstream serializer handle it. The caller gets a clearer
|
|
276
|
+
* error from the chain than a silent stuck tx.
|
|
277
|
+
*/
|
|
278
|
+
declare function prepareEvmSendTransaction({ transaction, wallet, supportedChains, defaultChain, }: {
|
|
279
|
+
transaction: EvmTransactionInput;
|
|
280
|
+
wallet: EvmTxPrepWallet;
|
|
281
|
+
supportedChains?: Chain[];
|
|
282
|
+
defaultChain?: Chain;
|
|
283
|
+
}): Promise<{
|
|
284
|
+
transaction: EvmTransactionInput;
|
|
285
|
+
rpcUrl: string;
|
|
286
|
+
chain: Chain;
|
|
287
|
+
}>;
|
|
288
|
+
|
|
289
|
+
interface SiwsMessageProps {
|
|
290
|
+
nonce: string;
|
|
291
|
+
domain: string;
|
|
292
|
+
address: string;
|
|
293
|
+
uri?: string;
|
|
294
|
+
version?: string;
|
|
295
|
+
chainId?: string;
|
|
296
|
+
statement?: string;
|
|
297
|
+
issuedAt?: string;
|
|
298
|
+
expirationTime?: string;
|
|
299
|
+
notBefore?: string;
|
|
300
|
+
requestId?: string;
|
|
301
|
+
resources?: string[];
|
|
302
|
+
message?: string;
|
|
303
|
+
signature?: string;
|
|
304
|
+
}
|
|
305
|
+
declare class SiwsMessage {
|
|
306
|
+
nonce: string;
|
|
307
|
+
domain: string;
|
|
308
|
+
address: string;
|
|
309
|
+
uri?: string;
|
|
310
|
+
version?: string;
|
|
311
|
+
chainId?: string;
|
|
312
|
+
statement?: string;
|
|
313
|
+
issuedAt?: string;
|
|
314
|
+
expirationTime?: string;
|
|
315
|
+
notBefore?: string;
|
|
316
|
+
requestId?: string;
|
|
317
|
+
resources?: string[];
|
|
318
|
+
message?: string;
|
|
319
|
+
signature?: string;
|
|
320
|
+
constructor({ nonce, domain, address, uri, version, chainId, statement, issuedAt, expirationTime, notBefore, requestId, resources, message, signature }: SiwsMessageProps);
|
|
321
|
+
prepareBasic(): Uint8Array;
|
|
322
|
+
prepareAdvanced(): Uint8Array;
|
|
323
|
+
token(signature: Uint8Array): Promise<string>;
|
|
324
|
+
decode(token: string): SiwsMessage;
|
|
325
|
+
validate(): Promise<boolean>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
interface DetailedInstruction {
|
|
329
|
+
type: string;
|
|
330
|
+
details: Record<string, any>;
|
|
331
|
+
}
|
|
332
|
+
declare class SolanaTransactionParser {
|
|
333
|
+
private logs;
|
|
334
|
+
private transaction?;
|
|
335
|
+
private instructions;
|
|
336
|
+
private connection?;
|
|
337
|
+
private userPublicKey?;
|
|
338
|
+
constructor(logs: string[], base64Transaction?: string, connection?: Connection, userPublicKey?: PublicKey);
|
|
339
|
+
parse(): Promise<DetailedInstruction[]>;
|
|
340
|
+
private parseInstruction;
|
|
341
|
+
private parseGenericInstruction;
|
|
342
|
+
private parseComputeBudget;
|
|
343
|
+
private parseAssociatedToken;
|
|
344
|
+
private parseSystemProgram;
|
|
345
|
+
private parseTokenProgram;
|
|
346
|
+
private parseJupiterBasic;
|
|
347
|
+
private parseTokenAccountData;
|
|
348
|
+
private formatTokenAmount;
|
|
349
|
+
private formatSOL;
|
|
350
|
+
private truncate;
|
|
351
|
+
getInstructions(): DetailedInstruction[];
|
|
352
|
+
getInstructionsByType(type: string): DetailedInstruction[];
|
|
353
|
+
}
|
|
354
|
+
declare function getInstructionsForHTML(base64Transaction: string, logs: string[], connection?: Connection, userPublicKey?: PublicKey): Promise<Array<{
|
|
355
|
+
id: string;
|
|
356
|
+
type: string;
|
|
357
|
+
title: string;
|
|
358
|
+
details: Array<{
|
|
359
|
+
label: string;
|
|
360
|
+
value: string;
|
|
361
|
+
}>;
|
|
362
|
+
}>>;
|
|
363
|
+
declare function getTransferInfoFromInstructions(base64Transaction: string, logs: string[], solPriceUsd?: string): Promise<Array<{
|
|
364
|
+
amount: string;
|
|
365
|
+
destination: string;
|
|
366
|
+
type: 'SOL' | 'Token';
|
|
367
|
+
usdValue?: string;
|
|
368
|
+
}>>;
|
|
369
|
+
declare function getSOLTransfersFromInstructions(base64Transaction: string, logs: string[], solPriceUsd?: string): Promise<Array<{
|
|
370
|
+
amount: string;
|
|
371
|
+
destination: string;
|
|
372
|
+
lamports: string;
|
|
373
|
+
usdValue?: string;
|
|
374
|
+
}>>;
|
|
375
|
+
|
|
376
|
+
interface BuildUrlConfig {
|
|
377
|
+
publishableKey: string;
|
|
378
|
+
config?: {
|
|
379
|
+
appearance?: {
|
|
380
|
+
hideClose?: boolean;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
declare const buildUrl: (baseUrl: string, sdkConfig: BuildUrlConfig, enableCaptcha?: boolean, captchaSitekey?: string) => string;
|
|
385
|
+
|
|
386
|
+
declare const DEFAULT_AUTH_URL = "https://iframe.moonx-dev.com";
|
|
387
|
+
|
|
388
|
+
declare const serializeEthereumTransaction: (transaction: any) => Promise<string>;
|
|
389
|
+
declare const broadcastEthereumRaw: (rpcUrl: string, signedSerialized: string) => Promise<string>;
|
|
390
|
+
declare const broadcastSolanaSigned: (rpcUrl: string, signedBase58: string) => Promise<string>;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Convert any wire representation of a byte array back into Uint8Array.
|
|
394
|
+
* Pass-through for actual `Uint8Array` and regular `number[]`. Used
|
|
395
|
+
* defensively at every transport boundary that may have stripped typed
|
|
396
|
+
* arrays.
|
|
397
|
+
*/
|
|
398
|
+
declare const arrayLikeToBytes: (value: unknown) => Uint8Array;
|
|
399
|
+
/**
|
|
400
|
+
* Decode a base58 string (or pass-through bytes) into Uint8Array.
|
|
401
|
+
* Solana sign-transaction handlers return base58-encoded signed bytes;
|
|
402
|
+
* sign-message handlers return raw Uint8Array. This helper handles
|
|
403
|
+
* both shapes so callers don't have to branch.
|
|
404
|
+
*
|
|
405
|
+
* `bs58` is an optional peer of `@moon-x/core`; we lazy-import to keep
|
|
406
|
+
* the cold-start lean for consumers who don't use Solana flows.
|
|
407
|
+
*/
|
|
408
|
+
declare const bs58ToBytes: (value: unknown) => Promise<Uint8Array>;
|
|
409
|
+
|
|
410
|
+
export { type BuildUrlConfig, DEFAULT_AUTH_URL, EthereumSiweMessage, type EthereumSiweMessageProps, type EvmTransactionInput, type EvmTxPrepWallet, type ManualSiweMessageProps, SiwsMessage, SolanaTransactionParser, type VerifyIdTokenResponse, arrayLikeToBytes, authState, broadcastEthereumRaw, broadcastSolanaSigned, bs58ToBytes, buildUrl, createManualSiweMessage, estimateEvmGas, estimateEvmGasReserve, fromB64url, getChainById, getDefaultChain, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getInstructionsForHTML, getRpcUrl, getSOLTransfersFromInstructions, getTransferInfoFromInstructions, isChainSupported, prepareEvmSendTransaction, prepareEvmSignTransaction, resolveEvmChain, sanitizeUserData, serializeEthereumTransaction, setChainRpcUrl, toB64url, validateChainConfig, verifyIdToken };
|