@privy-io/react-auth 1.26.0 → 1.26.1-beta.2

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/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 EIP1193OnEventHandler = ((accounts: string[]) => void) | ((chainId: string | number) => void);
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;