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

@coinmasters/toolbox-evm

Package Overview
Dependencies
Maintainers
2
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coinmasters/toolbox-evm - npm Package Compare versions

Comparing version 7.0.0 to 8.0.0

dist/index-226d6e15.js

11

dist/index.d.ts

@@ -250,10 +250,3 @@ import type { Asset } from '@coinmasters/types';

export declare const BASEToolbox: ({ api, provider, signer, covalentApiKey, }: {
api?: {
getBalance: (address: any) => Promise<{
value: string;
decimal: number;
chain: Chain;
symbol: string;
}[]>;
} | undefined;
api?: null | undefined;
covalentApiKey: string;

@@ -274,3 +267,3 @@ signer: Signer;

};
getBalance: (address: any, potentialScamFilter?: boolean) => Promise<AssetValue[]>;
getBalance(address: any): Promise<AssetValue[] | undefined>;
approve: (params: ApproveParams) => Promise<string>;

@@ -277,0 +270,0 @@ approvedAmount: (params: ApprovedParams) => Promise<bigint>;

@@ -1,2 +0,2 @@

import { aY as o, aZ as t, a_ as b, a$ as l, aS as r, aT as d, b0 as A, bj as i, b2 as T, aW as c, b3 as h, bc as n, b8 as x, b4 as g, bb as k, b5 as w, bh as p, aU as E, bd as M, bi as S, aV as W, b1 as m, ba as C, be as B, bf as V, b6 as u, b9 as N, aX as P, bg as f, b7 as D } from "./index-dba67d30.js";
import { aY as o, aZ as t, a_ as b, a$ as l, aS as r, aT as d, b0 as A, bj as i, b2 as T, aW as c, b3 as h, bc as n, b8 as x, b4 as g, bb as k, b5 as w, bh as p, aU as E, bd as M, bi as S, aV as W, b1 as m, ba as C, be as B, bf as V, b6 as u, b9 as N, aX as P, bg as f, b7 as D } from "./index-fc3f9f9d.js";
import "@coinmasters/helpers";

@@ -3,0 +3,0 @@ export {

@@ -5,3 +5,3 @@ {

"ethers": "6.9.0",
"@coinmasters/types": "4.3.0"
"@coinmasters/types": "4.4.0"
},

@@ -18,4 +18,4 @@ "description": "THORSwap evm",

"vitest": "0.34.6",
"@internal/config": "2.3.0",
"@coinmasters/helpers": "7.0.0"
"@internal/config": "2.4.0",
"@coinmasters/helpers": "8.0.0"
},

@@ -26,3 +26,3 @@ "eslintConfig": {

"peerDependencies": {
"@coinmasters/helpers": "7.0.0"
"@coinmasters/helpers": "8.0.0"
},

@@ -52,3 +52,3 @@ "exports": {

"types": "./dist/index.d.ts",
"version": "7.0.0",
"version": "8.0.0",
"scripts": {

@@ -55,0 +55,0 @@ "build": "vite build",

@@ -0,8 +1,8 @@

import { AssetValue, formatBigIntToSafeValue } from '@coinmasters/helpers';
import { BaseDecimal, Chain, ChainId, ChainToExplorerUrl } from '@coinmasters/types';
import type { BrowserProvider, JsonRpcProvider, Signer } from 'ethers';
import type { CovalentApiType } from '../api/covalentApi.ts';
import { covalentApi } from '../api/covalentApi.ts';
import { getBalance } from '../index.ts';
// import type { CovalentApiType } from '../api/covalentApi.ts';
// import { covalentApi } from '../api/covalentApi.ts';
// import { getBalance } from '../index.ts';
import { BaseEVMToolbox } from './BaseEVMToolbox.ts';

@@ -25,3 +25,3 @@

}: {
api?: CovalentApiType;
api?: null;
covalentApiKey: string;

@@ -31,3 +31,2 @@ signer: Signer;

}) => {
const avaxApi = api || covalentApi({ apiKey: covalentApiKey, chainId: ChainId.Avalanche });
const baseToolbox = BaseEVMToolbox({ provider, signer });

@@ -38,5 +37,24 @@

getNetworkParams,
getBalance: (address: any, potentialScamFilter?: boolean) =>
getBalance({ provider, api: avaxApi, address, chain: Chain.Avalanche, potentialScamFilter }),
async getBalance(address: any) {
try {
const evmGasTokenBalance = await provider.getBalance(address[0].address);
//console.log('tokenBalances: ', tokenBalances);
console.log('evmGasTokenBalance: ', evmGasTokenBalance);
let gasTokenBalance = AssetValue.fromChainOrSignature(
Chain.Base,
formatBigIntToSafeValue({
value: evmGasTokenBalance,
decimal: 18,
}),
);
gasTokenBalance.address = address[0].address;
let balances = [gasTokenBalance];
return balances;
} catch (e) {
console.log('getBalance error: ', e);
}
},
// getBalance: (address: any, potentialScamFilter?: boolean) =>
// getBalance({ provider, api: null, address, chain: Chain.Avalanche, potentialScamFilter }),
};
};

@@ -243,3 +243,3 @@ import type { AssetValue } from '@coinmasters/helpers';

const chain = assetValue.chain as EVMChain;
console.log('isGasAsset: ', isGasAsset(assetValue));
if (!isGasAsset(assetValue)) {

@@ -271,3 +271,3 @@ const contractAddress = getTokenAddress(assetValue, chain);

};
console.log('txObject: ', txObject);
return sendTransaction(provider, txObject, feeOptionKey, signer, isEIP1559Compatible);

@@ -395,6 +395,6 @@ };

) => {
//console.log("TOOLBOX: checkpoint: ")
console.log("TOOLBOX: checkpoint: ")
if (!signer) throw new Error('Signer is not defined');
const { from, to, data, value, ...transaction } = tx;
//console.log("TOOLBOX: tx: ",tx)
console.log("TOOLBOX: tx: ",tx)
if (!to) throw new Error('No to address provided');

@@ -452,9 +452,9 @@

gasLimit,
nonce,
nonce: nonce.toString(),
...feeData,
};
//console.log("TOOLBOX: txObject: ",txObject)
console.log("TOOLBOX: txObject: ",txObject)
try {
const response = await signer.sendTransaction(txObject);
//console.log("TOOLBOX: response: ",response)
console.log("TOOLBOX: response: ",response)
return typeof response?.hash === 'string' ? response.hash : response;

@@ -466,6 +466,9 @@ } catch (error) {

});
console.log("TOOLBOX: txHex: ",txHex)
const response = await provider.broadcastTransaction(txHex);
return typeof response?.hash === 'string' ? response.hash : response;
}
} catch (error) {
console.error("sendTransaction: BaseEVMToolbox: ",error)
throw new Error(`Error sending transaction: ${JSON.stringify(error)}`);

@@ -472,0 +475,0 @@ }

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