@b3dotfun/sdk 0.0.5-alpha.4 → 0.0.5-alpha.6
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 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useB3EnsName.js +2 -2
- package/dist/esm/anyspend/constants/index.js +2 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useB3EnsName.js +3 -3
- package/dist/types/global-account/react/hooks/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/anyspend/README.md +2 -11
- package/src/anyspend/constants/index.ts +2 -4
- package/src/global-account/react/hooks/index.ts +2 -1
- package/src/global-account/react/hooks/useB3EnsName.ts +9 -5
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.USDC_BASE = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.RELAY_ETH_ADDRESS = exports.ANYSPEND_TESTNET_BASE_URL = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
4
4
|
const chains_1 = require("viem/chains");
|
|
5
|
-
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://
|
|
6
|
-
exports.ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://
|
|
5
|
+
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
6
|
+
exports.ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
7
7
|
exports.RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
8
8
|
exports.RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
9
9
|
exports.RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
@@ -3,13 +3,14 @@ export { useAccountWallet } from "./useAccountWallet";
|
|
|
3
3
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
4
4
|
export { useAuthentication } from "./useAuthentication";
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
|
+
export { useB3EnsName } from "./useB3EnsName";
|
|
6
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
7
8
|
export { useBsmntProfile } from "./useBsmntProfile";
|
|
8
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
9
10
|
export { useClaim } from "./useClaim";
|
|
10
11
|
export { useConnect } from "./useConnect";
|
|
11
12
|
export { useExchangeRate } from "./useExchangeRate";
|
|
12
|
-
export { type TWSignerWithMetadata
|
|
13
|
+
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
13
14
|
export { useGetGeo } from "./useGetGeo";
|
|
14
15
|
export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
|
|
15
16
|
export { useHasMounted } from "./useHasMounted";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useOneBalance = exports.useOnchainName = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useClaim = exports.useChainSwitchWithAction = exports.useBsmntProfile = exports.useBestTransactionPath = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
|
|
3
|
+
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useOneBalance = exports.useOnchainName = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useClaim = exports.useChainSwitchWithAction = exports.useBsmntProfile = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
|
|
4
4
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
5
5
|
Object.defineProperty(exports, "useAccountAssets", { enumerable: true, get: function () { return useAccountAssets_1.useAccountAssets; } });
|
|
6
6
|
var useAccountWallet_1 = require("./useAccountWallet");
|
|
@@ -11,6 +11,8 @@ var useAuthentication_1 = require("./useAuthentication");
|
|
|
11
11
|
Object.defineProperty(exports, "useAuthentication", { enumerable: true, get: function () { return useAuthentication_1.useAuthentication; } });
|
|
12
12
|
var useB3BalanceFromAddresses_1 = require("./useB3BalanceFromAddresses");
|
|
13
13
|
Object.defineProperty(exports, "useB3BalanceFromAddresses", { enumerable: true, get: function () { return useB3BalanceFromAddresses_1.useB3BalanceFromAddresses; } });
|
|
14
|
+
var useB3EnsName_1 = require("./useB3EnsName");
|
|
15
|
+
Object.defineProperty(exports, "useB3EnsName", { enumerable: true, get: function () { return useB3EnsName_1.useB3EnsName; } });
|
|
14
16
|
var useBestTransactionPath_1 = require("./useBestTransactionPath");
|
|
15
17
|
Object.defineProperty(exports, "useBestTransactionPath", { enumerable: true, get: function () { return useBestTransactionPath_1.useBestTransactionPath; } });
|
|
16
18
|
var useBsmntProfile_1 = require("./useBsmntProfile");
|
|
@@ -31,9 +31,9 @@ const useB3EnsName = () => {
|
|
|
31
31
|
const data = await response.json();
|
|
32
32
|
return data;
|
|
33
33
|
}, []);
|
|
34
|
-
return {
|
|
34
|
+
return (0, react_1.useMemo)(() => ({
|
|
35
35
|
registerEns,
|
|
36
36
|
getEns
|
|
37
|
-
};
|
|
37
|
+
}), [registerEns, getEns]);
|
|
38
38
|
};
|
|
39
39
|
exports.useB3EnsName = useB3EnsName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { base } from "viem/chains";
|
|
2
|
-
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://
|
|
3
|
-
export const ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://
|
|
2
|
+
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
3
|
+
export const ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
4
4
|
export const RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
5
5
|
export const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
6
6
|
export const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
@@ -3,13 +3,14 @@ export { useAccountWallet } from "./useAccountWallet";
|
|
|
3
3
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
4
4
|
export { useAuthentication } from "./useAuthentication";
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
|
+
export { useB3EnsName } from "./useB3EnsName";
|
|
6
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
7
8
|
export { useBsmntProfile } from "./useBsmntProfile";
|
|
8
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
9
10
|
export { useClaim } from "./useClaim";
|
|
10
11
|
export { useConnect } from "./useConnect";
|
|
11
12
|
export { useExchangeRate } from "./useExchangeRate";
|
|
12
|
-
export { type TWSignerWithMetadata
|
|
13
|
+
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
13
14
|
export { useGetGeo } from "./useGetGeo";
|
|
14
15
|
export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
|
|
15
16
|
export { useHasMounted } from "./useHasMounted";
|
|
@@ -3,6 +3,7 @@ export { useAccountWallet } from "./useAccountWallet.js";
|
|
|
3
3
|
export { useAddTWSessionKey } from "./useAddTWSessionKey.js";
|
|
4
4
|
export { useAuthentication } from "./useAuthentication.js";
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses.js";
|
|
6
|
+
export { useB3EnsName } from "./useB3EnsName.js";
|
|
6
7
|
export { useBestTransactionPath } from "./useBestTransactionPath.js";
|
|
7
8
|
export { useBsmntProfile } from "./useBsmntProfile.js";
|
|
8
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import bsmntApp from "../../../global-account/bsmnt.js";
|
|
2
2
|
import { B3_AUTH_COOKIE_NAME } from "../../../shared/constants/index.js";
|
|
3
3
|
import Cookies from "js-cookie";
|
|
4
|
-
import { useCallback } from "react";
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
5
5
|
export const useB3EnsName = () => {
|
|
6
6
|
const registerEns = useCallback(async (username, message, hash) => {
|
|
7
7
|
if (!bsmntApp.authentication.authenticated) {
|
|
@@ -25,8 +25,8 @@ export const useB3EnsName = () => {
|
|
|
25
25
|
const data = await response.json();
|
|
26
26
|
return data;
|
|
27
27
|
}, []);
|
|
28
|
-
return {
|
|
28
|
+
return useMemo(() => ({
|
|
29
29
|
registerEns,
|
|
30
30
|
getEns
|
|
31
|
-
};
|
|
31
|
+
}), [registerEns, getEns]);
|
|
32
32
|
};
|
|
@@ -3,13 +3,14 @@ export { useAccountWallet } from "./useAccountWallet";
|
|
|
3
3
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
4
4
|
export { useAuthentication } from "./useAuthentication";
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
|
+
export { useB3EnsName } from "./useB3EnsName";
|
|
6
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
7
8
|
export { useBsmntProfile } from "./useBsmntProfile";
|
|
8
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
9
10
|
export { useClaim } from "./useClaim";
|
|
10
11
|
export { useConnect } from "./useConnect";
|
|
11
12
|
export { useExchangeRate } from "./useExchangeRate";
|
|
12
|
-
export { type TWSignerWithMetadata
|
|
13
|
+
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
13
14
|
export { useGetGeo } from "./useGetGeo";
|
|
14
15
|
export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
|
|
15
16
|
export { useHasMounted } from "./useHasMounted";
|
package/package.json
CHANGED
package/src/anyspend/README.md
CHANGED
|
@@ -300,21 +300,12 @@ const order = await anyspendService.createOrder({
|
|
|
300
300
|
});
|
|
301
301
|
```
|
|
302
302
|
|
|
303
|
-
## 🔧 Environment Configuration
|
|
304
|
-
|
|
305
|
-
### Environment Variables
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
# Optional: Custom AnySpend API endpoints
|
|
309
|
-
NEXT_PUBLIC_ANYSPEND_BASE_URL=https://your-custom-anyspend-api.com
|
|
310
|
-
```
|
|
311
|
-
|
|
312
303
|
### Network Configuration
|
|
313
304
|
|
|
314
305
|
AnySpend automatically configures API endpoints based on the `isMainnet` parameter:
|
|
315
306
|
|
|
316
|
-
- **Mainnet**: `https://
|
|
317
|
-
- **Testnet**: `
|
|
307
|
+
- **Mainnet**: `https://mainnet.anyspend.com`
|
|
308
|
+
- **Testnet**: `http://testnet.anyspend.com`
|
|
318
309
|
|
|
319
310
|
## 💼 Common Use Cases
|
|
320
311
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { NftContract, Token } from "@b3dotfun/sdk/anyspend/types";
|
|
2
2
|
import { base } from "viem/chains";
|
|
3
3
|
|
|
4
|
-
export const ANYSPEND_MAINNET_BASE_URL =
|
|
5
|
-
|
|
6
|
-
export const ANYSPEND_TESTNET_BASE_URL =
|
|
7
|
-
process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://anyspend-testnet.up.railway.app";
|
|
4
|
+
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
5
|
+
export const ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
8
6
|
|
|
9
7
|
export const RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
10
8
|
export const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
@@ -3,13 +3,14 @@ export { useAccountWallet } from "./useAccountWallet";
|
|
|
3
3
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
4
4
|
export { useAuthentication } from "./useAuthentication";
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
|
+
export { useB3EnsName } from "./useB3EnsName";
|
|
6
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
7
8
|
export { useBsmntProfile } from "./useBsmntProfile";
|
|
8
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
9
10
|
export { useClaim } from "./useClaim";
|
|
10
11
|
export { useConnect } from "./useConnect";
|
|
11
12
|
export { useExchangeRate } from "./useExchangeRate";
|
|
12
|
-
export { type TWSignerWithMetadata
|
|
13
|
+
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
13
14
|
export { useGetGeo } from "./useGetGeo";
|
|
14
15
|
export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
|
|
15
16
|
export { useHasMounted } from "./useHasMounted";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import bsmntApp from "@b3dotfun/sdk/global-account/bsmnt";
|
|
2
2
|
import { B3_AUTH_COOKIE_NAME } from "@b3dotfun/sdk/shared/constants";
|
|
3
3
|
import Cookies from "js-cookie";
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { useCallback, useMemo } from "react";
|
|
5
6
|
|
|
6
7
|
export const useB3EnsName = () => {
|
|
7
8
|
const registerEns = useCallback(
|
|
@@ -38,8 +39,11 @@ export const useB3EnsName = () => {
|
|
|
38
39
|
return data as { name: string };
|
|
39
40
|
}, []);
|
|
40
41
|
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
return useMemo(
|
|
43
|
+
() => ({
|
|
44
|
+
registerEns,
|
|
45
|
+
getEns
|
|
46
|
+
}),
|
|
47
|
+
[registerEns, getEns]
|
|
48
|
+
);
|
|
45
49
|
};
|