@chainflip/rpc 1.11.4 → 1.11.6

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
@@ -1,4 +1,5 @@
1
1
  // src/parsers.ts
2
+ import { bytesToHex } from "@chainflip/utils/bytes";
2
3
  import { priceAssets } from "@chainflip/utils/chainflip";
3
4
  import { isUndefined } from "@chainflip/utils/guard";
4
5
  import { isHex } from "@chainflip/utils/string";
@@ -319,7 +320,7 @@ var cfAccountInfo = z.discriminatedUnion("role", [unregistered, broker, operator
319
320
  }
320
321
  }
321
322
  });
322
- var cfAccounts = z.array(z.tuple([z.string(), z.string()]));
323
+ var cfAccounts = z.array(z.tuple([accountId, z.string()]));
323
324
  var cfPoolPriceV2 = z.object({
324
325
  sell: numberOrHex.nullable(),
325
326
  buy: numberOrHex.nullable(),
@@ -492,8 +493,7 @@ var cfOraclePrices = z.array(
492
493
  );
493
494
  var broadcastPalletSafeModeStatuses = z.object({
494
495
  retry_enabled: z.boolean(),
495
- // TODO(1.10): make not optional
496
- egress_witnessing_enabled: z.boolean().optional()
496
+ egress_witnessing_enabled: z.boolean()
497
497
  });
498
498
  var ingressEgressPalletSafeModeStatuses = z.object({
499
499
  boost_deposits_enabled: z.boolean(),
@@ -501,7 +501,7 @@ var ingressEgressPalletSafeModeStatuses = z.object({
501
501
  deposit_channel_witnessing_enabled: z.boolean(),
502
502
  vault_deposit_witnessing_enabled: z.boolean()
503
503
  });
504
- var cfSafeModeStatusesBase = z.object({
504
+ var cfSafeModeStatuses = z.object({
505
505
  emissions: z.object({
506
506
  emissions_sync_enabled: z.boolean()
507
507
  }),
@@ -516,7 +516,7 @@ var cfSafeModeStatusesBase = z.object({
516
516
  liquidity_provider: z.object({
517
517
  deposit_enabled: z.boolean(),
518
518
  withdrawal_enabled: z.boolean(),
519
- internal_swaps_enabled: z.boolean().optional().default(false)
519
+ internal_swaps_enabled: z.boolean()
520
520
  }),
521
521
  validator: z.object({
522
522
  authority_rotation_enabled: z.boolean(),
@@ -550,66 +550,33 @@ var cfSafeModeStatusesBase = z.object({
550
550
  threshold_signature_solana: z.object({
551
551
  slashing_enabled: z.boolean()
552
552
  }),
553
+ lending_pools: z.object({
554
+ add_boost_funds_enabled: z.boolean(),
555
+ stop_boosting_enabled: z.boolean(),
556
+ // TODO(1.12): remove `optional` after all networks upgraded
557
+ borrowing_enabled: z.array(rpcAssetSchema).optional(),
558
+ add_lender_funds_enabled: z.array(rpcAssetSchema).optional(),
559
+ withdraw_lender_funds_enabled: z.array(rpcAssetSchema).optional(),
560
+ add_collateral_enabled: z.array(rpcAssetSchema).optional(),
561
+ remove_collateral_enabled: z.array(rpcAssetSchema).optional()
562
+ }),
553
563
  broadcast_ethereum: broadcastPalletSafeModeStatuses,
554
564
  broadcast_bitcoin: broadcastPalletSafeModeStatuses,
555
565
  broadcast_polkadot: broadcastPalletSafeModeStatuses,
556
566
  broadcast_arbitrum: broadcastPalletSafeModeStatuses,
557
567
  broadcast_solana: broadcastPalletSafeModeStatuses,
558
- broadcast_assethub: broadcastPalletSafeModeStatuses
559
- });
560
- var cfSafeModeStatuses = z.union([
561
- // TODO(1.10): remove
562
- cfSafeModeStatusesBase.extend({
563
- ingress_egress_ethereum: z.object({
564
- boost_deposits_enabled: z.boolean(),
565
- add_boost_funds_enabled: z.boolean(),
566
- stop_boosting_enabled: z.boolean(),
567
- deposits_enabled: z.boolean()
568
- }),
569
- ingress_egress_bitcoin: z.object({
570
- boost_deposits_enabled: z.boolean(),
571
- add_boost_funds_enabled: z.boolean(),
572
- stop_boosting_enabled: z.boolean(),
573
- deposits_enabled: z.boolean()
574
- }),
575
- ingress_egress_polkadot: z.object({
576
- boost_deposits_enabled: z.boolean(),
577
- add_boost_funds_enabled: z.boolean(),
578
- stop_boosting_enabled: z.boolean(),
579
- deposits_enabled: z.boolean()
580
- }),
581
- ingress_egress_arbitrum: z.object({
582
- boost_deposits_enabled: z.boolean(),
583
- add_boost_funds_enabled: z.boolean(),
584
- stop_boosting_enabled: z.boolean(),
585
- deposits_enabled: z.boolean()
586
- }),
587
- ingress_egress_solana: z.object({
588
- boost_deposits_enabled: z.boolean(),
589
- add_boost_funds_enabled: z.boolean(),
590
- stop_boosting_enabled: z.boolean(),
591
- deposits_enabled: z.boolean()
592
- }),
593
- ingress_egress_assethub: z.object({
594
- boost_deposits_enabled: z.boolean(),
595
- add_boost_funds_enabled: z.boolean(),
596
- stop_boosting_enabled: z.boolean(),
597
- deposits_enabled: z.boolean()
598
- })
599
- }),
600
- cfSafeModeStatusesBase.extend({
601
- lending_pools: z.object({
602
- add_boost_funds_enabled: z.boolean(),
603
- stop_boosting_enabled: z.boolean()
604
- }),
605
- ingress_egress_ethereum: ingressEgressPalletSafeModeStatuses,
606
- ingress_egress_bitcoin: ingressEgressPalletSafeModeStatuses,
607
- ingress_egress_polkadot: ingressEgressPalletSafeModeStatuses,
608
- ingress_egress_arbitrum: ingressEgressPalletSafeModeStatuses,
609
- ingress_egress_solana: ingressEgressPalletSafeModeStatuses,
610
- ingress_egress_assethub: ingressEgressPalletSafeModeStatuses
568
+ broadcast_assethub: broadcastPalletSafeModeStatuses,
569
+ ingress_egress_ethereum: ingressEgressPalletSafeModeStatuses,
570
+ ingress_egress_bitcoin: ingressEgressPalletSafeModeStatuses,
571
+ ingress_egress_polkadot: ingressEgressPalletSafeModeStatuses,
572
+ ingress_egress_arbitrum: ingressEgressPalletSafeModeStatuses,
573
+ ingress_egress_solana: ingressEgressPalletSafeModeStatuses,
574
+ ingress_egress_assethub: ingressEgressPalletSafeModeStatuses,
575
+ witnesser: z.enum(["CodeRed", "CodeGreen", "CodeAmber"]),
576
+ elections_generic: z.object({
577
+ oracle_price_elections: z.boolean()
611
578
  })
612
- ]);
579
+ });
613
580
  var cfLendingPools = z.array(
614
581
  z.object({
615
582
  asset: rpcAssetSchema,
@@ -683,6 +650,46 @@ var cfLoanAccount = z.object({
683
650
  }).nullable()
684
651
  });
685
652
  var cfLoanAccounts = z.array(cfLoanAccount);
653
+ var cfVaultAddresses = z.object({
654
+ ethereum: z.object({ Eth: z.array(z.number()).length(20).transform(bytesToHex) }),
655
+ arbitrum: z.object({ Arb: z.array(z.number()).length(20).transform(bytesToHex) }),
656
+ bitcoin: z.array(
657
+ z.tuple([
658
+ accountId,
659
+ z.object({
660
+ Btc: z.array(z.number()).transform((bytes) => new TextDecoder().decode(new Uint8Array(bytes)))
661
+ })
662
+ ])
663
+ )
664
+ }).transform(({ ethereum, arbitrum, bitcoin }) => {
665
+ const bitcoinAddresses = bitcoin.reduce((acc, [brokerId, { Btc }]) => {
666
+ let obj = acc.get(brokerId);
667
+ if (!obj) {
668
+ obj = { current: "", previous: "" };
669
+ acc.set(brokerId, obj);
670
+ }
671
+ if (!obj.previous) {
672
+ obj.previous = Btc;
673
+ } else {
674
+ obj.current = Btc;
675
+ }
676
+ return acc;
677
+ }, /* @__PURE__ */ new Map());
678
+ return {
679
+ Ethereum: ethereum.Eth,
680
+ Arbitrum: arbitrum.Arb,
681
+ Bitcoin: bitcoinAddresses
682
+ };
683
+ }).superRefine(({ Bitcoin }, ctx) => {
684
+ Bitcoin.forEach((value, key) => {
685
+ if (!value.current) {
686
+ ctx.addIssue({
687
+ message: `No current BTC address for broker ${key}`,
688
+ code: z.ZodIssueCode.custom
689
+ });
690
+ }
691
+ });
692
+ });
686
693
  export {
687
694
  accountInfoCommon,
688
695
  broker,
@@ -719,6 +726,7 @@ export {
719
726
  cfSwapRateV3,
720
727
  cfSwappingEnvironment,
721
728
  cfTradingStrategy,
729
+ cfVaultAddresses,
722
730
  chainGetBlockHash,
723
731
  ethereumAddress,
724
732
  hexString,
package/dist/types.d.cts CHANGED
@@ -39,6 +39,7 @@ type CfOraclePrices = RpcResult<'cf_oracle_prices'>;
39
39
  type CfLendingPools = RpcResult<'cf_lending_pools'>;
40
40
  type CfLendingConfig = RpcResult<'cf_lending_config'>;
41
41
  type CfLoanAccounts = RpcResult<'cf_loan_accounts'>;
42
+ type CfVaultAddresses = RpcResult<'cf_get_vault_addresses'>;
42
43
  type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
43
44
  type CfAccountsResponse = RpcResponse<'cf_accounts'>;
44
45
  type CfAuctionStateResponse = RpcResponse<'cf_auction_state'>;
@@ -72,6 +73,7 @@ type CfOraclePricesResponse = RpcResponse<'cf_oracle_prices'>;
72
73
  type CfLendingPoolsResponse = RpcResponse<'cf_lending_pools'>;
73
74
  type CfLendingConfigResponse = RpcResponse<'cf_lending_config'>;
74
75
  type CfLoanAccountsResponse = RpcResponse<'cf_loan_accounts'>;
76
+ type CfVaultAddressesResponse = RpcResponse<'cf_get_vault_addresses'>;
75
77
  type CfUnregisteredAccount = z.output<typeof unregistered>;
76
78
  type CfBrokerAccount = z.output<typeof broker>;
77
79
  type CfValidatorAccount = z.output<typeof validator>;
@@ -80,4 +82,4 @@ type CfOperatorAccount = z.output<typeof operator>;
80
82
  type LpTotalBalances = RpcResult<'lp_total_balances'>;
81
83
  type LpTotalBalancesResponse = RpcResponse<'lp_total_balances'>;
82
84
 
83
- 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 CfMonitoringSimulateAuction, type CfMonitoringSimulateAuctionResponse, 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 };
85
+ 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 CfMonitoringSimulateAuction, type CfMonitoringSimulateAuctionResponse, 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 CfVaultAddresses, type CfVaultAddressesResponse, type LpTotalBalances, type LpTotalBalancesResponse, RpcResult };
package/dist/types.d.ts CHANGED
@@ -39,6 +39,7 @@ type CfOraclePrices = RpcResult<'cf_oracle_prices'>;
39
39
  type CfLendingPools = RpcResult<'cf_lending_pools'>;
40
40
  type CfLendingConfig = RpcResult<'cf_lending_config'>;
41
41
  type CfLoanAccounts = RpcResult<'cf_loan_accounts'>;
42
+ type CfVaultAddresses = RpcResult<'cf_get_vault_addresses'>;
42
43
  type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
43
44
  type CfAccountsResponse = RpcResponse<'cf_accounts'>;
44
45
  type CfAuctionStateResponse = RpcResponse<'cf_auction_state'>;
@@ -72,6 +73,7 @@ type CfOraclePricesResponse = RpcResponse<'cf_oracle_prices'>;
72
73
  type CfLendingPoolsResponse = RpcResponse<'cf_lending_pools'>;
73
74
  type CfLendingConfigResponse = RpcResponse<'cf_lending_config'>;
74
75
  type CfLoanAccountsResponse = RpcResponse<'cf_loan_accounts'>;
76
+ type CfVaultAddressesResponse = RpcResponse<'cf_get_vault_addresses'>;
75
77
  type CfUnregisteredAccount = z.output<typeof unregistered>;
76
78
  type CfBrokerAccount = z.output<typeof broker>;
77
79
  type CfValidatorAccount = z.output<typeof validator>;
@@ -80,4 +82,4 @@ type CfOperatorAccount = z.output<typeof operator>;
80
82
  type LpTotalBalances = RpcResult<'lp_total_balances'>;
81
83
  type LpTotalBalancesResponse = RpcResponse<'lp_total_balances'>;
82
84
 
83
- 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 CfMonitoringSimulateAuction, type CfMonitoringSimulateAuctionResponse, 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 };
85
+ 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 CfMonitoringSimulateAuction, type CfMonitoringSimulateAuctionResponse, 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 CfVaultAddresses, type CfVaultAddressesResponse, type LpTotalBalances, type LpTotalBalancesResponse, RpcResult };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@chainflip/rpc",
3
- "version": "1.11.4",
3
+ "version": "1.11.6",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@chainflip/utils": "0.11.0",
7
7
  "zod": "^3.25.75"
8
8
  },
9
9
  "devDependencies": {
10
- "@types/node": "^24.5.2",
10
+ "@types/node": "^24.8.1",
11
11
  "@types/ws": "^8.18.1",
12
12
  "ws": "^8.18.3"
13
13
  },