@chainflip/rpc 2.0.0 → 2.0.2

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/common.cjs CHANGED
@@ -40,13 +40,14 @@ var _zod = require('zod');
40
40
 
41
41
 
42
42
 
43
+
43
44
 
44
45
 
45
46
  var _parserscjs = require('./parsers.cjs');
46
47
 
47
48
  var rpcResult = {
48
49
  broker_request_swap_deposit_address: _parserscjs.brokerRequestSwapDepositAddress,
49
- broker_request_account_creation_deposit_address: _parserscjs.brokerRequestSwapDepositAddress,
50
+ broker_request_account_creation_deposit_address: _parserscjs.brokerRequestAccountCreationDepositAddress,
50
51
  broker_request_swap_parameter_encoding: _parserscjs.requestSwapParameterEncoding,
51
52
  cf_request_swap_parameter_encoding: _parserscjs.requestSwapParameterEncoding,
52
53
  cf_accounts: _parserscjs.cfAccounts,
package/dist/common.d.cts CHANGED
@@ -80,37 +80,6 @@ type EncodeCfParametersParams = [
80
80
  dcaParams?: Nullish<DcaParams>
81
81
  ];
82
82
  type RpcRequest = WithHash<{
83
- broker_request_swap_deposit_address: [
84
- sourceAsset: UncheckedAssetAndChain,
85
- destinationAsset: UncheckedAssetAndChain,
86
- destinationAddress: string,
87
- brokerCommission: number,
88
- ccmMetadata: Nullish<CcmParams>,
89
- boostFee: Nullish<number>,
90
- affiliateFees: Nullish<{
91
- account: string;
92
- bps: number;
93
- }[]>,
94
- fillOrKillParams: FillOrKillParams,
95
- dcaParams?: Nullish<DcaParams>
96
- ];
97
- broker_request_account_creation_deposit_address: [
98
- asset: UncheckedAssetAndChain,
99
- refundAddress: string,
100
- boostFee: Nullish<number>,
101
- signatureData: {
102
- Ethereum: {
103
- signature: HexString;
104
- signer: HexString;
105
- sigType: 'Eip712';
106
- };
107
- },
108
- transactionMetadata: {
109
- nonce: number;
110
- expiryBlock: number;
111
- }
112
- ];
113
- broker_request_swap_parameter_encoding: RequestSwapParameterEncodingParams;
114
83
  cf_request_swap_parameter_encoding: [
115
84
  brokerAccountId: string,
116
85
  ...RequestSwapParameterEncodingParams
@@ -215,6 +184,37 @@ type RpcRequest = WithHash<{
215
184
  cf_get_vault_addresses: [];
216
185
  }> & {
217
186
  chain_getBlockHash: [blockHeight?: number];
187
+ broker_request_swap_deposit_address: [
188
+ sourceAsset: UncheckedAssetAndChain,
189
+ destinationAsset: UncheckedAssetAndChain,
190
+ destinationAddress: string,
191
+ brokerCommission: number,
192
+ ccmMetadata: Nullish<CcmParams>,
193
+ boostFee: Nullish<number>,
194
+ affiliateFees: Nullish<{
195
+ account: string;
196
+ bps: number;
197
+ }[]>,
198
+ fillOrKillParams: FillOrKillParams,
199
+ dcaParams?: Nullish<DcaParams>
200
+ ];
201
+ broker_request_account_creation_deposit_address: [
202
+ signatureData: {
203
+ Ethereum: {
204
+ signature: HexString;
205
+ signer: HexString;
206
+ sig_type: 'Eip712';
207
+ };
208
+ },
209
+ transactionMetadata: {
210
+ nonce: number;
211
+ expiry_block: number;
212
+ },
213
+ asset: UncheckedAssetAndChain,
214
+ boostFee: Nullish<number>,
215
+ refundAddress: string
216
+ ];
217
+ broker_request_swap_parameter_encoding: RequestSwapParameterEncodingParams;
218
218
  };
219
219
  declare const rpcResult: {
220
220
  readonly broker_request_swap_deposit_address: z.ZodObject<{
@@ -237,23 +237,29 @@ declare const rpcResult: {
237
237
  channel_opening_fee: string;
238
238
  }>;
239
239
  readonly broker_request_account_creation_deposit_address: z.ZodObject<{
240
- address: z.ZodString;
241
240
  issued_block: z.ZodNumber;
242
241
  channel_id: z.ZodNumber;
243
- source_chain_expiry_block: z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>, z.ZodString]>, bigint, string | number>;
242
+ address: z.ZodString;
243
+ requested_for: z.ZodEffects<z.ZodString, `cF${string}`, string>;
244
+ deposit_chain_expiry_block: z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>, z.ZodString]>, bigint, string | number>;
244
245
  channel_opening_fee: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>;
246
+ refund_address: z.ZodString;
245
247
  }, "strip", z.ZodTypeAny, {
246
248
  address: string;
247
249
  issued_block: number;
248
250
  channel_id: number;
249
- source_chain_expiry_block: bigint;
250
251
  channel_opening_fee: bigint;
252
+ requested_for: `cF${string}`;
253
+ deposit_chain_expiry_block: bigint;
254
+ refund_address: string;
251
255
  }, {
252
256
  address: string;
253
257
  issued_block: number;
254
258
  channel_id: number;
255
- source_chain_expiry_block: string | number;
256
259
  channel_opening_fee: string;
260
+ requested_for: string;
261
+ deposit_chain_expiry_block: string | number;
262
+ refund_address: string;
257
263
  }>;
258
264
  readonly broker_request_swap_parameter_encoding: z.ZodDiscriminatedUnion<"chain", [z.ZodObject<{
259
265
  chain: z.ZodLiteral<"Bitcoin">;
@@ -26864,7 +26870,7 @@ declare const rpcResult: {
26864
26870
  lp_id: string;
26865
26871
  }[];
26866
26872
  }>>, "many">;
26867
- readonly cf_get_vault_addresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
26873
+ readonly cf_get_vault_addresses: z.ZodEffects<z.ZodObject<{
26868
26874
  ethereum: z.ZodObject<{
26869
26875
  Eth: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, `0x${string}`, number[]>;
26870
26876
  }, "strip", z.ZodTypeAny, {
@@ -26909,27 +26915,7 @@ declare const rpcResult: {
26909
26915
  }>, {
26910
26916
  Ethereum: `0x${string}`;
26911
26917
  Arbitrum: `0x${string}`;
26912
- Bitcoin: Map<`cF${string}`, {
26913
- current: string;
26914
- previous: string;
26915
- }>;
26916
- }, {
26917
- ethereum: {
26918
- Eth: number[];
26919
- };
26920
- arbitrum: {
26921
- Arb: number[];
26922
- };
26923
- bitcoin: [string, {
26924
- Btc: number[];
26925
- }][];
26926
- }>, {
26927
- Ethereum: `0x${string}`;
26928
- Arbitrum: `0x${string}`;
26929
- Bitcoin: Map<`cF${string}`, {
26930
- current: string;
26931
- previous: string;
26932
- }>;
26918
+ Bitcoin: Map<`cF${string}`, string>;
26933
26919
  }, {
26934
26920
  ethereum: {
26935
26921
  Eth: number[];
package/dist/common.d.ts CHANGED
@@ -80,37 +80,6 @@ type EncodeCfParametersParams = [
80
80
  dcaParams?: Nullish<DcaParams>
81
81
  ];
82
82
  type RpcRequest = WithHash<{
83
- broker_request_swap_deposit_address: [
84
- sourceAsset: UncheckedAssetAndChain,
85
- destinationAsset: UncheckedAssetAndChain,
86
- destinationAddress: string,
87
- brokerCommission: number,
88
- ccmMetadata: Nullish<CcmParams>,
89
- boostFee: Nullish<number>,
90
- affiliateFees: Nullish<{
91
- account: string;
92
- bps: number;
93
- }[]>,
94
- fillOrKillParams: FillOrKillParams,
95
- dcaParams?: Nullish<DcaParams>
96
- ];
97
- broker_request_account_creation_deposit_address: [
98
- asset: UncheckedAssetAndChain,
99
- refundAddress: string,
100
- boostFee: Nullish<number>,
101
- signatureData: {
102
- Ethereum: {
103
- signature: HexString;
104
- signer: HexString;
105
- sigType: 'Eip712';
106
- };
107
- },
108
- transactionMetadata: {
109
- nonce: number;
110
- expiryBlock: number;
111
- }
112
- ];
113
- broker_request_swap_parameter_encoding: RequestSwapParameterEncodingParams;
114
83
  cf_request_swap_parameter_encoding: [
115
84
  brokerAccountId: string,
116
85
  ...RequestSwapParameterEncodingParams
@@ -215,6 +184,37 @@ type RpcRequest = WithHash<{
215
184
  cf_get_vault_addresses: [];
216
185
  }> & {
217
186
  chain_getBlockHash: [blockHeight?: number];
187
+ broker_request_swap_deposit_address: [
188
+ sourceAsset: UncheckedAssetAndChain,
189
+ destinationAsset: UncheckedAssetAndChain,
190
+ destinationAddress: string,
191
+ brokerCommission: number,
192
+ ccmMetadata: Nullish<CcmParams>,
193
+ boostFee: Nullish<number>,
194
+ affiliateFees: Nullish<{
195
+ account: string;
196
+ bps: number;
197
+ }[]>,
198
+ fillOrKillParams: FillOrKillParams,
199
+ dcaParams?: Nullish<DcaParams>
200
+ ];
201
+ broker_request_account_creation_deposit_address: [
202
+ signatureData: {
203
+ Ethereum: {
204
+ signature: HexString;
205
+ signer: HexString;
206
+ sig_type: 'Eip712';
207
+ };
208
+ },
209
+ transactionMetadata: {
210
+ nonce: number;
211
+ expiry_block: number;
212
+ },
213
+ asset: UncheckedAssetAndChain,
214
+ boostFee: Nullish<number>,
215
+ refundAddress: string
216
+ ];
217
+ broker_request_swap_parameter_encoding: RequestSwapParameterEncodingParams;
218
218
  };
219
219
  declare const rpcResult: {
220
220
  readonly broker_request_swap_deposit_address: z.ZodObject<{
@@ -237,23 +237,29 @@ declare const rpcResult: {
237
237
  channel_opening_fee: string;
238
238
  }>;
239
239
  readonly broker_request_account_creation_deposit_address: z.ZodObject<{
240
- address: z.ZodString;
241
240
  issued_block: z.ZodNumber;
242
241
  channel_id: z.ZodNumber;
243
- source_chain_expiry_block: z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>, z.ZodString]>, bigint, string | number>;
242
+ address: z.ZodString;
243
+ requested_for: z.ZodEffects<z.ZodString, `cF${string}`, string>;
244
+ deposit_chain_expiry_block: z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>, z.ZodString]>, bigint, string | number>;
244
245
  channel_opening_fee: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>;
246
+ refund_address: z.ZodString;
245
247
  }, "strip", z.ZodTypeAny, {
246
248
  address: string;
247
249
  issued_block: number;
248
250
  channel_id: number;
249
- source_chain_expiry_block: bigint;
250
251
  channel_opening_fee: bigint;
252
+ requested_for: `cF${string}`;
253
+ deposit_chain_expiry_block: bigint;
254
+ refund_address: string;
251
255
  }, {
252
256
  address: string;
253
257
  issued_block: number;
254
258
  channel_id: number;
255
- source_chain_expiry_block: string | number;
256
259
  channel_opening_fee: string;
260
+ requested_for: string;
261
+ deposit_chain_expiry_block: string | number;
262
+ refund_address: string;
257
263
  }>;
258
264
  readonly broker_request_swap_parameter_encoding: z.ZodDiscriminatedUnion<"chain", [z.ZodObject<{
259
265
  chain: z.ZodLiteral<"Bitcoin">;
@@ -26864,7 +26870,7 @@ declare const rpcResult: {
26864
26870
  lp_id: string;
26865
26871
  }[];
26866
26872
  }>>, "many">;
26867
- readonly cf_get_vault_addresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
26873
+ readonly cf_get_vault_addresses: z.ZodEffects<z.ZodObject<{
26868
26874
  ethereum: z.ZodObject<{
26869
26875
  Eth: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, `0x${string}`, number[]>;
26870
26876
  }, "strip", z.ZodTypeAny, {
@@ -26909,27 +26915,7 @@ declare const rpcResult: {
26909
26915
  }>, {
26910
26916
  Ethereum: `0x${string}`;
26911
26917
  Arbitrum: `0x${string}`;
26912
- Bitcoin: Map<`cF${string}`, {
26913
- current: string;
26914
- previous: string;
26915
- }>;
26916
- }, {
26917
- ethereum: {
26918
- Eth: number[];
26919
- };
26920
- arbitrum: {
26921
- Arb: number[];
26922
- };
26923
- bitcoin: [string, {
26924
- Btc: number[];
26925
- }][];
26926
- }>, {
26927
- Ethereum: `0x${string}`;
26928
- Arbitrum: `0x${string}`;
26929
- Bitcoin: Map<`cF${string}`, {
26930
- current: string;
26931
- previous: string;
26932
- }>;
26918
+ Bitcoin: Map<`cF${string}`, string>;
26933
26919
  }, {
26934
26920
  ethereum: {
26935
26921
  Eth: number[];
package/dist/common.mjs CHANGED
@@ -41,12 +41,13 @@ import {
41
41
  cfLoanAccounts,
42
42
  cfMonitoringSimulateAuction,
43
43
  cfVaultAddresses,
44
- cfLendingPoolSupplyBalances
44
+ cfLendingPoolSupplyBalances,
45
+ brokerRequestAccountCreationDepositAddress
45
46
  } from "./parsers.mjs";
46
47
  import { rpcResponse } from "./parsers.mjs";
47
48
  var rpcResult = {
48
49
  broker_request_swap_deposit_address: brokerRequestSwapDepositAddress,
49
- broker_request_account_creation_deposit_address: brokerRequestSwapDepositAddress,
50
+ broker_request_account_creation_deposit_address: brokerRequestAccountCreationDepositAddress,
50
51
  broker_request_swap_parameter_encoding: requestSwapParameterEncoding,
51
52
  cf_request_swap_parameter_encoding: requestSwapParameterEncoding,
52
53
  cf_accounts: cfAccounts,
package/dist/parsers.cjs CHANGED
@@ -4,6 +4,7 @@ var _chainflip = require('@chainflip/utils/chainflip');
4
4
  var _guard = require('@chainflip/utils/guard');
5
5
  var _string = require('@chainflip/utils/string');
6
6
  var _zod = require('zod');
7
+ var accountId = _zod.z.string().refine((val) => val.startsWith("cF"));
7
8
  var hexString = _zod.z.string().refine(_string.isHex, { message: "Invalid hex string" });
8
9
  var u256 = hexString.transform((value) => BigInt(value));
9
10
  var numericString = _zod.z.string().regex(/^[0-9]+$/);
@@ -180,6 +181,15 @@ var brokerRequestSwapDepositAddress = _zod.z.object({
180
181
  source_chain_expiry_block: numberOrHex,
181
182
  channel_opening_fee: u256
182
183
  });
184
+ var brokerRequestAccountCreationDepositAddress = _zod.z.object({
185
+ issued_block: _zod.z.number(),
186
+ channel_id: _zod.z.number(),
187
+ address: _zod.z.string(),
188
+ requested_for: accountId,
189
+ deposit_chain_expiry_block: numberOrHex,
190
+ channel_opening_fee: u256,
191
+ refund_address: _zod.z.string()
192
+ });
183
193
  var evmBrokerRequestSwapParameterEncoding = _zod.z.object({
184
194
  to: hexString,
185
195
  calldata: hexString,
@@ -211,7 +221,6 @@ var requestSwapParameterEncoding = _zod.z.discriminatedUnion("chain", [
211
221
  )
212
222
  })
213
223
  ]);
214
- var accountId = _zod.z.string().refine((val) => val.startsWith("cF"));
215
224
  var delegationStatus = _zod.z.object({
216
225
  operator: accountId,
217
226
  bid: numberOrHex
@@ -682,33 +691,14 @@ var cfVaultAddresses = _zod.z.object({
682
691
  ])
683
692
  )
684
693
  }).transform(({ ethereum, arbitrum, bitcoin }) => {
685
- const bitcoinAddresses = bitcoin.reduce((acc, [brokerId, { Btc }]) => {
686
- let obj = acc.get(brokerId);
687
- if (!obj) {
688
- obj = { current: "", previous: "" };
689
- acc.set(brokerId, obj);
690
- }
691
- if (!obj.previous) {
692
- obj.previous = Btc;
693
- } else {
694
- obj.current = Btc;
695
- }
696
- return acc;
697
- }, /* @__PURE__ */ new Map());
694
+ const bitcoinAddresses = new Map(
695
+ bitcoin.map(([brokerId, { Btc }]) => [brokerId, Btc])
696
+ );
698
697
  return {
699
698
  Ethereum: ethereum.Eth,
700
699
  Arbitrum: arbitrum.Arb,
701
700
  Bitcoin: bitcoinAddresses
702
701
  };
703
- }).superRefine(({ Bitcoin }, ctx) => {
704
- Bitcoin.forEach((value, key) => {
705
- if (!value.current) {
706
- ctx.addIssue({
707
- message: `No current BTC address for broker ${key}`,
708
- code: _zod.z.ZodIssueCode.custom
709
- });
710
- }
711
- });
712
702
  });
713
703
 
714
704
 
@@ -763,4 +753,5 @@ var cfVaultAddresses = _zod.z.object({
763
753
 
764
754
 
765
755
 
766
- exports.accountInfoCommon = accountInfoCommon; exports.broker = broker; exports.brokerRequestSwapDepositAddress = brokerRequestSwapDepositAddress; exports.cfAccountInfo = cfAccountInfo; exports.cfAccounts = cfAccounts; exports.cfAuctionState = cfAuctionState; exports.cfAvailablePools = cfAvailablePools; exports.cfBoostPoolDetails = cfBoostPoolDetails; exports.cfBoostPoolPendingFees = cfBoostPoolPendingFees; exports.cfBoostPoolsDepth = cfBoostPoolsDepth; exports.cfEnvironment = cfEnvironment; exports.cfFailedCallEvm = cfFailedCallEvm; exports.cfFlipSuppy = cfFlipSuppy; exports.cfFundingEnvironment = cfFundingEnvironment; exports.cfGetTradingStrategies = cfGetTradingStrategies; exports.cfGetTradingStrategyLimits = cfGetTradingStrategyLimits; exports.cfIngressEgressEnvironment = cfIngressEgressEnvironment; exports.cfLendingConfig = cfLendingConfig; exports.cfLendingPoolSupplyBalances = cfLendingPoolSupplyBalances; exports.cfLendingPools = cfLendingPools; exports.cfLoanAccount = cfLoanAccount; exports.cfLoanAccounts = cfLoanAccounts; exports.cfMonitoringSimulateAuction = cfMonitoringSimulateAuction; exports.cfOraclePrices = cfOraclePrices; exports.cfPoolDepth = cfPoolDepth; exports.cfPoolOrderbook = cfPoolOrderbook; exports.cfPoolOrders = cfPoolOrders; exports.cfPoolPriceV2 = cfPoolPriceV2; exports.cfPoolsEnvironment = cfPoolsEnvironment; exports.cfSafeModeStatuses = cfSafeModeStatuses; exports.cfSupportedAssets = cfSupportedAssets; exports.cfSwapRate = cfSwapRate; exports.cfSwapRateV2 = cfSwapRateV2; exports.cfSwapRateV3 = cfSwapRateV3; exports.cfSwappingEnvironment = cfSwappingEnvironment; exports.cfTradingStrategy = cfTradingStrategy; exports.cfVaultAddresses = cfVaultAddresses; exports.chainGetBlockHash = chainGetBlockHash; exports.ethereumAddress = ethereumAddress; exports.hexString = hexString; exports.liquidityProvider = liquidityProvider; exports.lpTotalBalances = lpTotalBalances; exports.numberOrHex = numberOrHex; exports.numericString = numericString; exports.operator = operator; exports.requestSwapParameterEncoding = requestSwapParameterEncoding; exports.rpcResponse = rpcResponse; exports.stateGetMetadata = stateGetMetadata; exports.stateGetRuntimeVersion = stateGetRuntimeVersion; exports.u256 = u256; exports.unregistered = unregistered; exports.validator = validator;
756
+
757
+ exports.accountInfoCommon = accountInfoCommon; exports.broker = broker; exports.brokerRequestAccountCreationDepositAddress = brokerRequestAccountCreationDepositAddress; exports.brokerRequestSwapDepositAddress = brokerRequestSwapDepositAddress; exports.cfAccountInfo = cfAccountInfo; exports.cfAccounts = cfAccounts; exports.cfAuctionState = cfAuctionState; exports.cfAvailablePools = cfAvailablePools; exports.cfBoostPoolDetails = cfBoostPoolDetails; exports.cfBoostPoolPendingFees = cfBoostPoolPendingFees; exports.cfBoostPoolsDepth = cfBoostPoolsDepth; exports.cfEnvironment = cfEnvironment; exports.cfFailedCallEvm = cfFailedCallEvm; exports.cfFlipSuppy = cfFlipSuppy; exports.cfFundingEnvironment = cfFundingEnvironment; exports.cfGetTradingStrategies = cfGetTradingStrategies; exports.cfGetTradingStrategyLimits = cfGetTradingStrategyLimits; exports.cfIngressEgressEnvironment = cfIngressEgressEnvironment; exports.cfLendingConfig = cfLendingConfig; exports.cfLendingPoolSupplyBalances = cfLendingPoolSupplyBalances; exports.cfLendingPools = cfLendingPools; exports.cfLoanAccount = cfLoanAccount; exports.cfLoanAccounts = cfLoanAccounts; exports.cfMonitoringSimulateAuction = cfMonitoringSimulateAuction; exports.cfOraclePrices = cfOraclePrices; exports.cfPoolDepth = cfPoolDepth; exports.cfPoolOrderbook = cfPoolOrderbook; exports.cfPoolOrders = cfPoolOrders; exports.cfPoolPriceV2 = cfPoolPriceV2; exports.cfPoolsEnvironment = cfPoolsEnvironment; exports.cfSafeModeStatuses = cfSafeModeStatuses; exports.cfSupportedAssets = cfSupportedAssets; exports.cfSwapRate = cfSwapRate; exports.cfSwapRateV2 = cfSwapRateV2; exports.cfSwapRateV3 = cfSwapRateV3; exports.cfSwappingEnvironment = cfSwappingEnvironment; exports.cfTradingStrategy = cfTradingStrategy; exports.cfVaultAddresses = cfVaultAddresses; exports.chainGetBlockHash = chainGetBlockHash; exports.ethereumAddress = ethereumAddress; exports.hexString = hexString; exports.liquidityProvider = liquidityProvider; exports.lpTotalBalances = lpTotalBalances; exports.numberOrHex = numberOrHex; exports.numericString = numericString; exports.operator = operator; exports.requestSwapParameterEncoding = requestSwapParameterEncoding; exports.rpcResponse = rpcResponse; exports.stateGetMetadata = stateGetMetadata; exports.stateGetRuntimeVersion = stateGetRuntimeVersion; exports.u256 = u256; exports.unregistered = unregistered; exports.validator = validator;
@@ -16337,6 +16337,31 @@ declare const brokerRequestSwapDepositAddress: z.ZodObject<{
16337
16337
  source_chain_expiry_block: string | number;
16338
16338
  channel_opening_fee: string;
16339
16339
  }>;
16340
+ declare const brokerRequestAccountCreationDepositAddress: z.ZodObject<{
16341
+ issued_block: z.ZodNumber;
16342
+ channel_id: z.ZodNumber;
16343
+ address: z.ZodString;
16344
+ requested_for: z.ZodEffects<z.ZodString, `cF${string}`, string>;
16345
+ deposit_chain_expiry_block: z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>, z.ZodString]>, bigint, string | number>;
16346
+ channel_opening_fee: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>;
16347
+ refund_address: z.ZodString;
16348
+ }, "strip", z.ZodTypeAny, {
16349
+ address: string;
16350
+ issued_block: number;
16351
+ channel_id: number;
16352
+ channel_opening_fee: bigint;
16353
+ requested_for: `cF${string}`;
16354
+ deposit_chain_expiry_block: bigint;
16355
+ refund_address: string;
16356
+ }, {
16357
+ address: string;
16358
+ issued_block: number;
16359
+ channel_id: number;
16360
+ channel_opening_fee: string;
16361
+ requested_for: string;
16362
+ deposit_chain_expiry_block: string | number;
16363
+ refund_address: string;
16364
+ }>;
16340
16365
  declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.ZodObject<{
16341
16366
  chain: z.ZodLiteral<"Bitcoin">;
16342
16367
  nulldata_payload: z.ZodEffects<z.ZodString, `0x${string}`, string>;
@@ -31898,7 +31923,7 @@ declare const cfLendingPoolSupplyBalances: z.ZodArray<z.ZodIntersection<z.ZodUni
31898
31923
  lp_id: string;
31899
31924
  }[];
31900
31925
  }>>, "many">;
31901
- declare const cfVaultAddresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
31926
+ declare const cfVaultAddresses: z.ZodEffects<z.ZodObject<{
31902
31927
  ethereum: z.ZodObject<{
31903
31928
  Eth: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, `0x${string}`, number[]>;
31904
31929
  }, "strip", z.ZodTypeAny, {
@@ -31943,27 +31968,7 @@ declare const cfVaultAddresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
31943
31968
  }>, {
31944
31969
  Ethereum: `0x${string}`;
31945
31970
  Arbitrum: `0x${string}`;
31946
- Bitcoin: Map<`cF${string}`, {
31947
- current: string;
31948
- previous: string;
31949
- }>;
31950
- }, {
31951
- ethereum: {
31952
- Eth: number[];
31953
- };
31954
- arbitrum: {
31955
- Arb: number[];
31956
- };
31957
- bitcoin: [string, {
31958
- Btc: number[];
31959
- }][];
31960
- }>, {
31961
- Ethereum: `0x${string}`;
31962
- Arbitrum: `0x${string}`;
31963
- Bitcoin: Map<`cF${string}`, {
31964
- current: string;
31965
- previous: string;
31966
- }>;
31971
+ Bitcoin: Map<`cF${string}`, string>;
31967
31972
  }, {
31968
31973
  ethereum: {
31969
31974
  Eth: number[];
@@ -31976,4 +31981,4 @@ declare const cfVaultAddresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
31976
31981
  }][];
31977
31982
  }>;
31978
31983
 
31979
- export { type AssetAndChain, type RpcLimitOrder, type RpcRangeOrder, accountInfoCommon, broker, brokerRequestSwapDepositAddress, cfAccountInfo, cfAccounts, cfAuctionState, cfAvailablePools, cfBoostPoolDetails, cfBoostPoolPendingFees, cfBoostPoolsDepth, cfEnvironment, cfFailedCallEvm, cfFlipSuppy, cfFundingEnvironment, cfGetTradingStrategies, cfGetTradingStrategyLimits, cfIngressEgressEnvironment, cfLendingConfig, cfLendingPoolSupplyBalances, cfLendingPools, cfLoanAccount, cfLoanAccounts, cfMonitoringSimulateAuction, cfOraclePrices, cfPoolDepth, cfPoolOrderbook, cfPoolOrders, cfPoolPriceV2, cfPoolsEnvironment, cfSafeModeStatuses, cfSupportedAssets, cfSwapRate, cfSwapRateV2, cfSwapRateV3, cfSwappingEnvironment, cfTradingStrategy, cfVaultAddresses, chainGetBlockHash, ethereumAddress, hexString, liquidityProvider, lpTotalBalances, numberOrHex, numericString, operator, requestSwapParameterEncoding, rpcResponse, stateGetMetadata, stateGetRuntimeVersion, u256, unregistered, validator };
31984
+ export { type AssetAndChain, type RpcLimitOrder, type RpcRangeOrder, accountInfoCommon, broker, brokerRequestAccountCreationDepositAddress, brokerRequestSwapDepositAddress, cfAccountInfo, cfAccounts, cfAuctionState, cfAvailablePools, cfBoostPoolDetails, cfBoostPoolPendingFees, cfBoostPoolsDepth, cfEnvironment, cfFailedCallEvm, cfFlipSuppy, cfFundingEnvironment, cfGetTradingStrategies, cfGetTradingStrategyLimits, cfIngressEgressEnvironment, cfLendingConfig, cfLendingPoolSupplyBalances, cfLendingPools, cfLoanAccount, cfLoanAccounts, cfMonitoringSimulateAuction, cfOraclePrices, cfPoolDepth, cfPoolOrderbook, cfPoolOrders, cfPoolPriceV2, cfPoolsEnvironment, cfSafeModeStatuses, cfSupportedAssets, cfSwapRate, cfSwapRateV2, cfSwapRateV3, cfSwappingEnvironment, cfTradingStrategy, cfVaultAddresses, chainGetBlockHash, ethereumAddress, hexString, liquidityProvider, lpTotalBalances, numberOrHex, numericString, operator, requestSwapParameterEncoding, rpcResponse, stateGetMetadata, stateGetRuntimeVersion, u256, unregistered, validator };
package/dist/parsers.d.ts CHANGED
@@ -16337,6 +16337,31 @@ declare const brokerRequestSwapDepositAddress: z.ZodObject<{
16337
16337
  source_chain_expiry_block: string | number;
16338
16338
  channel_opening_fee: string;
16339
16339
  }>;
16340
+ declare const brokerRequestAccountCreationDepositAddress: z.ZodObject<{
16341
+ issued_block: z.ZodNumber;
16342
+ channel_id: z.ZodNumber;
16343
+ address: z.ZodString;
16344
+ requested_for: z.ZodEffects<z.ZodString, `cF${string}`, string>;
16345
+ deposit_chain_expiry_block: z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>, z.ZodString]>, bigint, string | number>;
16346
+ channel_opening_fee: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>;
16347
+ refund_address: z.ZodString;
16348
+ }, "strip", z.ZodTypeAny, {
16349
+ address: string;
16350
+ issued_block: number;
16351
+ channel_id: number;
16352
+ channel_opening_fee: bigint;
16353
+ requested_for: `cF${string}`;
16354
+ deposit_chain_expiry_block: bigint;
16355
+ refund_address: string;
16356
+ }, {
16357
+ address: string;
16358
+ issued_block: number;
16359
+ channel_id: number;
16360
+ channel_opening_fee: string;
16361
+ requested_for: string;
16362
+ deposit_chain_expiry_block: string | number;
16363
+ refund_address: string;
16364
+ }>;
16340
16365
  declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.ZodObject<{
16341
16366
  chain: z.ZodLiteral<"Bitcoin">;
16342
16367
  nulldata_payload: z.ZodEffects<z.ZodString, `0x${string}`, string>;
@@ -31898,7 +31923,7 @@ declare const cfLendingPoolSupplyBalances: z.ZodArray<z.ZodIntersection<z.ZodUni
31898
31923
  lp_id: string;
31899
31924
  }[];
31900
31925
  }>>, "many">;
31901
- declare const cfVaultAddresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
31926
+ declare const cfVaultAddresses: z.ZodEffects<z.ZodObject<{
31902
31927
  ethereum: z.ZodObject<{
31903
31928
  Eth: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, `0x${string}`, number[]>;
31904
31929
  }, "strip", z.ZodTypeAny, {
@@ -31943,27 +31968,7 @@ declare const cfVaultAddresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
31943
31968
  }>, {
31944
31969
  Ethereum: `0x${string}`;
31945
31970
  Arbitrum: `0x${string}`;
31946
- Bitcoin: Map<`cF${string}`, {
31947
- current: string;
31948
- previous: string;
31949
- }>;
31950
- }, {
31951
- ethereum: {
31952
- Eth: number[];
31953
- };
31954
- arbitrum: {
31955
- Arb: number[];
31956
- };
31957
- bitcoin: [string, {
31958
- Btc: number[];
31959
- }][];
31960
- }>, {
31961
- Ethereum: `0x${string}`;
31962
- Arbitrum: `0x${string}`;
31963
- Bitcoin: Map<`cF${string}`, {
31964
- current: string;
31965
- previous: string;
31966
- }>;
31971
+ Bitcoin: Map<`cF${string}`, string>;
31967
31972
  }, {
31968
31973
  ethereum: {
31969
31974
  Eth: number[];
@@ -31976,4 +31981,4 @@ declare const cfVaultAddresses: z.ZodEffects<z.ZodEffects<z.ZodObject<{
31976
31981
  }][];
31977
31982
  }>;
31978
31983
 
31979
- export { type AssetAndChain, type RpcLimitOrder, type RpcRangeOrder, accountInfoCommon, broker, brokerRequestSwapDepositAddress, cfAccountInfo, cfAccounts, cfAuctionState, cfAvailablePools, cfBoostPoolDetails, cfBoostPoolPendingFees, cfBoostPoolsDepth, cfEnvironment, cfFailedCallEvm, cfFlipSuppy, cfFundingEnvironment, cfGetTradingStrategies, cfGetTradingStrategyLimits, cfIngressEgressEnvironment, cfLendingConfig, cfLendingPoolSupplyBalances, cfLendingPools, cfLoanAccount, cfLoanAccounts, cfMonitoringSimulateAuction, cfOraclePrices, cfPoolDepth, cfPoolOrderbook, cfPoolOrders, cfPoolPriceV2, cfPoolsEnvironment, cfSafeModeStatuses, cfSupportedAssets, cfSwapRate, cfSwapRateV2, cfSwapRateV3, cfSwappingEnvironment, cfTradingStrategy, cfVaultAddresses, chainGetBlockHash, ethereumAddress, hexString, liquidityProvider, lpTotalBalances, numberOrHex, numericString, operator, requestSwapParameterEncoding, rpcResponse, stateGetMetadata, stateGetRuntimeVersion, u256, unregistered, validator };
31984
+ export { type AssetAndChain, type RpcLimitOrder, type RpcRangeOrder, accountInfoCommon, broker, brokerRequestAccountCreationDepositAddress, brokerRequestSwapDepositAddress, cfAccountInfo, cfAccounts, cfAuctionState, cfAvailablePools, cfBoostPoolDetails, cfBoostPoolPendingFees, cfBoostPoolsDepth, cfEnvironment, cfFailedCallEvm, cfFlipSuppy, cfFundingEnvironment, cfGetTradingStrategies, cfGetTradingStrategyLimits, cfIngressEgressEnvironment, cfLendingConfig, cfLendingPoolSupplyBalances, cfLendingPools, cfLoanAccount, cfLoanAccounts, cfMonitoringSimulateAuction, cfOraclePrices, cfPoolDepth, cfPoolOrderbook, cfPoolOrders, cfPoolPriceV2, cfPoolsEnvironment, cfSafeModeStatuses, cfSupportedAssets, cfSwapRate, cfSwapRateV2, cfSwapRateV3, cfSwappingEnvironment, cfTradingStrategy, cfVaultAddresses, chainGetBlockHash, ethereumAddress, hexString, liquidityProvider, lpTotalBalances, numberOrHex, numericString, operator, requestSwapParameterEncoding, rpcResponse, stateGetMetadata, stateGetRuntimeVersion, u256, unregistered, validator };
package/dist/parsers.mjs CHANGED
@@ -4,6 +4,7 @@ import { priceAssets } from "@chainflip/utils/chainflip";
4
4
  import { isUndefined } from "@chainflip/utils/guard";
5
5
  import { isHex } from "@chainflip/utils/string";
6
6
  import { z } from "zod";
7
+ var accountId = z.string().refine((val) => val.startsWith("cF"));
7
8
  var hexString = z.string().refine(isHex, { message: "Invalid hex string" });
8
9
  var u256 = hexString.transform((value) => BigInt(value));
9
10
  var numericString = z.string().regex(/^[0-9]+$/);
@@ -180,6 +181,15 @@ var brokerRequestSwapDepositAddress = z.object({
180
181
  source_chain_expiry_block: numberOrHex,
181
182
  channel_opening_fee: u256
182
183
  });
184
+ var brokerRequestAccountCreationDepositAddress = z.object({
185
+ issued_block: z.number(),
186
+ channel_id: z.number(),
187
+ address: z.string(),
188
+ requested_for: accountId,
189
+ deposit_chain_expiry_block: numberOrHex,
190
+ channel_opening_fee: u256,
191
+ refund_address: z.string()
192
+ });
183
193
  var evmBrokerRequestSwapParameterEncoding = z.object({
184
194
  to: hexString,
185
195
  calldata: hexString,
@@ -211,7 +221,6 @@ var requestSwapParameterEncoding = z.discriminatedUnion("chain", [
211
221
  )
212
222
  })
213
223
  ]);
214
- var accountId = z.string().refine((val) => val.startsWith("cF"));
215
224
  var delegationStatus = z.object({
216
225
  operator: accountId,
217
226
  bid: numberOrHex
@@ -682,37 +691,19 @@ var cfVaultAddresses = z.object({
682
691
  ])
683
692
  )
684
693
  }).transform(({ ethereum, arbitrum, bitcoin }) => {
685
- const bitcoinAddresses = bitcoin.reduce((acc, [brokerId, { Btc }]) => {
686
- let obj = acc.get(brokerId);
687
- if (!obj) {
688
- obj = { current: "", previous: "" };
689
- acc.set(brokerId, obj);
690
- }
691
- if (!obj.previous) {
692
- obj.previous = Btc;
693
- } else {
694
- obj.current = Btc;
695
- }
696
- return acc;
697
- }, /* @__PURE__ */ new Map());
694
+ const bitcoinAddresses = new Map(
695
+ bitcoin.map(([brokerId, { Btc }]) => [brokerId, Btc])
696
+ );
698
697
  return {
699
698
  Ethereum: ethereum.Eth,
700
699
  Arbitrum: arbitrum.Arb,
701
700
  Bitcoin: bitcoinAddresses
702
701
  };
703
- }).superRefine(({ Bitcoin }, ctx) => {
704
- Bitcoin.forEach((value, key) => {
705
- if (!value.current) {
706
- ctx.addIssue({
707
- message: `No current BTC address for broker ${key}`,
708
- code: z.ZodIssueCode.custom
709
- });
710
- }
711
- });
712
702
  });
713
703
  export {
714
704
  accountInfoCommon,
715
705
  broker,
706
+ brokerRequestAccountCreationDepositAddress,
716
707
  brokerRequestSwapDepositAddress,
717
708
  cfAccountInfo,
718
709
  cfAccounts,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@chainflip/rpc",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
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.10.0",
10
+ "@types/node": "^24.10.1",
11
11
  "@types/ws": "^8.18.1",
12
12
  "ws": "^8.18.3"
13
13
  },