thirdweb 5.116.2-nightly-4bab6f1ae85cbc03da1bb15b5626ce8d10cace48-20251216000358 → 5.116.2-nightly-7ebc32a0c4e3fa71167255ee5a517143c3ea3a0a-20251217000343
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/react/web/ui/Bridge/bridge-widget/bridge-widget.js +10 -5
- package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -1
- package/dist/cjs/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js +15 -14
- package/dist/cjs/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js +10 -5
- package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -1
- package/dist/esm/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js +15 -13
- package/dist/esm/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/scripts/bridge-widget.js +3 -3
- package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts +107 -0
- package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts.map +1 -1
- package/dist/types/stories/Bridge/BridgeWidget/bridge-widget-script.stories.d.ts +0 -1
- package/dist/types/stories/Bridge/BridgeWidget/bridge-widget-script.stories.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx +129 -2
- package/src/react/web/ui/MediaRenderer/MediaRenderer.test.tsx +2 -2
- package/src/stories/Bridge/BridgeWidget/bridge-widget-script.stories.tsx +22 -23
- package/src/version.ts +1 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import type { Chain } from "../../../../../chains/types.js";
|
|
1
2
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
2
3
|
import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
|
|
3
4
|
import type { PurchaseData } from "../../../../../pay/types.js";
|
|
5
|
+
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
|
|
6
|
+
import type { SmartWalletOptions } from "../../../../../wallets/smart/types.js";
|
|
7
|
+
import type { AppMetadata } from "../../../../../wallets/types.js";
|
|
4
8
|
import { type Theme } from "../../../../core/design-system/index.js";
|
|
9
|
+
import type { SiweAuthOptions } from "../../../../core/hooks/auth/useSiweAuth.js";
|
|
10
|
+
import type { ConnectButton_connectModalOptions } from "../../../../core/hooks/connection/ConnectButtonProps.js";
|
|
5
11
|
import type { CompletedStatusResult } from "../../../../core/hooks/useStepExecutor.js";
|
|
6
12
|
import { type BuyOrOnrampPrepareResult } from "../BuyWidget.js";
|
|
7
13
|
import type { SwapPreparedQuote } from "../swap-widget/types.js";
|
|
@@ -9,6 +15,8 @@ import type { SwapPreparedQuote } from "../swap-widget/types.js";
|
|
|
9
15
|
* Props for the `BridgeWidget` component.
|
|
10
16
|
*/
|
|
11
17
|
export type BridgeWidgetProps = {
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
12
20
|
/**
|
|
13
21
|
* A client is the entry point to the thirdweb SDK. It is required for all other actions.
|
|
14
22
|
* You can create a client using the `createThirdwebClient` function. Refer to the
|
|
@@ -165,6 +173,105 @@ export type BridgeWidgetProps = {
|
|
|
165
173
|
/** Arbitrary data to be included in returned status and webhook events. */
|
|
166
174
|
purchaseData?: PurchaseData;
|
|
167
175
|
};
|
|
176
|
+
connectOptions?: {
|
|
177
|
+
/**
|
|
178
|
+
* Configurations for the `ConnectButton`'s Modal that is shown for connecting a wallet
|
|
179
|
+
* Refer to the [`ConnectButton_connectModalOptions`](https://portal.thirdweb.com/references/typescript/v5/ConnectButton_connectModalOptions) type for more details
|
|
180
|
+
*/
|
|
181
|
+
connectModal?: ConnectButton_connectModalOptions;
|
|
182
|
+
/**
|
|
183
|
+
* Configure options for WalletConnect
|
|
184
|
+
*
|
|
185
|
+
* By default WalletConnect uses the thirdweb's default project id.
|
|
186
|
+
* Setting your own project id is recommended.
|
|
187
|
+
*
|
|
188
|
+
* You can create a project id by signing up on [walletconnect.com](https://walletconnect.com/)
|
|
189
|
+
*/
|
|
190
|
+
walletConnect?: {
|
|
191
|
+
projectId?: string;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Enable Account abstraction for all wallets. This will connect to the users's smart account based on the connected personal wallet and the given options.
|
|
195
|
+
*
|
|
196
|
+
* This allows to sponsor gas fees for your user's transaction using the thirdweb account abstraction infrastructure.
|
|
197
|
+
*
|
|
198
|
+
*/
|
|
199
|
+
accountAbstraction?: SmartWalletOptions;
|
|
200
|
+
/**
|
|
201
|
+
* Array of wallets to show in Connect Modal. If not provided, default wallets will be used.
|
|
202
|
+
*/
|
|
203
|
+
wallets?: Wallet[];
|
|
204
|
+
/**
|
|
205
|
+
* When the user has connected their wallet to your site, this configuration determines whether or not you want to automatically connect to the last connected wallet when user visits your site again in the future.
|
|
206
|
+
*
|
|
207
|
+
* By default it is set to `{ timeout: 15000 }` meaning that autoConnect is enabled and if the autoConnection does not succeed within 15 seconds, it will be cancelled.
|
|
208
|
+
*
|
|
209
|
+
* If you want to disable autoConnect, set this prop to `false`.
|
|
210
|
+
*
|
|
211
|
+
* If you want to customize the timeout, you can assign an object with a `timeout` key to this prop.
|
|
212
|
+
*/
|
|
213
|
+
autoConnect?: {
|
|
214
|
+
timeout: number;
|
|
215
|
+
} | boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Metadata of the app that will be passed to connected wallet. Setting this is highly recommended.
|
|
218
|
+
*/
|
|
219
|
+
appMetadata?: AppMetadata;
|
|
220
|
+
/**
|
|
221
|
+
* The [`Chain`](https://portal.thirdweb.com/references/typescript/v5/Chain) object of the blockchain you want the wallet to connect to
|
|
222
|
+
*
|
|
223
|
+
* If a `chain` is not specified, Wallet will be connected to whatever is the default set in the wallet.
|
|
224
|
+
*
|
|
225
|
+
* If a `chain` is specified, Wallet will be prompted to switch to given chain after connection if it is not already connected to it.
|
|
226
|
+
* This ensures that the wallet is connected to the correct blockchain before interacting with your app.
|
|
227
|
+
*
|
|
228
|
+
* The `ConnectButton` also shows a "Switch Network" button until the wallet is connected to the specified chain. Clicking on the "Switch Network" button triggers the wallet to switch to the specified chain.
|
|
229
|
+
*
|
|
230
|
+
* You can create a `Chain` object using the [`defineChain`](https://portal.thirdweb.com/references/typescript/v5/defineChain) function.
|
|
231
|
+
* At minimum, you need to pass the `id` of the blockchain to `defineChain` function to create a `Chain` object.
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
chain?: Chain;
|
|
235
|
+
/**
|
|
236
|
+
* Array of chains that your app supports.
|
|
237
|
+
*
|
|
238
|
+
* This is only relevant if your app is a multi-chain app and works across multiple blockchains.
|
|
239
|
+
* If your app only works on a single blockchain, you should only specify the `chain` prop.
|
|
240
|
+
*
|
|
241
|
+
* Given list of chains will used in various ways:
|
|
242
|
+
* - They will be displayed in the network selector in the `ConnectButton`'s details modal post connection
|
|
243
|
+
* - They will be sent to wallet at the time of connection if the wallet supports requesting multiple chains ( example: WalletConnect ) so that users can switch between the chains post connection easily
|
|
244
|
+
*
|
|
245
|
+
* You can create a `Chain` object using the [`defineChain`](https://portal.thirdweb.com/references/typescript/v5/defineChain) function.
|
|
246
|
+
* At minimum, you need to pass the `id` of the blockchain to `defineChain` function to create a `Chain` object.
|
|
247
|
+
*
|
|
248
|
+
* ```tsx
|
|
249
|
+
* import { defineChain } from "thirdweb/react";
|
|
250
|
+
*
|
|
251
|
+
* const polygon = defineChain({
|
|
252
|
+
* id: 137,
|
|
253
|
+
* });
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
chains?: Chain[];
|
|
257
|
+
/**
|
|
258
|
+
* Wallets to show as recommended in the `ConnectButton`'s Modal
|
|
259
|
+
*/
|
|
260
|
+
recommendedWallets?: Wallet[];
|
|
261
|
+
/**
|
|
262
|
+
* By default, ConnectButton modal shows a "All Wallets" button that shows a list of 500+ wallets.
|
|
263
|
+
*
|
|
264
|
+
* You can disable this button by setting `showAllWallets` prop to `false`
|
|
265
|
+
*/
|
|
266
|
+
showAllWallets?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Enable SIWE (Sign in with Ethererum) by passing an object of type `SiweAuthOptions` to
|
|
269
|
+
* enforce the users to sign a message after connecting their wallet to authenticate themselves.
|
|
270
|
+
*
|
|
271
|
+
* Refer to the [`SiweAuthOptions`](https://portal.thirdweb.com/references/typescript/v5/SiweAuthOptions) for more details
|
|
272
|
+
*/
|
|
273
|
+
auth?: SiweAuthOptions;
|
|
274
|
+
};
|
|
168
275
|
};
|
|
169
276
|
/**
|
|
170
277
|
* A combined widget for swapping or buying tokens with cross-chain support.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-widget.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge-widget.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,EAIL,KAAK,KAAK,EACX,MAAM,yCAAyC,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AAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,2EAA2E;QAC3E,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B,CAAC;IAEF,cAAc,CAAC,EAAE;QACf;;;WAGG;QACH,YAAY,CAAC,EAAE,iCAAiC,CAAC;QAEjD;;;;;;;WAOG;QACH,aAAa,CAAC,EAAE;YACd,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC;QAEF;;;;;WAKG;QACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;QAExC;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB;;;;;;;;WAQG;QACH,WAAW,CAAC,EACR;YACE,OAAO,EAAE,MAAM,CAAC;SACjB,GACD,OAAO,CAAC;QAEZ;;WAEG;QACH,WAAW,CAAC,EAAE,WAAW,CAAC;QAE1B;;;;;;;;;;;;;WAaG;QACH,KAAK,CAAC,EAAE,KAAK,CAAC;QAEd;;;;;;;;;;;;;;;;;;;;WAoBG;QACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QAEjB;;WAEG;QACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;QAE9B;;;;WAIG;QACH,cAAc,CAAC,EAAE,OAAO,CAAC;QAEzB;;;;;WAKG;QACH,IAAI,CAAC,EAAE,eAAe,CAAC;KACxB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA4FpD"}
|
|
@@ -3,7 +3,6 @@ import { BridgeWidgetScript } from "../../../script-exports/bridge-widget-script
|
|
|
3
3
|
declare const meta: Meta<typeof BridgeWidgetScript>;
|
|
4
4
|
export default meta;
|
|
5
5
|
export declare function BasicUsage(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare function LightTheme(): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export declare function CurrencySet(): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export declare function NoThirdwebBranding(): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export declare function CustomTheme(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-widget-script.stories.d.ts","sourceRoot":"","sources":["../../../../../src/stories/Bridge/BridgeWidget/bridge-widget-script.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAEnB,MAAM,iDAAiD,CAAC;AAGzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CAEzC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,wBAAgB,UAAU,4CAOzB;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"bridge-widget-script.stories.d.ts","sourceRoot":"","sources":["../../../../../src/stories/Bridge/BridgeWidget/bridge-widget-script.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAEnB,MAAM,iDAAiD,CAAC;AAGzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CAEzC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,wBAAgB,UAAU,4CAOzB;AAED,wBAAgB,WAAW,4CAQ1B;AAED,wBAAgB,kBAAkB,4CASjC;AAED,wBAAgB,WAAW,4CA0B1B"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.116.2-nightly-
|
|
1
|
+
export declare const version = "5.116.2-nightly-7ebc32a0c4e3fa71167255ee5a517143c3ea3a0a-20251217000343";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
"typings": "./dist/types/exports/thirdweb.d.ts",
|
|
402
|
-
"version": "5.116.2-nightly-
|
|
402
|
+
"version": "5.116.2-nightly-7ebc32a0c4e3fa71167255ee5a517143c3ea3a0a-20251217000343",
|
|
403
403
|
"scripts": {
|
|
404
404
|
"bench": "vitest -c ./test/vitest.config.ts bench",
|
|
405
405
|
"bench:compare": "bun run ./benchmarks/run.ts",
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { trackPayEvent } from "../../../../../analytics/track/pay.js";
|
|
3
|
+
import type { Chain } from "../../../../../chains/types.js";
|
|
3
4
|
import { defineChain } from "../../../../../chains/utils.js";
|
|
4
5
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
5
6
|
import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
|
|
6
7
|
import type { PurchaseData } from "../../../../../pay/types.js";
|
|
8
|
+
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
|
|
9
|
+
import type { SmartWalletOptions } from "../../../../../wallets/smart/types.js";
|
|
10
|
+
import type { AppMetadata } from "../../../../../wallets/types.js";
|
|
7
11
|
import {
|
|
8
12
|
CustomThemeProvider,
|
|
9
13
|
useCustomTheme,
|
|
@@ -14,6 +18,8 @@ import {
|
|
|
14
18
|
spacing,
|
|
15
19
|
type Theme,
|
|
16
20
|
} from "../../../../core/design-system/index.js";
|
|
21
|
+
import type { SiweAuthOptions } from "../../../../core/hooks/auth/useSiweAuth.js";
|
|
22
|
+
import type { ConnectButton_connectModalOptions } from "../../../../core/hooks/connection/ConnectButtonProps.js";
|
|
17
23
|
import type { CompletedStatusResult } from "../../../../core/hooks/useStepExecutor.js";
|
|
18
24
|
import { EmbedContainer } from "../../ConnectWallet/Modal/ConnectEmbed.js";
|
|
19
25
|
import { Container } from "../../components/basic.js";
|
|
@@ -26,6 +32,8 @@ import type { SwapPreparedQuote } from "../swap-widget/types.js";
|
|
|
26
32
|
* Props for the `BridgeWidget` component.
|
|
27
33
|
*/
|
|
28
34
|
export type BridgeWidgetProps = {
|
|
35
|
+
className?: string;
|
|
36
|
+
style?: React.CSSProperties;
|
|
29
37
|
/**
|
|
30
38
|
* A client is the entry point to the thirdweb SDK. It is required for all other actions.
|
|
31
39
|
* You can create a client using the `createThirdwebClient` function. Refer to the
|
|
@@ -190,6 +198,117 @@ export type BridgeWidgetProps = {
|
|
|
190
198
|
/** Arbitrary data to be included in returned status and webhook events. */
|
|
191
199
|
purchaseData?: PurchaseData;
|
|
192
200
|
};
|
|
201
|
+
|
|
202
|
+
connectOptions?: {
|
|
203
|
+
/**
|
|
204
|
+
* Configurations for the `ConnectButton`'s Modal that is shown for connecting a wallet
|
|
205
|
+
* Refer to the [`ConnectButton_connectModalOptions`](https://portal.thirdweb.com/references/typescript/v5/ConnectButton_connectModalOptions) type for more details
|
|
206
|
+
*/
|
|
207
|
+
connectModal?: ConnectButton_connectModalOptions;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Configure options for WalletConnect
|
|
211
|
+
*
|
|
212
|
+
* By default WalletConnect uses the thirdweb's default project id.
|
|
213
|
+
* Setting your own project id is recommended.
|
|
214
|
+
*
|
|
215
|
+
* You can create a project id by signing up on [walletconnect.com](https://walletconnect.com/)
|
|
216
|
+
*/
|
|
217
|
+
walletConnect?: {
|
|
218
|
+
projectId?: string;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Enable Account abstraction for all wallets. This will connect to the users's smart account based on the connected personal wallet and the given options.
|
|
223
|
+
*
|
|
224
|
+
* This allows to sponsor gas fees for your user's transaction using the thirdweb account abstraction infrastructure.
|
|
225
|
+
*
|
|
226
|
+
*/
|
|
227
|
+
accountAbstraction?: SmartWalletOptions;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Array of wallets to show in Connect Modal. If not provided, default wallets will be used.
|
|
231
|
+
*/
|
|
232
|
+
wallets?: Wallet[];
|
|
233
|
+
/**
|
|
234
|
+
* When the user has connected their wallet to your site, this configuration determines whether or not you want to automatically connect to the last connected wallet when user visits your site again in the future.
|
|
235
|
+
*
|
|
236
|
+
* By default it is set to `{ timeout: 15000 }` meaning that autoConnect is enabled and if the autoConnection does not succeed within 15 seconds, it will be cancelled.
|
|
237
|
+
*
|
|
238
|
+
* If you want to disable autoConnect, set this prop to `false`.
|
|
239
|
+
*
|
|
240
|
+
* If you want to customize the timeout, you can assign an object with a `timeout` key to this prop.
|
|
241
|
+
*/
|
|
242
|
+
autoConnect?:
|
|
243
|
+
| {
|
|
244
|
+
timeout: number;
|
|
245
|
+
}
|
|
246
|
+
| boolean;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Metadata of the app that will be passed to connected wallet. Setting this is highly recommended.
|
|
250
|
+
*/
|
|
251
|
+
appMetadata?: AppMetadata;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The [`Chain`](https://portal.thirdweb.com/references/typescript/v5/Chain) object of the blockchain you want the wallet to connect to
|
|
255
|
+
*
|
|
256
|
+
* If a `chain` is not specified, Wallet will be connected to whatever is the default set in the wallet.
|
|
257
|
+
*
|
|
258
|
+
* If a `chain` is specified, Wallet will be prompted to switch to given chain after connection if it is not already connected to it.
|
|
259
|
+
* This ensures that the wallet is connected to the correct blockchain before interacting with your app.
|
|
260
|
+
*
|
|
261
|
+
* The `ConnectButton` also shows a "Switch Network" button until the wallet is connected to the specified chain. Clicking on the "Switch Network" button triggers the wallet to switch to the specified chain.
|
|
262
|
+
*
|
|
263
|
+
* You can create a `Chain` object using the [`defineChain`](https://portal.thirdweb.com/references/typescript/v5/defineChain) function.
|
|
264
|
+
* At minimum, you need to pass the `id` of the blockchain to `defineChain` function to create a `Chain` object.
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
chain?: Chain;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Array of chains that your app supports.
|
|
271
|
+
*
|
|
272
|
+
* This is only relevant if your app is a multi-chain app and works across multiple blockchains.
|
|
273
|
+
* If your app only works on a single blockchain, you should only specify the `chain` prop.
|
|
274
|
+
*
|
|
275
|
+
* Given list of chains will used in various ways:
|
|
276
|
+
* - They will be displayed in the network selector in the `ConnectButton`'s details modal post connection
|
|
277
|
+
* - They will be sent to wallet at the time of connection if the wallet supports requesting multiple chains ( example: WalletConnect ) so that users can switch between the chains post connection easily
|
|
278
|
+
*
|
|
279
|
+
* You can create a `Chain` object using the [`defineChain`](https://portal.thirdweb.com/references/typescript/v5/defineChain) function.
|
|
280
|
+
* At minimum, you need to pass the `id` of the blockchain to `defineChain` function to create a `Chain` object.
|
|
281
|
+
*
|
|
282
|
+
* ```tsx
|
|
283
|
+
* import { defineChain } from "thirdweb/react";
|
|
284
|
+
*
|
|
285
|
+
* const polygon = defineChain({
|
|
286
|
+
* id: 137,
|
|
287
|
+
* });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
chains?: Chain[];
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Wallets to show as recommended in the `ConnectButton`'s Modal
|
|
294
|
+
*/
|
|
295
|
+
recommendedWallets?: Wallet[];
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* By default, ConnectButton modal shows a "All Wallets" button that shows a list of 500+ wallets.
|
|
299
|
+
*
|
|
300
|
+
* You can disable this button by setting `showAllWallets` prop to `false`
|
|
301
|
+
*/
|
|
302
|
+
showAllWallets?: boolean;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Enable SIWE (Sign in with Ethererum) by passing an object of type `SiweAuthOptions` to
|
|
306
|
+
* enforce the users to sign a message after connecting their wallet to authenticate themselves.
|
|
307
|
+
*
|
|
308
|
+
* Refer to the [`SiweAuthOptions`](https://portal.thirdweb.com/references/typescript/v5/SiweAuthOptions) for more details
|
|
309
|
+
*/
|
|
310
|
+
auth?: SiweAuthOptions;
|
|
311
|
+
};
|
|
193
312
|
};
|
|
194
313
|
|
|
195
314
|
/**
|
|
@@ -258,8 +377,10 @@ export function BridgeWidget(props: BridgeWidgetProps) {
|
|
|
258
377
|
<CustomThemeProvider theme={props.theme}>
|
|
259
378
|
<EmbedContainer
|
|
260
379
|
modalSize="compact"
|
|
380
|
+
className={props.className}
|
|
261
381
|
style={{
|
|
262
382
|
borderRadius: radius.xl,
|
|
383
|
+
...props.style,
|
|
263
384
|
}}
|
|
264
385
|
>
|
|
265
386
|
<Container
|
|
@@ -294,6 +415,7 @@ export function BridgeWidget(props: BridgeWidgetProps) {
|
|
|
294
415
|
onCancel={props.swap?.onCancel}
|
|
295
416
|
onDisconnect={props.swap?.onDisconnect}
|
|
296
417
|
persistTokenSelections={props.swap?.persistTokenSelections}
|
|
418
|
+
connectOptions={props.connectOptions}
|
|
297
419
|
style={{
|
|
298
420
|
border: "none",
|
|
299
421
|
...props.swap?.style,
|
|
@@ -321,6 +443,7 @@ export function BridgeWidget(props: BridgeWidgetProps) {
|
|
|
321
443
|
presetOptions={props.buy?.presetOptions}
|
|
322
444
|
purchaseData={props.buy?.purchaseData}
|
|
323
445
|
paymentMethods={["card"]}
|
|
446
|
+
connectOptions={props.connectOptions}
|
|
324
447
|
style={{
|
|
325
448
|
border: "none",
|
|
326
449
|
}}
|
|
@@ -345,8 +468,12 @@ function TabButton(props: {
|
|
|
345
468
|
borderRadius: radius.full,
|
|
346
469
|
fontSize: fontSize.sm,
|
|
347
470
|
fontWeight: 500,
|
|
348
|
-
paddingInline: spacing
|
|
349
|
-
paddingBlock:
|
|
471
|
+
paddingInline: spacing.md,
|
|
472
|
+
paddingBlock: 0,
|
|
473
|
+
height: "36px",
|
|
474
|
+
color: props.isActive
|
|
475
|
+
? theme.colors.primaryText
|
|
476
|
+
: theme.colors.secondaryText,
|
|
350
477
|
border: `1px solid ${
|
|
351
478
|
props.isActive ? theme.colors.secondaryText : theme.colors.borderColor
|
|
352
479
|
}`,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
const three3dModelLink =
|
|
18
18
|
"https://i2.seadn.io/matic/0x2953399124f0cbb46d2cbacd8a89cf0599974963/bd1801876c5cf1302484e225c72959/49bd1801876c5cf1302484e225c72959.glb";
|
|
19
19
|
const imageLink =
|
|
20
|
-
"https://
|
|
20
|
+
"https://i2.seadn.io/ethereum/0xbd3531da5cf5857e7cfaa92426877b022e612cf8/750c4805cd12ea19c8c3909677e61988.png?w=350";
|
|
21
21
|
|
|
22
22
|
describe("MediaRenderer", () => {
|
|
23
23
|
it("should render nothing if no src provided", () => {
|
|
@@ -32,7 +32,7 @@ describe("MediaRenderer", () => {
|
|
|
32
32
|
}, 1000);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it("should render a plain image", async () => {
|
|
35
|
+
it.skip("should render a plain image", async () => {
|
|
36
36
|
render(<MediaRenderer client={TEST_CLIENT} src={imageLink} />);
|
|
37
37
|
await waitFor(() => {
|
|
38
38
|
expect(screen.getByRole("img")).toBeInTheDocument();
|
|
@@ -19,16 +19,6 @@ export function BasicUsage() {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function LightTheme() {
|
|
23
|
-
return (
|
|
24
|
-
<Variant
|
|
25
|
-
clientId={storyClient.clientId}
|
|
26
|
-
theme="light"
|
|
27
|
-
buy={{ chainId: 8453, amount: "0.1" }}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
22
|
export function CurrencySet() {
|
|
33
23
|
return (
|
|
34
24
|
<Variant
|
|
@@ -52,20 +42,29 @@ export function NoThirdwebBranding() {
|
|
|
52
42
|
|
|
53
43
|
export function CustomTheme() {
|
|
54
44
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
modalBg: "#FFFFF0",
|
|
62
|
-
tertiaryBg: "#DBE4C9",
|
|
63
|
-
borderColor: "#8AA624",
|
|
64
|
-
secondaryText: "#3E3F29",
|
|
65
|
-
accentText: "#E43636",
|
|
66
|
-
},
|
|
45
|
+
<div
|
|
46
|
+
style={{
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
gap: "40px",
|
|
50
|
+
alignItems: "center",
|
|
67
51
|
}}
|
|
68
|
-
|
|
52
|
+
>
|
|
53
|
+
<BridgeWidgetScript
|
|
54
|
+
clientId={storyClient.clientId}
|
|
55
|
+
buy={{ chainId: 8453, amount: "0.1" }}
|
|
56
|
+
theme={{
|
|
57
|
+
type: "light",
|
|
58
|
+
colors: {
|
|
59
|
+
modalBg: "#FFFFF0",
|
|
60
|
+
tertiaryBg: "#DBE4C9",
|
|
61
|
+
borderColor: "#8AA624",
|
|
62
|
+
secondaryText: "#3E3F29",
|
|
63
|
+
accentText: "#E43636",
|
|
64
|
+
},
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
69
68
|
);
|
|
70
69
|
}
|
|
71
70
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.116.2-nightly-
|
|
1
|
+
export const version = "5.116.2-nightly-7ebc32a0c4e3fa71167255ee5a517143c3ea3a0a-20251217000343";
|