@chainflip/rpc 1.11.0-beta.9 → 1.11.0

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/parsers.mjs CHANGED
@@ -5,7 +5,8 @@ import { isHex } from "@chainflip/utils/string";
5
5
  import { z } from "zod";
6
6
  var hexString = z.string().refine(isHex, { message: "Invalid hex string" });
7
7
  var u256 = hexString.transform((value) => BigInt(value));
8
- var numberOrHex = z.union([z.number().transform((n) => BigInt(n)), u256]);
8
+ var numericString = z.string().regex(/^[0-9]+$/);
9
+ var numberOrHex = z.union([z.number(), u256, numericString]).transform((n) => BigInt(n));
9
10
  var chainAssetMapFactory = (parser, _defaultValue) => z.object({
10
11
  Bitcoin: z.object({ BTC: parser }),
11
12
  Ethereum: z.object({ ETH: parser, USDC: parser, FLIP: parser, USDT: parser }),
@@ -13,7 +14,7 @@ var chainAssetMapFactory = (parser, _defaultValue) => z.object({
13
14
  Arbitrum: z.object({ ETH: parser, USDC: parser }),
14
15
  Solana: z.object({ SOL: parser, USDC: parser }),
15
16
  Assethub: z.object({ DOT: parser, USDC: parser, USDT: parser })
16
- });
17
+ }).omit({ Polkadot: true });
17
18
  var chainBaseAssetMapFactory = (parser, _defaultValue) => z.object({
18
19
  Bitcoin: z.object({ BTC: parser }),
19
20
  Ethereum: z.object({ ETH: parser, FLIP: parser, USDT: parser }),
@@ -21,7 +22,7 @@ var chainBaseAssetMapFactory = (parser, _defaultValue) => z.object({
21
22
  Arbitrum: z.object({ ETH: parser, USDC: parser }),
22
23
  Solana: z.object({ SOL: parser, USDC: parser }),
23
24
  Assethub: z.object({ DOT: parser, USDC: parser, USDT: parser })
24
- });
25
+ }).omit({ Polkadot: true });
25
26
  var chainMapFactory = (parser, _defaultValue) => z.object({
26
27
  Bitcoin: parser,
27
28
  Ethereum: parser,
@@ -29,7 +30,7 @@ var chainMapFactory = (parser, _defaultValue) => z.object({
29
30
  Arbitrum: parser,
30
31
  Solana: parser,
31
32
  Assethub: parser
32
- });
33
+ }).omit({ Polkadot: true });
33
34
  var rpcAssetSchema = z.union([
34
35
  z.object({ chain: z.literal("Bitcoin"), asset: z.literal("BTC") }),
35
36
  z.object({ chain: z.literal("Polkadot"), asset: z.literal("DOT") }),
@@ -211,6 +212,7 @@ var delegationStatus = z.object({
211
212
  bid: numberOrHex
212
213
  });
213
214
  var accountInfoCommon = {
215
+ vanity_name: z.string().optional(),
214
216
  flip_balance: numberOrHex,
215
217
  asset_balances: chainAssetMapFactory(numberOrHex, 0),
216
218
  bond: numberOrHex,
@@ -284,7 +286,24 @@ var liquidityProvider = z.object({
284
286
  ...accountInfoCommon,
285
287
  refund_addresses: chainMapFactory(z.string().nullable(), null),
286
288
  earned_fees: chainAssetMapFactory(numberOrHex, 0),
287
- boost_balances: chainAssetMapFactory(boostBalances, [])
289
+ boost_balances: chainAssetMapFactory(boostBalances, []),
290
+ lending_positions: z.array(
291
+ z.intersection(
292
+ rpcAssetSchema,
293
+ z.object({
294
+ total_amount: numberOrHex,
295
+ available_amount: numberOrHex
296
+ })
297
+ )
298
+ ).optional(),
299
+ collateral_balances: z.array(
300
+ z.intersection(
301
+ rpcAssetSchema,
302
+ z.object({
303
+ amount: numberOrHex
304
+ })
305
+ )
306
+ ).optional()
288
307
  });
289
308
  var oldValidator = z.object({
290
309
  role: z.literal("validator"),
@@ -625,6 +644,77 @@ var cfSafeModeStatuses = z.union([
625
644
  ingress_egress_assethub: ingressEgressPalletSafeModeStatuses
626
645
  })
627
646
  ]);
647
+ var cfLendingPools = z.array(
648
+ z.object({
649
+ asset: rpcAssetSchema,
650
+ total_amount: numberOrHex,
651
+ available_amount: numberOrHex,
652
+ utilisation_rate: z.number(),
653
+ current_interest_rate: z.number(),
654
+ origination_fee: z.number(),
655
+ liquidation_fee: z.number(),
656
+ interest_rate_curve: z.object({
657
+ interest_at_zero_utilisation: z.number(),
658
+ junction_utilisation: z.number(),
659
+ interest_at_junction_utilisation: z.number(),
660
+ interest_at_max_utilisation: z.number()
661
+ })
662
+ })
663
+ );
664
+ var cfLendingConfig = z.object({
665
+ ltv_thresholds: z.object({
666
+ minimum: numberOrHex,
667
+ target: numberOrHex,
668
+ topup: numberOrHex,
669
+ soft_liquidation: numberOrHex,
670
+ soft_liquidation_abort: numberOrHex,
671
+ hard_liquidation: numberOrHex,
672
+ hard_liquidation_abort: numberOrHex
673
+ }),
674
+ network_fee_contributions: z.object({
675
+ from_interest: z.number(),
676
+ from_origination_fee: z.number(),
677
+ from_liquidation_fee: z.number()
678
+ }),
679
+ fee_swap_interval_blocks: z.number(),
680
+ interest_payment_interval_blocks: z.number(),
681
+ fee_swap_threshold_usd: numberOrHex,
682
+ liquidation_swap_chunk_size_usd: numberOrHex,
683
+ soft_liquidation_max_oracle_slippage: z.number(),
684
+ hard_liquidation_max_oracle_slippage: z.number(),
685
+ fee_swap_max_oracle_slippage: z.number()
686
+ });
687
+ var cfLoanAccount = z.object({
688
+ account: accountId,
689
+ primary_collateral_asset: rpcAssetSchema,
690
+ ltv_ratio: numberOrHex,
691
+ collateral: z.array(
692
+ z.intersection(
693
+ rpcAssetSchema,
694
+ z.object({
695
+ amount: numberOrHex
696
+ })
697
+ )
698
+ ),
699
+ loans: z.array(
700
+ z.object({
701
+ loan_id: z.number(),
702
+ asset: rpcAssetSchema,
703
+ created_at: z.number(),
704
+ principal_amount: numberOrHex
705
+ })
706
+ ),
707
+ liquidation_status: z.object({
708
+ liquidation_swaps: z.array(
709
+ z.object({
710
+ swap_request_id: z.number(),
711
+ loan_id: z.number()
712
+ })
713
+ ),
714
+ is_hard: z.boolean()
715
+ }).nullable()
716
+ });
717
+ var cfLoanAccounts = z.array(cfLoanAccount);
628
718
  export {
629
719
  accountInfoCommon,
630
720
  broker,
@@ -643,6 +733,10 @@ export {
643
733
  cfGetTradingStrategies,
644
734
  cfGetTradingStrategyLimits,
645
735
  cfIngressEgressEnvironment,
736
+ cfLendingConfig,
737
+ cfLendingPools,
738
+ cfLoanAccount,
739
+ cfLoanAccounts,
646
740
  cfOraclePrices,
647
741
  cfPoolDepth,
648
742
  cfPoolOrderbook,
@@ -663,6 +757,7 @@ export {
663
757
  lpTotalBalances,
664
758
  newCfAccountInfo,
665
759
  numberOrHex,
760
+ numericString,
666
761
  oldBroker,
667
762
  oldCfAccountInfo,
668
763
  oldLiquidityProvider,
package/dist/types.d.cts CHANGED
@@ -35,6 +35,9 @@ type CfSwapRate = RpcResult<'cf_swap_rate'>;
35
35
  type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
36
36
  type CfSwapRateV3 = RpcResult<'cf_swap_rate_v3'>;
37
37
  type CfOraclePrices = RpcResult<'cf_oracle_prices'>;
38
+ type CfLendingPools = RpcResult<'cf_lending_pools'>;
39
+ type CfLendingConfig = RpcResult<'cf_lending_config'>;
40
+ type CfLoanAccounts = RpcResult<'cf_loan_accounts'>;
38
41
  type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
39
42
  type CfAccountsResponse = RpcResponse<'cf_accounts'>;
40
43
  type CfAuctionStateResponse = RpcResponse<'cf_auction_state'>;
@@ -64,6 +67,9 @@ type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
64
67
  type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
65
68
  type CfSwapRateV3Response = RpcResponse<'cf_swap_rate_v3'>;
66
69
  type CfOraclePricesResponse = RpcResponse<'cf_oracle_prices'>;
70
+ type CfLendingPoolsResponse = RpcResponse<'cf_lending_pools'>;
71
+ type CfLendingConfigResponse = RpcResponse<'cf_lending_config'>;
72
+ type CfLoanAccountsResponse = RpcResponse<'cf_loan_accounts'>;
67
73
  type CfUnregisteredAccount = z.output<typeof unregistered>;
68
74
  type CfBrokerAccount = z.output<typeof broker>;
69
75
  type CfValidatorAccount = z.output<typeof validator>;
@@ -72,4 +78,4 @@ type CfOperatorAccount = z.output<typeof operator>;
72
78
  type LpTotalBalances = RpcResult<'lp_total_balances'>;
73
79
  type LpTotalBalancesResponse = RpcResponse<'lp_total_balances'>;
74
80
 
75
- export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, type CfAuctionState, type CfAuctionStateResponse, type CfAvailablePools, type CfAvailablePoolsResponse, type CfBoostPoolDetails, type CfBoostPoolDetailsResponse, type CfBoostPoolPendingFees, type CfBoostPoolPendingFeesResponse, type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfBrokerAccount, type CfEncodeCfParameters, type CfEncodeCfParametersResponse, type CfEnvironment, type CfEnvironmentResponse, type CfFailedCallArbitrum, type CfFailedCallArbitrumResponse, type CfFailedCallEthereum, type CfFailedCallEthereumResponse, type CfFlipSupply, type CfFlipSupplyResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfGetTradingStrategies, type CfGetTradingStrategiesResponse, type CfGetTradingStrategyLimits, type CfGetTradingStrategyLimitsResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfLiquidityProviderAccount, type CfOperatorAccount, type CfOraclePrices, type CfOraclePricesResponse, type CfPoolDepth, type CfPoolDepthResponse, type CfPoolOrderbook, type CfPoolOrderbookResponse, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfPoolsEnvironment, type CfPoolsEnvironmentResponse, type CfRequestSwapParameterEncoding, type CfRequestSwapParameterEncodingResponse, type CfSafeModeStatuses, type CfSafeModeStatusesResponse, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwapRateV3, type CfSwapRateV3Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, type CfUnregisteredAccount, type CfValidatorAccount, type LpTotalBalances, type LpTotalBalancesResponse, RpcResult };
81
+ export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, type CfAuctionState, type CfAuctionStateResponse, type CfAvailablePools, type CfAvailablePoolsResponse, type CfBoostPoolDetails, type CfBoostPoolDetailsResponse, type CfBoostPoolPendingFees, type CfBoostPoolPendingFeesResponse, type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfBrokerAccount, type CfEncodeCfParameters, type CfEncodeCfParametersResponse, type CfEnvironment, type CfEnvironmentResponse, type CfFailedCallArbitrum, type CfFailedCallArbitrumResponse, type CfFailedCallEthereum, type CfFailedCallEthereumResponse, type CfFlipSupply, type CfFlipSupplyResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfGetTradingStrategies, type CfGetTradingStrategiesResponse, type CfGetTradingStrategyLimits, type CfGetTradingStrategyLimitsResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfLendingConfig, type CfLendingConfigResponse, type CfLendingPools, type CfLendingPoolsResponse, type CfLiquidityProviderAccount, type CfLoanAccounts, type CfLoanAccountsResponse, type CfOperatorAccount, type CfOraclePrices, type CfOraclePricesResponse, type CfPoolDepth, type CfPoolDepthResponse, type CfPoolOrderbook, type CfPoolOrderbookResponse, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfPoolsEnvironment, type CfPoolsEnvironmentResponse, type CfRequestSwapParameterEncoding, type CfRequestSwapParameterEncodingResponse, type CfSafeModeStatuses, type CfSafeModeStatusesResponse, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwapRateV3, type CfSwapRateV3Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, type CfUnregisteredAccount, type CfValidatorAccount, type LpTotalBalances, type LpTotalBalancesResponse, RpcResult };
package/dist/types.d.ts CHANGED
@@ -35,6 +35,9 @@ type CfSwapRate = RpcResult<'cf_swap_rate'>;
35
35
  type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
36
36
  type CfSwapRateV3 = RpcResult<'cf_swap_rate_v3'>;
37
37
  type CfOraclePrices = RpcResult<'cf_oracle_prices'>;
38
+ type CfLendingPools = RpcResult<'cf_lending_pools'>;
39
+ type CfLendingConfig = RpcResult<'cf_lending_config'>;
40
+ type CfLoanAccounts = RpcResult<'cf_loan_accounts'>;
38
41
  type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
39
42
  type CfAccountsResponse = RpcResponse<'cf_accounts'>;
40
43
  type CfAuctionStateResponse = RpcResponse<'cf_auction_state'>;
@@ -64,6 +67,9 @@ type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
64
67
  type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
65
68
  type CfSwapRateV3Response = RpcResponse<'cf_swap_rate_v3'>;
66
69
  type CfOraclePricesResponse = RpcResponse<'cf_oracle_prices'>;
70
+ type CfLendingPoolsResponse = RpcResponse<'cf_lending_pools'>;
71
+ type CfLendingConfigResponse = RpcResponse<'cf_lending_config'>;
72
+ type CfLoanAccountsResponse = RpcResponse<'cf_loan_accounts'>;
67
73
  type CfUnregisteredAccount = z.output<typeof unregistered>;
68
74
  type CfBrokerAccount = z.output<typeof broker>;
69
75
  type CfValidatorAccount = z.output<typeof validator>;
@@ -72,4 +78,4 @@ type CfOperatorAccount = z.output<typeof operator>;
72
78
  type LpTotalBalances = RpcResult<'lp_total_balances'>;
73
79
  type LpTotalBalancesResponse = RpcResponse<'lp_total_balances'>;
74
80
 
75
- export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, type CfAuctionState, type CfAuctionStateResponse, type CfAvailablePools, type CfAvailablePoolsResponse, type CfBoostPoolDetails, type CfBoostPoolDetailsResponse, type CfBoostPoolPendingFees, type CfBoostPoolPendingFeesResponse, type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfBrokerAccount, type CfEncodeCfParameters, type CfEncodeCfParametersResponse, type CfEnvironment, type CfEnvironmentResponse, type CfFailedCallArbitrum, type CfFailedCallArbitrumResponse, type CfFailedCallEthereum, type CfFailedCallEthereumResponse, type CfFlipSupply, type CfFlipSupplyResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfGetTradingStrategies, type CfGetTradingStrategiesResponse, type CfGetTradingStrategyLimits, type CfGetTradingStrategyLimitsResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfLiquidityProviderAccount, type CfOperatorAccount, type CfOraclePrices, type CfOraclePricesResponse, type CfPoolDepth, type CfPoolDepthResponse, type CfPoolOrderbook, type CfPoolOrderbookResponse, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfPoolsEnvironment, type CfPoolsEnvironmentResponse, type CfRequestSwapParameterEncoding, type CfRequestSwapParameterEncodingResponse, type CfSafeModeStatuses, type CfSafeModeStatusesResponse, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwapRateV3, type CfSwapRateV3Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, type CfUnregisteredAccount, type CfValidatorAccount, type LpTotalBalances, type LpTotalBalancesResponse, RpcResult };
81
+ export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, type CfAuctionState, type CfAuctionStateResponse, type CfAvailablePools, type CfAvailablePoolsResponse, type CfBoostPoolDetails, type CfBoostPoolDetailsResponse, type CfBoostPoolPendingFees, type CfBoostPoolPendingFeesResponse, type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfBrokerAccount, type CfEncodeCfParameters, type CfEncodeCfParametersResponse, type CfEnvironment, type CfEnvironmentResponse, type CfFailedCallArbitrum, type CfFailedCallArbitrumResponse, type CfFailedCallEthereum, type CfFailedCallEthereumResponse, type CfFlipSupply, type CfFlipSupplyResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfGetTradingStrategies, type CfGetTradingStrategiesResponse, type CfGetTradingStrategyLimits, type CfGetTradingStrategyLimitsResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfLendingConfig, type CfLendingConfigResponse, type CfLendingPools, type CfLendingPoolsResponse, type CfLiquidityProviderAccount, type CfLoanAccounts, type CfLoanAccountsResponse, type CfOperatorAccount, type CfOraclePrices, type CfOraclePricesResponse, type CfPoolDepth, type CfPoolDepthResponse, type CfPoolOrderbook, type CfPoolOrderbookResponse, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfPoolsEnvironment, type CfPoolsEnvironmentResponse, type CfRequestSwapParameterEncoding, type CfRequestSwapParameterEncodingResponse, type CfSafeModeStatuses, type CfSafeModeStatusesResponse, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwapRateV3, type CfSwapRateV3Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, type CfUnregisteredAccount, type CfValidatorAccount, type LpTotalBalances, type LpTotalBalancesResponse, RpcResult };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@chainflip/rpc",
3
- "version": "1.11.0-beta.9",
3
+ "version": "1.11.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@chainflip/utils": "0.8.18",
6
+ "@chainflip/utils": "0.11.0",
7
7
  "zod": "^3.25.75"
8
8
  },
9
9
  "devDependencies": {
10
- "@types/node": "^24.3.1",
10
+ "@types/node": "^24.5.2",
11
11
  "@types/ws": "^8.18.1",
12
12
  "ws": "^8.18.3"
13
13
  },