@coinlist-co/react 0.12.2-rc.aa91ce3 → 0.12.2-rc.bc20f5b

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.
Files changed (31) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-QRVIBG6H.js → chunk-3WW5FLT7.js} +2 -2
  3. package/dist/{chunk-IAY3F42Q.js → chunk-C6GF7MDF.js} +125 -158
  4. package/dist/chunk-C6GF7MDF.js.map +1 -0
  5. package/dist/{chunk-3OTYQADF.js → chunk-IZJ4JSSC.js} +2 -2
  6. package/dist/chunk-IZJ4JSSC.js.map +1 -0
  7. package/dist/client/index.cjs +4469 -3149
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +939 -167
  10. package/dist/client/index.d.ts +939 -167
  11. package/dist/client/index.js +3867 -2555
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.cjs +40 -49
  14. package/dist/server/index.cjs.map +1 -1
  15. package/dist/server/index.d.cts +3 -6
  16. package/dist/server/index.d.ts +3 -6
  17. package/dist/server/index.js +2 -2
  18. package/dist/server/index.js.map +1 -1
  19. package/dist/{time-DyjvzWso.d.cts → time-CVZpAkGY.d.cts} +276 -318
  20. package/dist/{time-DyjvzWso.d.ts → time-CVZpAkGY.d.ts} +276 -318
  21. package/dist/{token-registry-snapshot-Bldj1r5X.d.ts → token-registry-snapshot-BkwA8KmD.d.ts} +1 -1
  22. package/dist/{token-registry-snapshot-CbNCYP_5.d.cts → token-registry-snapshot-bR14QehS.d.cts} +1 -1
  23. package/dist/universal/index.cjs +26 -60
  24. package/dist/universal/index.cjs.map +1 -1
  25. package/dist/universal/index.d.cts +7 -12
  26. package/dist/universal/index.d.ts +7 -12
  27. package/dist/universal/index.js +2 -4
  28. package/package.json +1 -1
  29. package/dist/chunk-3OTYQADF.js.map +0 -1
  30. package/dist/chunk-IAY3F42Q.js.map +0 -1
  31. /package/dist/{chunk-QRVIBG6H.js.map → chunk-3WW5FLT7.js.map} +0 -0
package/README.md CHANGED
@@ -37,3 +37,13 @@ The flake provides the toolchain, not `node_modules` — install JS dependencies
37
37
  ```bash
38
38
  npm ci
39
39
  ```
40
+
41
+ ## Git hooks
42
+
43
+ The dev shell includes [pre-commit](https://pre-commit.com/). Register the push hook once:
44
+
45
+ ```bash
46
+ pre-commit install --hook-type pre-push
47
+ ```
48
+
49
+ The hook runs typecheck, Biome, and deslop.
@@ -9,7 +9,7 @@ import {
9
9
  getUUIDv4,
10
10
  internalLogger,
11
11
  viemChain
12
- } from "./chunk-IAY3F42Q.js";
12
+ } from "./chunk-C6GF7MDF.js";
13
13
 
14
14
  // src/universal/api/nabu/config.ts
15
15
  var NABU_BASE_URL = "https://asset.coinlist.co";
@@ -435,4 +435,4 @@ export {
435
435
  SDK_LOGGER_NAME,
436
436
  loggerOverPino
437
437
  };
