@gearbox-protocol/sdk 9.10.1 → 9.10.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.
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var providers_exports = {};
20
20
  __export(providers_exports, {
21
21
  getAlchemyUrl: () => getAlchemyUrl,
22
+ getAnkrUrl: () => getAnkrUrl,
22
23
  getDrpcUrl: () => getDrpcUrl,
23
24
  getProviderUrl: () => getProviderUrl
24
25
  });
@@ -29,6 +30,8 @@ function getProviderUrl(provider, network, apiKey, protocol) {
29
30
  return getAlchemyUrl(network, apiKey, protocol);
30
31
  case "drpc":
31
32
  return getDrpcUrl(network, apiKey, protocol);
33
+ case "ankr":
34
+ return getAnkrUrl(network, apiKey, protocol);
32
35
  case "custom": {
33
36
  if (!apiKey.startsWith(protocol)) {
34
37
  throw new Error(`Custom RPC URL must start with ${protocol}`);
@@ -82,9 +85,32 @@ function getDrpcUrl(network, apiKey, protocol) {
82
85
  const net = DRPC_NETS[network];
83
86
  return net ? `${protocol}s://lb.drpc.org/${net}/${apiKey}` : void 0;
84
87
  }
88
+ const ANKR_DOMAINS = {
89
+ Arbitrum: "arbitrum",
90
+ Avalanche: "avalanche",
91
+ Base: "base",
92
+ Berachain: null,
93
+ BNB: "bsc",
94
+ Etherlink: "etherlink_mainnet",
95
+ Hemi: null,
96
+ Lisk: null,
97
+ Mainnet: "eth",
98
+ MegaETH: null,
99
+ Monad: "monad_testnet",
100
+ Optimism: "optimism",
101
+ Plasma: null,
102
+ Sonic: "sonic_mainnet",
103
+ WorldChain: null
104
+ };
105
+ function getAnkrUrl(network, apiKey, protocol) {
106
+ const net = ANKR_DOMAINS[network];
107
+ const sep = protocol === "ws" ? "/ws/" : "/";
108
+ return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
109
+ }
85
110
  // Annotate the CommonJS export names for ESM import in node:
86
111
  0 && (module.exports = {
87
112
  getAlchemyUrl,
113
+ getAnkrUrl,
88
114
  getDrpcUrl,
89
115
  getProviderUrl
90
116
  });
@@ -4,6 +4,8 @@ function getProviderUrl(provider, network, apiKey, protocol) {
4
4
  return getAlchemyUrl(network, apiKey, protocol);
5
5
  case "drpc":
6
6
  return getDrpcUrl(network, apiKey, protocol);
7
+ case "ankr":
8
+ return getAnkrUrl(network, apiKey, protocol);
7
9
  case "custom": {
8
10
  if (!apiKey.startsWith(protocol)) {
9
11
  throw new Error(`Custom RPC URL must start with ${protocol}`);
@@ -57,8 +59,31 @@ function getDrpcUrl(network, apiKey, protocol) {
57
59
  const net = DRPC_NETS[network];
58
60
  return net ? `${protocol}s://lb.drpc.org/${net}/${apiKey}` : void 0;
59
61
  }
62
+ const ANKR_DOMAINS = {
63
+ Arbitrum: "arbitrum",
64
+ Avalanche: "avalanche",
65
+ Base: "base",
66
+ Berachain: null,
67
+ BNB: "bsc",
68
+ Etherlink: "etherlink_mainnet",
69
+ Hemi: null,
70
+ Lisk: null,
71
+ Mainnet: "eth",
72
+ MegaETH: null,
73
+ Monad: "monad_testnet",
74
+ Optimism: "optimism",
75
+ Plasma: null,
76
+ Sonic: "sonic_mainnet",
77
+ WorldChain: null
78
+ };
79
+ function getAnkrUrl(network, apiKey, protocol) {
80
+ const net = ANKR_DOMAINS[network];
81
+ const sep = protocol === "ws" ? "/ws/" : "/";
82
+ return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
83
+ }
60
84
  export {
61
85
  getAlchemyUrl,
86
+ getAnkrUrl,
62
87
  getDrpcUrl,
63
88
  getProviderUrl
64
89
  };
@@ -1,6 +1,6 @@
1
1
  import type { HttpTransportConfig, WebSocketTransportConfig } from "viem";
2
2
  import type { NetworkType } from "../sdk/index.js";
3
- export type RpcProvider = "alchemy" | "drpc" | "custom";
3
+ export type RpcProvider = "alchemy" | "drpc" | "ankr" | "custom";
4
4
  export interface ProviderConfig {
5
5
  provider: RpcProvider;
6
6
  keys: string[];
@@ -23,3 +23,4 @@ export type CreateTransportConfig = CreateHTTPTransportConfig | CreateWSTranspor
23
23
  export declare function getProviderUrl(provider: RpcProvider, network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
24
24
  export declare function getAlchemyUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
25
25
  export declare function getDrpcUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
26
+ export declare function getAnkrUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "9.10.1",
3
+ "version": "9.10.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",