@b3dotfun/sdk 0.1.70-alpha.18 → 0.1.70-alpha.19
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/README.md +3 -3
- package/dist/cjs/anyspend/constants/rpc.d.ts +1 -0
- package/dist/cjs/anyspend/constants/rpc.js +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +14 -12
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +32 -13
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +32 -10
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +16 -8
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +4 -5
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/utils/chain.d.ts +45 -0
- package/dist/cjs/anyspend/utils/chain.js +51 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +4 -5
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +23 -15
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +8 -6
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +17 -8
- package/dist/cjs/global-account/react/components/Send/Send.js +15 -11
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/index.js +7 -8
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -0
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/cjs/global-account/react/hooks/useFirstEOA.js +1 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioBalance.js +76 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.js +178 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +24 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +4 -4
- package/dist/cjs/shared/constants/index.d.ts +4 -0
- package/dist/cjs/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/cjs/shared/utils/zerionPositions.js +186 -0
- package/dist/cjs/wallet/utils/createWalletConfig.d.ts +2 -2
- package/dist/esm/anyspend/constants/rpc.d.ts +1 -0
- package/dist/esm/anyspend/constants/rpc.js +2 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +15 -13
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +33 -14
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +33 -11
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +18 -10
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +6 -7
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/utils/chain.d.ts +45 -0
- package/dist/esm/anyspend/utils/chain.js +50 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +4 -5
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +24 -16
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +9 -7
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +18 -9
- package/dist/esm/global-account/react/components/Send/Send.js +16 -12
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/index.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/useAuth.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -0
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/esm/global-account/react/hooks/useFirstEOA.js +1 -0
- package/dist/esm/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/esm/global-account/react/hooks/usePortfolioBalance.js +72 -0
- package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.js +175 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +2 -2
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +24 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +4 -4
- package/dist/esm/shared/constants/index.d.ts +4 -0
- package/dist/esm/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/esm/shared/utils/zerionPositions.js +178 -0
- package/dist/esm/wallet/utils/createWalletConfig.d.ts +2 -2
- package/dist/types/anyspend/constants/rpc.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/anyspend/utils/chain.d.ts +45 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/types/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/types/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/types/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +2 -2
- package/dist/types/shared/constants/chains/b3Chain.d.ts +24 -0
- package/dist/types/shared/constants/chains/supported.d.ts +4 -4
- package/dist/types/shared/constants/index.d.ts +4 -0
- package/dist/types/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/types/wallet/utils/createWalletConfig.d.ts +2 -2
- package/node_modules/@b3/chain-registry/chains.json +29 -1
- package/node_modules/@b3/chain-registry/package.json +18 -2
- package/package.json +2 -2
- package/src/anyspend/README.md +2 -2
- package/src/anyspend/constants/rpc.ts +2 -0
- package/src/anyspend/docs/components.md +6 -6
- package/src/anyspend/docs/contributing.md +1 -1
- package/src/anyspend/docs/hooks.md +3 -3
- package/src/anyspend/docs/installation.md +2 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +26 -19
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +55 -14
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +55 -11
- package/src/anyspend/react/components/__tests__/QRDeposit.test.tsx +3 -4
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +25 -12
- package/src/anyspend/react/components/common/TokenBalance.tsx +10 -7
- package/src/anyspend/utils/__tests__/deprecatedChains.test.ts +44 -0
- package/src/anyspend/utils/__tests__/toRegistryChainId.test.ts +17 -0
- package/src/anyspend/utils/chain.ts +53 -2
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -3
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +4 -11
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +50 -21
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +5 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -6
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +22 -9
- package/src/global-account/react/components/Send/Send.tsx +39 -15
- package/src/global-account/react/hooks/index.ts +2 -2
- package/src/global-account/react/hooks/useAuth.ts +3 -2
- package/src/global-account/react/hooks/useAuthentication.ts +3 -2
- package/src/global-account/react/hooks/useFirstEOA.tsx +9 -2
- package/src/global-account/react/hooks/usePortfolioBalance.ts +89 -0
- package/src/global-account/react/hooks/usePortfolioCollectibles.ts +212 -0
- package/src/global-account/react/stores/useModalStore.ts +0 -2
- package/src/shared/constants/index.ts +8 -0
- package/src/shared/utils/__tests__/zerionPositions.test.ts +226 -0
- package/src/shared/utils/zerionPositions.ts +244 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +0 -98
- package/dist/cjs/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/cjs/global-account/react/hooks/useSimCollectibles.js +0 -190
- package/dist/cjs/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/cjs/global-account/react/utils/simdune.js +0 -21
- package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/esm/global-account/react/hooks/useSimBalance.js +0 -93
- package/dist/esm/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/esm/global-account/react/hooks/useSimCollectibles.js +0 -187
- package/dist/esm/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/esm/global-account/react/utils/simdune.js +0 -17
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/types/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/types/global-account/react/utils/simdune.d.ts +0 -7
- package/node_modules/@b3/chain-registry/src/index.ts +0 -169
- package/node_modules/@b3/chain-registry/tsconfig.json +0 -16
- package/src/global-account/react/hooks/useSimBalance.ts +0 -164
- package/src/global-account/react/hooks/useSimCollectibles.ts +0 -238
- package/src/global-account/react/utils/simdune.ts +0 -20
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type B3TokenBalance } from "@b3dotfun/sdk/shared/utils/zerionPositions";
|
|
2
|
+
/**
|
|
3
|
+
* Holdings for a wallet, optionally narrowed to specific chains.
|
|
4
|
+
*
|
|
5
|
+
* Read `isError` before reading `data`: a failed read and an empty wallet are different facts, and
|
|
6
|
+
* rendering the first as the second tells the user they hold nothing when nobody knows.
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePortfolioBalance(address?: string, chainIds?: number[]): import("@tanstack/react-query").UseQueryResult<B3TokenBalance[], Error>;
|
|
9
|
+
/**
|
|
10
|
+
* One token's balance for a wallet, served from the same per-wallet fetch as {@link usePortfolioBalance}.
|
|
11
|
+
*
|
|
12
|
+
* `tokenAddress` may be a contract address or the chain's native sentinel; matching is
|
|
13
|
+
* case-insensitive because callers pass addresses in whatever casing their source used.
|
|
14
|
+
*/
|
|
15
|
+
export declare function usePortfolioTokenBalance(walletAddress?: string, tokenAddress?: string, chainId?: number): import("@tanstack/react-query").UseQueryResult<B3TokenBalance | undefined, Error>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SimpleHashNFTResponse } from "@b3dotfun/sdk/global-account/types/simplehash.types";
|
|
2
|
+
/**
|
|
3
|
+
* NFTs held by a wallet, in the SimpleHash shape `AccountAssets` already renders.
|
|
4
|
+
*
|
|
5
|
+
* Chain narrowing happens here rather than in the request: the upstream rejects some valid chain
|
|
6
|
+
* slugs outright and fails the whole request when one is present, so asking for a subset can cost
|
|
7
|
+
* you the whole answer.
|
|
8
|
+
*/
|
|
9
|
+
export declare function usePortfolioCollectibles(address?: string, chainIds?: number[], options?: {
|
|
10
|
+
limit?: number;
|
|
11
|
+
filterSpam?: boolean;
|
|
12
|
+
}): import("@tanstack/react-query").UseQueryResult<SimpleHashNFTResponse, Error>;
|
|
@@ -649,8 +649,6 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
649
649
|
showChainSelection?: boolean;
|
|
650
650
|
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
651
651
|
showFiatOption?: boolean;
|
|
652
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
653
|
-
minPoolSize?: number;
|
|
654
652
|
/** Custom title for chain selection step */
|
|
655
653
|
chainSelectionTitle?: string;
|
|
656
654
|
/** Custom description for chain selection step */
|
|
@@ -13,6 +13,6 @@ export interface CreateWagmiConfigOptions {
|
|
|
13
13
|
* @param options.connectors - Additional connectors to include
|
|
14
14
|
* @param options.overrideDefaultConnectors - If true, only use provided connectors (ignores defaults)
|
|
15
15
|
*/
|
|
16
|
-
export declare function createWagmiConfig(options: CreateWagmiConfigOptions): import("wagmi").Config<readonly [
|
|
17
|
-
[k: string]:
|
|
16
|
+
export declare function createWagmiConfig(options: CreateWagmiConfigOptions): import("wagmi").Config<readonly [any, ...any[]], {
|
|
17
|
+
[k: string]: any;
|
|
18
18
|
}, CreateConnectorFn[]>;
|
|
@@ -37,11 +37,23 @@ export declare const b3Mainnet: {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
sourceId?: number | undefined | undefined;
|
|
40
|
+
supportsTransactionReplacementDetection?: boolean | undefined | undefined;
|
|
40
41
|
testnet?: boolean | undefined | undefined;
|
|
41
42
|
custom?: Record<string, unknown> | undefined;
|
|
43
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
42
44
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
43
45
|
formatters?: undefined;
|
|
46
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
47
|
+
client: import("viem").Client;
|
|
48
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
49
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
50
|
+
client: import("viem").Client;
|
|
51
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
52
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
53
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
54
|
+
}] | undefined;
|
|
44
55
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
56
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
45
57
|
readonly rpc: "https://mainnet-rpc.b3.fun";
|
|
46
58
|
readonly icon: {
|
|
47
59
|
readonly url: "https://cdn.b3.fun/b3_logo.svg";
|
|
@@ -85,11 +97,23 @@ export declare const b3Chain: Chain | {
|
|
|
85
97
|
};
|
|
86
98
|
};
|
|
87
99
|
sourceId?: number | undefined | undefined;
|
|
100
|
+
supportsTransactionReplacementDetection?: boolean | undefined | undefined;
|
|
88
101
|
testnet?: boolean | undefined | undefined;
|
|
89
102
|
custom?: Record<string, unknown> | undefined;
|
|
103
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
90
104
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
91
105
|
formatters?: undefined;
|
|
106
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
107
|
+
client: import("viem").Client;
|
|
108
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
109
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
110
|
+
client: import("viem").Client;
|
|
111
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
112
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
113
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
114
|
+
}] | undefined;
|
|
92
115
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
116
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
93
117
|
readonly rpc: "https://mainnet-rpc.b3.fun";
|
|
94
118
|
readonly icon: {
|
|
95
119
|
readonly url: "https://cdn.b3.fun/b3_logo.svg";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Chain as ThirdwebChain } from "thirdweb";
|
|
2
|
-
export declare const supportedChains:
|
|
2
|
+
export declare const supportedChains: any;
|
|
3
3
|
export declare const supportedChainsTW: ThirdwebChain[];
|
|
4
|
-
export declare const supportedChainNetworks:
|
|
4
|
+
export declare const supportedChainNetworks: any;
|
|
5
5
|
export declare const coingeckoChains: Record<number, {
|
|
6
6
|
coingecko_id: string;
|
|
7
7
|
name: string;
|
|
@@ -15,7 +15,7 @@ export declare function getCoingeckoChainInfo(chainId: number): {
|
|
|
15
15
|
export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
16
16
|
rpc: string;
|
|
17
17
|
}>;
|
|
18
|
-
export declare const b3Mainnet:
|
|
19
|
-
export declare const baseMainnet:
|
|
18
|
+
export declare const b3Mainnet: any;
|
|
19
|
+
export declare const baseMainnet: any;
|
|
20
20
|
export declare function getThirdwebChain(chainId: number): ThirdwebChain;
|
|
21
21
|
export declare function getChainLogo(chainId: number): string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { Wallet } from "thirdweb/wallets";
|
|
1
2
|
export * from "./currency";
|
|
2
3
|
export declare const siteURL = "https://basement.fun";
|
|
3
4
|
export declare const b3CoinIcon = "https://cdn.b3.fun/b3-coin-3d.png";
|
|
4
5
|
export declare const ecosystemWalletId: `ecosystem.${string}`;
|
|
6
|
+
export type EcosystemWallet = Wallet<`ecosystem.${string}`> & {
|
|
7
|
+
getAuthToken: () => string | null;
|
|
8
|
+
};
|
|
5
9
|
export declare const tokenIcons: {
|
|
6
10
|
ETH: string;
|
|
7
11
|
WETH: string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical browser-side translation of Zerion wallet positions into B3 balance rows.
|
|
3
|
+
*
|
|
4
|
+
* This lives in the published SDK because every browser consumer needs it — the apps in this repo
|
|
5
|
+
* and the sites that install `@b3dotfun/sdk` from npm — and the in-repo Zerion client is a private
|
|
6
|
+
* workspace package that a published package cannot depend on. Backend services keep their own
|
|
7
|
+
* translation: pulling a browser SDK into a Node service to share one function is a worse trade
|
|
8
|
+
* than the second copy.
|
|
9
|
+
*
|
|
10
|
+
* Only the HTTP layer differs between callers. The rules below — which row counts as the chain's
|
|
11
|
+
* native coin, and which rows have no usable identity — must not be re-derived anywhere else.
|
|
12
|
+
*/
|
|
13
|
+
/** Address B3 uses for a chain's native coin on EVM. Matches NATIVE_TOKEN_ADDRESSES. */
|
|
14
|
+
export declare const EVM_NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
15
|
+
export declare const SOLANA_NATIVE_TOKEN_ADDRESS = "So11111111111111111111111111111111111111112";
|
|
16
|
+
export declare const SOLANA_ZERION_SLUG = "solana";
|
|
17
|
+
/** Solana's chain id as the chain registry defines it — the id every balance row is keyed by. */
|
|
18
|
+
export declare const SOLANA_CHAIN_ID = 7565164;
|
|
19
|
+
export declare function zerionSlugToChainId(slug: string): number | undefined;
|
|
20
|
+
export declare function chainIdToZerionSlug(chainId: number): string | undefined;
|
|
21
|
+
export interface ZerionPositionQuantity {
|
|
22
|
+
int?: string;
|
|
23
|
+
decimals?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ZerionPositionImplementation {
|
|
26
|
+
chain_id?: string;
|
|
27
|
+
address?: string | null;
|
|
28
|
+
decimals?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ZerionPositionFungibleInfo {
|
|
31
|
+
name?: string;
|
|
32
|
+
symbol?: string;
|
|
33
|
+
icon?: {
|
|
34
|
+
url?: string;
|
|
35
|
+
} | null;
|
|
36
|
+
implementations?: ZerionPositionImplementation[];
|
|
37
|
+
}
|
|
38
|
+
export interface ZerionPositionLike {
|
|
39
|
+
id?: string;
|
|
40
|
+
attributes?: {
|
|
41
|
+
quantity?: ZerionPositionQuantity;
|
|
42
|
+
value?: number | null;
|
|
43
|
+
price?: number | null;
|
|
44
|
+
fungible_info?: ZerionPositionFungibleInfo;
|
|
45
|
+
flags?: {
|
|
46
|
+
displayable?: boolean;
|
|
47
|
+
is_trash?: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
relationships?: {
|
|
51
|
+
chain?: {
|
|
52
|
+
data?: {
|
|
53
|
+
id?: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** One spendable holding. `amount` is the raw integer; pair it with `decimals` to display. */
|
|
59
|
+
export interface B3TokenBalance {
|
|
60
|
+
chain: string;
|
|
61
|
+
chain_id: number;
|
|
62
|
+
address: string;
|
|
63
|
+
amount: string;
|
|
64
|
+
symbol: string;
|
|
65
|
+
decimals: number;
|
|
66
|
+
/**
|
|
67
|
+
* Whether `address` is the native-coin sentinel rather than a real contract. Callers deciding
|
|
68
|
+
* between a value-bearing send and an ERC-20 `transfer` MUST branch on this, never on the
|
|
69
|
+
* sentinel string: getting it backwards spends gas and moves nothing.
|
|
70
|
+
*/
|
|
71
|
+
is_native: boolean;
|
|
72
|
+
name?: string;
|
|
73
|
+
price_usd?: number;
|
|
74
|
+
value_usd?: number;
|
|
75
|
+
token_metadata?: {
|
|
76
|
+
logo: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export declare function nativeTokenAddressForChain(slug: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether `balance` is the token identified by `tokenAddress`.
|
|
82
|
+
*
|
|
83
|
+
* Native coins are matched on the row's `is_native` flag rather than its printed address, because
|
|
84
|
+
* the caller and the adapter rarely spell the native coin the same way.
|
|
85
|
+
*/
|
|
86
|
+
export declare function balanceMatchesToken(balance: B3TokenBalance, tokenAddress: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Adapt raw Zerion positions into balance rows, dropping any row we cannot describe honestly.
|
|
89
|
+
*
|
|
90
|
+
* A row is dropped when its chain slug is absent or unmapped, or when neither the quantity nor the
|
|
91
|
+
* chain implementation carries decimals — an amount rendered against a guessed scale is a wrong
|
|
92
|
+
* number presented as a real one, which is worse for the reader than a missing row.
|
|
93
|
+
*
|
|
94
|
+
* @param slugToChainId overrides slug resolution; return undefined to skip a chain entirely.
|
|
95
|
+
*/
|
|
96
|
+
export declare function adaptZerionPositions(positions: ZerionPositionLike[], slugToChainId?: (slug: string) => number | undefined): B3TokenBalance[];
|
|
@@ -16,6 +16,6 @@ export interface CreateWalletConfigOptions {
|
|
|
16
16
|
* Creates a generic wagmi config with sensible defaults.
|
|
17
17
|
* No ecosystem wallet, no B3-specific concerns.
|
|
18
18
|
*/
|
|
19
|
-
export declare function createWalletConfig(options?: CreateWalletConfigOptions): import("wagmi").Config<readonly [
|
|
20
|
-
[k: string]:
|
|
19
|
+
export declare function createWalletConfig(options?: CreateWalletConfigOptions): import("wagmi").Config<readonly [any, ...any[]], {
|
|
20
|
+
[k: string]: any;
|
|
21
21
|
}, CreateConnectorFn[]>;
|
|
@@ -297,7 +297,8 @@
|
|
|
297
297
|
"explorer": "https://hyperevmscan.io/",
|
|
298
298
|
"rpcEnvKey": "RPC_URL_HYPEREVM",
|
|
299
299
|
"fallbackRpc": "https://rpc.hyperliquid.xyz/evm",
|
|
300
|
-
"quicknodeSlug":
|
|
300
|
+
"quicknodeSlug": "hype-mainnet",
|
|
301
|
+
"quicknodeRpcPath": "/evm",
|
|
301
302
|
"coingecko": {
|
|
302
303
|
"platform": "hyperevm",
|
|
303
304
|
"nativeCoinId": "hyperliquid"
|
|
@@ -495,6 +496,33 @@
|
|
|
495
496
|
"tags": ["abstract"],
|
|
496
497
|
"integrations": ["anyspend"]
|
|
497
498
|
},
|
|
499
|
+
{
|
|
500
|
+
"chainId": 4663,
|
|
501
|
+
"key": "ROBINHOOD",
|
|
502
|
+
"name": "Robinhood Chain",
|
|
503
|
+
"network": "robinhood",
|
|
504
|
+
"type": "evm",
|
|
505
|
+
"isTestnet": false,
|
|
506
|
+
"nativeCurrency": {
|
|
507
|
+
"name": "Ether",
|
|
508
|
+
"symbol": "ETH",
|
|
509
|
+
"decimals": 18
|
|
510
|
+
},
|
|
511
|
+
"explorer": "https://robinhoodchain.blockscout.com",
|
|
512
|
+
"rpcEnvKey": "RPC_URL_ROBINHOOD",
|
|
513
|
+
"fallbackRpc": "https://rpc.mainnet.chain.robinhood.com",
|
|
514
|
+
"quicknodeSlug": "robinhood-mainnet",
|
|
515
|
+
"coingecko": {
|
|
516
|
+
"platform": "robinhood",
|
|
517
|
+
"nativeCoinId": "ethereum"
|
|
518
|
+
},
|
|
519
|
+
"trustwalletSlug": "robinhoodchain",
|
|
520
|
+
"logoUrl": "https://assets.relay.link/icons/square/4663/light.png",
|
|
521
|
+
"tags": ["robinhood"],
|
|
522
|
+
"integrations": ["anyspend", "morpho"],
|
|
523
|
+
"stablecoins": [{ "symbol": "USDG", "address": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168" }],
|
|
524
|
+
"wrappedNative": "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
|
|
525
|
+
},
|
|
498
526
|
{
|
|
499
527
|
"chainId": 5000,
|
|
500
528
|
"key": "MANTLE",
|
|
@@ -2,10 +2,26 @@
|
|
|
2
2
|
"name": "@b3/chain-registry",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
5
6
|
"description": "Canonical chain definitions for all B3OS services",
|
|
6
|
-
"main": "src/index.
|
|
7
|
-
"types": "src/index.ts",
|
|
7
|
+
"main": "./dist/src/index.js",
|
|
8
|
+
"types": "./dist/src/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./src/index.ts",
|
|
12
|
+
"production": "./dist/src/index.js",
|
|
13
|
+
"import": "./src/index.ts",
|
|
14
|
+
"default": "./src/index.ts"
|
|
15
|
+
},
|
|
16
|
+
"./chains.json": "./chains.json",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"chains.json"
|
|
22
|
+
],
|
|
8
23
|
"scripts": {
|
|
24
|
+
"build": "tsc -p tsconfig.build.json && cp chains.json dist/chains.json",
|
|
9
25
|
"typecheck": "tsc --noEmit"
|
|
10
26
|
},
|
|
11
27
|
"devDependencies": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.1.70-alpha.
|
|
3
|
+
"version": "0.1.70-alpha.19",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -455,7 +455,7 @@
|
|
|
455
455
|
"react-native-mmkv": "^3.2.0",
|
|
456
456
|
"thirdweb": "5.116.1",
|
|
457
457
|
"three": "^0.175.0",
|
|
458
|
-
"viem": "2.
|
|
458
|
+
"viem": "2.55.1",
|
|
459
459
|
"wagmi": "2.16.9"
|
|
460
460
|
},
|
|
461
461
|
"peerDependenciesMeta": {
|
package/src/anyspend/README.md
CHANGED
|
@@ -43,12 +43,12 @@ import { AnySpendNFTButton } from "@b3dotfun/sdk/anyspend/react";
|
|
|
43
43
|
|
|
44
44
|
function NFTCard() {
|
|
45
45
|
const nftContract = {
|
|
46
|
-
chainId:
|
|
46
|
+
chainId: 8453,
|
|
47
47
|
contractAddress: "0x9c275ff1634519E9B5449ec79cd939B5F900564d",
|
|
48
48
|
price: "500000000000000000", // 0.5 ETH in wei
|
|
49
49
|
priceFormatted: "0.5",
|
|
50
50
|
currency: {
|
|
51
|
-
chainId:
|
|
51
|
+
chainId: 8453,
|
|
52
52
|
address: "0x0000000000000000000000000000000000000000",
|
|
53
53
|
name: "Ether",
|
|
54
54
|
symbol: "ETH",
|
|
@@ -21,6 +21,7 @@ export const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun";
|
|
|
21
21
|
export const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
22
22
|
export const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
23
23
|
export const PLUME_PUBLIC_RPC = "https://rpc.plume.org";
|
|
24
|
+
export const ROBINHOOD_PUBLIC_RPC = "https://rpc.mainnet.chain.robinhood.com";
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Map of chain IDs to their default public RPC URLs.
|
|
@@ -37,4 +38,5 @@ export const PUBLIC_RPC_URLS: Record<number, string> = {
|
|
|
37
38
|
2741: ABSTRACT_PUBLIC_RPC, // Abstract
|
|
38
39
|
999: HYPEREVM_PUBLIC_RPC, // HyperEVM
|
|
39
40
|
98866: PLUME_PUBLIC_RPC, // Plume Network
|
|
41
|
+
4663: ROBINHOOD_PUBLIC_RPC, // Robinhood Chain
|
|
40
42
|
};
|
|
@@ -15,7 +15,7 @@ import { AnySpend } from "@b3dotfun/sdk/anyspend/react";
|
|
|
15
15
|
mode="modal"
|
|
16
16
|
defaultActiveTab="crypto"
|
|
17
17
|
destinationTokenAddress="0x..."
|
|
18
|
-
destinationTokenChainId={
|
|
18
|
+
destinationTokenChainId={8453}
|
|
19
19
|
recipientAddress="0x..."
|
|
20
20
|
hideTransactionHistoryButton={false}
|
|
21
21
|
onSuccess={(txHash) => console.log("Swap completed", txHash)}
|
|
@@ -53,7 +53,7 @@ import { AnySpend } from "@b3dotfun/sdk/anyspend/react";
|
|
|
53
53
|
<AnySpend
|
|
54
54
|
defaultActiveTab="fiat"
|
|
55
55
|
destinationTokenAddress="0xA0b86a33E6Fb6Dd9a9B3d8B5FEb2b3C8e7D9Ff1E"
|
|
56
|
-
destinationTokenChainId={
|
|
56
|
+
destinationTokenChainId={8453}
|
|
57
57
|
recipientAddress={userWalletAddress}
|
|
58
58
|
/>
|
|
59
59
|
```
|
|
@@ -107,12 +107,12 @@ interface NFTContract {
|
|
|
107
107
|
|
|
108
108
|
```tsx
|
|
109
109
|
const coolNFT = {
|
|
110
|
-
chainId:
|
|
110
|
+
chainId: 8453,
|
|
111
111
|
contractAddress: "0x9c275ff1634519E9B5449ec79cd939B5F900564d",
|
|
112
112
|
price: "500000000000000000", // 0.5 ETH
|
|
113
113
|
priceFormatted: "0.5",
|
|
114
114
|
currency: {
|
|
115
|
-
chainId:
|
|
115
|
+
chainId: 8453,
|
|
116
116
|
address: "0x0000000000000000000000000000000000000000",
|
|
117
117
|
name: "Ether",
|
|
118
118
|
symbol: "ETH",
|
|
@@ -144,7 +144,7 @@ import { AnySpendCustom } from "@b3dotfun/sdk/anyspend/react";
|
|
|
144
144
|
|
|
145
145
|
<AnySpendCustom
|
|
146
146
|
orderType="custom"
|
|
147
|
-
dstChainId={
|
|
147
|
+
dstChainId={8453}
|
|
148
148
|
dstToken={tokenDetails}
|
|
149
149
|
dstAmount="1000000000000000000"
|
|
150
150
|
contractAddress="0x..."
|
|
@@ -184,7 +184,7 @@ const stakingCalldata = encodeFunctionData({
|
|
|
184
184
|
|
|
185
185
|
<AnySpendCustom
|
|
186
186
|
orderType="custom"
|
|
187
|
-
dstChainId={
|
|
187
|
+
dstChainId={8453}
|
|
188
188
|
dstToken={stakingToken}
|
|
189
189
|
dstAmount={stakeAmount}
|
|
190
190
|
contractAddress="0xStakingContract..."
|
|
@@ -54,7 +54,7 @@ interface QuoteRequest {
|
|
|
54
54
|
function SwapQuote() {
|
|
55
55
|
const quoteRequest = {
|
|
56
56
|
srcChain: 1, // Ethereum
|
|
57
|
-
dstChain:
|
|
57
|
+
dstChain: 8453, // Base
|
|
58
58
|
srcTokenAddress: "0xA0b86a33E6Fb6Dd9a9B3d8B5FEb2b3C8e7D9Ff1E", // USDC
|
|
59
59
|
dstTokenAddress: "0x0000000000000000000000000000000000000000", // ETH
|
|
60
60
|
type: "swap",
|
|
@@ -140,7 +140,7 @@ function PaymentForm() {
|
|
|
140
140
|
recipientAddress: userWalletAddress,
|
|
141
141
|
orderType: "swap",
|
|
142
142
|
srcChain: 1,
|
|
143
|
-
dstChain:
|
|
143
|
+
dstChain: 8453,
|
|
144
144
|
srcToken: {
|
|
145
145
|
chainId: 1,
|
|
146
146
|
address: "0xA0b86a33E6Fb6Dd9a9B3d8B5FEb2b3C8e7D9Ff1E",
|
|
@@ -149,7 +149,7 @@ function PaymentForm() {
|
|
|
149
149
|
decimals: 6,
|
|
150
150
|
},
|
|
151
151
|
dstToken: {
|
|
152
|
-
chainId:
|
|
152
|
+
chainId: 8453,
|
|
153
153
|
address: "0x0000000000000000000000000000000000000000",
|
|
154
154
|
name: "Ether",
|
|
155
155
|
symbol: "ETH",
|
|
@@ -74,12 +74,12 @@ import { AnySpendNFTButton } from "@b3dotfun/sdk/anyspend/react";
|
|
|
74
74
|
|
|
75
75
|
function TestComponent() {
|
|
76
76
|
const testNFT = {
|
|
77
|
-
chainId:
|
|
77
|
+
chainId: 8453,
|
|
78
78
|
contractAddress: "0x9c275ff1634519E9B5449ec79cd939B5F900564d",
|
|
79
79
|
price: "500000000000000000",
|
|
80
80
|
priceFormatted: "0.5",
|
|
81
81
|
currency: {
|
|
82
|
-
chainId:
|
|
82
|
+
chainId: 8453,
|
|
83
83
|
address: "0x0000000000000000000000000000000000000000",
|
|
84
84
|
name: "Ether",
|
|
85
85
|
symbol: "ETH",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { USDC_BASE } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
4
|
-
import { Skeleton, useAccountWallet,
|
|
4
|
+
import { Skeleton, useAccountWallet, usePortfolioBalance, useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
5
5
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
6
6
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
7
7
|
import {
|
|
@@ -108,8 +108,6 @@ export interface AnySpendDepositProps {
|
|
|
108
108
|
showFiatOption?: boolean;
|
|
109
109
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
110
110
|
supportedChains?: ChainConfig[];
|
|
111
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
112
|
-
minPoolSize?: number;
|
|
113
111
|
/** Custom title for chain selection step */
|
|
114
112
|
chainSelectionTitle?: string;
|
|
115
113
|
/** Custom description for chain selection step */
|
|
@@ -164,9 +162,6 @@ const DEFAULT_SUPPORTED_CHAINS: ChainConfig[] = [
|
|
|
164
162
|
{ id: 56, name: "BNB Chain" },
|
|
165
163
|
];
|
|
166
164
|
|
|
167
|
-
// Minimum pool size to filter out low liquidity tokens
|
|
168
|
-
const DEFAULT_MIN_POOL_SIZE = 1_000_000;
|
|
169
|
-
|
|
170
165
|
/**
|
|
171
166
|
* Self-described fallback metadata for the default funding token(s), keyed by
|
|
172
167
|
* `${chainId}:${lowercased address}`. Used when `useTokenData` misses (returns
|
|
@@ -284,7 +279,6 @@ export function AnySpendDeposit({
|
|
|
284
279
|
showChainSelection,
|
|
285
280
|
showFiatOption = true,
|
|
286
281
|
supportedChains = DEFAULT_SUPPORTED_CHAINS,
|
|
287
|
-
minPoolSize = DEFAULT_MIN_POOL_SIZE,
|
|
288
282
|
topChainsCount = 3,
|
|
289
283
|
onClose,
|
|
290
284
|
returnToHomeUrl,
|
|
@@ -345,20 +339,25 @@ export function AnySpendDeposit({
|
|
|
345
339
|
|
|
346
340
|
// Fetch balances for EOA wallet (use senderAddress as fallback for pre-filled balance display)
|
|
347
341
|
const effectiveBalanceAddress = senderAddress || eoaAddress;
|
|
348
|
-
const {
|
|
342
|
+
const {
|
|
343
|
+
data: balances,
|
|
344
|
+
isLoading: isBalanceLoading,
|
|
345
|
+
isError: isBalanceError,
|
|
346
|
+
} = usePortfolioBalance(
|
|
349
347
|
shouldShowChainSelection ? effectiveBalanceAddress : undefined,
|
|
350
348
|
supportedChains.map(c => c.id),
|
|
351
349
|
);
|
|
352
350
|
|
|
353
|
-
// Group balances by chain and calculate total USD value per chain
|
|
351
|
+
// Group balances by chain and calculate total USD value per chain.
|
|
352
|
+
//
|
|
353
|
+
// There is deliberately no liquidity threshold here. The balance provider reports no pool size,
|
|
354
|
+
// so a `pool_size > n` test is false for every row and quietly reduces to "native only",
|
|
355
|
+
// erasing every ERC-20 the user holds from the chain summary. Spam filtering belongs to the
|
|
356
|
+
// token-filter service, which has the data to do it.
|
|
354
357
|
const chainBalances = useMemo(() => {
|
|
355
|
-
if (!
|
|
356
|
-
|
|
357
|
-
const filteredBalances = balanceData.balances.filter(
|
|
358
|
-
token => token.address === "native" || (token.pool_size && token.pool_size > minPoolSize),
|
|
359
|
-
);
|
|
358
|
+
if (!balances) return {};
|
|
360
359
|
|
|
361
|
-
return
|
|
360
|
+
return balances.reduce(
|
|
362
361
|
(acc, token) => {
|
|
363
362
|
const chainId = token.chain_id;
|
|
364
363
|
if (!acc[chainId]) {
|
|
@@ -375,7 +374,7 @@ export function AnySpendDeposit({
|
|
|
375
374
|
},
|
|
376
375
|
{} as Record<number, { chainId: number; chainName: string; totalUsdValue: number; tokenCount: number }>,
|
|
377
376
|
);
|
|
378
|
-
}, [
|
|
377
|
+
}, [balances]);
|
|
379
378
|
|
|
380
379
|
// Sort chains by USD value (highest first)
|
|
381
380
|
const sortedChains = useMemo(() => {
|
|
@@ -477,7 +476,7 @@ export function AnySpendDeposit({
|
|
|
477
476
|
</button>
|
|
478
477
|
)}
|
|
479
478
|
{/* Balance header */}
|
|
480
|
-
{!isBalanceLoading && totalBalance > 0 && (
|
|
479
|
+
{!isBalanceLoading && !isBalanceError && totalBalance > 0 && (
|
|
481
480
|
<div
|
|
482
481
|
className={
|
|
483
482
|
depositClasses?.balanceContainer || "anyspend-deposit-balance border-theme-border-secondary border-b p-5"
|
|
@@ -520,8 +519,16 @@ export function AnySpendDeposit({
|
|
|
520
519
|
</div>
|
|
521
520
|
)}
|
|
522
521
|
|
|
522
|
+
{/* A failed read leaves every chain at zero, which reads as "you hold nothing" on a
|
|
523
|
+
funding screen. Say what actually happened instead. */}
|
|
524
|
+
{isBalanceError && !isBalanceLoading && (
|
|
525
|
+
<p className="text-as-primary/50 px-1 py-2 text-sm">
|
|
526
|
+
We couldn't read your balances just now. You can still pick a chain below.
|
|
527
|
+
</p>
|
|
528
|
+
)}
|
|
529
|
+
|
|
523
530
|
{/* Top chains with balance */}
|
|
524
|
-
{topChainsWithBalance.length > 0 && (
|
|
531
|
+
{!isBalanceError && topChainsWithBalance.length > 0 && (
|
|
525
532
|
<div className={depositClasses?.chainsContainer || "anyspend-deposit-chains flex flex-col gap-2"}>
|
|
526
533
|
{topChainsWithBalance.map(chain => (
|
|
527
534
|
<button
|
|
@@ -548,7 +555,7 @@ export function AnySpendDeposit({
|
|
|
548
555
|
depositClasses?.chainBalance || "anyspend-deposit-chain-balance text-as-secondary text-xs"
|
|
549
556
|
}
|
|
550
557
|
>
|
|
551
|
-
{formatUsd(chain.balance)} available
|
|
558
|
+
{`${formatUsd(chain.balance)} available`}
|
|
552
559
|
</p>
|
|
553
560
|
</div>
|
|
554
561
|
</div>
|