@chainflip/rpc 1.8.3 → 1.8.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.
@@ -9,13 +9,22 @@ var HttpClient = (_class = class extends _Clientcjs2.default {constructor(...arg
9
9
  __init2() {this.batchDuration = 100}
10
10
  __init3() {this.requestMap = /* @__PURE__ */ new Map()}
11
11
  async send(request) {
12
- const res = await fetch(this.url, {
13
- body: JSON.stringify(request),
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/json"
17
- }
18
- });
12
+ let res;
13
+ try {
14
+ res = await fetch(this.url, {
15
+ body: JSON.stringify(request),
16
+ method: "POST",
17
+ headers: {
18
+ "Content-Type": "application/json"
19
+ }
20
+ });
21
+ } catch (error) {
22
+ return request.map((r) => ({
23
+ id: r.id,
24
+ success: false,
25
+ error: new Error("Network error", { cause: error })
26
+ }));
27
+ }
19
28
  if (!res.ok) {
20
29
  return request.map((r) => ({
21
30
  id: r.id,
@@ -9,13 +9,22 @@ var HttpClient = class extends Client {
9
9
  batchDuration = 100;
10
10
  requestMap = /* @__PURE__ */ new Map();
11
11
  async send(request) {
12
- const res = await fetch(this.url, {
13
- body: JSON.stringify(request),
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/json"
17
- }
18
- });
12
+ let res;
13
+ try {
14
+ res = await fetch(this.url, {
15
+ body: JSON.stringify(request),
16
+ method: "POST",
17
+ headers: {
18
+ "Content-Type": "application/json"
19
+ }
20
+ });
21
+ } catch (error) {
22
+ return request.map((r) => ({
23
+ id: r.id,
24
+ success: false,
25
+ error: new Error("Network error", { cause: error })
26
+ }));
27
+ }
19
28
  if (!res.ok) {
20
29
  return request.map((r) => ({
21
30
  id: r.id,
package/dist/common.d.cts CHANGED
@@ -188,6 +188,7 @@ declare const rpcResult: {
188
188
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
189
189
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
190
190
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
191
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
191
192
  }, {
192
193
  chain: z.ZodLiteral<"Ethereum">;
193
194
  }>, "strip", z.ZodTypeAny, {
@@ -195,15 +196,18 @@ declare const rpcResult: {
195
196
  chain: "Ethereum";
196
197
  to: `0x${string}`;
197
198
  calldata: `0x${string}`;
199
+ source_token_address?: `0x${string}` | undefined;
198
200
  }, {
199
201
  value: string | number;
200
202
  chain: "Ethereum";
201
203
  to: string;
202
204
  calldata: string;
205
+ source_token_address?: string | undefined;
203
206
  }>, z.ZodObject<z.objectUtil.extendShape<{
204
207
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
205
208
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
206
209
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
210
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
207
211
  }, {
208
212
  chain: z.ZodLiteral<"Arbitrum">;
209
213
  }>, "strip", z.ZodTypeAny, {
@@ -211,11 +215,13 @@ declare const rpcResult: {
211
215
  chain: "Arbitrum";
212
216
  to: `0x${string}`;
213
217
  calldata: `0x${string}`;
218
+ source_token_address?: `0x${string}` | undefined;
214
219
  }, {
215
220
  value: string | number;
216
221
  chain: "Arbitrum";
217
222
  to: string;
218
223
  calldata: string;
224
+ source_token_address?: string | undefined;
219
225
  }>, z.ZodObject<{
220
226
  chain: z.ZodLiteral<"Solana">;
221
227
  program_id: z.ZodString;
@@ -268,6 +274,7 @@ declare const rpcResult: {
268
274
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
269
275
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
270
276
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
277
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
271
278
  }, {
272
279
  chain: z.ZodLiteral<"Ethereum">;
273
280
  }>, "strip", z.ZodTypeAny, {
@@ -275,15 +282,18 @@ declare const rpcResult: {
275
282
  chain: "Ethereum";
276
283
  to: `0x${string}`;
277
284
  calldata: `0x${string}`;
285
+ source_token_address?: `0x${string}` | undefined;
278
286
  }, {
279
287
  value: string | number;
280
288
  chain: "Ethereum";
281
289
  to: string;
282
290
  calldata: string;
291
+ source_token_address?: string | undefined;
283
292
  }>, z.ZodObject<z.objectUtil.extendShape<{
284
293
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
285
294
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
286
295
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
296
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
287
297
  }, {
288
298
  chain: z.ZodLiteral<"Arbitrum">;
289
299
  }>, "strip", z.ZodTypeAny, {
@@ -291,11 +301,13 @@ declare const rpcResult: {
291
301
  chain: "Arbitrum";
292
302
  to: `0x${string}`;
293
303
  calldata: `0x${string}`;
304
+ source_token_address?: `0x${string}` | undefined;
294
305
  }, {
295
306
  value: string | number;
296
307
  chain: "Arbitrum";
297
308
  to: string;
298
309
  calldata: string;
310
+ source_token_address?: string | undefined;
299
311
  }>, z.ZodObject<{
300
312
  chain: z.ZodLiteral<"Solana">;
301
313
  program_id: z.ZodString;
package/dist/common.d.ts CHANGED
@@ -188,6 +188,7 @@ declare const rpcResult: {
188
188
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
189
189
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
190
190
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
191
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
191
192
  }, {
192
193
  chain: z.ZodLiteral<"Ethereum">;
193
194
  }>, "strip", z.ZodTypeAny, {
@@ -195,15 +196,18 @@ declare const rpcResult: {
195
196
  chain: "Ethereum";
196
197
  to: `0x${string}`;
197
198
  calldata: `0x${string}`;
199
+ source_token_address?: `0x${string}` | undefined;
198
200
  }, {
199
201
  value: string | number;
200
202
  chain: "Ethereum";
201
203
  to: string;
202
204
  calldata: string;
205
+ source_token_address?: string | undefined;
203
206
  }>, z.ZodObject<z.objectUtil.extendShape<{
204
207
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
205
208
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
206
209
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
210
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
207
211
  }, {
208
212
  chain: z.ZodLiteral<"Arbitrum">;
209
213
  }>, "strip", z.ZodTypeAny, {
@@ -211,11 +215,13 @@ declare const rpcResult: {
211
215
  chain: "Arbitrum";
212
216
  to: `0x${string}`;
213
217
  calldata: `0x${string}`;
218
+ source_token_address?: `0x${string}` | undefined;
214
219
  }, {
215
220
  value: string | number;
216
221
  chain: "Arbitrum";
217
222
  to: string;
218
223
  calldata: string;
224
+ source_token_address?: string | undefined;
219
225
  }>, z.ZodObject<{
220
226
  chain: z.ZodLiteral<"Solana">;
221
227
  program_id: z.ZodString;
@@ -268,6 +274,7 @@ declare const rpcResult: {
268
274
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
269
275
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
270
276
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
277
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
271
278
  }, {
272
279
  chain: z.ZodLiteral<"Ethereum">;
273
280
  }>, "strip", z.ZodTypeAny, {
@@ -275,15 +282,18 @@ declare const rpcResult: {
275
282
  chain: "Ethereum";
276
283
  to: `0x${string}`;
277
284
  calldata: `0x${string}`;
285
+ source_token_address?: `0x${string}` | undefined;
278
286
  }, {
279
287
  value: string | number;
280
288
  chain: "Ethereum";
281
289
  to: string;
282
290
  calldata: string;
291
+ source_token_address?: string | undefined;
283
292
  }>, z.ZodObject<z.objectUtil.extendShape<{
284
293
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
285
294
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
286
295
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
296
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
287
297
  }, {
288
298
  chain: z.ZodLiteral<"Arbitrum">;
289
299
  }>, "strip", z.ZodTypeAny, {
@@ -291,11 +301,13 @@ declare const rpcResult: {
291
301
  chain: "Arbitrum";
292
302
  to: `0x${string}`;
293
303
  calldata: `0x${string}`;
304
+ source_token_address?: `0x${string}` | undefined;
294
305
  }, {
295
306
  value: string | number;
296
307
  chain: "Arbitrum";
297
308
  to: string;
298
309
  calldata: string;
310
+ source_token_address?: string | undefined;
299
311
  }>, z.ZodObject<{
300
312
  chain: z.ZodLiteral<"Solana">;
301
313
  program_id: z.ZodString;
package/dist/parsers.cjs CHANGED
@@ -156,7 +156,8 @@ var brokerRequestSwapDepositAddress = _zod.z.object({
156
156
  var evmBrokerRequestSwapParameterEncoding = _zod.z.object({
157
157
  to: hexString,
158
158
  calldata: hexString,
159
- value: numberOrHex
159
+ value: numberOrHex,
160
+ source_token_address: hexString.optional()
160
161
  });
161
162
  var requestSwapParameterEncoding = _zod.z.discriminatedUnion("chain", [
162
163
  _zod.z.object({
@@ -11702,6 +11702,7 @@ declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.
11702
11702
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11703
11703
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11704
11704
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
11705
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
11705
11706
  }, {
11706
11707
  chain: z.ZodLiteral<"Ethereum">;
11707
11708
  }>, "strip", z.ZodTypeAny, {
@@ -11709,15 +11710,18 @@ declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.
11709
11710
  chain: "Ethereum";
11710
11711
  to: `0x${string}`;
11711
11712
  calldata: `0x${string}`;
11713
+ source_token_address?: `0x${string}` | undefined;
11712
11714
  }, {
11713
11715
  value: string | number;
11714
11716
  chain: "Ethereum";
11715
11717
  to: string;
11716
11718
  calldata: string;
11719
+ source_token_address?: string | undefined;
11717
11720
  }>, z.ZodObject<z.objectUtil.extendShape<{
11718
11721
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11719
11722
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11720
11723
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
11724
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
11721
11725
  }, {
11722
11726
  chain: z.ZodLiteral<"Arbitrum">;
11723
11727
  }>, "strip", z.ZodTypeAny, {
@@ -11725,11 +11729,13 @@ declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.
11725
11729
  chain: "Arbitrum";
11726
11730
  to: `0x${string}`;
11727
11731
  calldata: `0x${string}`;
11732
+ source_token_address?: `0x${string}` | undefined;
11728
11733
  }, {
11729
11734
  value: string | number;
11730
11735
  chain: "Arbitrum";
11731
11736
  to: string;
11732
11737
  calldata: string;
11738
+ source_token_address?: string | undefined;
11733
11739
  }>, z.ZodObject<{
11734
11740
  chain: z.ZodLiteral<"Solana">;
11735
11741
  program_id: z.ZodString;
package/dist/parsers.d.ts CHANGED
@@ -11702,6 +11702,7 @@ declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.
11702
11702
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11703
11703
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11704
11704
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
11705
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
11705
11706
  }, {
11706
11707
  chain: z.ZodLiteral<"Ethereum">;
11707
11708
  }>, "strip", z.ZodTypeAny, {
@@ -11709,15 +11710,18 @@ declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.
11709
11710
  chain: "Ethereum";
11710
11711
  to: `0x${string}`;
11711
11712
  calldata: `0x${string}`;
11713
+ source_token_address?: `0x${string}` | undefined;
11712
11714
  }, {
11713
11715
  value: string | number;
11714
11716
  chain: "Ethereum";
11715
11717
  to: string;
11716
11718
  calldata: string;
11719
+ source_token_address?: string | undefined;
11717
11720
  }>, z.ZodObject<z.objectUtil.extendShape<{
11718
11721
  to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11719
11722
  calldata: z.ZodEffects<z.ZodString, `0x${string}`, string>;
11720
11723
  value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, bigint, number>, z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, bigint, string>]>;
11724
+ source_token_address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
11721
11725
  }, {
11722
11726
  chain: z.ZodLiteral<"Arbitrum">;
11723
11727
  }>, "strip", z.ZodTypeAny, {
@@ -11725,11 +11729,13 @@ declare const requestSwapParameterEncoding: z.ZodDiscriminatedUnion<"chain", [z.
11725
11729
  chain: "Arbitrum";
11726
11730
  to: `0x${string}`;
11727
11731
  calldata: `0x${string}`;
11732
+ source_token_address?: `0x${string}` | undefined;
11728
11733
  }, {
11729
11734
  value: string | number;
11730
11735
  chain: "Arbitrum";
11731
11736
  to: string;
11732
11737
  calldata: string;
11738
+ source_token_address?: string | undefined;
11733
11739
  }>, z.ZodObject<{
11734
11740
  chain: z.ZodLiteral<"Solana">;
11735
11741
  program_id: z.ZodString;
package/dist/parsers.mjs CHANGED
@@ -156,7 +156,8 @@ var brokerRequestSwapDepositAddress = z.object({
156
156
  var evmBrokerRequestSwapParameterEncoding = z.object({
157
157
  to: hexString,
158
158
  calldata: hexString,
159
- value: numberOrHex
159
+ value: numberOrHex,
160
+ source_token_address: hexString.optional()
160
161
  });
161
162
  var requestSwapParameterEncoding = z.discriminatedUnion("chain", [
162
163
  z.object({
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@chainflip/rpc",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@chainflip/utils": "0.4.0",
7
- "zod": "^3.24.1"
7
+ "zod": "^3.24.2"
8
8
  },
9
9
  "devDependencies": {
10
- "@types/node": "^22.13.1",
10
+ "@types/node": "^22.13.4",
11
11
  "@types/ws": "^8.5.14",
12
12
  "ws": "^8.18.0"
13
13
  },