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

blockchain33

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockchain33 - npm Package Compare versions

Comparing version 0.0.41 to 0.0.42

64

dist/blockchain.js

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

if (net.symbol === net_i_1.Symbol.TRX) {
const results = await this.getLimitter(net.id).schedule(() => this.getTronMethods(net).getTokensInfo(tokens));
const results = await this.getLimitter(net.id).schedule({ id: 'getTokensInfo' }, () => this.getTronMethods(net).getTokensInfo(tokens));
if (caching)

@@ -168,3 +168,3 @@ for (let token of results)

const name = tokens.map(target => ({ target, method: "name", arguments: [], face }));
const result = await this.getLimitter(net.id).schedule(() => (0, multicall_1.multiCall)(net, [...decimals, ...symbol, ...name]));
const result = await this.getLimitter(net.id).schedule({ id: 'getTokensInfo' }, () => (0, multicall_1.multiCall)(net, [...decimals, ...symbol, ...name]));
const tkns = [];

@@ -208,3 +208,3 @@ for (let t = 0; t < tokens.length; t++) {

const items = tokens.map((address, i) => ({ target, method: "getAmountsOut", arguments: [parseUnits("1", tkns[i].decimals), [address, net.tokens.USDT.address]], face }));
const result = await this.getLimitter(netId).schedule(() => (0, multicall_1.multiCall)(net, items));
const result = await this.getLimitter(netId).schedule({ id: 'getTokensPriceUSD' }, () => (0, multicall_1.multiCall)(net, items));
return result;

@@ -241,7 +241,7 @@ }

if (net.symbol === net_i_1.Symbol.TRX) {
return await limitter.schedule(() => this.getTronMethods(net).getTransactionById(hash));
return await limitter.schedule({ id: 'getTransaction' }, () => this.getTronMethods(net).getTransactionById(hash));
}
else {
const provider = this.getProvider(net.id);
return await limitter.schedule(() => provider.getTransaction(hash));
return await limitter.schedule({ id: 'getTransaction' }, () => provider.getTransaction(hash));
}

@@ -256,7 +256,7 @@ }

if (net.symbol === net_i_1.Symbol.TRX) {
return await limitter.schedule(() => this.getTronMethods(net).getTransactionInfoById(hash));
return await limitter.schedule({ id: 'getTxReceipt' }, () => this.getTronMethods(net).getTransactionInfoById(hash));
}
else {
const provider = this.getProvider(net.id);
return await limitter.schedule(() => provider.getTransactionReceipt(hash));
return await limitter.schedule({ id: 'getTxReceipt' }, () => provider.getTransactionReceipt(hash));
}

@@ -271,3 +271,3 @@ }

const limitter = this.getLimitter(net.id);
return await limitter.schedule(() => this.getTronMethods(net).getContractAbi(contractAddress));
return await limitter.schedule({ id: 'getContractAbi' }, () => this.getTronMethods(net).getContractAbi(contractAddress));
}

@@ -297,7 +297,7 @@ else {

const tronMethods = this.getTronMethods(net);
return limitter.schedule(() => tronMethods.getBalance(address));
return limitter.schedule({ id: 'getBalanceEth' }, () => tronMethods.getBalance(address));
}
else {
const provider = new JsonRpcProvider(net.rpc.url);
const balance = await limitter.schedule(() => provider.getBalance(address));
const balance = await limitter.schedule({ id: 'getBalanceEth' }, () => provider.getBalance(address));
return Number(formatEther(balance));

@@ -341,3 +341,3 @@ }

const value = balance.sub(estimatedTxFee);
const tx = await this.getLimitter(netId).schedule({ priority: 4 }, () => wallet.sendTransaction({ value, to }));
const tx = await this.getLimitter(netId).schedule({ id: "getAllBalance" }, () => wallet.sendTransaction({ value, to }));
return tx;

@@ -383,3 +383,3 @@ }

}
const response = await this.getLimitter(net.id).schedule(() => (0, multicall_1.multiCall)(net, items));
const response = await this.getLimitter(net.id).schedule({ id: 'getBalances' }, () => (0, multicall_1.multiCall)(net, items));
const result = [];

@@ -406,3 +406,3 @@ for (let i = 0; i < balances.length; i++)

