@b3dotfun/sdk 0.0.40-test.2 → 0.0.40
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/anyspend/constants/index.d.ts +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +5 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -5
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +23 -19
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -9
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -12
- package/dist/esm/anyspend/constants/index.d.ts +0 -1
- package/dist/esm/anyspend/constants/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +6 -7
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +5 -6
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +24 -20
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -9
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -12
- package/dist/types/anyspend/constants/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -9
- package/package.json +4 -5
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +15 -17
- package/src/anyspend/react/components/AnySpendCustom.tsx +19 -21
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +16 -18
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +5 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +60 -43
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
- package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +3 -13
- package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
- package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/esm/global-account/examples/client-selection-example.js +0 -93
- package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
- package/src/global-account/app.d.ts +0 -14
- package/src/global-account/docs/client-selection.md +0 -292
- package/src/global-account/examples/client-selection-example.tsx +0 -197
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
4
|
-
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
4
|
import { supportedChains } from "../../../../shared/constants/chains/supported.js";
|
|
6
|
-
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
7
|
-
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
8
5
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
9
|
-
import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
|
|
10
6
|
import { useCallback, useEffect, useState } from "react";
|
|
11
7
|
import { Toaster } from "sonner";
|
|
12
8
|
import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
|
|
@@ -14,6 +10,7 @@ import { createConfig, http, WagmiProvider } from "wagmi";
|
|
|
14
10
|
import { setClientType } from "../../../client-manager.js";
|
|
15
11
|
import { StyleRoot } from "../StyleRoot.js";
|
|
16
12
|
import { B3Context } from "./types.js";
|
|
13
|
+
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
17
14
|
/**
|
|
18
15
|
* Default permissions configuration for B3 provider
|
|
19
16
|
*/
|
|
@@ -26,14 +23,6 @@ const DEFAULT_PERMISSIONS = {
|
|
|
26
23
|
export const wagmiConfig = createConfig({
|
|
27
24
|
chains: [supportedChains[0], ...supportedChains.slice(1)],
|
|
28
25
|
transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])),
|
|
29
|
-
connectors: [
|
|
30
|
-
inAppWalletConnector({
|
|
31
|
-
ecosystemId: ecosystemWalletId,
|
|
32
|
-
client,
|
|
33
|
-
}),
|
|
34
|
-
// injected(),
|
|
35
|
-
// coinbaseWallet({ appName: "HypeDuel" }),
|
|
36
|
-
],
|
|
37
26
|
});
|
|
38
27
|
// Create queryClient instance
|
|
39
28
|
const queryClient = new QueryClient();
|
|
@@ -12,6 +12,7 @@ interface ConnectWalletPaymentProps {
|
|
|
12
12
|
tournament?: Tournament;
|
|
13
13
|
nft?: NFT;
|
|
14
14
|
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
15
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
15
16
|
}
|
|
16
|
-
export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, }: ConnectWalletPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, onPaymentMethodChange, }: ConnectWalletPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -8,6 +8,8 @@ interface OrderDetailsProps {
|
|
|
8
8
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
9
9
|
refundTxs: components["schemas"]["RefundTx"][];
|
|
10
10
|
cryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
11
|
+
selectedCryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
12
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
11
13
|
onBack?: () => void;
|
|
12
14
|
disableUrlParamManagement?: boolean;
|
|
13
15
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
|
+
interface PaymentMethodSwitchProps {
|
|
3
|
+
currentMethod: CryptoPaymentMethodType;
|
|
4
|
+
onMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PaymentMethodSwitch({ currentMethod, onMethodChange }: PaymentMethodSwitchProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
3
|
type Order = components["schemas"]["Order"];
|
|
3
4
|
type Token = components["schemas"]["Token"];
|
|
4
5
|
type Tournament = components["schemas"]["Tournament"];
|
|
@@ -11,6 +12,7 @@ interface TransferCryptoDetailsProps {
|
|
|
11
12
|
nft?: NFT;
|
|
12
13
|
onBack: () => void;
|
|
13
14
|
recipientName?: string;
|
|
15
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
14
16
|
}
|
|
15
17
|
export declare const TransferCryptoDetails: import("react").NamedExoticComponent<TransferCryptoDetailsProps>;
|
|
16
18
|
export {};
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
2
|
-
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
3
2
|
import { Account } from "thirdweb/wallets";
|
|
4
3
|
import { ClientType } from "../../../client-manager";
|
|
5
4
|
import { B3ContextType } from "./types";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
accounts: readonly `0x${string}`[];
|
|
9
|
-
chainId: number;
|
|
10
|
-
}>;
|
|
11
|
-
}, {
|
|
12
|
-
"thirdweb:lastChainId": number;
|
|
13
|
-
}>]>;
|
|
5
|
+
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
6
|
+
export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly import("wagmi").CreateConnectorFn[]>;
|
|
14
7
|
/**
|
|
15
8
|
* Main B3Provider component
|
|
16
9
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.40
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -241,8 +241,8 @@
|
|
|
241
241
|
"@b3dotfun/basement-api": "0.0.11",
|
|
242
242
|
"@feathersjs/authentication-client": "5.0.33",
|
|
243
243
|
"@feathersjs/feathers": "5.0.33",
|
|
244
|
-
"@feathersjs/rest-client": "5.0.33",
|
|
245
244
|
"@feathersjs/socketio-client": "5.0.33",
|
|
245
|
+
"@feathersjs/rest-client": "5.0.33",
|
|
246
246
|
"@feathersjs/typebox": "5.0.33",
|
|
247
247
|
"@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
|
|
248
248
|
"@hey-api/client-fetch": "0.8.3",
|
|
@@ -261,7 +261,6 @@
|
|
|
261
261
|
"@solana/web3.js": "^1.98.2",
|
|
262
262
|
"@stripe/react-stripe-js": "^3.7.0",
|
|
263
263
|
"@stripe/stripe-js": "^7.3.1",
|
|
264
|
-
"@thirdweb-dev/wagmi-adapter": "^0.2.141",
|
|
265
264
|
"@web3icons/react": "3.16.0",
|
|
266
265
|
"big.js": "^7.0.1",
|
|
267
266
|
"class-variance-authority": "0.7.0",
|
|
@@ -332,8 +331,8 @@
|
|
|
332
331
|
"react-native-mmkv": "^3.2.0",
|
|
333
332
|
"thirdweb": "^5.105.20",
|
|
334
333
|
"three": "^0.175.0",
|
|
335
|
-
"
|
|
336
|
-
"
|
|
334
|
+
"wagmi": "^2.14.15",
|
|
335
|
+
"viem": "^2.28.1"
|
|
337
336
|
},
|
|
338
337
|
"peerDependenciesMeta": {
|
|
339
338
|
"@react-three/postprocessing": {
|
|
@@ -38,7 +38,6 @@ import { ErrorSection } from "./common/ErrorSection";
|
|
|
38
38
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
39
39
|
import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails";
|
|
40
40
|
import { OrderHistory } from "./common/OrderHistory";
|
|
41
|
-
import { OrderStatus } from "./common/OrderStatus";
|
|
42
41
|
import { PanelOnramp } from "./common/PanelOnramp";
|
|
43
42
|
import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
|
|
44
43
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
@@ -807,22 +806,21 @@ function AnySpendInner({
|
|
|
807
806
|
<div className={"mx-auto w-[460px] max-w-full"}>
|
|
808
807
|
<div className="relative flex flex-col gap-4">
|
|
809
808
|
{oat && (
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
</>
|
|
809
|
+
<OrderDetails
|
|
810
|
+
mode={mode}
|
|
811
|
+
order={oat.data.order}
|
|
812
|
+
depositTxs={oat.data.depositTxs}
|
|
813
|
+
relayTxs={oat.data.relayTxs}
|
|
814
|
+
executeTx={oat.data.executeTx}
|
|
815
|
+
refundTxs={oat.data.refundTxs}
|
|
816
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
817
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
818
|
+
onBack={() => {
|
|
819
|
+
setOrderId(undefined);
|
|
820
|
+
setActivePanel(PanelView.MAIN);
|
|
821
|
+
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
822
|
+
}}
|
|
823
|
+
/>
|
|
826
824
|
)}
|
|
827
825
|
{/* {mode === "page" && <div className="h-12" />} */}
|
|
828
826
|
</div>
|
|
@@ -47,7 +47,6 @@ import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPay
|
|
|
47
47
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
48
48
|
import { OrderDetails } from "./common/OrderDetails";
|
|
49
49
|
import { OrderHistory } from "./common/OrderHistory";
|
|
50
|
-
import { OrderStatus as OrderStatusDisplay } from "./common/OrderStatus";
|
|
51
50
|
import { OrderToken } from "./common/OrderToken";
|
|
52
51
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
53
52
|
|
|
@@ -648,26 +647,25 @@ function AnySpendCustomInner({
|
|
|
648
647
|
)}
|
|
649
648
|
>
|
|
650
649
|
{oat && (
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
</>
|
|
650
|
+
<OrderDetails
|
|
651
|
+
mode={mode}
|
|
652
|
+
order={oat.data.order}
|
|
653
|
+
depositTxs={oat.data.depositTxs}
|
|
654
|
+
relayTxs={oat.data.relayTxs}
|
|
655
|
+
executeTx={oat.data.executeTx}
|
|
656
|
+
refundTxs={oat.data.refundTxs}
|
|
657
|
+
cryptoPaymentMethod={activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
658
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
659
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
660
|
+
onBack={() => {
|
|
661
|
+
setOrderId(undefined);
|
|
662
|
+
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
663
|
+
// Remove orderId from URL when canceling
|
|
664
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
665
|
+
params.delete("orderId");
|
|
666
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
667
|
+
}}
|
|
668
|
+
/>
|
|
671
669
|
)}
|
|
672
670
|
{mode === "page" && <div className="h-12" />}
|
|
673
671
|
</div>
|
|
@@ -14,7 +14,6 @@ import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
|
|
|
14
14
|
import { ErrorSection } from "./common/ErrorSection";
|
|
15
15
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
16
16
|
import { OrderDetails } from "./common/OrderDetails";
|
|
17
|
-
import { OrderStatus } from "./common/OrderStatus";
|
|
18
17
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
19
18
|
|
|
20
19
|
import { ArrowDown } from "lucide-react";
|
|
@@ -381,23 +380,22 @@ function AnySpendDepositHypeInner({
|
|
|
381
380
|
<div className={"mx-auto w-[460px] max-w-full"}>
|
|
382
381
|
<div className="relative flex flex-col gap-4">
|
|
383
382
|
{oat && (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
</>
|
|
383
|
+
<OrderDetails
|
|
384
|
+
mode={mode}
|
|
385
|
+
order={oat.data.order}
|
|
386
|
+
depositTxs={oat.data.depositTxs}
|
|
387
|
+
relayTxs={oat.data.relayTxs}
|
|
388
|
+
executeTx={oat.data.executeTx}
|
|
389
|
+
refundTxs={oat.data.refundTxs}
|
|
390
|
+
cryptoPaymentMethod={paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
391
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
392
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
393
|
+
onBack={() => {
|
|
394
|
+
setOrderId(undefined);
|
|
395
|
+
setActivePanel(PanelView.MAIN);
|
|
396
|
+
}}
|
|
397
|
+
disableUrlParamManagement
|
|
398
|
+
/>
|
|
401
399
|
)}
|
|
402
400
|
</div>
|
|
403
401
|
</div>
|
|
@@ -10,6 +10,7 @@ import { ChevronRight, Loader2 } from "lucide-react";
|
|
|
10
10
|
import { useAccount } from "wagmi";
|
|
11
11
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
12
12
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
13
|
+
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
13
14
|
|
|
14
15
|
type Tournament = components["schemas"]["Tournament"];
|
|
15
16
|
type NFT = components["schemas"]["NFT"];
|
|
@@ -24,6 +25,7 @@ interface ConnectWalletPaymentProps {
|
|
|
24
25
|
tournament?: Tournament;
|
|
25
26
|
nft?: NFT;
|
|
26
27
|
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
28
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export default function ConnectWalletPayment({
|
|
@@ -35,6 +37,7 @@ export default function ConnectWalletPayment({
|
|
|
35
37
|
tournament,
|
|
36
38
|
nft,
|
|
37
39
|
cryptoPaymentMethod,
|
|
40
|
+
onPaymentMethodChange,
|
|
38
41
|
}: ConnectWalletPaymentProps) {
|
|
39
42
|
const profile = useProfile({ address: order.recipientAddress });
|
|
40
43
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
@@ -97,6 +100,8 @@ export default function ConnectWalletPayment({
|
|
|
97
100
|
: centerTruncate(connectedAddress || "")}
|
|
98
101
|
</span>
|
|
99
102
|
|
|
103
|
+
<PaymentMethodSwitch currentMethod={cryptoPaymentMethod} onMethodChange={onPaymentMethodChange} />
|
|
104
|
+
|
|
100
105
|
<div className="mt-4">
|
|
101
106
|
<OrderDetailsCollapsible
|
|
102
107
|
order={order}
|