cosmology-tech / cosmology Goto Github PK
View Code? Open in Web Editor NEWCLI and TS library for the Cosmos ⚛️
License: MIT License
CLI and TS library for the Cosmos ⚛️
License: MIT License
const routes = {
"poolId": "1",
"tokenOutDenom": "uosmo"
}
const msg = swapExactAmountIn({
sender: '',
routes,
tokenIn: coin(1000, 'uosmo'),
tokenOutMinAmount: 10000
});
I using something right this and get an error routes.map,when I try to use lookupRoutesForTrade,but I dont know what exactly the beliefValue and pair?
This issue is more for design and listing out queries that are needed.
e.g. currently do get number of tokens in a pool
convertPoolsToDisplayValues
getUserPools({pools, lockedPools})
instead, if we used a mobx store, we could wrap this all into a single call and it gets cached and we get simplicity and speed
Hi! Cosmology/core is becoming deprecated soon, as the asset list is "baked in" and the code is legacy.
An ideal workflow is to use osmojs
and @osmonauts/math
, which we have examples as shown here and in a video/tweet here
then you can use the chain-registry
for loading assets, and you can use @chain-registry/osmosis
for pre-baked assets, or @chain-registry/utils
to build an asset list dynamically:
import { ibc, assets } from 'chain-registry';
import { getAssetLists } from '@chain-registry/utils';
const list = getAssetLists('osmosis', ibc, assets);
Whe I run the getPoolsPricesPairs function :
this.client = await osmosis.ClientFactory.createRPCQueryClient({ rpcEndpoint: 'https://rpc.osmosis.zone'});
const {
pools,
prices,
pairs
} = await getPoolsPricesPairs(this.client);
I receive this error :
Uncaught Error Error: unknown pool type
at (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@cosmology/core/main/utils/osmo/pools.js:87:25)
at _callee$ (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@cosmology/core/main/utils/osmo/pools.js:76:39)
at tryCatch (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:44:17)
at (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:125:22)
at (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:69:21)
at asyncGeneratorStep (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _next (/home/herraiz/dev/cosmos-osmosis-fetcher/node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
at processTicksAndRejections (internal/process/task_queues:95:5)
depending on which library you use, here are the ones that will have v13 available:
Successfully published:
- @cosmology/[email protected]
- @cosmology/[email protected]
- [email protected]
tracking #20
Getting an error trying to swap on testnet
TypeError: Cannot read properties of undefined (reading 'amount')
at _callee$ (/Users/joel/.nvm/versions/node/v16.14.0/lib/node_modules/cosmology/node_modules/@cosmology/cli/main/commands/swap.js:153:83)
cosmology swap \
--mnemonic "pass panther local rare exit rule robust feel excuse hold arrange fence" \
--chainId osmo-test-4 \
--restEndpoint "https://lcd-test.osmosis.zone" \
--rpcEndpoint "https://rpc-test.osmosis.zone" \
--sell osmo \
--buy atom \
--value 1 \
--slippage 1
I am using rest/rpc endpoints from here, is this correct?
The osmosis frontend currently queries the endpoint https://lcd-osmosis.keplr.app/osmosis/gamm/v1beta1/pools?pagination.limit=1000
with pagination set to 1000
when getting the pool data from the LCD, however the OsmosisApiClient.getPools
function continues to query with pagination set to 750
, causing a few pools with IDs greater than 750
to be missed out.
when attempting to upgrading cosmjs libraries to 0.28.1, typeUrl
is apparently not recognized
{
"typeUrl": "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn",
"value": {
"sender": "osmo1REDACTED",
"routes": [
{
"poolId": "4",
"tokenOutDenom": "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2"
}
],
"tokenIn": {
"denom": "ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4",
"amount": "3546099"
},
"tokenOutMinAmount": "160609"
}
}
/Users/pyramation/code/cosmology/cosmology/node_modules/@cosmjs/stargate/build/aminotypes.js:21
throw new Error(`Type URL '${typeUrl}' does not exist in the Amino message type register. ` +
^
Error: Type URL '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn' does not exist in the Amino message type register. If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.
at AminoTypes.toAmino (/Users/pyramation/code/cosmology/cosmology/node_modules/@cosmjs/stargate/src/aminotypes.ts:43:13)
at /Users/pyramation/code/cosmology/cosmology/node_modules/@cosmjs/stargate/src/signingstargateclient.ts:347:56
at Array.map (<anonymous>)
at SigningStargateClient.signAmino (/Users/pyramation/code/cosmology/cosmology/node_modules/@cosmjs/stargate/src/signingstargateclient.ts:347:27)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
links: https://github.com/cosmology-tech/cosmology/tree/main/packages/core#lookuproutesfortrade
How to instantiate the parameters marked in the red box in the picture? Can you give a detailed process? Thank you
Hello!
I do swapExactAmountIn osmosis message. And usually it's working perfect.
But sometimes, for example in DAI/OSMO pool i encode message with parameter:
tokenIn: {
"denom": "ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7",
"amount": "129433920747610326239"
}
But after in osmosis scan in logs I see this:
https://www.mintscan.io/osmosis/txs/C67C13B32A51CBCD6763CA515DDCABD1523281A849D0C445CFF4A8FC5DEE5E52
"token_in":{
"denom":string"ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7"
"amount":string"306712231643464927"
}
I cannot understand how the 129433920747610326239 become 306712231643464927.
Please, help!
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) {
I hope to get help, thank you!
when i run , it showed :
SyntaxError: Named export 'messages' not found. The requested module '@cosmology/core' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@cosmology/core';
const { messages } = pkg;
The current assetlist.json
has not been updated for 2 months or so, hence there are various new tokens added by osmosis that is missing. The existing assetlist.json url is also invalid and returns a 404.
if i choose cosmology swap, it will just do swap, but how can i get swap ratio( how many a tokens can be swapped by b tokens) before i swap?
The current asset list used https://github.com/cosmology-tech/cosmology/blob/main/packages/core/src/assets/assetlist.json is out-of-date, the asset list by osmosis-labs https://github.com/osmosis-labs/assetlists/blob/main/osmosis-1/osmosis-1.assetlist.json has recently been updated with a few new assets including kujira
use tags now instead of frontier directly
https://github.com/osmosis-labs/assetlists/blob/main/osmosis-1/osmosis-1.assetlist.json
Hi,
I got LcdPool[]
by doing :
OsmosisApiClient
getPools()
. Get a PoolsResponse
containing LcdPool[]
The issue is that the received LcdPool[]
have properties like pool_assets
and not poolAssets
. Same for total_weight
and pool_params
.
So, I have to "clean" my LcdPool[]
before using it. With, for example if (pool.pool_params) pool.poolParams = pool.pool_params
Here is LcdPool
: https://github.com/cosmology-tech/cosmology/blob/main/packages/core/src/types.ts#L284
Here is PoolsResponse
: https://github.com/cosmology-tech/cosmology/blob/main/packages/core/src/clients/osmosis.ts#L21
Here is the method getPools()
of OsmosisApiClient
: https://github.com/cosmology-tech/cosmology/blob/main/packages/core/src/clients/osmosis.ts#L33
Wdyt ?
Thank you for your repo and your time.
use this cmd to swap
cosmology swap \
--chainId osmosis-1 \
--restEndpoint https://lcd-osmosis.blockapsis.com/ \
--rpcEndpoint https://osmosis.validator.network/ \
--sell UST \
--buy ATOM \
--value 0.1 \
--slippage 1
TX failed:
failed to execute message; message index: 0: ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2 token is lesser than min amount: calculated amount is lesser than min amount
TX: https://www.mintscan.io/osmosis/txs/F08A98B4F7932CDB3722FADF924B321A8FE0F34589485E40ADB513D7F70378A2
while the same swap succ at app, also using this cmd to swap atom/osmo succ, but swap ust would occur this error
The current pagination limit when querying for osmosis pools is 1000, with the total number of pools currently at 925 (verify here).
To deal with the growing number of pools, pagination limit should be increased to 1500 to ensure all pools are queried.
PS. would be very helpful if anyone knows of a way to query the pools endpoint such that all pools are returned WITHOUT having to set the pagination.limit
query parameter (so we don't have to update this again)
const rpcEndpoint = "https://rpc.cosmos.directory/osmosis"
const client = await osmosis.ClientFactory.createRPCQueryClient({ rpcEndpoint });
const {
pools,
prices,
pairs,
prettyPools
} = await getPoolsPricesPairs(client);
CoinGecko API response error: AxiosError: connect ETIMEDOUT 162.125.6.1:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
port: 443,
address: '162.125.6.1',
syscall: 'connect',
code: 'ETIMEDOUT',
errno: -4039,
Is there something wrong with my network ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.