@phantom/react-sdk 1.0.0-beta.0 → 1.0.0-beta.10
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 +66 -112
- package/dist/index.d.ts +11 -33
- package/dist/index.js +119 -235
- package/dist/index.mjs +120 -236
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -94,10 +94,8 @@ function App() {
|
|
|
94
94
|
<PhantomProvider
|
|
95
95
|
config={{
|
|
96
96
|
providerType: "embedded",
|
|
97
|
-
|
|
97
|
+
appId: "your-app-id", // Get your app ID from phantom.com/portal
|
|
98
98
|
addressTypes: [AddressType.solana, AddressType.ethereum],
|
|
99
|
-
apiBaseUrl: "https://api.phantom.app/v1/wallets",
|
|
100
|
-
organizationId: "your-org-id",
|
|
101
99
|
}}
|
|
102
100
|
>
|
|
103
101
|
<YourApp />
|
|
@@ -153,7 +151,7 @@ await connect({
|
|
|
153
151
|
},
|
|
154
152
|
});
|
|
155
153
|
|
|
156
|
-
// Apple authentication (skips provider selection)
|
|
154
|
+
// Apple authentication (skips provider selection)
|
|
157
155
|
await connect({
|
|
158
156
|
authOptions: {
|
|
159
157
|
provider: "apple",
|
|
@@ -182,27 +180,7 @@ Uses the Phantom browser extension installed by the user.
|
|
|
182
180
|
|
|
183
181
|
Creates non-custodial wallets embedded in your application.
|
|
184
182
|
|
|
185
|
-
####
|
|
186
|
-
|
|
187
|
-
- **New wallets** created per application
|
|
188
|
-
- **Unfunded** by default - you need to fund them
|
|
189
|
-
- **Independent** from user's existing Phantom wallet
|
|
190
|
-
|
|
191
|
-
```tsx
|
|
192
|
-
<PhantomProvider
|
|
193
|
-
config={{
|
|
194
|
-
providerType: "embedded",
|
|
195
|
-
embeddedWalletType: "app-wallet",
|
|
196
|
-
addressTypes: [AddressType.solana],
|
|
197
|
-
apiBaseUrl: "https://api.phantom.app/v1/wallets",
|
|
198
|
-
organizationId: "your-org-id",
|
|
199
|
-
}}
|
|
200
|
-
>
|
|
201
|
-
<YourApp />
|
|
202
|
-
</PhantomProvider>
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
#### User Wallet (For existing Phantom users)
|
|
183
|
+
#### User Wallet
|
|
206
184
|
|
|
207
185
|
- **Uses Phantom authentication** - user logs in with existing account
|
|
208
186
|
- **Potentially funded** - brings existing wallet balance
|
|
@@ -212,43 +190,14 @@ Creates non-custodial wallets embedded in your application.
|
|
|
212
190
|
<PhantomProvider
|
|
213
191
|
config={{
|
|
214
192
|
providerType: "embedded",
|
|
215
|
-
|
|
193
|
+
appId: "your-app-id",
|
|
216
194
|
addressTypes: [AddressType.solana, AddressType.ethereum],
|
|
217
|
-
apiBaseUrl: "https://api.phantom.app/v1/wallets",
|
|
218
|
-
organizationId: "your-org-id",
|
|
219
|
-
}}
|
|
220
|
-
>
|
|
221
|
-
<YourApp />
|
|
222
|
-
</PhantomProvider>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
## Solana Provider Configuration
|
|
226
|
-
|
|
227
|
-
When using `AddressType.solana`, you can choose between two Solana libraries:
|
|
228
|
-
|
|
229
|
-
```tsx
|
|
230
|
-
<PhantomProvider
|
|
231
|
-
config={{
|
|
232
|
-
providerType: "embedded",
|
|
233
|
-
addressTypes: [AddressType.solana],
|
|
234
|
-
solanaProvider: "web3js", // or 'kit'
|
|
235
|
-
apiBaseUrl: "https://api.phantom.app/v1/wallets",
|
|
236
|
-
organizationId: "your-org-id",
|
|
237
195
|
}}
|
|
238
196
|
>
|
|
239
197
|
<YourApp />
|
|
240
198
|
</PhantomProvider>
|
|
241
199
|
```
|
|
242
200
|
|
|
243
|
-
**Provider Options:**
|
|
244
|
-
|
|
245
|
-
- `'web3js'` (default) - Uses `@solana/web3.js` library
|
|
246
|
-
- `'kit'` - Uses `@solana/kit` library (modern, TypeScript-first)
|
|
247
|
-
|
|
248
|
-
**When to use each:**
|
|
249
|
-
|
|
250
|
-
- **@solana/web3.js**: Better ecosystem compatibility, wider community support
|
|
251
|
-
- **@solana/kit**: Better TypeScript support, modern architecture, smaller bundle size
|
|
252
201
|
|
|
253
202
|
## Available Hooks
|
|
254
203
|
|
|
@@ -378,7 +327,7 @@ function SolanaOperations() {
|
|
|
378
327
|
// Create transaction
|
|
379
328
|
const connection = new Connection("https://api.mainnet-beta.solana.com");
|
|
380
329
|
const { blockhash } = await connection.getLatestBlockhash();
|
|
381
|
-
|
|
330
|
+
|
|
382
331
|
const fromAddress = await solana.getPublicKey();
|
|
383
332
|
const transferInstruction = SystemProgram.transfer({
|
|
384
333
|
fromPubkey: new PublicKey(fromAddress),
|
|
@@ -396,11 +345,11 @@ function SolanaOperations() {
|
|
|
396
345
|
|
|
397
346
|
// Sign and send
|
|
398
347
|
const result = await solana.signAndSendTransaction(transaction);
|
|
399
|
-
console.log("Transaction sent:", result.
|
|
348
|
+
console.log("Transaction sent:", result.signature);
|
|
400
349
|
};
|
|
401
350
|
|
|
402
351
|
const switchNetwork = async () => {
|
|
403
|
-
await solana.switchNetwork(
|
|
352
|
+
await solana.switchNetwork("devnet");
|
|
404
353
|
};
|
|
405
354
|
|
|
406
355
|
return (
|
|
@@ -408,13 +357,14 @@ function SolanaOperations() {
|
|
|
408
357
|
<button onClick={signMessage}>Sign Message</button>
|
|
409
358
|
<button onClick={signAndSendTransaction}>Send Transaction</button>
|
|
410
359
|
<button onClick={switchNetwork}>Switch to Devnet</button>
|
|
411
|
-
<p>Connected: {solana.isConnected ?
|
|
360
|
+
<p>Connected: {solana.isConnected ? "Yes" : "No"}</p>
|
|
412
361
|
</div>
|
|
413
362
|
);
|
|
414
363
|
}
|
|
415
364
|
```
|
|
416
365
|
|
|
417
366
|
**Available methods:**
|
|
367
|
+
|
|
418
368
|
- `signMessage(message)` - Sign a message
|
|
419
369
|
- `signTransaction(transaction)` - Sign without sending
|
|
420
370
|
- `signAndSendTransaction(transaction)` - Sign and send
|
|
@@ -447,32 +397,42 @@ function EthereumOperations() {
|
|
|
447
397
|
{ name: "name", type: "string" },
|
|
448
398
|
{ name: "version", type: "string" },
|
|
449
399
|
{ name: "chainId", type: "uint256" },
|
|
450
|
-
{ name: "verifyingContract", type: "address" }
|
|
400
|
+
{ name: "verifyingContract", type: "address" },
|
|
451
401
|
],
|
|
452
402
|
Mail: [
|
|
453
403
|
{ name: "from", type: "string" },
|
|
454
404
|
{ name: "to", type: "string" },
|
|
455
|
-
{ name: "contents", type: "string" }
|
|
456
|
-
]
|
|
405
|
+
{ name: "contents", type: "string" },
|
|
406
|
+
],
|
|
457
407
|
},
|
|
458
408
|
primaryType: "Mail",
|
|
459
409
|
domain: {
|
|
460
410
|
name: "Ether Mail",
|
|
461
411
|
version: "1",
|
|
462
412
|
chainId: 1,
|
|
463
|
-
verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
|
|
413
|
+
verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
|
|
464
414
|
},
|
|
465
415
|
message: {
|
|
466
416
|
from: "Alice",
|
|
467
417
|
to: "Bob",
|
|
468
|
-
contents: "Hello!"
|
|
469
|
-
}
|
|
418
|
+
contents: "Hello!",
|
|
419
|
+
},
|
|
470
420
|
};
|
|
471
421
|
|
|
472
422
|
const signature = await ethereum.signTypedData(typedData);
|
|
473
423
|
console.log("Typed data signature:", signature);
|
|
474
424
|
};
|
|
475
425
|
|
|
426
|
+
const signTransaction = async () => {
|
|
427
|
+
const signedTx = await ethereum.signTransaction({
|
|
428
|
+
to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E",
|
|
429
|
+
value: "1000000000000000000", // 1 ETH in wei
|
|
430
|
+
gas: "21000",
|
|
431
|
+
});
|
|
432
|
+
console.log("Transaction signed:", signedTx);
|
|
433
|
+
// Transaction is signed but not sent - you can broadcast it later
|
|
434
|
+
};
|
|
435
|
+
|
|
476
436
|
const sendTransaction = async () => {
|
|
477
437
|
const result = await ethereum.sendTransaction({
|
|
478
438
|
to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E",
|
|
@@ -490,19 +450,22 @@ function EthereumOperations() {
|
|
|
490
450
|
<div>
|
|
491
451
|
<button onClick={signPersonalMessage}>Sign Personal Message</button>
|
|
492
452
|
<button onClick={signTypedData}>Sign Typed Data</button>
|
|
493
|
-
<button onClick={
|
|
453
|
+
<button onClick={signTransaction}>Sign Transaction</button>
|
|
454
|
+
<button onClick={sendTransaction}>Sign & Send Transaction</button>
|
|
494
455
|
<button onClick={switchChain}>Switch to Polygon</button>
|
|
495
|
-
<p>Connected: {ethereum.isConnected ?
|
|
456
|
+
<p>Connected: {ethereum.isConnected ? "Yes" : "No"}</p>
|
|
496
457
|
</div>
|
|
497
458
|
);
|
|
498
459
|
}
|
|
499
460
|
```
|
|
500
461
|
|
|
501
462
|
**Available methods:**
|
|
463
|
+
|
|
502
464
|
- `request(args)` - EIP-1193 requests
|
|
503
465
|
- `signPersonalMessage(message, address)` - Sign personal message
|
|
504
466
|
- `signTypedData(typedData)` - Sign EIP-712 typed data
|
|
505
|
-
- `
|
|
467
|
+
- `signTransaction(transaction)` - Sign transaction without sending
|
|
468
|
+
- `sendTransaction(transaction)` - Sign and send transaction
|
|
506
469
|
- `switchChain(chainId)` - Switch chains
|
|
507
470
|
- `getChainId()` - Get current chain ID
|
|
508
471
|
- `getAccounts()` - Get connected accounts
|
|
@@ -521,21 +484,13 @@ Hook for managing auto-confirm functionality with the Phantom extension. Auto-co
|
|
|
521
484
|
import { useAutoConfirm, NetworkId } from "@phantom/react-sdk";
|
|
522
485
|
|
|
523
486
|
function AutoConfirmControls() {
|
|
524
|
-
const {
|
|
525
|
-
enable,
|
|
526
|
-
disable,
|
|
527
|
-
status,
|
|
528
|
-
supportedChains,
|
|
529
|
-
isLoading,
|
|
530
|
-
error,
|
|
531
|
-
refetch,
|
|
532
|
-
} = useAutoConfirm();
|
|
487
|
+
const { enable, disable, status, supportedChains, isLoading, error, refetch } = useAutoConfirm();
|
|
533
488
|
|
|
534
489
|
const handleEnable = async () => {
|
|
535
490
|
try {
|
|
536
491
|
// Enable auto-confirm for specific chains
|
|
537
492
|
const result = await enable({
|
|
538
|
-
chains: [NetworkId.SOLANA_DEVNET, NetworkId.ETHEREUM_MAINNET]
|
|
493
|
+
chains: [NetworkId.SOLANA_DEVNET, NetworkId.ETHEREUM_MAINNET],
|
|
539
494
|
});
|
|
540
495
|
console.log("Auto-confirm enabled:", result);
|
|
541
496
|
} catch (err) {
|
|
@@ -563,14 +518,14 @@ function AutoConfirmControls() {
|
|
|
563
518
|
return (
|
|
564
519
|
<div>
|
|
565
520
|
<h3>Auto-Confirm Settings</h3>
|
|
566
|
-
|
|
521
|
+
|
|
567
522
|
<div>
|
|
568
523
|
<strong>Status:</strong> {status?.enabled ? "Enabled" : "Disabled"}
|
|
569
524
|
{status?.chains && (
|
|
570
525
|
<div>
|
|
571
526
|
<strong>Active Chains:</strong>
|
|
572
527
|
<ul>
|
|
573
|
-
{status.chains.map(
|
|
528
|
+
{status.chains.map(chain => (
|
|
574
529
|
<li key={chain}>{chain}</li>
|
|
575
530
|
))}
|
|
576
531
|
</ul>
|
|
@@ -582,7 +537,7 @@ function AutoConfirmControls() {
|
|
|
582
537
|
<strong>Supported Chains:</strong>
|
|
583
538
|
{supportedChains?.chains && (
|
|
584
539
|
<ul>
|
|
585
|
-
{supportedChains.chains.map(
|
|
540
|
+
{supportedChains.chains.map(chain => (
|
|
586
541
|
<li key={chain}>{chain}</li>
|
|
587
542
|
))}
|
|
588
543
|
</ul>
|
|
@@ -635,7 +590,7 @@ interface AutoConfirmSupportedChainsResult {
|
|
|
635
590
|
**Available Methods:**
|
|
636
591
|
|
|
637
592
|
- `enable(params)` - Enable auto-confirm for specific chains
|
|
638
|
-
- `disable()` - Disable auto-confirm completely
|
|
593
|
+
- `disable()` - Disable auto-confirm completely
|
|
639
594
|
- `refetch()` - Refresh status and supported chains from extension
|
|
640
595
|
- `status` - Current auto-confirm status (enabled/disabled and active chains)
|
|
641
596
|
- `supportedChains` - List of chains that support auto-confirm
|
|
@@ -685,7 +640,7 @@ function SolanaExample() {
|
|
|
685
640
|
|
|
686
641
|
// Sign and send using chain-specific hook
|
|
687
642
|
const result = await solana.signAndSendTransaction(transaction);
|
|
688
|
-
console.log("Transaction sent:", result.
|
|
643
|
+
console.log("Transaction sent:", result.signature);
|
|
689
644
|
};
|
|
690
645
|
|
|
691
646
|
return <button onClick={sendTransaction}>Send SOL</button>;
|
|
@@ -724,7 +679,7 @@ function SolanaKitExample() {
|
|
|
724
679
|
|
|
725
680
|
// Sign and send using chain-specific hook
|
|
726
681
|
const result = await solana.signAndSendTransaction(transaction);
|
|
727
|
-
console.log("Transaction sent:", result.
|
|
682
|
+
console.log("Transaction sent:", result.signature);
|
|
728
683
|
};
|
|
729
684
|
|
|
730
685
|
return <button onClick={sendTransaction}>Send SOL</button>;
|
|
@@ -778,36 +733,35 @@ function EthereumExample() {
|
|
|
778
733
|
|
|
779
734
|
Quick reference of all available hooks:
|
|
780
735
|
|
|
781
|
-
| Hook
|
|
782
|
-
|
|
|
783
|
-
| `useConnect`
|
|
784
|
-
| `useAccounts`
|
|
785
|
-
| `useIsExtensionInstalled`
|
|
786
|
-
| `useDisconnect`
|
|
787
|
-
| `useAutoConfirm`
|
|
788
|
-
| `useSolana`
|
|
789
|
-
| `useEthereum`
|
|
790
|
-
| `usePhantom`
|
|
736
|
+
| Hook | Purpose | Returns |
|
|
737
|
+
| ------------------------- | --------------------------------------- | --------------------------------------------------- |
|
|
738
|
+
| `useConnect` | Connect to wallet | `{ connect, isConnecting, error }` |
|
|
739
|
+
| `useAccounts` | Get wallet addresses | `WalletAddress[]` or `null` |
|
|
740
|
+
| `useIsExtensionInstalled` | Check extension status | `{ isLoading, isInstalled }` |
|
|
741
|
+
| `useDisconnect` | Disconnect from wallet | `{ disconnect, isDisconnecting }` |
|
|
742
|
+
| `useAutoConfirm` | Auto-confirm management (injected only) | `{ enable, disable, status, supportedChains, ... }` |
|
|
743
|
+
| `useSolana` | Solana chain operations | `{ signMessage, signAndSendTransaction, ... }` |
|
|
744
|
+
| `useEthereum` | Ethereum chain operations | `{ signPersonalMessage, sendTransaction, ... }` |
|
|
745
|
+
| `usePhantom` | Get provider context | `{ isConnected, isReady }` |
|
|
791
746
|
|
|
792
747
|
## Configuration Reference
|
|
793
748
|
|
|
794
749
|
```typescript
|
|
795
750
|
interface PhantomSDKConfig {
|
|
796
751
|
providerType: "injected" | "embedded";
|
|
797
|
-
appName?: string; // Optional app name for branding
|
|
798
|
-
appLogo?: string; // Optional app logo URL for branding
|
|
799
752
|
addressTypes?: [AddressType, ...AddressType[]]; // Networks to enable (e.g., [AddressType.solana])
|
|
800
753
|
|
|
801
754
|
// Required for embedded provider only
|
|
802
|
-
|
|
803
|
-
|
|
755
|
+
appId: string; // Your app ID from phantom.com/portal (required for embedded provider)
|
|
756
|
+
|
|
757
|
+
// Optional configuration
|
|
758
|
+
apiBaseUrl?: string; // Phantom API base URL (optional, has default)
|
|
804
759
|
authOptions?: {
|
|
805
|
-
authUrl?: string; // Custom auth URL (optional)
|
|
806
|
-
redirectUrl?: string; // Custom redirect URL (optional)
|
|
760
|
+
authUrl?: string; // Custom auth URL (optional, defaults to "https://connect.phantom.app/login")
|
|
761
|
+
redirectUrl?: string; // Custom redirect URL after authentication (optional)
|
|
807
762
|
};
|
|
808
|
-
embeddedWalletType?: "
|
|
809
|
-
|
|
810
|
-
autoConnect?: boolean; // Auto-connect to existing session on SDK instantiation (default: true for embedded, false for injected)
|
|
763
|
+
embeddedWalletType?: "user-wallet"; // Wallet type (optional, defaults to "user-wallet", currently the only supported type)
|
|
764
|
+
autoConnect?: boolean; // Auto-connect to existing session on SDK instantiation (optional, defaults to true for embedded, false for injected)
|
|
811
765
|
}
|
|
812
766
|
```
|
|
813
767
|
|
|
@@ -819,8 +773,8 @@ The React SDK supports separate debug configuration that can be changed without
|
|
|
819
773
|
|
|
820
774
|
```typescript
|
|
821
775
|
interface PhantomDebugConfig {
|
|
822
|
-
enabled?: boolean;
|
|
823
|
-
level?: DebugLevel;
|
|
776
|
+
enabled?: boolean; // Enable debug logging
|
|
777
|
+
level?: DebugLevel; // Debug level (ERROR, WARN, INFO, DEBUG)
|
|
824
778
|
callback?: DebugCallback; // Custom debug message handler
|
|
825
779
|
}
|
|
826
780
|
```
|
|
@@ -839,7 +793,7 @@ function App() {
|
|
|
839
793
|
// SDK configuration - static, won't change when debug settings change
|
|
840
794
|
const config: PhantomSDKConfig = {
|
|
841
795
|
providerType: "embedded",
|
|
842
|
-
|
|
796
|
+
appId: "your-app-id",
|
|
843
797
|
// ... other config
|
|
844
798
|
};
|
|
845
799
|
|
|
@@ -866,12 +820,12 @@ Debug callbacks receive a `DebugMessage` object:
|
|
|
866
820
|
|
|
867
821
|
```typescript
|
|
868
822
|
interface DebugMessage {
|
|
869
|
-
timestamp: number;
|
|
870
|
-
level: DebugLevel;
|
|
871
|
-
category: string;
|
|
872
|
-
message: string;
|
|
873
|
-
data?: any;
|
|
823
|
+
timestamp: number; // Unix timestamp
|
|
824
|
+
level: DebugLevel; // Message level
|
|
825
|
+
category: string; // Component category
|
|
826
|
+
message: string; // Debug message text
|
|
827
|
+
data?: any; // Additional debug data (optional)
|
|
874
828
|
}
|
|
875
829
|
```
|
|
876
830
|
|
|
877
|
-
For more details and examples, see the [@phantom/browser-sdk documentation](../browser-sdk/README.md).
|
|
831
|
+
For more details and examples, see the [@phantom/browser-sdk documentation](../browser-sdk/README.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,9 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { BrowserSDKConfig, DebugConfig, AuthOptions, BrowserSDK, WalletAddress, AutoConfirmEnableParams, AutoConfirmResult, AutoConfirmSupportedChainsResult } from '@phantom/browser-sdk';
|
|
4
4
|
export { AddressType, AutoConfirmEnableParams, AutoConfirmResult, AutoConfirmSupportedChainsResult, DebugLevel, DebugMessage, NetworkId, SignedTransaction, WalletAddress, debug } from '@phantom/browser-sdk';
|
|
5
5
|
import * as _phantom_embedded_provider_core from '@phantom/embedded-provider-core';
|
|
6
|
-
|
|
7
|
-
import { ISolanaChain, IEthereumChain, EthTransactionRequest } from '@phantom/chains';
|
|
8
|
-
export { EthTransactionRequest, IEthereumChain, ISolanaChain } from '@phantom/chains';
|
|
6
|
+
export { EthTransactionRequest, IEthereumChain, ISolanaChain } from '@phantom/chain-interfaces';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
type PhantomSDKConfig = BrowserSDKConfig;
|
|
12
9
|
interface PhantomDebugConfig extends DebugConfig {
|
|
13
10
|
}
|
|
14
11
|
interface ConnectOptions {
|
|
@@ -25,6 +22,7 @@ interface PhantomContextValue {
|
|
|
25
22
|
walletId: string | null;
|
|
26
23
|
currentProviderType: "injected" | "embedded" | null;
|
|
27
24
|
isPhantomAvailable: boolean;
|
|
25
|
+
isClient: boolean;
|
|
28
26
|
}
|
|
29
27
|
interface PhantomProviderProps {
|
|
30
28
|
children: ReactNode;
|
|
@@ -50,6 +48,10 @@ declare function useDisconnect(): {
|
|
|
50
48
|
|
|
51
49
|
declare function useAccounts(): _phantom_embedded_provider_core.WalletAddress[] | null;
|
|
52
50
|
|
|
51
|
+
/**
|
|
52
|
+
* React hook to check if Phantom extension is installed
|
|
53
|
+
* Uses waitForPhantomExtension for proper detection with retry logic
|
|
54
|
+
*/
|
|
53
55
|
declare function useIsExtensionInstalled(): {
|
|
54
56
|
isLoading: boolean;
|
|
55
57
|
isInstalled: boolean;
|
|
@@ -69,45 +71,21 @@ declare function useAutoConfirm(): UseAutoConfirmResult;
|
|
|
69
71
|
/**
|
|
70
72
|
* Hook for Solana chain operations
|
|
71
73
|
*
|
|
72
|
-
* @returns Solana chain interface
|
|
74
|
+
* @returns Solana chain interface with connection enforcement
|
|
73
75
|
*/
|
|
74
76
|
declare function useSolana(): {
|
|
75
|
-
solana:
|
|
76
|
-
signMessage: (message: string | Uint8Array) => Promise<_phantom_parsers.ParsedSignatureResult>;
|
|
77
|
-
signTransaction: <T>(transaction: T) => Promise<T>;
|
|
78
|
-
signAndSendTransaction: <T>(transaction: T) => Promise<_phantom_parsers.ParsedTransactionResult>;
|
|
79
|
-
connect: (options?: {
|
|
80
|
-
onlyIfTrusted?: boolean;
|
|
81
|
-
}) => Promise<{
|
|
82
|
-
publicKey: string;
|
|
83
|
-
}>;
|
|
84
|
-
disconnect: () => Promise<void>;
|
|
85
|
-
switchNetwork: (network: "mainnet" | "devnet") => Promise<void>;
|
|
86
|
-
getPublicKey: () => Promise<string | null>;
|
|
77
|
+
solana: any;
|
|
87
78
|
isAvailable: boolean;
|
|
88
|
-
isConnected: boolean;
|
|
89
79
|
};
|
|
90
80
|
|
|
91
81
|
/**
|
|
92
82
|
* Hook for Ethereum chain operations
|
|
93
83
|
*
|
|
94
|
-
* @returns Ethereum chain interface
|
|
84
|
+
* @returns Ethereum chain interface with connection enforcement
|
|
95
85
|
*/
|
|
96
86
|
declare function useEthereum(): {
|
|
97
|
-
ethereum:
|
|
98
|
-
request: <T = any>(args: {
|
|
99
|
-
method: string;
|
|
100
|
-
params?: unknown[];
|
|
101
|
-
}) => Promise<T>;
|
|
102
|
-
signPersonalMessage: (message: string, address: string) => Promise<string>;
|
|
103
|
-
signMessage: (message: string) => Promise<string>;
|
|
104
|
-
signTypedData: (typedData: any) => Promise<string>;
|
|
105
|
-
sendTransaction: (transaction: EthTransactionRequest) => Promise<_phantom_parsers.ParsedTransactionResult>;
|
|
106
|
-
switchChain: (chainId: number) => Promise<void>;
|
|
107
|
-
getChainId: () => Promise<number>;
|
|
108
|
-
getAccounts: () => Promise<string[]>;
|
|
87
|
+
ethereum: any;
|
|
109
88
|
isAvailable: boolean;
|
|
110
|
-
isConnected: boolean;
|
|
111
89
|
};
|
|
112
90
|
|
|
113
91
|
type ProviderType = "injected" | "embedded";
|