Closed d-never closed 1 year ago
oh thanks! I think you just pointed out that the docs are out of date (sorry!)
can you look at this example https://github.com/cosmology-tech/cosmology/blob/main/packages/cli/src/commands/rebalance.ts#L43-L57
and see if using the osmojs
library works with the RPC client?
oh thanks! I think you just pointed out that the docs are out of date (sorry!)
can you look at this example https://github.com/cosmology-tech/cosmology/blob/main/packages/cli/src/commands/rebalance.ts#L43-L57
and see if using the
osmojs
library works with the RPC client?
Thank you for your reply! I get the rawPools from this example, but I still cann't get the right routes? Because there are variables not instantiated, for example beliefValue、 pair and so on。Is there an example to refer ?
By the way,weather the the swapExactAmountIn docs out of date too, and is there a good example?
Thanks!
want to try looking here?
https://github.com/cosmology-tech/cosmology/blob/main/packages/cli/src/commands/rebalance.ts#L220
want to try looking here?
https://github.com/cosmology-tech/cosmology/blob/main/packages/cli/src/commands/rebalance.ts#L220
I've read this document, it doesn't work. Is there another doc to get the right routes?
want to try looking here? https://github.com/cosmology-tech/cosmology/blob/main/packages/cli/src/commands/rebalance.ts#L220
I've read this document, it doesn't work. Is there another doc to get the right routes?
Ok, I can try and make another, but I can promise you, that command 100% works — you can test it via the CLI. So you're likely not doing something correct, but perhaps that example is confusing due to the prompts.
想试试看这里吗? https://github.com/cosmology-tech/cosmology/blob/main/packages/cli/src/commands/rebalance.ts#L220
我读过这个文件,它不起作用。是否有其他文档可以获取正确的路线?
好的,我可以尝试再做一个,但我可以向你保证,该命令 100% 有效——你可以通过 CLI 对其进行测试。因此,您可能没有做正确的事情,但由于提示,该示例可能令人困惑。
hi sir, i try many times and it's still wrong .. so the question is : 1) import { prompt, printSwap, printSwapForPoolAllocation, printOsmoTransactionResponse, promptMnemonic, promptChain, promptRpcEndpoint, getPoolsDecoded } from '????' , i can't find right path , the rebalance.ts showed ../untils , but i can't find.
2) is there a discord or telegram , so we can study more ?
tracking here https://github.com/cosmology-tech/cosmology/pull/22
https://github.com/cosmology-tech/cosmology/tree/main/packages/core#lookuproutesfortrade
import {
lookupRoutesForTrade,
getPoolsPricesPairs,
calculateAmountWithSlippage
} from '@cosmology/core';
import { osmosis } from 'osmojs';
const {
swapExactAmountIn
} = osmosis.gamm.v1beta1.MessageComposer.withTypeUrl;
const client = await osmosis.ClientFactory.createRPCQueryClient({ rpcEndpoint });
const {
pools,
prices,
pairs,
prettyPools
} = await getPoolsPricesPairs(client);
const routes = lookupRoutesForTrade({
pools,
trade: {
sell: {
denom: tokenIn.denom,
amount: tokenInAmount
},
buy: {
denom: tokenOut.denom,
amount: tokenOutAmount
},
beliefValue: value
},
pairs
}).map((tradeRoute) => {
const {
poolId,
tokenOutDenom
} = tradeRoute;
return {
poolId,
tokenOutDenom
};
});
const tokenOutMinAmount = calculateAmountWithSlippage(
buy.amount,
slippage
);
const fee = FEES.osmosis.swapExactAmountIn(argv.fee || 'low'); // low, medium, high
const msg = swapExactAmountIn({
sender: address, // osmo address
routes, // TradeRoute
tokenIn: coin(amount, denom), // Coin
tokenOutMinAmount // number as string with no decimals
});
links:https://github.com/cosmology-tech/cosmology/tree/main/packages/core#lookupRoutesForTrade
I runned this code and it says there is an error as follows:
and I modified the osmosis.js:563 as follows:
var tokens = pool.pool_assets.map(function (_ref5) {
and there are new errors:
I hope to get help, thank you!