const value = ethers_1.ethers.BigNumber.from(ethers_1.ethers.utils.parseUnits(amount.toFixed(18), token.decimals));
const gasLimit = await this.getLimitter(net).schedule(() => this.getERC20Contract(token).connect(wallet).estimateGas.transfer(to, value));
const gasLimit = await this.getLimitter(net).schedule({ id: 'calcFee' }, () => this.getERC20Contract(token).connect(wallet).estimateGas.transfer(to, value));
return gasLimit.mul(gasPrice);

@@ -424,3 +424,3 @@ }

const provider = this.getProvider(net);
const gasPrice = await this.getLimitter(net).schedule(() => provider.getGasPrice());
const gasPrice = await this.getLimitter(net).schedule({ id: 'getGasPrice' }, () => provider.getGasPrice());
if (cache) {

@@ -451,3 +451,3 @@ cache.gasPrice = gasPrice;

try {
return await this.getLimitter(net).schedule(() => wallet.sendTransaction({ to, value, gasPrice }));
return await this.getLimitter(net).schedule({ id: 'send' }, () => wallet.sendTransaction({ to, value, gasPrice }));
}

@@ -461,3 +461,3 @@ catch (err) {

try {
return await this.getLimitter(net).schedule(() => this.getERC20Contract(token).connect(wallet).transfer(to, value, { gasPrice }));
return await this.getLimitter(net).schedule({ id: 'send' }, () => this.getERC20Contract(token).connect(wallet).transfer(to, value, { gasPrice }));
}

@@ -472,5 +472,5 @@ catch (err) {

if (net.symbol === net_i_1.Symbol.TRX)
return await this.getLimitter(net.id).schedule(() => this.tronMethodos[net.id].getBlockRange(blockNumber, toBlockNumber));
return await this.getLimitter(net.id).schedule({ id: 'getBlock' }, () => this.tronMethodos[net.id].getBlockRange(blockNumber, toBlockNumber));
else
return await this.getLimitter(net.id).schedule(() => this.getProvider(net).getBlockWithTransactions(blockNumber));
return await this.getLimitter(net.id).schedule({ id: 'getBlock' }, () => this.getProvider(net).getBlockWithTransactions(blockNumber));
}

@@ -481,6 +481,6 @@ async getBlockNumber(net) {

else
return await this.getLimitter(net.id).schedule(() => this.getProvider(net).getBlockNumber());
return await this.getLimitter(net.id).schedule({ id: 'getBlockNumber' }, () => this.getProvider(net).getBlockNumber());
}
async getLogs(net, fromBlock, toBlock, address, topics) {
return await this.getLimitter(net.id).schedule(() => this.getProvider(net).getLogs({
return await this.getLimitter(net.id).schedule({ id: 'getLogs' }, () => this.getProvider(net).getLogs({
fromBlock, toBlock, address, topics

@@ -512,3 +512,3 @@ }));

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapETHForExactTokens(amountOut, path, to, deadline, { value, gasPrice }));
return this.getLimitter(net).schedule({ id: 'swapETHForExactTokens' }, () => contract.swapETHForExactTokens(amountOut, path, to, deadline, { value, gasPrice }));
}

@@ -520,3 +520,3 @@ async swapExactETHForTokens(net, privateKey, value, amountOutMin, path, to, deadline, router = net_i_1.SwapRouterVersion.UNISWAP_V2) {

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapExactETHForTokens(amountOutMin, path, to, deadline, { value, gasPrice }));
return this.getLimitter(net).schedule({ id: 'swapExactETHForTokens' }, () => contract.swapExactETHForTokens(amountOutMin, path, to, deadline, { value, gasPrice }));
}

@@ -528,3 +528,3 @@ async swapExactTokensForTokens(net, privateKey, amountIn, amountOutMin, path, to, deadline, router = net_i_1.SwapRouterVersion.UNISWAP_V2) {

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapExactTokensForTokens(amountIn, amountOutMin, path, to, deadline, { gasPrice }));
return this.getLimitter(net).schedule({ id: 'swapExactTokensForTokens' }, () => contract.swapExactTokensForTokens(amountIn, amountOutMin, path, to, deadline, { gasPrice }));
}

@@ -536,3 +536,3 @@ async swapExactTokensForTokensSupportingFeeOnTransferTokens(net, privateKey, amountIn, amountOutMin, path, to, deadline, router = net_i_1.SwapRouterVersion.UNISWAP_V2) {

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, amountOutMin, path, to, deadline, { gasPrice }));
return this.getLimitter(net).schedule({ id: 'swapExactTokensForTokensSF' }, () => contract.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, amountOutMin, path, to, deadline, { gasPrice }));
}

