@rhea-finance/cross-chain-sdk 0.1.2 → 0.1.3
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 +11 -14
- package/dist/index.cjs +705 -292
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +210 -144
- package/dist/index.d.ts +210 -144
- package/dist/index.js +696 -291
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,6 @@ import {
|
|
|
60
60
|
getBalance,
|
|
61
61
|
getAllFarms,
|
|
62
62
|
getPrices,
|
|
63
|
-
getPortfolio,
|
|
64
63
|
} from "@rhea-finance/cross-chain-sdk";
|
|
65
64
|
|
|
66
65
|
// Batch query - get all data at once
|
|
@@ -102,11 +101,6 @@ const prices: IPrices | undefined = await getPrices({
|
|
|
102
101
|
config: config,
|
|
103
102
|
});
|
|
104
103
|
|
|
105
|
-
// Get portfolio - format account data for easier use
|
|
106
|
-
const portfolio: Portfolio = getPortfolio(accountAllPositions);
|
|
107
|
-
console.log(portfolio.supplied);
|
|
108
|
-
console.log(portfolio.collateral);
|
|
109
|
-
console.log(portfolio.borrowed);
|
|
110
104
|
```
|
|
111
105
|
|
|
112
106
|
### Multi-chain Account (MCA) Management
|
|
@@ -278,8 +272,8 @@ const depositAddress = quoteResult.quoteSuccessResult?.quote?.depositAddress;
|
|
|
278
272
|
// mca: Multi-chain account ID
|
|
279
273
|
// relayerGasFees: Relayer gas fees for different chains
|
|
280
274
|
// assets: Assets data (from getAssets() or batchViews())
|
|
281
|
-
// portfolio: Portfolio data (from
|
|
282
|
-
const simpleWithdrawData: ISimpleWithdraw | null =
|
|
275
|
+
// portfolio: Portfolio data (from getAccountAllPositions() or batchViews())
|
|
276
|
+
const simpleWithdrawData: ISimpleWithdraw | null = computeRelayerGas({
|
|
283
277
|
nearStorageAmount,
|
|
284
278
|
mca,
|
|
285
279
|
relayerGasFees,
|
|
@@ -716,7 +710,6 @@ if (relayer_result?.code == 0) {
|
|
|
716
710
|
### Views
|
|
717
711
|
|
|
718
712
|
- `batchViews` - Batch query views (account, assets, config, etc.)
|
|
719
|
-
- `getPortfolio` - Get portfolio
|
|
720
713
|
- `getAssets` - Get asset list
|
|
721
714
|
- `getPrices` - Get price information
|
|
722
715
|
- `getBalance` - Get balance
|
|
@@ -777,6 +770,14 @@ if (relayer_result?.code == 0) {
|
|
|
777
770
|
- `config_evm` - EVM chain configuration
|
|
778
771
|
- `config_solana` - Solana chain configuration
|
|
779
772
|
- `config_btc` - Bitcoin chain configuration
|
|
773
|
+
- `setCustomNodeUrl` - Set custom RPC node URL for NEAR chain. This function allows you to customize the RPC endpoint used for NEAR chain interactions.
|
|
774
|
+
|
|
775
|
+
```typescript
|
|
776
|
+
import { setCustomNodeUrl } from "@rhea-finance/cross-chain-sdk";
|
|
777
|
+
|
|
778
|
+
// Set custom NEAR RPC node URL
|
|
779
|
+
setCustomNodeUrl("https://your-custom-near-rpc-url.com");
|
|
780
|
+
```
|
|
780
781
|
|
|
781
782
|
### Type Definitions
|
|
782
783
|
|
|
@@ -796,19 +797,15 @@ Check out the [cross-chain-demo](./../cross-chain-demo) project for more complet
|
|
|
796
797
|
### Example 1: Query Account Data
|
|
797
798
|
|
|
798
799
|
```typescript
|
|
799
|
-
import { batchViews
|
|
800
|
+
import { batchViews } from "@rhea-finance/cross-chain-sdk";
|
|
800
801
|
|
|
801
802
|
async function fetchAccountData(mcaId: string) {
|
|
802
803
|
// Batch query
|
|
803
804
|
const lendingData = await batchViews(mcaId);
|
|
804
805
|
|
|
805
|
-
// Convert to portfolio format
|
|
806
|
-
const portfolio = getPortfolio(lendingData.account_all_positions);
|
|
807
|
-
|
|
808
806
|
return {
|
|
809
807
|
assets: lendingData.assets_paged_detailed,
|
|
810
808
|
config: lendingData.config,
|
|
811
|
-
portfolio,
|
|
812
809
|
};
|
|
813
810
|
}
|
|
814
811
|
```
|