@raac/rpc 2.0.0-beta.6 → 2.0.0-beta.7
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/dist/RPCLibrary.js +13 -0
- package/dist/configs/chains/11155111.json +30 -0
- package/dist/contracts/curve/common/_helpers.js +39 -0
- package/dist/contracts/curve/common/getPools.js +36 -0
- package/dist/contracts/curve/common/getVirtualPrice.js +26 -0
- package/dist/contracts/curve/common/index.js +18 -0
- package/dist/contracts/findContract.js +3 -3
- package/dist/contracts/getContractAddress.js +1 -0
- package/dist/contracts/governance/gaugeSystems/_helpers.js +2 -2
- package/dist/pools/lendingPool/adapters/erc20/getERC20AdapterBalance.js +4 -4
- package/dist/types/RPCLibrary.d.ts +8 -1
- package/dist/types/contracts/curve/common/_helpers.d.ts +16 -0
- package/dist/types/contracts/curve/common/getPools.d.ts +30 -0
- package/dist/types/contracts/curve/common/getVirtualPrice.d.ts +13 -0
- package/dist/types/contracts/curve/common/index.d.ts +2 -0
- package/dist/types/pools/lendingPool/adapters/erc20/getERC20AdapterBalance.d.ts +3 -3
- package/dist/types/user/_helpers.d.ts +23 -0
- package/dist/types/user/computeEffectiveReturn.d.ts +67 -0
- package/dist/types/user/getUserClaimables.d.ts +55 -0
- package/dist/types/user/getUserCollateral.d.ts +12 -0
- package/dist/types/user/getUserDebt.d.ts +18 -0
- package/dist/types/user/getUserFarming.d.ts +64 -0
- package/dist/types/user/getUserGovernance.d.ts +20 -0
- package/dist/types/user/getUserPortfolio.d.ts +61 -0
- package/dist/types/user/getUserWalletBalances.d.ts +20 -0
- package/dist/types/user/index.d.ts +9 -0
- package/dist/types/utils/amount.d.ts +7 -0
- package/dist/types/utils/contracts.d.ts +2 -0
- package/dist/user/_helpers.js +22 -0
- package/dist/user/computeEffectiveReturn.js +33 -0
- package/dist/user/getUserClaimables.js +97 -0
- package/dist/user/getUserCollateral.js +29 -0
- package/dist/user/getUserDebt.js +32 -0
- package/dist/user/getUserFarming.js +100 -0
- package/dist/user/getUserGovernance.js +35 -0
- package/dist/user/getUserPortfolio.js +109 -0
- package/dist/user/getUserWalletBalances.js +30 -0
- package/dist/user/index.js +24 -0
- package/dist/utils/amount.js +10 -0
- package/dist/utils/contracts.js +5 -2
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./computeEffectiveReturn"), exports);
|
|
18
|
+
__exportStar(require("./getUserClaimables"), exports);
|
|
19
|
+
__exportStar(require("./getUserCollateral"), exports);
|
|
20
|
+
__exportStar(require("./getUserDebt"), exports);
|
|
21
|
+
__exportStar(require("./getUserFarming"), exports);
|
|
22
|
+
__exportStar(require("./getUserGovernance"), exports);
|
|
23
|
+
__exportStar(require("./getUserPortfolio"), exports);
|
|
24
|
+
__exportStar(require("./getUserWalletBalances"), exports);
|
package/dist/utils/amount.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.toAmount = toAmount;
|
|
|
5
5
|
exports.toScaled = toScaled;
|
|
6
6
|
exports.parseAmount = parseAmount;
|
|
7
7
|
exports.toDecimalString = toDecimalString;
|
|
8
|
+
exports.toNumber = toNumber;
|
|
8
9
|
exports.serializeAmount = serializeAmount;
|
|
9
10
|
exports.deserializeAmount = deserializeAmount;
|
|
10
11
|
exports.getAssetDecimals = getAssetDecimals;
|
|
@@ -65,6 +66,15 @@ function parseAmount(text, decimals) {
|
|
|
65
66
|
function toDecimalString(amount) {
|
|
66
67
|
return ethers_1.ethers.formatUnits(amount.value, amount.decimals);
|
|
67
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* An amount or scaled value as a JavaScript number, for USD and rate maths. Lossy past about 15 significant digits,
|
|
71
|
+
* so keep on-chain values as `bigint` and use this only for computed figures.
|
|
72
|
+
* @param amount The amount or scaled value, e.g. a ray rate of 3.5e25 becomes 0.035.
|
|
73
|
+
* @returns The value in whole units.
|
|
74
|
+
*/
|
|
75
|
+
function toNumber(amount) {
|
|
76
|
+
return Number(toDecimalString(amount));
|
|
77
|
+
}
|
|
68
78
|
/**
|
|
69
79
|
* Converts an amount to a JSON-safe form, since `bigint` does not survive `JSON.stringify`.
|
|
70
80
|
* @param amount The amount.
|
package/dist/utils/contracts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContractAddress = exports.getContract = exports.getConfig = exports.setOverrideConfig = exports.getConfigs = void 0;
|
|
3
|
+
exports.isDeployed = exports.getContractAddress = exports.getContract = exports.getConfig = exports.setOverrideConfig = exports.getConfigs = void 0;
|
|
4
4
|
const configs_1 = require("../configs");
|
|
5
5
|
const chains_1 = require("../configs/chains");
|
|
6
6
|
const artifacts_1 = require("./artifacts");
|
|
@@ -56,7 +56,7 @@ const getContractAddress = (chainId, contractName) => {
|
|
|
56
56
|
if (!config) {
|
|
57
57
|
throw new Error(`Unsupported chain ID: ${chainId}`);
|
|
58
58
|
}
|
|
59
|
-
const chainKeys = ["contracts", "governance", "assets", "pools", "nfts", "lockers", "zap", "psm"];
|
|
59
|
+
const chainKeys = ["contracts", "governance", "assets", "pools", "nfts", "lockers", "zap", "psm", "curve"];
|
|
60
60
|
const keys = Object.keys(config).filter((key) => chainKeys.includes(key));
|
|
61
61
|
let address = null;
|
|
62
62
|
for (const key of keys) {
|
|
@@ -84,3 +84,6 @@ exports.default = {
|
|
|
84
84
|
getConfig: exports.getConfig,
|
|
85
85
|
getConfigs: exports.getConfigs,
|
|
86
86
|
};
|
|
87
|
+
/** Whether a config address is set and deployed: a valid, non-zero address. */
|
|
88
|
+
const isDeployed = (address) => !!address && ethers_1.ethers.isAddress(address) && address !== ethers_1.ethers.ZeroAddress;
|
|
89
|
+
exports.isDeployed = isDeployed;
|