@chainflip/rpc 1.4.4 → 1.4.5

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
@@ -11,6 +11,12 @@ var chainAssetMapFactory = (parser, defaultValue) => z.object({
11
11
  Polkadot: z.object({ DOT: parser }),
12
12
  Arbitrum: z.object({ ETH: parser.default(defaultValue), USDC: parser.default(defaultValue) })
13
13
  });
14
+ var chainBaseAssetMapFactory = (parser, defaultValue) => z.object({
15
+ Bitcoin: z.object({ BTC: parser }),
16
+ Ethereum: z.object({ ETH: parser, FLIP: parser, USDT: parser }),
17
+ Polkadot: z.object({ DOT: parser }),
18
+ Arbitrum: z.object({ ETH: parser.default(defaultValue), USDC: parser.default(defaultValue) })
19
+ });
14
20
  var chainMapFactory = (parser, defaultValue) => z.object({
15
21
  Bitcoin: parser,
16
22
  Ethereum: parser,
@@ -83,10 +89,33 @@ var cfFundingEnvironment = z.object({
83
89
  redemption_tax: numberOrHex,
84
90
  minimum_funding_amount: numberOrHex
85
91
  });
92
+ var cfPoolsEnvironment = z.object({
93
+ fees: chainBaseAssetMapFactory(
94
+ z.object({
95
+ limit_order_fee_hundredth_pips: z.number(),
96
+ range_order_fee_hundredth_pips: z.number(),
97
+ range_order_total_fees_earned: z.object({ base: u256, quote: u256 }),
98
+ limit_order_total_fees_earned: z.object({ base: u256, quote: u256 }),
99
+ range_total_swap_inputs: z.object({ base: u256, quote: u256 }),
100
+ limit_total_swap_inputs: z.object({ base: u256, quote: u256 }),
101
+ quote_asset: z.object({ chain: z.literal("Ethereum"), asset: z.literal("USDC") })
102
+ }),
103
+ {
104
+ limit_order_fee_hundredth_pips: 0,
105
+ range_order_fee_hundredth_pips: 0,
106
+ range_order_total_fees_earned: { base: "0x0", quote: "0x0" },
107
+ limit_order_total_fees_earned: { base: "0x0", quote: "0x0" },
108
+ range_total_swap_inputs: { base: "0x0", quote: "0x0" },
109
+ limit_total_swap_inputs: { base: "0x0", quote: "0x0" },
110
+ quote_asset: { chain: "Ethereum", asset: "USDC" }
111
+ }
112
+ )
113
+ });
86
114
  var cfEnvironment = z.object({
87
115
  ingress_egress: cfIngressEgressEnvironment,
88
116
  swapping: cfSwappingEnvironment,
89
- funding: cfFundingEnvironment
117
+ funding: cfFundingEnvironment,
118
+ pools: cfPoolsEnvironment
90
119
  });
91
120
  var cfBoostPoolsDepth = z.array(
92
121
  z.intersection(rpcAssetSchema, z.object({ tier: z.number(), available_amount: u256 }))
@@ -99,21 +128,100 @@ var brokerRequestSwapDepositAddress = z.object({
99
128
  source_chain_expiry_block: numberOrHex,
100
129
  channel_opening_fee: u256
101
130
  });
131
+ var unregistered = z.object({
132
+ role: z.literal("unregistered"),
133
+ flip_balance: numberOrHex
134
+ });
135
+ var broker = z.object({
136
+ role: z.literal("broker"),
137
+ flip_balance: numberOrHex,
138
+ earned_fees: chainAssetMapFactory(numberOrHex, 0)
139
+ });
140
+ var liquidityProvider = z.object({
141
+ role: z.literal("liquidity_provider"),
142
+ balances: chainAssetMapFactory(numberOrHex, "0x0"),
143
+ refund_addresses: chainMapFactory(z.string().nullable(), null),
144
+ flip_balance: numberOrHex,
145
+ earned_fees: chainAssetMapFactory(numberOrHex, 0)
146
+ });
147
+ var validator = z.object({
148
+ role: z.literal("validator"),
149
+ flip_balance: numberOrHex,
150
+ bond: numberOrHex,
151
+ last_heartbeat: z.number(),
152
+ reputation_points: z.number(),
153
+ keyholder_epochs: z.array(z.number()),
154
+ is_current_authority: z.boolean(),
155
+ is_current_backup: z.boolean(),
156
+ is_qualified: z.boolean(),
157
+ is_online: z.boolean(),
158
+ is_bidding: z.boolean(),
159
+ bound_redeem_address: hexString.nullable(),
160
+ apy_bp: z.number().nullable(),
161
+ restricted_balances: z.record(hexString, numberOrHex)
162
+ });
163
+ var cfAccountInfo = z.union([unregistered, broker, liquidityProvider, validator]);
164
+ var cfPoolPriceV2 = z.object({
165
+ sell: numberOrHex.nullable(),
166
+ buy: numberOrHex.nullable(),
167
+ range_order: numberOrHex,
168
+ base_asset: rpcAssetSchema,
169
+ quote_asset: rpcAssetSchema
170
+ });
171
+ var orderId = numberOrHex.transform((n) => String(n));
172
+ var limitOrder = z.object({
173
+ id: orderId,
174
+ tick: z.number(),
175
+ sell_amount: numberOrHex,
176
+ fees_earned: numberOrHex,
177
+ original_sell_amount: numberOrHex,
178
+ lp: z.string()
179
+ });
180
+ var ask = limitOrder.transform((order) => ({
181
+ ...order,
182
+ type: "ask"
183
+ }));
184
+ var bid = limitOrder.transform((order) => ({
185
+ ...order,
186
+ type: "bid"
187
+ }));
188
+ var rangeOrder = z.object({
189
+ id: orderId,
190
+ range: z.object({ start: z.number(), end: z.number() }),
191
+ liquidity: numberOrHex,
192
+ fees_earned: z.object({ base: numberOrHex, quote: numberOrHex }),
193
+ lp: z.string()
194
+ }).transform((order) => ({ ...order, type: "range" }));
195
+ var cfPoolOrders = z.object({
196
+ limit_orders: z.object({
197
+ asks: z.array(ask),
198
+ bids: z.array(bid)
199
+ }),
200
+ range_orders: z.array(rangeOrder)
201
+ });
102
202
  export {
203
+ broker,
103
204
  brokerRequestSwapDepositAddress,
205
+ cfAccountInfo,
104
206
  cfBoostPoolsDepth,
105
207
  cfEnvironment,
106
208
  cfFundingEnvironment,
107
209
  cfIngressEgressEnvironment,
210
+ cfPoolOrders,
211
+ cfPoolPriceV2,
212
+ cfPoolsEnvironment,
108
213
  cfSupportedAsssets,
109
214
  cfSwapRate,
110
215
  cfSwapRateV2,
111
216
  cfSwappingEnvironment,
112
217
  chainGetBlockHash,
113
218
  hexString,
219
+ liquidityProvider,
114
220
  numberOrHex,
115
221
  rpcResponse,
116
222
  stateGetMetadata,
117
223
  stateGetRuntimeVersion,
118
- u256
224
+ u256,
225
+ unregistered,
226
+ validator
119
227
  };
package/dist/types.d.cts CHANGED
@@ -1,24 +1,35 @@
1
+ import { z } from 'zod';
1
2
  import { RpcResult, RpcResponse } from './common.cjs';
2
3
  export { RpcMethod, RpcRequest as RpcParams } from './common.cjs';
3
- import 'zod';
4
- import './parsers.cjs';
4
+ import { unregistered, broker, validator, liquidityProvider } from './parsers.cjs';
5
+ export { RpcLimitOrder, RpcRangeOrder } from './parsers.cjs';
5
6
  import '@chainflip/utils/types';
6
7
 
8
+ type CfAccountInfo = RpcResult<'cf_account_info'>;
7
9
  type CfBoostPoolsDepth = RpcResult<'cf_boost_pools_depth'>;
8
10
  type CfEnvironment = RpcResult<'cf_environment'>;
9
11
  type CfFundingEnvironment = RpcResult<'cf_funding_environment'>;
10
12
  type CfIngressEgressEnvironment = RpcResult<'cf_ingress_egress_environment'>;
13
+ type CfPoolOrders = RpcResult<'cf_pool_orders'>;
14
+ type CfPoolPriceV2 = RpcResult<'cf_pool_price_v2'>;
11
15
  type CfSupportedAssets = RpcResult<'cf_supported_assets'>;
12
16
  type CfSwappingEnvironment = RpcResult<'cf_swapping_environment'>;
13
17
  type CfSwapRate = RpcResult<'cf_swap_rate'>;
14
18
  type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
19
+ type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
15
20
  type CfBoostPoolsDepthResponse = RpcResponse<'cf_boost_pools_depth'>;
16
21
  type CfEnvironmentResponse = RpcResponse<'cf_environment'>;
17
22
  type CfFundingEnvironmentResponse = RpcResponse<'cf_funding_environment'>;
18
23
  type CfIngressEgressEnvironmentResponse = RpcResponse<'cf_ingress_egress_environment'>;
24
+ type CfPoolOrdersResponse = RpcResponse<'cf_pool_orders'>;
25
+ type CfPoolPriceV2Response = RpcResponse<'cf_pool_price_v2'>;
19
26
  type CfSupportedAssetsResponse = RpcResponse<'cf_supported_assets'>;
20
27
  type CfSwappingEnvironmentResponse = RpcResponse<'cf_swapping_environment'>;
21
28
  type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
22
29
  type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
30
+ type CfUnregisteredAccount = z.output<typeof unregistered>;
31
+ type CfBrokerAccount = z.output<typeof broker>;
32
+ type CfValidatorAccount = z.output<typeof validator>;
33
+ type CfLiquidityProviderAccount = z.output<typeof liquidityProvider>;
23
34
 
24
- export { type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfEnvironment, type CfEnvironmentResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, RpcResult };
35
+ export { type CfAccountInfo, type CfAccountInfoResponse, type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfBrokerAccount, type CfEnvironment, type CfEnvironmentResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfLiquidityProviderAccount, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, type CfUnregisteredAccount, type CfValidatorAccount, RpcResult };
package/dist/types.d.ts CHANGED
@@ -1,24 +1,35 @@
1
+ import { z } from 'zod';
1
2
  import { RpcResult, RpcResponse } from './common.js';
2
3
  export { RpcMethod, RpcRequest as RpcParams } from './common.js';
3
- import 'zod';
4
- import './parsers.js';
4
+ import { unregistered, broker, validator, liquidityProvider } from './parsers.js';
5
+ export { RpcLimitOrder, RpcRangeOrder } from './parsers.js';
5
6
  import '@chainflip/utils/types';
6
7
 
8
+ type CfAccountInfo = RpcResult<'cf_account_info'>;
7
9
  type CfBoostPoolsDepth = RpcResult<'cf_boost_pools_depth'>;
8
10
  type CfEnvironment = RpcResult<'cf_environment'>;
9
11
  type CfFundingEnvironment = RpcResult<'cf_funding_environment'>;
10
12
  type CfIngressEgressEnvironment = RpcResult<'cf_ingress_egress_environment'>;
13
+ type CfPoolOrders = RpcResult<'cf_pool_orders'>;
14
+ type CfPoolPriceV2 = RpcResult<'cf_pool_price_v2'>;
11
15
  type CfSupportedAssets = RpcResult<'cf_supported_assets'>;
12
16
  type CfSwappingEnvironment = RpcResult<'cf_swapping_environment'>;
13
17
  type CfSwapRate = RpcResult<'cf_swap_rate'>;
14
18
  type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
19
+ type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
15
20
  type CfBoostPoolsDepthResponse = RpcResponse<'cf_boost_pools_depth'>;
16
21
  type CfEnvironmentResponse = RpcResponse<'cf_environment'>;
17
22
  type CfFundingEnvironmentResponse = RpcResponse<'cf_funding_environment'>;
18
23
  type CfIngressEgressEnvironmentResponse = RpcResponse<'cf_ingress_egress_environment'>;
24
+ type CfPoolOrdersResponse = RpcResponse<'cf_pool_orders'>;
25
+ type CfPoolPriceV2Response = RpcResponse<'cf_pool_price_v2'>;
19
26
  type CfSupportedAssetsResponse = RpcResponse<'cf_supported_assets'>;
20
27
  type CfSwappingEnvironmentResponse = RpcResponse<'cf_swapping_environment'>;
21
28
  type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
22
29
  type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
30
+ type CfUnregisteredAccount = z.output<typeof unregistered>;
31
+ type CfBrokerAccount = z.output<typeof broker>;
32
+ type CfValidatorAccount = z.output<typeof validator>;
33
+ type CfLiquidityProviderAccount = z.output<typeof liquidityProvider>;
23
34
 
24
- export { type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfEnvironment, type CfEnvironmentResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, RpcResult };
35
+ export { type CfAccountInfo, type CfAccountInfoResponse, type CfBoostPoolsDepth, type CfBoostPoolsDepthResponse, type CfBrokerAccount, type CfEnvironment, type CfEnvironmentResponse, type CfFundingEnvironment, type CfFundingEnvironmentResponse, type CfIngressEgressEnvironment, type CfIngressEgressEnvironmentResponse, type CfLiquidityProviderAccount, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfSupportedAssets, type CfSupportedAssetsResponse, type CfSwapRate, type CfSwapRateResponse, type CfSwapRateV2, type CfSwapRateV2Response, type CfSwappingEnvironment, type CfSwappingEnvironmentResponse, type CfUnregisteredAccount, type CfValidatorAccount, RpcResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/rpc",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@chainflip/utils": "^0.3.0",