@gearbox-protocol/sdk 10.4.2 → 10.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "10.4.2",
3
+ "version": "10.4.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -1,147 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var providers_exports = {};
20
- __export(providers_exports, {
21
- getAlchemyUrl: () => getAlchemyUrl,
22
- getAnkrUrl: () => getAnkrUrl,
23
- getDrpcUrl: () => getDrpcUrl,
24
- getProviderUrl: () => getProviderUrl,
25
- getThirdWebUrl: () => getThirdWebUrl
26
- });
27
- module.exports = __toCommonJS(providers_exports);
28
- var import_sdk = require("../sdk/index.js");
29
- function getProviderUrl(provider, network, apiKey, protocol) {
30
- switch (provider) {
31
- case "alchemy":
32
- return getAlchemyUrl(network, apiKey, protocol);
33
- case "drpc":
34
- return getDrpcUrl(network, apiKey, protocol);
35
- case "ankr":
36
- return getAnkrUrl(network, apiKey, protocol);
37
- case "thirdweb":
38
- return getThirdWebUrl(network, apiKey, protocol);
39
- default: {
40
- if (!apiKey.startsWith(protocol)) {
41
- throw new Error(
42
- `generic provider's ${provider} key must start with ${protocol}`
43
- );
44
- }
45
- return apiKey;
46
- }
47
- }
48
- }
49
- function getAlchemyUrl(network, apiKey, protocol) {
50
- const alchemyDomain = ALCHEMY_DOMAINS[network];
51
- if (!alchemyDomain) {
52
- return void 0;
53
- }
54
- return `${protocol}s://${alchemyDomain}.g.alchemy.com/v2/${apiKey}`;
55
- }
56
- const DRPC_NETS = {
57
- Arbitrum: "arbitrum",
58
- Base: "base",
59
- BNB: "bsc",
60
- Mainnet: "ethereum",
61
- Optimism: "optimism",
62
- Sonic: "sonic",
63
- WorldChain: "worldchain",
64
- Berachain: "berachain",
65
- Avalanche: "avalanche",
66
- Monad: "monad-testnet",
67
- Hemi: "hemi",
68
- Lisk: "lisk",
69
- MegaETH: null,
70
- Etherlink: null,
71
- Plasma: "plasma"
72
- };
73
- const ALCHEMY_DOMAINS = {
74
- Mainnet: "eth-mainnet",
75
- Arbitrum: "arb-mainnet",
76
- Optimism: "opt-mainnet",
77
- Base: "base-mainnet",
78
- Sonic: "sonic-mainnet",
79
- Monad: "monad-testnet",
80
- Berachain: "berachain-mainnet",
81
- Avalanche: "avax-mainnet",
82
- BNB: "bnb-mainnet",
83
- WorldChain: "worldchain-mainnet",
84
- MegaETH: null,
85
- Etherlink: null,
86
- Hemi: null,
87
- Lisk: null,
88
- Plasma: "plasma-mainnet"
89
- };
90
- function getDrpcUrl(network, apiKey, protocol) {
91
- const net = DRPC_NETS[network];
92
- return net ? `${protocol}s://lb.drpc.org/${net}/${apiKey}` : void 0;
93
- }
94
- const ANKR_DOMAINS = {
95
- Arbitrum: "arbitrum",
96
- Avalanche: "avalanche",
97
- Base: "base",
98
- Berachain: null,
99
- BNB: "bsc",
100
- Etherlink: "etherlink_mainnet",
101
- Hemi: null,
102
- Lisk: null,
103
- Mainnet: "eth",
104
- MegaETH: null,
105
- Monad: "monad_testnet",
106
- Optimism: "optimism",
107
- Plasma: null,
108
- Sonic: "sonic_mainnet",
109
- WorldChain: null
110
- };
111
- function getAnkrUrl(network, apiKey, protocol) {
112
- const net = ANKR_DOMAINS[network];
113
- const sep = protocol === "ws" ? "/ws/" : "/";
114
- return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
115
- }
116
- const THIRDWEB_DOMAINS = {
117
- Arbitrum: import_sdk.chains.Arbitrum.id.toString(),
118
- Avalanche: import_sdk.chains.Avalanche.id.toString(),
119
- Base: import_sdk.chains.Base.id.toString(),
120
- Berachain: import_sdk.chains.Berachain.id.toString(),
121
- BNB: import_sdk.chains.BNB.id.toString(),
122
- Etherlink: import_sdk.chains.Etherlink.id.toString(),
123
- Hemi: import_sdk.chains.Hemi.id.toString(),
124
- Lisk: import_sdk.chains.Lisk.id.toString(),
125
- Mainnet: import_sdk.chains.Mainnet.id.toString(),
126
- MegaETH: import_sdk.chains.MegaETH.id.toString(),
127
- Monad: import_sdk.chains.Monad.id.toString(),
128
- Optimism: import_sdk.chains.Optimism.id.toString(),
129
- Plasma: import_sdk.chains.Plasma.id.toString(),
130
- Sonic: import_sdk.chains.Sonic.id.toString(),
131
- WorldChain: import_sdk.chains.WorldChain.id.toString()
132
- };
133
- function getThirdWebUrl(network, apiKey, protocol) {
134
- if (protocol === "ws") {
135
- return void 0;
136
- }
137
- const net = THIRDWEB_DOMAINS[network];
138
- return `https://${net}.rpc.thirdweb.com/${apiKey}`;
139
- }
140
- // Annotate the CommonJS export names for ESM import in node:
141
- 0 && (module.exports = {
142
- getAlchemyUrl,
143
- getAnkrUrl,
144
- getDrpcUrl,
145
- getProviderUrl,
146
- getThirdWebUrl
147
- });
@@ -1,119 +0,0 @@
1
- import { chains } from "../sdk/index.js";
2
- function getProviderUrl(provider, network, apiKey, protocol) {
3
- switch (provider) {
4
- case "alchemy":
5
- return getAlchemyUrl(network, apiKey, protocol);
6
- case "drpc":
7
- return getDrpcUrl(network, apiKey, protocol);
8
- case "ankr":
9
- return getAnkrUrl(network, apiKey, protocol);
10
- case "thirdweb":
11
- return getThirdWebUrl(network, apiKey, protocol);
12
- default: {
13
- if (!apiKey.startsWith(protocol)) {
14
- throw new Error(
15
- `generic provider's ${provider} key must start with ${protocol}`
16
- );
17
- }
18
- return apiKey;
19
- }
20
- }
21
- }
22
- function getAlchemyUrl(network, apiKey, protocol) {
23
- const alchemyDomain = ALCHEMY_DOMAINS[network];
24
- if (!alchemyDomain) {
25
- return void 0;
26
- }
27
- return `${protocol}s://${alchemyDomain}.g.alchemy.com/v2/${apiKey}`;
28
- }
29
- const DRPC_NETS = {
30
- Arbitrum: "arbitrum",
31
- Base: "base",
32
- BNB: "bsc",
33
- Mainnet: "ethereum",
34
- Optimism: "optimism",
35
- Sonic: "sonic",
36
- WorldChain: "worldchain",
37
- Berachain: "berachain",
38
- Avalanche: "avalanche",
39
- Monad: "monad-testnet",
40
- Hemi: "hemi",
41
- Lisk: "lisk",
42
- MegaETH: null,
43
- Etherlink: null,
44
- Plasma: "plasma"
45
- };
46
- const ALCHEMY_DOMAINS = {
47
- Mainnet: "eth-mainnet",
48
- Arbitrum: "arb-mainnet",
49
- Optimism: "opt-mainnet",
50
- Base: "base-mainnet",
51
- Sonic: "sonic-mainnet",
52
- Monad: "monad-testnet",
53
- Berachain: "berachain-mainnet",
54
- Avalanche: "avax-mainnet",
55
- BNB: "bnb-mainnet",
56
- WorldChain: "worldchain-mainnet",
57
- MegaETH: null,
58
- Etherlink: null,
59
- Hemi: null,
60
- Lisk: null,
61
- Plasma: "plasma-mainnet"
62
- };
63
- function getDrpcUrl(network, apiKey, protocol) {
64
- const net = DRPC_NETS[network];
65
- return net ? `${protocol}s://lb.drpc.org/${net}/${apiKey}` : void 0;
66
- }
67
- const ANKR_DOMAINS = {
68
- Arbitrum: "arbitrum",
69
- Avalanche: "avalanche",
70
- Base: "base",
71
- Berachain: null,
72
- BNB: "bsc",
73
- Etherlink: "etherlink_mainnet",
74
- Hemi: null,
75
- Lisk: null,
76
- Mainnet: "eth",
77
- MegaETH: null,
78
- Monad: "monad_testnet",
79
- Optimism: "optimism",
80
- Plasma: null,
81
- Sonic: "sonic_mainnet",
82
- WorldChain: null
83
- };
84
- function getAnkrUrl(network, apiKey, protocol) {
85
- const net = ANKR_DOMAINS[network];
86
- const sep = protocol === "ws" ? "/ws/" : "/";
87
- return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
88
- }
89
- const THIRDWEB_DOMAINS = {
90
- Arbitrum: chains.Arbitrum.id.toString(),
91
- Avalanche: chains.Avalanche.id.toString(),
92
- Base: chains.Base.id.toString(),
93
- Berachain: chains.Berachain.id.toString(),
94
- BNB: chains.BNB.id.toString(),
95
- Etherlink: chains.Etherlink.id.toString(),
96
- Hemi: chains.Hemi.id.toString(),
97
- Lisk: chains.Lisk.id.toString(),
98
- Mainnet: chains.Mainnet.id.toString(),
99
- MegaETH: chains.MegaETH.id.toString(),
100
- Monad: chains.Monad.id.toString(),
101
- Optimism: chains.Optimism.id.toString(),
102
- Plasma: chains.Plasma.id.toString(),
103
- Sonic: chains.Sonic.id.toString(),
104
- WorldChain: chains.WorldChain.id.toString()
105
- };
106
- function getThirdWebUrl(network, apiKey, protocol) {
107
- if (protocol === "ws") {
108
- return void 0;
109
- }
110
- const net = THIRDWEB_DOMAINS[network];
111
- return `https://${net}.rpc.thirdweb.com/${apiKey}`;
112
- }
113
- export {
114
- getAlchemyUrl,
115
- getAnkrUrl,
116
- getDrpcUrl,
117
- getProviderUrl,
118
- getThirdWebUrl
119
- };
@@ -1,6 +0,0 @@
1
- import { type NetworkType } from "../sdk/index.js";
2
- export declare function getProviderUrl(provider: string, network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
3
- export declare function getAlchemyUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
4
- export declare function getDrpcUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
5
- export declare function getAnkrUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
6
- export declare function getThirdWebUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;