@coinlist-co/react 0.12.2-rc.a59b344 → 0.12.2-rc.aa91ce3
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/{chunk-UJYSXXJF.js → chunk-3OTYQADF.js} +62 -153
- package/dist/chunk-3OTYQADF.js.map +1 -0
- package/dist/{chunk-NBO5E2RO.js → chunk-IAY3F42Q.js} +863 -519
- package/dist/chunk-IAY3F42Q.js.map +1 -0
- package/dist/{chunk-4IZ2F732.js → chunk-QRVIBG6H.js} +2 -2
- package/dist/client/index.cjs +6031 -4024
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +758 -6
- package/dist/client/index.d.ts +758 -6
- package/dist/client/index.js +2449 -821
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +291 -26
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +9 -2
- package/dist/server/index.d.ts +9 -2
- package/dist/server/index.js +4 -2
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-D_XSpiS-.d.cts → time-DyjvzWso.d.cts} +634 -41
- package/dist/{tokens-namespace-D_XSpiS-.d.ts → time-DyjvzWso.d.ts} +634 -41
- package/dist/{token-registry-snapshot-BsAfBL_b.d.ts → token-registry-snapshot-Bldj1r5X.d.ts} +66 -2
- package/dist/{token-registry-snapshot-Cc_eA5zM.d.cts → token-registry-snapshot-CbNCYP_5.d.cts} +66 -2
- package/dist/universal/index.cjs +736 -461
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +59 -321
- package/dist/universal/index.d.ts +59 -321
- package/dist/universal/index.js +25 -7
- package/package.json +1 -1
- package/dist/chunk-NBO5E2RO.js.map +0 -1
- package/dist/chunk-UJYSXXJF.js.map +0 -1
- package/dist/time-CFocgYyl.d.cts +0 -50
- package/dist/time-DvgN98Q9.d.ts +0 -50
- /package/dist/{chunk-4IZ2F732.js.map → chunk-QRVIBG6H.js.map} +0 -0
package/dist/server/index.cjs
CHANGED
|
@@ -1406,6 +1406,9 @@ function requiredDate(value, field) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
return date;
|
|
1408
1408
|
}
|
|
1409
|
+
function dateOrNull(value, field) {
|
|
1410
|
+
return value === null ? null : requiredDate(value, field);
|
|
1411
|
+
}
|
|
1409
1412
|
function decimalOrNull(value) {
|
|
1410
1413
|
return value === null ? null : DecimalString(value);
|
|
1411
1414
|
}
|
|
@@ -2090,6 +2093,291 @@ function transportFor(api, override, chain, logger) {
|
|
|
2090
2093
|
return typeof override === "string" ? (0, import_viem3.http)(override) : override;
|
|
2091
2094
|
}
|
|
2092
2095
|
|
|
2096
|
+
// src/universal/core/shared/blockchain/math.ts
|
|
2097
|
+
var import_viem4 = require("viem");
|
|
2098
|
+
function blockchainAmountFromRawOrThrow({
|
|
2099
|
+
label,
|
|
2100
|
+
raw,
|
|
2101
|
+
decimals
|
|
2102
|
+
}) {
|
|
2103
|
+
const trimmed = raw.trim();
|
|
2104
|
+
if (trimmed === "") {
|
|
2105
|
+
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
2106
|
+
}
|
|
2107
|
+
let value;
|
|
2108
|
+
try {
|
|
2109
|
+
value = BigInt(trimmed);
|
|
2110
|
+
} catch {
|
|
2111
|
+
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
2112
|
+
}
|
|
2113
|
+
try {
|
|
2114
|
+
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
2115
|
+
} catch {
|
|
2116
|
+
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
// src/universal/types/providers/centrifuge/centrifuge.ts
|
|
2121
|
+
var CentrifugeVaultQuote = {
|
|
2122
|
+
fromDto: (dto) => {
|
|
2123
|
+
const spendDecimals = AssetDecimals(dto.spend_input_decimals);
|
|
2124
|
+
const shareDecimals = AssetDecimals(dto.share_decimals);
|
|
2125
|
+
return {
|
|
2126
|
+
chain: EthereumChain(dto.chain),
|
|
2127
|
+
symbol: AssetSymbol(dto.symbol),
|
|
2128
|
+
spendInputAmount: blockchainAmountFromRawOrThrow({
|
|
2129
|
+
label: "spend_input_amount",
|
|
2130
|
+
raw: dto.spend_input_amount,
|
|
2131
|
+
decimals: spendDecimals
|
|
2132
|
+
}),
|
|
2133
|
+
estimatedShares: blockchainAmountFromRawOrThrow({
|
|
2134
|
+
label: "estimated_shares",
|
|
2135
|
+
raw: dto.estimated_shares,
|
|
2136
|
+
decimals: shareDecimals
|
|
2137
|
+
}),
|
|
2138
|
+
indicativePrice: decimalOrNull(dto.indicative_price),
|
|
2139
|
+
minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
|
|
2140
|
+
label: "minimum_input_amount",
|
|
2141
|
+
raw: dto.minimum_input_amount,
|
|
2142
|
+
decimals: spendDecimals
|
|
2143
|
+
}),
|
|
2144
|
+
orderability: parseOrderability(
|
|
2145
|
+
dto.can_order,
|
|
2146
|
+
dto.reasons,
|
|
2147
|
+
"CentrifugeVaultQuote"
|
|
2148
|
+
)
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
2152
|
+
var CentrifugeVaultStatus = {
|
|
2153
|
+
fromDto: (dto) => ({
|
|
2154
|
+
chain: EthereumChain(dto.chain),
|
|
2155
|
+
symbol: AssetSymbol(dto.symbol),
|
|
2156
|
+
vaultAddress: EvmContractAddress(dto.vault_address),
|
|
2157
|
+
linked: dto.linked,
|
|
2158
|
+
permissioned: dto.permissioned,
|
|
2159
|
+
membershipValidUntil: dateOrNull(
|
|
2160
|
+
dto.membership_valid_until,
|
|
2161
|
+
"CentrifugeVaultStatus.membership_valid_until"
|
|
2162
|
+
),
|
|
2163
|
+
halted: dto.halted,
|
|
2164
|
+
priceUpdatedAt: dateOrNull(
|
|
2165
|
+
dto.price_updated_at,
|
|
2166
|
+
"CentrifugeVaultStatus.price_updated_at"
|
|
2167
|
+
),
|
|
2168
|
+
orderability: parseOrderability(
|
|
2169
|
+
dto.can_order,
|
|
2170
|
+
dto.reasons,
|
|
2171
|
+
"CentrifugeVaultStatus"
|
|
2172
|
+
),
|
|
2173
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
|
|
2174
|
+
})
|
|
2175
|
+
};
|
|
2176
|
+
var CentrifugeVaultClaimTransaction = {
|
|
2177
|
+
fromDto: (dto) => ({
|
|
2178
|
+
...parseTransactionCore(dto, "CentrifugeVaultClaimTransaction"),
|
|
2179
|
+
claimableShares: blockchainAmountFromRawOrThrow({
|
|
2180
|
+
label: "claimable_shares",
|
|
2181
|
+
raw: dto.claimable_shares,
|
|
2182
|
+
decimals: AssetDecimals(dto.share_decimals)
|
|
2183
|
+
})
|
|
2184
|
+
})
|
|
2185
|
+
};
|
|
2186
|
+
var CentrifugeVaultPosition = {
|
|
2187
|
+
fromDto: (dto) => {
|
|
2188
|
+
const assetDecimals = AssetDecimals(dto.asset_decimals);
|
|
2189
|
+
const shareDecimals = AssetDecimals(dto.share_decimals);
|
|
2190
|
+
const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
|
|
2191
|
+
const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
|
|
2192
|
+
return {
|
|
2193
|
+
chain: EthereumChain(dto.chain),
|
|
2194
|
+
symbol: AssetSymbol(dto.symbol),
|
|
2195
|
+
walletAddress: EvmWalletAddress(dto.wallet_address),
|
|
2196
|
+
status: dto.status,
|
|
2197
|
+
requested: asset("requested", dto.requested),
|
|
2198
|
+
pending: asset("pending", dto.pending),
|
|
2199
|
+
filledAssets: asset("filled_assets", dto.filled_assets),
|
|
2200
|
+
earnedShares: shares("earned_shares", dto.earned_shares),
|
|
2201
|
+
claimedShares: shares("claimed_shares", dto.claimed_shares),
|
|
2202
|
+
claimableShares: shares("claimable_shares", dto.claimable_shares),
|
|
2203
|
+
shareBalance: shares("share_balance", dto.share_balance),
|
|
2204
|
+
averagePrice: decimalOrNull(dto.average_price),
|
|
2205
|
+
frozen: dto.frozen,
|
|
2206
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
var CentrifugeVaultRedeemPosition = {
|
|
2211
|
+
fromDto: (dto) => ({
|
|
2212
|
+
chain: EthereumChain(dto.chain),
|
|
2213
|
+
symbol: AssetSymbol(dto.symbol),
|
|
2214
|
+
walletAddress: EvmWalletAddress(dto.wallet_address),
|
|
2215
|
+
status: dto.status,
|
|
2216
|
+
pending: blockchainAmountFromRawOrThrow({
|
|
2217
|
+
label: "pending",
|
|
2218
|
+
raw: dto.pending,
|
|
2219
|
+
decimals: AssetDecimals(dto.share_decimals)
|
|
2220
|
+
}),
|
|
2221
|
+
claimableAssets: blockchainAmountFromRawOrThrow({
|
|
2222
|
+
label: "claimable_assets",
|
|
2223
|
+
raw: dto.claimable_assets,
|
|
2224
|
+
decimals: AssetDecimals(dto.asset_decimals)
|
|
2225
|
+
}),
|
|
2226
|
+
frozen: dto.frozen,
|
|
2227
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultRedeemPosition.as_of")
|
|
2228
|
+
})
|
|
2229
|
+
};
|
|
2230
|
+
var CentrifugeVaultClaimProceedsTransaction = {
|
|
2231
|
+
fromDto: (dto) => ({
|
|
2232
|
+
...parseTransactionCore(dto, "CentrifugeVaultClaimProceedsTransaction"),
|
|
2233
|
+
claimableAssets: blockchainAmountFromRawOrThrow({
|
|
2234
|
+
label: "claimable_assets",
|
|
2235
|
+
raw: dto.claimable_assets,
|
|
2236
|
+
decimals: AssetDecimals(dto.asset_decimals)
|
|
2237
|
+
})
|
|
2238
|
+
})
|
|
2239
|
+
};
|
|
2240
|
+
function parseOrderability(canOrder, reasons, model) {
|
|
2241
|
+
const [first, ...rest] = reasons;
|
|
2242
|
+
if (canOrder) {
|
|
2243
|
+
if (first !== void 0) {
|
|
2244
|
+
throw new ValidationError(
|
|
2245
|
+
`${model}.reasons: expected none when can_order is true, got ${JSON.stringify(reasons)}`
|
|
2246
|
+
);
|
|
2247
|
+
}
|
|
2248
|
+
return { type: "orderable" };
|
|
2249
|
+
}
|
|
2250
|
+
if (first === void 0) {
|
|
2251
|
+
throw new ValidationError(
|
|
2252
|
+
`${model}.reasons: expected at least one when can_order is false`
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2255
|
+
return { type: "blocked", reasons: [first, ...rest] };
|
|
2256
|
+
}
|
|
2257
|
+
function parseTransactionCore(dto, model) {
|
|
2258
|
+
return {
|
|
2259
|
+
tx: {
|
|
2260
|
+
to: EvmContractAddress(dto.to),
|
|
2261
|
+
data: HexEncodedTransactionData(dto.data)
|
|
2262
|
+
},
|
|
2263
|
+
expiresAt: dateOrNull(dto.expires_at, `${model}.expires_at`)
|
|
2264
|
+
};
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// src/universal/api/frontline/providers/centrifuge/centrifuge.ts
|
|
2268
|
+
async function getCentrifugeVaultQuote(api, params) {
|
|
2269
|
+
const dto = await api.send({
|
|
2270
|
+
method: "GET",
|
|
2271
|
+
url: "/v1/centrifuge/vault/quote",
|
|
2272
|
+
queryParams: {
|
|
2273
|
+
symbol: params.symbol,
|
|
2274
|
+
chain: params.chain,
|
|
2275
|
+
amount: params.amount.raw.toString()
|
|
2276
|
+
},
|
|
2277
|
+
attributes: Attributes.protected()
|
|
2278
|
+
});
|
|
2279
|
+
return CentrifugeVaultQuote.fromDto(dto);
|
|
2280
|
+
}
|
|
2281
|
+
async function getCentrifugeVaultStatus(api, params) {
|
|
2282
|
+
const dto = await api.send({
|
|
2283
|
+
method: "GET",
|
|
2284
|
+
url: "/v1/centrifuge/vault/status",
|
|
2285
|
+
queryParams: {
|
|
2286
|
+
symbol: params.symbol,
|
|
2287
|
+
chain: params.chain
|
|
2288
|
+
},
|
|
2289
|
+
attributes: Attributes.protected()
|
|
2290
|
+
});
|
|
2291
|
+
return CentrifugeVaultStatus.fromDto(dto);
|
|
2292
|
+
}
|
|
2293
|
+
async function getCentrifugeVaultPosition(api, params) {
|
|
2294
|
+
const dto = await api.send({
|
|
2295
|
+
method: "GET",
|
|
2296
|
+
url: "/v1/centrifuge/vault/position",
|
|
2297
|
+
queryParams: walletFields(params),
|
|
2298
|
+
attributes: Attributes.protected()
|
|
2299
|
+
});
|
|
2300
|
+
return CentrifugeVaultPosition.fromDto(dto);
|
|
2301
|
+
}
|
|
2302
|
+
async function getCentrifugeVaultRedeemPosition(api, params) {
|
|
2303
|
+
const dto = await api.send({
|
|
2304
|
+
method: "GET",
|
|
2305
|
+
url: "/v1/centrifuge/vault/redeem-position",
|
|
2306
|
+
queryParams: walletFields(params),
|
|
2307
|
+
attributes: Attributes.protected()
|
|
2308
|
+
});
|
|
2309
|
+
return CentrifugeVaultRedeemPosition.fromDto(dto);
|
|
2310
|
+
}
|
|
2311
|
+
async function createCentrifugeVaultClaim(api, params) {
|
|
2312
|
+
const dto = await api.send({
|
|
2313
|
+
method: "POST",
|
|
2314
|
+
url: "/v1/centrifuge/vault/claim",
|
|
2315
|
+
body: walletFields(params),
|
|
2316
|
+
attributes: Attributes.protected()
|
|
2317
|
+
});
|
|
2318
|
+
return CentrifugeVaultClaimTransaction.fromDto(dto);
|
|
2319
|
+
}
|
|
2320
|
+
async function createCentrifugeVaultClaimProceeds(api, params) {
|
|
2321
|
+
const dto = await api.send({
|
|
2322
|
+
method: "POST",
|
|
2323
|
+
url: "/v1/centrifuge/vault/claim-proceeds",
|
|
2324
|
+
body: walletFields(params),
|
|
2325
|
+
attributes: Attributes.protected()
|
|
2326
|
+
});
|
|
2327
|
+
return CentrifugeVaultClaimProceedsTransaction.fromDto(dto);
|
|
2328
|
+
}
|
|
2329
|
+
function walletFields(params) {
|
|
2330
|
+
return {
|
|
2331
|
+
symbol: params.symbol,
|
|
2332
|
+
chain: params.chain,
|
|
2333
|
+
wallet_address: params.walletAddress
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
// src/universal/core/checkout/centrifuge/centrifuge-namespace.ts
|
|
2338
|
+
var CentrifugeNamespaceImpl = class {
|
|
2339
|
+
constructor(ctx) {
|
|
2340
|
+
this.ctx = ctx;
|
|
2341
|
+
this.log = internalLogger(ctx.logger, "CENTRIFUGE");
|
|
2342
|
+
}
|
|
2343
|
+
async getQuote(params) {
|
|
2344
|
+
return this.log.wrap("getQuote", params, async () => {
|
|
2345
|
+
await this.ctx.ensureUserAuthenticated();
|
|
2346
|
+
return getCentrifugeVaultQuote(this.ctx.api, params);
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
async getVaultStatus(params) {
|
|
2350
|
+
return this.log.wrap("getVaultStatus", params, async () => {
|
|
2351
|
+
await this.ctx.ensureUserAuthenticated();
|
|
2352
|
+
return getCentrifugeVaultStatus(this.ctx.api, params);
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
async getPosition(params) {
|
|
2356
|
+
return this.log.wrap("getPosition", params, async () => {
|
|
2357
|
+
await this.ctx.ensureUserAuthenticated();
|
|
2358
|
+
return getCentrifugeVaultPosition(this.ctx.api, params);
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
async getRedeemPosition(params) {
|
|
2362
|
+
return this.log.wrap("getRedeemPosition", params, async () => {
|
|
2363
|
+
await this.ctx.ensureUserAuthenticated();
|
|
2364
|
+
return getCentrifugeVaultRedeemPosition(this.ctx.api, params);
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
async createClaim(params) {
|
|
2368
|
+
return this.log.wrap("createClaim", params, async () => {
|
|
2369
|
+
await this.ctx.ensureUserAuthenticated();
|
|
2370
|
+
return createCentrifugeVaultClaim(this.ctx.api, params);
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
async createClaimProceeds(params) {
|
|
2374
|
+
return this.log.wrap("createClaimProceeds", params, async () => {
|
|
2375
|
+
await this.ctx.ensureUserAuthenticated();
|
|
2376
|
+
return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
};
|
|
2380
|
+
|
|
2093
2381
|
// src/universal/types/providers/coin-list/token-sale.ts
|
|
2094
2382
|
var ParticipationId = (value) => value;
|
|
2095
2383
|
var Blockchain = (value) => value;
|
|
@@ -2204,39 +2492,15 @@ var CoinListTokenSaleNamespaceImpl = class {
|
|
|
2204
2492
|
};
|
|
2205
2493
|
|
|
2206
2494
|
// src/universal/core/shared/blockchain/formatters.ts
|
|
2207
|
-
var
|
|
2495
|
+
var import_viem5 = require("viem");
|
|
2208
2496
|
function formatRawAmount(amount) {
|
|
2209
|
-
return (0,
|
|
2497
|
+
return (0, import_viem5.formatUnits)(amount.raw, amount.decimals);
|
|
2210
2498
|
}
|
|
2211
2499
|
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
2212
2500
|
var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
|
|
2213
2501
|
var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
|
|
2214
2502
|
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
2215
2503
|
|
|
2216
|
-
// src/universal/core/shared/blockchain/math.ts
|
|
2217
|
-
var import_viem5 = require("viem");
|
|
2218
|
-
function blockchainAmountFromRawOrThrow({
|
|
2219
|
-
label,
|
|
2220
|
-
raw,
|
|
2221
|
-
decimals
|
|
2222
|
-
}) {
|
|
2223
|
-
const trimmed = raw.trim();
|
|
2224
|
-
if (trimmed === "") {
|
|
2225
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
2226
|
-
}
|
|
2227
|
-
let value;
|
|
2228
|
-
try {
|
|
2229
|
-
value = BigInt(trimmed);
|
|
2230
|
-
} catch {
|
|
2231
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
2232
|
-
}
|
|
2233
|
-
try {
|
|
2234
|
-
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
2235
|
-
} catch {
|
|
2236
|
-
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
2504
|
// src/universal/types/providers/ondo/ondo.ts
|
|
2241
2505
|
var OndoTradingStatus = {
|
|
2242
2506
|
fromDto: (dto) => {
|
|
@@ -4089,6 +4353,7 @@ var CoinListServerImpl = class {
|
|
|
4089
4353
|
this.tokenSale = new CoinListTokenSaleNamespaceImpl(ctx);
|
|
4090
4354
|
this.superstate = new SuperstateSwapNamespaceImpl(ctx);
|
|
4091
4355
|
this.ondo = new OndoNamespaceImpl(ctx);
|
|
4356
|
+
this.centrifuge = new CentrifugeNamespaceImpl(ctx);
|
|
4092
4357
|
this.tokens = new TokensNamespaceImpl(
|
|
4093
4358
|
_config.tokensBaseUrl ?? NABU_BASE_URL,
|
|
4094
4359
|
logger
|