@gearbox-protocol/sdk 4.1.0 → 4.1.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.
|
@@ -27,7 +27,7 @@ module.exports = __toCommonJS(createTransport_exports);
|
|
|
27
27
|
var import_viem = require("viem");
|
|
28
28
|
var import_sdk = require("../sdk/index.js");
|
|
29
29
|
function createTransport(config) {
|
|
30
|
-
const { alchemyKeys, protocol, network } = config;
|
|
30
|
+
const { alchemyKeys, protocol, network, ...rest } = config;
|
|
31
31
|
const rpcUrls = config.rpcUrls.filter((url) => {
|
|
32
32
|
return url.startsWith(protocol) && !alchemyKeys.some((key) => url.includes(key));
|
|
33
33
|
});
|
|
@@ -38,7 +38,7 @@ function createTransport(config) {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
const transports = rpcUrls.map(
|
|
41
|
-
(url) => protocol === "http" ? (0, import_viem.http)(url) : (0, import_viem.webSocket)(url)
|
|
41
|
+
(url) => protocol === "http" ? (0, import_viem.http)(url, rest) : (0, import_viem.webSocket)(url, rest)
|
|
42
42
|
);
|
|
43
43
|
if (transports.length === 0) {
|
|
44
44
|
throw new Error("no fitting rpc urls found");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fallback, http, webSocket } from "viem";
|
|
2
2
|
import { getChain } from "../sdk/index.js";
|
|
3
3
|
function createTransport(config) {
|
|
4
|
-
const { alchemyKeys, protocol, network } = config;
|
|
4
|
+
const { alchemyKeys, protocol, network, ...rest } = config;
|
|
5
5
|
const rpcUrls = config.rpcUrls.filter((url) => {
|
|
6
6
|
return url.startsWith(protocol) && !alchemyKeys.some((key) => url.includes(key));
|
|
7
7
|
});
|
|
@@ -12,7 +12,7 @@ function createTransport(config) {
|
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
14
|
const transports = rpcUrls.map(
|
|
15
|
-
(url) => protocol === "http" ? http(url) : webSocket(url)
|
|
15
|
+
(url) => protocol === "http" ? http(url, rest) : webSocket(url, rest)
|
|
16
16
|
);
|
|
17
17
|
if (transports.length === 0) {
|
|
18
18
|
throw new Error("no fitting rpc urls found");
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export interface
|
|
1
|
+
import type { HttpTransportConfig, Transport, WebSocketTransportConfig } from "viem";
|
|
2
|
+
import type { NetworkType } from "../sdk/index.js";
|
|
3
|
+
export interface CreateTransportURLOptions {
|
|
4
4
|
rpcUrls: string[];
|
|
5
5
|
alchemyKeys: string[];
|
|
6
|
-
protocol: "http" | "ws";
|
|
7
6
|
network: NetworkType;
|
|
8
7
|
}
|
|
8
|
+
export type CreateHTTPTransportConfig = {
|
|
9
|
+
protocol: "http";
|
|
10
|
+
} & HttpTransportConfig & CreateTransportURLOptions;
|
|
11
|
+
export type CreateWSTransportConfig = {
|
|
12
|
+
protocol: "ws";
|
|
13
|
+
} & WebSocketTransportConfig & CreateTransportURLOptions;
|
|
14
|
+
export type CreateTransportConfig = CreateHTTPTransportConfig | CreateWSTransportConfig;
|
|
9
15
|
/**
|
|
10
16
|
* Helper method to create viem Transport using API keys of well-known RPC providers and explicit fallback URLs
|
|
11
17
|
* Currently only supports Alchemy
|