@b3dotfun/sdk 0.0.7-alpha.8 → 0.0.7
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.js +2 -5
- package/dist/cjs/anyspend/index.d.ts +0 -1
- package/dist/cjs/anyspend/index.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +33 -33
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +43 -75
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -3
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +3 -5
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +3 -4
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +1 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +0 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +0 -4
- package/dist/cjs/anyspend/services/anyspend.d.ts +1 -3
- package/dist/cjs/anyspend/services/anyspend.js +1 -1
- package/dist/cjs/anyspend/types/index.d.ts +0 -1
- package/dist/cjs/anyspend/types/index.js +0 -1
- package/dist/cjs/anyspend/types/nft.d.ts +0 -7
- package/dist/cjs/anyspend/types/nft.js +0 -2
- package/dist/cjs/anyspend/types/order.d.ts +0 -10
- package/dist/cjs/anyspend/types/req-res/createOrder.d.ts +0 -28
- package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -18
- package/dist/cjs/anyspend/types/req-res/getOrderHistory.d.ts +0 -14
- package/dist/cjs/anyspend/types/req-res/getQuote.d.ts +0 -11
- package/dist/cjs/anyspend/types/req-res/getQuote.js +1 -4
- package/dist/cjs/anyspend/utils/orderPayload.d.ts +3 -3
- package/dist/cjs/anyspend/utils/orderPayload.js +4 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +16 -11
- package/dist/cjs/global-account/react/components/StyleRoot.js +1 -0
- package/dist/cjs/global-account/react/hooks/useB3EnsName.d.ts +4 -1
- package/dist/cjs/global-account/react/hooks/useB3EnsName.js +22 -22
- package/dist/cjs/shared/constants/chains/supported.js +0 -3
- package/dist/cjs/shared/constants/index.d.ts +0 -1
- package/dist/cjs/shared/constants/index.js +1 -2
- package/dist/cjs/shared/utils/index.d.ts +0 -9
- package/dist/cjs/shared/utils/index.js +0 -17
- package/dist/esm/anyspend/constants/index.js +2 -5
- package/dist/esm/anyspend/index.d.ts +0 -1
- package/dist/esm/anyspend/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +5 -5
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +20 -52
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -3
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +3 -5
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +4 -5
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +0 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +0 -4
- package/dist/esm/anyspend/services/anyspend.d.ts +1 -3
- package/dist/esm/anyspend/services/anyspend.js +1 -1
- package/dist/esm/anyspend/types/index.d.ts +0 -1
- package/dist/esm/anyspend/types/index.js +0 -1
- package/dist/esm/anyspend/types/nft.d.ts +0 -7
- package/dist/esm/anyspend/types/nft.js +0 -2
- package/dist/esm/anyspend/types/order.d.ts +0 -10
- package/dist/esm/anyspend/types/req-res/createOrder.d.ts +0 -28
- package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -18
- package/dist/esm/anyspend/types/req-res/getOrderHistory.d.ts +0 -14
- package/dist/esm/anyspend/types/req-res/getQuote.d.ts +0 -11
- package/dist/esm/anyspend/types/req-res/getQuote.js +1 -4
- package/dist/esm/anyspend/utils/orderPayload.d.ts +3 -3
- package/dist/esm/anyspend/utils/orderPayload.js +5 -19
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +2 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +12 -7
- package/dist/esm/global-account/react/components/StyleRoot.js +1 -0
- package/dist/esm/global-account/react/hooks/useB3EnsName.d.ts +4 -1
- package/dist/esm/global-account/react/hooks/useB3EnsName.js +21 -24
- package/dist/esm/shared/constants/chains/supported.js +0 -3
- package/dist/esm/shared/constants/index.d.ts +0 -1
- package/dist/esm/shared/constants/index.js +0 -1
- package/dist/esm/shared/utils/index.d.ts +0 -9
- package/dist/esm/shared/utils/index.js +0 -15
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -2
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -3
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +0 -4
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +0 -4
- package/dist/types/anyspend/services/anyspend.d.ts +1 -3
- package/dist/types/anyspend/types/index.d.ts +0 -1
- package/dist/types/anyspend/types/nft.d.ts +0 -7
- package/dist/types/anyspend/types/order.d.ts +0 -10
- package/dist/types/anyspend/types/req-res/createOrder.d.ts +0 -28
- package/dist/types/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -18
- package/dist/types/anyspend/types/req-res/getOrderHistory.d.ts +0 -14
- package/dist/types/anyspend/types/req-res/getQuote.d.ts +0 -11
- package/dist/types/anyspend/utils/orderPayload.d.ts +3 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useB3EnsName.d.ts +4 -1
- package/dist/types/shared/constants/index.d.ts +0 -1
- package/dist/types/shared/utils/index.d.ts +0 -9
- package/package.json +3 -22
- package/src/anyspend/constants/index.ts +3 -5
- package/src/anyspend/index.ts +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +7 -8
- package/src/anyspend/react/components/AnySpendCustom.tsx +24 -68
- package/src/anyspend/react/components/AnySpendNFT.tsx +4 -9
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +6 -7
- package/src/anyspend/react/components/AnySpendTournament.tsx +1 -4
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -6
- package/src/anyspend/services/anyspend.ts +2 -2
- package/src/anyspend/types/index.ts +0 -1
- package/src/anyspend/types/nft.ts +0 -3
- package/src/anyspend/types/req-res/getQuote.ts +1 -4
- package/src/anyspend/utils/orderPayload.ts +5 -17
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +3 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +27 -15
- package/src/global-account/react/components/StyleRoot.tsx +1 -0
- package/src/global-account/react/hooks/useB3EnsName.ts +32 -26
- package/src/shared/constants/chains/supported.ts +0 -5
- package/src/shared/constants/index.ts +0 -2
- package/src/shared/utils/index.ts +0 -16
- package/dist/cjs/anyspend/types/metadata.d.ts +0 -26
- package/dist/cjs/anyspend/types/metadata.js +0 -16
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.d.ts +0 -14
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +0 -50
- package/dist/cjs/global-account/react/components/custom/Icon.d.ts +0 -7
- package/dist/cjs/global-account/react/components/custom/Icon.js +0 -52
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.d.ts +0 -4
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +0 -20
- package/dist/cjs/index.d.ts +0 -0
- package/dist/cjs/index.js +0 -2
- package/dist/esm/anyspend/types/metadata.d.ts +0 -26
- package/dist/esm/anyspend/types/metadata.js +0 -11
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.d.ts +0 -14
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +0 -44
- package/dist/esm/global-account/react/components/custom/Icon.d.ts +0 -7
- package/dist/esm/global-account/react/components/custom/Icon.js +0 -50
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.d.ts +0 -4
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +0 -17
- package/dist/esm/index.d.ts +0 -0
- package/dist/esm/index.js +0 -2
- package/dist/types/anyspend/types/metadata.d.ts +0 -26
- package/dist/types/global-account/react/components/SignInWithB3/SignIn.d.ts +0 -14
- package/dist/types/global-account/react/components/custom/Icon.d.ts +0 -7
- package/dist/types/global-account/react/components/custom/ManageAccountButton.d.ts +0 -4
- package/dist/types/index.d.ts +0 -0
- package/src/anyspend/types/metadata.ts +0 -41
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +0 -190
- package/src/global-account/react/components/custom/Icon.tsx +0 -102
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +0 -33
- package/src/index.ts +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const useB3EnsName: () => {
|
|
2
|
-
registerEns: (
|
|
2
|
+
registerEns: (username: string, message: string, hash: string) => Promise<{
|
|
3
|
+
success: boolean;
|
|
4
|
+
error?: string;
|
|
5
|
+
}>;
|
|
3
6
|
getEns: (address: string) => Promise<{
|
|
4
7
|
name: string;
|
|
5
8
|
}>;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.useB3EnsName = void 0;
|
|
7
|
+
const bsmnt_1 = __importDefault(require("../../../global-account/bsmnt"));
|
|
4
8
|
const constants_1 = require("../../../shared/constants");
|
|
9
|
+
const js_cookie_1 = __importDefault(require("js-cookie"));
|
|
5
10
|
const react_1 = require("react");
|
|
6
11
|
const useB3EnsName = () => {
|
|
7
|
-
const registerEns = async (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
message: message,
|
|
20
|
-
hash: hash
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
});
|
|
12
|
+
const registerEns = (0, react_1.useCallback)(async (username, message, hash) => {
|
|
13
|
+
if (!bsmnt_1.default.authentication.authenticated) {
|
|
14
|
+
await bsmnt_1.default.authentication.authenticate({
|
|
15
|
+
strategy: "b3-jwt",
|
|
16
|
+
accessToken: js_cookie_1.default.get(constants_1.B3_AUTH_COOKIE_NAME) || ""
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const response = await bsmnt_1.default.service("profiles").registerUsername({
|
|
20
|
+
username,
|
|
21
|
+
message,
|
|
22
|
+
hash
|
|
23
|
+
}, {});
|
|
24
24
|
return response;
|
|
25
|
-
};
|
|
26
|
-
const getEns = async (address) => {
|
|
27
|
-
const response = await fetch(
|
|
25
|
+
}, [bsmnt_1.default.authentication.authenticated]);
|
|
26
|
+
const getEns = (0, react_1.useCallback)(async (address) => {
|
|
27
|
+
const response = await fetch(`https://ens-gateway.b3.fun/address/${address}`);
|
|
28
28
|
if (!response.ok) {
|
|
29
29
|
throw new Error(`Failed to fetch ENS name: ${response.statusText}`);
|
|
30
30
|
}
|
|
31
31
|
const data = await response.json();
|
|
32
32
|
return data;
|
|
33
|
-
};
|
|
33
|
+
}, []);
|
|
34
34
|
return (0, react_1.useMemo)(() => ({
|
|
35
35
|
registerEns,
|
|
36
36
|
getEns
|
|
37
|
-
}), []);
|
|
37
|
+
}), [registerEns, getEns]);
|
|
38
38
|
};
|
|
39
39
|
exports.useB3EnsName = useB3EnsName;
|
|
@@ -40,8 +40,5 @@ exports.b3MainnetThirdWeb = exports.supportedChainsTW.find(chain => chain.id ===
|
|
|
40
40
|
exports.b3TestnetThirdWeb = exports.supportedChainsTW.find(chain => chain.id === 1993);
|
|
41
41
|
(0, invariant_1.default)(exports.b3TestnetThirdWeb, "B3 testnet chain not found in supported chains TW");
|
|
42
42
|
exports.b3Mainnet = exports.supportedChains.find(chain => chain.id === 8333);
|
|
43
|
-
(0, invariant_1.default)(exports.b3Mainnet, "B3 mainnet chain not found in supported chains");
|
|
44
43
|
exports.b3Testnet = exports.supportedChains.find(chain => chain.id === 1993);
|
|
45
|
-
(0, invariant_1.default)(exports.b3Testnet, "B3 testnet chain not found in supported chains");
|
|
46
44
|
exports.baseMainnet = exports.supportedChains.find(chain => chain.id === 8453);
|
|
47
|
-
(0, invariant_1.default)(exports.baseMainnet, "Base mainnet chain not found in supported chains");
|
|
@@ -13,4 +13,3 @@ export declare const THIRDWEB_SECRET_KEY: string;
|
|
|
13
13
|
export declare const THIRDWEB_CLIENT_ID: string;
|
|
14
14
|
export declare const CLIENT_APP_BUNDLE_ID: string;
|
|
15
15
|
export declare const B3_AUTH_COOKIE_NAME = "b3-auth";
|
|
16
|
-
export declare const ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.B3_AUTH_COOKIE_NAME = exports.CLIENT_APP_BUNDLE_ID = exports.THIRDWEB_CLIENT_ID = exports.THIRDWEB_SECRET_KEY = exports.tokenIcons = exports.ecosystemWalletId = exports.b3CoinIcon = exports.siteURL = void 0;
|
|
4
4
|
exports.siteURL = "https://basement.fun";
|
|
5
5
|
exports.b3CoinIcon = "https://cdn.b3.fun/b3-coin-3d.png";
|
|
6
6
|
exports.ecosystemWalletId = (process.env.EXPO_PUBLIC_THIRDWEB_ECOSYSTEM_ID ||
|
|
@@ -19,4 +19,3 @@ exports.THIRDWEB_SECRET_KEY = process.env.THIRDWEB_SECRET_KEY || "";
|
|
|
19
19
|
exports.THIRDWEB_CLIENT_ID = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID || process.env.EXPO_PUBLIC_THIRDWEB_CLIENT_ID || "";
|
|
20
20
|
exports.CLIENT_APP_BUNDLE_ID = process.env.EXPO_PUBLIC_B3_BUNDLE_ID || "";
|
|
21
21
|
exports.B3_AUTH_COOKIE_NAME = "b3-auth";
|
|
22
|
-
exports.ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
export declare function formatUsername(username: string): string;
|
|
2
|
-
/**
|
|
3
|
-
* Helper functions for formatting data
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Truncates a wallet address to show first 4 and last 4 characters
|
|
7
|
-
* @param address Wallet address to truncate
|
|
8
|
-
* @returns Truncated address in format "0x1234...5678"
|
|
9
|
-
*/
|
|
10
|
-
export declare const truncateAddress: (address: string) => string;
|
|
11
2
|
export * from "./cn";
|
|
@@ -14,27 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.truncateAddress = void 0;
|
|
18
17
|
exports.formatUsername = formatUsername;
|
|
19
18
|
function formatUsername(username) {
|
|
20
19
|
// Remove .b3.fun and put an @ before it
|
|
21
20
|
// Make it all lowercase
|
|
22
21
|
return `@${username.replace(".b3.fun", "").toLowerCase()}`;
|
|
23
22
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Helper functions for formatting data
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Truncates a wallet address to show first 4 and last 4 characters
|
|
29
|
-
* @param address Wallet address to truncate
|
|
30
|
-
* @returns Truncated address in format "0x1234...5678"
|
|
31
|
-
*/
|
|
32
|
-
const truncateAddress = (address) => {
|
|
33
|
-
if (!address)
|
|
34
|
-
return "";
|
|
35
|
-
if (address.length <= 9)
|
|
36
|
-
return address;
|
|
37
|
-
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
38
|
-
};
|
|
39
|
-
exports.truncateAddress = truncateAddress;
|
|
40
23
|
__exportStar(require("./cn"), exports);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NftType } from "../../anyspend/types/index.js";
|
|
2
1
|
import { base } from "viem/chains";
|
|
3
2
|
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
4
3
|
export const ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
@@ -37,8 +36,7 @@ export const NFT_CONTRACTS = [
|
|
|
37
36
|
imageUrl: "https://storage.googleapis.com/nftimagebucket/base/tokens/0x80f0e6644723abb03aa8867d21e32bd854b2a2d9/preview/TVRjME1EUTRORFl4T0E9PV8zNjcy.jpg",
|
|
38
37
|
name: "Downhill Ski",
|
|
39
38
|
description: "Downhill Ski",
|
|
40
|
-
tokenId: null
|
|
41
|
-
type: NftType.ERC721
|
|
39
|
+
tokenId: null
|
|
42
40
|
},
|
|
43
41
|
{
|
|
44
42
|
chainId: base.id,
|
|
@@ -49,8 +47,7 @@ export const NFT_CONTRACTS = [
|
|
|
49
47
|
imageUrl: "https://cdn.b3.fun/game-weapon-demo.png",
|
|
50
48
|
name: "Eclipse Venom",
|
|
51
49
|
description: "The Eclipse Venom's crystalline blade channels imprisoned astral toxins through swirling currents of violet and teal light, synchronizing with its wielder's heartbeat for strikes that bypass conventional armor. Wounds from this otherworldly weapon resist healing as victims describe being consumed from within by liquid darkness, their final moments filled with visions of infinite cosmic depths.",
|
|
52
|
-
tokenId: null
|
|
53
|
-
type: NftType.ERC721
|
|
50
|
+
tokenId: null
|
|
54
51
|
}
|
|
55
52
|
];
|
|
56
53
|
export const DEFAULT_NFT_CONTRACT = NFT_CONTRACTS[1];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { B3_TOKEN, OrderType } from "../../../anyspend/index.js";
|
|
3
|
-
import { Button, GlareCardRounded, Input, StyleRoot, TextLoop, useChainSwitchWithAction, useHasMounted, useModalStore, useTokenBalance } from "../../../global-account/react/index.js";
|
|
4
3
|
import { baseMainnet } from "../../../shared/constants/chains/supported.js";
|
|
4
|
+
import { EthIcon } from "./icons/EthIcon.js";
|
|
5
|
+
import { SolIcon } from "./icons/SolIcon.js";
|
|
6
|
+
import { UsdcIcon } from "./icons/USDCIcon.js";
|
|
7
|
+
import { StyleRoot } from "../../../global-account/react/index.js";
|
|
8
|
+
import { Button, GlareCardRounded, Input, TextLoop, useChainSwitchWithAction, useHasMounted, useTokenBalance, useModalStore } from "../../../global-account/react/index.js";
|
|
5
9
|
import { motion } from "framer-motion";
|
|
6
10
|
import invariant from "invariant";
|
|
7
11
|
import { ArrowRight, Loader2 } from "lucide-react";
|
|
@@ -10,9 +14,6 @@ import { toast } from "sonner";
|
|
|
10
14
|
import { createPublicClient, encodeFunctionData, erc20Abi, formatUnits, http } from "viem";
|
|
11
15
|
import { useAccount, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
|
|
12
16
|
import { AnySpendCustom } from "./AnySpendCustom.js";
|
|
13
|
-
import { EthIcon } from "./icons/EthIcon.js";
|
|
14
|
-
import { SolIcon } from "./icons/SolIcon.js";
|
|
15
|
-
import { UsdcIcon } from "./icons/USDCIcon.js";
|
|
16
17
|
const SPIN_WHEEL_ABI = [
|
|
17
18
|
{
|
|
18
19
|
inputs: [],
|
|
@@ -387,7 +388,6 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
387
388
|
// AnySpend flow for when user needs to swap to B3
|
|
388
389
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
389
390
|
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.Custom, dstChainId: chainId, dstToken: B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
390
|
-
type: OrderType.Custom,
|
|
391
391
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`
|
|
392
392
|
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
|
|
393
393
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetQuoteResponse, OrderType, Token } from "../../../anyspend";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare function AnySpendCustom({ isMainnet, loadOrder, mode, recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient }: {
|
|
4
4
|
isMainnet?: boolean;
|
|
@@ -12,7 +12,7 @@ export declare function AnySpendCustom({ isMainnet, loadOrder, mode, recipientAd
|
|
|
12
12
|
dstAmount: string;
|
|
13
13
|
contractAddress: string;
|
|
14
14
|
encodedData: string;
|
|
15
|
-
metadata:
|
|
15
|
+
metadata: any;
|
|
16
16
|
header: ({ anyspendPrice, isLoadingAnyspendPrice }: {
|
|
17
17
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
18
18
|
isLoadingAnyspendPrice: boolean;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { eqci, getDefaultToken,
|
|
3
|
-
import {
|
|
2
|
+
import { eqci, getDefaultToken, NftType, OrderStatus, OrderType, RELAY_ETH_ADDRESS, USDC_BASE, useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useGeoOnrampOptions } from "../../../anyspend/index.js";
|
|
3
|
+
import { useB3, StyleRoot } from "../../../global-account/react/index.js";
|
|
4
|
+
import { Badge, Button, ShinyButton, Skeleton, Tabs, TabsContent, TabsList, TabTrigger, useAccountWallet, useBsmntProfile, useHasMounted, useRouter, useTokenBalancesByChain, useModalStore, useSearchParamsSSR } from "../../../global-account/react/index.js";
|
|
5
|
+
import { TextShimmer } from "../../../global-account/react/index.js";
|
|
6
|
+
import { TransitionPanel } from "../../../global-account/react/index.js";
|
|
4
7
|
import { cn } from "../../../shared/utils/index.js";
|
|
5
8
|
import centerTruncate from "../../../shared/utils/centerTruncate.js";
|
|
6
9
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
@@ -23,7 +26,7 @@ var PanelView;
|
|
|
23
26
|
PanelView[PanelView["ORDER_DETAILS"] = 2] = "ORDER_DETAILS";
|
|
24
27
|
PanelView[PanelView["LOADING"] = 3] = "LOADING";
|
|
25
28
|
})(PanelView || (PanelView = {}));
|
|
26
|
-
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress,
|
|
29
|
+
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress, encodedData, spenderAddress }) {
|
|
27
30
|
switch (orderType) {
|
|
28
31
|
case OrderType.MintNFT: {
|
|
29
32
|
return {
|
|
@@ -33,9 +36,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
33
36
|
dstChain: dstChainId,
|
|
34
37
|
dstTokenAddress: dstToken.address,
|
|
35
38
|
price: dstAmount,
|
|
36
|
-
contractAddress: contractAddress
|
|
37
|
-
tokenId: tokenId,
|
|
38
|
-
contractType: contractType
|
|
39
|
+
contractAddress: contractAddress
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
case OrderType.JoinTournament: {
|
|
@@ -159,8 +160,6 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
|
|
|
159
160
|
dstToken: dstToken,
|
|
160
161
|
dstAmount: dstAmount,
|
|
161
162
|
contractAddress: contractAddress,
|
|
162
|
-
tokenId: isNftMetadata(metadata) ? metadata.nftContract.tokenId : undefined,
|
|
163
|
-
contractType: isNftMetadata(metadata) ? metadata.nftContract.type : undefined,
|
|
164
163
|
encodedData: encodedData,
|
|
165
164
|
spenderAddress: spenderAddress
|
|
166
165
|
});
|
|
@@ -240,35 +239,21 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
|
|
|
240
239
|
srcAmount: srcAmount.toString(),
|
|
241
240
|
recipientAddress,
|
|
242
241
|
creatorAddress: currentWallet?.wallet?.address,
|
|
243
|
-
nft:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
: {
|
|
253
|
-
type: NftType.ERC721,
|
|
254
|
-
contractAddress: metadata.nftContract.contractAddress,
|
|
255
|
-
contractType: metadata.nftContract.type,
|
|
256
|
-
nftPrice: dstAmount
|
|
257
|
-
}
|
|
258
|
-
: undefined,
|
|
259
|
-
tournament: isTournamentMetadata(metadata)
|
|
260
|
-
? {
|
|
261
|
-
...metadata.tournament,
|
|
262
|
-
contractAddress: contractAddress,
|
|
263
|
-
entryPriceOrFundAmount: dstAmount
|
|
264
|
-
}
|
|
265
|
-
: undefined,
|
|
242
|
+
nft: {
|
|
243
|
+
...metadata.nftContract,
|
|
244
|
+
type: NftType.ERC721
|
|
245
|
+
},
|
|
246
|
+
tournament: {
|
|
247
|
+
...metadata.tournament,
|
|
248
|
+
contractAddress: contractAddress,
|
|
249
|
+
entryPriceOrFundAmount: dstAmount
|
|
250
|
+
},
|
|
266
251
|
payload: {
|
|
267
252
|
amount: dstAmount,
|
|
268
253
|
data: encodedData,
|
|
269
254
|
spenderAddress: spenderAddress,
|
|
270
255
|
to: contractAddress,
|
|
271
|
-
action:
|
|
256
|
+
action: metadata.action
|
|
272
257
|
}
|
|
273
258
|
};
|
|
274
259
|
if (onramp) {
|
|
@@ -365,26 +350,9 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
|
|
|
365
350
|
opacity: hasMounted ? 1 : 0,
|
|
366
351
|
y: hasMounted ? 0 : 20,
|
|
367
352
|
filter: hasMounted ? "blur(0px)" : "blur(10px)"
|
|
368
|
-
}, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Loading quote..." })] })) : anyspendQuote ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Checkout" }), _jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), _jsx(TabsContent, { value: "fiat", children: _jsx("div", { className: "mt-6 flex w-full flex-col gap-6", children: _jsx(PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft:
|
|
369
|
-
? metadata.
|
|
370
|
-
|
|
371
|
-
type: NftType.ERC1155,
|
|
372
|
-
contractAddress: metadata.nftContract.contractAddress,
|
|
373
|
-
tokenId: metadata.nftContract.tokenId,
|
|
374
|
-
imageUrl: metadata.nftContract.imageUrl,
|
|
375
|
-
name: metadata.nftContract.name,
|
|
376
|
-
description: metadata.nftContract.description,
|
|
377
|
-
price: dstAmount
|
|
378
|
-
}
|
|
379
|
-
: {
|
|
380
|
-
type: NftType.ERC721,
|
|
381
|
-
contractAddress: metadata.nftContract.contractAddress,
|
|
382
|
-
name: metadata.nftContract.name,
|
|
383
|
-
description: metadata.nftContract.description,
|
|
384
|
-
imageUrl: metadata.nftContract.imageUrl,
|
|
385
|
-
price: dstAmount
|
|
386
|
-
}
|
|
387
|
-
: undefined, payload: isCustomTxMetadata(metadata)
|
|
353
|
+
}, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Loading quote..." })] })) : anyspendQuote ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Checkout" }), _jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), _jsx(TabsContent, { value: "fiat", children: _jsx("div", { className: "mt-6 flex w-full flex-col gap-6", children: _jsx(PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.nftContract ? { ...metadata.nftContract, price: dstAmount } : undefined, tournament: metadata.tournament
|
|
354
|
+
? { ...metadata.tournament, contractAddress: contractAddress, entryPriceOrFundAmount: dstAmount }
|
|
355
|
+
: undefined, payload: metadata.action
|
|
388
356
|
? {
|
|
389
357
|
...metadata,
|
|
390
358
|
amount: dstAmount,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NftContract } from "../../../anyspend/types";
|
|
2
|
-
export declare function AnySpendNFT({ isMainnet, loadOrder, mode, recipientAddress, nftContract
|
|
2
|
+
export declare function AnySpendNFT({ isMainnet, loadOrder, mode, recipientAddress, nftContract }: {
|
|
3
3
|
isMainnet?: boolean;
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
recipientAddress?: string;
|
|
7
|
-
nftContract
|
|
8
|
-
onSuccess?: (txHash?: string) => void;
|
|
7
|
+
nftContract?: NftContract;
|
|
9
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ALL_CHAINS, getChainName, getExplorerAddressUrl, OrderType } from "../../../anyspend/index.js";
|
|
3
|
+
import { DEFAULT_NFT_CONTRACT } from "../../../anyspend/constants/index.js";
|
|
3
4
|
import { GlareCard, Popover, PopoverContent, PopoverTrigger } from "../../../global-account/react/index.js";
|
|
4
5
|
import { cn } from "../../../shared/utils/index.js";
|
|
5
6
|
import { getIpfsUrl } from "../../../shared/utils/ipfs.js";
|
|
@@ -9,14 +10,11 @@ import { MoreVertical } from "lucide-react";
|
|
|
9
10
|
import { useState } from "react";
|
|
10
11
|
import { b3 } from "viem/chains";
|
|
11
12
|
import { AnySpendCustom } from "./AnySpendCustom.js";
|
|
12
|
-
export function AnySpendNFT({ isMainnet = true, loadOrder, mode = "modal", recipientAddress, nftContract
|
|
13
|
+
export function AnySpendNFT({ isMainnet = true, loadOrder, mode = "modal", recipientAddress, nftContract = DEFAULT_NFT_CONTRACT }) {
|
|
13
14
|
const header = ({ anyspendPrice, isLoadingAnyspendPrice }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative size-[200px]", children: [_jsx("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), _jsxs(GlareCard, { className: "overflow-hidden", children: [_jsx("img", { src: getIpfsUrl(nftContract.imageUrl), alt: nftContract.name, className: "size-full object-cover" }), _jsx("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), _jsx(DropdownMenu, { nftContract: nftContract })] }), _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[100px] w-full" }), _jsxs("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [_jsx("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), _jsx("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? (_jsx(AnimatePresence, { mode: "wait", children: _jsx("div", { className: cn("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
|
|
14
15
|
"opacity-0": isLoadingAnyspendPrice
|
|
15
16
|
}), children: formatDisplayNumber(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : (_jsx("div", { className: "h-[36px] w-full" })) })] })] })] }));
|
|
16
|
-
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.MintNFT, dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
17
|
-
type: OrderType.MintNFT,
|
|
18
|
-
nftContract: nftContract
|
|
19
|
-
}, header: header, onSuccess: onSuccess }));
|
|
17
|
+
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.MintNFT, dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: { nftContract }, header: header }));
|
|
20
18
|
}
|
|
21
19
|
function DropdownMenu({ nftContract }) {
|
|
22
20
|
const [open, setOpen] = useState(false);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ABI_ERC20_STAKING, B3_TOKEN, OrderType } from "../../../anyspend/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EthIcon } from "./icons/EthIcon.js";
|
|
4
|
+
import { SolIcon } from "./icons/SolIcon.js";
|
|
5
|
+
import { UsdcIcon } from "./icons/USDCIcon.js";
|
|
6
|
+
import { Button, GlareCardRounded, Input, TextLoop, useHasMounted, useModalStore, useChainSwitchWithAction, useTokenBalance, StyleRoot } from "../../../global-account/react/index.js";
|
|
4
7
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
5
8
|
import { motion } from "framer-motion";
|
|
6
9
|
import invariant from "invariant";
|
|
@@ -11,9 +14,6 @@ import { createPublicClient, encodeFunctionData, erc20Abi, http } from "viem";
|
|
|
11
14
|
import { base } from "viem/chains";
|
|
12
15
|
import { useAccount, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
|
|
13
16
|
import { AnySpendCustom } from "./AnySpendCustom.js";
|
|
14
|
-
import { EthIcon } from "./icons/EthIcon.js";
|
|
15
|
-
import { SolIcon } from "./icons/SolIcon.js";
|
|
16
|
-
import { UsdcIcon } from "./icons/USDCIcon.js";
|
|
17
17
|
const basePublicClient = createPublicClient({
|
|
18
18
|
chain: base,
|
|
19
19
|
transport: http()
|
|
@@ -250,7 +250,6 @@ export function AnySpendStakeB3({ isMainnet = true, loadOrder, mode = "modal", r
|
|
|
250
250
|
}
|
|
251
251
|
const encodedData = generateEncodedDataForStakingB3(userStakeAmount, recipientAddress);
|
|
252
252
|
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.Custom, dstChainId: base.id, dstToken: B3_TOKEN, dstAmount: userStakeAmount, contractAddress: ERC20Staking, encodedData: encodedData, metadata: {
|
|
253
|
-
type: OrderType.Custom,
|
|
254
253
|
action: "stake B3"
|
|
255
254
|
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
256
255
|
}
|
|
@@ -11,8 +11,5 @@ export function AnySpendTournament(props) {
|
|
|
11
11
|
const header = ({ anyspendPrice, isLoadingAnyspendPrice }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: "z-10 mt-[-100px] flex h-[270px] w-full items-end justify-center", children: _jsx("img", { src: "https://cdn.b3.fun/tournament-play.svg", alt: "Tournament Play", className: "h-[200px] w-[360px] object-cover object-center" }) }), _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[100px] w-full" }), _jsxs("div", { className: "flex w-full flex-col items-center gap-1 p-6 pt-0", children: [_jsxs("span", { className: "font-sf-rounded text-center text-lg font-semibold", children: [action === "join" ? "Pay entry fee to join " : "Pay to fund ", " ", tournamentMetadata.name] }), _jsx("div", { className: "mt-2 flex w-fit items-center gap-1", children: anyspendPrice ? (_jsx(AnimatePresence, { mode: "wait", children: _jsxs("div", { className: cn("text-as-primary group flex items-center text-2xl font-semibold transition-all", {
|
|
12
12
|
"opacity-0": isLoadingAnyspendPrice
|
|
13
13
|
}), children: [formatDisplayNumber(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }), " (", formatTokenAmount(BigInt(dstAmount), dstToken.decimals, 6, true), " ", dstToken.symbol, ")"] }) })) : (_jsx("div", { className: "h-[32px] w-full" })) })] })] })] }));
|
|
14
|
-
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? OrderType.JoinTournament : OrderType.FundTournament, dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: {
|
|
15
|
-
type: action === "join" ? OrderType.JoinTournament : OrderType.FundTournament,
|
|
16
|
-
tournament: tournamentMetadata
|
|
17
|
-
}, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
|
|
14
|
+
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? OrderType.JoinTournament : OrderType.FundTournament, dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: { tournament: tournamentMetadata }, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
|
|
18
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ALL_CHAINS, capitalizeFirstLetter, EVM_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, OrderStatus, OrderType, RELAY_ETH_ADDRESS, zNft, zToken, zTournament } from "../../../../anyspend/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CopyToClipboard, Badge, ShinyButton, Skeleton, TextLoop, TextShimmer, Button, useAccountWallet, useChainSwitchWithAction, useOnchainName, useModalStore } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { cn } from "../../../../shared/utils/index.js";
|
|
6
6
|
import centerTruncate from "../../../../shared/utils/centerTruncate.js";
|
|
7
7
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
@@ -217,7 +217,7 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
|
|
|
217
217
|
};
|
|
218
218
|
// When waitingForDeposit is true, we show a message to the user to wait for the deposit to be processed.
|
|
219
219
|
const setWaitingForDeposit = useCallback(() => {
|
|
220
|
-
const params = new URLSearchParams(searchParams
|
|
220
|
+
const params = new URLSearchParams(searchParams);
|
|
221
221
|
params.set("waitingForDeposit", "true");
|
|
222
222
|
router.push(`?${params}`);
|
|
223
223
|
}, [router, searchParams]);
|
|
@@ -338,7 +338,7 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
|
|
|
338
338
|
toast.success("Copied to clipboard");
|
|
339
339
|
}, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("strong", { className: "border-as-brand text-as-primary border-b-2 pb-1 text-2xl font-semibold sm:text-xl", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "text-as-primary/50 hover:text-as-primary h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), _jsxs(Badge, { variant: "outline", className: "flex h-10 items-center gap-2 px-3 py-1 pr-2 text-sm", children: ["on ", getChainName(order.srcChain), _jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") })] })] }), _jsx("span", { className: "text-as-primary/50 mb-1 mt-2", children: " to the address:" })] }), _jsx(CopyToClipboard, { text: order.globalAddress, onCopy: () => {
|
|
340
340
|
toast.success("Copied to clipboard");
|
|
341
|
-
}, children: _jsxs("div", { className: "bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), account?.address && !showQRCode ? (_jsxs("div", { className: "mb-4 mt-8 flex w-full flex-col items-center gap-4", children: [_jsxs("div", { className: "relative flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: handlePayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to: ", centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] })) : (_jsxs(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: [_jsxs("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress),
|
|
341
|
+
}, children: _jsxs("div", { className: "bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), account?.address && !showQRCode ? (_jsxs("div", { className: "mb-4 mt-8 flex w-full flex-col items-center gap-4", children: [_jsxs("div", { className: "relative flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: handlePayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to: ", centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] })) : (_jsxs(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: [_jsxs("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress), size: 200 }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" })] })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [account && (_jsxs(Button, { variant: "ghost", className: "text-as-primary w-full", onClick: handlePayment, children: ["Send Transaction ", _jsx(ChevronRight, { className: "ml-2 h-4 w-4" })] })), EVM_CHAINS[order.srcChain] ? (_jsxs(Button, { variant: "outline", className: "w-full", onClick: handlePayment, children: ["Open Metamask", _jsx(WalletMetamask, { className: "ml-2 h-5 w-5", variant: "branded" })] })) : null, _jsx("a", { href: handleCoinbaseRedirect(), children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Open Coinbase", _jsx(WalletCoinbase, { className: "ml-2 h-5 w-5", variant: "branded" })] }) }), _jsx("a", { href: handlePhantomRedirect(), children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Open Phantom", _jsx(WalletPhantom, { className: "ml-2 h-5 w-5", variant: "branded" })] }) })] })] }))] })), _jsxs("div", { className: "bg-as-light-brand/30 w-full rounded-lg p-4 sm:p-2 sm:px-4", children: [_jsx("p", { className: "text-as-secondary mb-3 text-sm", children: "Continue on another device?" }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(CopyToClipboard, { text: permalink, onCopy: () => {
|
|
342
342
|
toast.success("Copied to clipboard");
|
|
343
343
|
}, children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Copy Link", _jsx(Copy, { className: "ml-2 h-3 w-3" })] }) }), _jsxs(Button, { variant: "outline", className: "w-full", onClick: () => {
|
|
344
344
|
if (navigator.share) {
|
|
@@ -130,8 +130,6 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
|
|
|
130
130
|
} | null;
|
|
131
131
|
payload: {
|
|
132
132
|
contractAddress: string;
|
|
133
|
-
tokenId: number | null;
|
|
134
|
-
contractType: import("../../../anyspend/types").NftType;
|
|
135
133
|
nftPrice: string;
|
|
136
134
|
};
|
|
137
135
|
} | {
|
|
@@ -490,8 +488,6 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
|
|
|
490
488
|
} | null;
|
|
491
489
|
payload: {
|
|
492
490
|
contractAddress: string;
|
|
493
|
-
tokenId: number | null;
|
|
494
|
-
contractType: import("../../../anyspend/types").NftType;
|
|
495
491
|
nftPrice: string;
|
|
496
492
|
};
|
|
497
493
|
} | {
|
|
@@ -127,8 +127,6 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
|
|
|
127
127
|
} | null;
|
|
128
128
|
payload: {
|
|
129
129
|
contractAddress: string;
|
|
130
|
-
tokenId: number | null;
|
|
131
|
-
contractType: import("../..").NftType;
|
|
132
130
|
nftPrice: string;
|
|
133
131
|
};
|
|
134
132
|
} | {
|
|
@@ -451,8 +449,6 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
|
|
|
451
449
|
} | null;
|
|
452
450
|
payload: {
|
|
453
451
|
contractAddress: string;
|
|
454
|
-
tokenId: number | null;
|
|
455
|
-
contractType: import("../..").NftType;
|
|
456
452
|
nftPrice: string;
|
|
457
453
|
};
|
|
458
454
|
} | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OnrampOptions } from "../../anyspend/react";
|
|
2
1
|
import { GetOrderAndTxsResponse, GetQuoteRequest, GetQuoteResponse, SendPermitDataRequestBody, Token } from "../../anyspend/types";
|
|
2
|
+
import { OnrampOptions } from "../../anyspend/react";
|
|
3
3
|
export declare const anyspendService: {
|
|
4
4
|
getTokenList: (isMainnet: boolean, chainId: number, query: string) => Promise<Token[]>;
|
|
5
5
|
getToken: (isMainnet: boolean, chainId: number, tokenAddress: string) => Promise<Token>;
|
|
@@ -150,8 +150,6 @@ export declare const anyspendService: {
|
|
|
150
150
|
} | null;
|
|
151
151
|
payload: {
|
|
152
152
|
contractAddress: string;
|
|
153
|
-
tokenId: number | null;
|
|
154
|
-
contractType: import("../../anyspend/types").NftType;
|
|
155
153
|
nftPrice: string;
|
|
156
154
|
};
|
|
157
155
|
} | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ANYSPEND_MAINNET_BASE_URL, ANYSPEND_TESTNET_BASE_URL } from "../../anyspend/constants/index.js";
|
|
2
1
|
import { zGetCoinbaseOnrampOptionsResponse, zGetOrderAndTxsResponse, zGetOrderHistoryResponse, zGetTokenListResponse } from "../../anyspend/types/index.js";
|
|
3
2
|
import { getNativeToken, isNativeToken } from "../../anyspend/utils/index.js";
|
|
4
3
|
import invariant from "invariant";
|
|
4
|
+
import { ANYSPEND_MAINNET_BASE_URL, ANYSPEND_TESTNET_BASE_URL } from "../../anyspend/constants/index.js";
|
|
5
5
|
// Service functions
|
|
6
6
|
export const anyspendService = {
|
|
7
7
|
getTokenList: async (isMainnet, chainId, query) => {
|
|
@@ -68,18 +68,12 @@ export declare const zNft: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
68
68
|
export type Nft = z.infer<typeof zNft>;
|
|
69
69
|
export declare const zMintNftPayload: z.ZodObject<{
|
|
70
70
|
contractAddress: z.ZodString;
|
|
71
|
-
tokenId: z.ZodNullable<z.ZodNumber>;
|
|
72
|
-
contractType: z.ZodNativeEnum<typeof NftType>;
|
|
73
71
|
nftPrice: z.ZodString;
|
|
74
72
|
}, "strip", z.ZodTypeAny, {
|
|
75
73
|
contractAddress: string;
|
|
76
|
-
tokenId: number | null;
|
|
77
|
-
contractType: NftType;
|
|
78
74
|
nftPrice: string;
|
|
79
75
|
}, {
|
|
80
76
|
contractAddress: string;
|
|
81
|
-
tokenId: number | null;
|
|
82
|
-
contractType: NftType;
|
|
83
77
|
nftPrice: string;
|
|
84
78
|
}>;
|
|
85
79
|
export declare const zMintNftMetadata: z.ZodObject<{
|
|
@@ -270,5 +264,4 @@ export interface NftContract {
|
|
|
270
264
|
name: string;
|
|
271
265
|
description: string;
|
|
272
266
|
tokenId: number | null;
|
|
273
|
-
type: NftType;
|
|
274
267
|
}
|
|
@@ -24,8 +24,6 @@ export const zNft = z.discriminatedUnion("type", [
|
|
|
24
24
|
]);
|
|
25
25
|
export const zMintNftPayload = z.object({
|
|
26
26
|
contractAddress: z.string(),
|
|
27
|
-
tokenId: z.number().nullable(),
|
|
28
|
-
contractType: z.nativeEnum(NftType),
|
|
29
27
|
nftPrice: z.string()
|
|
30
28
|
});
|
|
31
29
|
export const zMintNftMetadata = z.object({
|