@phantom/react-sdk 0.0.6 → 0.0.7
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 +5 -5
- package/dist/solana/index.d.ts +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install @phantom/react-sdk @phantom/browser-sdk
|
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
14
|
import React from "react";
|
|
15
|
-
import { PhantomProvider, useConnect } from "@phantom/react-sdk";
|
|
15
|
+
import { PhantomProvider, useConnect } from "@phantom/react-sdk/solana";
|
|
16
16
|
import { createSolanaPlugin } from "@phantom/browser-sdk/solana";
|
|
17
17
|
|
|
18
18
|
function App() {
|
|
@@ -79,7 +79,7 @@ The hook returns an object with the following property:
|
|
|
79
79
|
- `connect: () => Promise<ConnectResponse>` - An asynchronous function that initiates the connection process. Returns a promise that resolves with the connection response (e.g., `{ publicKey: string }`) or rejects if connection fails.
|
|
80
80
|
|
|
81
81
|
```tsx
|
|
82
|
-
import { useConnect } from "@phantom/react-sdk"; // Or '@phantom/react-sdk/solana' if specific
|
|
82
|
+
import { useConnect } from "@phantom/react-sdk/solana"; // Or '@phantom/react-sdk/solana' if specific
|
|
83
83
|
|
|
84
84
|
function MyComponent() {
|
|
85
85
|
const { connect } = useConnect({ autoConnect: true });
|
|
@@ -107,7 +107,7 @@ The hook returns an object with the following property:
|
|
|
107
107
|
- `disconnect: () => Promise<void>` - An asynchronous function that initiates the disconnection process. Returns a promise that resolves when disconnection is complete or rejects if disconnection fails.
|
|
108
108
|
|
|
109
109
|
```tsx
|
|
110
|
-
import { useDisconnect } from "@phantom/react-sdk";
|
|
110
|
+
import { useDisconnect } from "@phantom/react-sdk/solana";
|
|
111
111
|
|
|
112
112
|
function MyComponent() {
|
|
113
113
|
const { disconnect } = useDisconnect();
|
|
@@ -145,7 +145,7 @@ The hook returns an object with the following property:
|
|
|
145
145
|
- `signIn: (signInData: SolanaSignInData) => Promise<{ address: string; signature: Uint8Array; signedMessage: Uint8Array }>` - An asynchronous function that initiates the sign-in process. `SolanaSignInData` is a type imported from `@phantom/browser-sdk/solana`. Returns a promise that resolves with the `address` (string), `signature` (Uint8Array), and `signedMessage` (Uint8Array), or rejects if the sign-in fails.
|
|
146
146
|
|
|
147
147
|
```tsx
|
|
148
|
-
import { useSignIn } from "@phantom/react-sdk";
|
|
148
|
+
import { useSignIn } from "@phantom/react-sdk/solana";
|
|
149
149
|
import { SolanaSignInData } from "@phantom/browser-sdk/solana"; // This type might be needed from the browser-sdk
|
|
150
150
|
|
|
151
151
|
function MyComponent() {
|
|
@@ -186,7 +186,7 @@ The hook returns an object with the following property:
|
|
|
186
186
|
- `signMessage: (message: Uint8Array, display?: 'utf8' | 'hex') => Promise<{ signature: Uint8Array; publicKey: string }>` - An asynchronous function that prompts the user to sign a message. The `message` must be a `Uint8Array`. The optional `display` parameter can be 'utf8' (default) or 'hex' to suggest how the wallet should display the message bytes. Returns a promise that resolves with the `signature` (Uint8Array) and `publicKey` (string) of the signer, or rejects if signing fails.
|
|
187
187
|
|
|
188
188
|
```tsx
|
|
189
|
-
import { useSignMessage } from "@phantom/react-sdk";
|
|
189
|
+
import { useSignMessage } from "@phantom/react-sdk/solana";
|
|
190
190
|
|
|
191
191
|
function MyComponent() {
|
|
192
192
|
const { signMessage } = useSignMessage();
|
package/dist/solana/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SolanaSignInData } from '@phantom/browser-sdk/solana';
|
|
2
2
|
import { Transaction } from '@solana/kit';
|
|
3
|
+
import { VersionedTransaction } from '@solana/web3.js';
|
|
3
4
|
|
|
4
5
|
type UseConnectProps = {
|
|
5
6
|
autoConnect?: boolean;
|
|
@@ -22,7 +23,7 @@ interface UseSignInResult {
|
|
|
22
23
|
declare function useSignIn(): UseSignInResult;
|
|
23
24
|
|
|
24
25
|
interface UseSignAndSendTransactionResult {
|
|
25
|
-
signAndSendTransaction: (transaction: Transaction) => Promise<{
|
|
26
|
+
signAndSendTransaction: (transaction: Transaction | VersionedTransaction) => Promise<{
|
|
26
27
|
signature: string;
|
|
27
28
|
publicKey?: string;
|
|
28
29
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/react-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test": "jest"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@phantom/browser-sdk": "^0.0.
|
|
32
|
+
"@phantom/browser-sdk": "^0.0.7"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@testing-library/dom": "^10.4.0",
|