@chainflip/rpc 1.11.5 → 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(),
@@ -649,6 +650,46 @@ var cfLoanAccount = z.object({
649
650
  }).nullable()
650
651
  });
651
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
+ });
652
693
  export {
653
694
  accountInfoCommon,
654
695
  broker,
@@ -685,6 +726,7 @@ export {
685
726
  cfSwapRateV3,
686
727
  cfSwappingEnvironment,
687
728
  cfTradingStrategy,
729
+ cfVaultAddresses,
688
730
  chainGetBlockHash,
689
731
  ethereumAddress,
690
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.5",
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
  },