@privy-io/react-auth 1.26.0 → 1.26.1-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/dist/esm/index.js +165 -165
- package/dist/index.d.ts +60 -8
- package/dist/index.js +165 -165
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -140,12 +140,65 @@ interface EmbeddedWalletProxy {
|
|
|
140
140
|
rpc: (data: WalletRpcRequestDataType) => Promise<WalletRpcResponseDataType>;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
declare abstract class PrivyError extends Error {
|
|
144
|
+
/**
|
|
145
|
+
* Privy error type.
|
|
146
|
+
*/
|
|
147
|
+
abstract type: string;
|
|
148
|
+
/**
|
|
149
|
+
* Original Error object, it the error originated client-side.
|
|
150
|
+
*/
|
|
151
|
+
cause?: Error;
|
|
152
|
+
/**
|
|
153
|
+
* An optional error code, often included in Privy API responses.
|
|
154
|
+
*/
|
|
155
|
+
privyErrorCode?: PrivyErrorCode;
|
|
156
|
+
/**
|
|
157
|
+
* @param type Privy error type.
|
|
158
|
+
* @param message Human-readable message.
|
|
159
|
+
* @param cause Source of this error.
|
|
160
|
+
*/
|
|
161
|
+
protected constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
|
|
162
|
+
toString(): string;
|
|
163
|
+
}
|
|
164
|
+
declare enum PrivyErrorCode {
|
|
165
|
+
MISSING_OR_INVALID_PRIVY_APP_ID = "missing_or_invalid_privy_app_id",
|
|
166
|
+
MISSING_OR_INVALID_PRIVY_ACCOUNT_ID = "missing_or_invalid_privy_account_id",
|
|
167
|
+
INVALID_DATA = "invalid_data",
|
|
168
|
+
LINKED_TO_ANOTHER_USER = "linked_to_another_user",
|
|
169
|
+
ALLOWLIST_REJECTED = "allowlist_rejected"
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A ProviderRpcError combines the necessary bits of the {PrivyError} with the
|
|
174
|
+
* EIP-compliant ProviderRpcError. This is meant to be a type around errors raised
|
|
175
|
+
* by the ethereum provider.
|
|
176
|
+
*/
|
|
177
|
+
declare class ProviderRpcError extends PrivyError {
|
|
178
|
+
type: string;
|
|
179
|
+
readonly code: number;
|
|
180
|
+
readonly data?: unknown;
|
|
181
|
+
constructor(message: string, code: number, data?: unknown);
|
|
182
|
+
}
|
|
183
|
+
|
|
143
184
|
declare global {
|
|
144
185
|
interface Window {
|
|
145
186
|
ethereum?: unknown;
|
|
146
187
|
}
|
|
147
188
|
}
|
|
148
|
-
type
|
|
189
|
+
type ProviderConnectInfo = {
|
|
190
|
+
chainId: string;
|
|
191
|
+
};
|
|
192
|
+
type OnConnectEventHandler = (connectInfo: ProviderConnectInfo) => void;
|
|
193
|
+
type OnDisconnectEventHandler = (error: ProviderRpcError) => void;
|
|
194
|
+
type OnChainChangedEventHandler = (chainId: string | number) => void;
|
|
195
|
+
type OnAccountsChangedEventHandler = (accounts: string[]) => void;
|
|
196
|
+
type ProviderMessage = {
|
|
197
|
+
type: string;
|
|
198
|
+
data: unknown;
|
|
199
|
+
};
|
|
200
|
+
type OnMessageEventHandler = (message: ProviderMessage) => void;
|
|
201
|
+
type EIP1193OnEventHandler = OnConnectEventHandler | OnDisconnectEventHandler | OnChainChangedEventHandler | OnAccountsChangedEventHandler | OnMessageEventHandler;
|
|
149
202
|
interface EIP1193Provider {
|
|
150
203
|
request: (request: {
|
|
151
204
|
method: string;
|
|
@@ -416,15 +469,14 @@ interface ConnectedWallet extends BaseConnectedWallet {
|
|
|
416
469
|
/** True if this wallet is linked to the authenticated user. False if it is not yet linked or
|
|
417
470
|
* the user has not yet authenticated. */
|
|
418
471
|
linked: boolean;
|
|
419
|
-
/**
|
|
420
|
-
*
|
|
421
|
-
|
|
472
|
+
/** Login with this wallet or link this wallet to the authenticated user.
|
|
473
|
+
*
|
|
474
|
+
* Throws a PrivyClientError if the wallet is not connected.
|
|
475
|
+
*/
|
|
476
|
+
loginOrLink: () => Promise<void>;
|
|
422
477
|
/** Unlink this wallet to the authenticated user. Throws a PrivyClientError if the user is not
|
|
423
478
|
* authenticated. */
|
|
424
479
|
unlink: () => Promise<void>;
|
|
425
|
-
/** Login with this wallet. Throws a PrivyClientError if the user is already authenticated or
|
|
426
|
-
* the wallet is not connected. */
|
|
427
|
-
login: () => Promise<void>;
|
|
428
480
|
}
|
|
429
481
|
/** Object representation of a user's email. */
|
|
430
482
|
interface Email {
|
|
@@ -747,7 +799,7 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
|
|
|
747
799
|
* the wallets away with the following logic:
|
|
748
800
|
*
|
|
749
801
|
* 1. Flatten all wallets from all connectors
|
|
750
|
-
* 2. Sorted by
|
|
802
|
+
* 2. Sorted by connectedAt
|
|
751
803
|
* 3. Active wallet is moved to front of array (if it exists)
|
|
752
804
|
*/
|
|
753
805
|
get wallets(): BaseConnectedWallet[];
|