@privy-io/react-auth 2.7.0 → 2.7.1
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/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/farcaster.js +1 -1
- package/dist/cjs/{frame-Mqj2ph9n.js → frame-B-Or6HA6.js} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/internal-context-D-972JmA.js +1 -0
- package/dist/cjs/privy-provider-kUjrC6Cw.js +27 -0
- package/dist/cjs/{smart-wallets-C7PSePsj.js → smart-wallets-DC0Ul4x6.js} +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/{useActiveWallet-ZMzj2yZK.js → useActiveWallet-Vcnggwyv.js} +1 -1
- package/dist/cjs/{useFundWallet-B-le1Hwp.js → useFundWallet-BYGqrtqz.js} +1 -1
- package/dist/dts/farcaster.d.mts +2 -2
- package/dist/dts/farcaster.d.ts +2 -2
- package/dist/dts/index.d.mts +19 -121
- package/dist/dts/index.d.ts +19 -121
- package/dist/dts/smart-wallets.d.mts +3 -3
- package/dist/dts/smart-wallets.d.ts +3 -3
- package/dist/dts/solana.d.mts +5 -5
- package/dist/dts/solana.d.ts +5 -5
- package/dist/dts/{types-Bv6KFBSe.d.mts → types-Cq3xKsys.d.mts} +3 -195
- package/dist/dts/{types-Bv6KFBSe.d.ts → types-Cq3xKsys.d.ts} +3 -195
- package/dist/dts/ui.d.mts +3 -3
- package/dist/dts/ui.d.ts +3 -3
- package/dist/dts/{useSolanaWallets-DmfTxIs8.d.mts → useSolanaWallets-BADh6ZyK.d.mts} +2 -1
- package/dist/dts/{useSolanaWallets-DmfTxIs8.d.ts → useSolanaWallets-BADh6ZyK.d.ts} +2 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/farcaster.mjs +1 -1
- package/dist/esm/{frame-BqfuK5mX.mjs → frame-BpnDpebm.mjs} +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/{internal-context-cnN4FGtP.mjs → internal-context-D95Bns6A.mjs} +1 -1
- package/dist/esm/privy-provider-BCKJFtPt.mjs +27 -0
- package/dist/esm/{smart-wallets-CD4dnxap.mjs → smart-wallets-CkUTq3Ym.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +2 -2
- package/dist/esm/{useActiveWallet-BX_Fj6ki.mjs → useActiveWallet-jAsui8zn.mjs} +1 -1
- package/dist/esm/{useFundWallet-C43hxi7R.mjs → useFundWallet-ChktspDK.mjs} +1 -1
- package/package.json +6 -5
- package/dist/cjs/internal-context-D_DHIn45.js +0 -1
- package/dist/cjs/privy-provider-BZuQMAQL.js +0 -27
- package/dist/esm/privy-provider-CPOch3uT.mjs +0 -27
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Adapter, WalletError, MessageSignerWalletAdapterProps, WalletAdapterProps, SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
|
-
import { Cluster as Cluster$1, CountryCode } from '@privy-io/js-sdk-core';
|
|
4
|
+
import { Cluster as Cluster$1, ChainLikeWithId, CountryCode, Chain } from '@privy-io/js-sdk-core';
|
|
5
5
|
import { SmartWalletType, CustomMetadataType, PasskeyAuthenticateInputType } from '@privy-io/public-api';
|
|
6
|
-
import EventEmitter from 'eventemitter3';
|
|
7
6
|
import { TypedMessage as TypedMessage$1, MessageTypes as MessageTypes$1 } from '@metamask/eth-sig-util';
|
|
8
7
|
import { Transaction, VersionedTransaction, ParsedTransactionWithMeta, Cluster } from '@solana/web3.js';
|
|
8
|
+
import EventEmitter from 'eventemitter3';
|
|
9
9
|
|
|
10
10
|
interface ConnectorEvents {
|
|
11
11
|
walletsUpdated(): void;
|
|
@@ -50,111 +50,6 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
|
|
|
50
50
|
abstract promptConnection(walletClientType: WalletClientType): void;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* These types are fully compatible with WAGMI chain types, in case
|
|
55
|
-
* we need interop in the future.
|
|
56
|
-
*/
|
|
57
|
-
type RpcUrls = {
|
|
58
|
-
http: readonly string[];
|
|
59
|
-
webSocket?: readonly string[];
|
|
60
|
-
};
|
|
61
|
-
type NativeCurrency = {
|
|
62
|
-
name: string;
|
|
63
|
-
/** 2-6 characters long */
|
|
64
|
-
symbol: string;
|
|
65
|
-
decimals: number;
|
|
66
|
-
};
|
|
67
|
-
type BlockExplorer = {
|
|
68
|
-
name: string;
|
|
69
|
-
url: string;
|
|
70
|
-
};
|
|
71
|
-
/** A subset of WAGMI's chain type
|
|
72
|
-
* https://github.com/wagmi-dev/references/blob/6aea7ee9c65cfac24f33173ab3c98176b8366f05/packages/chains/src/types.ts#L8
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
*
|
|
76
|
-
* override the RPC URL for a chain
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* import { mainnet } from 'viem/chains';
|
|
80
|
-
*
|
|
81
|
-
* const mainnetOverride: Chain = {
|
|
82
|
-
* ...mainnet,
|
|
83
|
-
* rpcUrls: {
|
|
84
|
-
* ...mainnet.rpcUrls,
|
|
85
|
-
* privyWalletOverride: {
|
|
86
|
-
* http: [INSERT_MAINNET_OVERRIDE_URL],
|
|
87
|
-
* },
|
|
88
|
-
* },
|
|
89
|
-
* };
|
|
90
|
-
*
|
|
91
|
-
* ```
|
|
92
|
-
* or
|
|
93
|
-
* ```ts
|
|
94
|
-
* import { mainnet } from 'viem/chains';
|
|
95
|
-
* import { addRpcUrlOverrideToChain } from '@privy-io/react-auth';
|
|
96
|
-
*
|
|
97
|
-
* const mainnetOverride = addRpcUrlOverrideToChain(mainnet, INSERT_MAINNET_OVERRIDE_URL);
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
|
-
type Chain = {
|
|
102
|
-
/** Id in number form */
|
|
103
|
-
id: number;
|
|
104
|
-
/** Human readable name */
|
|
105
|
-
name: string;
|
|
106
|
-
/** Internal network name */
|
|
107
|
-
network?: string;
|
|
108
|
-
/** Currency used by chain */
|
|
109
|
-
nativeCurrency: NativeCurrency;
|
|
110
|
-
/** Collection of block explorers */
|
|
111
|
-
blockExplorers?: {
|
|
112
|
-
[key: string]: BlockExplorer;
|
|
113
|
-
default: BlockExplorer;
|
|
114
|
-
};
|
|
115
|
-
/** Collection of RPC endpoints */
|
|
116
|
-
rpcUrls: {
|
|
117
|
-
[key: string]: RpcUrls;
|
|
118
|
-
default: RpcUrls;
|
|
119
|
-
} | {
|
|
120
|
-
[key: string]: RpcUrls;
|
|
121
|
-
default: RpcUrls;
|
|
122
|
-
/** @optional Allows you to override the RPC url for this chain */
|
|
123
|
-
privyWalletOverride: RpcUrls;
|
|
124
|
-
};
|
|
125
|
-
/** Flag for test networks */
|
|
126
|
-
testnet?: boolean;
|
|
127
|
-
};
|
|
128
|
-
type ChainLikeWithId = {
|
|
129
|
-
id: number;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* RPC configuration for wallets.
|
|
133
|
-
*/
|
|
134
|
-
type RpcConfig = {
|
|
135
|
-
/**
|
|
136
|
-
* Mapping of chainId to RPC URL. Overrides Privy default RPC URLs that are shared across projects. Set your own RPC URLs
|
|
137
|
-
* to avoid rate limits or other throughput bottlenecks.
|
|
138
|
-
*
|
|
139
|
-
* Do not provide an RPC URL that can serve multiple networks. You should only provide RPC URLs that are speciifc to the
|
|
140
|
-
* chain ID you'd like to override.
|
|
141
|
-
*/
|
|
142
|
-
rpcUrls?: {
|
|
143
|
-
[key: number]: string;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Mapping between `walletClientType`s to the length of time after which RPC requests will timeout for that
|
|
147
|
-
* `walletClientType`.
|
|
148
|
-
*
|
|
149
|
-
* By default, all RPC requests through Privy will timeout after 2 mins (120000 ms). Use this object to
|
|
150
|
-
* override the RPC timeout in ms for specific` walletClientType`s, e.g. 'safe', in order to extend or
|
|
151
|
-
* shorten the timeout duration.
|
|
152
|
-
*/
|
|
153
|
-
rpcTimeouts?: {
|
|
154
|
-
[key in WalletClientType]?: number;
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
|
|
158
53
|
declare abstract class PrivyError extends Error {
|
|
159
54
|
/**
|
|
160
55
|
* Privy error type.
|
|
@@ -1137,80 +1032,9 @@ type OAuthTokens = {
|
|
|
1137
1032
|
/** The list of OAuth scopes the access token is approved for. */
|
|
1138
1033
|
scopes?: string[];
|
|
1139
1034
|
};
|
|
1140
|
-
type TelegramAuthConfiguration = {
|
|
1141
|
-
botId: string;
|
|
1142
|
-
botName: string;
|
|
1143
|
-
seamlessAuthEnabled: boolean;
|
|
1144
|
-
};
|
|
1145
1035
|
type FundingMethod = 'moonpay' | 'coinbase-onramp' | 'external';
|
|
1146
|
-
type FundingOption = {
|
|
1147
|
-
method: string;
|
|
1148
|
-
provider: string;
|
|
1149
|
-
};
|
|
1150
|
-
type FundingConfig = {
|
|
1151
|
-
/** The recommended currency for the user to fund. Note: to begin with we default to the chain's native currency. */
|
|
1152
|
-
defaultRecommendedCurrency: {
|
|
1153
|
-
chain: string;
|
|
1154
|
-
asset?: 'native-currency' | 'USDC';
|
|
1155
|
-
};
|
|
1156
|
-
/** The recommended amount of the specified currency to fund, in human readable format (eg '0.1') */
|
|
1157
|
-
defaultRecommendedAmount: string;
|
|
1158
|
-
/** @deprecated Use options. The list of funding methods enabled for the app */
|
|
1159
|
-
methods: FundingMethod[];
|
|
1160
|
-
/** The list of funding methods enabled for the app */
|
|
1161
|
-
options: FundingOption[];
|
|
1162
|
-
/** Whether to prompt the user to fund upon embedded wallet creation */
|
|
1163
|
-
promptFundingOnWalletCreation: boolean;
|
|
1164
|
-
/** Determines if EVM<->SOL bridging is enabled */
|
|
1165
|
-
crossChainBridgingEnabled?: boolean;
|
|
1166
|
-
};
|
|
1167
1036
|
/** The default funding method to immediately trigger when funding is requested */
|
|
1168
1037
|
type DefaultFundingMethod = 'card' | 'exchange' | 'wallet' | 'manual';
|
|
1169
|
-
type PrivyServerConfig = {
|
|
1170
|
-
id?: string;
|
|
1171
|
-
name?: string;
|
|
1172
|
-
verificationKey?: string;
|
|
1173
|
-
showWalletLoginFirst?: boolean;
|
|
1174
|
-
allowlistConfig: AllowlistConfig;
|
|
1175
|
-
walletAuth?: boolean;
|
|
1176
|
-
solanaWalletAuth?: boolean;
|
|
1177
|
-
emailAuth?: boolean;
|
|
1178
|
-
smsAuth?: boolean;
|
|
1179
|
-
googleOAuth?: boolean;
|
|
1180
|
-
twitterOAuth?: boolean;
|
|
1181
|
-
discordOAuth?: boolean;
|
|
1182
|
-
githubOAuth?: boolean;
|
|
1183
|
-
spotifyOAuth?: boolean;
|
|
1184
|
-
instagramOAuth?: boolean;
|
|
1185
|
-
tiktokOAuth?: boolean;
|
|
1186
|
-
linkedinOAuth?: boolean;
|
|
1187
|
-
appleOAuth?: boolean;
|
|
1188
|
-
farcasterAuth?: boolean;
|
|
1189
|
-
passkeyAuth?: boolean;
|
|
1190
|
-
passkeysForSignupEnabled?: boolean;
|
|
1191
|
-
telegramAuth?: boolean;
|
|
1192
|
-
disablePlusEmails: boolean;
|
|
1193
|
-
termsAndConditionsUrl: string | null;
|
|
1194
|
-
privacyPolicyUrl: string | null;
|
|
1195
|
-
requireUsersAcceptTerms?: boolean;
|
|
1196
|
-
createdAt?: Date;
|
|
1197
|
-
updatedAt?: Date;
|
|
1198
|
-
customApiUrl?: string | null;
|
|
1199
|
-
walletConnectCloudProjectId?: string | null;
|
|
1200
|
-
embeddedWalletConfig: EmbeddedWalletsConfig;
|
|
1201
|
-
fiatOnRampEnabled?: boolean;
|
|
1202
|
-
captchaEnabled?: boolean;
|
|
1203
|
-
captchaSiteKey: string;
|
|
1204
|
-
enforceWalletUis?: boolean;
|
|
1205
|
-
legacyWalletUiConfig?: boolean;
|
|
1206
|
-
/** May be deprecated from the server config in a future release */
|
|
1207
|
-
logoUrl?: string;
|
|
1208
|
-
/** May be deprecated from the server config in a future release */
|
|
1209
|
-
accentColor?: string;
|
|
1210
|
-
mfaMethods?: Array<MfaMethod>;
|
|
1211
|
-
telegramAuthConfiguration?: TelegramAuthConfiguration;
|
|
1212
|
-
fundingConfig?: FundingConfig;
|
|
1213
|
-
};
|
|
1214
1038
|
type HexColor = `#${string}`;
|
|
1215
1039
|
/**
|
|
1216
1040
|
* Options to customize the display of transaction prices in the embedded wallet's transaction prompt.
|
|
@@ -1700,23 +1524,7 @@ type SmartWalletNetworkConfig = {
|
|
|
1700
1524
|
paymasterUrl?: string;
|
|
1701
1525
|
paymasterContext?: AlchemyPaymasterContextClient | BiconomyPaymasterContext;
|
|
1702
1526
|
};
|
|
1703
|
-
interface AllowlistConfig {
|
|
1704
|
-
errorTitle: string | null;
|
|
1705
|
-
errorDetail: string | null;
|
|
1706
|
-
errorCtaText: string | null;
|
|
1707
|
-
errorCtaLink: string | null;
|
|
1708
|
-
}
|
|
1709
1527
|
type EmbeddedWalletCreateOnLoginConfig = 'users-without-wallets' | 'all-users' | 'off';
|
|
1710
|
-
interface EmbeddedWalletsConfig {
|
|
1711
|
-
ethereum: {
|
|
1712
|
-
createOnLogin: EmbeddedWalletCreateOnLoginConfig;
|
|
1713
|
-
};
|
|
1714
|
-
solana: {
|
|
1715
|
-
createOnLogin: EmbeddedWalletCreateOnLoginConfig;
|
|
1716
|
-
};
|
|
1717
|
-
requireUserOwnedRecoveryOnCreate: boolean;
|
|
1718
|
-
userOwnedRecoveryOptions: UserRecoveryMethod[];
|
|
1719
|
-
}
|
|
1720
1528
|
type OtpFlowState = {
|
|
1721
1529
|
status: 'initial';
|
|
1722
1530
|
} | {
|
|
@@ -2164,4 +1972,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
|
|
|
2164
1972
|
type SolanaRpcRequestType = solana_signMessage;
|
|
2165
1973
|
type SolanaRpcResponseType = solana_signMessageResponse;
|
|
2166
1974
|
|
|
2167
|
-
export { type
|
|
1975
|
+
export { type SiweWalletMetadata as $, type WalletListEntry as A, type BaseConnectedEthereumWallet as B, type ConnectedSolanaWallet as C, type ExternalWalletsConfig as D, type EthereumRpcRequestType as E, type FundingMethod as F, type BaseConnectedWallet as G, type ConnectWalletModalOptions as H, type LoginModalOptions as I, type SetWalletRecoveryOptions as J, type SignTypedDataParams as K, type LoginToFrame as L, type MfaMethod as M, type UnsignedTransactionRequest as N, type OAuthTokens as O, PrivyErrorCode as P, type FundWalletConfig as Q, type RuntimeLoginOverridableOptions as R, type SolanaTransactionReceipt as S, type ConnectedWallet as T, type User as U, type CrossAppProviderDetails as V, type Wallet as W, type OAuthProviderType as X, type MoonpaySignRequest as Y, type MoonpaySignResponse as Z, type SmartWalletConfig as _, type LoginMethod as a, type TelegramAuthResult as a0, type TelegramWebAppData as a1, type OAuthUserInfo as a2, type OAuthFlowState as a3, type LoginWithCode as a4, type OtpFlowState as a5, type PasskeyFlowState as a6, type SiweFlowState as a7, type UnsignedTransactionRequestWithChainId as a8, type BaseConnectedWalletType as a9, type TwitterOAuthWithMetadata as aA, type DiscordOAuthWithMetadata as aB, type GithubOAuthWithMetadata as aC, type TiktokOAuthWithMetadata as aD, type LinkedInOAuthWithMetadata as aE, type AppleOAuthWithMetadata as aF, type FarcasterWithMetadata as aG, type TelegramWithMetadata as aH, type CrossAppAccountWithMetadata as aI, type PasskeyWithMetadata as aJ, type Email as aK, type Phone as aL, type TransactionUIOptions as aM, type ContractUIOptions as aN, type NativeFundingConfig as aO, type MoonpayFundingConfig as aP, type PriceDisplayOptions as aQ, type Farcaster as aR, type Passkey as aS, type LoginMethodOrderOption as aT, type CustomAuthFlowState as aa, type TelegramAuthFlowState as ab, type TypedMessage as ac, type MessageTypes as ad, type SmartWallet as ae, type MoonpayConfig as af, type MoonpayCurrencyCode as ag, type MoonpayPaymentMethod as ah, type Quantity as ai, type TransactionLog as aj, type TransactionReceipt as ak, type NonEmptyArray as al, type EmailWithMetadata as am, type PhoneWithMetadata as an, type WalletWithMetadata as ao, type Google as ap, type Twitter as aq, type Discord as ar, type Github as as, type LinkedIn as at, type Apple as au, type Tiktok as av, type Telegram as aw, type CrossAppAccount as ax, type LinkedAccountType as ay, type GoogleOAuthWithMetadata as az, type LinkedAccountWithMetadata as b, type BaseConnectedSolanaWallet as c, type UserRecoveryMethod as d, type SupportedSolanaTransaction as e, type SolanaCluster as f, type CreateWalletOptions as g, type SendTransactionModalUIOptions as h, type SignMessageModalUIOptions as i, type SolanaFundingConfig as j, SolanaWalletConnector as k, type WalletClientType as l, type PrivyFarcasterSignerInitResponse as m, type MfaSubmitArgs as n, type SolanaRpcRequestType as o, type EthereumRpcResponseType as p, type SolanaRpcResponseType as q, type PrivyClientConfig as r, type EIP1193Provider as s, toSolanaWalletConnectors as t, type EntropyIdVerifier as u, type RequestArguments as v, WalletTimeoutError as w, WalletConnector as x, type ConnectedWalletMetadata as y, type ConnectorType as z };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Adapter, WalletError, MessageSignerWalletAdapterProps, WalletAdapterProps, SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
|
-
import { Cluster as Cluster$1, CountryCode } from '@privy-io/js-sdk-core';
|
|
4
|
+
import { Cluster as Cluster$1, ChainLikeWithId, CountryCode, Chain } from '@privy-io/js-sdk-core';
|
|
5
5
|
import { SmartWalletType, CustomMetadataType, PasskeyAuthenticateInputType } from '@privy-io/public-api';
|
|
6
|
-
import EventEmitter from 'eventemitter3';
|
|
7
6
|
import { TypedMessage as TypedMessage$1, MessageTypes as MessageTypes$1 } from '@metamask/eth-sig-util';
|
|
8
7
|
import { Transaction, VersionedTransaction, ParsedTransactionWithMeta, Cluster } from '@solana/web3.js';
|
|
8
|
+
import EventEmitter from 'eventemitter3';
|
|
9
9
|
|
|
10
10
|
interface ConnectorEvents {
|
|
11
11
|
walletsUpdated(): void;
|
|
@@ -50,111 +50,6 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
|
|
|
50
50
|
abstract promptConnection(walletClientType: WalletClientType): void;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* These types are fully compatible with WAGMI chain types, in case
|
|
55
|
-
* we need interop in the future.
|
|
56
|
-
*/
|
|
57
|
-
type RpcUrls = {
|
|
58
|
-
http: readonly string[];
|
|
59
|
-
webSocket?: readonly string[];
|
|
60
|
-
};
|
|
61
|
-
type NativeCurrency = {
|
|
62
|
-
name: string;
|
|
63
|
-
/** 2-6 characters long */
|
|
64
|
-
symbol: string;
|
|
65
|
-
decimals: number;
|
|
66
|
-
};
|
|
67
|
-
type BlockExplorer = {
|
|
68
|
-
name: string;
|
|
69
|
-
url: string;
|
|
70
|
-
};
|
|
71
|
-
/** A subset of WAGMI's chain type
|
|
72
|
-
* https://github.com/wagmi-dev/references/blob/6aea7ee9c65cfac24f33173ab3c98176b8366f05/packages/chains/src/types.ts#L8
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
*
|
|
76
|
-
* override the RPC URL for a chain
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* import { mainnet } from 'viem/chains';
|
|
80
|
-
*
|
|
81
|
-
* const mainnetOverride: Chain = {
|
|
82
|
-
* ...mainnet,
|
|
83
|
-
* rpcUrls: {
|
|
84
|
-
* ...mainnet.rpcUrls,
|
|
85
|
-
* privyWalletOverride: {
|
|
86
|
-
* http: [INSERT_MAINNET_OVERRIDE_URL],
|
|
87
|
-
* },
|
|
88
|
-
* },
|
|
89
|
-
* };
|
|
90
|
-
*
|
|
91
|
-
* ```
|
|
92
|
-
* or
|
|
93
|
-
* ```ts
|
|
94
|
-
* import { mainnet } from 'viem/chains';
|
|
95
|
-
* import { addRpcUrlOverrideToChain } from '@privy-io/react-auth';
|
|
96
|
-
*
|
|
97
|
-
* const mainnetOverride = addRpcUrlOverrideToChain(mainnet, INSERT_MAINNET_OVERRIDE_URL);
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
|
-
type Chain = {
|
|
102
|
-
/** Id in number form */
|
|
103
|
-
id: number;
|
|
104
|
-
/** Human readable name */
|
|
105
|
-
name: string;
|
|
106
|
-
/** Internal network name */
|
|
107
|
-
network?: string;
|
|
108
|
-
/** Currency used by chain */
|
|
109
|
-
nativeCurrency: NativeCurrency;
|
|
110
|
-
/** Collection of block explorers */
|
|
111
|
-
blockExplorers?: {
|
|
112
|
-
[key: string]: BlockExplorer;
|
|
113
|
-
default: BlockExplorer;
|
|
114
|
-
};
|
|
115
|
-
/** Collection of RPC endpoints */
|
|
116
|
-
rpcUrls: {
|
|
117
|
-
[key: string]: RpcUrls;
|
|
118
|
-
default: RpcUrls;
|
|
119
|
-
} | {
|
|
120
|
-
[key: string]: RpcUrls;
|
|
121
|
-
default: RpcUrls;
|
|
122
|
-
/** @optional Allows you to override the RPC url for this chain */
|
|
123
|
-
privyWalletOverride: RpcUrls;
|
|
124
|
-
};
|
|
125
|
-
/** Flag for test networks */
|
|
126
|
-
testnet?: boolean;
|
|
127
|
-
};
|
|
128
|
-
type ChainLikeWithId = {
|
|
129
|
-
id: number;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* RPC configuration for wallets.
|
|
133
|
-
*/
|
|
134
|
-
type RpcConfig = {
|
|
135
|
-
/**
|
|
136
|
-
* Mapping of chainId to RPC URL. Overrides Privy default RPC URLs that are shared across projects. Set your own RPC URLs
|
|
137
|
-
* to avoid rate limits or other throughput bottlenecks.
|
|
138
|
-
*
|
|
139
|
-
* Do not provide an RPC URL that can serve multiple networks. You should only provide RPC URLs that are speciifc to the
|
|
140
|
-
* chain ID you'd like to override.
|
|
141
|
-
*/
|
|
142
|
-
rpcUrls?: {
|
|
143
|
-
[key: number]: string;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Mapping between `walletClientType`s to the length of time after which RPC requests will timeout for that
|
|
147
|
-
* `walletClientType`.
|
|
148
|
-
*
|
|
149
|
-
* By default, all RPC requests through Privy will timeout after 2 mins (120000 ms). Use this object to
|
|
150
|
-
* override the RPC timeout in ms for specific` walletClientType`s, e.g. 'safe', in order to extend or
|
|
151
|
-
* shorten the timeout duration.
|
|
152
|
-
*/
|
|
153
|
-
rpcTimeouts?: {
|
|
154
|
-
[key in WalletClientType]?: number;
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
|
|
158
53
|
declare abstract class PrivyError extends Error {
|
|
159
54
|
/**
|
|
160
55
|
* Privy error type.
|
|
@@ -1137,80 +1032,9 @@ type OAuthTokens = {
|
|
|
1137
1032
|
/** The list of OAuth scopes the access token is approved for. */
|
|
1138
1033
|
scopes?: string[];
|
|
1139
1034
|
};
|
|
1140
|
-
type TelegramAuthConfiguration = {
|
|
1141
|
-
botId: string;
|
|
1142
|
-
botName: string;
|
|
1143
|
-
seamlessAuthEnabled: boolean;
|
|
1144
|
-
};
|
|
1145
1035
|
type FundingMethod = 'moonpay' | 'coinbase-onramp' | 'external';
|
|
1146
|
-
type FundingOption = {
|
|
1147
|
-
method: string;
|
|
1148
|
-
provider: string;
|
|
1149
|
-
};
|
|
1150
|
-
type FundingConfig = {
|
|
1151
|
-
/** The recommended currency for the user to fund. Note: to begin with we default to the chain's native currency. */
|
|
1152
|
-
defaultRecommendedCurrency: {
|
|
1153
|
-
chain: string;
|
|
1154
|
-
asset?: 'native-currency' | 'USDC';
|
|
1155
|
-
};
|
|
1156
|
-
/** The recommended amount of the specified currency to fund, in human readable format (eg '0.1') */
|
|
1157
|
-
defaultRecommendedAmount: string;
|
|
1158
|
-
/** @deprecated Use options. The list of funding methods enabled for the app */
|
|
1159
|
-
methods: FundingMethod[];
|
|
1160
|
-
/** The list of funding methods enabled for the app */
|
|
1161
|
-
options: FundingOption[];
|
|
1162
|
-
/** Whether to prompt the user to fund upon embedded wallet creation */
|
|
1163
|
-
promptFundingOnWalletCreation: boolean;
|
|
1164
|
-
/** Determines if EVM<->SOL bridging is enabled */
|
|
1165
|
-
crossChainBridgingEnabled?: boolean;
|
|
1166
|
-
};
|
|
1167
1036
|
/** The default funding method to immediately trigger when funding is requested */
|
|
1168
1037
|
type DefaultFundingMethod = 'card' | 'exchange' | 'wallet' | 'manual';
|
|
1169
|
-
type PrivyServerConfig = {
|
|
1170
|
-
id?: string;
|
|
1171
|
-
name?: string;
|
|
1172
|
-
verificationKey?: string;
|
|
1173
|
-
showWalletLoginFirst?: boolean;
|
|
1174
|
-
allowlistConfig: AllowlistConfig;
|
|
1175
|
-
walletAuth?: boolean;
|
|
1176
|
-
solanaWalletAuth?: boolean;
|
|
1177
|
-
emailAuth?: boolean;
|
|
1178
|
-
smsAuth?: boolean;
|
|
1179
|
-
googleOAuth?: boolean;
|
|
1180
|
-
twitterOAuth?: boolean;
|
|
1181
|
-
discordOAuth?: boolean;
|
|
1182
|
-
githubOAuth?: boolean;
|
|
1183
|
-
spotifyOAuth?: boolean;
|
|
1184
|
-
instagramOAuth?: boolean;
|
|
1185
|
-
tiktokOAuth?: boolean;
|
|
1186
|
-
linkedinOAuth?: boolean;
|
|
1187
|
-
appleOAuth?: boolean;
|
|
1188
|
-
farcasterAuth?: boolean;
|
|
1189
|
-
passkeyAuth?: boolean;
|
|
1190
|
-
passkeysForSignupEnabled?: boolean;
|
|
1191
|
-
telegramAuth?: boolean;
|
|
1192
|
-
disablePlusEmails: boolean;
|
|
1193
|
-
termsAndConditionsUrl: string | null;
|
|
1194
|
-
privacyPolicyUrl: string | null;
|
|
1195
|
-
requireUsersAcceptTerms?: boolean;
|
|
1196
|
-
createdAt?: Date;
|
|
1197
|
-
updatedAt?: Date;
|
|
1198
|
-
customApiUrl?: string | null;
|
|
1199
|
-
walletConnectCloudProjectId?: string | null;
|
|
1200
|
-
embeddedWalletConfig: EmbeddedWalletsConfig;
|
|
1201
|
-
fiatOnRampEnabled?: boolean;
|
|
1202
|
-
captchaEnabled?: boolean;
|
|
1203
|
-
captchaSiteKey: string;
|
|
1204
|
-
enforceWalletUis?: boolean;
|
|
1205
|
-
legacyWalletUiConfig?: boolean;
|
|
1206
|
-
/** May be deprecated from the server config in a future release */
|
|
1207
|
-
logoUrl?: string;
|
|
1208
|
-
/** May be deprecated from the server config in a future release */
|
|
1209
|
-
accentColor?: string;
|
|
1210
|
-
mfaMethods?: Array<MfaMethod>;
|
|
1211
|
-
telegramAuthConfiguration?: TelegramAuthConfiguration;
|
|
1212
|
-
fundingConfig?: FundingConfig;
|
|
1213
|
-
};
|
|
1214
1038
|
type HexColor = `#${string}`;
|
|
1215
1039
|
/**
|
|
1216
1040
|
* Options to customize the display of transaction prices in the embedded wallet's transaction prompt.
|
|
@@ -1700,23 +1524,7 @@ type SmartWalletNetworkConfig = {
|
|
|
1700
1524
|
paymasterUrl?: string;
|
|
1701
1525
|
paymasterContext?: AlchemyPaymasterContextClient | BiconomyPaymasterContext;
|
|
1702
1526
|
};
|
|
1703
|
-
interface AllowlistConfig {
|
|
1704
|
-
errorTitle: string | null;
|
|
1705
|
-
errorDetail: string | null;
|
|
1706
|
-
errorCtaText: string | null;
|
|
1707
|
-
errorCtaLink: string | null;
|
|
1708
|
-
}
|
|
1709
1527
|
type EmbeddedWalletCreateOnLoginConfig = 'users-without-wallets' | 'all-users' | 'off';
|
|
1710
|
-
interface EmbeddedWalletsConfig {
|
|
1711
|
-
ethereum: {
|
|
1712
|
-
createOnLogin: EmbeddedWalletCreateOnLoginConfig;
|
|
1713
|
-
};
|
|
1714
|
-
solana: {
|
|
1715
|
-
createOnLogin: EmbeddedWalletCreateOnLoginConfig;
|
|
1716
|
-
};
|
|
1717
|
-
requireUserOwnedRecoveryOnCreate: boolean;
|
|
1718
|
-
userOwnedRecoveryOptions: UserRecoveryMethod[];
|
|
1719
|
-
}
|
|
1720
1528
|
type OtpFlowState = {
|
|
1721
1529
|
status: 'initial';
|
|
1722
1530
|
} | {
|
|
@@ -2164,4 +1972,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
|
|
|
2164
1972
|
type SolanaRpcRequestType = solana_signMessage;
|
|
2165
1973
|
type SolanaRpcResponseType = solana_signMessageResponse;
|
|
2166
1974
|
|
|
2167
|
-
export { type
|
|
1975
|
+
export { type SiweWalletMetadata as $, type WalletListEntry as A, type BaseConnectedEthereumWallet as B, type ConnectedSolanaWallet as C, type ExternalWalletsConfig as D, type EthereumRpcRequestType as E, type FundingMethod as F, type BaseConnectedWallet as G, type ConnectWalletModalOptions as H, type LoginModalOptions as I, type SetWalletRecoveryOptions as J, type SignTypedDataParams as K, type LoginToFrame as L, type MfaMethod as M, type UnsignedTransactionRequest as N, type OAuthTokens as O, PrivyErrorCode as P, type FundWalletConfig as Q, type RuntimeLoginOverridableOptions as R, type SolanaTransactionReceipt as S, type ConnectedWallet as T, type User as U, type CrossAppProviderDetails as V, type Wallet as W, type OAuthProviderType as X, type MoonpaySignRequest as Y, type MoonpaySignResponse as Z, type SmartWalletConfig as _, type LoginMethod as a, type TelegramAuthResult as a0, type TelegramWebAppData as a1, type OAuthUserInfo as a2, type OAuthFlowState as a3, type LoginWithCode as a4, type OtpFlowState as a5, type PasskeyFlowState as a6, type SiweFlowState as a7, type UnsignedTransactionRequestWithChainId as a8, type BaseConnectedWalletType as a9, type TwitterOAuthWithMetadata as aA, type DiscordOAuthWithMetadata as aB, type GithubOAuthWithMetadata as aC, type TiktokOAuthWithMetadata as aD, type LinkedInOAuthWithMetadata as aE, type AppleOAuthWithMetadata as aF, type FarcasterWithMetadata as aG, type TelegramWithMetadata as aH, type CrossAppAccountWithMetadata as aI, type PasskeyWithMetadata as aJ, type Email as aK, type Phone as aL, type TransactionUIOptions as aM, type ContractUIOptions as aN, type NativeFundingConfig as aO, type MoonpayFundingConfig as aP, type PriceDisplayOptions as aQ, type Farcaster as aR, type Passkey as aS, type LoginMethodOrderOption as aT, type CustomAuthFlowState as aa, type TelegramAuthFlowState as ab, type TypedMessage as ac, type MessageTypes as ad, type SmartWallet as ae, type MoonpayConfig as af, type MoonpayCurrencyCode as ag, type MoonpayPaymentMethod as ah, type Quantity as ai, type TransactionLog as aj, type TransactionReceipt as ak, type NonEmptyArray as al, type EmailWithMetadata as am, type PhoneWithMetadata as an, type WalletWithMetadata as ao, type Google as ap, type Twitter as aq, type Discord as ar, type Github as as, type LinkedIn as at, type Apple as au, type Tiktok as av, type Telegram as aw, type CrossAppAccount as ax, type LinkedAccountType as ay, type GoogleOAuthWithMetadata as az, type LinkedAccountWithMetadata as b, type BaseConnectedSolanaWallet as c, type UserRecoveryMethod as d, type SupportedSolanaTransaction as e, type SolanaCluster as f, type CreateWalletOptions as g, type SendTransactionModalUIOptions as h, type SignMessageModalUIOptions as i, type SolanaFundingConfig as j, SolanaWalletConnector as k, type WalletClientType as l, type PrivyFarcasterSignerInitResponse as m, type MfaSubmitArgs as n, type SolanaRpcRequestType as o, type EthereumRpcResponseType as p, type SolanaRpcResponseType as q, type PrivyClientConfig as r, type EIP1193Provider as s, toSolanaWalletConnectors as t, type EntropyIdVerifier as u, type RequestArguments as v, WalletTimeoutError as w, WalletConnector as x, type ConnectedWalletMetadata as y, type ConnectorType as z };
|
package/dist/dts/ui.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RuntimeLoginOverridableOptions
|
|
2
|
+
import { R as RuntimeLoginOverridableOptions } from './types-Cq3xKsys.js';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
|
-
import { Cluster } from '@privy-io/js-sdk-core';
|
|
4
|
+
import { Chain, Cluster } from '@privy-io/js-sdk-core';
|
|
5
5
|
import '@solana/wallet-adapter-base';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@privy-io/public-api';
|
|
8
|
-
import 'eventemitter3';
|
|
9
8
|
import '@metamask/eth-sig-util';
|
|
10
9
|
import '@solana/web3.js';
|
|
10
|
+
import 'eventemitter3';
|
|
11
11
|
|
|
12
12
|
type UserPillProps = {
|
|
13
13
|
action?: {
|
package/dist/dts/ui.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RuntimeLoginOverridableOptions
|
|
2
|
+
import { R as RuntimeLoginOverridableOptions } from './types-Cq3xKsys.js';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
|
-
import { Cluster } from '@privy-io/js-sdk-core';
|
|
4
|
+
import { Chain, Cluster } from '@privy-io/js-sdk-core';
|
|
5
5
|
import '@solana/wallet-adapter-base';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@privy-io/public-api';
|
|
8
|
-
import 'eventemitter3';
|
|
9
8
|
import '@metamask/eth-sig-util';
|
|
10
9
|
import '@solana/web3.js';
|
|
10
|
+
import 'eventemitter3';
|
|
11
11
|
|
|
12
12
|
type UserPillProps = {
|
|
13
13
|
action?: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Chain } from '@privy-io/js-sdk-core';
|
|
2
|
+
import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-Cq3xKsys.js';
|
|
2
3
|
import { MouseEvent } from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Chain } from '@privy-io/js-sdk-core';
|
|
2
|
+
import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-Cq3xKsys.js';
|
|
2
3
|
import { MouseEvent } from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{hexToNumber as
|
|
1
|
+
import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as c}from"viem/chains";import{u as s,f as l,m as d,aj as m,l as p,a as u,ar as h,as as I,at as g,n as y}from"./privy-provider-BCKJFtPt.mjs";import{u as f}from"./internal-context-D95Bns6A.mjs";import{g as v}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as w}from"./smart-wallets-CkUTq3Ym.mjs";import"react/jsx-runtime";import"mipd";import"react";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"@solana/web3.js";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function C(){let{user:C}=s(),{hideWalletUIs:T,openPrivyModal:P,chains:S,appId:b,rpcConfig:A,client:M}=f(),k=l(),{wallets:F}=d(),{setModalData:W}=m(),x=p(C),E=async(o=c.id)=>{let s=v(F);if(!s)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![c.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=S.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await s.switchChain(d.id);let m=await s.getEthereumProvider(),p=t({account:s.address,transport:n(m)}),u=a({address:s.address,signMessage:p.signMessage,signTransaction:p.signTransaction,signTypedData:p.signTypedData});return await e({chain:d,transport:i(y(d,A,b)),publicTransport:i(y(d,A,b)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await E(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=u(C);T.current=!0,W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:h,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},signTypedData:async(e,o)=>{let r=await E(o);return new Promise((async(o,t)=>{T.current=!0;let{entropyId:n,entropyIdVerifier:i}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:h,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},sendTransaction:async e=>{let r=await E(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{T.current=!0;let{entropyId:c,entropyIdVerifier:s}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:w({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:i.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},signTransaction:async e=>{let r=await E(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{T.current=!0;let{entropyId:c,entropyIdVerifier:s}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:w({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:i.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>{if(!n)return r.signTransaction(e);throw Error("Batch transactions not supported for signing")},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))}}}export{C as useAbstractSmartWallets};
|
package/dist/esm/farcaster.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as t}from"react";import{F as e}from"./frame-
|
|
1
|
+
import{useCallback as t}from"react";import{F as e}from"./frame-BpnDpebm.mjs";import{u as i,P as r}from"./internal-context-D95Bns6A.mjs";import"ofetch";const a=()=>{let{client:a,setAuthenticated:n,setUser:s}=i();return{initLoginToFrame:t((async()=>{let t=new e;if(!a)throw new r("Must initialize Privy client first.");return a.startAuthFlow(t),await t.init()}),[a]),loginToFrame:t((async({message:t,signature:i})=>{if(!a)throw new r("Must initialize Privy client first.");if(!(a.authFlow instanceof e))throw new r("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new r("Invalid message format; could not parse Farcaster ID.");a.authFlow.setAuthData({message:t,signature:i,fid:o});let{user:l}=await a.authenticate();return l&&(s(l),n(!0)),l}),[a,s,n])}};export{a as useLoginToFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as t,am as s,an as i,f as e}from"./internal-context-
|
|
1
|
+
import{P as t,am as s,an as i,f as e}from"./internal-context-D95Bns6A.mjs";class a{async init(){if(!this.api)throw new t("Auth flow has no API instance");let{nonce:i,expires_at:e}=await this.api.post(s,{});return{nonce:i,expiresAt:e}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new t("Auth flow has no message, signature, or fid");if(!this.api)throw new t("Auth flow has no API instance");try{let s=await this.api.post(i,{message:this.message,signature:this.signature,fid:this.fid});if(!s)throw new t("No response from authentication");return s}catch(t){throw e(t)}}async link(){throw Error("Not implemented")}setAuthData({message:t,signature:s,fid:i}){this.message=t,this.signature=s,this.fid=i}constructor(){this.meta={}}}export{a as F};
|