@chainflip/rpc 1.4.4 → 1.4.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
@@ -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,141 @@ 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
+ });
202
+ var boostPoolAmount = z.object({
203
+ account_id: z.string(),
204
+ amount: u256
205
+ });
206
+ var cfBoostPoolDetails = z.array(
207
+ z.intersection(
208
+ rpcAssetSchema,
209
+ z.object({
210
+ fee_tier: z.number(),
211
+ available_amounts: z.array(boostPoolAmount),
212
+ deposits_pending_finalization: z.array(
213
+ z.object({
214
+ deposit_id: z.number().transform(BigInt),
215
+ owed_amounts: z.array(boostPoolAmount)
216
+ })
217
+ ),
218
+ pending_withdrawals: z.array(
219
+ z.object({
220
+ account_id: z.string(),
221
+ pending_deposits: z.array(z.bigint())
222
+ })
223
+ )
224
+ })
225
+ )
226
+ );
227
+ var cfBoostPoolPendingFees = z.array(
228
+ z.intersection(
229
+ rpcAssetSchema,
230
+ z.object({
231
+ fee_tier: z.number(),
232
+ pending_fees: z.array(
233
+ z.object({
234
+ deposit_id: z.number().transform(BigInt),
235
+ fees: z.array(boostPoolAmount)
236
+ })
237
+ )
238
+ })
239
+ )
240
+ );
102
241
  export {
242
+ broker,
103
243
  brokerRequestSwapDepositAddress,
244
+ cfAccountInfo,
245
+ cfBoostPoolDetails,
246
+ cfBoostPoolPendingFees,
104
247
  cfBoostPoolsDepth,
105
248
  cfEnvironment,
106
249
  cfFundingEnvironment,
107
250
  cfIngressEgressEnvironment,
251
+ cfPoolOrders,
252
+ cfPoolPriceV2,
253
+ cfPoolsEnvironment,
108
254
  cfSupportedAsssets,
109
255
  cfSwapRate,
110
256
  cfSwapRateV2,
111
257
  cfSwappingEnvironment,
112
258
  chainGetBlockHash,
113
259
  hexString,
260
+ liquidityProvider,
114
261
  numberOrHex,
115
262
  rpcResponse,
116
263
  stateGetMetadata,
117
264
  stateGetRuntimeVersion,
118
- u256
265
+ u256,
266
+ unregistered,
267
+ validator
119
268
  };
package/dist/types.d.cts CHANGED
@@ -1,24 +1,41 @@
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'>;
9
+ type CfBoostPoolDetails = RpcResult<'cf_boost_pool_details'>;
10
+ type CfBoostPoolPendingFees = RpcResult<'cf_boost_pool_pending_fees'>;
7
11
  type CfBoostPoolsDepth = RpcResult<'cf_boost_pools_depth'>;
8
12
  type CfEnvironment = RpcResult<'cf_environment'>;
9
13
  type CfFundingEnvironment = RpcResult<'cf_funding_environment'>;
10
14
  type CfIngressEgressEnvironment = RpcResult<'cf_ingress_egress_environment'>;
15
+ type CfPoolOrders = RpcResult<'cf_pool_orders'>;
16
+ type CfPoolPriceV2 = RpcResult<'cf_pool_price_v2'>;
17
+ type CfPoolsEnvironment = RpcResult<'cf_pools_environment'>;
11
18
  type CfSupportedAssets = RpcResult<'cf_supported_assets'>;
12
19
  type CfSwappingEnvironment = RpcResult<'cf_swapping_environment'>;
13
20
  type CfSwapRate = RpcResult<'cf_swap_rate'>;
14
21
  type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
22
+ type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
23
+ type CfBoostPoolDetailsResponse = RpcResponse<'cf_boost_pool_details'>;
24
+ type CfBoostPoolPendingFeesResponse = RpcResponse<'cf_boost_pool_pending_fees'>;
15
25
  type CfBoostPoolsDepthResponse = RpcResponse<'cf_boost_pools_depth'>;
16
26
  type CfEnvironmentResponse = RpcResponse<'cf_environment'>;
17
27
  type CfFundingEnvironmentResponse = RpcResponse<'cf_funding_environment'>;
18
28
  type CfIngressEgressEnvironmentResponse = RpcResponse<'cf_ingress_egress_environment'>;
