@rhea-finance/cross-chain-sdk 0.1.0 → 0.1.2
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 +578 -142
- package/dist/index.cjs +45 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +43 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ function getConfig() {
|
|
|
33
33
|
WRAP_NEAR_CONTRACT_ID: "wrap.near",
|
|
34
34
|
XRHEA_TOKEN_ID: "xtoken.rhealab.near",
|
|
35
35
|
NBTCTokenId: "nbtc.bridge.near",
|
|
36
|
+
WBTC_TOKEN_ID: "2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near",
|
|
36
37
|
indexUrl: "https://api.rhea.finance",
|
|
37
38
|
dataServiceUrl: "https://apidata.rhea.finance",
|
|
38
39
|
txIdApiUrl: "https://api3.nearblocks.io",
|
|
@@ -46,8 +47,7 @@ function getConfig() {
|
|
|
46
47
|
"aurora",
|
|
47
48
|
"token.burrow.near",
|
|
48
49
|
"45.contract.portalbridge.near",
|
|
49
|
-
"shadow_ref_v1-4179"
|
|
50
|
-
"2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near"
|
|
50
|
+
"shadow_ref_v1-4179"
|
|
51
51
|
]
|
|
52
52
|
};
|
|
53
53
|
return {
|
|
@@ -868,6 +868,12 @@ var getOraclePrices = async () => {
|
|
|
868
868
|
return void 0;
|
|
869
869
|
}
|
|
870
870
|
};
|
|
871
|
+
var getTokenPythInfos = async () => {
|
|
872
|
+
return await view_on_near({
|
|
873
|
+
contractId: config_near.LOGIC_CONTRACT_NAME,
|
|
874
|
+
methodName: ViewMethodsLogic[17 /* get_all_token_pyth_infos */]
|
|
875
|
+
});
|
|
876
|
+
};
|
|
871
877
|
var { oneClickUrl, indexUrl } = config_near;
|
|
872
878
|
var getSignature = (plaintext) => {
|
|
873
879
|
const key = process.env.NEXT_PUBLIC_CRYPTO_KEY;
|
|
@@ -1581,6 +1587,16 @@ var getPortfolio = (accountPositions) => {
|
|
|
1581
1587
|
hasNonFarmedAssets: accountPositions.has_non_farmed_assets || hasZeroSharesFarmRewards(accountPositions.farms)
|
|
1582
1588
|
};
|
|
1583
1589
|
};
|
|
1590
|
+
var getAccountAllPositions = async (account_id) => {
|
|
1591
|
+
const accountDetailed = await view_on_near({
|
|
1592
|
+
contractId: config_near.LOGIC_CONTRACT_NAME,
|
|
1593
|
+
methodName: ViewMethodsLogic[2 /* get_account_all_positions */],
|
|
1594
|
+
args: {
|
|
1595
|
+
account_id
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
return accountDetailed;
|
|
1599
|
+
};
|
|
1584
1600
|
|
|
1585
1601
|
// src/view/get-balance.ts
|
|
1586
1602
|
var getBalance = async (tokenId, accountId) => {
|
|
@@ -1600,23 +1616,6 @@ var getBalance = async (tokenId, accountId) => {
|
|
|
1600
1616
|
return "0";
|
|
1601
1617
|
}
|
|
1602
1618
|
};
|
|
1603
|
-
var getBalance2 = async (tokenId, accountId) => {
|
|
1604
|
-
try {
|
|
1605
|
-
const balanceInYocto = await view_on_near({
|
|
1606
|
-
contractId: tokenId,
|
|
1607
|
-
methodName: ViewMethodsToken[1 /* ft_balance_of */],
|
|
1608
|
-
args: {
|
|
1609
|
-
account_id: accountId
|
|
1610
|
-
}
|
|
1611
|
-
});
|
|
1612
|
-
return balanceInYocto;
|
|
1613
|
-
} catch (err) {
|
|
1614
|
-
console.error(
|
|
1615
|
-
`Failed to get balance for ${accountId} on ${tokenId} ${err.message}`
|
|
1616
|
-
);
|
|
1617
|
-
return "0";
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
1619
|
|
|
1621
1620
|
// src/view/get-farms.ts
|
|
1622
1621
|
var getAllFarms = async () => {
|
|
@@ -2372,6 +2371,30 @@ function searchMatchAssetId({
|
|
|
2372
2371
|
return {};
|
|
2373
2372
|
}
|
|
2374
2373
|
|
|
2374
|
+
// src/other/getSimpleWithdrawData.ts
|
|
2375
|
+
var getSimpleWithdrawData = async ({
|
|
2376
|
+
nearStorageAmount,
|
|
2377
|
+
mca,
|
|
2378
|
+
relayerGasFees,
|
|
2379
|
+
assets,
|
|
2380
|
+
portfolio
|
|
2381
|
+
}) => {
|
|
2382
|
+
const gasData = await computeRelayerGas({
|
|
2383
|
+
nearStorageAmount,
|
|
2384
|
+
mca,
|
|
2385
|
+
relayerGasFees,
|
|
2386
|
+
assets,
|
|
2387
|
+
portfolio
|
|
2388
|
+
});
|
|
2389
|
+
const simpleWithdrawData = gasData ? {
|
|
2390
|
+
tokenId: gasData.tokenId,
|
|
2391
|
+
amount: gasData.amount,
|
|
2392
|
+
amountToken: gasData.amountToken,
|
|
2393
|
+
amountBurrow: gasData.amountBurrow
|
|
2394
|
+
} : null;
|
|
2395
|
+
return simpleWithdrawData;
|
|
2396
|
+
};
|
|
2397
|
+
|
|
2375
2398
|
exports.DEFAULT_POSITION = DEFAULT_POSITION;
|
|
2376
2399
|
exports.FRACTION_DIGITS = FRACTION_DIGITS;
|
|
2377
2400
|
exports.MAX_RATIO = MAX_RATIO;
|
|
@@ -2393,13 +2416,13 @@ exports.fetchIntentsQuotation = fetchIntentsQuotation;
|
|
|
2393
2416
|
exports.fetchIntentsTokens = fetchIntentsTokens;
|
|
2394
2417
|
exports.fetchIntentsTransactionStatus = fetchIntentsTransactionStatus;
|
|
2395
2418
|
exports.format_wallet = format_wallet;
|
|
2419
|
+
exports.getAccountAllPositions = getAccountAllPositions;
|
|
2396
2420
|
exports.getAccountBalance = getAccountBalance;
|
|
2397
2421
|
exports.getAllFarms = getAllFarms;
|
|
2398
2422
|
exports.getAssets = getAssets;
|
|
2399
2423
|
exports.getAssetsDetail = getAssetsDetail;
|
|
2400
2424
|
exports.getAuthenticationHeaders = getAuthenticationHeaders;
|
|
2401
2425
|
exports.getBalance = getBalance;
|
|
2402
|
-
exports.getBalance2 = getBalance2;
|
|
2403
2426
|
exports.getBoosterTokens = getBoosterTokens;
|
|
2404
2427
|
exports.getCeateMcaFee = getCeateMcaFee;
|
|
2405
2428
|
exports.getConfig = getConfig2;
|
|
@@ -2417,7 +2440,9 @@ exports.getPortfolio = getPortfolio;
|
|
|
2417
2440
|
exports.getPrices = getPrices;
|
|
2418
2441
|
exports.getRepayCustomRecipientMsg = getRepayCustomRecipientMsg;
|
|
2419
2442
|
exports.getSignature = getSignature;
|
|
2443
|
+
exports.getSimpleWithdrawData = getSimpleWithdrawData;
|
|
2420
2444
|
exports.getSupplyCustomRecipientMsg = getSupplyCustomRecipientMsg;
|
|
2445
|
+
exports.getTokenPythInfos = getTokenPythInfos;
|
|
2421
2446
|
exports.get_all_tokens_metadata = get_all_tokens_metadata;
|
|
2422
2447
|
exports.get_interest_rate = get_interest_rate;
|
|
2423
2448
|
exports.get_liquidations = get_liquidations;
|