thirdweb 5.35.0 → 5.35.1-nightly-0a5af48f70a76fc060909b853e20c927328c31c3-20240717194138
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/utils.js +9 -0
- package/dist/cjs/chains/utils.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/core/utils/defaultTokens.js +8 -0
- package/dist/cjs/react/core/utils/defaultTokens.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectButton.js +8 -0
- package/dist/cjs/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +2 -2
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +8 -0
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +8 -0
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +9 -7
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +3 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +3 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/PayEmbed.js +9 -1
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +71 -1
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/cjs/wallets/smart/types.js.map +1 -1
- package/dist/esm/chains/utils.js +8 -0
- package/dist/esm/chains/utils.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/core/utils/defaultTokens.js +8 -0
- package/dist/esm/react/core/utils/defaultTokens.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectButton.js +8 -0
- package/dist/esm/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +2 -2
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +9 -7
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/PayEmbed.js +9 -1
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +72 -2
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/esm/wallets/smart/types.js.map +1 -1
- package/dist/types/chains/utils.d.ts +4 -0
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/utils/defaultTokens.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +6 -0
- package/dist/types/react/web/ui/PayEmbed.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/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/types.d.ts +4 -0
- package/dist/types/wallets/smart/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/chains/utils.ts +9 -0
- package/src/react/core/hooks/transaction/useSendTransaction.ts +3 -0
- package/src/react/core/utils/defaultTokens.ts +8 -0
- package/src/react/native/ui/connect/ConnectButton.tsx +10 -0
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +10 -0
- package/src/react/web/ui/ConnectWallet/Details.tsx +1 -0
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +10 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +13 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +4 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +4 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.tsx +1 -0
- package/src/react/web/ui/PayEmbed.tsx +18 -0
- package/src/version.ts +1 -1
- package/src/wallets/smart/index.ts +87 -1
- package/src/wallets/smart/types.ts +4 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/types.ts"],"names":[],"mappings":"AAAA,OA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AAE,OAAO,CAAC;IACnB,cAAc,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,GAAG,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,gBAAgB,EAAE,oBAAoB,wBA2CvC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.35.
|
3
|
+
"version": "5.35.1-nightly-0a5af48f70a76fc060909b853e20c927328c31c3-20240717194138",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -211,7 +211,7 @@
|
|
211
211
|
"@aws-sdk/credential-providers": "^3",
|
212
212
|
"@coinbase/wallet-mobile-sdk": "^1",
|
213
213
|
"@react-native-async-storage/async-storage": "^1",
|
214
|
-
"@react-native-clipboard/clipboard": "
|
214
|
+
"@react-native-clipboard/clipboard": "*",
|
215
215
|
"amazon-cognito-identity-js": "^6",
|
216
216
|
"aws-amplify": "^5",
|
217
217
|
"ethers": "^5 || ^6",
|
package/src/chains/utils.ts
CHANGED
@@ -60,6 +60,15 @@ export function defineChain(
|
|
60
60
|
return chain;
|
61
61
|
}
|
62
62
|
|
63
|
+
/**
|
64
|
+
* @internal
|
65
|
+
*/
|
66
|
+
export function cacheChains(chains: Chain[]) {
|
67
|
+
for (const chain of chains) {
|
68
|
+
CUSTOM_CHAIN_MAP.set(chain.id, chain);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
63
72
|
/**
|
64
73
|
* @internal
|
65
74
|
*/
|
@@ -38,6 +38,9 @@ import type { SupportedTokens } from "../../utils/defaultTokens.js";
|
|
38
38
|
*/
|
39
39
|
export type SendTransactionPayModalConfig =
|
40
40
|
| {
|
41
|
+
metadata?: {
|
42
|
+
title?: string;
|
43
|
+
};
|
41
44
|
locale?: LocaleId;
|
42
45
|
supportedTokens?: SupportedTokens;
|
43
46
|
theme?: Theme | "light" | "dark";
|
@@ -91,6 +91,14 @@ export const defaultTokens: SupportedTokens = {
|
|
91
91
|
icon: maticIcon,
|
92
92
|
},
|
93
93
|
],
|
94
|
+
"11155111": [
|
95
|
+
{
|
96
|
+
address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
97
|
+
name: "USD Coin",
|
98
|
+
symbol: "USDC",
|
99
|
+
icon: usdcIcon,
|
100
|
+
},
|
101
|
+
],
|
94
102
|
"10": [
|
95
103
|
{
|
96
104
|
address: "0x4200000000000000000000000000000000000006",
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
StyleSheet,
|
10
10
|
View,
|
11
11
|
} from "react-native";
|
12
|
+
import { cacheChains } from "../../../../chains/utils.js";
|
12
13
|
import { parseTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
13
14
|
import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
|
14
15
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
@@ -67,6 +68,15 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
67
68
|
]).start();
|
68
69
|
}, []);
|
69
70
|
|
71
|
+
// to update cached chains ASAP, we skip using useEffect - this does not trigger a re-render so it's fine
|
72
|
+
if (props.chains) {
|
73
|
+
cacheChains(props.chains);
|
74
|
+
}
|
75
|
+
|
76
|
+
if (props.chain) {
|
77
|
+
cacheChains([props.chain]);
|
78
|
+
}
|
79
|
+
|
70
80
|
const closeModal = useCallback(() => {
|
71
81
|
Animated.parallel([
|
72
82
|
Animated.timing(fadeAnim.current, {
|
@@ -77,6 +77,7 @@ export function useSendTransaction(config: SendTransactionConfig = {}) {
|
|
77
77
|
: (data) => {
|
78
78
|
setRootEl(
|
79
79
|
<TxModal
|
80
|
+
title={payModal?.metadata?.title || "Buy"}
|
80
81
|
tx={data.tx}
|
81
82
|
onComplete={data.sendTx}
|
82
83
|
onClose={() => {
|
@@ -108,6 +109,7 @@ export function useSendTransaction(config: SendTransactionConfig = {}) {
|
|
108
109
|
}
|
109
110
|
|
110
111
|
type ModalProps = {
|
112
|
+
title: string;
|
111
113
|
onComplete: () => void;
|
112
114
|
onClose: () => void;
|
113
115
|
client: ThirdwebClient;
|
@@ -178,6 +180,7 @@ function ModalContent(props: ModalProps) {
|
|
178
180
|
|
179
181
|
return (
|
180
182
|
<LazyBuyScreen
|
183
|
+
title={props.title}
|
181
184
|
isEmbed={false}
|
182
185
|
client={props.client}
|
183
186
|
onViewPendingTx={() => {
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
import styled from "@emotion/styled";
|
4
4
|
import { useEffect, useMemo, useState } from "react";
|
5
|
+
import { cacheChains } from "../../../../chains/utils.js";
|
5
6
|
import { iconSize } from "../../../core/design-system/index.js";
|
6
7
|
import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
|
7
8
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
@@ -63,6 +64,15 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
63
64
|
client: props.client,
|
64
65
|
});
|
65
66
|
|
67
|
+
// to update cached chains ASAP, we skip using useEffect - this does not trigger a re-render so it's fine
|
68
|
+
if (props.chains) {
|
69
|
+
cacheChains(props.chains);
|
70
|
+
}
|
71
|
+
|
72
|
+
if (props.chain) {
|
73
|
+
cacheChains([props.chain]);
|
74
|
+
}
|
75
|
+
|
66
76
|
const size = useMemo(() => {
|
67
77
|
return !canFitWideModal() || wallets.length === 1
|
68
78
|
? "compact"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use client";
|
2
2
|
import { useEffect, useMemo } from "react";
|
3
3
|
import type { Chain } from "../../../../../chains/types.js";
|
4
|
+
import { cacheChains } from "../../../../../chains/utils.js";
|
4
5
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
5
6
|
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
|
6
7
|
import type { SmartWalletOptions } from "../../../../../wallets/smart/types.js";
|
@@ -62,6 +63,15 @@ export function ConnectEmbed(props: ConnectEmbedProps) {
|
|
62
63
|
const show =
|
63
64
|
!activeAccount || (siweAuth.requiresAuth && !siweAuth.isLoggedIn);
|
64
65
|
|
66
|
+
// to update cached chains ASAP, we skip using useEffect - this does not trigger a re-render so it's fine
|
67
|
+
if (props.chains) {
|
68
|
+
cacheChains(props.chains);
|
69
|
+
}
|
70
|
+
|
71
|
+
if (props.chain) {
|
72
|
+
cacheChains([props.chain]);
|
73
|
+
}
|
74
|
+
|
65
75
|
const wallets = useMemo(
|
66
76
|
() =>
|
67
77
|
props.wallets ||
|
@@ -77,6 +77,7 @@ import type { PayerInfo } from "./types.js";
|
|
77
77
|
import { usePayerSetup } from "./usePayerSetup.js";
|
78
78
|
|
79
79
|
export type BuyScreenProps = {
|
80
|
+
title: string;
|
80
81
|
onBack: (() => void) | undefined;
|
81
82
|
supportedTokens: SupportedTokens | undefined;
|
82
83
|
onViewPendingTx: () => void;
|
@@ -111,6 +112,7 @@ export default function BuyScreen(props: BuyScreenProps) {
|
|
111
112
|
}
|
112
113
|
|
113
114
|
type BuyScreenContentProps = {
|
115
|
+
title: string;
|
114
116
|
client: ThirdwebClient;
|
115
117
|
onBack?: () => void;
|
116
118
|
supportedTokens?: SupportedTokens;
|
@@ -228,6 +230,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
228
230
|
if (screen.id === "swap-flow" && payer) {
|
229
231
|
return (
|
230
232
|
<SwapFlow
|
233
|
+
title={props.title}
|
231
234
|
isBuyForTx={!!props.buyForTx}
|
232
235
|
isEmbed={props.isEmbed}
|
233
236
|
client={client}
|
@@ -253,6 +256,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
253
256
|
if (screen.id === "fiat-flow" && payer) {
|
254
257
|
return (
|
255
258
|
<FiatFlow
|
259
|
+
title={props.title}
|
256
260
|
isBuyForTx={!!props.buyForTx}
|
257
261
|
quote={screen.quote}
|
258
262
|
onBack={() => {
|
@@ -329,7 +333,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
329
333
|
}
|
330
334
|
connectLocale={connectLocale}
|
331
335
|
client={client}
|
332
|
-
modalTitle=
|
336
|
+
modalTitle={props.title}
|
333
337
|
/>
|
334
338
|
);
|
335
339
|
}
|
@@ -391,6 +395,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
391
395
|
<div>
|
392
396
|
{screen.id === "main" && (
|
393
397
|
<MainScreen
|
398
|
+
title={props.title}
|
394
399
|
payerAccount={payer?.account}
|
395
400
|
buyForTx={buyForTx}
|
396
401
|
client={client}
|
@@ -418,6 +423,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
418
423
|
screen.id === "buy-with-fiat") &&
|
419
424
|
payer && (
|
420
425
|
<TokenSelectedLayout
|
426
|
+
title={props.title}
|
421
427
|
selectedChain={toChain}
|
422
428
|
selectedToken={toToken}
|
423
429
|
tokenAmount={tokenAmount}
|
@@ -547,6 +553,7 @@ function SelectedTokenInfo(props: {
|
|
547
553
|
}
|
548
554
|
|
549
555
|
function MainScreen(props: {
|
556
|
+
title: string;
|
550
557
|
buyForTx: BuyForTx | undefined;
|
551
558
|
client: ThirdwebClient;
|
552
559
|
setTokenAmount: (amount: string) => void;
|
@@ -598,7 +605,9 @@ function MainScreen(props: {
|
|
598
605
|
<Container p="lg">
|
599
606
|
<ModalHeader
|
600
607
|
title={
|
601
|
-
props.buyForTx
|
608
|
+
props.buyForTx
|
609
|
+
? `Not enough ${props.buyForTx.tokenSymbol}`
|
610
|
+
: props.title
|
602
611
|
}
|
603
612
|
onBack={props.onBack}
|
604
613
|
/>
|
@@ -697,6 +706,7 @@ function MainScreen(props: {
|
|
697
706
|
}
|
698
707
|
|
699
708
|
function TokenSelectedLayout(props: {
|
709
|
+
title: string;
|
700
710
|
children: React.ReactNode;
|
701
711
|
tokenAmount: string;
|
702
712
|
selectedToken: ERC20OrNativeToken;
|
@@ -707,7 +717,7 @@ function TokenSelectedLayout(props: {
|
|
707
717
|
return (
|
708
718
|
<Container>
|
709
719
|
<Container p="lg">
|
710
|
-
<ModalHeader title={
|
720
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
711
721
|
</Container>
|
712
722
|
|
713
723
|
<Container
|
@@ -37,6 +37,7 @@ type Screen =
|
|
37
37
|
};
|
38
38
|
|
39
39
|
export function FiatFlow(props: {
|
40
|
+
title: string;
|
40
41
|
quote: BuyWithFiatQuote;
|
41
42
|
onBack: () => void;
|
42
43
|
client: ThirdwebClient;
|
@@ -67,6 +68,7 @@ export function FiatFlow(props: {
|
|
67
68
|
if (screen.id === "step-1") {
|
68
69
|
return (
|
69
70
|
<FiatSteps
|
71
|
+
title={props.title}
|
70
72
|
client={props.client}
|
71
73
|
onBack={props.onBack}
|
72
74
|
partialQuote={fiatQuoteToPartialQuote(props.quote)}
|
@@ -87,6 +89,7 @@ export function FiatFlow(props: {
|
|
87
89
|
if (screen.id === "onramp-status") {
|
88
90
|
return (
|
89
91
|
<OnrampStatusScreen
|
92
|
+
title={props.title}
|
90
93
|
client={props.client}
|
91
94
|
intentId={props.quote.intentId}
|
92
95
|
onBack={props.onBack}
|
@@ -107,6 +110,7 @@ export function FiatFlow(props: {
|
|
107
110
|
if (screen.id === "postonramp-swap") {
|
108
111
|
return (
|
109
112
|
<PostOnRampSwapFlow
|
113
|
+
title={props.title}
|
110
114
|
status={screen.data}
|
111
115
|
quote={fiatQuoteToPartialQuote(props.quote)}
|
112
116
|
client={props.client}
|
@@ -30,6 +30,7 @@ type UIStatus = "loading" | "failed" | "completed" | "partialSuccess";
|
|
30
30
|
* - call `onShowSwapFlow` if on-ramp is completed and swap is required
|
31
31
|
*/
|
32
32
|
export function OnrampStatusScreen(props: {
|
33
|
+
title: string;
|
33
34
|
client: ThirdwebClient;
|
34
35
|
onBack: () => void;
|
35
36
|
intentId: string;
|
@@ -97,7 +98,7 @@ export function OnrampStatusScreen(props: {
|
|
97
98
|
|
98
99
|
return (
|
99
100
|
<Container p="lg">
|
100
|
-
<ModalHeader title=
|
101
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
101
102
|
|
102
103
|
{props.hasTwoSteps && (
|
103
104
|
<>
|
@@ -83,6 +83,7 @@ export function fiatQuoteToPartialQuote(
|
|
83
83
|
}
|
84
84
|
|
85
85
|
export function FiatSteps(props: {
|
86
|
+
title: string;
|
86
87
|
partialQuote: BuyWithFiatPartialQuote;
|
87
88
|
status?: BuyWithFiatStatus;
|
88
89
|
onBack: () => void;
|
@@ -308,7 +309,7 @@ export function FiatSteps(props: {
|
|
308
309
|
|
309
310
|
return (
|
310
311
|
<Container p="lg">
|
311
|
-
<ModalHeader title=
|
312
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
312
313
|
<Spacer y="lg" />
|
313
314
|
|
314
315
|
{/* Step 1 */}
|
@@ -15,6 +15,7 @@ import { SwapFlow } from "../swap/SwapFlow.js";
|
|
15
15
|
import type { PayerInfo } from "../types.js";
|
16
16
|
|
17
17
|
export function PostOnRampSwap(props: {
|
18
|
+
title: string;
|
18
19
|
client: ThirdwebClient;
|
19
20
|
buyWithFiatStatus: BuyWithFiatStatus;
|
20
21
|
onBack?: () => void;
|
@@ -59,7 +60,7 @@ export function PostOnRampSwap(props: {
|
|
59
60
|
return (
|
60
61
|
<Container fullHeight>
|
61
62
|
<Container p="lg">
|
62
|
-
<ModalHeader title=
|
63
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
63
64
|
</Container>
|
64
65
|
|
65
66
|
<Container
|
@@ -95,7 +96,7 @@ export function PostOnRampSwap(props: {
|
|
95
96
|
return (
|
96
97
|
<Container fullHeight>
|
97
98
|
<Container p="lg">
|
98
|
-
<ModalHeader title=
|
99
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
99
100
|
</Container>
|
100
101
|
|
101
102
|
<Container
|
@@ -117,6 +118,7 @@ export function PostOnRampSwap(props: {
|
|
117
118
|
|
118
119
|
return (
|
119
120
|
<SwapFlow
|
121
|
+
title={props.title}
|
120
122
|
payer={props.payer}
|
121
123
|
buyWithCryptoQuote={lockedOnRampQuote}
|
122
124
|
client={props.client}
|
@@ -12,6 +12,7 @@ import { PostOnRampSwap } from "./PostOnRampSwap.js";
|
|
12
12
|
* - Show swap flow
|
13
13
|
*/
|
14
14
|
export function PostOnRampSwapFlow(props: {
|
15
|
+
title: string;
|
15
16
|
status: BuyWithFiatStatus;
|
16
17
|
quote: BuyWithFiatPartialQuote;
|
17
18
|
client: ThirdwebClient;
|
@@ -31,6 +32,7 @@ export function PostOnRampSwapFlow(props: {
|
|
31
32
|
if (statusForSwap) {
|
32
33
|
return (
|
33
34
|
<PostOnRampSwap
|
35
|
+
title={props.title}
|
34
36
|
buyWithFiatStatus={statusForSwap}
|
35
37
|
client={props.client}
|
36
38
|
onViewPendingTx={props.onViewPendingTx}
|
@@ -45,6 +47,7 @@ export function PostOnRampSwapFlow(props: {
|
|
45
47
|
// show step 1 and step 2 details
|
46
48
|
return (
|
47
49
|
<FiatSteps
|
50
|
+
title={props.title}
|
48
51
|
client={props.client}
|
49
52
|
onBack={props.onBack}
|
50
53
|
partialQuote={props.quote}
|
@@ -34,6 +34,7 @@ import { addPendingTx } from "./pendingSwapTx.js";
|
|
34
34
|
* @internal
|
35
35
|
*/
|
36
36
|
export function SwapConfirmationScreen(props: {
|
37
|
+
title: string;
|
37
38
|
onBack?: () => void;
|
38
39
|
client: ThirdwebClient;
|
39
40
|
quote: BuyWithCryptoQuote;
|
@@ -63,7 +64,7 @@ export function SwapConfirmationScreen(props: {
|
|
63
64
|
|
64
65
|
return (
|
65
66
|
<Container p="lg">
|
66
|
-
<ModalHeader title=
|
67
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
67
68
|
|
68
69
|
{props.isFiatFlow ? (
|
69
70
|
<>
|
@@ -10,6 +10,7 @@ import { SwapConfirmationScreen } from "./ConfirmationScreen.js";
|
|
10
10
|
import { SwapStatusScreen } from "./SwapStatusScreen.js";
|
11
11
|
|
12
12
|
type SwapFlowProps = {
|
13
|
+
title: string;
|
13
14
|
onBack?: () => void;
|
14
15
|
buyWithCryptoQuote: BuyWithCryptoQuote;
|
15
16
|
payer: PayerInfo;
|
@@ -75,6 +76,7 @@ export function SwapFlow(props: SwapFlowProps) {
|
|
75
76
|
if (swapTxHash) {
|
76
77
|
return (
|
77
78
|
<SwapStatusScreen
|
79
|
+
title={props.title}
|
78
80
|
onBack={props.onBack}
|
79
81
|
onTryAgain={props.onTryAgain}
|
80
82
|
onViewPendingTx={props.onViewPendingTx}
|
@@ -90,6 +92,7 @@ export function SwapFlow(props: SwapFlowProps) {
|
|
90
92
|
|
91
93
|
return (
|
92
94
|
<SwapConfirmationScreen
|
95
|
+
title={props.title}
|
93
96
|
setSwapTxHash={setSwapTxHash}
|
94
97
|
toChain={toChain}
|
95
98
|
toAmount={toAmount}
|
@@ -17,6 +17,7 @@ import { SwapTxDetailsTable } from "../tx-history/SwapDetailsScreen.js";
|
|
17
17
|
type UIStatus = "pending" | "success" | "failed" | "partialSuccess";
|
18
18
|
|
19
19
|
export function SwapStatusScreen(props: {
|
20
|
+
title: string;
|
20
21
|
onBack?: () => void;
|
21
22
|
onViewPendingTx: () => void;
|
22
23
|
swapTxHash: string;
|
@@ -77,7 +78,7 @@ export function SwapStatusScreen(props: {
|
|
77
78
|
return (
|
78
79
|
<Container animate="fadein">
|
79
80
|
<Container p="lg">
|
80
|
-
<ModalHeader title=
|
81
|
+
<ModalHeader title={props.title} onBack={props.onBack} />
|
81
82
|
<Spacer y="sm" />
|
82
83
|
|
83
84
|
{uiStatus === "success" && (
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
import { useState } from "react";
|
4
4
|
import type { Chain } from "../../../chains/types.js";
|
5
|
+
import { cacheChains } from "../../../chains/utils.js";
|
5
6
|
import type { ThirdwebClient } from "../../../client/client.js";
|
6
7
|
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
|
7
8
|
import type { SmartWalletOptions } from "../../../wallets/smart/types.js";
|
@@ -124,6 +125,13 @@ export type PayEmbedProps = {
|
|
124
125
|
*/
|
125
126
|
connectOptions?: PayEmbedConnectOptions;
|
126
127
|
|
128
|
+
/**
|
129
|
+
* Customize the display of the PayEmbed UI.
|
130
|
+
*/
|
131
|
+
metadata?: {
|
132
|
+
title?: string;
|
133
|
+
};
|
134
|
+
|
127
135
|
style?: React.CSSProperties;
|
128
136
|
};
|
129
137
|
|
@@ -154,6 +162,15 @@ export function PayEmbed(props: PayEmbedProps) {
|
|
154
162
|
const [screen, setScreen] = useState<"buy" | "tx-history">("buy");
|
155
163
|
const theme = props.theme || "dark";
|
156
164
|
|
165
|
+
// to update cached chains ASAP, we skip using useEffect - this does not trigger a re-render so it's fine
|
166
|
+
if (props.connectOptions?.chains) {
|
167
|
+
cacheChains(props.connectOptions?.chains);
|
168
|
+
}
|
169
|
+
|
170
|
+
if (props.connectOptions?.chain) {
|
171
|
+
cacheChains([props.connectOptions?.chain]);
|
172
|
+
}
|
173
|
+
|
157
174
|
let content = null;
|
158
175
|
|
159
176
|
if (!localeQuery.data) {
|
@@ -175,6 +192,7 @@ export function PayEmbed(props: PayEmbedProps) {
|
|
175
192
|
<>
|
176
193
|
<div style={{ display: screen === "tx-history" ? "none" : "inherit" }}>
|
177
194
|
<BuyScreen
|
195
|
+
title={props.metadata?.title || "Buy"}
|
178
196
|
isEmbed={true}
|
179
197
|
supportedTokens={props.supportedTokens}
|
180
198
|
theme={theme}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.35.
|
1
|
+
export const version = "5.35.1-nightly-0a5af48f70a76fc060909b853e20c927328c31c3-20240717194138";
|
@@ -4,10 +4,14 @@ import {
|
|
4
4
|
type TypedDataDefinition,
|
5
5
|
type TypedDataDomain,
|
6
6
|
hashTypedData,
|
7
|
+
maxUint96,
|
7
8
|
} from "viem";
|
8
9
|
import type { Chain } from "../../chains/types.js";
|
9
10
|
import { getCachedChain } from "../../chains/utils.js";
|
10
11
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
12
|
+
import { allowance } from "../../extensions/erc20/__generated__/IERC20/read/allowance.js";
|
13
|
+
import { approve } from "../../extensions/erc20/write/approve.js";
|
14
|
+
import { toSerializableTransaction } from "../../transaction/actions/to-serializable-transaction.js";
|
11
15
|
import type { WaitForReceiptOptions } from "../../transaction/actions/wait-for-tx-receipt.js";
|
12
16
|
import {
|
13
17
|
populateEip712Transaction,
|
@@ -15,6 +19,8 @@ import {
|
|
15
19
|
} from "../../transaction/actions/zksync/send-eip712-transaction.js";
|
16
20
|
import type { PreparedTransaction } from "../../transaction/prepare-transaction.js";
|
17
21
|
import { getAddress } from "../../utils/address.js";
|
22
|
+
import { concatHex } from "../../utils/encoding/helpers/concat-hex.js";
|
23
|
+
import type { Hex } from "../../utils/encoding/hex.js";
|
18
24
|
import { parseTypedData } from "../../utils/signatures/helpers/parseTypedData.js";
|
19
25
|
import type {
|
20
26
|
Account,
|
@@ -44,9 +50,11 @@ import {
|
|
44
50
|
} from "./lib/userop.js";
|
45
51
|
import { isNativeAAChain } from "./lib/utils.js";
|
46
52
|
import type {
|
53
|
+
PaymasterResult,
|
47
54
|
SmartAccountOptions,
|
48
55
|
SmartWalletConnectionOptions,
|
49
56
|
SmartWalletOptions,
|
57
|
+
UserOperation,
|
50
58
|
} from "./types.js";
|
51
59
|
|
52
60
|
/**
|
@@ -170,6 +178,27 @@ async function createSmartAccount(
|
|
170
178
|
const account: Account = {
|
171
179
|
address: getAddress(accountContract.address),
|
172
180
|
async sendTransaction(transaction: SendTransactionOption) {
|
181
|
+
// if erc20 paymaster - check allowance and approve if needed
|
182
|
+
const erc20Paymaster = options.overrides?.erc20Paymaster;
|
183
|
+
let paymasterOverride:
|
184
|
+
| undefined
|
185
|
+
| ((userOp: UserOperation) => Promise<PaymasterResult>) = undefined;
|
186
|
+
if (erc20Paymaster) {
|
187
|
+
await approveERC20({
|
188
|
+
accountContract,
|
189
|
+
erc20Paymaster,
|
190
|
+
options,
|
191
|
+
});
|
192
|
+
const paymasterCallback = async (): Promise<PaymasterResult> => {
|
193
|
+
return {
|
194
|
+
paymasterAndData: concatHex([
|
195
|
+
erc20Paymaster.address as Hex,
|
196
|
+
erc20Paymaster?.token as Hex,
|
197
|
+
]),
|
198
|
+
};
|
199
|
+
};
|
200
|
+
paymasterOverride = options.overrides?.paymaster || paymasterCallback;
|
201
|
+
}
|
173
202
|
const executeTx = prepareExecute({
|
174
203
|
accountContract,
|
175
204
|
transaction,
|
@@ -177,7 +206,13 @@ async function createSmartAccount(
|
|
177
206
|
});
|
178
207
|
return _sendUserOp({
|
179
208
|
executeTx,
|
180
|
-
options
|
209
|
+
options: {
|
210
|
+
...options,
|
211
|
+
overrides: {
|
212
|
+
...options.overrides,
|
213
|
+
paymaster: paymasterOverride,
|
214
|
+
},
|
215
|
+
},
|
181
216
|
});
|
182
217
|
},
|
183
218
|
async sendBatchTransaction(transactions: SendTransactionOption[]) {
|
@@ -362,6 +397,57 @@ async function createSmartAccount(
|
|
362
397
|
return account;
|
363
398
|
}
|
364
399
|
|
400
|
+
async function approveERC20(args: {
|
401
|
+
accountContract: ThirdwebContract;
|
402
|
+
options: SmartAccountOptions;
|
403
|
+
erc20Paymaster: {
|
404
|
+
address: string;
|
405
|
+
token: string;
|
406
|
+
};
|
407
|
+
}) {
|
408
|
+
const { accountContract, erc20Paymaster, options } = args;
|
409
|
+
const tokenAddress = erc20Paymaster.token;
|
410
|
+
const tokenContract = getContract({
|
411
|
+
address: tokenAddress,
|
412
|
+
chain: accountContract.chain,
|
413
|
+
client: accountContract.client,
|
414
|
+
});
|
415
|
+
const accountAllowance = await allowance({
|
416
|
+
contract: tokenContract,
|
417
|
+
owner: accountContract.address,
|
418
|
+
spender: erc20Paymaster.address,
|
419
|
+
});
|
420
|
+
|
421
|
+
if (accountAllowance > 0n) {
|
422
|
+
return;
|
423
|
+
}
|
424
|
+
|
425
|
+
const approveTx = approve({
|
426
|
+
contract: tokenContract,
|
427
|
+
spender: erc20Paymaster.address,
|
428
|
+
amountWei: maxUint96 - 1n,
|
429
|
+
});
|
430
|
+
const transaction = await toSerializableTransaction({
|
431
|
+
transaction: approveTx,
|
432
|
+
from: accountContract.address,
|
433
|
+
});
|
434
|
+
const executeTx = prepareExecute({
|
435
|
+
accountContract,
|
436
|
+
transaction,
|
437
|
+
executeOverride: options.overrides?.execute,
|
438
|
+
});
|
439
|
+
await _sendUserOp({
|
440
|
+
executeTx,
|
441
|
+
options: {
|
442
|
+
...options,
|
443
|
+
overrides: {
|
444
|
+
...options.overrides,
|
445
|
+
erc20Paymaster: undefined,
|
446
|
+
},
|
447
|
+
},
|
448
|
+
});
|
449
|
+
}
|
450
|
+
|
365
451
|
function createZkSyncAccount(args: {
|
366
452
|
creationOptions: SmartWalletOptions;
|
367
453
|
connectionOptions: SmartWalletConnectionOptions;
|
@@ -17,6 +17,10 @@ export type SmartWalletOptions = Prettify<
|
|
17
17
|
accountAddress?: string;
|
18
18
|
accountSalt?: string;
|
19
19
|
entrypointAddress?: string;
|
20
|
+
erc20Paymaster?: {
|
21
|
+
address: string;
|
22
|
+
token: string;
|
23
|
+
};
|
20
24
|
paymaster?: (userOp: UserOperation) => Promise<PaymasterResult>;
|
21
25
|
predictAddress?: (factoryContract: ThirdwebContract) => Promise<string>;
|
22
26
|
createAccount?: (
|