29
+ type CfPoolOrdersResponse = RpcResponse<'cf_pool_orders'>;
30
+ type CfPoolPriceV2Response = RpcResponse<'cf_pool_price_v2'>;
31
+ type CfPoolsEnvironmentResponse = RpcResponse<'cf_pools_environment'>;
19
32
  type CfSupportedAssetsResponse = RpcResponse<'cf_supported_assets'>;
20
33
  type CfSwappingEnvironmentResponse = RpcResponse<'cf_swapping_environment'>;
21
34
  type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
22
35
  type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
36
+ type CfUnregisteredAccount = z.output<typeof unregistered>;
37
+ type CfBrokerAccount = z.output<typeof broker>;
38
+ type CfValidatorAccount = z.output<typeof validator>;
39
+ type CfLiquidityProviderAccount = z.output<typeof liquidityProvider>;
23
40
 
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 };
41
+ export { type CfAccountInfo, type CfAccountInfoResponse, type CfBoostPoolDetails, type CfBoostPoolDetailsResponse, type CfBoostPoolPendingFees, type CfBoostPoolPendingFeesResponse, 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 CfPoolsEnvironment, type CfPoolsEnvironmentResponse, 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,41 @@
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'>;
9
+ type CfBoostPoolDetails = RpcResult<'cf_boost_pool_details'>;
10
+ type CfBoostPoolPendingFees = RpcResult<'cf_boost_pool_pending_fees'>;
7
11
  type CfBoostPoolsDepth = RpcResult<'cf_boost_pools_depth'>;
8
12
  type CfEnvironment = RpcResult<'cf_environment'>;
9
13
  type CfFundingEnvironment = RpcResult<'cf_funding_environment'>;
10
14
  type CfIngressEgressEnvironment = RpcResult<'cf_ingress_egress_environment'>;
15
+ type CfPoolOrders = RpcResult<'cf_pool_orders'>;
16
+ type CfPoolPriceV2 = RpcResult<'cf_pool_price_v2'>;
17
+ type CfPoolsEnvironment = RpcResult<'cf_pools_environment'>;
11
18
  type CfSupportedAssets = RpcResult<'cf_supported_assets'>;
12
19
  type CfSwappingEnvironment = RpcResult<'cf_swapping_environment'>;
13
20
  type CfSwapRate = RpcResult<'cf_swap_rate'>;
14
21
  type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
22
+ type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
23
+ type CfBoostPoolDetailsResponse = RpcResponse<'cf_boost_pool_details'>;
24
+ type CfBoostPoolPendingFeesResponse = RpcResponse<'cf_boost_pool_pending_fees'>;
15
25
  type CfBoostPoolsDepthResponse = RpcResponse<'cf_boost_pools_depth'>;
16
26
  type CfEnvironmentResponse = RpcResponse<'cf_environment'>;
17
27
  type CfFundingEnvironmentResponse = RpcResponse<'cf_funding_environment'>;
18
28
  type CfIngressEgressEnvironmentResponse = RpcResponse<'cf_ingress_egress_environment'>;
29
+ type CfPoolOrdersResponse = RpcResponse<'cf_pool_orders'>;
30
+ type CfPoolPriceV2Response = RpcResponse<'cf_pool_price_v2'>;
31
+ type CfPoolsEnvironmentResponse = RpcResponse<'cf_pools_environment'>;
19
32
  type CfSupportedAssetsResponse = RpcResponse<'cf_supported_assets'>;
20
33
  type CfSwappingEnvironmentResponse = RpcResponse<'cf_swapping_environment'>;
21
34
  type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
22
35
  type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
36
+ type CfUnregisteredAccount = z.output<typeof unregistered>;
37
+ type CfBrokerAccount = z.output<typeof broker>;
38
+ type CfValidatorAccount = z.output<typeof validator>;
39
+ type CfLiquidityProviderAccount = z.output<typeof liquidityProvider>;
23
40
 
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 };
41
+ export { type CfAccountInfo, type CfAccountInfoResponse, type CfBoostPoolDetails, type CfBoostPoolDetailsResponse, type CfBoostPoolPendingFees, type CfBoostPoolPendingFeesResponse, 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 CfPoolsEnvironment, type CfPoolsEnvironmentResponse, 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.6",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@chainflip/utils": "^0.3.0",