thirdweb 5.108.1 → 5.108.2
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/bridge/Buy.js +2 -2
- package/dist/cjs/bridge/Chains.js +1 -1
- package/dist/cjs/bridge/Routes.js +1 -1
- package/dist/cjs/bridge/Sell.js +2 -2
- package/dist/cjs/bridge/Status.js +1 -1
- package/dist/cjs/bridge/Token.js +3 -3
- package/dist/cjs/bridge/Transfer.js +1 -1
- package/dist/cjs/bridge/Webhook.js +1 -1
- package/dist/cjs/exports/react.js +3 -1
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/thirdweb.js +1 -1
- package/dist/cjs/react/core/hooks/useStepExecutor.js +1 -21
- package/dist/cjs/react/core/hooks/useStepExecutor.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +5 -6
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/StepRunner.js +2 -2
- package/dist/cjs/react/web/ui/Bridge/StepRunner.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +1 -0
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js +95 -0
- package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js +1 -0
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/SwapWidget.js +13 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/SwapWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/select-chain.js +12 -1
- 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 +13 -4
- package/dist/cjs/react/web/ui/Bridge/swap-widget/select-token-ui.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/swap-widget/swap-ui.js +6 -10
- package/dist/cjs/react/web/ui/Bridge/swap-widget/swap-ui.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/script-exports/bridge-widget-script.js +17 -0
- package/dist/cjs/script-exports/bridge-widget-script.js.map +1 -0
- package/dist/cjs/script-exports/bridge-widget.js +13 -0
- package/dist/cjs/script-exports/bridge-widget.js.map +1 -0
- package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js +30 -1
- package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js +47 -0
- package/dist/cjs/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js.map +1 -0
- package/dist/cjs/stories/Bridge/StepRunner.stories.js +1 -21
- package/dist/cjs/stories/Bridge/StepRunner.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js +4 -4
- package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -1
- package/dist/cjs/utils/units.js +3 -0
- package/dist/cjs/utils/units.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/x402/common.js +41 -41
- package/dist/cjs/x402/common.js.map +1 -1
- package/dist/cjs/x402/facilitator.js +1 -0
- package/dist/cjs/x402/facilitator.js.map +1 -1
- package/dist/cjs/x402/fetchWithPayment.js +1 -1
- package/dist/cjs/x402/fetchWithPayment.js.map +1 -1
- package/dist/cjs/x402/schemas.js +3 -0
- package/dist/cjs/x402/schemas.js.map +1 -1
- package/dist/cjs/x402/settle-payment.js +4 -3
- package/dist/cjs/x402/settle-payment.js.map +1 -1
- package/dist/cjs/x402/types.js.map +1 -1
- package/dist/cjs/x402/verify-payment.js +2 -1
- package/dist/cjs/x402/verify-payment.js.map +1 -1
- package/dist/esm/bridge/Buy.js +2 -2
- package/dist/esm/bridge/Chains.js +1 -1
- package/dist/esm/bridge/Routes.js +1 -1
- package/dist/esm/bridge/Sell.js +2 -2
- package/dist/esm/bridge/Status.js +1 -1
- package/dist/esm/bridge/Token.js +3 -3
- package/dist/esm/bridge/Transfer.js +1 -1
- package/dist/esm/bridge/Webhook.js +1 -1
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/thirdweb.js +1 -1
- package/dist/esm/react/core/hooks/useStepExecutor.js +1 -21
- package/dist/esm/react/core/hooks/useStepExecutor.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +5 -6
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/StepRunner.js +2 -2
- package/dist/esm/react/web/ui/Bridge/StepRunner.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +1 -0
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js +92 -0
- package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js +1 -0
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/SwapWidget.js +13 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/SwapWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/select-chain.js +13 -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 +13 -4
- package/dist/esm/react/web/ui/Bridge/swap-widget/select-token-ui.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/swap-widget/swap-ui.js +6 -10
- package/dist/esm/react/web/ui/Bridge/swap-widget/swap-ui.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/script-exports/bridge-widget-script.js +14 -0
- package/dist/esm/script-exports/bridge-widget-script.js.map +1 -0
- package/dist/esm/script-exports/bridge-widget.js +10 -0
- package/dist/esm/script-exports/bridge-widget.js.map +1 -0
- package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js +29 -0
- package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js +40 -0
- package/dist/esm/stories/Bridge/BridgeWidget/bridge-widget-script.stories.js.map +1 -0
- package/dist/esm/stories/Bridge/StepRunner.stories.js +2 -22
- package/dist/esm/stories/Bridge/StepRunner.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js +4 -4
- package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -1
- package/dist/esm/utils/units.js +3 -0
- package/dist/esm/utils/units.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/x402/common.js +42 -42
- package/dist/esm/x402/common.js.map +1 -1
- package/dist/esm/x402/facilitator.js +1 -0
- package/dist/esm/x402/facilitator.js.map +1 -1
- package/dist/esm/x402/fetchWithPayment.js +1 -1
- package/dist/esm/x402/fetchWithPayment.js.map +1 -1
- package/dist/esm/x402/schemas.js +3 -0
- package/dist/esm/x402/schemas.js.map +1 -1
- package/dist/esm/x402/settle-payment.js +4 -3
- package/dist/esm/x402/settle-payment.js.map +1 -1
- package/dist/esm/x402/types.js.map +1 -1
- package/dist/esm/x402/verify-payment.js +2 -1
- package/dist/esm/x402/verify-payment.js.map +1 -1
- package/dist/scripts/bridge-widget.d.ts +1118 -0
- package/dist/scripts/bridge-widget.js +532 -0
- package/dist/types/bridge/Buy.d.ts +2 -2
- package/dist/types/bridge/Chains.d.ts +1 -1
- package/dist/types/bridge/Routes.d.ts +1 -1
- package/dist/types/bridge/Sell.d.ts +2 -2
- package/dist/types/bridge/Status.d.ts +1 -1
- package/dist/types/bridge/Token.d.ts +3 -3
- package/dist/types/bridge/Transfer.d.ts +1 -1
- package/dist/types/bridge/Webhook.d.ts +1 -1
- package/dist/types/bridge/types/Chain.d.ts +1 -1
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/thirdweb.d.ts +1 -1
- package/dist/types/react/core/hooks/useStepExecutor.d.ts +3 -4
- package/dist/types/react/core/hooks/useStepExecutor.d.ts.map +1 -1
- package/dist/types/react/core/hooks/useTransactionDetails.d.ts +1 -1
- package/dist/types/react/core/hooks/useTransactionDetails.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +1 -1
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/StepRunner.d.ts +6 -2
- package/dist/types/react/web/ui/Bridge/StepRunner.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts +218 -0
- package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/swap-widget/SwapWidget.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 +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/Bridge/swap-widget/swap-ui.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/script-exports/bridge-widget-script.d.ts +49 -0
- package/dist/types/script-exports/bridge-widget-script.d.ts.map +1 -0
- package/dist/types/script-exports/bridge-widget.d.ts +4 -0
- package/dist/types/script-exports/bridge-widget.d.ts.map +1 -0
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts +4 -0
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/BridgeWidget/bridge-widget-script.stories.d.ts +10 -0
- package/dist/types/stories/Bridge/BridgeWidget/bridge-widget-script.stories.d.ts.map +1 -0
- package/dist/types/stories/Bridge/StepRunner.stories.d.ts +0 -6
- package/dist/types/stories/Bridge/StepRunner.stories.d.ts.map +1 -1
- package/dist/types/utils/domains.d.ts +1 -1
- package/dist/types/utils/units.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/x402/common.d.ts.map +1 -1
- package/dist/types/x402/facilitator.d.ts +1 -0
- package/dist/types/x402/facilitator.d.ts.map +1 -1
- package/dist/types/x402/fetchWithPayment.d.ts.map +1 -1
- package/dist/types/x402/schemas.d.ts +2 -1
- package/dist/types/x402/schemas.d.ts.map +1 -1
- package/dist/types/x402/settle-payment.d.ts +4 -2
- package/dist/types/x402/settle-payment.d.ts.map +1 -1
- package/dist/types/x402/types.d.ts +2 -1
- package/dist/types/x402/types.d.ts.map +1 -1
- package/dist/types/x402/verify-payment.d.ts +2 -1
- package/dist/types/x402/verify-payment.d.ts.map +1 -1
- package/package.json +7 -4
- package/src/bridge/Buy.ts +2 -2
- package/src/bridge/Chains.ts +1 -1
- package/src/bridge/Routes.ts +1 -1
- package/src/bridge/Sell.ts +2 -2
- package/src/bridge/Status.ts +1 -1
- package/src/bridge/Token.ts +3 -3
- package/src/bridge/Transfer.ts +1 -1
- package/src/bridge/Webhook.ts +1 -1
- package/src/bridge/types/Chain.ts +1 -1
- package/src/exports/react.ts +4 -0
- package/src/exports/thirdweb.ts +1 -1
- package/src/react/core/hooks/useStepExecutor.ts +5 -30
- package/src/react/core/hooks/useTransactionDetails.ts +1 -1
- package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +6 -9
- package/src/react/web/ui/Bridge/BuyWidget.tsx +1 -1
- package/src/react/web/ui/Bridge/StepRunner.tsx +11 -2
- package/src/react/web/ui/Bridge/TransactionPayment.tsx +1 -0
- package/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx +344 -0
- package/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx +1 -0
- package/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx +14 -0
- package/src/react/web/ui/Bridge/swap-widget/select-chain.tsx +17 -2
- package/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx +14 -5
- package/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx +6 -14
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +3 -1
- package/src/script-exports/bridge-widget-script.tsx +72 -0
- package/src/script-exports/bridge-widget.tsx +17 -0
- package/src/script-exports/readme.md +72 -0
- package/src/stories/Bridge/BridgeOrchestrator.stories.tsx +31 -0
- package/src/stories/Bridge/BridgeWidget/bridge-widget-script.stories.tsx +79 -0
- package/src/stories/Bridge/StepRunner.stories.tsx +6 -23
- package/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx +4 -4
- package/src/utils/domains.ts +1 -1
- package/src/utils/units.test.ts +13 -0
- package/src/utils/units.ts +4 -0
- package/src/version.ts +1 -1
- package/src/wallets/eip5792/send-calls.ts +1 -1
- package/src/wallets/smart/smart-wallet-modular.test.ts +1 -1
- package/src/x402/common.ts +46 -52
- package/src/x402/facilitator.ts +1 -0
- package/src/x402/fetchWithPayment.ts +3 -1
- package/src/x402/schemas.ts +5 -1
- package/src/x402/settle-payment.ts +4 -3
- package/src/x402/types.ts +2 -1
- package/src/x402/verify-payment.ts +2 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SupportedFiatCurrency } from "../pay/convert/type.js";
|
|
2
|
+
import type { PurchaseData } from "../pay/types.js";
|
|
3
|
+
import { type ThemeOverrides } from "../react/core/design-system/index.js";
|
|
4
|
+
import type { BuyOrOnrampPrepareResult } from "../react/web/ui/Bridge/BuyWidget.js";
|
|
5
|
+
import type { SwapPreparedQuote } from "../react/web/ui/Bridge/swap-widget/types.js";
|
|
6
|
+
export type BridgeWidgetScriptProps = {
|
|
7
|
+
clientId: string;
|
|
8
|
+
theme?: "light" | "dark" | ({
|
|
9
|
+
type: "light" | "dark";
|
|
10
|
+
} & ThemeOverrides);
|
|
11
|
+
showThirdwebBranding?: boolean;
|
|
12
|
+
currency?: SupportedFiatCurrency;
|
|
13
|
+
swap?: {
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
onSuccess?: (quote: SwapPreparedQuote) => void;
|
|
17
|
+
onError?: (error: Error, quote: SwapPreparedQuote) => void;
|
|
18
|
+
onCancel?: (quote: SwapPreparedQuote) => void;
|
|
19
|
+
onDisconnect?: () => void;
|
|
20
|
+
persistTokenSelections?: boolean;
|
|
21
|
+
prefill?: {
|
|
22
|
+
buyToken?: {
|
|
23
|
+
tokenAddress?: string;
|
|
24
|
+
chainId: number;
|
|
25
|
+
amount?: string;
|
|
26
|
+
};
|
|
27
|
+
sellToken?: {
|
|
28
|
+
tokenAddress?: string;
|
|
29
|
+
chainId: number;
|
|
30
|
+
amount?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
buy: {
|
|
35
|
+
amount: string;
|
|
36
|
+
chainId: number;
|
|
37
|
+
tokenAddress?: string;
|
|
38
|
+
buttonLabel?: string;
|
|
39
|
+
onCancel?: (quote: BuyOrOnrampPrepareResult | undefined) => void;
|
|
40
|
+
onError?: (error: Error, quote: BuyOrOnrampPrepareResult | undefined) => void;
|
|
41
|
+
onSuccess?: (quote: BuyOrOnrampPrepareResult) => void;
|
|
42
|
+
className?: string;
|
|
43
|
+
country?: string;
|
|
44
|
+
presetOptions?: [number, number, number];
|
|
45
|
+
purchaseData?: PurchaseData;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare function BridgeWidgetScript(props: BridgeWidgetScriptProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
//# sourceMappingURL=bridge-widget-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-widget-script.d.ts","sourceRoot":"","sources":["../../../src/script-exports/bridge-widget-script.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAMrF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,CAAC;QAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,GAAG,cAAc,CAAC,CAAC;IACzE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC5B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;QAC/C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;QAC3D,QAAQ,CA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"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAC;AAKnC,wBAAgB,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,uBAAuB,QAMxE"}
|
|
@@ -89,5 +89,9 @@ export declare const Transaction: Story;
|
|
|
89
89
|
* Transaction mode in light theme showing an ERC20 token transfer.
|
|
90
90
|
*/
|
|
91
91
|
export declare const TransactionLight: Story;
|
|
92
|
+
/**
|
|
93
|
+
* Transaction mode in light theme showing an ERC20 token transfer.
|
|
94
|
+
*/
|
|
95
|
+
export declare const TransactionJPYCurrency: Story;
|
|
92
96
|
export declare const CustompresetOptions: Story;
|
|
93
97
|
//# sourceMappingURL=BridgeOrchestrator.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeOrchestrator.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Bridge/BridgeOrchestrator.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iDAAiD,CAAC;AAQzD;;;;GAIG;AAGH,UAAU,gCAAiC,SAAQ,uBAAuB;IACxE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;CACjC;AAcD,QAAA,MAAM,IAAI;;;;;;;;;qBA6BgF,CAAC;2BAA2B,CAAC;qBAC7G,CAAT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAxCQ,gCAAgC;;;;;;;;;;;CAwDW,CAAC;AAErD,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC;;GAEG;AACH,eAAO,MA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uBhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAuBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAuB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,KA0BpC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAuBjC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { BridgeWidgetScript } from "../../../script-exports/bridge-widget-script.js";
|
|
3
|
+
declare const meta: Meta<typeof BridgeWidgetScript>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare function BasicUsage(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function LightTheme(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function CurrencySet(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function NoThirdwebBranding(): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function CustomTheme(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=bridge-widget-script.stories.d.ts.map
|
|
@@ -0,0 +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,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAGrF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CAczC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,wBAAgB,UAAU,4CAOzB;AAED,wBAAgB,UAAU,4CAQzB;AAED,wBAAgB,WAAW,4CAQ1B;AAED,wBAAgB,kBAAkB,4CASjC;AAED,wBAAgB,WAAW,4CAiB1B"}
|
|
@@ -44,14 +44,8 @@ declare const meta: {
|
|
|
44
44
|
};
|
|
45
45
|
component: (props: StepRunnerWithThemeProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
parameters: {
|
|
47
|
-
docs: {
|
|
48
|
-
description: {
|
|
49
|
-
component: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
47
|
layout: string;
|
|
53
48
|
};
|
|
54
|
-
tags: string[];
|
|
55
49
|
title: string;
|
|
56
50
|
};
|
|
57
51
|
export default meta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepRunner.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Bridge/StepRunner.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAEvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"StepRunner.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Bridge/StepRunner.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO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{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../src/utils/units.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA8BhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,UAElC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA6ChE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,UAEnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,UAEpC"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.108.
|
|
1
|
+
export declare const version = "5.108.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/x402/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/x402/common.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EAClC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAE3B,MAAM,YAAY,CAAC;AAEpB,KAAK,4BAA4B,GAAG;IAClC,MAAM,EAAE,GAAG,CAAC;IACZ,mBAAmB,EAAE,4BAA4B,EAAE,CAAC;IACpD,2BAA2B,EAAE,4BAA4B,CAAC;IAC1D,cAAc,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,4BAA4B,GAAG,qBAAqB,CAAC,CAiJ/D"}
|
|
@@ -18,6 +18,7 @@ export type ThirdwebX402FacilitatorConfig = {
|
|
|
18
18
|
* ```ts
|
|
19
19
|
* import { facilitator } from "thirdweb/x402";
|
|
20
20
|
* import { createThirdwebClient } from "thirdweb";
|
|
21
|
+
* import { paymentMiddleware } from 'x402-hono'
|
|
21
22
|
*
|
|
22
23
|
* const client = createThirdwebClient({
|
|
23
24
|
* secretKey: "your-secret-key",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facilitator.d.ts","sourceRoot":"","sources":["../../../src/x402/facilitator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,cAAc,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF
|
|
1
|
+
{"version":3,"file":"facilitator.d.ts","sourceRoot":"","sources":["../../../src/x402/facilitator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,cAAc,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,6BAA6B;SAYhB,GAAG,MAAM,MAAM,MAAM,EAAE;;;;;;;;;;;;;;;;;IAqBpE;;;;;;OAMG;oBAEQ,uBAAuB,uBACX,4BAA4B,GAChD,OAAO,CAAC,cAAc,CAAC;IA0B1B;;;;;;OAMG;oBAEQ,uBAAuB,uBACX,4BAA4B,GAChD,OAAO,CAAC,yBAAyB,CAAC;IA0BrC;;;;OAIG;iBACgB,OAAO,CAAC,6BAA6B,CAAC;EA2B5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchWithPayment.d.ts","sourceRoot":"","sources":["../../../src/x402/fetchWithPayment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAQ9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,EAC9B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAA4B,IAExB,OAAO,WAAW,EAAE,OAAO,WAAW,
|
|
1
|
+
{"version":3,"file":"fetchWithPayment.d.ts","sourceRoot":"","sources":["../../../src/x402/fetchWithPayment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAQ9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,EAC9B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAA4B,IAExB,OAAO,WAAW,EAAE,OAAO,WAAW,uBAyErD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ExactEvmPayload } from "x402/types";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import type { Chain } from "../chains/types.js";
|
|
3
4
|
declare const FacilitatorNetworkSchema: z.ZodUnion<[z.ZodLiteral<"base-sepolia">, z.ZodLiteral<"base">, z.ZodLiteral<"avalanche-fuji">, z.ZodLiteral<"avalanche">, z.ZodLiteral<"iotex">, z.ZodLiteral<"solana-devnet">, z.ZodLiteral<"solana">, z.ZodLiteral<"sei">, z.ZodLiteral<"sei-testnet">, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
5
|
export type FacilitatorNetwork = z.infer<typeof FacilitatorNetworkSchema>;
|
|
5
6
|
export declare const RequestedPaymentPayloadSchema: z.ZodObject<{
|
|
@@ -159,6 +160,6 @@ declare const FacilitatorSettleResponseSchema: z.ZodObject<{
|
|
|
159
160
|
payer?: string | undefined;
|
|
160
161
|
}>;
|
|
161
162
|
export type FacilitatorSettleResponse = z.infer<typeof FacilitatorSettleResponseSchema>;
|
|
162
|
-
export declare function networkToChainId(network: string): number;
|
|
163
|
+
export declare function networkToChainId(network: string | Chain): number;
|
|
163
164
|
export {};
|
|
164
165
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/x402/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAKrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/x402/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAKrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,QAAA,MAAM,wBAAwB,wSAa5B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,uBAAuB,EACvB,SAAS,CACV,GAAG;IACF,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG;QAAE,SAAS,EAAE,SAAS,CAAA;KAAE,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3C,CAAC;AAEL,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,kCAAkC,CAC1C,CAAC;AAEF,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;EAEnC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAqBhE"}
|
|
@@ -17,6 +17,7 @@ import { type PaymentArgs, type SettlePaymentResult } from "./types.js";
|
|
|
17
17
|
* // Usage in a Next.js API route
|
|
18
18
|
* import { settlePayment, facilitator } from "thirdweb/x402";
|
|
19
19
|
* import { createThirdwebClient } from "thirdweb";
|
|
20
|
+
* import { arbitrumSepolia } from "thirdweb/chains";
|
|
20
21
|
*
|
|
21
22
|
* const client = createThirdwebClient({
|
|
22
23
|
* secretKey: process.env.THIRDWEB_SECRET_KEY,
|
|
@@ -36,7 +37,7 @@ import { type PaymentArgs, type SettlePaymentResult } from "./types.js";
|
|
|
36
37
|
* method: "GET",
|
|
37
38
|
* paymentData,
|
|
38
39
|
* payTo: "0x1234567890123456789012345678901234567890",
|
|
39
|
-
* network:
|
|
40
|
+
* network: arbitrumSepolia, // or any other chain
|
|
40
41
|
* price: "$0.10", // or { amount: "100000", asset: { address: "0x...", decimals: 6 } }
|
|
41
42
|
* facilitator: thirdwebFacilitator,
|
|
42
43
|
* routeConfig: {
|
|
@@ -66,6 +67,7 @@ import { type PaymentArgs, type SettlePaymentResult } from "./types.js";
|
|
|
66
67
|
* import express from "express";
|
|
67
68
|
* import { settlePayment, facilitator } from "thirdweb/x402";
|
|
68
69
|
* import { createThirdwebClient } from "thirdweb";
|
|
70
|
+
* import { arbitrumSepolia } from "thirdweb/chains";
|
|
69
71
|
*
|
|
70
72
|
* const client = createThirdwebClient({
|
|
71
73
|
* secretKey: process.env.THIRDWEB_SECRET_KEY,
|
|
@@ -85,7 +87,7 @@ import { type PaymentArgs, type SettlePaymentResult } from "./types.js";
|
|
|
85
87
|
* method: req.method,
|
|
86
88
|
* paymentData: req.headers["x-payment"],
|
|
87
89
|
* payTo: "0x1234567890123456789012345678901234567890",
|
|
88
|
-
* network:
|
|
90
|
+
* network: arbitrumSepolia, // or any other chain
|
|
89
91
|
* price: "$0.05",
|
|
90
92
|
* facilitator: thirdwebFacilitator,
|
|
91
93
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settle-payment.d.ts","sourceRoot":"","sources":["../../../src/x402/settle-payment.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AAEpB
|
|
1
|
+
{"version":3,"file":"settle-payment.d.ts","sourceRoot":"","sources":["../../../src/x402/settle-payment.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,mBAAmB,CAAC,CA2D9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ERC20TokenAmount, Money, PaymentMiddlewareConfig } from "x402/types";
|
|
2
|
+
import type { Chain } from "../chains/types.js";
|
|
2
3
|
import type { Address } from "../utils/address.js";
|
|
3
4
|
import type { Prettify } from "../utils/type-utils.js";
|
|
4
5
|
import type { facilitator as facilitatorType } from "./facilitator.js";
|
|
@@ -19,7 +20,7 @@ export type PaymentArgs = {
|
|
|
19
20
|
/** The wallet address that should receive the payment */
|
|
20
21
|
payTo: Address;
|
|
21
22
|
/** The blockchain network where the payment should be processed */
|
|
22
|
-
network: FacilitatorNetwork;
|
|
23
|
+
network: FacilitatorNetwork | Chain;
|
|
23
24
|
/** The price for accessing the resource - either a USD amount (e.g., "$0.10") or a specific token amount */
|
|
24
25
|
price: Money | ERC20TokenAmount;
|
|
25
26
|
/** The payment facilitator instance used to verify and settle payments */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/x402/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,KAAK,EACL,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAA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,2BAA2B,EAAE,4BAA4B,CAAC;CAC3D,GACD,qBAAqB,CACxB,CAAC"}
|
|
@@ -11,6 +11,7 @@ import { type PaymentArgs, type VerifyPaymentResult } from "./types.js";
|
|
|
11
11
|
* // Usage in a Next.js API route
|
|
12
12
|
* import { verifyPayment, facilitator } from "thirdweb/x402";
|
|
13
13
|
* import { createThirdwebClient } from "thirdweb";
|
|
14
|
+
* import { arbitrumSepolia } from "thirdweb/chains";
|
|
14
15
|
*
|
|
15
16
|
* const client = createThirdwebClient({
|
|
16
17
|
* secretKey: process.env.THIRDWEB_SECRET_KEY,
|
|
@@ -29,7 +30,7 @@ import { type PaymentArgs, type VerifyPaymentResult } from "./types.js";
|
|
|
29
30
|
* method: "GET",
|
|
30
31
|
* paymentData,
|
|
31
32
|
* payTo: "0x1234567890123456789012345678901234567890",
|
|
32
|
-
* network:
|
|
33
|
+
* network: arbitrumSepolia, // or any other chain
|
|
33
34
|
* price: "$0.10", // or { amount: "100000", asset: { address: "0x...", decimals: 6 } }
|
|
34
35
|
* facilitator: thirdwebFacilitator,
|
|
35
36
|
* routeConfig: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-payment.d.ts","sourceRoot":"","sources":["../../../src/x402/verify-payment.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AAEpB
|
|
1
|
+
{"version":3,"file":"verify-payment.d.ts","sourceRoot":"","sources":["../../../src/x402/verify-payment.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAyD9B"}
|
package/package.json
CHANGED
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"viem": "2.33.2",
|
|
41
41
|
"x402": "0.6.1",
|
|
42
42
|
"zod": "3.25.75",
|
|
43
|
-
"@thirdweb-dev/
|
|
44
|
-
"@thirdweb-dev/
|
|
43
|
+
"@thirdweb-dev/insight": "1.1.1",
|
|
44
|
+
"@thirdweb-dev/engine": "3.2.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@aws-sdk/client-kms": "3.592.0",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@types/prompts": "2.4.9",
|
|
66
66
|
"@types/qrcode": "1.5.5",
|
|
67
67
|
"@types/react": "19.1.8",
|
|
68
|
+
"@types/react-dom": "19.1.6",
|
|
68
69
|
"@viem/anvil": "0.0.10",
|
|
69
70
|
"@vitejs/plugin-react": "^4.6.0",
|
|
70
71
|
"@vitest/coverage-v8": "3.2.4",
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
"sharp": "^0.34.2",
|
|
90
91
|
"size-limit": "11.2.0",
|
|
91
92
|
"storybook": "9.0.15",
|
|
93
|
+
"tsup": "^8.5.0",
|
|
92
94
|
"typedoc": "0.27.9",
|
|
93
95
|
"typedoc-better-json": "0.9.4",
|
|
94
96
|
"typescript": "5.8.3",
|
|
@@ -397,11 +399,12 @@
|
|
|
397
399
|
}
|
|
398
400
|
},
|
|
399
401
|
"typings": "./dist/types/exports/thirdweb.d.ts",
|
|
400
|
-
"version": "5.108.
|
|
402
|
+
"version": "5.108.2",
|
|
401
403
|
"scripts": {
|
|
402
404
|
"bench": "vitest -c ./test/vitest.config.ts bench",
|
|
403
405
|
"bench:compare": "bun run ./benchmarks/run.ts",
|
|
404
|
-
"build": "pnpm clean && pnpm build:types && pnpm build:cjs && pnpm build:esm",
|
|
406
|
+
"build": "pnpm clean && pnpm build:types && pnpm build:cjs && pnpm build:esm && pnpm build:tsup",
|
|
407
|
+
"build:tsup": "tsup",
|
|
405
408
|
"build-storybook": "storybook build",
|
|
406
409
|
"build:cjs": "tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
|
|
407
410
|
"build:esm": "tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
|
package/src/bridge/Buy.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { ApiError } from "./types/Errors.js";
|
|
|
9
9
|
import type { PreparedQuote, Quote } from "./types/Quote.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Retrieves a
|
|
12
|
+
* Retrieves a Bridge quote for the provided buy intent. The quote will specify the necessary `originAmount` to receive the desired `destinationAmount`, which is specified with the `buyAmountWei` option.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
@@ -209,7 +209,7 @@ export declare namespace quote {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
|
-
* Prepares a **finalized**
|
|
212
|
+
* Prepares a **finalized** Bridge quote for the provided buy request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp.
|
|
213
213
|
*
|
|
214
214
|
* @example
|
|
215
215
|
* ```typescript
|
package/src/bridge/Chains.ts
CHANGED
package/src/bridge/Routes.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ApiError } from "./types/Errors.js";
|
|
|
6
6
|
import type { Route } from "./types/Route.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Retrieves supported
|
|
9
|
+
* Retrieves supported Bridge routes based on the provided filters.
|
|
10
10
|
*
|
|
11
11
|
* When multiple filters are specified, a route must satisfy all filters to be included (it acts as an AND operator).
|
|
12
12
|
*
|
package/src/bridge/Sell.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { ApiError } from "./types/Errors.js";
|
|
|
9
9
|
import type { PreparedQuote, Quote } from "./types/Quote.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Retrieves a
|
|
12
|
+
* Retrieves a Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
@@ -200,7 +200,7 @@ export declare namespace quote {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
* Prepares a **finalized**
|
|
203
|
+
* Prepares a **finalized** Bridge quote for the provided sell request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp.
|
|
204
204
|
*
|
|
205
205
|
* @example
|
|
206
206
|
* ```typescript
|
package/src/bridge/Status.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ApiError } from "./types/Errors.js";
|
|
|
7
7
|
import type { Status } from "./types/Status.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Retrieves a
|
|
10
|
+
* Retrieves a Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option.
|
|
11
11
|
*
|
|
12
12
|
* The returned status will include both the origin and destination transactions and any finalized amounts for the route.
|
|
13
13
|
*
|
package/src/bridge/Token.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ApiError } from "./types/Errors.js";
|
|
|
5
5
|
import type { Token, TokenWithPrices } from "./types/Token.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Retrieves supported
|
|
8
|
+
* Retrieves supported Bridge tokens based on the provided filters.
|
|
9
9
|
*
|
|
10
10
|
* When multiple filters are specified, a token must satisfy all filters to be included (it acts as an AND operator).
|
|
11
11
|
*
|
|
@@ -226,9 +226,9 @@ export declare namespace tokens {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
|
-
* Adds a token to the
|
|
229
|
+
* Adds a token to the Bridge for indexing.
|
|
230
230
|
*
|
|
231
|
-
* This function requests the
|
|
231
|
+
* This function requests the Bridge to index a specific token on a given chain.
|
|
232
232
|
* Once indexed, the token will be available for cross-chain operations.
|
|
233
233
|
*
|
|
234
234
|
* @example
|
package/src/bridge/Transfer.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { ApiError } from "./types/Errors.js";
|
|
|
9
9
|
import type { PreparedQuote } from "./types/Quote.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Prepares a **finalized**
|
|
12
|
+
* Prepares a **finalized** Bridge quote for the provided transfer request with transaction data.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
package/src/bridge/Webhook.ts
CHANGED
|
@@ -90,7 +90,7 @@ export type WebhookPayload = Exclude<
|
|
|
90
90
|
>;
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Parses an incoming
|
|
93
|
+
* Parses an incoming Bridge webhook payload.
|
|
94
94
|
*
|
|
95
95
|
* @param payload - The raw text body received from thirdweb.
|
|
96
96
|
* @param headers - The webhook headers received from thirdweb.
|
package/src/exports/react.ts
CHANGED
|
@@ -137,6 +137,10 @@ export {
|
|
|
137
137
|
BuyWidget,
|
|
138
138
|
type BuyWidgetProps,
|
|
139
139
|
} from "../react/web/ui/Bridge/BuyWidget.js";
|
|
140
|
+
export {
|
|
141
|
+
BridgeWidget,
|
|
142
|
+
type BridgeWidgetProps,
|
|
143
|
+
} from "../react/web/ui/Bridge/bridge-widget/bridge-widget.js";
|
|
140
144
|
export {
|
|
141
145
|
CheckoutWidget,
|
|
142
146
|
type CheckoutWidgetProps,
|
package/src/exports/thirdweb.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
2
|
import type { status as OnrampStatus } from "../../../bridge/OnrampStatus.js";
|
|
4
3
|
import { ApiError } from "../../../bridge/types/Errors.js";
|
|
@@ -10,14 +9,9 @@ import type { Status } from "../../../bridge/types/Status.js";
|
|
|
10
9
|
import { getCachedChain } from "../../../chains/utils.js";
|
|
11
10
|
import type { ThirdwebClient } from "../../../client/client.js";
|
|
12
11
|
import { waitForReceipt } from "../../../transaction/actions/wait-for-tx-receipt.js";
|
|
13
|
-
import { stringify } from "../../../utils/json.js";
|
|
14
12
|
import type { Account, Wallet } from "../../../wallets/interfaces/wallet.js";
|
|
15
13
|
import type { WindowAdapter } from "../adapters/WindowAdapter.js";
|
|
16
|
-
import {
|
|
17
|
-
type BridgePrepareRequest,
|
|
18
|
-
type BridgePrepareResult,
|
|
19
|
-
useBridgePrepare,
|
|
20
|
-
} from "./useBridgePrepare.js";
|
|
14
|
+
import type { BridgePrepareResult } from "./useBridgePrepare.js";
|
|
21
15
|
|
|
22
16
|
/**
|
|
23
17
|
* Type for completed status results from Bridge.status and Onramp.status
|
|
@@ -35,8 +29,7 @@ export type CompletedStatusResult =
|
|
|
35
29
|
* Options for the step executor hook
|
|
36
30
|
*/
|
|
37
31
|
interface StepExecutorOptions {
|
|
38
|
-
|
|
39
|
-
request: BridgePrepareRequest;
|
|
32
|
+
preparedQuote: BridgePrepareResult;
|
|
40
33
|
/** Wallet instance providing getAccount() & sendTransaction */
|
|
41
34
|
wallet?: Wallet;
|
|
42
35
|
/** Window adapter for opening on-ramp URLs (web / RN) */
|
|
@@ -67,7 +60,7 @@ interface StepExecutorResult {
|
|
|
67
60
|
currentTxIndex?: number;
|
|
68
61
|
progress: number; // 0–100
|
|
69
62
|
onrampStatus?: "pending" | "executing" | "completed" | "failed";
|
|
70
|
-
executionState: "
|
|
63
|
+
executionState: "idle" | "executing" | "auto-starting";
|
|
71
64
|
steps?: RouteStep[];
|
|
72
65
|
error?: ApiError;
|
|
73
66
|
start: () => void;
|
|
@@ -100,16 +93,14 @@ export function useStepExecutor(
|
|
|
100
93
|
options: StepExecutorOptions,
|
|
101
94
|
): StepExecutorResult {
|
|
102
95
|
const {
|
|
103
|
-
request,
|
|
104
96
|
wallet,
|
|
105
97
|
windowAdapter,
|
|
106
98
|
client,
|
|
107
99
|
autoStart = false,
|
|
108
100
|
onComplete,
|
|
101
|
+
preparedQuote,
|
|
109
102
|
} = options;
|
|
110
103
|
|
|
111
|
-
const { data: preparedQuote, isLoading } = useBridgePrepare(request);
|
|
112
|
-
|
|
113
104
|
// Flatten all transactions upfront
|
|
114
105
|
const flatTxs = useMemo(
|
|
115
106
|
() => (preparedQuote?.steps ? flattenRouteSteps(preparedQuote.steps) : []),
|
|
@@ -121,7 +112,7 @@ export function useStepExecutor(
|
|
|
121
112
|
undefined,
|
|
122
113
|
);
|
|
123
114
|
const [executionState, setExecutionState] = useState<
|
|
124
|
-
"
|
|
115
|
+
"idle" | "executing" | "auto-starting"
|
|
125
116
|
>("idle");
|
|
126
117
|
const [error, setError] = useState<ApiError | undefined>(undefined);
|
|
127
118
|
const [completedTxs, setCompletedTxs] = useState<Set<number>>(new Set());
|
|
@@ -129,22 +120,6 @@ export function useStepExecutor(
|
|
|
129
120
|
"pending" | "executing" | "completed" | "failed" | undefined
|
|
130
121
|
>(preparedQuote?.type === "onramp" ? "pending" : undefined);
|
|
131
122
|
|
|
132
|
-
useQuery({
|
|
133
|
-
queryFn: async () => {
|
|
134
|
-
if (!isLoading) {
|
|
135
|
-
setExecutionState("idle");
|
|
136
|
-
} else {
|
|
137
|
-
setExecutionState("fetching");
|
|
138
|
-
}
|
|
139
|
-
return executionState;
|
|
140
|
-
},
|
|
141
|
-
queryKey: [
|
|
142
|
-
"bridge-quote-execution-state",
|
|
143
|
-
stringify(preparedQuote?.steps),
|
|
144
|
-
isLoading,
|
|
145
|
-
],
|
|
146
|
-
});
|
|
147
|
-
|
|
148
123
|
// Cancellation tracking
|
|
149
124
|
const abortControllerRef = useRef<AbortController | null>(null);
|
|
150
125
|
|
|
@@ -189,13 +189,9 @@ export function BridgeOrchestrator({
|
|
|
189
189
|
}, [send, uiOptions.mode]);
|
|
190
190
|
|
|
191
191
|
// Handle post-buy transaction completion
|
|
192
|
-
const handlePostBuyTransactionComplete = useCallback(
|
|
193
|
-
(
|
|
194
|
-
|
|
195
|
-
send({ type: "RESET" });
|
|
196
|
-
},
|
|
197
|
-
[onComplete, send],
|
|
198
|
-
);
|
|
192
|
+
const handlePostBuyTransactionComplete = useCallback(() => {
|
|
193
|
+
send({ type: "RESET" });
|
|
194
|
+
}, [send]);
|
|
199
195
|
|
|
200
196
|
// Handle errors
|
|
201
197
|
const handleError = useCallback(
|
|
@@ -379,6 +375,7 @@ export function BridgeOrchestrator({
|
|
|
379
375
|
|
|
380
376
|
{state.value === "execute" && quote && state.context.request && (
|
|
381
377
|
<StepRunner
|
|
378
|
+
preparedQuote={quote}
|
|
382
379
|
autoStart={true}
|
|
383
380
|
client={client}
|
|
384
381
|
onBack={() => {
|
|
@@ -415,9 +412,9 @@ export function BridgeOrchestrator({
|
|
|
415
412
|
quote &&
|
|
416
413
|
uiOptions.transaction && (
|
|
417
414
|
<ExecutingTxScreen
|
|
418
|
-
closeModal={
|
|
415
|
+
closeModal={handlePostBuyTransactionComplete}
|
|
419
416
|
onTxSent={() => {
|
|
420
|
-
|
|
417
|
+
onComplete?.(quote);
|
|
421
418
|
}}
|
|
422
419
|
tx={uiOptions.transaction}
|
|
423
420
|
windowAdapter={webWindowAdapter}
|
|
@@ -33,7 +33,7 @@ import type { LocaleId } from "../types.js";
|
|
|
33
33
|
import { BridgeOrchestrator, type UIOptions } from "./BridgeOrchestrator.js";
|
|
34
34
|
import { UnsupportedTokenScreen } from "./UnsupportedTokenScreen.js";
|
|
35
35
|
|
|
36
|
-
type BuyOrOnrampPrepareResult = Extract<
|
|
36
|
+
export type BuyOrOnrampPrepareResult = Extract<
|
|
37
37
|
BridgePrepareResult,
|
|
38
38
|
{ type: "buy" | "onramp" }
|
|
39
39
|
>;
|