@gearbox-protocol/sdk 8.27.9 → 8.27.11
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.
|
@@ -28,17 +28,25 @@ var import_viem = require("viem");
|
|
|
28
28
|
var import_sdk = require("../sdk/index.js");
|
|
29
29
|
function createTransport(config) {
|
|
30
30
|
const { rpcProviders = [], protocol, network, ...rest } = config;
|
|
31
|
-
const rpcUrls = /* @__PURE__ */ new
|
|
31
|
+
const rpcUrls = /* @__PURE__ */ new Map();
|
|
32
32
|
for (const { provider, keys } of rpcProviders) {
|
|
33
33
|
for (const key of keys) {
|
|
34
34
|
const url = getProviderUrl(provider, network, key, protocol);
|
|
35
35
|
if (url) {
|
|
36
|
-
rpcUrls.
|
|
36
|
+
rpcUrls.set(url, provider);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const transports = Array.from(rpcUrls).map(
|
|
41
|
-
(url) => protocol === "http" ? (0, import_viem.http)(url,
|
|
40
|
+
const transports = Array.from(rpcUrls.entries()).map(
|
|
41
|
+
([url, provider], index) => protocol === "http" ? (0, import_viem.http)(url, {
|
|
42
|
+
...rest,
|
|
43
|
+
key: `${provider}-${index}`,
|
|
44
|
+
name: `${provider}-${index}`
|
|
45
|
+
}) : (0, import_viem.webSocket)(url, {
|
|
46
|
+
...rest,
|
|
47
|
+
key: `${provider}-${index}`,
|
|
48
|
+
name: `${provider}-${index}`
|
|
49
|
+
})
|
|
42
50
|
);
|
|
43
51
|
if (transports.length === 0) {
|
|
44
52
|
throw new Error("no fitting rpc urls found");
|
|
@@ -2,17 +2,25 @@ import { fallback, http, webSocket } from "viem";
|
|
|
2
2
|
import { getChain } from "../sdk/index.js";
|
|
3
3
|
function createTransport(config) {
|
|
4
4
|
const { rpcProviders = [], protocol, network, ...rest } = config;
|
|
5
|
-
const rpcUrls = /* @__PURE__ */ new
|
|
5
|
+
const rpcUrls = /* @__PURE__ */ new Map();
|
|
6
6
|
for (const { provider, keys } of rpcProviders) {
|
|
7
7
|
for (const key of keys) {
|
|
8
8
|
const url = getProviderUrl(provider, network, key, protocol);
|
|
9
9
|
if (url) {
|
|
10
|
-
rpcUrls.
|
|
10
|
+
rpcUrls.set(url, provider);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
const transports = Array.from(rpcUrls).map(
|
|
15
|
-
(url) => protocol === "http" ? http(url,
|
|
14
|
+
const transports = Array.from(rpcUrls.entries()).map(
|
|
15
|
+
([url, provider], index) => protocol === "http" ? http(url, {
|
|
16
|
+
...rest,
|
|
17
|
+
key: `${provider}-${index}`,
|
|
18
|
+
name: `${provider}-${index}`
|
|
19
|
+
}) : webSocket(url, {
|
|
20
|
+
...rest,
|
|
21
|
+
key: `${provider}-${index}`,
|
|
22
|
+
name: `${provider}-${index}`
|
|
23
|
+
})
|
|
16
24
|
);
|
|
17
25
|
if (transports.length === 0) {
|
|
18
26
|
throw new Error("no fitting rpc urls found");
|