@tokemak/graph-cli 0.0.6 → 0.0.8
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/dist/index.js +36 -9
- package/dist/index.mjs +36 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3078,17 +3078,44 @@ function getSdk6(client, withWrapper = defaultWrapper6) {
|
|
|
3078
3078
|
}
|
|
3079
3079
|
|
|
3080
3080
|
// clients.ts
|
|
3081
|
-
var
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3081
|
+
var getEndpoint = (chainId) => {
|
|
3082
|
+
let config;
|
|
3083
|
+
switch (chainId) {
|
|
3084
|
+
case import_chains.mainnet.id:
|
|
3085
|
+
config = import_config.coreMainnetConfig;
|
|
3086
|
+
break;
|
|
3087
|
+
case import_chains.base.id:
|
|
3088
|
+
config = import_config.coreBaseConfig;
|
|
3089
|
+
break;
|
|
3090
|
+
case import_chains.sonic.id:
|
|
3091
|
+
config = import_config.coreSonicConfig;
|
|
3092
|
+
break;
|
|
3093
|
+
case import_chains.plasma.id:
|
|
3094
|
+
config = import_config.corePlasmaConfig;
|
|
3095
|
+
break;
|
|
3096
|
+
case import_chains.arbitrum.id:
|
|
3097
|
+
config = import_config.coreArbitrumConfig;
|
|
3098
|
+
break;
|
|
3099
|
+
case import_chains.linea.id:
|
|
3100
|
+
config = import_config.coreLineaConfig;
|
|
3101
|
+
break;
|
|
3102
|
+
default:
|
|
3103
|
+
throw new Error(`Unsupported chainId: ${chainId}`);
|
|
3104
|
+
}
|
|
3105
|
+
if (!config) {
|
|
3106
|
+
throw new Error(
|
|
3107
|
+
`Config for chainId ${chainId} is undefined. Make sure @tokemak/config is properly installed and built.`
|
|
3108
|
+
);
|
|
3109
|
+
}
|
|
3110
|
+
if (!config.subgraphEndpoint) {
|
|
3111
|
+
throw new Error(
|
|
3112
|
+
`subgraphEndpoint is undefined for chainId ${chainId}. Make sure @tokemak/config is properly configured.`
|
|
3113
|
+
);
|
|
3114
|
+
}
|
|
3115
|
+
return config.subgraphEndpoint;
|
|
3088
3116
|
};
|
|
3089
3117
|
var getSdkByChainId = (chainId) => {
|
|
3090
|
-
const url =
|
|
3091
|
-
if (!url) throw new Error(`Unsupported chainId: ${chainId}`);
|
|
3118
|
+
const url = getEndpoint(chainId);
|
|
3092
3119
|
const client = new import_graphql_request.GraphQLClient(url);
|
|
3093
3120
|
if (chainId === import_chains.base.id) return getSdk2(client);
|
|
3094
3121
|
if (chainId === import_chains.sonic.id) return getSdk3(client);
|
package/dist/index.mjs
CHANGED
|
@@ -3049,17 +3049,44 @@ function getSdk6(client, withWrapper = defaultWrapper6) {
|
|
|
3049
3049
|
}
|
|
3050
3050
|
|
|
3051
3051
|
// clients.ts
|
|
3052
|
-
var
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3052
|
+
var getEndpoint = (chainId) => {
|
|
3053
|
+
let config;
|
|
3054
|
+
switch (chainId) {
|
|
3055
|
+
case mainnet.id:
|
|
3056
|
+
config = coreMainnetConfig;
|
|
3057
|
+
break;
|
|
3058
|
+
case base.id:
|
|
3059
|
+
config = coreBaseConfig;
|
|
3060
|
+
break;
|
|
3061
|
+
case sonic.id:
|
|
3062
|
+
config = coreSonicConfig;
|
|
3063
|
+
break;
|
|
3064
|
+
case plasma.id:
|
|
3065
|
+
config = corePlasmaConfig;
|
|
3066
|
+
break;
|
|
3067
|
+
case arbitrum.id:
|
|
3068
|
+
config = coreArbitrumConfig;
|
|
3069
|
+
break;
|
|
3070
|
+
case linea.id:
|
|
3071
|
+
config = coreLineaConfig;
|
|
3072
|
+
break;
|
|
3073
|
+
default:
|
|
3074
|
+
throw new Error(`Unsupported chainId: ${chainId}`);
|
|
3075
|
+
}
|
|
3076
|
+
if (!config) {
|
|
3077
|
+
throw new Error(
|
|
3078
|
+
`Config for chainId ${chainId} is undefined. Make sure @tokemak/config is properly installed and built.`
|
|
3079
|
+
);
|
|
3080
|
+
}
|
|
3081
|
+
if (!config.subgraphEndpoint) {
|
|
3082
|
+
throw new Error(
|
|
3083
|
+
`subgraphEndpoint is undefined for chainId ${chainId}. Make sure @tokemak/config is properly configured.`
|
|
3084
|
+
);
|
|
3085
|
+
}
|
|
3086
|
+
return config.subgraphEndpoint;
|
|
3059
3087
|
};
|
|
3060
3088
|
var getSdkByChainId = (chainId) => {
|
|
3061
|
-
const url =
|
|
3062
|
-
if (!url) throw new Error(`Unsupported chainId: ${chainId}`);
|
|
3089
|
+
const url = getEndpoint(chainId);
|
|
3063
3090
|
const client = new GraphQLClient(url);
|
|
3064
3091
|
if (chainId === base.id) return getSdk2(client);
|
|
3065
3092
|
if (chainId === sonic.id) return getSdk3(client);
|