thirdweb 5.64.1 → 5.64.3-nightly-ddec3dadcc260e0d4d0ed2b43c502e0915a14203-20241029000326
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/auth/core/generate-login-payload.js +1 -1
- package/dist/cjs/auth/core/generate-login-payload.js.map +1 -1
- package/dist/cjs/extensions/prebuilts/deploy-vote.js +13 -13
- package/dist/cjs/extensions/prebuilts/deploy-vote.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +19 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +27 -78
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +27 -13
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +50 -19
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +0 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +21 -32
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.js +138 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js +3 -1
- package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/esm/auth/core/generate-login-payload.js +1 -1
- package/dist/esm/auth/core/generate-login-payload.js.map +1 -1
- package/dist/esm/extensions/prebuilts/deploy-vote.js +13 -13
- package/dist/esm/extensions/prebuilts/deploy-vote.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +19 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +29 -80
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +28 -14
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +50 -19
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +0 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +21 -32
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.js +135 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js +3 -1
- package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts +12 -8
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts +1 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.d.ts +30 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/token/TokenSymbol.d.ts +1 -1
- package/dist/types/react/web/ui/components/token/TokenSymbol.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/bundler.d.ts.map +1 -1
- package/dist/types/wallets/smart/types.d.ts +1 -1
- package/dist/types/wallets/smart/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/auth/core/generate-login-payload.test.ts +1 -1
- package/src/auth/core/generate-login-payload.ts +1 -1
- package/src/extensions/prebuilts/deploy-vote.test.ts +1 -46
- package/src/extensions/prebuilts/deploy-vote.ts +21 -20
- package/src/extensions/split/split.test.ts +76 -0
- package/src/extensions/unstoppable-domains/read/resolveName.test.ts +20 -17
- package/src/extensions/vote/{read/proposalExists.test.ts → vote.test.ts} +21 -52
- package/src/react/core/hooks/transaction/useSendTransaction.ts +34 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +35 -148
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +62 -31
- package/src/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.tsx +136 -48
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.ts +0 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +57 -71
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PaymentSelectionScreen.tsx +251 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +1 -1
- package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +2 -1
- package/src/react/web/ui/components/token/TokenSymbol.tsx +2 -2
- package/src/version.ts +1 -1
- package/src/wallets/smart/lib/bundler.ts +4 -1
- package/src/wallets/smart/smart-wallet-dev.test.ts +23 -4
- package/src/wallets/smart/smart-wallet-integration.test.ts +11 -8
- package/src/wallets/smart/types.ts +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/GenericWalletIcon.js +0 -12
- package/dist/cjs/react/web/ui/ConnectWallet/icons/GenericWalletIcon.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +0 -34
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/GenericWalletIcon.js +0 -8
- package/dist/esm/react/web/ui/ConnectWallet/icons/GenericWalletIcon.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +0 -31
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/icons/GenericWalletIcon.d.ts +0 -6
- package/dist/types/react/web/ui/ConnectWallet/icons/GenericWalletIcon.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts +0 -14
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts.map +0 -1
- package/src/extensions/prebuilts/deploy-split.test.ts +0 -31
- package/src/extensions/split/read/getAllRecipientsAddresses.test.ts +0 -41
- package/src/extensions/split/read/getAllRecipientsPercentages.test.ts +0 -50
- package/src/extensions/split/read/getRecipientSplitPercentage.test.ts +0 -49
- package/src/react/web/ui/ConnectWallet/icons/GenericWalletIcon.tsx +0 -22
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx +0 -83
@@ -0,0 +1,251 @@
|
|
1
|
+
import { IdCardIcon } from "@radix-ui/react-icons";
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
3
|
+
import type { Chain } from "../../../../../../../chains/types.js";
|
4
|
+
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
5
|
+
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
6
|
+
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
|
7
|
+
import type { Wallet } from "../../../../../../../wallets/interfaces/wallet.js";
|
8
|
+
import {
|
9
|
+
type GetWalletBalanceResult,
|
10
|
+
getWalletBalance,
|
11
|
+
} from "../../../../../../../wallets/utils/getWalletBalance.js";
|
12
|
+
import type { WalletId } from "../../../../../../../wallets/wallet-types.js";
|
13
|
+
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
|
14
|
+
import {
|
15
|
+
iconSize,
|
16
|
+
radius,
|
17
|
+
spacing,
|
18
|
+
} from "../../../../../../core/design-system/index.js";
|
19
|
+
import type { PayUIOptions } from "../../../../../../core/hooks/connection/ConnectButtonProps.js";
|
20
|
+
import { useChainMetadata } from "../../../../../../core/hooks/others/useChainQuery.js";
|
21
|
+
import { useActiveAccount } from "../../../../../../core/hooks/wallets/useActiveAccount.js";
|
22
|
+
import { useConnectedWallets } from "../../../../../../core/hooks/wallets/useConnectedWallets.js";
|
23
|
+
import type {
|
24
|
+
SupportedTokens,
|
25
|
+
TokenInfo,
|
26
|
+
} from "../../../../../../core/utils/defaultTokens.js";
|
27
|
+
import { LoadingScreen } from "../../../../../wallets/shared/LoadingScreen.js";
|
28
|
+
import { Spacer } from "../../../../components/Spacer.js";
|
29
|
+
import { Container } from "../../../../components/basic.js";
|
30
|
+
import { Button } from "../../../../components/buttons.js";
|
31
|
+
import { Text } from "../../../../components/text.js";
|
32
|
+
import { OutlineWalletIcon } from "../../../icons/OutlineWalletIcon.js";
|
33
|
+
import { type ERC20OrNativeToken, isNativeToken } from "../../nativeToken.js";
|
34
|
+
import { WalletRowWithBalances } from "../WalletSelectorButton.js";
|
35
|
+
|
36
|
+
export type TokenBalance = {
|
37
|
+
balance: GetWalletBalanceResult;
|
38
|
+
chain: Chain;
|
39
|
+
token: TokenInfo;
|
40
|
+
};
|
41
|
+
|
42
|
+
export function PaymentSelectionScreen(props: {
|
43
|
+
client: ThirdwebClient;
|
44
|
+
mode: PayUIOptions["mode"];
|
45
|
+
showAllWallets: boolean;
|
46
|
+
sourceSupportedTokens: SupportedTokens | undefined;
|
47
|
+
toChain: Chain;
|
48
|
+
toToken: ERC20OrNativeToken;
|
49
|
+
tokenAmount: string;
|
50
|
+
wallets: Wallet[] | undefined;
|
51
|
+
onSelect: (wallet: Wallet, token: TokenInfo, chain: Chain) => void;
|
52
|
+
onSelectFiat: () => void;
|
53
|
+
onBack: () => void;
|
54
|
+
onConnect: () => void;
|
55
|
+
hiddenWallets?: WalletId[];
|
56
|
+
payWithFiatEnabled: boolean;
|
57
|
+
}) {
|
58
|
+
const theme = useCustomTheme();
|
59
|
+
const connectedWallets = useConnectedWallets();
|
60
|
+
|
61
|
+
// if all wallets are connected and showAll wallets is disabled, hide the connect button
|
62
|
+
const hideConnectButton =
|
63
|
+
!props.showAllWallets &&
|
64
|
+
props.wallets?.every((w) => connectedWallets.includes(w));
|
65
|
+
|
66
|
+
const chainInfo = useChainMetadata(props.toChain);
|
67
|
+
const activeAccount = useActiveAccount();
|
68
|
+
|
69
|
+
const walletsAndBalances = useQuery({
|
70
|
+
queryKey: [
|
71
|
+
"wallets-and-balances",
|
72
|
+
connectedWallets.map((w) => w.getAccount()?.address),
|
73
|
+
props.sourceSupportedTokens,
|
74
|
+
props.toChain.id,
|
75
|
+
props.toToken,
|
76
|
+
props.tokenAmount,
|
77
|
+
props.mode,
|
78
|
+
activeAccount?.address,
|
79
|
+
],
|
80
|
+
queryFn: async () => {
|
81
|
+
// in parallel, get the balances of all the wallets on each of the sourceSupportedTokens
|
82
|
+
const walletBalanceMap = new Map<Wallet, TokenBalance[]>();
|
83
|
+
|
84
|
+
const balancePromises = connectedWallets.flatMap((wallet) => {
|
85
|
+
const account = wallet.getAccount();
|
86
|
+
if (!account) return [];
|
87
|
+
walletBalanceMap.set(wallet, []);
|
88
|
+
|
89
|
+
// inject the destination token too since it can be used as well to pay/transfer
|
90
|
+
const toToken = isNativeToken(props.toToken)
|
91
|
+
? {
|
92
|
+
address: NATIVE_TOKEN_ADDRESS,
|
93
|
+
name: chainInfo.data?.nativeCurrency.name || "",
|
94
|
+
symbol: chainInfo.data?.nativeCurrency.symbol || "",
|
95
|
+
icon: chainInfo.data?.icon?.url,
|
96
|
+
}
|
97
|
+
: props.toToken;
|
98
|
+
|
99
|
+
const tokens = {
|
100
|
+
...props.sourceSupportedTokens,
|
101
|
+
[props.toChain.id]: [
|
102
|
+
toToken,
|
103
|
+
...(props.sourceSupportedTokens?.[props.toChain.id] || []),
|
104
|
+
],
|
105
|
+
};
|
106
|
+
|
107
|
+
return Object.entries(tokens).flatMap(([chainId, tokens]) => {
|
108
|
+
return tokens.map(async (token) => {
|
109
|
+
try {
|
110
|
+
const chain = getCachedChain(Number(chainId));
|
111
|
+
const balance = await getWalletBalance({
|
112
|
+
address: account.address,
|
113
|
+
chain,
|
114
|
+
tokenAddress: isNativeToken(token) ? undefined : token.address,
|
115
|
+
client: props.client,
|
116
|
+
});
|
117
|
+
|
118
|
+
// show the token if:
|
119
|
+
// - its not the destination token and balance is greater than 0
|
120
|
+
// - its the destination token and balance is greater than the token amount AND we the account is not the default account in fund_wallet mode
|
121
|
+
const shouldInclude =
|
122
|
+
token.address === toToken.address &&
|
123
|
+
chain.id === props.toChain.id
|
124
|
+
? props.mode === "fund_wallet" &&
|
125
|
+
account.address === activeAccount?.address
|
126
|
+
? false
|
127
|
+
: Number(balance.displayValue) > Number(props.tokenAmount)
|
128
|
+
: balance.value > 0n;
|
129
|
+
|
130
|
+
if (shouldInclude) {
|
131
|
+
const existingBalances = walletBalanceMap.get(wallet) || [];
|
132
|
+
existingBalances.push({ balance, chain, token });
|
133
|
+
existingBalances.sort((a, b) => {
|
134
|
+
if (
|
135
|
+
a.chain.id === props.toChain.id &&
|
136
|
+
a.token.address === toToken.address
|
137
|
+
)
|
138
|
+
return -1;
|
139
|
+
if (
|
140
|
+
b.chain.id === props.toChain.id &&
|
141
|
+
b.token.address === toToken.address
|
142
|
+
)
|
143
|
+
return 1;
|
144
|
+
if (a.chain.id === props.toChain.id) return -1;
|
145
|
+
if (b.chain.id === props.toChain.id) return 1;
|
146
|
+
return a.chain.id > b.chain.id ? 1 : -1;
|
147
|
+
});
|
148
|
+
}
|
149
|
+
} catch (error) {
|
150
|
+
console.error(
|
151
|
+
`Failed to fetch balance for wallet ${wallet.id} on chain ${chainId} for token ${token.symbol}:`,
|
152
|
+
error,
|
153
|
+
);
|
154
|
+
}
|
155
|
+
});
|
156
|
+
});
|
157
|
+
});
|
158
|
+
|
159
|
+
await Promise.all(balancePromises);
|
160
|
+
return walletBalanceMap;
|
161
|
+
},
|
162
|
+
enabled: !!props.sourceSupportedTokens && !!chainInfo.data,
|
163
|
+
});
|
164
|
+
|
165
|
+
if (walletsAndBalances.isLoading || !walletsAndBalances.data) {
|
166
|
+
return <LoadingScreen />;
|
167
|
+
}
|
168
|
+
|
169
|
+
return (
|
170
|
+
<Container>
|
171
|
+
<Container flex="column" gap="xs">
|
172
|
+
{Array.from(walletsAndBalances.data?.entries() || [])
|
173
|
+
.filter(([w]) => !props.hiddenWallets?.includes(w.id))
|
174
|
+
.map(([w, balances]) => {
|
175
|
+
const address = w.getAccount()?.address;
|
176
|
+
if (!address) return null;
|
177
|
+
return (
|
178
|
+
<WalletRowWithBalances
|
179
|
+
key={w.id}
|
180
|
+
wallet={w}
|
181
|
+
balances={balances}
|
182
|
+
client={props.client}
|
183
|
+
address={address}
|
184
|
+
onClick={props.onSelect}
|
185
|
+
/>
|
186
|
+
);
|
187
|
+
})}
|
188
|
+
{!hideConnectButton && (
|
189
|
+
<Button
|
190
|
+
variant="secondary"
|
191
|
+
fullWidth
|
192
|
+
onClick={props.onConnect}
|
193
|
+
gap="xs"
|
194
|
+
bg="tertiaryBg"
|
195
|
+
style={{
|
196
|
+
borderRadius: radius.lg,
|
197
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
198
|
+
padding: spacing.sm,
|
199
|
+
}}
|
200
|
+
>
|
201
|
+
<Container
|
202
|
+
flex="row"
|
203
|
+
gap="sm"
|
204
|
+
center="y"
|
205
|
+
expand
|
206
|
+
color="secondaryIconColor"
|
207
|
+
>
|
208
|
+
<OutlineWalletIcon size={iconSize.md} />
|
209
|
+
<Text size="sm" color="primaryText">
|
210
|
+
Pay with another wallet
|
211
|
+
</Text>
|
212
|
+
</Container>
|
213
|
+
</Button>
|
214
|
+
)}
|
215
|
+
{props.payWithFiatEnabled && (
|
216
|
+
<Button
|
217
|
+
variant="secondary"
|
218
|
+
fullWidth
|
219
|
+
gap="xs"
|
220
|
+
bg="tertiaryBg"
|
221
|
+
onClick={props.onSelectFiat}
|
222
|
+
style={{
|
223
|
+
borderRadius: radius.lg,
|
224
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
225
|
+
padding: spacing.sm,
|
226
|
+
}}
|
227
|
+
>
|
228
|
+
<Container
|
229
|
+
flex="row"
|
230
|
+
gap="sm"
|
231
|
+
center="y"
|
232
|
+
expand
|
233
|
+
color="secondaryIconColor"
|
234
|
+
>
|
235
|
+
<IdCardIcon
|
236
|
+
style={{
|
237
|
+
width: iconSize.md,
|
238
|
+
height: iconSize.md,
|
239
|
+
}}
|
240
|
+
/>
|
241
|
+
<Text size="sm" color="primaryText">
|
242
|
+
Pay with credit card
|
243
|
+
</Text>
|
244
|
+
</Container>
|
245
|
+
</Button>
|
246
|
+
)}
|
247
|
+
</Container>
|
248
|
+
<Spacer y="sm" />
|
249
|
+
</Container>
|
250
|
+
);
|
251
|
+
}
|
@@ -34,7 +34,7 @@ export type SupportedChainAndTokens = Array<{
|
|
34
34
|
}>;
|
35
35
|
}>;
|
36
36
|
|
37
|
-
async function fetchBuySupportedDestinations(
|
37
|
+
export async function fetchBuySupportedDestinations(
|
38
38
|
client: ThirdwebClient,
|
39
39
|
isTestMode?: boolean,
|
40
40
|
): Promise<SupportedChainAndTokens> {
|
@@ -13,9 +13,10 @@ export function formatTokenBalance(
|
|
13
13
|
displayValue: string;
|
14
14
|
},
|
15
15
|
showSymbol = true,
|
16
|
+
decimals = 5,
|
16
17
|
) {
|
17
18
|
return (
|
18
|
-
formatNumber(Number(balanceData.displayValue),
|
19
|
+
formatNumber(Number(balanceData.displayValue), decimals) +
|
19
20
|
(showSymbol ? ` ${balanceData.symbol}` : "")
|
20
21
|
);
|
21
22
|
}
|
@@ -15,7 +15,7 @@ import { Text } from "../text.js";
|
|
15
15
|
export function TokenSymbol(props: {
|
16
16
|
token: ERC20OrNativeToken;
|
17
17
|
chain: Chain;
|
18
|
-
size: "sm" | "md" | "lg";
|
18
|
+
size: "xs" | "sm" | "md" | "lg";
|
19
19
|
color?: keyof Theme["colors"];
|
20
20
|
inline?: boolean;
|
21
21
|
}) {
|
@@ -43,7 +43,7 @@ export function TokenSymbol(props: {
|
|
43
43
|
|
44
44
|
function NativeTokenSymbol(props: {
|
45
45
|
chain: Chain;
|
46
|
-
size: "sm" | "md" | "lg";
|
46
|
+
size: "xs" | "sm" | "md" | "lg";
|
47
47
|
color?: keyof Theme["colors"];
|
48
48
|
inline?: boolean;
|
49
49
|
}) {
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.64.
|
1
|
+
export const version = "5.64.3-nightly-ddec3dadcc260e0d4d0ed2b43c502e0915a14203-20241029000326";
|
@@ -84,7 +84,10 @@ export async function estimateUserOpGas(args: {
|
|
84
84
|
// add gas buffer for managed account factory delegate calls
|
85
85
|
return {
|
86
86
|
preVerificationGas: hexToBigInt(res.preVerificationGas),
|
87
|
-
verificationGas:
|
87
|
+
verificationGas:
|
88
|
+
res.verificationGas !== undefined
|
89
|
+
? hexToBigInt(res.verificationGas)
|
90
|
+
: undefined,
|
88
91
|
verificationGasLimit: hexToBigInt(res.verificationGasLimit),
|
89
92
|
callGasLimit: hexToBigInt(res.callGasLimit) + MANAGED_ACCOUNT_GAS_BUFFER,
|
90
93
|
paymasterVerificationGasLimit:
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
2
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
3
|
-
import {
|
3
|
+
import { zkSyncSepolia } from "../../chains/chain-definitions/zksync-sepolia.js";
|
4
4
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
5
5
|
import { balanceOf } from "../../extensions/erc1155/__generated__/IERC1155/read/balanceOf.js";
|
6
6
|
import { claimTo } from "../../extensions/erc1155/drops/write/claimTo.js";
|
7
7
|
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
8
|
+
import { sendTransaction } from "../../transaction/actions/send-transaction.js";
|
9
|
+
import { prepareTransaction } from "../../transaction/prepare-transaction.js";
|
8
10
|
import type { Address } from "../../utils/address.js";
|
9
11
|
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
|
10
12
|
import { setThirdwebDomains } from "../../utils/domains.js";
|
@@ -18,7 +20,7 @@ let smartWalletAddress: Address;
|
|
18
20
|
let personalAccount: Account;
|
19
21
|
let accountContract: ThirdwebContract;
|
20
22
|
|
21
|
-
const chain =
|
23
|
+
const chain = zkSyncSepolia;
|
22
24
|
const client = TEST_CLIENT;
|
23
25
|
const contract = getContract({
|
24
26
|
client,
|
@@ -61,13 +63,30 @@ describe.runIf(process.env.TW_SECRET_KEY).skip.sequential(
|
|
61
63
|
expect(smartWalletAddress).toHaveLength(42);
|
62
64
|
});
|
63
65
|
|
64
|
-
it("can sign a msg", async () => {
|
66
|
+
it.skip("can sign a msg", async () => {
|
65
67
|
await smartAccount.signMessage({ message: "hello world" });
|
66
68
|
const isDeployed = await isContractDeployed(accountContract);
|
67
69
|
expect(isDeployed).toEqual(true);
|
68
70
|
});
|
69
71
|
|
70
|
-
it("
|
72
|
+
it("should send a transaction", async () => {
|
73
|
+
const tx = prepareTransaction({
|
74
|
+
client,
|
75
|
+
chain,
|
76
|
+
to: smartAccount.address,
|
77
|
+
value: 0n,
|
78
|
+
});
|
79
|
+
|
80
|
+
console.log("Sending transaction...");
|
81
|
+
const receipt = await sendTransaction({
|
82
|
+
transaction: tx,
|
83
|
+
account: smartAccount,
|
84
|
+
});
|
85
|
+
console.log("Transaction sent:", receipt.transactionHash);
|
86
|
+
expect(receipt.transactionHash).toBeDefined();
|
87
|
+
});
|
88
|
+
|
89
|
+
it.skip("can execute a tx", async () => {
|
71
90
|
const tx = await sendAndConfirmTransaction({
|
72
91
|
transaction: claimTo({
|
73
92
|
contract,
|
@@ -20,6 +20,7 @@ import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-co
|
|
20
20
|
import { sendBatchTransaction } from "../../transaction/actions/send-batch-transaction.js";
|
21
21
|
import { waitForReceipt } from "../../transaction/actions/wait-for-tx-receipt.js";
|
22
22
|
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
|
23
|
+
import { sleep } from "../../utils/sleep.js";
|
23
24
|
import type { Account, Wallet } from "../interfaces/wallet.js";
|
24
25
|
import { generateAccount } from "../utils/generateAccount.js";
|
25
26
|
import { smartWallet } from "./smart-wallet.js";
|
@@ -332,15 +333,17 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
|
332
333
|
}),
|
333
334
|
account: newSmartAccount,
|
334
335
|
}),
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
336
|
+
sleep(1000).then(() =>
|
337
|
+
sendAndConfirmTransaction({
|
338
|
+
transaction: claimTo({
|
339
|
+
contract,
|
340
|
+
quantity: 1n,
|
341
|
+
to: newSmartAccount.address,
|
342
|
+
tokenId: 0n,
|
343
|
+
}),
|
344
|
+
account: newSmartAccount,
|
341
345
|
}),
|
342
|
-
|
343
|
-
}),
|
346
|
+
),
|
344
347
|
]);
|
345
348
|
expect(txs.length).toEqual(2);
|
346
349
|
expect(txs.every((t) => t.transactionHash.length === 66)).toBe(true);
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GenericWalletIcon = void 0;
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
5
|
-
/**
|
6
|
-
* @internal
|
7
|
-
*/
|
8
|
-
const GenericWalletIcon = (props) => {
|
9
|
-
return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 18 18", width: props.size, height: props.size, role: "presentation", children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M15.6 4.6H1.85v-.55l12.1-.968v.968h1.65V2.4c0-1.21-.98-2.059-2.177-1.888L2.378 2.089C1.18 2.26.2 3.39.2 4.6v11a2.2 2.2 0 002.2 2.2h13.2a2.2 2.2 0 002.2-2.2V6.8a2.2 2.2 0 00-2.2-2.2zm-1.65 7.707a1.65 1.65 0 01-.63-3.176 1.65 1.65 0 11.63 3.176z" }) }));
|
10
|
-
};
|
11
|
-
exports.GenericWalletIcon = GenericWalletIcon;
|
12
|
-
//# sourceMappingURL=GenericWalletIcon.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"GenericWalletIcon.js","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/ConnectWallet/icons/GenericWalletIcon.tsx"],"names":[],"mappings":";;;;AAEA;;GAEG;AACI,MAAM,iBAAiB,GAAW,CAAC,KAAK,EAAE,EAAE;IACjD,OAAO,CACL,gCACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,KAAK,CAAC,IAAI,EACjB,MAAM,EAAE,KAAK,CAAC,IAAI,EAClB,IAAI,EAAC,cAAc,YAEnB,iCACE,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,qPAAqP,GACvP,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B"}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.WalletSwitcherDrawerContent = WalletSwitcherDrawerContent;
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
5
|
-
const react_icons_1 = require("@radix-ui/react-icons");
|
6
|
-
const CustomThemeProvider_js_1 = require("../../../../../../core/design-system/CustomThemeProvider.js");
|
7
|
-
const index_js_1 = require("../../../../../../core/design-system/index.js");
|
8
|
-
const useConnectedWallets_js_1 = require("../../../../../../core/hooks/wallets/useConnectedWallets.js");
|
9
|
-
const Spacer_js_1 = require("../../../../components/Spacer.js");
|
10
|
-
const basic_js_1 = require("../../../../components/basic.js");
|
11
|
-
const buttons_js_1 = require("../../../../components/buttons.js");
|
12
|
-
const text_js_1 = require("../../../../components/text.js");
|
13
|
-
const WalletSelectorButton_js_1 = require("../WalletSelectorButton.js");
|
14
|
-
function WalletSwitcherDrawerContent(props) {
|
15
|
-
const theme = (0, CustomThemeProvider_js_1.useCustomTheme)();
|
16
|
-
const connectedWallets = (0, useConnectedWallets_js_1.useConnectedWallets)();
|
17
|
-
// if all wallets are connected and showAll wallets is disabled, hide the connect button
|
18
|
-
const hideConnectButton = !props.showAllWallets &&
|
19
|
-
props.wallets?.every((w) => connectedWallets.includes(w));
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { children: [(0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "xs", children: [connectedWallets
|
21
|
-
.filter((w) => !props.hiddenWallets?.includes(w.id))
|
22
|
-
.map((w) => {
|
23
|
-
const address = w.getAccount()?.address;
|
24
|
-
return ((0, jsx_runtime_1.jsx)(WalletSelectorButton_js_1.WalletSelectorButton, { walletId: w.id, client: props.client, address: address || "", onClick: () => {
|
25
|
-
props.onSelect(w);
|
26
|
-
props.onBack();
|
27
|
-
}, disableChevron: true, checked: false }, w.id));
|
28
|
-
}), !hideConnectButton && ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "secondary", fullWidth: true, onClick: props.onConnect, gap: "xs", bg: "tertiaryBg", style: {
|
29
|
-
borderRadius: index_js_1.radius.lg,
|
30
|
-
border: `1px solid ${theme.colors.borderColor}`,
|
31
|
-
padding: index_js_1.spacing.sm,
|
32
|
-
}, children: (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", gap: "sm", center: "y", expand: true, children: [(0, jsx_runtime_1.jsx)(react_icons_1.PlusIcon, { width: index_js_1.iconSize.md, height: index_js_1.iconSize.md }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "sm", color: "primaryText", children: "Add Another Wallet" })] }) }))] }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "sm" })] }));
|
33
|
-
}
|
34
|
-
//# sourceMappingURL=WalletSwitcherDrawerContent.js.map
|
package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"WalletSwitcherDrawerContent.js","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx"],"names":[],"mappings":";;AAiBA,kEAiEC;;AAlFD,uDAAiD;AAIjD,wGAA6F;AAC7F,4EAIuD;AACvD,wGAAkG;AAClG,gEAA0D;AAC1D,8DAA4D;AAC5D,kEAA2D;AAC3D,4DAAsD;AACtD,wEAAkE;AAElE,SAAgB,2BAA2B,CAAC,KAS3C;IACC,MAAM,KAAK,GAAG,IAAA,uCAAc,GAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,IAAA,4CAAmB,GAAE,CAAC;IAE/C,wFAAwF;IACxF,MAAM,iBAAiB,GACrB,CAAC,KAAK,CAAC,cAAc;QACrB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5D,OAAO,CACL,wBAAC,oBAAS,eACR,wBAAC,oBAAS,IAAC,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,aAC9B,gBAAgB;yBACd,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;yBACnD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBACT,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC;wBACxC,OAAO,CACL,uBAAC,8CAAoB,IAEnB,QAAQ,EAAE,CAAC,CAAC,EAAE,EACd,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,OAAO,IAAI,EAAE,EACtB,OAAO,EAAE,GAAG,EAAE;gCACZ,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gCAClB,KAAK,CAAC,MAAM,EAAE,CAAC;4BACjB,CAAC,EACD,cAAc,QACd,OAAO,EAAE,KAAK,IATT,CAAC,CAAC,EAAE,CAUT,CACH,CAAC;oBACJ,CAAC,CAAC,EACH,CAAC,iBAAiB,IAAI,CACrB,uBAAC,mBAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,QACT,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,GAAG,EAAC,IAAI,EACR,EAAE,EAAC,YAAY,EACf,KAAK,EAAE;4BACL,YAAY,EAAE,iBAAM,CAAC,EAAE;4BACvB,MAAM,EAAE,aAAa,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;4BAC/C,OAAO,EAAE,kBAAO,CAAC,EAAE;yBACpB,YAED,wBAAC,oBAAS,IAAC,IAAI,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAC,MAAM,EAAC,GAAG,EAAC,MAAM,mBAC9C,uBAAC,sBAAQ,IAAC,KAAK,EAAE,mBAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,mBAAQ,CAAC,EAAE,GAAI,EACrD,uBAAC,cAAI,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,aAAa,mCAE5B,IACG,GACL,CACV,IACS,EACZ,uBAAC,kBAAM,IAAC,CAAC,EAAC,IAAI,GAAG,IACP,CACb,CAAC;AACJ,CAAC"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
/**
|
3
|
-
* @internal
|
4
|
-
*/
|
5
|
-
export const GenericWalletIcon = (props) => {
|
6
|
-
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 18 18", width: props.size, height: props.size, role: "presentation", children: _jsx("path", { fill: "currentColor", d: "M15.6 4.6H1.85v-.55l12.1-.968v.968h1.65V2.4c0-1.21-.98-2.059-2.177-1.888L2.378 2.089C1.18 2.26.2 3.39.2 4.6v11a2.2 2.2 0 002.2 2.2h13.2a2.2 2.2 0 002.2-2.2V6.8a2.2 2.2 0 00-2.2-2.2zm-1.65 7.707a1.65 1.65 0 01-.63-3.176 1.65 1.65 0 11.63 3.176z" }) }));
|
7
|
-
};
|
8
|
-
//# sourceMappingURL=GenericWalletIcon.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"GenericWalletIcon.js","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/ConnectWallet/icons/GenericWalletIcon.tsx"],"names":[],"mappings":";AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAW,CAAC,KAAK,EAAE,EAAE;IACjD,OAAO,CACL,cACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,KAAK,CAAC,IAAI,EACjB,MAAM,EAAE,KAAK,CAAC,IAAI,EAClB,IAAI,EAAC,cAAc,YAEnB,eACE,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,qPAAqP,GACvP,GACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { PlusIcon } from "@radix-ui/react-icons";
|
3
|
-
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
|
4
|
-
import { iconSize, radius, spacing, } from "../../../../../../core/design-system/index.js";
|
5
|
-
import { useConnectedWallets } from "../../../../../../core/hooks/wallets/useConnectedWallets.js";
|
6
|
-
import { Spacer } from "../../../../components/Spacer.js";
|
7
|
-
import { Container } from "../../../../components/basic.js";
|
8
|
-
import { Button } from "../../../../components/buttons.js";
|
9
|
-
import { Text } from "../../../../components/text.js";
|
10
|
-
import { WalletSelectorButton } from "../WalletSelectorButton.js";
|
11
|
-
export function WalletSwitcherDrawerContent(props) {
|
12
|
-
const theme = useCustomTheme();
|
13
|
-
const connectedWallets = useConnectedWallets();
|
14
|
-
// if all wallets are connected and showAll wallets is disabled, hide the connect button
|
15
|
-
const hideConnectButton = !props.showAllWallets &&
|
16
|
-
props.wallets?.every((w) => connectedWallets.includes(w));
|
17
|
-
return (_jsxs(Container, { children: [_jsxs(Container, { flex: "column", gap: "xs", children: [connectedWallets
|
18
|
-
.filter((w) => !props.hiddenWallets?.includes(w.id))
|
19
|
-
.map((w) => {
|
20
|
-
const address = w.getAccount()?.address;
|
21
|
-
return (_jsx(WalletSelectorButton, { walletId: w.id, client: props.client, address: address || "", onClick: () => {
|
22
|
-
props.onSelect(w);
|
23
|
-
props.onBack();
|
24
|
-
}, disableChevron: true, checked: false }, w.id));
|
25
|
-
}), !hideConnectButton && (_jsx(Button, { variant: "secondary", fullWidth: true, onClick: props.onConnect, gap: "xs", bg: "tertiaryBg", style: {
|
26
|
-
borderRadius: radius.lg,
|
27
|
-
border: `1px solid ${theme.colors.borderColor}`,
|
28
|
-
padding: spacing.sm,
|
29
|
-
}, children: _jsxs(Container, { flex: "row", gap: "sm", center: "y", expand: true, children: [_jsx(PlusIcon, { width: iconSize.md, height: iconSize.md }), _jsx(Text, { size: "sm", color: "primaryText", children: "Add Another Wallet" })] }) }))] }), _jsx(Spacer, { y: "sm" })] }));
|
30
|
-
}
|
31
|
-
//# sourceMappingURL=WalletSwitcherDrawerContent.js.map
|
package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"WalletSwitcherDrawerContent.js","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,OAAO,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAC7F,OAAO,EACL,QAAQ,EACR,MAAM,EACN,OAAO,GACR,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,UAAU,2BAA2B,CAAC,KAS3C;IACC,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAE/C,wFAAwF;IACxF,MAAM,iBAAiB,GACrB,CAAC,KAAK,CAAC,cAAc;QACrB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5D,OAAO,CACL,MAAC,SAAS,eACR,MAAC,SAAS,IAAC,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,aAC9B,gBAAgB;yBACd,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;yBACnD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBACT,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC;wBACxC,OAAO,CACL,KAAC,oBAAoB,IAEnB,QAAQ,EAAE,CAAC,CAAC,EAAE,EACd,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,OAAO,IAAI,EAAE,EACtB,OAAO,EAAE,GAAG,EAAE;gCACZ,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gCAClB,KAAK,CAAC,MAAM,EAAE,CAAC;4BACjB,CAAC,EACD,cAAc,QACd,OAAO,EAAE,KAAK,IATT,CAAC,CAAC,EAAE,CAUT,CACH,CAAC;oBACJ,CAAC,CAAC,EACH,CAAC,iBAAiB,IAAI,CACrB,KAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,QACT,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,GAAG,EAAC,IAAI,EACR,EAAE,EAAC,YAAY,EACf,KAAK,EAAE;4BACL,YAAY,EAAE,MAAM,CAAC,EAAE;4BACvB,MAAM,EAAE,aAAa,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;4BAC/C,OAAO,EAAE,OAAO,CAAC,EAAE;yBACpB,YAED,MAAC,SAAS,IAAC,IAAI,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI,EAAC,MAAM,EAAC,GAAG,EAAC,MAAM,mBAC9C,KAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAI,EACrD,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,aAAa,mCAE5B,IACG,GACL,CACV,IACS,EACZ,KAAC,MAAM,IAAC,CAAC,EAAC,IAAI,GAAG,IACP,CACb,CAAC;AACJ,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"GenericWalletIcon.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/ConnectWallet/icons/GenericWalletIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAgB/B,CAAC"}
|
package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
2
|
-
import type { Wallet } from "../../../../../../../wallets/interfaces/wallet.js";
|
3
|
-
import type { WalletId } from "../../../../../../../wallets/wallet-types.js";
|
4
|
-
export declare function WalletSwitcherDrawerContent(props: {
|
5
|
-
client: ThirdwebClient;
|
6
|
-
showAllWallets: boolean;
|
7
|
-
wallets: Wallet[] | undefined;
|
8
|
-
onSelect: (wallet: Wallet) => void;
|
9
|
-
onBack: () => void;
|
10
|
-
onConnect: () => void;
|
11
|
-
selectedAddress: string;
|
12
|
-
hiddenWallets?: WalletId[];
|
13
|
-
}): import("react/jsx-runtime.js").JSX.Element;
|
14
|
-
//# sourceMappingURL=WalletSwitcherDrawerContent.d.ts.map
|
package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"WalletSwitcherDrawerContent.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAc7E,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC;CAC5B,8CAwDA"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
2
|
-
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
|
-
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
-
import { TEST_ACCOUNT_D } from "~test/test-wallets.js";
|
5
|
-
import { isAddress } from "../../utils/address.js";
|
6
|
-
import { deploySplitContract } from "./deploy-split.js";
|
7
|
-
|
8
|
-
describe.runIf(process.env.TW_SECRET_KEY)("deploy-split contract", () => {
|
9
|
-
it("should deploy Split contract", async () => {
|
10
|
-
const address = await deploySplitContract({
|
11
|
-
account: TEST_ACCOUNT_D,
|
12
|
-
client: TEST_CLIENT,
|
13
|
-
chain: ANVIL_CHAIN,
|
14
|
-
params: {
|
15
|
-
name: "split-contract",
|
16
|
-
payees: [
|
17
|
-
"0x12345674b599ce99958242b3D3741e7b01841DF3",
|
18
|
-
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
19
|
-
],
|
20
|
-
shares: [
|
21
|
-
5100n, // 51%
|
22
|
-
4900n, // 49%
|
23
|
-
],
|
24
|
-
},
|
25
|
-
});
|
26
|
-
expect(address).toBeDefined();
|
27
|
-
expect(isAddress(address)).toBe(true);
|
28
|
-
// Further tests to verify the functionality of this contract
|
29
|
-
// are done in other Split tests
|
30
|
-
});
|
31
|
-
});
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
2
|
-
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
|
-
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
|
-
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
|
-
import { getContract } from "../../../contract/contract.js";
|
7
|
-
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
|
-
import { getAllRecipientsAddresses } from "./getAllRecipientsAddresses.js";
|
9
|
-
|
10
|
-
const chain = ANVIL_CHAIN;
|
11
|
-
const client = TEST_CLIENT;
|
12
|
-
|
13
|
-
describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsAddresses", () => {
|
14
|
-
it("should work", async () => {
|
15
|
-
const payees = [
|
16
|
-
"0x12345674b599ce99958242b3D3741e7b01841DF3",
|
17
|
-
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
18
|
-
];
|
19
|
-
const address = await deploySplitContract({
|
20
|
-
account: TEST_ACCOUNT_C,
|
21
|
-
client: TEST_CLIENT,
|
22
|
-
chain: ANVIL_CHAIN,
|
23
|
-
params: {
|
24
|
-
name: "split-contract",
|
25
|
-
contractURI: TEST_CONTRACT_URI, // just to speed up the test
|
26
|
-
payees,
|
27
|
-
shares: [
|
28
|
-
5100n, // 51%
|
29
|
-
4900n, // 49%
|
30
|
-
],
|
31
|
-
},
|
32
|
-
});
|
33
|
-
const contract = getContract({
|
34
|
-
address,
|
35
|
-
chain,
|
36
|
-
client,
|
37
|
-
});
|
38
|
-
const result = await getAllRecipientsAddresses({ contract });
|
39
|
-
expect(result).toStrictEqual(payees);
|
40
|
-
});
|
41
|
-
});
|