@phantom/react-sdk 1.0.0-beta.10 → 1.0.0-beta.12
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 +9 -9
- package/dist/index.d.ts +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,8 +52,8 @@ function App() {
|
|
|
52
52
|
|
|
53
53
|
function WalletComponent() {
|
|
54
54
|
const { connect, isConnecting } = useConnect();
|
|
55
|
-
const solana = useSolana();
|
|
56
|
-
const ethereum = useEthereum();
|
|
55
|
+
const { solana } = useSolana();
|
|
56
|
+
const { ethereum } = useEthereum();
|
|
57
57
|
|
|
58
58
|
const handleConnect = async () => {
|
|
59
59
|
const { addresses } = await connect();
|
|
@@ -115,8 +115,8 @@ The React SDK follows a clear connection pattern:
|
|
|
115
115
|
```tsx
|
|
116
116
|
function WalletExample() {
|
|
117
117
|
const { connect } = useConnect();
|
|
118
|
-
const solana = useSolana();
|
|
119
|
-
const ethereum = useEthereum();
|
|
118
|
+
const { solana } = useSolana();
|
|
119
|
+
const { ethereum } = useEthereum();
|
|
120
120
|
|
|
121
121
|
// 1. Connect first
|
|
122
122
|
const handleConnect = async () => {
|
|
@@ -316,7 +316,7 @@ import { useSolana } from "@phantom/react-sdk";
|
|
|
316
316
|
import { VersionedTransaction, TransactionMessage, SystemProgram, PublicKey, Connection } from "@solana/web3.js";
|
|
317
317
|
|
|
318
318
|
function SolanaOperations() {
|
|
319
|
-
const solana = useSolana();
|
|
319
|
+
const { solana } = useSolana();
|
|
320
320
|
|
|
321
321
|
const signMessage = async () => {
|
|
322
322
|
const signature = await solana.signMessage("Hello Solana!");
|
|
@@ -381,7 +381,7 @@ Hook for Ethereum chain operations:
|
|
|
381
381
|
import { useEthereum } from "@phantom/react-sdk";
|
|
382
382
|
|
|
383
383
|
function EthereumOperations() {
|
|
384
|
-
const ethereum = useEthereum();
|
|
384
|
+
const { ethereum } = useEthereum();
|
|
385
385
|
|
|
386
386
|
const signPersonalMessage = async () => {
|
|
387
387
|
const accounts = await ethereum.getAccounts();
|
|
@@ -614,7 +614,7 @@ import { VersionedTransaction, TransactionMessage, SystemProgram, PublicKey, Con
|
|
|
614
614
|
import { useSolana } from "@phantom/react-sdk";
|
|
615
615
|
|
|
616
616
|
function SolanaExample() {
|
|
617
|
-
const solana = useSolana();
|
|
617
|
+
const { solana } = useSolana();
|
|
618
618
|
|
|
619
619
|
const sendTransaction = async () => {
|
|
620
620
|
// Get recent blockhash
|
|
@@ -662,7 +662,7 @@ import {
|
|
|
662
662
|
import { useSolana } from "@phantom/react-sdk";
|
|
663
663
|
|
|
664
664
|
function SolanaKitExample() {
|
|
665
|
-
const solana = useSolana();
|
|
665
|
+
const { solana } = useSolana();
|
|
666
666
|
|
|
667
667
|
const sendTransaction = async () => {
|
|
668
668
|
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
|
|
@@ -693,7 +693,7 @@ import { parseEther, parseGwei, encodeFunctionData } from "viem";
|
|
|
693
693
|
import { useEthereum } from "@phantom/react-sdk";
|
|
694
694
|
|
|
695
695
|
function EthereumExample() {
|
|
696
|
-
const ethereum = useEthereum();
|
|
696
|
+
const { ethereum } = useEthereum();
|
|
697
697
|
|
|
698
698
|
const sendEth = async () => {
|
|
699
699
|
const result = await ethereum.sendTransaction({
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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
|
+
import { ISolanaChain, IEthereumChain } from '@phantom/chain-interfaces';
|
|
6
7
|
export { EthTransactionRequest, IEthereumChain, ISolanaChain } from '@phantom/chain-interfaces';
|
|
7
8
|
|
|
8
9
|
type PhantomSDKConfig = BrowserSDKConfig;
|
|
@@ -74,7 +75,7 @@ declare function useAutoConfirm(): UseAutoConfirmResult;
|
|
|
74
75
|
* @returns Solana chain interface with connection enforcement
|
|
75
76
|
*/
|
|
76
77
|
declare function useSolana(): {
|
|
77
|
-
solana:
|
|
78
|
+
solana: ISolanaChain;
|
|
78
79
|
isAvailable: boolean;
|
|
79
80
|
};
|
|
80
81
|
|
|
@@ -84,7 +85,7 @@ declare function useSolana(): {
|
|
|
84
85
|
* @returns Ethereum chain interface with connection enforcement
|
|
85
86
|
*/
|
|
86
87
|
declare function useEthereum(): {
|
|
87
|
-
ethereum:
|
|
88
|
+
ethereum: IEthereumChain;
|
|
88
89
|
isAvailable: boolean;
|
|
89
90
|
};
|
|
90
91
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/react-sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.12",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@phantom/browser-sdk": "^1.0.0-beta.
|
|
29
|
+
"@phantom/browser-sdk": "^1.0.0-beta.12",
|
|
30
30
|
"@phantom/chain-interfaces": "^1.0.0-beta.6",
|
|
31
31
|
"@phantom/constants": "^1.0.0-beta.6"
|
|
32
32
|
},
|