438
- //# sourceMappingURL=chunk-QRVIBG6H.js.map
438
+ //# sourceMappingURL=chunk-3WW5FLT7.js.map
@@ -291,6 +291,106 @@ function isExpired({
291
291
  return now >= expiresAt - buffer;
292
292
  }
293
293
 
294
+ // src/universal/core/shared/blockchain/erc20/abi.ts
295
+ var ERC20_ABI = [
296
+ {
297
+ type: "function",
298
+ name: "allowance",
299
+ inputs: [
300
+ { name: "owner", type: "address" },
301
+ { name: "spender", type: "address" }
302
+ ],
303
+ outputs: [{ name: "", type: "uint256" }],
304
+ stateMutability: "view"
305
+ },
306
+ {
307
+ type: "function",
308
+ name: "approve",
309
+ inputs: [
310
+ { name: "spender", type: "address" },
311
+ { name: "amount", type: "uint256" }
312
+ ],
313
+ outputs: [{ name: "", type: "bool" }],
314
+ stateMutability: "nonpayable"
315
+ },
316
+ {
317
+ type: "function",
318
+ name: "balanceOf",
319
+ inputs: [{ name: "account", type: "address" }],
320
+ outputs: [{ name: "", type: "uint256" }],
321
+ stateMutability: "view"
322
+ },
323
+ {
324
+ type: "function",
325
+ name: "decimals",
326
+ inputs: [],
327
+ outputs: [{ name: "", type: "uint8" }],
328
+ stateMutability: "view"
329
+ },
330
+ {
331
+ type: "function",
332
+ name: "name",
333
+ inputs: [],
334
+ outputs: [{ name: "", type: "string" }],
335
+ stateMutability: "view"
336
+ },
337
+ {
338
+ type: "function",
339
+ name: "symbol",
340
+ inputs: [],
341
+ outputs: [{ name: "", type: "string" }],
342
+ stateMutability: "view"
343
+ },
344
+ {
345
+ type: "function",
346
+ name: "totalSupply",
347
+ inputs: [],
348
+ outputs: [{ name: "", type: "uint256" }],
349
+ stateMutability: "view"
350
+ },
351
+ {
352
+ type: "function",
353
+ name: "transfer",
354
+ inputs: [
355
+ { name: "recipient", type: "address" },
356
+ { name: "amount", type: "uint256" }
357
+ ],
358
+ outputs: [{ name: "", type: "bool" }],
359
+ stateMutability: "nonpayable"
360
+ },
361
+ {
362
+ type: "function",
363
+ name: "transferFrom",
364
+ inputs: [
365
+ { name: "sender", type: "address" },
366
+ { name: "recipient", type: "address" },
367
+ { name: "amount", type: "uint256" }
368
+ ],
369
+ outputs: [{ name: "", type: "bool" }],
370
+ stateMutability: "nonpayable"
371
+ },
372
+ {
373
+ type: "event",
374
+ name: "Approval",
375
+ inputs: [
376
+ { name: "owner", type: "address", indexed: true },
377
+ { name: "spender", type: "address", indexed: true },
378
+ { name: "value", type: "uint256", indexed: false }
379
+ ],
380
+ anonymous: false
381
+ },
382
+ {
383
+ type: "event",
384
+ name: "Transfer",
385
+ inputs: [
386
+ { name: "from", type: "address", indexed: true },
387
+ { name: "to", type: "address", indexed: true },
388
+ { name: "value", type: "uint256", indexed: false }
389
+ ],
390
+ anonymous: false
391
+ }
392
+ ];
393
+
294
394
  // src/universal/types/blockchain/core.ts
295
395
  var ETHEREUM_CHAINS = {
296
396
  ethereum_mainnet: true,
@@ -539,37 +639,6 @@ function requiredArray(value, field) {
539
639
  }
540
640
 
541
641
  // src/universal/types/providers/centrifuge/centrifuge.ts
542
- var CentrifugeVaultQuote = {
543
- fromDto: (dto) => {
544
- const spendDecimals = AssetDecimals(dto.spend_input_decimals);
545
- const shareDecimals = AssetDecimals(dto.share_decimals);
546
- return {
547
- chain: EthereumChain(dto.chain),
548
- symbol: AssetSymbol(dto.symbol),
549
- spendInputAmount: blockchainAmountFromRawOrThrow({
550
- label: "spend_input_amount",
551
- raw: dto.spend_input_amount,
552
- decimals: spendDecimals
553
- }),
554
- estimatedShares: blockchainAmountFromRawOrThrow({
555
- label: "estimated_shares",
556
- raw: dto.estimated_shares,
557
- decimals: shareDecimals
558
- }),
559
- indicativePrice: decimalOrNull(dto.indicative_price),
560
- minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
561
- label: "minimum_input_amount",
562
- raw: dto.minimum_input_amount,
563
- decimals: spendDecimals
564
- }),
565
- orderability: parseOrderability(
566
- dto.can_order,
567
- dto.reasons,
568
- "CentrifugeVaultQuote"
569
- )
570
- };
571
- }
572
- };
573
642
  var CentrifugeVaultStatus = {
574
643
  fromDto: (dto) => ({
575
644
  chain: EthereumChain(dto.chain),
@@ -608,12 +677,7 @@ var CentrifugeVaultBuyTransaction = {
608
677
  }
609
678
  return {
610
679
  ...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
611
- spendInputAmount,
612
- estimatedShares: blockchainAmountFromRawOrThrow({
613
- label: "estimated_shares",
614
- raw: dto.estimated_shares,
615
- decimals: AssetDecimals(dto.share_decimals)
616
- })
680
+ spendInputAmount
617
681
  };
618
682
  }
619
683
  };
@@ -737,30 +801,34 @@ function parseTransactionCore(dto, model) {
737
801
  }
738
802
 
739
803
  // src/universal/api/frontline/providers/centrifuge/centrifuge.ts
740
- async function getCentrifugeVaultQuote(api, params) {
804
+ async function getCentrifugeVaultStatus(api, params) {
741
805
  const dto = await api.send({
742
806
  method: "GET",
743
- url: "/v1/centrifuge/vault/quote",
807
+ url: "/v1/centrifuge/vault/status",
744
808
  queryParams: {
745
809
  symbol: params.symbol,
746
- chain: params.chain,
747
- amount: params.amount.raw.toString()
810
+ chain: params.chain
748
811
  },
749
812
  attributes: Attributes.protected()
750
813
  });
751
- return CentrifugeVaultQuote.fromDto(dto);
814
+ return CentrifugeVaultStatus.fromDto(dto);
752
815
  }
753
- async function getCentrifugeVaultStatus(api, params) {
816
+ async function buildCentrifugeVaultBuy(api, params) {
754
817
  const dto = await api.send({
755
- method: "GET",
756
- url: "/v1/centrifuge/vault/status",
757
- queryParams: {
758
- symbol: params.symbol,
759
- chain: params.chain
818
+ method: "POST",
819
+ url: "/v1/centrifuge/vault/invest",
820
+ body: {
821
+ ...walletFields(params),
822
+ amount: params.amount.raw.toString()
760
823
  },
761
824
  attributes: Attributes.protected()
762
825
  });
763
- return CentrifugeVaultStatus.fromDto(dto);
826
+ if (dto.spend_input_decimals !== params.amount.decimals) {
827
+ throw new ValidationError(
828
+ `spend_input_decimals: the request was priced in ${dto.spend_input_decimals} decimals but the deposit was sized in ${params.amount.decimals}`
829
+ );
830
+ }
831
+ return CentrifugeVaultBuyTransaction.fromDto(dto);
764
832
  }
765
833
  async function getCentrifugeVaultPosition(api, params) {
766
834
  const dto = await api.send({
@@ -995,12 +1063,6 @@ var CentrifugeNamespaceImpl = class {
995
1063
  this.ctx = ctx;
996
1064
  this.log = internalLogger(ctx.logger, "CENTRIFUGE");
997
1065
  }
998
- async getQuote(params) {
999
- return this.log.wrap("getQuote", params, async () => {
1000
- await this.ctx.ensureUserAuthenticated();
1001
- return getCentrifugeVaultQuote(this.ctx.api, params);
1002
- });
1003
- }
1004
1066
  async getVaultStatus(params) {
1005
1067
  return this.log.wrap("getVaultStatus", params, async () => {
1006
1068
  await this.ctx.ensureUserAuthenticated();
@@ -1031,107 +1093,13 @@ var CentrifugeNamespaceImpl = class {
1031
1093
  return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
1032
1094
  });
1033
1095
  }
1034
- };
1035
-
1036
- // src/universal/core/shared/blockchain/erc20/abi.ts
1037
- var ERC20_ABI = [
1038
- {
1039
- type: "function",
1040
- name: "allowance",
1041
- inputs: [
1042
- { name: "owner", type: "address" },
1043
- { name: "spender", type: "address" }
1044
- ],
1045
- outputs: [{ name: "", type: "uint256" }],
1046
- stateMutability: "view"
1047
- },
1048
- {
1049
- type: "function",
1050
- name: "approve",
1051
- inputs: [
1052
- { name: "spender", type: "address" },
1053
- { name: "amount", type: "uint256" }
1054
- ],
1055
- outputs: [{ name: "", type: "bool" }],
1056
- stateMutability: "nonpayable"
1057
- },
1058
- {
1059
- type: "function",
1060
- name: "balanceOf",
1061
- inputs: [{ name: "account", type: "address" }],
1062
- outputs: [{ name: "", type: "uint256" }],
1063
- stateMutability: "view"
1064
- },
1065
- {
1066
- type: "function",
1067
- name: "decimals",
1068
- inputs: [],
1069
- outputs: [{ name: "", type: "uint8" }],
1070
- stateMutability: "view"
1071
- },
1072
- {
1073
- type: "function",
1074
- name: "name",
1075
- inputs: [],
1076
- outputs: [{ name: "", type: "string" }],
1077
- stateMutability: "view"
1078
- },
1079
- {
1080
- type: "function",
1081
- name: "symbol",
1082
- inputs: [],
1083
- outputs: [{ name: "", type: "string" }],
1084
- stateMutability: "view"
1085
- },
1086
- {
1087
- type: "function",
1088
- name: "totalSupply",
1089
- inputs: [],
1090
- outputs: [{ name: "", type: "uint256" }],
1091
- stateMutability: "view"
1092
- },
1093
- {
1094
- type: "function",
1095
- name: "transfer",
1096
- inputs: [
1097
- { name: "recipient", type: "address" },
1098
- { name: "amount", type: "uint256" }
1099
- ],
1100
- outputs: [{ name: "", type: "bool" }],
1101
- stateMutability: "nonpayable"
1102
- },
1103
- {
1104
- type: "function",
1105
- name: "transferFrom",
1106
- inputs: [
1107
- { name: "sender", type: "address" },
1108
- { name: "recipient", type: "address" },
1109
- { name: "amount", type: "uint256" }
1110
- ],
1111
- outputs: [{ name: "", type: "bool" }],
1112
- stateMutability: "nonpayable"
1113
- },
1114
- {
1115
- type: "event",
1116
- name: "Approval",
1117
- inputs: [
1118
- { name: "owner", type: "address", indexed: true },
1119
- { name: "spender", type: "address", indexed: true },
1120
- { name: "value", type: "uint256", indexed: false }
1121
- ],
1122
- anonymous: false
1123
- },
1124
- {
1125
- type: "event",
1126
- name: "Transfer",
1127
- inputs: [
1128
- { name: "from", type: "address", indexed: true },
1129
- { name: "to", type: "address", indexed: true },
1130
- { name: "value", type: "uint256", indexed: false }
1131
- ],
1132
- anonymous: false
1096
+ async buildBuyTransaction(params) {
1097
+ return this.log.wrap("buildBuyTransaction", params, async () => {
1098
+ await this.ctx.ensureUserAuthenticated();
1099
+ return buildCentrifugeVaultBuy(this.ctx.api, params);
1100
+ });
1133
1101
  }
1134
- ];
1102
+ };
1135
1103
 
1136
1104
  // src/universal/api/pagination.ts
1137
1105
  async function fetchAllPages(fetchPage, baseParams) {
@@ -3883,6 +3851,7 @@ export {
3883
3851
  Millis,
3884
3852
  Seconds,
3885
3853
  isExpired,
3854
+ ERC20_ABI,
3886
3855
  ETHEREUM_CHAINS,
3887
3856
  EthereumChain,
3888
3857
  SOLANA_CHAINS,
@@ -3906,7 +3875,6 @@ export {
3906
3875
  Bps,
3907
3876
  blockchainAmountFromRawOrThrow,
3908
3877
  parseBlockchainAmount,
3909
- CentrifugeVaultQuote,
3910
3878
  CentrifugeVaultStatus,
3911
3879
  CentrifugeVaultBuyTransaction,
3912
3880
  CentrifugeVaultClaimTransaction,
@@ -3916,7 +3884,6 @@ export {
3916
3884
  CentrifugeVaultLegId,
3917
3885
  CentrifugeVaultClaimProceedsTransaction,
3918
3886
  CentrifugeNamespaceImpl,
3919
- ERC20_ABI,
3920
3887
  fetchAllPages,
3921
3888
  Cursor,
3922
3889
  PaginatedResponse,
@@ -4011,4 +3978,4 @@ export {
4011
3978
  OAuthRefreshToken,
4012
3979
  OAuthSession
4013
3980
  };
4014
- //# sourceMappingURL=chunk-IAY3F42Q.js.map
3981
+ //# sourceMappingURL=chunk-C6GF7MDF.js.map