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.14 to 0.0.15

9

dist/blockchain.d.ts

@@ -72,2 +72,6 @@ import "reflect-metadata";

export { NET, Token, NetworkName, Symbol, TX, NetParser, ethers, TronWeb, crypto, valid, net, lib };
export interface Descriped {
response: TransactionResponse;
description: TransactionDescription;
}
export interface SendTokenDto {

@@ -137,6 +141,3 @@ netId: number;

sendAllBalance(netId: number, privateKey: string, to: string): Promise<TransactionResponse>;
descript(net: NET, responses: ethers.providers.TransactionResponse[]): {
response: TransactionResponse;
description: TransactionDescription;
}[];
descript(net: NET, responses: ethers.providers.TransactionResponse[]): Descriped[];
formatTX(net: NET, transaction: BlockTransaction | TransactionResponse | Log): TX;

@@ -143,0 +144,0 @@ getTronMethods(net: NET | number): TronMethods;

@@ -331,13 +331,36 @@ "use strict";

try {
const face = response.data === "0x"
? undefined :
router
? new ethers_1.ethers.Contract(response.to, router.abi).interface
: new ethers_1.ethers.Contract(response.to, erc20_1.default).interface;
const face = response.data === "0x" ? undefined : router ? new ethers_1.ethers.Contract(response.to, router.abi).interface : new ethers_1.ethers.Contract(response.to, erc20_1.default).interface;
function parse(response) {
const description = response?.data === "0x"
? { args: [], functionFragment: "0x", name: "sendETH", signature: "send(address, uint256)", sighash: "0x", value: response.value }
: face?.parseTransaction(response);
let description = response?.data === "0x"
? { args: [], functionFragment: undefined, name: "sendETH", signature: "send(address, uint256)", sighash: "0x", value: response.value }
: { ...face?.parseTransaction(response), functionFragment: undefined };
if (description && router?.version === net_i_1.SwapRouterVersion.UNISWAP_V3 && description.name === "multicall") {
return description.args['data'].map((data) => parse({ ...response, data })).reduce((a, b) => [...a, ...b], []);
const [sub0] = parse({ ...response, data: description.args['data'][0] });
const [sub1] = parse({ ...response, data: description.args['data'][description.args['data'].length - 1] });
const args = [];
if (Number(sub0.description.args.amountIn))
args.amountIn = sub0.description.args.amountIn;
else if (Number(sub0.description.args.amountInMax))
args.amountInMax = sub0.description.args.amountInMax;
else if (Number(sub0.description.args.params?.amountIn))
args.amountIn = sub0.description.args.params.amountIn;
else if (Number(sub0.description.args.params?.amountInMax))
args.amountInMax = sub0.description.args.params.amountInMax;
if (Number(sub1.description.args.amountOut))
args.amountOut = sub1.description.args.amountOut;
else if (Number(sub1.description.args.amountOutMin))
args.amountOutMin = sub1.description.args.amountOutMin;
else if (Number(sub1.description.args.params.amountOut))
args.amountOut = sub1.description.args.params.amountOut;
else if (Number(sub1.description.args.params.amountOutMin))
args.amountOutMin = sub1.description.args.params.amountOutMin;
const path0 = sub0.description.args.path || sub0.description.args.params?.path;
const path1 = sub1.description.args.path || sub1.description.args.params?.path;
args.path = [path0.length > 10 ? path0.substr(0, 42) : path0[0], path1.length > 10 ? "0x" + path1.substring(path1.length - 40) : path1[path1.length - 1]];
if (!args.amountIn && !args.amountInMax)
args.amountIn = description.value;
args[0] = (args.amountIn || args.amountInMax);
args[1] = (args.amountOut || args.amountOutMin);
args[2] = (args.path);
description = { ...sub1.description, args, value: description.value };
}

@@ -380,5 +403,4 @@ return [{ response, description }];

balance.token = new net_i_1.Token(net.id, ethers_1.ethers.constants.AddressZero, net.decimals, net.symbol, net.name);
if (balance.token.address === ethers_1.ethers.constants.AddressZero) {
if (balance.token.address === ethers_1.ethers.constants.AddressZero)
items.push({ target: net.multicall, method: "getEthBalance", arguments: [balance.user], face: faceMulticall, key: "i" + i });
}
else

@@ -389,5 +411,4 @@ items.push({ target: balance.token.address, method: "balanceOf", arguments: [balance.user], face: faceERC, key: "i" + i });

const result = [];
for (let i = 0; i < balances.length; i++) {
for (let i = 0; i < balances.length; i++)
result.push(Number(formatUnits(response["i" + i][0], balances[i].token.decimals)));
}
return result;

@@ -394,0 +415,0 @@ }

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

],
"version": "0.0.14",
"version": "0.0.15",
"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

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