@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.
- package/README.md +36 -6
- package/dist/cjs/fixtures/1inch.json +1 -1
- package/dist/cjs/src/client.d.ts +3 -2
- package/dist/cjs/src/client.js +36 -16
- package/dist/cjs/src/client.js.map +1 -1
- package/dist/cjs/src/main.d.ts +2 -3
- package/dist/cjs/src/main.js +65 -14
- package/dist/cjs/src/main.js.map +1 -1
- package/dist/cjs/src/types.d.ts +4 -4
- package/dist/cjs/src/types.js.map +1 -1
- package/dist/mjs/fixtures/1inch.json +1 -1
- package/dist/mjs/src/client.d.ts +3 -2
- package/dist/mjs/src/client.js +24 -11
- package/dist/mjs/src/client.js.map +1 -1
- package/dist/mjs/src/main.d.ts +2 -3
- package/dist/mjs/src/main.js +61 -11
- package/dist/mjs/src/main.js.map +1 -1
- package/dist/mjs/src/types.d.ts +4 -4
- package/dist/mjs/src/types.js.map +1 -1
- package/package.json +39 -31
package/dist/cjs/src/client.d.ts
CHANGED
|
@@ -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.
|
|
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 {};
|
package/dist/cjs/src/client.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -33,22 +37,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
38
|
exports.loadTokenList = exports.createEthereumWalletClient = void 0;
|
|
35
39
|
const ethscan = __importStar(require("@mycrypto/eth-scan"));
|
|
36
|
-
const mem_1 = __importDefault(require("mem"));
|
|
37
40
|
const _1inch_json_1 = __importDefault(require("../fixtures/1inch.json"));
|
|
38
|
-
const createEthereumWalletClient = (provider) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
const createEthereumWalletClient = (provider) => {
|
|
42
|
+
// A custom ethscan provider implementation is needed to map `call` to `send` for ethscan to use the ethers client correctly.
|
|
43
|
+
// This is a temporary solution until the ethscan library is updated to support ethers v6.
|
|
44
|
+
const customProvider = {
|
|
45
|
+
send(method, params) {
|
|
46
|
+
// Type pulled from: https://github.com/MyCryptoHQ/eth-scan/blob/master/src/providers/provider.ts#L32
|
|
47
|
+
const typedParams = params;
|
|
48
|
+
return provider.call({ to: typedParams[0].to, data: typedParams[0].data });
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
getChainId() {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return (yield provider.getNetwork()).chainId;
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
getWeiBalance(walletAddress) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return yield provider.getBalance(walletAddress);
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
getTokensBalance(walletAddress, tokenContractAddresses) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return ethscan.getTokensBalance(customProvider, walletAddress, tokenContractAddresses);
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
};
|
|
50
69
|
exports.createEthereumWalletClient = createEthereumWalletClient;
|
|
51
|
-
|
|
70
|
+
const loadTokenList = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
71
|
return _1inch_json_1.default.tokens;
|
|
53
|
-
})
|
|
72
|
+
});
|
|
73
|
+
exports.loadTokenList = loadTokenList;
|
|
54
74
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8C;AAG9C,yEAAoD;AAS7C,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;QACC,UAAU;;gBACd,OAAO,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC;YAC/C,CAAC;SAAA;QACK,aAAa,CAAC,aAAa;;gBAC/B,OAAO,MAAM,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAClD,CAAC;SAAA;QACK,gBAAgB,CAAC,aAAa,EAAE,sBAAsB;;gBAC1D,OAAO,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,aAAa,EAAE,sBAAsB,CAAC,CAAC;YACzF,CAAC;SAAA;KACF,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,0BAA0B,8BAuBrC;AAWK,MAAM,aAAa,GAAG,GAA2B,EAAE;IACxD,OAAO,qBAAc,CAAC,MAAM,CAAC;AAC/B,CAAC,CAAA,CAAC;AAFW,QAAA,aAAa,iBAExB"}
|
package/dist/cjs/src/main.d.ts
CHANGED
|
@@ -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 {
|
|
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;
|
package/dist/cjs/src/main.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -36,6 +40,15 @@ Object.defineProperty(exports, "createEthereumWalletClient", { enumerable: true,
|
|
|
36
40
|
/** The minimum balance (in wei) that a token should have in order to be
|
|
37
41
|
* considered for returning as a balance. */
|
|
38
42
|
const NEGLIGIBLE_BALANCE_THRESHOLD = 1000;
|
|
43
|
+
/**
|
|
44
|
+
* Debug function that logs to console.log if DEBUG_ETHEREUM environment variable is set
|
|
45
|
+
*/
|
|
46
|
+
const debug = (...args) => {
|
|
47
|
+
if (process.env.DEBUG_ETHEREUM) {
|
|
48
|
+
const timestamp = new Date().toISOString();
|
|
49
|
+
console.log(`[DEBUG_ETHEREUM] [${timestamp}]`, ...args);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
39
52
|
exports.LunchMoneyEthereumWalletConnection = {
|
|
40
53
|
initiate(config, context) {
|
|
41
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -44,21 +57,59 @@ exports.LunchMoneyEthereumWalletConnection = {
|
|
|
44
57
|
},
|
|
45
58
|
getBalances({ walletAddress, negligibleBalanceThreshold = NEGLIGIBLE_BALANCE_THRESHOLD }, { client }) {
|
|
46
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
const obscuredWalletAddress = `0x..${walletAddress.slice(-6)}`;
|
|
61
|
+
debug('getBalances called for wallet address:', obscuredWalletAddress);
|
|
62
|
+
// Create a timeout so we fail instead of generating a CORS errors
|
|
63
|
+
let timeoutId;
|
|
64
|
+
const timeoutDuration = process.env.ETHEREUM_BALANCE_TIMEOUT_MSECS
|
|
65
|
+
? parseInt(process.env.ETHEREUM_BALANCE_TIMEOUT_MSECS)
|
|
66
|
+
: 60000;
|
|
67
|
+
const timeout = new Promise((_, reject) => {
|
|
68
|
+
timeoutId = setTimeout(() => {
|
|
69
|
+
reject(new Error(`Ethereum connector getBalances timed out after ${timeoutDuration} milliseconds.`));
|
|
70
|
+
}, timeoutDuration);
|
|
71
|
+
});
|
|
72
|
+
// Wrap all ethers calls in a single timeout
|
|
73
|
+
const result = yield Promise.race([
|
|
74
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
try {
|
|
76
|
+
const weiBalance = yield client.getWeiBalance(walletAddress);
|
|
77
|
+
// Filter out tokens that are not on mainnet
|
|
78
|
+
const chainId = yield client.getChainId();
|
|
79
|
+
const chainFilteredTokensList = (yield (0, client_js_1.loadTokenList)()).filter((t) => BigInt(t.chainId) === BigInt(chainId));
|
|
80
|
+
const map = yield client.getTokensBalance(walletAddress, chainFilteredTokensList.map((t) => t.address));
|
|
81
|
+
return { weiBalance, chainId, map, chainFilteredTokensList };
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
// Clear the timeout when the operation completes (success or failure)
|
|
85
|
+
if (timeoutId) {
|
|
86
|
+
clearTimeout(timeoutId);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}))(),
|
|
90
|
+
timeout,
|
|
91
|
+
]);
|
|
92
|
+
const { weiBalance, chainId, map, chainFilteredTokensList } = result;
|
|
93
|
+
debug('ethers.getTokensBalance returned for wallet address:', obscuredWalletAddress);
|
|
94
|
+
const balances = Object.entries(map)
|
|
95
|
+
.map(([address, balance]) => {
|
|
96
|
+
const token = chainFilteredTokensList.find((t) => t.address === address);
|
|
97
|
+
if (!token) {
|
|
98
|
+
throw new Error(`Token ${address} not found in filtered token list for chainId ${chainId}`);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
asset: token.symbol,
|
|
102
|
+
undivisedAmount: balance,
|
|
103
|
+
decimals: token.decimals,
|
|
104
|
+
};
|
|
57
105
|
})
|
|
58
|
-
.concat({ asset: 'ETH',
|
|
59
|
-
.
|
|
60
|
-
|
|
106
|
+
.concat({ asset: 'ETH', undivisedAmount: weiBalance, decimals: 18 })
|
|
107
|
+
.map(({ asset, undivisedAmount, decimals }) => ({ asset, amount: ethers.formatUnits(undivisedAmount, decimals) }))
|
|
108
|
+
// Normalize the amount to 18 decimal places (for the wei per eth standard) for filtering out negligible balances
|
|
109
|
+
.filter((b) => ethers.parseUnits(b.amount, 18) > negligibleBalanceThreshold)
|
|
110
|
+
.map((b) => ({ asset: b.asset, amount: String(b.amount) }))
|
|
61
111
|
.sort((a, b) => a.asset.localeCompare(b.asset));
|
|
112
|
+
debug(`Returning from getBalances for ${obscuredWalletAddress}:`, balances);
|
|
62
113
|
return {
|
|
63
114
|
providerName: 'wallet_ethereum',
|
|
64
115
|
balances,
|
package/dist/cjs/src/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,2CAAkE;AAClE,+CAAiC;AAEjC,yCAAyD;AAAhD,uHAAA,0BAA0B,OAAA;AAEnC;4CAC4C;AAC5C,MAAM,4BAA4B,GAAG,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
+
export type LunchMoneyCryptoConnectionConfig = Record<string, unknown>;
|
|
5
5
|
/**
|
|
6
6
|
* Non-serializable injected dependencies for the connection
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
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
|
|
14
|
+
export type ProviderName = (typeof providerNames)[number];
|
|
15
15
|
export interface LunchMoneyCryptoConnectionBalances {
|
|
16
16
|
providerName: ProviderName;
|
|
17
17
|
balances: CryptoBalance[];
|
|
18
18
|
}
|
|
19
|
-
export
|
|
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":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":";;;AAmBa,QAAA,aAAa,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,CAAU,CAAC"}
|