@lunch-money/ethereum-to-lunch-money 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,18 @@
1
1
  import * as ethscan from '@mycrypto/eth-scan';
2
2
  import * as ethers from 'ethers';
3
3
  export interface EthereumWalletClient {
4
+ getChainId(): Promise<bigint>;
4
5
  getWeiBalance(walletAddress: string): Promise<bigint>;
5
6
  getTokensBalance(walletAddress: string, tokenContractAddresses: string[]): Promise<ethscan.BalanceMap<bigint>>;
6
7
  }
7
- export declare const createEthereumWalletClient: (provider: ethers.providers.BaseProvider) => EthereumWalletClient;
8
+ export declare const createEthereumWalletClient: (provider: ethers.AbstractProvider) => EthereumWalletClient;
8
9
  interface Token {
9
10
  address: string;
10
11
  chainId: number;
11
12
  name: string;
12
13
  symbol: string;
13
14
  decimals: number;
14
- logoURI: string;
15
+ logoURI: string | null;
15
16
  }
16
17
  export declare const loadTokenList: () => Promise<Token[]>;
17
18
  export {};
@@ -1,15 +1,28 @@
1
1
  import * as ethscan from '@mycrypto/eth-scan';
2
- import mem from 'mem';
3
2
  import tokenList1inch from '../fixtures/1inch.json';
4
- export const createEthereumWalletClient = (provider) => ({
5
- async getWeiBalance(walletAddress) {
6
- return (await provider.getBalance(walletAddress)).toBigInt();
7
- },
8
- async getTokensBalance(walletAddress, tokenContractAddresses) {
9
- return ethscan.getTokensBalance(provider, walletAddress, tokenContractAddresses);
10
- },
11
- });
12
- export const loadTokenList = mem(async () => {
3
+ export const createEthereumWalletClient = (provider) => {
4
+ // A custom ethscan provider implementation is needed to map `call` to `send` for ethscan to use the ethers client correctly.
5
+ // This is a temporary solution until the ethscan library is updated to support ethers v6.
6
+ const customProvider = {
7
+ send(method, params) {
8
+ // Type pulled from: https://github.com/MyCryptoHQ/eth-scan/blob/master/src/providers/provider.ts#L32
9
+ const typedParams = params;
10
+ return provider.call({ to: typedParams[0].to, data: typedParams[0].data });
11
+ },
12
+ };
13
+ return {
14
+ async getChainId() {
15
+ return (await provider.getNetwork()).chainId;
16
+ },
17
+ async getWeiBalance(walletAddress) {
18
+ return await provider.getBalance(walletAddress);
19
+ },
20
+ async getTokensBalance(walletAddress, tokenContractAddresses) {
21
+ return ethscan.getTokensBalance(customProvider, walletAddress, tokenContractAddresses);
22
+ },
23
+ };
24
+ };
25
+ export const loadTokenList = async () => {
13
26
  return tokenList1inch.tokens;
14
- });
27
+ };
15
28
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,cAAc,MAAM,wBAAwB,CAAC;AAOpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,QAAuC,EAAwB,EAAE,CAAC,CAAC;IAC5G,KAAK,CAAC,aAAa,CAAC,aAAa;QAC/B,OAAO,CAAC,MAAM,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC/D,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,sBAAsB;QAC1D,OAAO,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,sBAAsB,CAAC,CAAC;IACnF,CAAC;CACF,CAAC,CAAC;AAWH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,IAAsB,EAAE;IAC5D,OAAO,cAAc,CAAC,MAAM,CAAC;AAC/B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAG9C,OAAO,cAAc,MAAM,wBAAwB,CAAC;AASpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,QAAiC,EAAwB,EAAE;IACpG,6HAA6H;IAC7H,0FAA0F;IAC1F,MAAM,cAAc,GAAuB;QACzC,IAAI,CAAS,MAAc,EAAE,MAA2B;YACtD,qGAAqG;YACrG,MAAM,WAAW,GAAG,MAAgD,CAAC;YAErE,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAoB,CAAC;QAChG,CAAC;KACF,CAAC;IAEF,OAAO;QACL,KAAK,CAAC,UAAU;YACd,OAAO,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,aAAa,CAAC,aAAa;YAC/B,OAAO,MAAM,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,sBAAsB;YAC1D,OAAO,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,aAAa,EAAE,sBAAsB,CAAC,CAAC;QACzF,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAsB,EAAE;IACxD,OAAO,cAAc,CAAC,MAAM,CAAC;AAC/B,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
- import { LunchMoneyCryptoConnection, LunchMoneyCryptoConnectionContext, LunchMoneyCryptoConnectionConfig } from './types.js';
1
+ import type { LunchMoneyCryptoConnection, LunchMoneyCryptoConnectionContext, LunchMoneyCryptoConnectionConfig } from './types.js';
2
2
  import { EthereumWalletClient } from './client.js';
