@phantom/browser-sdk 0.0.10 → 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 +648 -100
- package/dist/index.d.ts +118 -3
- package/dist/index.js +769 -10
- package/dist/index.mjs +767 -8
- package/package.json +26 -29
- package/dist/auto-confirm/index.d.ts +0 -10
- package/dist/auto-confirm/index.js +0 -107
- package/dist/auto-confirm/index.mjs +0 -82
- package/dist/chunk-GV6AIHPN.mjs +0 -18
- package/dist/extension/index.d.ts +0 -10
- package/dist/extension/index.js +0 -50
- package/dist/extension/index.mjs +0 -25
- package/dist/index-52a9bded.d.ts +0 -182
- package/dist/solana/index.d.ts +0 -10
- package/dist/solana/index.js +0 -550
- package/dist/solana/index.mjs +0 -515
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { AddressType, NetworkId } from '@phantom/client';
|
|
2
|
+
export { AddressType, NetworkId } from '@phantom/client';
|
|
3
|
+
|
|
4
|
+
interface BrowserSDKConfig {
|
|
5
|
+
providerType: "injected" | "embedded" | (string & Record<never, never>);
|
|
6
|
+
appName?: string;
|
|
7
|
+
addressTypes?: AddressType[];
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
organizationId?: string;
|
|
10
|
+
authUrl?: string;
|
|
11
|
+
embeddedWalletType?: "app-wallet" | "user-wallet" | (string & Record<never, never>);
|
|
12
|
+
solanaProvider?: "web3js" | "kit";
|
|
13
|
+
serverUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
interface WalletAddress {
|
|
16
|
+
addressType: AddressType;
|
|
17
|
+
address: string;
|
|
18
|
+
}
|
|
19
|
+
interface ConnectResult {
|
|
20
|
+
walletId?: string;
|
|
21
|
+
addresses: WalletAddress[];
|
|
22
|
+
}
|
|
23
|
+
interface SignMessageParams {
|
|
24
|
+
message: string;
|
|
25
|
+
networkId: NetworkId;
|
|
26
|
+
}
|
|
27
|
+
interface SignAndSendTransactionParams {
|
|
28
|
+
transaction: any;
|
|
29
|
+
networkId: NetworkId;
|
|
30
|
+
}
|
|
31
|
+
interface SignedTransaction {
|
|
32
|
+
rawTransaction: string;
|
|
33
|
+
}
|
|
34
|
+
interface CreateUserOrganizationParams {
|
|
35
|
+
userId: string;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
interface CreateUserOrganizationResult {
|
|
39
|
+
organizationId: string;
|
|
40
|
+
}
|
|
41
|
+
interface Provider {
|
|
42
|
+
connect(): Promise<ConnectResult>;
|
|
43
|
+
disconnect(): Promise<void>;
|
|
44
|
+
signMessage(params: SignMessageParams): Promise<string>;
|
|
45
|
+
signAndSendTransaction(params: SignAndSendTransactionParams): Promise<SignedTransaction>;
|
|
46
|
+
getAddresses(): WalletAddress[];
|
|
47
|
+
isConnected(): boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ProviderPreference {
|
|
51
|
+
type: "injected" | "embedded";
|
|
52
|
+
embeddedWalletType?: "app-wallet" | "user-wallet";
|
|
53
|
+
}
|
|
54
|
+
interface SwitchProviderOptions {
|
|
55
|
+
embeddedWalletType?: "app-wallet" | "user-wallet" | (string & Record<never, never>);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare class BrowserSDK {
|
|
59
|
+
private providerManager;
|
|
60
|
+
private config;
|
|
61
|
+
constructor(config: BrowserSDKConfig);
|
|
62
|
+
/**
|
|
63
|
+
* Connect to the wallet with optional provider switching
|
|
64
|
+
*/
|
|
65
|
+
connect(options?: {
|
|
66
|
+
providerType?: "injected" | "embedded" | (string & Record<never, never>);
|
|
67
|
+
embeddedWalletType?: "app-wallet" | "user-wallet" | (string & Record<never, never>);
|
|
68
|
+
}): Promise<ConnectResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Switch to a different provider type
|
|
71
|
+
*/
|
|
72
|
+
switchProvider(type: "injected" | "embedded" | (string & Record<never, never>), options?: SwitchProviderOptions): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Get current provider information
|
|
75
|
+
*/
|
|
76
|
+
getCurrentProviderInfo(): ProviderPreference | null;
|
|
77
|
+
/**
|
|
78
|
+
* Wait for Phantom extension to become available
|
|
79
|
+
*/
|
|
80
|
+
waitForPhantomExtension(timeoutMs?: number): Promise<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Disconnect from the wallet
|
|
83
|
+
*/
|
|
84
|
+
disconnect(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Sign a message
|
|
87
|
+
* @param message - Message string to sign
|
|
88
|
+
* @param networkId - Network identifier
|
|
89
|
+
* @returns Signature string
|
|
90
|
+
*/
|
|
91
|
+
signMessage(params: SignMessageParams): Promise<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Sign and send a transaction
|
|
94
|
+
* @param params - Transaction parameters with native transaction object
|
|
95
|
+
* @returns Transaction result
|
|
96
|
+
*/
|
|
97
|
+
signAndSendTransaction(params: SignAndSendTransactionParams): Promise<SignedTransaction>;
|
|
98
|
+
/**
|
|
99
|
+
* Get wallet addresses
|
|
100
|
+
*/
|
|
101
|
+
getAddresses(): WalletAddress[];
|
|
102
|
+
/**
|
|
103
|
+
* Check if wallet is connected
|
|
104
|
+
*/
|
|
105
|
+
isConnected(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Get the current wallet ID (for embedded wallets)
|
|
108
|
+
*/
|
|
109
|
+
getWalletId(): string | null;
|
|
110
|
+
/**
|
|
111
|
+
* Create a user organization via your backend API
|
|
112
|
+
* @param params - Parameters including userId and any additional options
|
|
113
|
+
* @returns Organization creation result with organizationId
|
|
114
|
+
*/
|
|
115
|
+
createUserOrganization(params: CreateUserOrganizationParams): Promise<CreateUserOrganizationResult>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { BrowserSDK, BrowserSDKConfig, ConnectResult, CreateUserOrganizationParams, CreateUserOrganizationResult, Provider, SignAndSendTransactionParams, SignMessageParams, SignedTransaction, WalletAddress };
|