@@ -544,3 +544,3 @@ async swapTokensForExactTokens(net, privateKey, amountOut, amountInMax, path, to, deadline, router = net_i_1.SwapRouterVersion.UNISWAP_V2) {

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapTokensForExactTokens(amountOut, amountInMax, path, to, deadline, { gasPrice }));
return this.getLimitter(net).schedule({ id: "swapTokensForExactTokens" }, () => contract.swapTokensForExactTokens(amountOut, amountInMax, path, to, deadline, { gasPrice }));
}

@@ -552,3 +552,3 @@ async swapTokensForExactETH(net, privateKey, amountOut, amountInMax, path, to, deadline, router = net_i_1.SwapRouterVersion.UNISWAP_V2) {

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapTokensForExactETH(amountOut, amountInMax, path, to, deadline, { gasPrice }));
return this.getLimitter(net).schedule({ id: "swapTokensForExactETH" }, () => contract.swapTokensForExactETH(amountOut, amountInMax, path, to, deadline, { gasPrice }));
}

@@ -560,3 +560,3 @@ async swapExactTokensForETH(net, privateKey, amountIn, amountOutMin, path, to, deadline, router = net_i_1.SwapRouterVersion.UNISWAP_V2) {

deadline = new Date().getTime();
return this.getLimitter(net).schedule(() => contract.swapExactTokensForETH(amountIn, amountOutMin, path, to, deadline, { gasPrice }));
return this.getLimitter(net).schedule({ id: "swapExactTokensForETH" }, () => contract.swapExactTokensForETH(amountIn, amountOutMin, path, to, deadline, { gasPrice }));
}

@@ -571,3 +571,3 @@ async getAllowance(net, tokenAddress, ownerAddress, spenderAddress) {

const tronMethods = this.getTronMethods(net);
return limitter.schedule(() => tronMethods.allowance(tokenAddress, ownerAddress, spenderAddress));
return limitter.schedule({ id: "getAllowance" }, () => tronMethods.allowance(tokenAddress, ownerAddress, spenderAddress));
}

@@ -577,3 +577,3 @@ else {

const contract = new ethers_1.Contract(tokenAddress, erc20_1.default, provider);
return await limitter.schedule(() => contract.allowance(ownerAddress, spenderAddress));
return await limitter.schedule({ id: "getAllowance" }, () => contract.allowance(ownerAddress, spenderAddress));
}

@@ -590,3 +590,3 @@ }

const tronMethods = this.getTronMethods(net);
return limitter.schedule(() => tronMethods.approve(privateKey, tokenAddress, spender, amount));
return limitter.schedule({ id: 'approveToken' }, () => tronMethods.approve(privateKey, tokenAddress, spender, amount));
}

@@ -597,3 +597,3 @@ else {

const contract = new ethers_1.Contract(tokenAddress, erc20_1.default, wallet);
return await limitter.schedule(() => contract.approve(spender, amount, { gasPrice }));
return await limitter.schedule({ id: 'approveToken' }, () => contract.approve(spender, amount, { gasPrice }));
}

@@ -632,3 +632,3 @@ }

const items = pathVariants.map((path, i) => ({ target, method, arguments: [amount, path], face }));
const result = await this.getLimitter(net.id).schedule(() => (0, multicall_1.multiCall)(net, items));
const result = await this.getLimitter(net.id).schedule({ id: 'getAmountsAndPath' }, () => (0, multicall_1.multiCall)(net, items));
const _data = result[method][target];

@@ -635,0 +635,0 @@ const data = !_data ? [] : _data.map((x, i) => (!x ? null : { x: x.map(y => ethers_1.BigNumber.from(y)), i }));

@@ -11,3 +11,3 @@ {

],
"version": "0.0.41",
"version": "0.0.42",
"description": "utilities for All blockchain like EVM (ETH)",

@@ -14,0 +14,0 @@ "main": "dist/blockchain.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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