Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
meteor-compounder-core
Advanced tools
npm install @cosmology/core
Use cosmology
to manage your daily rewards and investment strategies in Osmosis and the Cosmos. Make cryptocurrency trades, join liquidity pools, and stake rewards.
For osmosis, first get your signer/wallet and stargate signing client.
import {
getWalletFromMnemonic,
getSigningOsmosisClient
} from '@cosmology/core';
const signer = await getWalletFromMnemonic({mnemonic, token: 'OSMO'});
const client = await getSigningOsmosisClient({
rpcEndpoint: rpcEndpoint,
signer
});
For other chains, simply create a signing stargate client
import {
SigningStargateClient
} from '@cosmjs/stargate';
import {
getWalletFromMnemonic
} from '@cosmology/core';
const signer = await getWalletFromMnemonic({mnemonic, token: 'AKT'});
const client = await SigningStargateClient.connectWithSigner(
rpcEndpoint,
signer
);
Once you have your messages, you can broadcast them with signAndBroadcast
:
import { signAndBroadcast } from '@cosmology/core';
const res = await signAndBroadcast({
client: stargateClient,
chainId: argv.chainId, // e.g. 'osmosis-1'
address,
msg,
fee,
memo: ''
});
swapExactAmountIn
The swap command will make a trade between two currencies.
import { messages, getOsmoFee } from '@cosmology/core';
import { coin } from '@cosmjs/amino';
const fee = getOsmoFee('swapExactAmountIn');
const msg = messages.swapExactAmountIn({
sender: address, // osmo address
routes, // TradeRoute
tokenIn: coin(amount, denom), // Coin
tokenOutMinAmount // number as string with no decimals
});
lookupRoutesForTrade
For swaps, you'll need a TradeRoute
for it to work:
import {
messages,
lookupRoutesForTrade,
prettyPool,
OsmosisApiClient,
calculateAmountWithSlippage
} from '@cosmology/core';
const api = new OsmosisApiClient({
url: restEndpoint
});
const lcdPools = await api.getPools();
const pools = lcdPools.pools.map((pool) => prettyPool(pool));
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 = getOsmoFee('swapExactAmountIn');
const msg = messages.swapExactAmountIn({
sender: address, // osmo address
routes, // TradeRoute
tokenIn: coin(amount, denom), // Coin
tokenOutMinAmount // number as string with no decimals
});
joinPool
The join command will join a pool.
import { messages, getOsmoFee } from '@cosmology/core';
import { coin } from '@cosmjs/amino';
const fee = getOsmoFee('swapExactAmountIn');
const msg = messages.joinPool({
poolId, // string!
sender: account.address, // osmo address
shareOutAmount, // number as string with no decimals
tokenInMaxs // Coin[]
});
To calculate shareOutAmount
, you will need one of two methods. See below.
calculateCoinsNeededInPoolForValue
If you want to specify a dollar value to invest in a pool:
coinsNeeded = calculateCoinsNeededInPoolForValue(prices, poolInfo, value);
calculateMaxCoinsForPool
if you want to invest the maximum amount possible for a pool:
coinsNeeded = calculateMaxCoinsForPool(prices, poolInfo, balances);
calculateShareOutAmount
Once you have the coins needed from either calculateCoinsNeededInPoolForValue
or calculateMaxCoinsForPool
, you can use calculateShareOutAmount
to get the shareOutAmount
for the pool:
const shareOutAmount = calculateShareOutAmount(poolInfo, coinsNeeded);
lockTokens
The lock command will lock your gamms tokens for staking so you can earn rewards.
import { messages } from '@cosmology/core';
const msg = messages.lockTokens({
owner, // osmom address
coins, // Coin[]
duration // duration as string
});
withdrawDelegatorReward
Claim rewards from staking.
const msg = messages.withdrawDelegatorReward({
delegatorAddress: address,
validatorAddress: validator_address
});
delegate
Delegate to a validator.
const msg = messages.delegate({
delegatorAddress,
validatorAddress,
amount,
denom
});
AS DESCRIBED IN THE COSMOLOGY LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
No developer or entity involved in creating Cosmology will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Cosmology app or Cosmology CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
FAQs
meteor-compounder-core
The npm package meteor-compounder-core receives a total of 1 weekly downloads. As such, meteor-compounder-core popularity was classified as not popular.
We found that meteor-compounder-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.