Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orca-so/token-sdk

Package Overview
Dependencies
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orca-so/token-sdk - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

5

dist/fetcher.js

@@ -11,3 +11,3 @@ "use strict";

const p_timeout_1 = __importDefault(require("p-timeout"));
const TIMEOUT_MS = 2 * 60 * 1000; // 2 minutes
const TIMEOUT_MS = 3 * 60 * 1000; // 3 minutes
class TokenFetcher {

@@ -91,2 +91,5 @@ constructor(connection, timeoutMs = TIMEOUT_MS) {

}
else {
console.warn(`Missed ${next.length} tokens from ${provider.constructor.name}. Trying next provider...`);
}
}

@@ -93,0 +96,0 @@ }

4

dist/metadata/client/coingecko-client.d.ts
export interface CoinGeckoClient {
getContract(assetPlatform: string, contract: string): Promise<ContractResponse | null>;
getContract(assetPlatform: string, contract: string, timeoutMs: number | undefined): Promise<ContractResponse | null>;
}

@@ -8,3 +8,3 @@ export declare class CoinGeckoHttpClient implements CoinGeckoClient {

private buildUrl;
getContract(assetPlatform: string, contract: string): Promise<ContractResponse | null>;
getContract(assetPlatform: string, contract: string, timeoutMs?: number): Promise<ContractResponse | null>;
}

@@ -11,0 +11,0 @@ export interface ContractResponse {

@@ -11,2 +11,3 @@ "use strict";

const CG_PRO_API_URL = "https://pro-api.coingecko.com/api/v3";
const DEFAULT_COINGECKO_TIMEOUT = 10000;
class CoinGeckoHttpClient {

@@ -21,7 +22,7 @@ constructor(apiKey) {

}
async getContract(assetPlatform, contract) {
async getContract(assetPlatform, contract, timeoutMs = DEFAULT_COINGECKO_TIMEOUT) {
const path = `/coins/${assetPlatform}/contract/${contract}`;
let response;
try {
response = await (0, isomorphic_unfetch_1.default)(this.buildUrl(path));
response = await (0, isomorphic_unfetch_1.default)(this.buildUrl(path), { signal: AbortSignal.timeout(timeoutMs) });
}

@@ -28,0 +29,0 @@ catch (e) {

@@ -7,2 +7,3 @@ import { Address } from "@orca-so/common-sdk";

intervalMs?: number;
timeoutMs?: number;
}

@@ -12,2 +13,3 @@ export declare class CoinGeckoProvider implements MetadataProvider {

private readonly queue;
private readonly timeoutMs;
constructor(opts?: Opts);

@@ -14,0 +16,0 @@ find(address: Address): Promise<Readonly<Metadata> | null>;

@@ -18,2 +18,3 @@ "use strict";

this.queue = new p_queue_1.default({ concurrency, interval: intervalMs });
this.timeoutMs = opts.timeoutMs;
}

@@ -23,3 +24,3 @@ async find(address) {

try {
const contract = await this.client.getContract(SOLANA_ASSET_PLATFORM, mintPubKey.toBase58());
const contract = await this.client.getContract(SOLANA_ASSET_PLATFORM, mintPubKey.toBase58(), this.timeoutMs);
return convertToTokenMetadata(contract);

@@ -26,0 +27,0 @@ }

@@ -7,2 +7,4 @@ import { Connection } from "@solana/web3.js";

intervalMs?: number;
httpConcurrency?: number;
httpIntervalMs?: number;
/**

@@ -20,2 +22,3 @@ * Flag that indicates whether to load offchain JSON data used to populate image.

private readonly queue;
private readonly http_queue;
private readonly opts;

@@ -22,0 +25,0 @@ constructor(connection: Connection, opts?: Opts);

@@ -13,8 +13,11 @@ "use strict";

const DEFAULT_INTERVAL_MS = 1000;
const DEFAULT_HTTP_CONCURRENCY = 30;
const DEFAULT_HTTP_INTERVAL_MS = 10;
class MetaplexProvider {
constructor(connection, opts = {}) {
const { concurrency = DEFAULT_CONCURRENCY, intervalMs = DEFAULT_INTERVAL_MS } = opts;
const { concurrency = DEFAULT_CONCURRENCY, intervalMs = DEFAULT_INTERVAL_MS, httpConcurrency = DEFAULT_HTTP_CONCURRENCY, httpIntervalMs = DEFAULT_HTTP_INTERVAL_MS, } = opts;
this.connection = connection;
this.client = new client_1.MetaplexHttpClient();
this.queue = new p_queue_1.default({ concurrency, interval: intervalMs });
this.http_queue = new p_queue_1.default({ concurrency: httpConcurrency, interval: httpIntervalMs });
this.opts = opts;

@@ -74,3 +77,3 @@ }

}
await this.queue.addAll(jsonHandlers);
await this.http_queue.addAll(jsonHandlers);
const map = new Map();

@@ -77,0 +80,0 @@ for (let i = 0; i < pdas.length; i += 1) {

{
"name": "@orca-so/token-sdk",
"version": "0.3.2",
"version": "0.3.3",
"description": "SPL Token Utilities",

@@ -5,0 +5,0 @@ "repository": "https://github.com/orca-so/orca-sdks",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc