@coinlist-co/react 0.12.1-rc.f2804ef → 0.12.1-rc.f51a0c2

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.
@@ -1,4 +1,4 @@
1
- import { aI as ClientId, bw as RedirectUri, aJ as CodeChallenge, bk as PKCEState, C as CodeVerifier, q as EvmWalletAddress, a as EthereumChain, bN as Tx, B as BlockchainAmount, bG as SwapPreview, a0 as AssetDecimals, aA as Newtype, D as TokenMetadata, aH as Chain, b as EvmContractAddress, bf as OfferToken } from './tokens-namespace-CIWBtgt2.js';
1
+ import { aI as ClientId, bw as RedirectUri, aJ as CodeChallenge, bk as PKCEState, C as CodeVerifier, q as EvmWalletAddress, a as EthereumChain, bN as Tx, B as BlockchainAmount, bG as SwapPreview, a0 as AssetDecimals, aA as Newtype } from './tokens-namespace-CIWBtgt2.cjs';
2
2
  import { Hex, Abi, Hash, TransactionReceipt } from 'viem';
3
3
 
4
4
  type PKCEParams = {
@@ -113,67 +113,4 @@ declare const AssetIconUrl: (value: string) => AssetIconUrl;
113
113
  */
114
114
  type NonEmptyArray<T> = [T, ...T[]];
115
115
 
116
- /**
117
- * A token as a lookup names it. `Chain` rather than `EthereumChain` because
118
- * `OfferToken.chain` is the wider type; a Solana entry simply never matches,
119
- * since the snapshot models EVM chains only.
120
- */
121
- type TokenKey = {
122
- chain: Chain;
123
- address: EvmContractAddress;
124
- };
125
- /**
126
- * One `coinlist.tokens.list()` answer, indexed for the lookups a catalogue
127
- * makes: by the `(chain, address)` pairs `Offer.tokens` carries.
128
- *
129
- * The registry is fetched whole - a few hundred tokens across every chain in
130
- * one request - and then asked one question per offer. Building the index
131
- * once is what keeps that a map lookup per card rather than a scan of the
132
- * snapshot per card. The same rule frontline-web and every other host wrote
133
- * for themselves, kept here so that none of them has to.
134
- */
135
- type TokenRegistrySnapshot = {
136
- /** Every token the snapshot lists, in registry order. */
137
- readonly tokens: readonly TokenMetadata[];
138
- /** `chain:address` (address lowercased) to its metadata. */
139
- readonly byKey: ReadonlyMap<string, TokenMetadata>;
140
- };
141
- declare const TokenRegistrySnapshot: {
142
- /** Indexes a `tokens.list()` result. `[]` is a valid, empty snapshot. */
143
- fromTokens: (tokens: readonly TokenMetadata[]) => TokenRegistrySnapshot;
144
- /**
145
- * The registry's entry for one token, or `null` when it lists none. The
146
- * registry is curated, so `null` is an ordinary answer rather than an
147
- * error, and callers fall back to their own display defaults.
148
- */
149
- get: (snapshot: TokenRegistrySnapshot, token: TokenKey) => TokenMetadata | null;
150
- /**
151
- * The registry's entry for the token an offer is *about*, or `null` when
152
- * it lists none of them.
153
- *
154
- * Resolution follows {@link offerDisplayTokens}: the token a sale
155
- * distributes or a swap hands over, never the funding token the user pays
156
- * with. An offer deployed on several chains carries one such token per
157
- * chain, and the first the registry knows wins - they are the same asset,
158
- * so any listed one answers for the offer.
159
- */
160
- forOffer: (snapshot: TokenRegistrySnapshot, offer: {
161
- tokens: readonly OfferToken[];
162
- }) => TokenMetadata | null;
163
- };
164
- /**
165
- * The tokens an offer is *about*, most specific first: every `swap` entry,
166
- * then every `distribution` entry. `funding` entries name what a swap is paid
167
- * with (USDC, USDT) and never the asset on offer, so they are left out.
168
- *
169
- * `swap` outranks `distribution` because a swap product names the asset it
170
- * hands over precisely, while a sale's distribution entry names the same
171
- * token for a sale product and is accepted as the fallback. The checkout's
172
- * per-chain lookup and the catalogue's any-chain lookup both read this
173
- * ordering, which is why it is stated once, here.
174
- */
175
- declare function offerDisplayTokens(offer: {
176
- tokens: readonly OfferToken[];
177
- }): OfferToken[];
178
-
179
- export { AssetIconUrl as A, type BroadcastTxParams as B, type ConnectWallet as C, type EvmWallet as E, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, type WriteContractParams as W, ShortenedWalletAddress as a, FormattedPercentUi as b, TokenRegistrySnapshot as c, type EvmSigner as d, FormattedAmountUi as e, type PKCEParams as f, generatePKCEParams as g, offerDisplayTokens as o };
116
+ export { AssetIconUrl as A, type BroadcastTxParams as B, type ConnectWallet as C, type EvmWallet as E, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, type WriteContractParams as W, ShortenedWalletAddress as a, FormattedPercentUi as b, type EvmSigner as c, FormattedAmountUi as d, type PKCEParams as e, generatePKCEParams as g };
@@ -1,4 +1,4 @@
1
- import { aI as ClientId, bw as RedirectUri, aJ as CodeChallenge, bk as PKCEState, C as CodeVerifier, q as EvmWalletAddress, a as EthereumChain, bN as Tx, B as BlockchainAmount, bG as SwapPreview, a0 as AssetDecimals, aA as Newtype, D as TokenMetadata, aH as Chain, b as EvmContractAddress, bf as OfferToken } from './tokens-namespace-CIWBtgt2.cjs';
1
+ import { aI as ClientId, bw as RedirectUri, aJ as CodeChallenge, bk as PKCEState, C as CodeVerifier, q as EvmWalletAddress, a as EthereumChain, bN as Tx, B as BlockchainAmount, bG as SwapPreview, a0 as AssetDecimals, aA as Newtype } from './tokens-namespace-CIWBtgt2.js';
2
2
  import { Hex, Abi, Hash, TransactionReceipt } from 'viem';
3
3
 
4
4
  type PKCEParams = {
@@ -113,67 +113,4 @@ declare const AssetIconUrl: (value: string) => AssetIconUrl;
113
113
  */
114
114
  type NonEmptyArray<T> = [T, ...T[]];
115
115
 
116
- /**
117
- * A token as a lookup names it. `Chain` rather than `EthereumChain` because
118
- * `OfferToken.chain` is the wider type; a Solana entry simply never matches,
119
- * since the snapshot models EVM chains only.
120
- */
121
- type TokenKey = {
122
- chain: Chain;
123
- address: EvmContractAddress;
124
- };
125
- /**
126
- * One `coinlist.tokens.list()` answer, indexed for the lookups a catalogue
127
- * makes: by the `(chain, address)` pairs `Offer.tokens` carries.
128
- *
129
- * The registry is fetched whole - a few hundred tokens across every chain in
130
- * one request - and then asked one question per offer. Building the index
131
- * once is what keeps that a map lookup per card rather than a scan of the
132
- * snapshot per card. The same rule frontline-web and every other host wrote
133
- * for themselves, kept here so that none of them has to.
134
- */
135
- type TokenRegistrySnapshot = {
136
- /** Every token the snapshot lists, in registry order. */
137
- readonly tokens: readonly TokenMetadata[];
138
- /** `chain:address` (address lowercased) to its metadata. */
139
- readonly byKey: ReadonlyMap<string, TokenMetadata>;
140
- };
141
- declare const TokenRegistrySnapshot: {
142
- /** Indexes a `tokens.list()` result. `[]` is a valid, empty snapshot. */
143
- fromTokens: (tokens: readonly TokenMetadata[]) => TokenRegistrySnapshot;
144
- /**
145
- * The registry's entry for one token, or `null` when it lists none. The
146
- * registry is curated, so `null` is an ordinary answer rather than an
147
- * error, and callers fall back to their own display defaults.
148
- */
149
- get: (snapshot: TokenRegistrySnapshot, token: TokenKey) => TokenMetadata | null;
150
- /**
151
- * The registry's entry for the token an offer is *about*, or `null` when
152
- * it lists none of them.
153
- *
154
- * Resolution follows {@link offerDisplayTokens}: the token a sale
155
- * distributes or a swap hands over, never the funding token the user pays
156
- * with. An offer deployed on several chains carries one such token per
157
- * chain, and the first the registry knows wins - they are the same asset,
158
- * so any listed one answers for the offer.
159
- */
160
- forOffer: (snapshot: TokenRegistrySnapshot, offer: {
161
- tokens: readonly OfferToken[];
162
- }) => TokenMetadata | null;
163
- };
164
- /**
165
- * The tokens an offer is *about*, most specific first: every `swap` entry,
166
- * then every `distribution` entry. `funding` entries name what a swap is paid
167
- * with (USDC, USDT) and never the asset on offer, so they are left out.
168
- *
169
- * `swap` outranks `distribution` because a swap product names the asset it
170
- * hands over precisely, while a sale's distribution entry names the same
171
- * token for a sale product and is accepted as the fallback. The checkout's
172
- * per-chain lookup and the catalogue's any-chain lookup both read this
173
- * ordering, which is why it is stated once, here.
174
- */
175
- declare function offerDisplayTokens(offer: {
176
- tokens: readonly OfferToken[];
177
- }): OfferToken[];
178
-
179
- export { AssetIconUrl as A, type BroadcastTxParams as B, type ConnectWallet as C, type EvmWallet as E, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, type WriteContractParams as W, ShortenedWalletAddress as a, FormattedPercentUi as b, TokenRegistrySnapshot as c, type EvmSigner as d, FormattedAmountUi as e, type PKCEParams as f, generatePKCEParams as g, offerDisplayTokens as o };
116
+ export { AssetIconUrl as A, type BroadcastTxParams as B, type ConnectWallet as C, type EvmWallet as E, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, type WriteContractParams as W, ShortenedWalletAddress as a, FormattedPercentUi as b, type EvmSigner as c, FormattedAmountUi as d, type PKCEParams as e, generatePKCEParams as g };
@@ -136,7 +136,6 @@ __export(universal_exports, {
136
136
  TokenLogo: () => TokenLogo,
137
137
  TokenLogoUrl: () => TokenLogoUrl,
138
138
  TokenMetadata: () => TokenMetadata,
139
- TokenRegistrySnapshot: () => TokenRegistrySnapshot,
140
139
  TokensNamespaceImpl: () => TokensNamespaceImpl,
141
140
  TxExplorerUrl: () => TxExplorerUrl,
142
141
  USDC: () => USDC,
@@ -174,7 +173,6 @@ __export(universal_exports, {
174
173
  isChain: () => isChain,
175
174
  isOfferType: () => isOfferType,
176
175
  isSwapAvailable: () => isSwapAvailable,
177
- offerDisplayTokens: () => offerDisplayTokens,
178
176
  ondoQuoteOfferDeadline: () => ondoQuoteOfferDeadline,
179
177
  parseBlockchainAmount: () => parseBlockchainAmount,
180
178
  parseUint256: () => parseUint256,
@@ -3278,52 +3276,6 @@ var Erc20NamespaceImpl = class {
3278
3276
  }
3279
3277
  };
3280
3278
 
3281
- // src/universal/core/tokens/token-registry-snapshot.ts
3282
- var TokenRegistrySnapshot = {
3283
- /** Indexes a `tokens.list()` result. `[]` is a valid, empty snapshot. */
3284
- fromTokens: (tokens) => ({
3285
- tokens,
3286
- byKey: new Map(
3287
- tokens.map((token) => [registryKey(token.identifier), token])
3288
- )
3289
- }),
3290
- /**
3291
- * The registry's entry for one token, or `null` when it lists none. The
3292
- * registry is curated, so `null` is an ordinary answer rather than an
3293
- * error, and callers fall back to their own display defaults.
3294
- */
3295
- get: (snapshot, token) => snapshot.byKey.get(registryKey(token)) ?? null,
3296
- /**
3297
- * The registry's entry for the token an offer is *about*, or `null` when
3298
- * it lists none of them.
3299
- *
3300
- * Resolution follows {@link offerDisplayTokens}: the token a sale
3301
- * distributes or a swap hands over, never the funding token the user pays
3302
- * with. An offer deployed on several chains carries one such token per
3303
- * chain, and the first the registry knows wins - they are the same asset,
3304
- * so any listed one answers for the offer.
3305
- */
3306
- forOffer: (snapshot, offer) => {
3307
- for (const token of offerDisplayTokens(offer)) {
3308
- const metadata = TokenRegistrySnapshot.get(snapshot, token);
3309
- if (metadata !== null) {
3310
- return metadata;
3311
- }
3312
- }
3313
- return null;
3314
- }
3315
- };
3316
- function offerDisplayTokens(offer) {
3317
- const swaps = offer.tokens.filter((token) => token.role === "swap");
3318
- const distributions = offer.tokens.filter(
3319
- (token) => token.role === "distribution"
3320
- );
3321
- return [...swaps, ...distributions];
3322
- }
3323
- function registryKey(token) {
3324
- return `${token.chain}:${token.address.toLowerCase()}`;
3325
- }
3326
-
3327
3279
  // src/universal/api/nabu/tokens.ts
3328
3280
  var import_viem5 = require("viem");
3329
3281
 
@@ -3976,7 +3928,6 @@ var User = {
3976
3928
  TokenLogo,
3977
3929
  TokenLogoUrl,
3978
3930
  TokenMetadata,
3979
- TokenRegistrySnapshot,
3980
3931
  TokensNamespaceImpl,
3981
3932
  TxExplorerUrl,
3982
3933
  USDC,
@@ -4014,7 +3965,6 @@ var User = {
4014
3965
  isChain,
4015
3966
  isOfferType,
4016
3967
  isSwapAvailable,
4017
- offerDisplayTokens,
4018
3968
  ondoQuoteOfferDeadline,
4019
3969
  parseBlockchainAmount,
4020
3970
  parseUint256,