3
- export { LunchMoneyCryptoConnection } from './types.js';
4
- export { createEthereumWalletClient, EthereumWalletClient } from './client.js';
3
+ export { createEthereumWalletClient } from './client.js';
5
4
  interface LunchMoneyEthereumWalletConnectionConfig extends LunchMoneyCryptoConnectionConfig {
6
5
  /** The unique ID of the user's wallet address on the blockchain. */
7
6
  walletAddress: string;
@@ -4,23 +4,73 @@ export { createEthereumWalletClient } from './client.js';
4
4
  /** The minimum balance (in wei) that a token should have in order to be
5
5
  * considered for returning as a balance. */
6
6
  const NEGLIGIBLE_BALANCE_THRESHOLD = 1000;
7
+ /**
8
+ * Debug function that logs to console.log if DEBUG_ETHEREUM environment variable is set
9
+ */
10
+ const debug = (...args) => {
11
+ if (process.env.DEBUG_ETHEREUM) {
12
+ const timestamp = new Date().toISOString();
13
+ console.log(`[DEBUG_ETHEREUM] [${timestamp}]`, ...args);
14
+ }
15
+ };
7
16
  export const LunchMoneyEthereumWalletConnection = {
8
17
  async initiate(config, context) {
9
18
  return this.getBalances(config, context);
10
19
  },
11
20
  async getBalances({ walletAddress, negligibleBalanceThreshold = NEGLIGIBLE_BALANCE_THRESHOLD }, { client }) {
12
- const weiBalance = await client.getWeiBalance(walletAddress);
13
- const tokenList = await loadTokenList();
14
- const map = await client.getTokensBalance(walletAddress, tokenList.map((t) => t.address));
15
- const balances = tokenList
16
- .map((t) => ({
17
- asset: t.symbol,
18
- amount: map[t.address] ?? 0,
19
- }))
20
- .concat({ asset: 'ETH', amount: weiBalance })
21
- .filter((b) => b.amount > negligibleBalanceThreshold)
22
- .map(({ asset, amount }) => ({ asset, amount: ethers.utils.formatEther(amount) }))
21
+ const obscuredWalletAddress = `0x..${walletAddress.slice(-6)}`;
22
+ debug('getBalances called for wallet address:', obscuredWalletAddress);
23
+ // Create a timeout so we fail instead of generating a CORS errors
24
+ let timeoutId;
25
+ const timeoutDuration = process.env.ETHEREUM_BALANCE_TIMEOUT_MSECS
26
+ ? parseInt(process.env.ETHEREUM_BALANCE_TIMEOUT_MSECS)
27
+ : 60000;
28
+ const timeout = new Promise((_, reject) => {
29
+ timeoutId = setTimeout(() => {
30
+ reject(new Error(`Ethereum connector getBalances timed out after ${timeoutDuration} milliseconds.`));
31
+ }, timeoutDuration);
32
+ });
33
+ // Wrap all ethers calls in a single timeout
34
+ const result = await Promise.race([
35
+ (async () => {
36
+ try {
37
+ const weiBalance = await client.getWeiBalance(walletAddress);
38
+ // Filter out tokens that are not on mainnet
39
+ const chainId = await client.getChainId();
40
+ const chainFilteredTokensList = (await loadTokenList()).filter((t) => BigInt(t.chainId) === BigInt(chainId));
41
+ const map = await client.getTokensBalance(walletAddress, chainFilteredTokensList.map((t) => t.address));
42
+ return { weiBalance, chainId, map, chainFilteredTokensList };
43
+ }
44
+ finally {
45
+ // Clear the timeout when the operation completes (success or failure)
46
+ if (timeoutId) {
47
+ clearTimeout(timeoutId);
48
+ }
49
+ }
50
+ })(),
51
+ timeout,
52
+ ]);
53
+ const { weiBalance, chainId, map, chainFilteredTokensList } = result;
54
+ debug('ethers.getTokensBalance returned for wallet address:', obscuredWalletAddress);
55
+ const balances = Object.entries(map)
56
+ .map(([address, balance]) => {
57
+ const token = chainFilteredTokensList.find((t) => t.address === address);
58
+ if (!token) {
59
+ throw new Error(`Token ${address} not found in filtered token list for chainId ${chainId}`);
60
+ }
61
+ return {
62
+ asset: token.symbol,
63
+ undivisedAmount: balance,
64
+ decimals: token.decimals,
65
+ };
66
+ })
67
+ .concat({ asset: 'ETH', undivisedAmount: weiBalance, decimals: 18 })
68
+ .map(({ asset, undivisedAmount, decimals }) => ({ asset, amount: ethers.formatUnits(undivisedAmount, decimals) }))
69
+ // Normalize the amount to 18 decimal places (for the wei per eth standard) for filtering out negligible balances
70
+ .filter((b) => ethers.parseUnits(b.amount, 18) > negligibleBalanceThreshold)
71
+ .map((b) => ({ asset: b.asset, amount: String(b.amount) }))
23
72
  .sort((a, b) => a.asset.localeCompare(b.asset));
73
+ debug(`Returning from getBalances for ${obscuredWalletAddress}:`, balances);
24
74
  return {
25
75
  providerName: 'wallet_ethereum',
26
76
  balances,
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAwB,MAAM,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AE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;aAC1D,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAElD,KAAK,CAAC,kCAAkC,qBAAqB,GAAG,EAAE,QAAQ,CAAC,CAAC;QAE5E,OAAO;YACL,YAAY,EAAE,iBAAiB;YAC/B,QAAQ;SACT,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,22 +1,22 @@
1
1
  /**
2
2
  * Serializable configuration for the connection
3
3
  */
4
- export declare type LunchMoneyCryptoConnectionConfig = {};
4
+ export type LunchMoneyCryptoConnectionConfig = Record<string, unknown>;
5
5
  /**
6
6
  * Non-serializable injected dependencies for the connection
7
7
  */
8
- export declare type LunchMoneyCryptoConnectionContext = {};
8
+ export type LunchMoneyCryptoConnectionContext = Record<string, unknown>;
9
9
  export interface CryptoBalance {
10
10
  asset: string;
11
11
  amount: string;
12
12
  }
13
13
  export declare const providerNames: readonly ["coinbase", "coinbase_pro", "kraken", "binance", "wallet_ethereum"];
14
- export declare type ProviderName = typeof providerNames[number];
14
+ export type ProviderName = (typeof providerNames)[number];
15
15
  export interface LunchMoneyCryptoConnectionBalances {
16
16
  providerName: ProviderName;
17
17
  balances: CryptoBalance[];
18
18
  }
19
- export declare type LunchMoneyCryptoConnectionInitialization = LunchMoneyCryptoConnectionBalances;
19
+ export type LunchMoneyCryptoConnectionInitialization = LunchMoneyCryptoConnectionBalances;
20
20
  export interface LunchMoneyCryptoConnection<TConfig extends LunchMoneyCryptoConnectionConfig, TContext extends LunchMoneyCryptoConnectionContext> {
21
21
  initiate(config: TConfig, context: TContext): Promise<LunchMoneyCryptoConnectionInitialization>;
22
22
  getBalances(config: TConfig, context: TContext): Promise<LunchMoneyCryptoConnectionBalances>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,CAAU,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,CAAU,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@lunch-money/ethereum-to-lunch-money",
3
- "packageManager": "yarn@3.0.1",
4
- "author": {
5
- "name": "Max Dumas",
6
- "email": "maltor124@gmail.com"
3
+ "packageManager": "yarn@4.6.0",
4
+ "author": "Max Dumas <maltor124@gmail.com>",
5
+ "bugs": {
6
+ "url": "https://github.com/lunch-money/ethereum-to-lunch-money/issues"
7
7
  },
8
- "bugs": "https://github.com/lunch-money/ethereum-to-lunch-money/issues",
9
8
  "homepage": "https://github.com/lunch-money/ethereum-to-lunch-money#README",
10
- "version": "1.2.0",
9
+ "version": "1.4.0",
11
10
  "license": "MIT",
12
11
  "keywords": [
13
12
  "lunch money",
@@ -15,7 +14,10 @@
15
14
  "budgeting"
16
15
  ],
17
16
  "description": "A wrapper around Ethereum APIs for enabling Lunch Money to gather information about a user's wallet.",
18
- "repository": "github:lunch-money/ethereum-to-lunch-money",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/lunch-money/ethereum-to-lunch-money.git"
20
+ },
19
21
  "main": "dist/cjs/src/main.js",
20
22
  "module": "dist/mjs/src/main.js",
21
23
  "exports": {
@@ -34,32 +36,35 @@
34
36
  "files": [
35
37
  "dist/**/*"
36
38
  ],
37
- "type": "module",
39
+ "type": "commonjs",
38
40
  "scripts": {
39
41
  "clean": "rm -rf dist",
40
- "build": "yarn clean && tsc -p tsconfig.build-mjs.json && tsc -p tsconfig.build-cjs.json && ./postbuild",
42
+ "build": "yarn clean && npx tsc -p tsconfig.build-mjs.json && npx tsc -p tsconfig.build-cjs.json && ./postbuild",
41
43
  "lint": "eslint '{src,test}/**/*.{js,ts,tsx}' --fix",
42
- "test": "node --experimental-json-modules --loader ts-node/esm node_modules/mocha/lib/cli/cli --recursive --extension ts",
44
+ "test": "tsx node_modules/mocha/lib/cli/cli --recursive --extension ts",
45
+ "test-live": "npx ts-node --project tsconfig.build-cjs.json bin/get-balances.ts",
43
46
  "prepare": "husky install"
44
47
  },
45
48
  "devDependencies": {
46
- "@types/chai": "^4",
47
- "@types/mocha": "^9.0.0",
48
- "@types/node": "^16.6.1",
49
- "@types/sinon": "^10.0.2",
50
- "@typescript-eslint/eslint-plugin": "^4.29.2",
51
- "@typescript-eslint/parser": "^4.29.2",
52
- "chai": "^4.3.4",
53
- "eslint": "^7.32.0",
54
- "eslint-config-prettier": "^8.3.0",
55
- "eslint-plugin-prettier": "^3.4.0",
56
- "husky": "^7.0.0",
57
- "lint-staged": "^11.1.2",
58
- "mocha": "^9.0.3",
59
- "prettier": "^2.3.2",
60
- "sinon": "^11.1.2",
61
- "ts-node": "^10.2.0",
62
- "typescript": "^4.3.5"
49
+ "@types/chai": "^5.0.1",
50
+ "@types/mocha": "^10.0.10",
51
+ "@types/node": "^16.18.125",
52
+ "@types/sinon": "^17.0.3",
53
+ "@typescript-eslint/eslint-plugin": "^8.22.0",
54
+ "@typescript-eslint/parser": "^8.22.0",
55
+ "chai": "^5.1.2",
56
+ "dotenv": "^16.5.0",
57
+ "eslint": "^8.57.0",
58
+ "eslint-config-prettier": "^10.0.1",
59
+ "eslint-plugin-prettier": "^5.2.3",
60
+ "husky": "^9.1.7",
61
+ "lint-staged": "^15.4.3",
62
+ "mocha": "^11.1.0",
63
+ "prettier": "^3.4.2",
64
+ "sinon": "^19.0.2",
65
+ "tsc": "^2.0.4",
66
+ "tsx": "^4.19.2",
67
+ "typescript": "^4.9.5"
63
68
  },
64
69
  "engines": {
65
70
  "node": "^12.20.0 || ^14.17.1 || >=16.0.0"
@@ -70,8 +75,11 @@
70
75
  ]
71
76
  },
72
77
  "dependencies": {
73
- "@mycrypto/eth-scan": "^3.4.4",
74
- "ethers": "^5.4.6",
75
- "mem": "^8.1.1"
78
+ "@mycrypto/eth-scan": "^3.5.3",
79
+ "ethers": "^6.13.5"
80
+ },
81
+ "types": "./dist/cjs/src/main.d.ts",
82
+ "directories": {
83
+ "test": "test"
76
84
  }
77
- }
85
+ }