@chainflip/rpc 1.5.1 → 1.5.3

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.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/parsers.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/parsers.ts
2
2
  var _guard = require('@chainflip/utils/guard');
3
3
  var _string = require('@chainflip/utils/string');
4
4
  var _zod = require('zod');
@@ -9,22 +9,22 @@ var chainAssetMapFactory = (parser, defaultValue) => _zod.z.object({
9
9
  Bitcoin: _zod.z.object({ BTC: parser }),
10
10
  Ethereum: _zod.z.object({ ETH: parser, USDC: parser, FLIP: parser, USDT: parser }),
11
11
  Polkadot: _zod.z.object({ DOT: parser }),
12
- Arbitrum: _zod.z.object({ ETH: parser.default(defaultValue), USDC: parser.default(defaultValue) }).default({ ETH: defaultValue, USDC: defaultValue })
13
- // Solana: z.object({ SOL: parser.default(defaultValue) }),
12
+ Arbitrum: _zod.z.object({ ETH: parser, USDC: parser }),
13
+ Solana: _zod.z.object({ SOL: parser.default(defaultValue), USDC: parser.default(defaultValue) }).default({ SOL: defaultValue, USDC: defaultValue })
14
14
  });
15
15
  var chainBaseAssetMapFactory = (parser, defaultValue) => _zod.z.object({
16
16
  Bitcoin: _zod.z.object({ BTC: parser }),
17
17
  Ethereum: _zod.z.object({ ETH: parser, FLIP: parser, USDT: parser }),
18
18
  Polkadot: _zod.z.object({ DOT: parser }),
19
- Arbitrum: _zod.z.object({ ETH: parser.default(defaultValue), USDC: parser.default(defaultValue) }).default({ ETH: defaultValue, USDC: defaultValue })
20
- // Solana: z.object({ SOL: parser.default(defaultValue) }),
19
+ Arbitrum: _zod.z.object({ ETH: parser, USDC: parser }),
20
+ Solana: _zod.z.object({ SOL: parser.default(defaultValue), USDC: parser.default(defaultValue) }).default({ SOL: defaultValue, USDC: defaultValue })
21
21
  });
22
22
  var chainMapFactory = (parser, defaultValue) => _zod.z.object({
23
23
  Bitcoin: parser,
24
24
  Ethereum: parser,
25
25
  Polkadot: parser,
26
- Arbitrum: parser.default(defaultValue)
27
- // Solana: parser.default(defaultValue),
26
+ Arbitrum: parser,
27
+ Solana: parser.default(defaultValue)
28
28
  });
29
29
  var rpcAssetSchema = _zod.z.union([
30
30
  _zod.z.object({ chain: _zod.z.literal("Bitcoin"), asset: _zod.z.literal("BTC") }),
@@ -34,7 +34,9 @@ var rpcAssetSchema = _zod.z.union([
34
34
  _zod.z.object({ chain: _zod.z.literal("Ethereum"), asset: _zod.z.literal("USDC") }),
35
35
  _zod.z.object({ chain: _zod.z.literal("Ethereum"), asset: _zod.z.literal("USDT") }),
36
36
  _zod.z.object({ chain: _zod.z.literal("Arbitrum"), asset: _zod.z.literal("ETH") }),
37
- _zod.z.object({ chain: _zod.z.literal("Arbitrum"), asset: _zod.z.literal("USDC") })
37
+ _zod.z.object({ chain: _zod.z.literal("Arbitrum"), asset: _zod.z.literal("USDC") }),
38
+ _zod.z.object({ chain: _zod.z.literal("Solana"), asset: _zod.z.literal("SOL") }),
39
+ _zod.z.object({ chain: _zod.z.literal("Solana"), asset: _zod.z.literal("USDC") })
38
40
  ]);
39
41
  var rename = (mapping) => (obj) => Object.fromEntries(
40
42
  Object.entries(obj).map(([key, value]) => [
@@ -94,6 +96,15 @@ var cfFundingEnvironment = _zod.z.object({
94
96
  redemption_tax: numberOrHex,
95
97
  minimum_funding_amount: numberOrHex
96
98
  });
99
+ var defaultFeeInfo = {
100
+ limit_order_fee_hundredth_pips: 0,
101
+ range_order_fee_hundredth_pips: 0,
102
+ range_order_total_fees_earned: { base: "0x0", quote: "0x0" },
103
+ limit_order_total_fees_earned: { base: "0x0", quote: "0x0" },
104
+ range_total_swap_inputs: { base: "0x0", quote: "0x0" },
105
+ limit_total_swap_inputs: { base: "0x0", quote: "0x0" },
106
+ quote_asset: { chain: "Ethereum", asset: "USDC" }
107
+ };
97
108
  var cfPoolsEnvironment = _zod.z.object({
98
109
  fees: chainBaseAssetMapFactory(
99
110
  _zod.z.object({
@@ -104,16 +115,8 @@ var cfPoolsEnvironment = _zod.z.object({
104
115
  range_total_swap_inputs: _zod.z.object({ base: u256, quote: u256 }),
105
116
  limit_total_swap_inputs: _zod.z.object({ base: u256, quote: u256 }),
106
117
  quote_asset: _zod.z.object({ chain: _zod.z.literal("Ethereum"), asset: _zod.z.literal("USDC") })
107
- }),
108
- {
109
- limit_order_fee_hundredth_pips: 0,
110
- range_order_fee_hundredth_pips: 0,
111
- range_order_total_fees_earned: { base: "0x0", quote: "0x0" },
112
- limit_order_total_fees_earned: { base: "0x0", quote: "0x0" },
113
- range_total_swap_inputs: { base: "0x0", quote: "0x0" },
114
- limit_total_swap_inputs: { base: "0x0", quote: "0x0" },
115
- quote_asset: { chain: "Ethereum", asset: "USDC" }
116
- }
118
+ }).nullable().transform((info) => _nullishCoalesce(info, () => ( structuredClone(defaultFeeInfo)))),
119
+ structuredClone(defaultFeeInfo)
117
120
  )
118
121
  });
119
122
  var cfEnvironment = _zod.z.object({