Socket
Socket
Sign inDemoInstall

@stardust-collective/dag4-xchain-ethereum

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stardust-collective/dag4-xchain-ethereum - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

cjs/abis/Meta.abi.json

14

cjs/client.js

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

const tokens_json_1 = __importDefault(require("./data/tokens.json"));
const token_balances_1 = require("./token-balances");
const token_contract_service_1 = require("./token-contract-service");
const utils = __importStar(require("@xchainjs/xchain-util"));

@@ -36,3 +36,5 @@ exports.utils = utils;

super({ network, explorerUrl, etherscanApiKey, infuraCreds });
this.infuraProjectId = infuraCreds && infuraCreds.projectId;
if (infuraCreds.projectId) {
this.infuraProvider = new ethers_1.ethers.providers.InfuraProvider(null, infuraCreds.projectId);
}
this['changeWallet'](new ethers_1.ethers.Wallet(privateKey, this.getProvider()));

@@ -43,2 +45,5 @@ }

}
getTokenInfo(address) {
return token_contract_service_1.tokenContractService.getTokenInfo(this.infuraProvider, address);
}
getKnownTokens(chainId) {

@@ -58,6 +63,5 @@ return tokens_json_1.default.filter(t => t.chainId === chainId);

//const provider = ethers.getDefaultProvider(null, { ethers: this.infuraProjectId, quorum: 1});
const provider = new ethers_1.ethers.providers.InfuraProvider(null, this.infuraProjectId);
const ethBalance = await provider.getBalance(address);
const ethBalance = await this.infuraProvider.getBalance(address);
const ethBalanceNum = ethers_1.FixedNumber.fromValue(ethers_1.BigNumber.from(ethBalance), 18).toUnsafeFloat();
const tokenBalances = await token_balances_1.getAddressBalances(provider, address, tokens);
const tokenBalances = await token_contract_service_1.tokenContractService.getAddressBalances(this.infuraProvider, address, tokens);
const assetBalances = Object.keys(tokenBalances).map(address => {

@@ -64,0 +68,0 @@ const assetInfo = map[address];

@@ -5,2 +5,10 @@ [

"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"name": "Lattice Token",
"symbol": "LTX",
"decimals": 8,
"logoURI": "https://assets.coingecko.com/coins/images/13050/thumb/Lattice.jpg?1613976295"
},
{
"chainId": 1,
"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"name": "Aave",

@@ -7,0 +15,0 @@ "symbol": "AAVE",

import { BigNumber, ethers, FixedNumber } from 'ethers';
import { Client } from '@xchainjs/xchain-ethereum';
import knownTokenList from './data/tokens.json';
import { getAddressBalances } from './token-balances';
import { tokenContractService } from './token-contract-service';
import * as utils from '@xchainjs/xchain-util';

@@ -10,3 +10,5 @@ export { utils };

super({ network, explorerUrl, etherscanApiKey, infuraCreds });
this.infuraProjectId = infuraCreds && infuraCreds.projectId;
if (infuraCreds.projectId) {
this.infuraProvider = new ethers.providers.InfuraProvider(null, infuraCreds.projectId);
}
this['changeWallet'](new ethers.Wallet(privateKey, this.getProvider()));

@@ -17,2 +19,5 @@ }

}
getTokenInfo(address) {
return tokenContractService.getTokenInfo(this.infuraProvider, address);
}
getKnownTokens(chainId) {

@@ -32,6 +37,5 @@ return knownTokenList.filter(t => t.chainId === chainId);

//const provider = ethers.getDefaultProvider(null, { ethers: this.infuraProjectId, quorum: 1});
const provider = new ethers.providers.InfuraProvider(null, this.infuraProjectId);
const ethBalance = await provider.getBalance(address);
const ethBalance = await this.infuraProvider.getBalance(address);
const ethBalanceNum = FixedNumber.fromValue(BigNumber.from(ethBalance), 18).toUnsafeFloat();
const tokenBalances = await getAddressBalances(provider, address, tokens);
const tokenBalances = await tokenContractService.getAddressBalances(this.infuraProvider, address, tokens);
const assetBalances = Object.keys(tokenBalances).map(address => {

@@ -38,0 +42,0 @@ const assetInfo = map[address];

@@ -5,2 +5,10 @@ [

"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"name": "Lattice Token",
"symbol": "LTX",
"decimals": 8,
"logoURI": "https://assets.coingecko.com/coins/images/13050/thumb/Lattice.jpg?1613976295"
},
{
"chainId": 1,
"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"name": "Aave",

@@ -7,0 +15,0 @@ "symbol": "AAVE",

{
"name": "@stardust-collective/dag4-xchain-ethereum",
"version": "0.1.3",
"version": "0.1.4",
"description": "Cross chain communication with Ethereum",

@@ -5,0 +5,0 @@ "author": "Frank Fox",

@@ -14,5 +14,11 @@ import { ExplorerUrl, InfuraCreds } from '@xchainjs/xchain-ethereum';

export declare class XChainEthClient extends Client {
private infuraProjectId;
private infuraProvider;
constructor({ network, explorerUrl, privateKey, etherscanApiKey, infuraCreds }: XClientEthParams);
isValidEthereumAddress(address: string): boolean;
getTokenInfo(address: string): Promise<{
address: string;
decimals: any;
symbol: any;
name: string;
}>;
getKnownTokens(chainId: number): {

@@ -19,0 +25,0 @@ chainId: number;

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