@gearbox-protocol/sdk 13.0.0-next.24 → 13.0.0-next.26

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.
@@ -52,6 +52,9 @@ function getRpcProviderUrl(provider, network, apiKey, protocol = "http") {
52
52
  }
53
53
  }
54
54
  function getAlchemyUrl(network, apiKey, protocol = "http") {
55
+ if (!apiKey) {
56
+ return void 0;
57
+ }
55
58
  const alchemyDomain = ALCHEMY_DOMAINS[network];
56
59
  if (!alchemyDomain) {
57
60
  return void 0;
@@ -95,6 +98,9 @@ const ALCHEMY_DOMAINS = {
95
98
  Somnia: null
96
99
  };
97
100
  function getDrpcUrl(network, apiKey, protocol = "http") {
101
+ if (!apiKey) {
102
+ return void 0;
103
+ }
98
104
  const net = DRPC_NETS[network];
99
105
  return net ? `${protocol}s://lb.drpc.live/${net}/${apiKey}` : void 0;
100
106
  }
@@ -117,6 +123,9 @@ const ANKR_DOMAINS = {
117
123
  Somnia: "somnia_mainnet"
118
124
  };
119
125
  function getAnkrUrl(network, apiKey, protocol = "http") {
126
+ if (!apiKey) {
127
+ return void 0;
128
+ }
120
129
  const net = ANKR_DOMAINS[network];
121
130
  const sep = protocol === "ws" ? "/ws/" : "/";
122
131
  return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
@@ -140,6 +149,9 @@ const THIRDWEB_DOMAINS = {
140
149
  Somnia: import_sdk.chains.Somnia.id.toString()
141
150
  };
142
151
  function getThirdWebUrl(network, apiKey, protocol = "http") {
152
+ if (!apiKey) {
153
+ return void 0;
154
+ }
143
155
  if (protocol === "ws") {
144
156
  return void 0;
145
157
  }
@@ -68,7 +68,7 @@ class TokensMeta extends import_utils.AddressMap {
68
68
  `extended token data not loaded for ${t.symbol} (${t.addr})`
69
69
  );
70
70
  }
71
- return "contractType" in t && t.contractType.startsWith("PHANTOM_TOKEN::");
71
+ return !!t.contractType?.startsWith("PHANTOM_TOKEN::");
72
72
  }
73
73
  /**
74
74
  * Returns true if the token is a KYC underlying token, throws if the token data is not loaded
@@ -81,7 +81,7 @@ class TokensMeta extends import_utils.AddressMap {
81
81
  `extended token data not loaded for ${t.symbol} (${t.addr})`
82
82
  );
83
83
  }
84
- return "contractType" in t && t.contractType.startsWith("KYC_UNDERLYING::");
84
+ return !!t.contractType?.startsWith("KYC_UNDERLYING::");
85
85
  }
86
86
  /**
87
87
  * Returns true if the token is a DSToken, throws if the token data is not loaded
@@ -206,7 +206,7 @@ class TokensMeta extends import_utils.AddressMap {
206
206
  `token ${meta.symbol} (${token}) is ${contractType} but serialize failed: ${serializeResp.error}`
207
207
  );
208
208
  }
209
- } else if (contractType.startsWith("PHANTOM_TOKEN::")) {
209
+ } else {
210
210
  this.upsert(token, {
211
211
  ...meta,
212
212
  contractType
@@ -22,6 +22,9 @@ function getRpcProviderUrl(provider, network, apiKey, protocol = "http") {
22
22
  }
23
23
  }
24
24
  function getAlchemyUrl(network, apiKey, protocol = "http") {
25
+ if (!apiKey) {
26
+ return void 0;
27
+ }
25
28
  const alchemyDomain = ALCHEMY_DOMAINS[network];
26
29
  if (!alchemyDomain) {
27
30
  return void 0;
@@ -65,6 +68,9 @@ const ALCHEMY_DOMAINS = {
65
68
  Somnia: null
66
69
  };
67
70
  function getDrpcUrl(network, apiKey, protocol = "http") {
71
+ if (!apiKey) {
72
+ return void 0;
73
+ }
68
74
  const net = DRPC_NETS[network];
69
75
  return net ? `${protocol}s://lb.drpc.live/${net}/${apiKey}` : void 0;
70
76
  }
@@ -87,6 +93,9 @@ const ANKR_DOMAINS = {
87
93
  Somnia: "somnia_mainnet"
88
94
  };
89
95
  function getAnkrUrl(network, apiKey, protocol = "http") {
96
+ if (!apiKey) {
97
+ return void 0;
98
+ }
90
99
  const net = ANKR_DOMAINS[network];
91
100
  const sep = protocol === "ws" ? "/ws/" : "/";
92
101
  return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
@@ -110,6 +119,9 @@ const THIRDWEB_DOMAINS = {
110
119
  Somnia: chains.Somnia.id.toString()
111
120
  };
112
121
  function getThirdWebUrl(network, apiKey, protocol = "http") {
122
+ if (!apiKey) {
123
+ return void 0;
124
+ }
113
125
  if (protocol === "ws") {
114
126
  return void 0;
115
127
  }
@@ -56,7 +56,7 @@ class TokensMeta extends AddressMap {
56
56
  `extended token data not loaded for ${t.symbol} (${t.addr})`
57
57
  );
58
58
  }
59
- return "contractType" in t && t.contractType.startsWith("PHANTOM_TOKEN::");
59
+ return !!t.contractType?.startsWith("PHANTOM_TOKEN::");
60
60
  }
61
61
  /**
62
62
  * Returns true if the token is a KYC underlying token, throws if the token data is not loaded
@@ -69,7 +69,7 @@ class TokensMeta extends AddressMap {
69
69
  `extended token data not loaded for ${t.symbol} (${t.addr})`
70
70
  );
71
71
  }
72
- return "contractType" in t && t.contractType.startsWith("KYC_UNDERLYING::");
72
+ return !!t.contractType?.startsWith("KYC_UNDERLYING::");
73
73
  }
74
74
  /**
75
75
  * Returns true if the token is a DSToken, throws if the token data is not loaded
@@ -194,7 +194,7 @@ class TokensMeta extends AddressMap {
194
194
  `token ${meta.symbol} (${token}) is ${contractType} but serialize failed: ${serializeResp.error}`
195
195
  );
196
196
  }
197
- } else if (contractType.startsWith("PHANTOM_TOKEN::")) {
197
+ } else {
198
198
  this.upsert(token, {
199
199
  ...meta,
200
200
  contractType
@@ -8,11 +8,11 @@ export declare const rpcProvidersSchema: z.ZodEnum<{
8
8
  ankr: "ankr";
9
9
  }>;
10
10
  export type RpcProvider = z.infer<typeof rpcProvidersSchema>;
11
- export declare function getRpcProviderUrl(provider: RpcProvider, network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
12
- export declare function getAlchemyUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
13
- export declare function getDrpcUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
14
- export declare function getAnkrUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
15
- export declare function getThirdWebUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
11
+ export declare function getRpcProviderUrl(provider: RpcProvider, network: NetworkType, apiKey?: string, protocol?: "http" | "ws"): string | undefined;
12
+ export declare function getAlchemyUrl(network: NetworkType, apiKey?: string, protocol?: "http" | "ws"): string | undefined;
13
+ export declare function getDrpcUrl(network: NetworkType, apiKey?: string, protocol?: "http" | "ws"): string | undefined;
14
+ export declare function getAnkrUrl(network: NetworkType, apiKey?: string, protocol?: "http" | "ws"): string | undefined;
15
+ export declare function getThirdWebUrl(network: NetworkType, apiKey?: string, protocol?: "http" | "ws"): string | undefined;
16
16
  export declare function getErpcKey(network: NetworkType, projectId?: string, urlBase?: string): string | undefined;
17
17
  /**
18
18
  Non-existent event:
@@ -8,6 +8,7 @@ export type KYCUnderlyingContractType = typeof KYC_UNDERLYING_DEFAULT | typeof K
8
8
  export type PhantomTokenContractType = (typeof PHANTOM_TOKEN_CONTRACT_TYPES)[number];
9
9
  export type SimpleTokenMeta = TokenData & {
10
10
  isDSToken?: boolean;
11
+ contractType?: string;
11
12
  };
12
13
  export type PhantomTokenMeta = SimpleTokenMeta & {
13
14
  contractType: PhantomTokenContractType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "13.0.0-next.24",
3
+ "version": "13.0.0-next.26",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",