thirdweb 5.111.8 → 5.111.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/cjs/chains/chain-definitions/celo-sepolia-testnet.js +20 -0
- package/dist/cjs/chains/chain-definitions/celo-sepolia-testnet.js.map +1 -0
- package/dist/cjs/cli/commands/stylus/create.js +48 -0
- package/dist/cjs/cli/commands/stylus/create.js.map +1 -1
- package/dist/cjs/exports/chains.js +3 -3
- package/dist/cjs/exports/chains.js.map +1 -1
- package/dist/cjs/extensions/modules/common/installPublishedModule.js +26 -9
- package/dist/cjs/extensions/modules/common/installPublishedModule.js.map +1 -1
- package/dist/cjs/extensions/prebuilts/deploy-published.js +1 -1
- package/dist/cjs/extensions/prebuilts/deploy-published.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/common/TokenAndChain.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/common/TokenBalanceRow.js +2 -2
- package/dist/cjs/react/web/ui/Bridge/common/TokenBalanceRow.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/common/selected-token-button.js +7 -2
- package/dist/cjs/react/web/ui/Bridge/common/selected-token-button.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js +5 -5
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-success/PaymentReceipt.js +20 -44
- package/dist/cjs/react/web/ui/Bridge/payment-success/PaymentReceipt.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js +3 -3
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/select-chain.js +10 -2
- package/dist/cjs/react/web/ui/Bridge/swap-widget/select-chain.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/select-token-ui.js +94 -48
- package/dist/cjs/react/web/ui/Bridge/swap-widget/select-token-ui.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/cjs/react/web/ui/components/CopyIcon.js +6 -8
- package/dist/cjs/react/web/ui/components/CopyIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/Spacer.js +1 -0
- package/dist/cjs/react/web/ui/components/Spacer.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/chains/chain-definitions/celo-sepolia-testnet.js +17 -0
- package/dist/esm/chains/chain-definitions/celo-sepolia-testnet.js.map +1 -0
- package/dist/esm/cli/commands/stylus/create.js +48 -0
- package/dist/esm/cli/commands/stylus/create.js.map +1 -1
- package/dist/esm/exports/chains.js +1 -1
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/extensions/modules/common/installPublishedModule.js +26 -9
- package/dist/esm/extensions/modules/common/installPublishedModule.js.map +1 -1
- package/dist/esm/extensions/prebuilts/deploy-published.js +1 -1
- package/dist/esm/extensions/prebuilts/deploy-published.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +1 -1
- package/dist/esm/react/web/ui/Bridge/common/TokenAndChain.js +1 -1
- package/dist/esm/react/web/ui/Bridge/common/TokenBalanceRow.js +2 -2
- package/dist/esm/react/web/ui/Bridge/common/TokenBalanceRow.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/common/selected-token-button.js +7 -2
- package/dist/esm/react/web/ui/Bridge/common/selected-token-button.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js +5 -5
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-success/PaymentReceipt.js +23 -47
- package/dist/esm/react/web/ui/Bridge/payment-success/PaymentReceipt.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js +4 -4
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/select-chain.js +10 -2
- package/dist/esm/react/web/ui/Bridge/swap-widget/select-chain.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/select-token-ui.js +95 -49
- package/dist/esm/react/web/ui/Bridge/swap-widget/select-token-ui.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/esm/react/web/ui/components/CopyIcon.js +6 -8
- package/dist/esm/react/web/ui/components/CopyIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/Spacer.js +1 -0
- package/dist/esm/react/web/ui/components/Spacer.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/scripts/bridge-widget.js +100 -100
- package/dist/types/chains/chain-definitions/celo-sepolia-testnet.d.ts +7 -0
- package/dist/types/chains/chain-definitions/celo-sepolia-testnet.d.ts.map +1 -0
- package/dist/types/cli/commands/stylus/create.d.ts.map +1 -1
- package/dist/types/exports/chains.d.ts +1 -1
- package/dist/types/exports/chains.d.ts.map +1 -1
- package/dist/types/extensions/modules/common/installPublishedModule.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/common/TokenBalanceRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/common/selected-token-button.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-success/PaymentReceipt.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/swap-widget/select-chain.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/swap-widget/select-token-ui.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/CopyIcon.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Spacer.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/chains/chain-definitions/celo-sepolia-testnet.ts +17 -0
- package/src/cli/commands/stylus/create.ts +49 -0
- package/src/contract/deployment/deploy-dynamic.test.ts +35 -39
- package/src/exports/chains.ts +1 -1
- package/src/extensions/dynamic-contracts/write/installPublishedExtension.test.ts +40 -44
- package/src/extensions/dynamic-contracts/write/uninstallExtension.test.ts +1 -2
- package/src/extensions/modules/common/installPublishedModule.ts +28 -9
- package/src/extensions/prebuilts/deploy-published.ts +1 -1
- package/src/react/web/ui/Bridge/TransactionPayment.tsx +1 -1
- package/src/react/web/ui/Bridge/common/TokenAndChain.tsx +1 -1
- package/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx +11 -10
- package/src/react/web/ui/Bridge/common/selected-token-button.tsx +11 -1
- package/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx +9 -7
- package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +1 -1
- package/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx +92 -115
- package/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx +4 -6
- package/src/react/web/ui/Bridge/swap-widget/select-chain.tsx +18 -3
- package/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx +186 -118
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +5 -3
- package/src/react/web/ui/components/CopyIcon.tsx +8 -9
- package/src/react/web/ui/components/Spacer.tsx +1 -0
- package/src/version.ts +1 -1
- package/dist/cjs/chains/chain-definitions/celo-alfajores-testnet.js +0 -20
- package/dist/cjs/chains/chain-definitions/celo-alfajores-testnet.js.map +0 -1
- package/dist/esm/chains/chain-definitions/celo-alfajores-testnet.js +0 -17
- package/dist/esm/chains/chain-definitions/celo-alfajores-testnet.js.map +0 -1
- package/dist/types/chains/chain-definitions/celo-alfajores-testnet.d.ts +0 -7
- package/dist/types/chains/chain-definitions/celo-alfajores-testnet.d.ts.map +0 -1
- package/src/chains/chain-definitions/celo-alfajores-testnet.ts +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo, useState } from "react";
|
|
1
|
+
import { useCallback, useMemo, useState } from "react";
|
|
2
2
|
import type { Token } from "../../../../../bridge/index.js";
|
|
3
3
|
import type { BridgeChain } from "../../../../../bridge/types/Chain.js";
|
|
4
4
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
radius,
|
|
11
11
|
spacing,
|
|
12
12
|
} from "../../../../core/design-system/index.js";
|
|
13
|
-
import { CoinsIcon } from "../../ConnectWallet/icons/CoinsIcon.js";
|
|
14
|
-
import { WalletDotIcon } from "../../ConnectWallet/icons/WalletDotIcon.js";
|
|
15
13
|
import { Container, noScrollBar } from "../../components/basic.js";
|
|
16
14
|
import { Button } from "../../components/buttons.js";
|
|
17
15
|
import { Img } from "../../components/Img.js";
|
|
@@ -52,14 +50,18 @@ function findChain(chains: BridgeChain[], activeChainId: number | undefined) {
|
|
|
52
50
|
return chains.find((chain) => chain.chainId === activeChainId);
|
|
53
51
|
}
|
|
54
52
|
|
|
53
|
+
const ALL_TOKENS_LIMIT = 100;
|
|
54
|
+
const OWNED_TOKENS_LIMIT = 50;
|
|
55
|
+
|
|
55
56
|
/**
|
|
56
57
|
* @internal
|
|
57
58
|
*/
|
|
58
59
|
export function SelectToken(props: SelectTokenUIProps) {
|
|
59
60
|
const chainQuery = useBridgeChains(props.client);
|
|
60
|
-
const [search,
|
|
61
|
+
const [search, _setSearch] = useState("");
|
|
61
62
|
const debouncedSearch = useDebouncedValue(search, 500);
|
|
62
|
-
const [
|
|
63
|
+
const [allTokensLimit, setAllTokensLimit] = useState(ALL_TOKENS_LIMIT);
|
|
64
|
+
const [ownedTokensLimit, setOwnedTokensLimit] = useState(OWNED_TOKENS_LIMIT);
|
|
63
65
|
|
|
64
66
|
const [_selectedChain, setSelectedChain] = useState<BridgeChain | undefined>(
|
|
65
67
|
undefined,
|
|
@@ -77,7 +79,7 @@ export function SelectToken(props: SelectTokenUIProps) {
|
|
|
77
79
|
client: props.client,
|
|
78
80
|
chainId: selectedChain?.chainId,
|
|
79
81
|
search: debouncedSearch,
|
|
80
|
-
limit,
|
|
82
|
+
limit: allTokensLimit,
|
|
81
83
|
offset: 0,
|
|
82
84
|
});
|
|
83
85
|
|
|
@@ -85,7 +87,7 @@ export function SelectToken(props: SelectTokenUIProps) {
|
|
|
85
87
|
const ownedTokensQuery = useTokenBalances({
|
|
86
88
|
clientId: props.client.clientId,
|
|
87
89
|
chainId: selectedChain?.chainId,
|
|
88
|
-
limit,
|
|
90
|
+
limit: ownedTokensLimit,
|
|
89
91
|
page: 1,
|
|
90
92
|
walletAddress: props.activeWalletInfo?.activeAccount.address,
|
|
91
93
|
});
|
|
@@ -102,43 +104,62 @@ export function SelectToken(props: SelectTokenUIProps) {
|
|
|
102
104
|
});
|
|
103
105
|
}, [ownedTokensQuery.data?.tokens, debouncedSearch]);
|
|
104
106
|
|
|
105
|
-
const
|
|
107
|
+
const setSearch = useCallback((search: string) => {
|
|
108
|
+
_setSearch(search);
|
|
109
|
+
setAllTokensLimit(ALL_TOKENS_LIMIT);
|
|
110
|
+
setOwnedTokensLimit(OWNED_TOKENS_LIMIT);
|
|
111
|
+
}, []);
|
|
106
112
|
|
|
107
113
|
return (
|
|
108
114
|
<SelectTokenUI
|
|
109
115
|
{...props}
|
|
110
|
-
ownedTokens={
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
ownedTokens={{
|
|
117
|
+
data: filteredOwnedTokens || [],
|
|
118
|
+
isFetching: ownedTokensQuery.isFetching,
|
|
119
|
+
showMore: ownedTokensQuery.data?.pagination.hasMore
|
|
120
|
+
? () => {
|
|
121
|
+
setOwnedTokensLimit(ownedTokensLimit + OWNED_TOKENS_LIMIT);
|
|
122
|
+
}
|
|
123
|
+
: undefined,
|
|
124
|
+
}}
|
|
125
|
+
allTokens={{
|
|
126
|
+
data: tokensQuery.data || [],
|
|
127
|
+
isFetching: tokensQuery.isFetching,
|
|
128
|
+
showMore:
|
|
129
|
+
tokensQuery.data?.length === allTokensLimit
|
|
130
|
+
? () => {
|
|
131
|
+
setAllTokensLimit(allTokensLimit + ALL_TOKENS_LIMIT);
|
|
132
|
+
}
|
|
133
|
+
: undefined,
|
|
134
|
+
}}
|
|
113
135
|
selectedChain={selectedChain}
|
|
114
136
|
setSelectedChain={setSelectedChain}
|
|
115
137
|
search={search}
|
|
116
138
|
setSearch={setSearch}
|
|
117
139
|
selectedToken={props.selectedToken}
|
|
118
140
|
setSelectedToken={props.setSelectedToken}
|
|
119
|
-
showMore={
|
|
120
|
-
tokensQuery.data?.length === limit
|
|
121
|
-
? () => {
|
|
122
|
-
setLimit(limit * 2);
|
|
123
|
-
}
|
|
124
|
-
: undefined
|
|
125
|
-
}
|
|
126
141
|
/>
|
|
127
142
|
);
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
function SelectTokenUI(
|
|
131
146
|
props: SelectTokenUIProps & {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
allTokens: {
|
|
148
|
+
data: Token[];
|
|
149
|
+
isFetching: boolean;
|
|
150
|
+
showMore: (() => void) | undefined;
|
|
151
|
+
};
|
|
152
|
+
ownedTokens: {
|
|
153
|
+
data: TokenBalance[];
|
|
154
|
+
isFetching: boolean;
|
|
155
|
+
showMore: (() => void) | undefined;
|
|
156
|
+
};
|
|
135
157
|
selectedChain: BridgeChain | undefined;
|
|
136
158
|
setSelectedChain: (chain: BridgeChain) => void;
|
|
137
159
|
search: string;
|
|
138
160
|
setSearch: (search: string) => void;
|
|
139
161
|
selectedToken: TokenSelection | undefined;
|
|
140
162
|
setSelectedToken: (token: TokenSelection) => void;
|
|
141
|
-
showMore: (() => void) | undefined;
|
|
142
163
|
},
|
|
143
164
|
) {
|
|
144
165
|
const isMobile = useIsMobile();
|
|
@@ -148,7 +169,7 @@ function SelectTokenUI(
|
|
|
148
169
|
|
|
149
170
|
// show tokens with icons first
|
|
150
171
|
const sortedOwnedTokens = useMemo(() => {
|
|
151
|
-
return props.ownedTokens.sort((a, b) => {
|
|
172
|
+
return props.ownedTokens.data.sort((a, b) => {
|
|
152
173
|
if (a.icon_uri && !b.icon_uri) {
|
|
153
174
|
return -1;
|
|
154
175
|
}
|
|
@@ -157,23 +178,11 @@ function SelectTokenUI(
|
|
|
157
178
|
}
|
|
158
179
|
return 0;
|
|
159
180
|
});
|
|
160
|
-
}, [props.ownedTokens]);
|
|
161
|
-
|
|
162
|
-
const otherTokens = useMemo(() => {
|
|
163
|
-
const ownedTokenSet = new Set(
|
|
164
|
-
sortedOwnedTokens.map((t) =>
|
|
165
|
-
`${t.token_address}-${t.chain_id}`.toLowerCase(),
|
|
166
|
-
),
|
|
167
|
-
);
|
|
168
|
-
return props.allTokens.filter(
|
|
169
|
-
(token) =>
|
|
170
|
-
!ownedTokenSet.has(`${token.address}-${token.chainId}`.toLowerCase()),
|
|
171
|
-
);
|
|
172
|
-
}, [props.allTokens, sortedOwnedTokens]);
|
|
181
|
+
}, [props.ownedTokens.data]);
|
|
173
182
|
|
|
174
183
|
// show tokens with icons first
|
|
175
|
-
const
|
|
176
|
-
return
|
|
184
|
+
const sortedAllTokens = useMemo(() => {
|
|
185
|
+
return props.allTokens.data.sort((a, b) => {
|
|
177
186
|
if (a.iconUri && !b.iconUri) {
|
|
178
187
|
return -1;
|
|
179
188
|
}
|
|
@@ -182,7 +191,7 @@ function SelectTokenUI(
|
|
|
182
191
|
}
|
|
183
192
|
return 0;
|
|
184
193
|
});
|
|
185
|
-
}, [
|
|
194
|
+
}, [props.allTokens.data]);
|
|
186
195
|
|
|
187
196
|
// desktop
|
|
188
197
|
if (!isMobile) {
|
|
@@ -214,15 +223,20 @@ function SelectTokenUI(
|
|
|
214
223
|
}}
|
|
215
224
|
isMobile={false}
|
|
216
225
|
selectedToken={props.selectedToken}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
226
|
+
ownedTokens={{
|
|
227
|
+
...props.ownedTokens,
|
|
228
|
+
data: sortedOwnedTokens,
|
|
229
|
+
}}
|
|
230
|
+
allTokens={{
|
|
231
|
+
...props.allTokens,
|
|
232
|
+
data: sortedAllTokens,
|
|
233
|
+
}}
|
|
221
234
|
selectedChain={props.selectedChain}
|
|
222
235
|
onSelectChain={() => setScreen("select-chain")}
|
|
223
236
|
client={props.client}
|
|
224
237
|
search={props.search}
|
|
225
238
|
setSearch={props.setSearch}
|
|
239
|
+
isWalletConnected={props.activeWalletInfo !== undefined}
|
|
226
240
|
/>
|
|
227
241
|
</Container>
|
|
228
242
|
</Container>
|
|
@@ -232,15 +246,20 @@ function SelectTokenUI(
|
|
|
232
246
|
if (screen === "select-token") {
|
|
233
247
|
return (
|
|
234
248
|
<TokenSelectionScreen
|
|
249
|
+
isWalletConnected={props.activeWalletInfo !== undefined}
|
|
235
250
|
onSelectToken={(token) => {
|
|
236
251
|
props.setSelectedToken(token);
|
|
237
252
|
props.onClose();
|
|
238
253
|
}}
|
|
239
254
|
selectedToken={props.selectedToken}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
255
|
+
ownedTokens={{
|
|
256
|
+
...props.ownedTokens,
|
|
257
|
+
data: sortedOwnedTokens,
|
|
258
|
+
}}
|
|
259
|
+
allTokens={{
|
|
260
|
+
...props.allTokens,
|
|
261
|
+
data: sortedAllTokens,
|
|
262
|
+
}}
|
|
244
263
|
selectedChain={props.selectedChain}
|
|
245
264
|
isMobile={true}
|
|
246
265
|
onSelectChain={() => setScreen("select-chain")}
|
|
@@ -428,17 +447,36 @@ function TokenSelectionScreen(props: {
|
|
|
428
447
|
client: ThirdwebClient;
|
|
429
448
|
search: string;
|
|
430
449
|
setSearch: (search: string) => void;
|
|
431
|
-
isFetching: boolean;
|
|
432
|
-
ownedTokens: TokenBalance[];
|
|
433
|
-
otherTokens: Token[];
|
|
434
|
-
showMore: (() => void) | undefined;
|
|
435
450
|
selectedToken: TokenSelection | undefined;
|
|
436
451
|
onSelectToken: (token: TokenSelection) => void;
|
|
452
|
+
isWalletConnected: boolean;
|
|
453
|
+
allTokens: {
|
|
454
|
+
data: Token[];
|
|
455
|
+
isFetching: boolean;
|
|
456
|
+
showMore: (() => void) | undefined;
|
|
457
|
+
};
|
|
458
|
+
ownedTokens: {
|
|
459
|
+
data: TokenBalance[];
|
|
460
|
+
isFetching: boolean;
|
|
461
|
+
showMore: (() => void) | undefined;
|
|
462
|
+
};
|
|
437
463
|
}) {
|
|
438
|
-
const
|
|
439
|
-
!props.isFetching &&
|
|
440
|
-
|
|
441
|
-
|
|
464
|
+
const noAllTokensFound =
|
|
465
|
+
!props.allTokens.isFetching && props.allTokens.data.length === 0;
|
|
466
|
+
|
|
467
|
+
const noOwnedTokensFound =
|
|
468
|
+
!props.ownedTokens.isFetching && props.ownedTokens.data.length === 0;
|
|
469
|
+
|
|
470
|
+
const [activeTab, setActiveTab] = useState<"owned" | "all">("all");
|
|
471
|
+
const showSkeletons =
|
|
472
|
+
(props.allTokens.isFetching && activeTab === "all") ||
|
|
473
|
+
(props.ownedTokens.isFetching && activeTab === "owned");
|
|
474
|
+
|
|
475
|
+
const showNoTokensFound =
|
|
476
|
+
(activeTab === "all" && noAllTokensFound) ||
|
|
477
|
+
(activeTab === "owned" && noOwnedTokensFound);
|
|
478
|
+
|
|
479
|
+
const theme = useCustomTheme();
|
|
442
480
|
|
|
443
481
|
return (
|
|
444
482
|
<Container fullHeight flex="column">
|
|
@@ -448,16 +486,14 @@ function TokenSelectionScreen(props: {
|
|
|
448
486
|
</Text>
|
|
449
487
|
<Spacer y="3xs" />
|
|
450
488
|
<Text
|
|
451
|
-
size="
|
|
489
|
+
size="sm"
|
|
452
490
|
color="secondaryText"
|
|
453
491
|
multiline
|
|
454
492
|
style={{
|
|
455
493
|
textWrap: "pretty",
|
|
456
|
-
maxWidth: "70%",
|
|
457
494
|
}}
|
|
458
495
|
>
|
|
459
|
-
Select a token from the list or
|
|
460
|
-
address
|
|
496
|
+
Select a token from the list or use the search
|
|
461
497
|
</Text>
|
|
462
498
|
</Container>
|
|
463
499
|
|
|
@@ -467,7 +503,7 @@ function TokenSelectionScreen(props: {
|
|
|
467
503
|
display: "flex",
|
|
468
504
|
alignItems: "center",
|
|
469
505
|
justifyContent: "center",
|
|
470
|
-
minHeight: "
|
|
506
|
+
minHeight: "300px",
|
|
471
507
|
}}
|
|
472
508
|
>
|
|
473
509
|
<Spinner color="secondaryText" size="xl" />
|
|
@@ -498,7 +534,28 @@ function TokenSelectionScreen(props: {
|
|
|
498
534
|
/>
|
|
499
535
|
</Container>
|
|
500
536
|
|
|
501
|
-
<Spacer y="
|
|
537
|
+
<Spacer y="sm" />
|
|
538
|
+
|
|
539
|
+
{/* tabs */}
|
|
540
|
+
{props.isWalletConnected && (
|
|
541
|
+
<Container
|
|
542
|
+
flex="row"
|
|
543
|
+
gap="xs"
|
|
544
|
+
px="md"
|
|
545
|
+
style={{ borderBottom: `1px solid ${theme.colors.borderColor}` }}
|
|
546
|
+
>
|
|
547
|
+
<TabButton
|
|
548
|
+
isSelected={activeTab === "all"}
|
|
549
|
+
onSelect={() => setActiveTab("all")}
|
|
550
|
+
label="All Tokens"
|
|
551
|
+
/>
|
|
552
|
+
<TabButton
|
|
553
|
+
isSelected={activeTab === "owned"}
|
|
554
|
+
onSelect={() => setActiveTab("owned")}
|
|
555
|
+
label="Your Tokens"
|
|
556
|
+
/>
|
|
557
|
+
</Container>
|
|
558
|
+
)}
|
|
502
559
|
|
|
503
560
|
<Container
|
|
504
561
|
pb="md"
|
|
@@ -507,43 +564,24 @@ function TokenSelectionScreen(props: {
|
|
|
507
564
|
gap="xxs"
|
|
508
565
|
flex="column"
|
|
509
566
|
style={{
|
|
510
|
-
minHeight: "
|
|
567
|
+
minHeight: "300px",
|
|
511
568
|
maxHeight: props.isMobile ? "450px" : "none",
|
|
512
569
|
overflowY: "auto",
|
|
513
570
|
scrollbarWidth: "none",
|
|
514
571
|
paddingBottom: spacing.md,
|
|
515
572
|
}}
|
|
516
573
|
>
|
|
517
|
-
{props.
|
|
574
|
+
{props.isWalletConnected && <Spacer y="xxs" />}
|
|
575
|
+
|
|
576
|
+
{showSkeletons &&
|
|
518
577
|
new Array(20).fill(0).map((_, i) => (
|
|
519
578
|
// biome-ignore lint/suspicious/noArrayIndexKey: ok
|
|
520
579
|
<TokenButtonSkeleton key={i} />
|
|
521
580
|
))}
|
|
522
581
|
|
|
523
|
-
{
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
py="xs"
|
|
527
|
-
flex="row"
|
|
528
|
-
gap="xs"
|
|
529
|
-
center="y"
|
|
530
|
-
color="secondaryText"
|
|
531
|
-
>
|
|
532
|
-
<WalletDotIcon size={iconSize.xs} />
|
|
533
|
-
<Text
|
|
534
|
-
size="sm"
|
|
535
|
-
color="secondaryText"
|
|
536
|
-
style={{
|
|
537
|
-
overflow: "unset",
|
|
538
|
-
}}
|
|
539
|
-
>
|
|
540
|
-
Your Tokens
|
|
541
|
-
</Text>
|
|
542
|
-
</Container>
|
|
543
|
-
)}
|
|
544
|
-
|
|
545
|
-
{!props.isFetching &&
|
|
546
|
-
props.ownedTokens.map((token) => (
|
|
582
|
+
{activeTab === "owned" &&
|
|
583
|
+
!props.ownedTokens.isFetching &&
|
|
584
|
+
props.ownedTokens.data.map((token) => (
|
|
547
585
|
<TokenButton
|
|
548
586
|
key={token.token_address}
|
|
549
587
|
token={token}
|
|
@@ -558,33 +596,9 @@ function TokenSelectionScreen(props: {
|
|
|
558
596
|
/>
|
|
559
597
|
))}
|
|
560
598
|
|
|
561
|
-
{
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
py="xs"
|
|
565
|
-
flex="row"
|
|
566
|
-
gap="xs"
|
|
567
|
-
center="y"
|
|
568
|
-
color="secondaryText"
|
|
569
|
-
style={{
|
|
570
|
-
marginTop: spacing.sm,
|
|
571
|
-
}}
|
|
572
|
-
>
|
|
573
|
-
<CoinsIcon size={iconSize.xs} />
|
|
574
|
-
<Text
|
|
575
|
-
size="sm"
|
|
576
|
-
color="secondaryText"
|
|
577
|
-
style={{
|
|
578
|
-
overflow: "unset",
|
|
579
|
-
}}
|
|
580
|
-
>
|
|
581
|
-
Other Tokens
|
|
582
|
-
</Text>
|
|
583
|
-
</Container>
|
|
584
|
-
)}
|
|
585
|
-
|
|
586
|
-
{!props.isFetching &&
|
|
587
|
-
props.otherTokens.map((token) => (
|
|
599
|
+
{activeTab === "all" &&
|
|
600
|
+
!props.allTokens.isFetching &&
|
|
601
|
+
props.allTokens.data.map((token) => (
|
|
588
602
|
<TokenButton
|
|
589
603
|
key={token.address}
|
|
590
604
|
token={token}
|
|
@@ -599,19 +613,31 @@ function TokenSelectionScreen(props: {
|
|
|
599
613
|
/>
|
|
600
614
|
))}
|
|
601
615
|
|
|
602
|
-
{props.showMore && (
|
|
616
|
+
{activeTab === "all" && props.allTokens.showMore && (
|
|
603
617
|
<Button
|
|
604
618
|
variant="secondary"
|
|
605
619
|
fullWidth
|
|
606
620
|
onClick={() => {
|
|
607
|
-
props.showMore?.();
|
|
621
|
+
props.allTokens.showMore?.();
|
|
608
622
|
}}
|
|
609
623
|
>
|
|
610
624
|
Load More
|
|
611
625
|
</Button>
|
|
612
626
|
)}
|
|
613
627
|
|
|
614
|
-
{
|
|
628
|
+
{activeTab === "owned" && props.ownedTokens.showMore && (
|
|
629
|
+
<Button
|
|
630
|
+
variant="secondary"
|
|
631
|
+
fullWidth
|
|
632
|
+
onClick={() => {
|
|
633
|
+
props.ownedTokens.showMore?.();
|
|
634
|
+
}}
|
|
635
|
+
>
|
|
636
|
+
Load More
|
|
637
|
+
</Button>
|
|
638
|
+
)}
|
|
639
|
+
|
|
640
|
+
{showNoTokensFound && (
|
|
615
641
|
<div
|
|
616
642
|
style={{
|
|
617
643
|
flex: 1,
|
|
@@ -620,7 +646,7 @@ function TokenSelectionScreen(props: {
|
|
|
620
646
|
justifyContent: "center",
|
|
621
647
|
}}
|
|
622
648
|
>
|
|
623
|
-
<Text size="
|
|
649
|
+
<Text size="sm" color="secondaryText">
|
|
624
650
|
No Tokens Found
|
|
625
651
|
</Text>
|
|
626
652
|
</div>
|
|
@@ -643,3 +669,45 @@ const LeftContainer = /* @__PURE__ */ StyledDiv((_) => {
|
|
|
643
669
|
position: "relative",
|
|
644
670
|
};
|
|
645
671
|
});
|
|
672
|
+
|
|
673
|
+
function TabButton(props: {
|
|
674
|
+
isSelected: boolean;
|
|
675
|
+
onSelect: () => void;
|
|
676
|
+
label: string;
|
|
677
|
+
}) {
|
|
678
|
+
const theme = useCustomTheme();
|
|
679
|
+
return (
|
|
680
|
+
<div
|
|
681
|
+
style={{
|
|
682
|
+
paddingBottom: "4px",
|
|
683
|
+
position: "relative",
|
|
684
|
+
}}
|
|
685
|
+
>
|
|
686
|
+
<Button
|
|
687
|
+
variant="ghost-solid"
|
|
688
|
+
onClick={props.onSelect}
|
|
689
|
+
style={{
|
|
690
|
+
fontSize: fontSize.sm,
|
|
691
|
+
padding: `10px ${spacing.xs}`,
|
|
692
|
+
color: props.isSelected
|
|
693
|
+
? theme.colors.primaryText
|
|
694
|
+
: theme.colors.secondaryText,
|
|
695
|
+
}}
|
|
696
|
+
>
|
|
697
|
+
{props.label}
|
|
698
|
+
</Button>
|
|
699
|
+
|
|
700
|
+
{props.isSelected && (
|
|
701
|
+
<div
|
|
702
|
+
style={{
|
|
703
|
+
position: "absolute",
|
|
704
|
+
left: 0,
|
|
705
|
+
right: 0,
|
|
706
|
+
bottom: "-1.5px",
|
|
707
|
+
borderBottom: `2px solid ${theme.colors.primaryText}`,
|
|
708
|
+
}}
|
|
709
|
+
></div>
|
|
710
|
+
)}
|
|
711
|
+
</div>
|
|
712
|
+
);
|
|
713
|
+
}
|
|
@@ -46,17 +46,19 @@ export function WalletRow(props: {
|
|
|
46
46
|
const addressOrENS = address
|
|
47
47
|
? ensNameQuery.data || shortenAddress(address)
|
|
48
48
|
: "";
|
|
49
|
+
|
|
50
|
+
const iconSizeValue = iconSize[props.iconSize || "md"];
|
|
49
51
|
return (
|
|
50
52
|
<Container flex="row" style={{ justifyContent: "space-between" }}>
|
|
51
|
-
<Container center="y" color="secondaryText" flex="row" gap="
|
|
53
|
+
<Container center="y" color="secondaryText" flex="row" gap="sm">
|
|
52
54
|
{wallet ? (
|
|
53
55
|
<WalletImage
|
|
54
56
|
client={props.client}
|
|
55
57
|
id={wallet.id}
|
|
56
|
-
size={
|
|
58
|
+
size={iconSizeValue}
|
|
57
59
|
/>
|
|
58
60
|
) : (
|
|
59
|
-
<OutlineWalletIcon size={
|
|
61
|
+
<OutlineWalletIcon size={iconSizeValue} />
|
|
60
62
|
)}
|
|
61
63
|
<Container flex="column" gap="3xs">
|
|
62
64
|
{props.label ? (
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { CheckIcon, CopyIcon as CopyIconSVG } from "@radix-ui/react-icons";
|
|
3
|
+
import { radius } from "../../../core/design-system/index.js";
|
|
3
4
|
import { useClipboard } from "../hooks/useCopyClipboard.js";
|
|
4
5
|
import { Container } from "./basic.js";
|
|
6
|
+
import { Button } from "./buttons.js";
|
|
5
7
|
import { ToolTip } from "./Tooltip.js";
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -19,25 +21,22 @@ export const CopyIcon: React.FC<{
|
|
|
19
21
|
const showCheckIcon = props.hasCopied || hasCopied;
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
|
-
|
|
23
|
-
<div
|
|
24
|
+
<Button
|
|
24
25
|
onClick={onCopy}
|
|
25
|
-
|
|
26
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
27
|
-
onCopy();
|
|
28
|
-
}
|
|
29
|
-
}}
|
|
26
|
+
variant="ghost-solid"
|
|
30
27
|
style={{
|
|
31
28
|
alignItems: "center",
|
|
32
29
|
display: "flex",
|
|
30
|
+
padding: 2,
|
|
33
31
|
justifyContent: "center",
|
|
32
|
+
borderRadius: radius.sm,
|
|
34
33
|
}}
|
|
35
34
|
>
|
|
36
35
|
<ToolTip align={props.align} side={props.side} tip={props.tip}>
|
|
37
36
|
<div>
|
|
38
37
|
<Container
|
|
39
38
|
center="both"
|
|
40
|
-
color={showCheckIcon ? "success" :
|
|
39
|
+
color={showCheckIcon ? "success" : "secondaryText"}
|
|
41
40
|
flex="row"
|
|
42
41
|
>
|
|
43
42
|
{showCheckIcon ? (
|
|
@@ -56,6 +55,6 @@ export const CopyIcon: React.FC<{
|
|
|
56
55
|
</Container>
|
|
57
56
|
</div>
|
|
58
57
|
</ToolTip>
|
|
59
|
-
</
|
|
58
|
+
</Button>
|
|
60
59
|
);
|
|
61
60
|
};
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.111.
|
|
1
|
+
export const version = "5.111.10";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.celoAlfajoresTestnet = void 0;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
/**
|
|
6
|
-
* @chain
|
|
7
|
-
*/
|
|
8
|
-
exports.celoAlfajoresTestnet = (0, utils_js_1.defineChain)({
|
|
9
|
-
blockExplorers: [
|
|
10
|
-
{
|
|
11
|
-
name: "Alfajoresscan",
|
|
12
|
-
url: "https://alfajores.celoscan.io",
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
id: 44787,
|
|
16
|
-
name: "Celo Alfajores Testnet",
|
|
17
|
-
nativeCurrency: { decimals: 18, name: "CELO", symbol: "CELO" },
|
|
18
|
-
testnet: true,
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=celo-alfajores-testnet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"celo-alfajores-testnet.js","sourceRoot":"","sources":["../../../../src/chains/chain-definitions/celo-alfajores-testnet.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAE1C;;GAEG;AACU,QAAA,oBAAoB,GAAmB,IAAA,sBAAW,EAAC;IAC9D,cAAc,EAAE;QACd;YACE,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,+BAA+B;SACrC;KACF;IACD,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,wBAAwB;IAC9B,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9D,OAAO,EAAE,IAAI;CACd,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineChain } from "../utils.js";
|
|
2
|
-
/**
|
|
3
|
-
* @chain
|
|
4
|
-
*/
|
|
5
|
-
export const celoAlfajoresTestnet = /* @__PURE__ */ defineChain({
|
|
6
|
-
blockExplorers: [
|
|
7
|
-
{
|
|
8
|
-
name: "Alfajoresscan",
|
|
9
|
-
url: "https://alfajores.celoscan.io",
|
|
10
|
-
},
|
|
11
|
-
],
|
|
12
|
-
id: 44787,
|
|
13
|
-
name: "Celo Alfajores Testnet",
|
|
14
|
-
nativeCurrency: { decimals: 18, name: "CELO", symbol: "CELO" },
|
|
15
|
-
testnet: true,
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=celo-alfajores-testnet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"celo-alfajores-testnet.js","sourceRoot":"","sources":["../../../../src/chains/chain-definitions/celo-alfajores-testnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,WAAW,CAAC;IAC9D,cAAc,EAAE;QACd;YACE,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,+BAA+B;SACrC;KACF;IACD,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,wBAAwB;IAC9B,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9D,OAAO,EAAE,IAAI;CACd,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"celo-alfajores-testnet.d.ts","sourceRoot":"","sources":["../../../../src/chains/chain-definitions/celo-alfajores-testnet.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,oBAAoB;;EAW/B,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineChain } from "../utils.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @chain
|
|
5
|
-
*/
|
|
6
|
-
export const celoAlfajoresTestnet = /* @__PURE__ */ defineChain({
|
|
7
|
-
blockExplorers: [
|
|
8
|
-
{
|
|
9
|
-
name: "Alfajoresscan",
|
|
10
|
-
url: "https://alfajores.celoscan.io",
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
id: 44787,
|
|
14
|
-
name: "Celo Alfajores Testnet",
|
|
15
|
-
nativeCurrency: { decimals: 18, name: "CELO", symbol: "CELO" },
|
|
16
|
-
testnet: true,
|
|
17
|
-
});
|