@coinlist-co/react 0.12.2-rc.9fb6364 → 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-KRA6EM2L.js → chunk-3OTYQADF.js} +78 -4
- package/dist/chunk-3OTYQADF.js.map +1 -0
- package/dist/{chunk-BNMF2HMW.js → chunk-IAY3F42Q.js} +892 -512
- package/dist/chunk-IAY3F42Q.js.map +1 -0
- package/dist/{chunk-STAHYDLY.js → chunk-QRVIBG6H.js} +2 -2
- package/dist/client/index.cjs +5891 -3786
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +845 -30
- package/dist/client/index.d.ts +845 -30
- package/dist/client/index.js +2598 -910
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +361 -66
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +27 -5
- package/dist/server/index.d.ts +27 -5
- package/dist/server/index.js +9 -6
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-BJfFeowE.d.cts → time-DyjvzWso.d.cts} +735 -59
- package/dist/{tokens-namespace-BJfFeowE.d.ts → time-DyjvzWso.d.ts} +735 -59
- package/dist/{token-registry-snapshot-C1NxdBmF.d.ts → token-registry-snapshot-Bldj1r5X.d.ts} +74 -8
- package/dist/{token-registry-snapshot-DyjrA32p.d.cts → token-registry-snapshot-CbNCYP_5.d.cts} +74 -8
- package/dist/universal/index.cjs +848 -377
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +79 -6
- package/dist/universal/index.d.ts +79 -6
- package/dist/universal/index.js +36 -2
- package/package.json +1 -1
- package/dist/chunk-BNMF2HMW.js.map +0 -1
- package/dist/chunk-KRA6EM2L.js.map +0 -1
- package/dist/time-B5YOQxuh.d.ts +0 -50
- package/dist/time-BY3apBpc.d.cts +0 -50
- /package/dist/{chunk-STAHYDLY.js.map → chunk-QRVIBG6H.js.map} +0 -0
package/dist/server/index.cjs
CHANGED
|
@@ -1180,12 +1180,13 @@ var ServerAuthNamespaceImpl = class {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
});
|
|
1182
1182
|
} catch (err) {
|
|
1183
|
-
if (
|
|
1183
|
+
if (this.config.strict) {
|
|
1184
1184
|
throw err;
|
|
1185
1185
|
}
|
|
1186
|
-
this.log.child({ op: "logout" }).
|
|
1187
|
-
msg: "
|
|
1188
|
-
|
|
1186
|
+
this.log.child({ op: "logout" }).warning(
|
|
1187
|
+
() => ({ msg: "revoke failed; local session cleared regardless" }),
|
|
1188
|
+
err
|
|
1189
|
+
);
|
|
1189
1190
|
}
|
|
1190
1191
|
await setSession(null);
|
|
1191
1192
|
}
|
|
@@ -1292,40 +1293,6 @@ async function fetchAllPages(fetchPage, baseParams) {
|
|
|
1292
1293
|
return items;
|
|
1293
1294
|
}
|
|
1294
1295
|
|
|
1295
|
-
// src/universal/core/shared/utils/wire.ts
|
|
1296
|
-
function unknownTypeError(dto, model) {
|
|
1297
|
-
const type = dto.type;
|
|
1298
|
-
throw new ValidationError(
|
|
1299
|
-
`${model}.type: unknown type ${JSON.stringify(type)}`
|
|
1300
|
-
);
|
|
1301
|
-
}
|
|
1302
|
-
function requiredString(value, field) {
|
|
1303
|
-
const text = notBlankStringOrNull(value);
|
|
1304
|
-
if (text === null) {
|
|
1305
|
-
throw new ValidationError(
|
|
1306
|
-
`${field}: expected a non-blank string, got ${typeof value === "string" ? "a blank string" : String(value)}`
|
|
1307
|
-
);
|
|
1308
|
-
}
|
|
1309
|
-
return text;
|
|
1310
|
-
}
|
|
1311
|
-
function requiredDate(value, field) {
|
|
1312
|
-
const date = typeof value === "string" ? new Date(value) : null;
|
|
1313
|
-
if (date === null || Number.isNaN(date.getTime())) {
|
|
1314
|
-
throw new ValidationError(
|
|
1315
|
-
`${field}: expected a date, got ${JSON.stringify(value)}`
|
|
1316
|
-
);
|
|
1317
|
-
}
|
|
1318
|
-
return date;
|
|
1319
|
-
}
|
|
1320
|
-
function requiredArray(value, field) {
|
|
1321
|
-
if (!Array.isArray(value)) {
|
|
1322
|
-
throw new ValidationError(
|
|
1323
|
-
`${field}: expected an array, got ${typeof value}`
|
|
1324
|
-
);
|
|
1325
|
-
}
|
|
1326
|
-
return value;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
1296
|
// src/universal/types/blockchain/core.ts
|
|
1330
1297
|
var ETHEREUM_CHAINS = {
|
|
1331
1298
|
ethereum_mainnet: true,
|
|
@@ -1414,13 +1381,54 @@ function combineAmounts(a, b, op) {
|
|
|
1414
1381
|
}
|
|
1415
1382
|
var AssetSymbol = (value) => value;
|
|
1416
1383
|
|
|
1384
|
+
// src/universal/core/shared/utils/wire.ts
|
|
1385
|
+
function unknownTypeError(dto, model) {
|
|
1386
|
+
const type = dto.type;
|
|
1387
|
+
throw new ValidationError(
|
|
1388
|
+
`${model}.type: unknown type ${JSON.stringify(type)}`
|
|
1389
|
+
);
|
|
1390
|
+
}
|
|
1391
|
+
function requiredString(value, field) {
|
|
1392
|
+
const text = notBlankStringOrNull(value);
|
|
1393
|
+
if (text === null) {
|
|
1394
|
+
throw new ValidationError(
|
|
1395
|
+
`${field}: expected a non-blank string, got ${typeof value === "string" ? "a blank string" : String(value)}`
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
return text;
|
|
1399
|
+
}
|
|
1400
|
+
function requiredDate(value, field) {
|
|
1401
|
+
const date = typeof value === "string" ? new Date(value) : null;
|
|
1402
|
+
if (date === null || Number.isNaN(date.getTime())) {
|
|
1403
|
+
throw new ValidationError(
|
|
1404
|
+
`${field}: expected a date, got ${JSON.stringify(value)}`
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1407
|
+
return date;
|
|
1408
|
+
}
|
|
1409
|
+
function dateOrNull(value, field) {
|
|
1410
|
+
return value === null ? null : requiredDate(value, field);
|
|
1411
|
+
}
|
|
1412
|
+
function decimalOrNull(value) {
|
|
1413
|
+
return value === null ? null : DecimalString(value);
|
|
1414
|
+
}
|
|
1415
|
+
function requiredArray(value, field) {
|
|
1416
|
+
if (!Array.isArray(value)) {
|
|
1417
|
+
throw new ValidationError(
|
|
1418
|
+
`${field}: expected an array, got ${typeof value}`
|
|
1419
|
+
);
|
|
1420
|
+
}
|
|
1421
|
+
return value;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1417
1424
|
// src/universal/types/offer.ts
|
|
1418
1425
|
var OfferId = (value) => value;
|
|
1419
1426
|
var OfferSlug = (value) => value;
|
|
1420
1427
|
var OFFER_TYPES = {
|
|
1421
1428
|
"coinlist::token_sale": true,
|
|
1422
1429
|
"superstate::swap": true,
|
|
1423
|
-
"ondo::swap": true
|
|
1430
|
+
"ondo::swap": true,
|
|
1431
|
+
"centrifuge::vault": true
|
|
1424
1432
|
};
|
|
1425
1433
|
var isOfferType = (value) => Object.keys(OFFER_TYPES).includes(value);
|
|
1426
1434
|
var OfferEditorial = {
|
|
@@ -1462,6 +1470,7 @@ var Offer = {
|
|
|
1462
1470
|
// on the wire: copying them would hand every consumer a `startsAt` that
|
|
1463
1471
|
// is 1970 for one variant and a date for the others.
|
|
1464
1472
|
case "ondo::swap":
|
|
1473
|
+
case "centrifuge::vault":
|
|
1465
1474
|
return {
|
|
1466
1475
|
...base2,
|
|
1467
1476
|
type: dto.type,
|
|
@@ -1526,6 +1535,19 @@ var OfferSwapContract = {
|
|
|
1526
1535
|
address: EvmContractAddress(dto.address)
|
|
1527
1536
|
})
|
|
1528
1537
|
};
|
|
1538
|
+
var OfferVaultContract = {
|
|
1539
|
+
fromDto: (dto) => ({
|
|
1540
|
+
chain: Chain(dto.chain),
|
|
1541
|
+
address: EvmContractAddress(dto.address)
|
|
1542
|
+
}),
|
|
1543
|
+
/**
|
|
1544
|
+
* Drops every proxy on a chain this SDK does not name, as
|
|
1545
|
+
* `OfferToken.listFromDto` does: frontline publishes the full offer-token
|
|
1546
|
+
* chain list, which runs ahead of {@link Chain}, and one unmodelled chain
|
|
1547
|
+
* should not throw away the proxies the SDK can use.
|
|
1548
|
+
*/
|
|
1549
|
+
listFromDto: (dtos) => dtos.filter((dto) => isChain(dto.chain)).map(OfferVaultContract.fromDto)
|
|
1550
|
+
};
|
|
1529
1551
|
var OfferDetail = {
|
|
1530
1552
|
fromDto: (dto) => {
|
|
1531
1553
|
const fundingAssets = requiredArray(
|
|
@@ -1588,6 +1610,18 @@ var OfferDetail = {
|
|
|
1588
1610
|
"OfferDetail.swap_contracts"
|
|
1589
1611
|
).map(OfferSwapContract.fromDto)
|
|
1590
1612
|
};
|
|
1613
|
+
// No editorial, as for Ondo. `[]` is fine and a missing key is not, for
|
|
1614
|
+
// the same reason as `swap_contracts`: this is the spender a user
|
|
1615
|
+
// approves.
|
|
1616
|
+
case "centrifuge::vault":
|
|
1617
|
+
return {
|
|
1618
|
+
...base2,
|
|
1619
|
+
type: dto.type,
|
|
1620
|
+
logoUrl: notBlankStringOrNull(dto.logo_url),
|
|
1621
|
+
vaultContracts: OfferVaultContract.listFromDto(
|
|
1622
|
+
requiredArray(dto.vault_contracts, "OfferDetail.vault_contracts")
|
|
1623
|
+
)
|
|
1624
|
+
};
|
|
1591
1625
|
default:
|
|
1592
1626
|
return unknownTypeError(dto, "OfferDetail");
|
|
1593
1627
|
}
|
|
@@ -2059,6 +2093,291 @@ function transportFor(api, override, chain, logger) {
|
|
|
2059
2093
|
return typeof override === "string" ? (0, import_viem3.http)(override) : override;
|
|
2060
2094
|
}
|
|
2061
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
|
+
|
|
2062
2381
|
// src/universal/types/providers/coin-list/token-sale.ts
|
|
2063
2382
|
var ParticipationId = (value) => value;
|
|
2064
2383
|
var Blockchain = (value) => value;
|
|
@@ -2173,39 +2492,15 @@ var CoinListTokenSaleNamespaceImpl = class {
|
|
|
2173
2492
|
};
|
|
2174
2493
|
|
|
2175
2494
|
// src/universal/core/shared/blockchain/formatters.ts
|
|
2176
|
-
var
|
|
2495
|
+
var import_viem5 = require("viem");
|
|
2177
2496
|
function formatRawAmount(amount) {
|
|
2178
|
-
return (0,
|
|
2497
|
+
return (0, import_viem5.formatUnits)(amount.raw, amount.decimals);
|
|
2179
2498
|
}
|
|
2180
2499
|
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
2181
2500
|
var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
|
|
2182
2501
|
var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
|
|
2183
2502
|
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
2184
2503
|
|
|
2185
|
-
// src/universal/core/shared/blockchain/math.ts
|
|
2186
|
-
var import_viem5 = require("viem");
|
|
2187
|
-
function blockchainAmountFromRawOrThrow({
|
|
2188
|
-
label,
|
|
2189
|
-
raw,
|
|
2190
|
-
decimals
|
|
2191
|
-
}) {
|
|
2192
|
-
const trimmed = raw.trim();
|
|
2193
|
-
if (trimmed === "") {
|
|
2194
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
2195
|
-
}
|
|
2196
|
-
let value;
|
|
2197
|
-
try {
|
|
2198
|
-
value = BigInt(trimmed);
|
|
2199
|
-
} catch {
|
|
2200
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
2201
|
-
}
|
|
2202
|
-
try {
|
|
2203
|
-
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
2204
|
-
} catch {
|
|
2205
|
-
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
2504
|
// src/universal/types/providers/ondo/ondo.ts
|
|
2210
2505
|
var OndoTradingStatus = {
|
|
2211
2506
|
fromDto: (dto) => {
|
|
@@ -2221,7 +2516,6 @@ var OndoTradingStatus = {
|
|
|
2221
2516
|
};
|
|
2222
2517
|
}
|
|
2223
2518
|
};
|
|
2224
|
-
var decimalOrNull = (value) => value === null ? null : DecimalString(value);
|
|
2225
2519
|
var OndoQuote = {
|
|
2226
2520
|
fromDto: (dto) => {
|
|
2227
2521
|
const assetDecimals = AssetDecimals(dto.asset_decimals);
|
|
@@ -4059,6 +4353,7 @@ var CoinListServerImpl = class {
|
|
|
4059
4353
|
this.tokenSale = new CoinListTokenSaleNamespaceImpl(ctx);
|
|
4060
4354
|
this.superstate = new SuperstateSwapNamespaceImpl(ctx);
|
|
4061
4355
|
this.ondo = new OndoNamespaceImpl(ctx);
|
|
4356
|
+
this.centrifuge = new CentrifugeNamespaceImpl(ctx);
|
|
4062
4357
|
this.tokens = new TokensNamespaceImpl(
|
|
4063
4358
|
_config.tokensBaseUrl ?? NABU_BASE_URL,
|
|
4064
4359
|
logger
|