@curvefi/llamalend-api 1.0.18 → 1.0.19
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/lib/utils.js +4 -4
- package/package.json +1 -1
- package/src/utils.ts +4 -4
package/lib/utils.js
CHANGED
|
@@ -156,7 +156,7 @@ export const _getBalances = (coinAddresses_1, ...args_1) => __awaiter(void 0, [c
|
|
|
156
156
|
});
|
|
157
157
|
export const getBalances = (coins_1, ...args_1) => __awaiter(void 0, [coins_1, ...args_1], void 0, function* (coins, address = "") {
|
|
158
158
|
const coinAddresses = _getCoinAddresses(coins);
|
|
159
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
159
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
160
160
|
const _balances = yield _getBalances(coinAddresses, address);
|
|
161
161
|
return _balances.map((_b, i) => formatUnits(_b, decimals[i]));
|
|
162
162
|
});
|
|
@@ -187,7 +187,7 @@ export const _getAllowance = memoize((coins, address, spender) => __awaiter(void
|
|
|
187
187
|
// coins can be either addresses or symbols
|
|
188
188
|
export const getAllowance = (coins, address, spender) => __awaiter(void 0, void 0, void 0, function* () {
|
|
189
189
|
const coinAddresses = _getCoinAddresses(coins);
|
|
190
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
190
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
191
191
|
const _allowance = yield _getAllowance(coinAddresses, address, spender);
|
|
192
192
|
return _allowance.map((a, i) => llamalend.formatUnits(a, decimals[i]));
|
|
193
193
|
});
|
|
@@ -217,7 +217,7 @@ export const _ensureAllowance = (coins_1, _amounts_1, spender_1, ...args_1) => _
|
|
|
217
217
|
// coins can be either addresses or symbols
|
|
218
218
|
export const ensureAllowanceEstimateGas = (coins_1, amounts_1, spender_1, ...args_1) => __awaiter(void 0, [coins_1, amounts_1, spender_1, ...args_1], void 0, function* (coins, amounts, spender, isMax = true) {
|
|
219
219
|
const coinAddresses = _getCoinAddresses(coins);
|
|
220
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
220
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
221
221
|
const _amounts = amounts.map((a, i) => parseUnits(a, decimals[i]));
|
|
222
222
|
const _allowance = yield _getAllowance(coinAddresses, llamalend.signerAddress, spender);
|
|
223
223
|
let gas = [0, 0];
|
|
@@ -234,7 +234,7 @@ export const ensureAllowanceEstimateGas = (coins_1, amounts_1, spender_1, ...arg
|
|
|
234
234
|
// coins can be either addresses or symbols
|
|
235
235
|
export const ensureAllowance = (coins_1, amounts_1, spender_1, ...args_1) => __awaiter(void 0, [coins_1, amounts_1, spender_1, ...args_1], void 0, function* (coins, amounts, spender, isMax = true) {
|
|
236
236
|
const coinAddresses = _getCoinAddresses(coins);
|
|
237
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
237
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
238
238
|
const _amounts = amounts.map((a, i) => parseUnits(a, decimals[i]));
|
|
239
239
|
return yield _ensureAllowance(coinAddresses, _amounts, spender, isMax);
|
|
240
240
|
});
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -180,7 +180,7 @@ export const _getBalances = async (coinAddresses: string[], address = ""): Promi
|
|
|
180
180
|
|
|
181
181
|
export const getBalances = async (coins: string[], address = ""): Promise<string[]> => {
|
|
182
182
|
const coinAddresses = _getCoinAddresses(coins);
|
|
183
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
183
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
184
184
|
const _balances = await _getBalances(coinAddresses, address);
|
|
185
185
|
|
|
186
186
|
return _balances.map((_b, i: number ) => formatUnits(_b, decimals[i]));
|
|
@@ -217,7 +217,7 @@ export const _getAllowance = memoize(async (coins: string[], address: string, sp
|
|
|
217
217
|
// coins can be either addresses or symbols
|
|
218
218
|
export const getAllowance = async (coins: string[], address: string, spender: string): Promise<string[]> => {
|
|
219
219
|
const coinAddresses = _getCoinAddresses(coins);
|
|
220
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
220
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
221
221
|
const _allowance = await _getAllowance(coinAddresses, address, spender);
|
|
222
222
|
|
|
223
223
|
return _allowance.map((a, i) => llamalend.formatUnits(a, decimals[i]))
|
|
@@ -254,7 +254,7 @@ export const _ensureAllowance = async (coins: string[], _amounts: bigint[], spen
|
|
|
254
254
|
// coins can be either addresses or symbols
|
|
255
255
|
export const ensureAllowanceEstimateGas = async (coins: string[], amounts: (number | string)[], spender: string, isMax = true): Promise<TGas> => {
|
|
256
256
|
const coinAddresses = _getCoinAddresses(coins);
|
|
257
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
257
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
258
258
|
const _amounts = amounts.map((a, i) => parseUnits(a, decimals[i]));
|
|
259
259
|
const _allowance: bigint[] = await _getAllowance(coinAddresses, llamalend.signerAddress, spender);
|
|
260
260
|
|
|
@@ -274,7 +274,7 @@ export const ensureAllowanceEstimateGas = async (coins: string[], amounts: (numb
|
|
|
274
274
|
// coins can be either addresses or symbols
|
|
275
275
|
export const ensureAllowance = async (coins: string[], amounts: (number | string)[], spender: string, isMax = true): Promise<string[]> => {
|
|
276
276
|
const coinAddresses = _getCoinAddresses(coins);
|
|
277
|
-
const decimals = _getCoinDecimals(coinAddresses);
|
|
277
|
+
const decimals = _getCoinDecimals(coinAddresses).map((item) => Number(item));
|
|
278
278
|
const _amounts = amounts.map((a, i) => parseUnits(a, decimals[i]));
|
|
279
279
|
|
|
280
280
|
return await _ensureAllowance(coinAddresses, _amounts, spender, isMax)
|