Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@mcsam/m3m3
Advanced tools
NPM: https://www.npmjs.com/package/@meteora-ag/m3m3
SDK: https://github.com/MeteoraAg/stake-for-fee-sdk
Discord: https://discord.com/channels/841152225564950528/864859354335412224
npm i @meteora-ag/m3m3 @project-serum/anchor @solana/web3.js @solana/spl-token @solana/spl-token-registry
import StakeForFee from "@meteora-ag/m3m3";
import { PublicKey } from "@solana/web3.js";
import { Wallet, AnchorProvider } from "@project-serum/anchor";
// Connection, Wallet, and AnchorProvider to interact with the network
const mainnetConnection = new Connection("https://api.mainnet-beta.solana.com");
const mockWallet = new Wallet(new Keypair());
const provider = new AnchorProvider(mainnetConnection, mockWallet, {
commitment: "confirmed",
});
// Alternatively, to use Solana Wallet Adapter
const poolAddress = new PublicKey(
"G2MRSjNjCbFUmMf32Z1aXYhy6pc1ihLyYg6orKedyjJG"
);
const m3m3 = await StakeForFee.create(connection, poolAddress);
const stakeAmount = new BN(
1_000 * 10 ** feeFarm.accountStates.tokenAMint.decimals
); // 1,000 stake token (make sure you have enough balance in your wallet)
const stakeTx = await feeFarm.stake(stakeAmount, mockWallet.publicKey);
const stakeTxHash = await provider.sendAndConfirm(stakeTx); // Transaction hash
await feeFarm.refreshStates(); // make sure to refresh states to get the latest data
const userEscrow = await feeFarm.getUserStakeAndClaimBalance(
mockWallet.publicKey
);
const stakeBalance =
userStakeEscrow.stakeEscrow.stakeAmount.toNumber() /
10 ** feeFarm.accountStates.tokenAMint.decimals;
const claimableFeeA = fromLamports(
userStakeEscrow.unclaimFee.feeA || 0,
feeFarm.accountStates.tokenAMint.decimals
);
const claimableFeeB = fromLamports(
userStakeEscrow.unclaimFee.feeB || 0,
feeFarm.accountStates.tokenBMint.decimals
);
const claimFeeTx = await feeVault.claimFee(
mockWallet.publicKey,
new BN(U64_MAX)
); // second param is max amount, so usually we just put max number BN.js can support
const claimfeeTxHash = await provider.sendAndConfirm(claimFeeTx); // Transaction hash
const unstakeKeyPair = new Keypair();
const unstakeTx = await feeVault.unstake(
userEscrow.stakeEscrow.stakeAmount,
unstakeKeyPair.publicKey,
mockWallet.publicKey
);
unstakeTx.partialSign(unstakeKeyPair); // Make sure to partial sign unstakeKeypair
const unstakeTxHash = await provider.sendAndConfirm(unstakeTx); // Transaction hash
const unstakePeriodInSeconds =
feeFarm.accountStates.feeVault.configuration.unstakeLockDuration.toNumber();
const cancelUnstakeTx = await feeFarm.cancelUnstake(
unstakeKeyPair.publicKey,
mockWallet.publicKey
);
const cancelUnstakeTxHash = await provider.sendAndConfirm(cancelUnstakeTx);
const withdrawTx = await feeFarm.withdraw(
unstakeKeyPair.publicKey,
mockWallet.publicKey
);
const withdrawTxHash = await provider.sendAndConfirm(withdrawTx);
FAQs
Unknown package
The npm package @mcsam/m3m3 receives a total of 2 weekly downloads. As such, @mcsam/m3m3 popularity was classified as not popular.
We found that @mcsam/m3m3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.