@b3dotfun/sdk 0.1.70-alpha.17 → 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/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +18 -11
- 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/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +18 -11
- 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/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -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/__tests__/useUnifiedChainSwitchAndExecute.test.tsx +156 -0
- 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/hooks/useUnifiedChainSwitchAndExecute.ts +26 -12
- 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,178 @@
|
|
|
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 const EVM_NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
15
|
+
export const SOLANA_NATIVE_TOKEN_ADDRESS = "So11111111111111111111111111111111111111112";
|
|
16
|
+
export const SOLANA_ZERION_SLUG = "solana";
|
|
17
|
+
/** What Zerion's `quantity.int` is: a base-10 integer, unbounded in length. */
|
|
18
|
+
const DECIMAL_INTEGER_PATTERN = /^\d+$/;
|
|
19
|
+
/** Solana's chain id as the chain registry defines it — the id every balance row is keyed by. */
|
|
20
|
+
export const SOLANA_CHAIN_ID = 7565164;
|
|
21
|
+
/**
|
|
22
|
+
* Zerion chain slug → numeric chain id. Slugs are Zerion's own vocabulary and do not always match
|
|
23
|
+
* the chain's common name — Gnosis is `xdai`, Metis is `metis-andromeda` — so an entry invented
|
|
24
|
+
* from the chain name silently drops every position on that chain, because the adapter skips any
|
|
25
|
+
* slug it cannot map. Every entry here is taken from Zerion's `GET /v1/chains/`.
|
|
26
|
+
*/
|
|
27
|
+
const ZERION_CHAIN_IDS = {
|
|
28
|
+
ethereum: 1,
|
|
29
|
+
optimism: 10,
|
|
30
|
+
"binance-smart-chain": 56,
|
|
31
|
+
xdai: 100,
|
|
32
|
+
unichain: 130,
|
|
33
|
+
polygon: 137,
|
|
34
|
+
sonic: 146,
|
|
35
|
+
fantom: 250,
|
|
36
|
+
"zksync-era": 324,
|
|
37
|
+
world: 480,
|
|
38
|
+
hyperevm: 999,
|
|
39
|
+
"metis-andromeda": 1088,
|
|
40
|
+
"polygon-zkevm": 1101,
|
|
41
|
+
soneium: 1868,
|
|
42
|
+
ronin: 2020,
|
|
43
|
+
abstract: 2741,
|
|
44
|
+
robinhood: 4663,
|
|
45
|
+
mantle: 5000,
|
|
46
|
+
base: 8453,
|
|
47
|
+
mode: 34443,
|
|
48
|
+
arbitrum: 42161,
|
|
49
|
+
celo: 42220,
|
|
50
|
+
avalanche: 43114,
|
|
51
|
+
linea: 59144,
|
|
52
|
+
berachain: 80094,
|
|
53
|
+
blast: 81457,
|
|
54
|
+
taiko: 167000,
|
|
55
|
+
scroll: 534352,
|
|
56
|
+
zora: 7777777,
|
|
57
|
+
degen: 666666666,
|
|
58
|
+
aurora: 1313161554,
|
|
59
|
+
[SOLANA_ZERION_SLUG]: SOLANA_CHAIN_ID,
|
|
60
|
+
};
|
|
61
|
+
// Maps rather than objects: a slug arrives straight off the wire, and an object lookup resolves an
|
|
62
|
+
// inherited key like `constructor` or `toString` to something truthy instead of reporting the chain
|
|
63
|
+
// as unknown — which would carry a row past the `=== undefined` guard with a function as its id.
|
|
64
|
+
const CHAIN_ID_BY_ZERION_SLUG = new Map(Object.entries(ZERION_CHAIN_IDS));
|
|
65
|
+
const ZERION_SLUG_BY_CHAIN_ID = new Map(Object.entries(ZERION_CHAIN_IDS).map(([slug, id]) => [id, slug]));
|
|
66
|
+
export function zerionSlugToChainId(slug) {
|
|
67
|
+
return CHAIN_ID_BY_ZERION_SLUG.get(slug);
|
|
68
|
+
}
|
|
69
|
+
export function chainIdToZerionSlug(chainId) {
|
|
70
|
+
return ZERION_SLUG_BY_CHAIN_ID.get(chainId);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Zerion encodes a position's asset in the first hyphen-delimited segment of its resource `id`
|
|
74
|
+
* (`<assetRef>-<chainSlug>-<positionType>-…`). A chain's native coin uses the literal `base`
|
|
75
|
+
* (`base-polygon-asset-asset`); ERC-20s use the contract address
|
|
76
|
+
* (`0x1dd17…-ethereum-asset-asset`).
|
|
77
|
+
*
|
|
78
|
+
* This is the only reliable native signal. A falsy per-chain `implementation.address` looks
|
|
79
|
+
* equivalent and is not: Zerion reports Polygon's native coin at its `0x…1010` system contract and
|
|
80
|
+
* Celo's at a real ERC-20 address, while Polygon simultaneously carries a non-native fungible with
|
|
81
|
+
* the same `POL` symbol. Keying on the address shape misclassifies both.
|
|
82
|
+
*/
|
|
83
|
+
function isNativePosition(id, impl) {
|
|
84
|
+
if (id?.startsWith("base-") === true)
|
|
85
|
+
return true;
|
|
86
|
+
// Second signal, for the chains that spell native as an absent address. It requires the
|
|
87
|
+
// implementation to EXIST: a fungible with no entry for this chain tells us nothing about what
|
|
88
|
+
// the row is, and calling that native would hand a value-bearing send an amount we cannot name.
|
|
89
|
+
return impl !== undefined && !impl.address;
|
|
90
|
+
}
|
|
91
|
+
export function nativeTokenAddressForChain(slug) {
|
|
92
|
+
return slug === SOLANA_ZERION_SLUG ? SOLANA_NATIVE_TOKEN_ADDRESS : EVM_NATIVE_TOKEN_ADDRESS;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Every spelling of "the chain's own coin" a caller might hold.
|
|
96
|
+
*
|
|
97
|
+
* A token record's address depends on where it came from — a quote provider, a token list, a URL
|
|
98
|
+
* parameter — and each source names the native coin differently. Matching a balance row against any
|
|
99
|
+
* single one of these silently fails for the others.
|
|
100
|
+
*/
|
|
101
|
+
const NATIVE_TOKEN_MARKERS = new Set([
|
|
102
|
+
"native",
|
|
103
|
+
"0x0000000000000000000000000000000000000000",
|
|
104
|
+
EVM_NATIVE_TOKEN_ADDRESS,
|
|
105
|
+
SOLANA_NATIVE_TOKEN_ADDRESS.toLowerCase(),
|
|
106
|
+
"11111111111111111111111111111111",
|
|
107
|
+
]);
|
|
108
|
+
/**
|
|
109
|
+
* Whether `balance` is the token identified by `tokenAddress`.
|
|
110
|
+
*
|
|
111
|
+
* Native coins are matched on the row's `is_native` flag rather than its printed address, because
|
|
112
|
+
* the caller and the adapter rarely spell the native coin the same way.
|
|
113
|
+
*/
|
|
114
|
+
export function balanceMatchesToken(balance, tokenAddress) {
|
|
115
|
+
const wanted = tokenAddress.toLowerCase();
|
|
116
|
+
if (NATIVE_TOKEN_MARKERS.has(wanted))
|
|
117
|
+
return balance.is_native;
|
|
118
|
+
// Case-insensitive only for hex contract addresses. Solana mints are base58, where case is
|
|
119
|
+
// significant — lowercasing them would let two distinct mints compare equal.
|
|
120
|
+
if (balance.chain === SOLANA_ZERION_SLUG)
|
|
121
|
+
return balance.address === tokenAddress;
|
|
122
|
+
return balance.address.toLowerCase() === wanted;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Adapt raw Zerion positions into balance rows, dropping any row we cannot describe honestly.
|
|
126
|
+
*
|
|
127
|
+
* A row is dropped when its chain slug is absent or unmapped, or when neither the quantity nor the
|
|
128
|
+
* chain implementation carries decimals — an amount rendered against a guessed scale is a wrong
|
|
129
|
+
* number presented as a real one, which is worse for the reader than a missing row.
|
|
130
|
+
*
|
|
131
|
+
* @param slugToChainId overrides slug resolution; return undefined to skip a chain entirely.
|
|
132
|
+
*/
|
|
133
|
+
export function adaptZerionPositions(positions, slugToChainId = zerionSlugToChainId) {
|
|
134
|
+
const out = [];
|
|
135
|
+
for (const position of positions) {
|
|
136
|
+
const attributes = position.attributes ?? {};
|
|
137
|
+
const flags = attributes.flags;
|
|
138
|
+
if (flags && (flags.displayable === false || flags.is_trash === true))
|
|
139
|
+
continue;
|
|
140
|
+
const slug = position.relationships?.chain?.data?.id;
|
|
141
|
+
if (!slug)
|
|
142
|
+
continue;
|
|
143
|
+
const chainId = slugToChainId(slug);
|
|
144
|
+
if (chainId === undefined)
|
|
145
|
+
continue;
|
|
146
|
+
const fungibleInfo = attributes.fungible_info ?? {};
|
|
147
|
+
const implementation = (fungibleInfo.implementations ?? []).find(entry => entry.chain_id === slug);
|
|
148
|
+
const decimals = attributes.quantity?.decimals ?? implementation?.decimals;
|
|
149
|
+
if (decimals === undefined)
|
|
150
|
+
continue;
|
|
151
|
+
const isNative = isNativePosition(position.id, implementation);
|
|
152
|
+
// A non-native row with no contract address has no on-chain identity — drop it rather than
|
|
153
|
+
// render a holding nothing can name.
|
|
154
|
+
const address = isNative ? nativeTokenAddressForChain(slug) : implementation?.address;
|
|
155
|
+
if (!address)
|
|
156
|
+
continue;
|
|
157
|
+
// A quantity we cannot read is not a zero balance. Must be the base-10 integer `quantity.int`
|
|
158
|
+
// is: `null`, `""`, and any other unusable string all format to NaN, which callers coerce back
|
|
159
|
+
// to 0 and show as "holds none". `"0"` matches, so a real zero balance still comes through.
|
|
160
|
+
const amount = attributes.quantity?.int;
|
|
161
|
+
if (amount === undefined || !DECIMAL_INTEGER_PATTERN.test(amount))
|
|
162
|
+
continue;
|
|
163
|
+
out.push({
|
|
164
|
+
chain: slug,
|
|
165
|
+
chain_id: chainId,
|
|
166
|
+
address,
|
|
167
|
+
amount,
|
|
168
|
+
symbol: fungibleInfo.symbol ?? "",
|
|
169
|
+
decimals,
|
|
170
|
+
is_native: isNative,
|
|
171
|
+
name: fungibleInfo.name,
|
|
172
|
+
price_usd: attributes.price ?? undefined,
|
|
173
|
+
value_usd: attributes.value ?? undefined,
|
|
174
|
+
token_metadata: fungibleInfo.icon?.url ? { logo: fungibleInfo.icon.url } : undefined,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
@@ -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[]>;
|
|
@@ -17,6 +17,7 @@ export declare const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun";
|
|
|
17
17
|
export declare const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
18
18
|
export declare const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
19
19
|
export declare const PLUME_PUBLIC_RPC = "https://rpc.plume.org";
|
|
20
|
+
export declare const ROBINHOOD_PUBLIC_RPC = "https://rpc.mainnet.chain.robinhood.com";
|
|
20
21
|
/**
|
|
21
22
|
* Map of chain IDs to their default public RPC URLs.
|
|
22
23
|
*/
|
|
@@ -84,8 +84,6 @@ export interface AnySpendDepositProps {
|
|
|
84
84
|
showFiatOption?: boolean;
|
|
85
85
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
86
86
|
supportedChains?: ChainConfig[];
|
|
87
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
88
|
-
minPoolSize?: number;
|
|
89
87
|
/** Custom title for chain selection step */
|
|
90
88
|
chainSelectionTitle?: string;
|
|
91
89
|
/** Custom description for chain selection step */
|
|
@@ -164,4 +162,4 @@ export interface AnySpendDepositProps {
|
|
|
164
162
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
165
163
|
* />
|
|
166
164
|
*/
|
|
167
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, lockDestinationToken, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains,
|
|
165
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, lockDestinationToken, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, pureTransferOnly, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -10,9 +10,9 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
|
|
|
10
10
|
description?: string | undefined;
|
|
11
11
|
status?: "ACTIVE" | "INACTIVE" | "DRAFT" | undefined;
|
|
12
12
|
metadata?: {} | undefined;
|
|
13
|
+
logoURI?: string | undefined;
|
|
13
14
|
createdAt?: string | undefined;
|
|
14
15
|
updatedAt?: string | undefined;
|
|
15
|
-
logoURI?: string | undefined;
|
|
16
16
|
creator?: string | undefined;
|
|
17
17
|
signatureRequestBody?: {
|
|
18
18
|
currency?: string | undefined;
|
|
@@ -56,11 +56,23 @@ export declare const hyperEVM: {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
sourceId?: number | undefined | undefined;
|
|
59
|
+
supportsTransactionReplacementDetection?: boolean | undefined | undefined;
|
|
59
60
|
testnet?: boolean | undefined | undefined;
|
|
60
61
|
custom?: Record<string, unknown> | undefined;
|
|
62
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
61
63
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
62
64
|
formatters?: undefined;
|
|
65
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
66
|
+
client: import("viem").Client;
|
|
67
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
68
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
69
|
+
client: import("viem").Client;
|
|
70
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
71
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
72
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
73
|
+
}] | undefined;
|
|
63
74
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
75
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
64
76
|
};
|
|
65
77
|
export declare const plume: {
|
|
66
78
|
blockExplorers: {
|
|
@@ -94,11 +106,23 @@ export declare const plume: {
|
|
|
94
106
|
};
|
|
95
107
|
};
|
|
96
108
|
sourceId?: number | undefined | undefined;
|
|
109
|
+
supportsTransactionReplacementDetection?: boolean | undefined | undefined;
|
|
97
110
|
testnet?: boolean | undefined | undefined;
|
|
98
111
|
custom?: Record<string, unknown> | undefined;
|
|
112
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
99
113
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
100
114
|
formatters?: undefined;
|
|
115
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
116
|
+
client: import("viem").Client;
|
|
117
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
118
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
119
|
+
client: import("viem").Client;
|
|
120
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
121
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
122
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
123
|
+
}] | undefined;
|
|
101
124
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
125
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
102
126
|
};
|
|
103
127
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
104
128
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
@@ -106,6 +130,14 @@ export declare const SOLANA_MAINNET: ISolanaChain;
|
|
|
106
130
|
export declare const HYPERLIQUID_MAINNET: IHyperliquidChain;
|
|
107
131
|
export declare const EVM_CHAINS: Record<number, IEVMChain>;
|
|
108
132
|
export declare const SOLANA_CHAINS: Record<number, ISolanaChain>;
|
|
133
|
+
/**
|
|
134
|
+
* Translate a Relay-numbered chain id into the id the chain registry uses.
|
|
135
|
+
*
|
|
136
|
+
* Relay numbers Solana 792703809; every other chain shares the universal EVM id. Balance rows are
|
|
137
|
+
* keyed by the registry's id, so handing Relay's number to a balance lookup matches nothing at all
|
|
138
|
+
* — and a funded Solana wallet then reads as empty rather than as unreadable.
|
|
139
|
+
*/
|
|
140
|
+
export declare function toRegistryChainId(chainId: number): number;
|
|
109
141
|
export declare const HYPERLIQUID_CHAINS: Record<number, IHyperliquidChain>;
|
|
110
142
|
export declare const ALL_CHAINS: Record<number, IBaseChain>;
|
|
111
143
|
export declare function getSolanaChains(network: "mainnet" | "testnet"): ISolanaChain;
|
|
@@ -128,6 +160,19 @@ export declare function getNativeToken(chainId: number): components["schemas"]["
|
|
|
128
160
|
export declare function isEvmChain(chainId: number): boolean;
|
|
129
161
|
export declare function isHyperliquidChain(chainId: number): boolean;
|
|
130
162
|
export declare function getHyperliquidChain(chainId: number): IHyperliquidChain;
|
|
163
|
+
/**
|
|
164
|
+
* Chains AnySpend no longer accepts orders on, as either source or destination.
|
|
165
|
+
*
|
|
166
|
+
* They stay in ALL_CHAINS on purpose. That map answers "what is this chain" — name, logo, token,
|
|
167
|
+
* decimals — which every order that ever existed still needs in order to render; removing an entry
|
|
168
|
+
* would make getChainName and friends throw on historical rows. Whether new orders are accepted is
|
|
169
|
+
* this separate question.
|
|
170
|
+
*
|
|
171
|
+
* anyspend-service imports this list rather than keeping its own, so the API and the chain picker
|
|
172
|
+
* can never disagree about what is on offer.
|
|
173
|
+
*/
|
|
174
|
+
export declare const DEPRECATED_CHAIN_IDS: readonly number[];
|
|
175
|
+
export declare function isDeprecatedChain(chainId?: number): boolean;
|
|
131
176
|
/**
|
|
132
177
|
* Get available chain IDs for AnySpend based on context (source or destination).
|
|
133
178
|
* Filters out chains that shouldn't be available for the given context.
|
|
@@ -10,7 +10,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
10
10
|
/**
|
|
11
11
|
* Main B3Provider component
|
|
12
12
|
*/
|
|
13
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider,
|
|
13
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, authStrategy, apiUrl, notificationsApiUrl, }: {
|
|
14
14
|
theme: "light" | "dark";
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
accountOverride?: Account;
|
|
@@ -18,7 +18,6 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
18
18
|
automaticallySetFirstEoa?: boolean;
|
|
19
19
|
/** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
|
|
20
20
|
defaultEoaProvider?: EIP1193.EIP1193Provider;
|
|
21
|
-
simDuneApiKey?: string;
|
|
22
21
|
toaster?: {
|
|
23
22
|
position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
|
|
24
23
|
style?: React.CSSProperties;
|
|
@@ -30,8 +30,8 @@ export { useQueryBSMNT } from "./useQueryBSMNT";
|
|
|
30
30
|
export { useRemoveSessionKey } from "./useRemoveSessionKey";
|
|
31
31
|
export { useRouter } from "./useRouter";
|
|
32
32
|
export { useSearchParamsSSR } from "./useSearchParamsSSR";
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
33
|
+
export { usePortfolioBalance, usePortfolioTokenBalance } from "./usePortfolioBalance";
|
|
34
|
+
export { usePortfolioCollectibles } from "./usePortfolioCollectibles";
|
|
35
35
|
export { useSiwe } from "./useSiwe";
|
|
36
36
|
export { useTokenBalance } from "./useTokenBalance";
|
|
37
37
|
export { useTokenBalanceDirect } from "./useTokenBalanceDirect";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type EcosystemWallet } from "@b3dotfun/sdk/shared/constants";
|
|
1
2
|
import { Wallet } from "thirdweb/wallets";
|
|
2
3
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
4
|
/**
|
|
@@ -13,7 +14,7 @@ export declare function useAuth(): {
|
|
|
13
14
|
isReady: boolean;
|
|
14
15
|
isConnecting: boolean;
|
|
15
16
|
isConnected: boolean;
|
|
16
|
-
wallet:
|
|
17
|
+
wallet: EcosystemWallet;
|
|
17
18
|
preAuthenticate: typeof preAuthenticate;
|
|
18
19
|
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
19
20
|
isAuthenticating: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type EcosystemWallet } from "@b3dotfun/sdk/shared/constants";
|
|
1
2
|
import { Wallet } from "thirdweb/wallets";
|
|
2
3
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
4
|
export declare function useAuthentication(partnerId: string, { skipAutoConnect }?: {
|
|
@@ -8,7 +9,7 @@ export declare function useAuthentication(partnerId: string, { skipAutoConnect }
|
|
|
8
9
|
isReady: boolean;
|
|
9
10
|
isConnecting: boolean;
|
|
10
11
|
isConnected: boolean;
|
|
11
|
-
wallet:
|
|
12
|
+
wallet: EcosystemWallet;
|
|
12
13
|
preAuthenticate: typeof preAuthenticate;
|
|
13
14
|
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
14
15
|
isAuthenticating: boolean;
|