@privy-io/react-auth 1.36.1 → 1.37.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/dist/esm/index.js +143 -143
- package/dist/index.d.ts +50 -46
- package/dist/index.js +168 -168
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ type TransactionReceipt = {
|
|
|
64
64
|
status?: number;
|
|
65
65
|
gasUsed: string;
|
|
66
66
|
cumulativeGasUsed: string;
|
|
67
|
-
effectiveGasPrice
|
|
67
|
+
effectiveGasPrice?: string;
|
|
68
68
|
};
|
|
69
69
|
interface BaseRpcRequestType {
|
|
70
70
|
method: JsonRpcMethodType;
|
|
@@ -112,44 +112,6 @@ interface eth_signTypedData_v4Response {
|
|
|
112
112
|
type RpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4;
|
|
113
113
|
type RpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response;
|
|
114
114
|
|
|
115
|
-
type WalletCreateRequestDataType = {
|
|
116
|
-
accessToken: string;
|
|
117
|
-
recoveryPin?: string;
|
|
118
|
-
};
|
|
119
|
-
type WalletConnectRequestDataType = {
|
|
120
|
-
accessToken: string;
|
|
121
|
-
address: string;
|
|
122
|
-
};
|
|
123
|
-
type WalletRecoverRequestDataType = {
|
|
124
|
-
accessToken: string;
|
|
125
|
-
address: string;
|
|
126
|
-
recoveryPin?: string;
|
|
127
|
-
};
|
|
128
|
-
type WalletRpcRequestDataType = {
|
|
129
|
-
accessToken: string;
|
|
130
|
-
address: string;
|
|
131
|
-
request: RpcRequestType;
|
|
132
|
-
};
|
|
133
|
-
type WalletCreateResponseDataType = {
|
|
134
|
-
address: string;
|
|
135
|
-
};
|
|
136
|
-
type WalletConnectResponseDataType = {
|
|
137
|
-
address: string;
|
|
138
|
-
};
|
|
139
|
-
type WalletRecoverResponseDataType = {
|
|
140
|
-
address: string;
|
|
141
|
-
};
|
|
142
|
-
type WalletRpcResponseDataType = {
|
|
143
|
-
address: string;
|
|
144
|
-
response: RpcResponseType;
|
|
145
|
-
};
|
|
146
|
-
interface EmbeddedWalletProxy {
|
|
147
|
-
create: (data: WalletCreateRequestDataType) => Promise<WalletCreateResponseDataType>;
|
|
148
|
-
connect: (data: WalletConnectRequestDataType) => Promise<WalletConnectResponseDataType>;
|
|
149
|
-
recover: (data: WalletRecoverRequestDataType) => Promise<WalletRecoverResponseDataType>;
|
|
150
|
-
rpc: (data: WalletRpcRequestDataType) => Promise<WalletRpcResponseDataType>;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
115
|
/**
|
|
154
116
|
* These types are fully compatible with WAGMI chain types, in case
|
|
155
117
|
* we need interop in the future.
|
|
@@ -209,7 +171,45 @@ type RpcConfig = {
|
|
|
209
171
|
};
|
|
210
172
|
};
|
|
211
173
|
|
|
212
|
-
declare const
|
|
174
|
+
declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain];
|
|
175
|
+
|
|
176
|
+
type WalletCreateRequestDataType = {
|
|
177
|
+
accessToken: string;
|
|
178
|
+
recoveryPin?: string;
|
|
179
|
+
};
|
|
180
|
+
type WalletConnectRequestDataType = {
|
|
181
|
+
accessToken: string;
|
|
182
|
+
address: string;
|
|
183
|
+
};
|
|
184
|
+
type WalletRecoverRequestDataType = {
|
|
185
|
+
accessToken: string;
|
|
186
|
+
address: string;
|
|
187
|
+
recoveryPin?: string;
|
|
188
|
+
};
|
|
189
|
+
type WalletRpcRequestDataType = {
|
|
190
|
+
accessToken: string;
|
|
191
|
+
address: string;
|
|
192
|
+
request: RpcRequestType;
|
|
193
|
+
};
|
|
194
|
+
type WalletCreateResponseDataType = {
|
|
195
|
+
address: string;
|
|
196
|
+
};
|
|
197
|
+
type WalletConnectResponseDataType = {
|
|
198
|
+
address: string;
|
|
199
|
+
};
|
|
200
|
+
type WalletRecoverResponseDataType = {
|
|
201
|
+
address: string;
|
|
202
|
+
};
|
|
203
|
+
type WalletRpcResponseDataType = {
|
|
204
|
+
address: string;
|
|
205
|
+
response: RpcResponseType;
|
|
206
|
+
};
|
|
207
|
+
interface EmbeddedWalletProxy {
|
|
208
|
+
create: (data: WalletCreateRequestDataType) => Promise<WalletCreateResponseDataType>;
|
|
209
|
+
connect: (data: WalletConnectRequestDataType) => Promise<WalletConnectResponseDataType>;
|
|
210
|
+
recover: (data: WalletRecoverRequestDataType) => Promise<WalletRecoverResponseDataType>;
|
|
211
|
+
rpc: (data: WalletRpcRequestDataType) => Promise<WalletRpcResponseDataType>;
|
|
212
|
+
}
|
|
213
213
|
|
|
214
214
|
declare abstract class PrivyError extends Error {
|
|
215
215
|
/**
|
|
@@ -312,7 +312,8 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
312
312
|
provider: StaticJsonRpcProvider;
|
|
313
313
|
chainId: number;
|
|
314
314
|
rpcConfig: RpcConfig;
|
|
315
|
-
|
|
315
|
+
chains: Chain[];
|
|
316
|
+
constructor(walletProxy: EmbeddedWalletProxy, address: string, rpcConfig: RpcConfig, chains: Chain[], chainId?: number);
|
|
316
317
|
handleSendTransaction(args: RequestArguments): Promise<string>;
|
|
317
318
|
private handleSwitchEthereumChain;
|
|
318
319
|
private handlePersonalSign;
|
|
@@ -367,9 +368,10 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
|
|
|
367
368
|
initialized: boolean;
|
|
368
369
|
wallets: BaseConnectedWallet[];
|
|
369
370
|
walletClientType: WalletClientType;
|
|
371
|
+
chains: Chain[];
|
|
370
372
|
abstract connectorType: ConnectorType;
|
|
371
373
|
abstract proxyProvider: PrivyProxyProvider | Embedded1193Provider;
|
|
372
|
-
constructor(walletClientType: WalletClientType);
|
|
374
|
+
constructor(walletClientType: WalletClientType, chains: Chain[]);
|
|
373
375
|
/**
|
|
374
376
|
* Builds a connected wallet object to be exposed to the developer. This object
|
|
375
377
|
* contains the address, chainId, and a few helper methods.
|
|
@@ -572,7 +574,8 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
|
|
|
572
574
|
private activeWallet?;
|
|
573
575
|
private walletConnectCloudProjectId;
|
|
574
576
|
private rpcConfig;
|
|
575
|
-
|
|
577
|
+
private chains;
|
|
578
|
+
constructor(walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[]);
|
|
576
579
|
/**
|
|
577
580
|
* The core wallets array that is exposed to developers. It builds
|
|
578
581
|
* the wallets away with the following logic:
|
|
@@ -684,7 +687,7 @@ declare class PrivyClient {
|
|
|
684
687
|
* config. We can set this once and only once. If it is set twice, event listeners will be created
|
|
685
688
|
* on the first ConnectorManager and are not re-created.
|
|
686
689
|
*/
|
|
687
|
-
initializeConnectorManager(walletConnectCloudProjectId: string, rpcConfig: RpcConfig): void;
|
|
690
|
+
initializeConnectorManager(walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[]): void;
|
|
688
691
|
generateApi(): Http;
|
|
689
692
|
/**
|
|
690
693
|
* In the case of cookie-based auth, re-initialize the http client with the custom api url.
|
|
@@ -736,7 +739,7 @@ declare class PrivyClient {
|
|
|
736
739
|
disableAutoRefresh?: boolean;
|
|
737
740
|
}): Promise<string | null>;
|
|
738
741
|
getServerConfig(): Promise<PrivyServerConfig>;
|
|
739
|
-
getUsdTokenPrice(
|
|
742
|
+
getUsdTokenPrice(chain: Chain): Promise<number | undefined>;
|
|
740
743
|
/**
|
|
741
744
|
* Get a short-lived token to start a new Privy session from the existing authenticated session.
|
|
742
745
|
*
|
|
@@ -1225,6 +1228,7 @@ type PrivyClientConfig = {
|
|
|
1225
1228
|
* @experimental
|
|
1226
1229
|
*/
|
|
1227
1230
|
rpcConfig?: RpcConfig;
|
|
1231
|
+
additionalChains?: Chain[];
|
|
1228
1232
|
captchaEnabled?: boolean;
|
|
1229
1233
|
/** All embedded wallets configuration */
|
|
1230
1234
|
embeddedWallets?: {
|
|
@@ -1840,4 +1844,4 @@ declare function useConnectWallet(callbacks?: PrivyEvents['connectWallet']): {
|
|
|
1840
1844
|
connectWallet: () => void;
|
|
1841
1845
|
};
|
|
1842
1846
|
|
|
1843
|
-
export { Apple, AppleOAuthWithMetadata, AsExternalProvider, CallbackError, ConnectedWallet, ConnectorManager, ContractUIOptions, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, FundWalletConfig, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, MoonpayConfig, MoonpayCurrencyCode, MoonpayPaymentMethod, Phone, PhoneWithMetadata, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, SUPPORTED_CHAINS, SendTransactionModalUIOptions, SignMessageModalUIOptions, TransactionLog, TransactionReceipt, TransactionUIOptions, Twitter, TwitterOAuthWithMetadata, UnsignedTransactionRequest, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletWithMetadata, getAccessToken, useConnectWallet, useLogin, useLogout, usePrivy, useWallets };
|
|
1847
|
+
export { Apple, AppleOAuthWithMetadata, AsExternalProvider, CallbackError, ConnectedWallet, ConnectorManager, ContractUIOptions, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, FundWalletConfig, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, MoonpayConfig, MoonpayCurrencyCode, MoonpayPaymentMethod, Phone, PhoneWithMetadata, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendTransactionModalUIOptions, SignMessageModalUIOptions, TransactionLog, TransactionReceipt, TransactionUIOptions, Twitter, TwitterOAuthWithMetadata, UnsignedTransactionRequest, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletWithMetadata, getAccessToken, useConnectWallet, useLogin, useLogout, usePrivy, useWallets };
|