@chainflip/rpc 1.8.9 → 1.9.0-assethub.1
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/Client.cjs +24 -56
- package/dist/Client.d.cts +11 -18
- package/dist/Client.d.ts +11 -18
- package/dist/Client.mjs +22 -54
- package/dist/HttpClient.cjs +65 -23
- package/dist/HttpClient.d.cts +8 -4
- package/dist/HttpClient.d.ts +8 -4
- package/dist/HttpClient.mjs +62 -20
- package/dist/WsClient.cjs +63 -74
- package/dist/WsClient.d.cts +7 -10
- package/dist/WsClient.d.ts +7 -10
- package/dist/WsClient.mjs +61 -72
- package/dist/common.cjs +2 -9
- package/dist/common.d.cts +948 -1938
- package/dist/common.d.ts +948 -1938
- package/dist/common.mjs +5 -12
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/parsers.cjs +11 -56
- package/dist/parsers.d.cts +1113 -1965
- package/dist/parsers.d.ts +1113 -1965
- package/dist/parsers.mjs +10 -55
- package/dist/types.d.cts +1 -5
- package/dist/types.d.ts +1 -5
- package/package.json +14 -14
package/dist/parsers.mjs
CHANGED
|
@@ -5,26 +5,26 @@ import { z } from "zod";
|
|
|
5
5
|
var hexString = z.string().refine(isHex, { message: "Invalid hex string" });
|
|
6
6
|
var u256 = hexString.transform((value) => BigInt(value));
|
|
7
7
|
var numberOrHex = z.union([z.number().transform((n) => BigInt(n)), u256]);
|
|
8
|
-
var chainAssetMapFactory = (parser,
|
|
8
|
+
var chainAssetMapFactory = (parser, defaultValue) => z.object({
|
|
9
9
|
Bitcoin: z.object({ BTC: parser }),
|
|
10
10
|
Ethereum: z.object({ ETH: parser, USDC: parser, FLIP: parser, USDT: parser }),
|
|
11
11
|
Polkadot: z.object({ DOT: parser }),
|
|
12
12
|
Arbitrum: z.object({ ETH: parser, USDC: parser }),
|
|
13
|
-
Solana: z.object({ SOL: parser, USDC: parser })
|
|
13
|
+
Solana: z.object({ SOL: parser.default(defaultValue), USDC: parser.default(defaultValue) }).default({ SOL: defaultValue, USDC: defaultValue })
|
|
14
14
|
});
|
|
15
|
-
var chainBaseAssetMapFactory = (parser,
|
|
15
|
+
var chainBaseAssetMapFactory = (parser, defaultValue) => z.object({
|
|
16
16
|
Bitcoin: z.object({ BTC: parser }),
|
|
17
17
|
Ethereum: z.object({ ETH: parser, FLIP: parser, USDT: parser }),
|
|
18
18
|
Polkadot: z.object({ DOT: parser }),
|
|
19
19
|
Arbitrum: z.object({ ETH: parser, USDC: parser }),
|
|
20
|
-
Solana: z.object({ SOL: parser, USDC: parser })
|
|
20
|
+
Solana: z.object({ SOL: parser.default(defaultValue), USDC: parser.default(defaultValue) }).default({ SOL: defaultValue, USDC: defaultValue })
|
|
21
21
|
});
|
|
22
|
-
var chainMapFactory = (parser,
|
|
22
|
+
var chainMapFactory = (parser, defaultValue) => z.object({
|
|
23
23
|
Bitcoin: parser,
|
|
24
24
|
Ethereum: parser,
|
|
25
25
|
Polkadot: parser,
|
|
26
26
|
Arbitrum: parser,
|
|
27
|
-
Solana: parser
|
|
27
|
+
Solana: parser.default(defaultValue)
|
|
28
28
|
});
|
|
29
29
|
var rpcAssetSchema = z.union([
|
|
30
30
|
z.object({ chain: z.literal("Bitcoin"), asset: z.literal("BTC") }),
|
|
@@ -45,7 +45,7 @@ var rename = (mapping) => (obj) => Object.fromEntries(
|
|
|
45
45
|
])
|
|
46
46
|
);
|
|
47
47
|
var rpcBaseResponse = z.object({
|
|
48
|
-
id: z.string(),
|
|
48
|
+
id: z.union([z.string(), z.number()]),
|
|
49
49
|
jsonrpc: z.literal("2.0")
|
|
50
50
|
});
|
|
51
51
|
var nonNullish = z.any().refine(isNotNullish, { message: "Value must not be null or undefined" });
|
|
@@ -66,9 +66,6 @@ var cfSwapRateV2 = z.object({
|
|
|
66
66
|
network_fee: fee,
|
|
67
67
|
output: u256
|
|
68
68
|
});
|
|
69
|
-
var cfSwapRateV3 = cfSwapRateV2.extend({
|
|
70
|
-
broker_commission: fee
|
|
71
|
-
});
|
|
72
69
|
var chainGetBlockHash = hexString;
|
|
73
70
|
var stateGetMetadata = hexString;
|
|
74
71
|
var stateGetRuntimeVersion = z.object({
|
|
@@ -153,37 +150,6 @@ var brokerRequestSwapDepositAddress = z.object({
|
|
|
153
150
|
source_chain_expiry_block: numberOrHex,
|
|
154
151
|
channel_opening_fee: u256
|
|
155
152
|
});
|
|
156
|
-
var evmBrokerRequestSwapParameterEncoding = z.object({
|
|
157
|
-
to: hexString,
|
|
158
|
-
calldata: hexString,
|
|
159
|
-
value: numberOrHex,
|
|
160
|
-
source_token_address: hexString.optional()
|
|
161
|
-
});
|
|
162
|
-
var requestSwapParameterEncoding = z.discriminatedUnion("chain", [
|
|
163
|
-
z.object({
|
|
164
|
-
chain: z.literal("Bitcoin"),
|
|
165
|
-
nulldata_payload: hexString,
|
|
166
|
-
deposit_address: z.string()
|
|
167
|
-
}),
|
|
168
|
-
evmBrokerRequestSwapParameterEncoding.extend({
|
|
169
|
-
chain: z.literal("Ethereum")
|
|
170
|
-
}),
|
|
171
|
-
evmBrokerRequestSwapParameterEncoding.extend({
|
|
172
|
-
chain: z.literal("Arbitrum")
|
|
173
|
-
}),
|
|
174
|
-
z.object({
|
|
175
|
-
chain: z.literal("Solana"),
|
|
176
|
-
program_id: z.string(),
|
|
177
|
-
data: hexString,
|
|
178
|
-
accounts: z.array(
|
|
179
|
-
z.object({
|
|
180
|
-
pubkey: z.string(),
|
|
181
|
-
is_signer: z.boolean(),
|
|
182
|
-
is_writable: z.boolean()
|
|
183
|
-
})
|
|
184
|
-
)
|
|
185
|
-
})
|
|
186
|
-
]);
|
|
187
153
|
var unregistered = z.object({
|
|
188
154
|
role: z.literal("unregistered"),
|
|
189
155
|
flip_balance: numberOrHex
|
|
@@ -191,8 +157,7 @@ var unregistered = z.object({
|
|
|
191
157
|
var broker = z.object({
|
|
192
158
|
role: z.literal("broker"),
|
|
193
159
|
flip_balance: numberOrHex,
|
|
194
|
-
earned_fees: chainAssetMapFactory(numberOrHex, 0)
|
|
195
|
-
btc_vault_deposit_address: z.string().nullable().optional()
|
|
160
|
+
earned_fees: chainAssetMapFactory(numberOrHex, 0)
|
|
196
161
|
});
|
|
197
162
|
var boostBalances = z.array(
|
|
198
163
|
z.object({
|
|
@@ -227,12 +192,7 @@ var validator = z.object({
|
|
|
227
192
|
apy_bp: z.number().nullable(),
|
|
228
193
|
restricted_balances: z.record(hexString, numberOrHex)
|
|
229
194
|
});
|
|
230
|
-
var cfAccountInfo = z.
|
|
231
|
-
unregistered,
|
|
232
|
-
broker,
|
|
233
|
-
liquidityProvider,
|
|
234
|
-
validator
|
|
235
|
-
]);
|
|
195
|
+
var cfAccountInfo = z.union([unregistered, broker, liquidityProvider, validator]);
|
|
236
196
|
var cfAccounts = z.array(z.tuple([z.string(), z.string()]));
|
|
237
197
|
var cfPoolPriceV2 = z.object({
|
|
238
198
|
sell: numberOrHex.nullable(),
|
|
@@ -293,8 +253,7 @@ var cfBoostPoolDetails = z.array(
|
|
|
293
253
|
account_id: z.string(),
|
|
294
254
|
pending_deposits: z.array(z.bigint())
|
|
295
255
|
})
|
|
296
|
-
)
|
|
297
|
-
network_fee_deduction_percent: z.number().optional()
|
|
256
|
+
)
|
|
298
257
|
})
|
|
299
258
|
)
|
|
300
259
|
);
|
|
@@ -312,7 +271,6 @@ var cfBoostPoolPendingFees = z.array(
|
|
|
312
271
|
})
|
|
313
272
|
)
|
|
314
273
|
);
|
|
315
|
-
var lpTotalBalances = chainAssetMapFactory(numberOrHex, 0);
|
|
316
274
|
export {
|
|
317
275
|
broker,
|
|
318
276
|
brokerRequestSwapDepositAddress,
|
|
@@ -331,14 +289,11 @@ export {
|
|
|
331
289
|
cfSupportedAssets,
|
|
332
290
|
cfSwapRate,
|
|
333
291
|
cfSwapRateV2,
|
|
334
|
-
cfSwapRateV3,
|
|
335
292
|
cfSwappingEnvironment,
|
|
336
293
|
chainGetBlockHash,
|
|
337
294
|
hexString,
|
|
338
295
|
liquidityProvider,
|
|
339
|
-
lpTotalBalances,
|
|
340
296
|
numberOrHex,
|
|
341
|
-
requestSwapParameterEncoding,
|
|
342
297
|
rpcResponse,
|
|
343
298
|
stateGetMetadata,
|
|
344
299
|
stateGetRuntimeVersion,
|
package/dist/types.d.cts
CHANGED
|
@@ -19,10 +19,8 @@ type CfSupportedAssets = RpcResult<'cf_supported_assets'>;
|
|
|
19
19
|
type CfSwappingEnvironment = RpcResult<'cf_swapping_environment'>;
|
|
20
20
|
type CfSwapRate = RpcResult<'cf_swap_rate'>;
|
|
21
21
|
type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
|
|
22
|
-
type CfSwapRateV3 = RpcResult<'cf_swap_rate_v3'>;
|
|
23
22
|
type CfPoolDepth = RpcResult<'cf_pool_depth'>;
|
|
24
23
|
type CfAccounts = RpcResult<'cf_accounts'>;
|
|
25
|
-
type CfRequestSwapParameterEncoding = RpcResult<'cf_request_swap_parameter_encoding'>;
|
|
26
24
|
type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
|
|
27
25
|
type CfBoostPoolDetailsResponse = RpcResponse<'cf_boost_pool_details'>;
|
|
28
26
|
type CfBoostPoolPendingFeesResponse = RpcResponse<'cf_boost_pool_pending_fees'>;
|
|
@@ -37,13 +35,11 @@ type CfSupportedAssetsResponse = RpcResponse<'cf_supported_assets'>;
|
|
|
37
35
|
type CfSwappingEnvironmentResponse = RpcResponse<'cf_swapping_environment'>;
|
|
38
36
|
type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
|
|
39
37
|
type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
|
|
40
|
-
type CfSwapRateV3Response = RpcResponse<'cf_swap_rate_v3'>;
|
|
41
38
|
type CfPoolDepthResponse = RpcResponse<'cf_pool_depth'>;
|
|
42
39
|
type CfAccountsResponse = RpcResponse<'cf_accounts'>;
|
|
43
|
-
type CfRequestSwapParameterEncodingResponse = RpcResponse<'cf_request_swap_parameter_encoding'>;
|
|
44
40
|
type CfUnregisteredAccount = z.output<typeof unregistered>;
|
|
45
41
|
type CfBrokerAccount = z.output<typeof broker>;
|
|
46
42
|
type CfValidatorAccount = z.output<typeof validator>;
|
|
47
43
|
type CfLiquidityProviderAccount = z.output<typeof liquidityProvider>;
|
|
48
44
|
|
|
49
|
-
export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, 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 CfPoolDepth, type CfPoolDepthResponse, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfPoolsEnvironment, type CfPoolsEnvironmentResponse, type
|
|
45
|
+
export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, 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 CfPoolDepth, type CfPoolDepthResponse, 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
|
@@ -19,10 +19,8 @@ type CfSupportedAssets = RpcResult<'cf_supported_assets'>;
|
|
|
19
19
|
type CfSwappingEnvironment = RpcResult<'cf_swapping_environment'>;
|
|
20
20
|
type CfSwapRate = RpcResult<'cf_swap_rate'>;
|
|
21
21
|
type CfSwapRateV2 = RpcResult<'cf_swap_rate_v2'>;
|
|
22
|
-
type CfSwapRateV3 = RpcResult<'cf_swap_rate_v3'>;
|
|
23
22
|
type CfPoolDepth = RpcResult<'cf_pool_depth'>;
|
|
24
23
|
type CfAccounts = RpcResult<'cf_accounts'>;
|
|
25
|
-
type CfRequestSwapParameterEncoding = RpcResult<'cf_request_swap_parameter_encoding'>;
|
|
26
24
|
type CfAccountInfoResponse = RpcResponse<'cf_account_info'>;
|
|
27
25
|
type CfBoostPoolDetailsResponse = RpcResponse<'cf_boost_pool_details'>;
|
|
28
26
|
type CfBoostPoolPendingFeesResponse = RpcResponse<'cf_boost_pool_pending_fees'>;
|
|
@@ -37,13 +35,11 @@ type CfSupportedAssetsResponse = RpcResponse<'cf_supported_assets'>;
|
|
|
37
35
|
type CfSwappingEnvironmentResponse = RpcResponse<'cf_swapping_environment'>;
|
|
38
36
|
type CfSwapRateResponse = RpcResponse<'cf_swap_rate'>;
|
|
39
37
|
type CfSwapRateV2Response = RpcResponse<'cf_swap_rate_v2'>;
|
|
40
|
-
type CfSwapRateV3Response = RpcResponse<'cf_swap_rate_v3'>;
|
|
41
38
|
type CfPoolDepthResponse = RpcResponse<'cf_pool_depth'>;
|
|
42
39
|
type CfAccountsResponse = RpcResponse<'cf_accounts'>;
|
|
43
|
-
type CfRequestSwapParameterEncodingResponse = RpcResponse<'cf_request_swap_parameter_encoding'>;
|
|
44
40
|
type CfUnregisteredAccount = z.output<typeof unregistered>;
|
|
45
41
|
type CfBrokerAccount = z.output<typeof broker>;
|
|
46
42
|
type CfValidatorAccount = z.output<typeof validator>;
|
|
47
43
|
type CfLiquidityProviderAccount = z.output<typeof liquidityProvider>;
|
|
48
44
|
|
|
49
|
-
export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, 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 CfPoolDepth, type CfPoolDepthResponse, type CfPoolOrders, type CfPoolOrdersResponse, type CfPoolPriceV2, type CfPoolPriceV2Response, type CfPoolsEnvironment, type CfPoolsEnvironmentResponse, type
|
|
45
|
+
export { type CfAccountInfo, type CfAccountInfoResponse, type CfAccounts, type CfAccountsResponse, 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 CfPoolDepth, type CfPoolDepthResponse, 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,7 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/rpc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-assethub.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"eslint:check": "pnpm eslint --max-warnings 0 './**/*.ts'",
|
|
7
|
+
"prettier:base": "prettier ./** --ignore-path=../../.prettierignore",
|
|
8
|
+
"prettier:check": "pnpm prettier:base --check",
|
|
9
|
+
"prettier:write": "pnpm prettier:base --write",
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"prepublish": "pnpm test run && pnpm build",
|
|
12
|
+
"build": "pnpm clean && pnpm tsup",
|
|
13
|
+
"test:ci": "CI=1 pnpm t run",
|
|
14
|
+
"test": "vitest",
|
|
15
|
+
"coverage": "vitest run --coverage"
|
|
16
|
+
},
|
|
5
17
|
"dependencies": {
|
|
6
18
|
"@chainflip/utils": "0.7.0",
|
|
7
19
|
"zod": "^3.24.2"
|
|
@@ -41,17 +53,5 @@
|
|
|
41
53
|
"publishConfig": {
|
|
42
54
|
"registry": "https://registry.npmjs.org/",
|
|
43
55
|
"access": "public"
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"eslint:check": "pnpm eslint --max-warnings 0 './**/*.ts'",
|
|
47
|
-
"prettier:base": "prettier ./** --ignore-path=../../.prettierignore",
|
|
48
|
-
"prettier:check": "pnpm prettier:base --check",
|
|
49
|
-
"prettier:write": "pnpm prettier:base --write",
|
|
50
|
-
"clean": "rm -rf dist",
|
|
51
|
-
"prepublish": "pnpm test run && pnpm build",
|
|
52
|
-
"build": "pnpm clean && pnpm tsup",
|
|
53
|
-
"test:ci": "CI=1 pnpm t run",
|
|
54
|
-
"test": "vitest",
|
|
55
|
-
"coverage": "vitest run --coverage"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|