pavelksg
pavelksg
WWasp-lang
Created by pavelksg on 9/27/2024 in #đŸ™‹questions
Cannot import external module @covalenthq/client-sdk
here is an example repository that seem to be including this modules and should be working fine: https://github.com/covalenthq/goldrush-kit/blob/main/package.json
19 replies
WWasp-lang
Created by pavelksg on 9/27/2024 in #đŸ™‹questions
Cannot import external module @covalenthq/client-sdk
However I am able to break it by changing to "module": "esnext", in tsconfig.json
19 replies
WWasp-lang
Created by pavelksg on 9/27/2024 in #đŸ™‹questions
Cannot import external module @covalenthq/client-sdk
I just confirmed it works in a clean, pure TypeScript with target: "esnext" in tsconfig.json. index.ts:
import { GoldRushClient } from "@covalenthq/client-sdk";

const ApiServices = async () => {
const client = new GoldRushClient("some api key");
try {
const resp = await client.BaseService.getAddressActivity("some address");
console.log(resp.data);
} catch (error) {
console.error(error);
}
}

(async () => {
await ApiServices();
})();
import { GoldRushClient } from "@covalenthq/client-sdk";

const ApiServices = async () => {
const client = new GoldRushClient("some api key");
try {
const resp = await client.BaseService.getAddressActivity("some address");
console.log(resp.data);
} catch (error) {
console.error(error);
}
}

(async () => {
await ApiServices();
})();
package.json:
{
"name": "goldrush-tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^22.7.4",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"dependencies": {
"@covalenthq/client-sdk": "^2.1.1"
}
}
{
"name": "goldrush-tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^22.7.4",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"dependencies": {
"@covalenthq/client-sdk": "^2.1.1"
}
}
19 replies
WWasp-lang
Created by pavelksg on 9/27/2024 in #đŸ™‹questions
Cannot import external module @covalenthq/client-sdk
Thanks for looking into it! I’m using 18.18. Also tried the weirdest suggestions from GPT-4o on what I can change in all configs including Vite, but nothing helped
19 replies
WWasp-lang
Created by pavelksg on 9/27/2024 in #đŸ™‹questions
Cannot import external module @covalenthq/client-sdk
Here is what I see in node_modules/@covalenthq/client-sdk/dist/esm/index.js
class GoldRushClient { constructor(apiKey, settings = {}) { this.userAgent = com.covalenthq.sdk.typescript/${version}; const validKey = isValidApiKey(apiKey); if (!validKey) { throw { data: null, error: true, error_code: 401, error_message: "Invalid or missing API key (sign up at https://goldrush.dev/platform/apikey)", }; } const execution = new Execution(settings, { Authorization: Bearer ${apiKey}, "X-Requested-With": settings.source ? ${settings.source} (${this.userAgent}) : this.userAgent, }); this.BalanceService = new BalanceService(execution); this.BaseService = new BaseService(execution); this.NftService = new NftService(execution); this.PricingService = new PricingService(execution); this.SecurityService = new SecurityService(execution); this.TransactionService = new TransactionService(execution); } }
class GoldRushClient { constructor(apiKey, settings = {}) { this.userAgent = com.covalenthq.sdk.typescript/${version}; const validKey = isValidApiKey(apiKey); if (!validKey) { throw { data: null, error: true, error_code: 401, error_message: "Invalid or missing API key (sign up at https://goldrush.dev/platform/apikey)", }; } const execution = new Execution(settings, { Authorization: Bearer ${apiKey}, "X-Requested-With": settings.source ? ${settings.source} (${this.userAgent}) : this.userAgent, }); this.BalanceService = new BalanceService(execution); this.BaseService = new BaseService(execution); this.NftService = new NftService(execution); this.PricingService = new PricingService(execution); this.SecurityService = new SecurityService(execution); this.TransactionService = new TransactionService(execution); } }
and then this at the bottom: export { ChainID, ChainName, GoldRushClient, bigIntParser, calculatePrettyBalance, isValidApiKey, prettifyCurrency };
19 replies