Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@mercurial-finance/francium-sdk
Advanced tools
Javascript sdk of Francium lending pools and farming pools. Learn more about Francium.
import { Connection, PublicKey } from '@solana/web3.js';
import FranciumSDK from 'francium-sdk';
const fr = new FranciumSDK({
connection: new Connection('https://free.rpcpool.com')
});
// Will fetch the LP price info on chain and return equity value.
fr.getUserFormattedFarmPosition(new PublicKey('23fxxxxxxxxxxxxxxxxxxx'))
.then(result => {
console.log(result);
// [{
// id: 'ORCA-USDC[Orca Aquafarm]',
// lpAmount: BN,
// lpShares: BN,
// lpDecimals: 6,
// userInfoPublicKey: PublicKey,
// borrowed: [{
// symbol: 'USDC',
// amount: BN
// }],
// totalPositionValue: 10,
// debtValue: 6,
// equityValue: 4
// }]
});
// Only return the amount.
fr.getUserFarmPosition(new PublicKey('23fxxxxxxxxxxxxxxxxxxx'))
.then(result => {
console.log(result);
// [{
// id: 'ORCA-USDC[Orca Aquafarm]',
// lpAmount: BN,
// lpShares: BN,
// lpDecimals: 6,
// userInfoPublicKey: PublicKey,
// borrowed: [{
// symbol: 'USDC',
// amount: BN
// }]
// }]
});
import { Connection, PublicKey } from '@solana/web3.js';
import FranciumSDK from 'francium-sdk';
const fr = new FranciumSDK({
connection: new Connection('https://free.rpcpool.com')
});
async function farm() {
// supply 1 USDC, borrow 1 USDC
const trxs = await fr.getFarmTransactions(
'SHDW-USDC',
'orca',
new PublicKey('23xxxxxxx'),
{
depositPcAmount: new BN(1000000),
depositCoinAmount: new BN(0),
borrowPcAmount: new BN(1000000),
borrowCoinAmount: new BN(0),
// Needed when adjust
currentUserInfoAccount?: PublicKey
}
);
// sign and send trxs
await fr.sendMultipleTransactions(trxs, wallet);
}
async function oneTxfarm() {
// supply 1 USDC, borrow 1 USDC
const versionedTrx = await fr.getOneFarmTransaction(
'RAY-USDC',
'raydium',
new PublicKey('23xxxxxxx'),
{
depositPcAmount: new BN(1000000),
depositCoinAmount: new BN(0),
borrowPcAmount: new BN(1000000),
borrowCoinAmount: new BN(0),
// Needed when adjust
currentUserInfoAccount?: PublicKey
}
);
// If there is Keypair
versionedTrx.sign([payer]);
fr.connection.sendTransaction(versionedTrx);
// if the wallet supports Versioned Transaction
await fr.sendVersionedTransaction(versionedTrx, wallet);
}
import { Connection, PublicKey } from '@solana/web3.js';
import FranciumSDK from 'francium-sdk';
const fr = new FranciumSDK({
connection: new Connection('https://free.rpcpool.com')
});
async function getRepayTransactions() {
const trxs = await fr.getRepayTransactions(
'SHDW-USDC',
'orca',
new PublicKey('23xxxxxxx'),
configs: {
amount0: BN;
amount1: BN;
// userPosition.userInfoPublicKey
currentUserInfoAccount: PublicKey;
}
);
// sign and send trxs
await fr.sendMultipleTransactions(trxs, wallet);
import { Connection, PublicKey } from '@solana/web3.js';
import FranciumSDK from 'francium-sdk';
const fr = new FranciumSDK({
connection: new Connection('https://free.rpcpool.com')
});
async function close() {
// supply 1 USDC, borrow 1 USDC
const trxs = await fr.getClosePositionTransactions(
'SHDW-USDC',
'orca',
new PublicKey('23xxxxxxx'),
{
// 0: swap to PC token
// 1: swap to Coin Token
// 2: minimize trading
withdrawType: 2,
// userPosition.lpShares
lpShares: BN,
// userPosition.userInfoPublicKey
currentUserInfoAccount: PublicKey
}
);
// sign and send trxs
await fr.sendMultipleTransactions(trxs, wallet);
}
async function oneTxClose() {
// supply 1 USDC, borrow 1 USDC
const versionedTrx = await fr.getOneFarmClosedTransaction(
'RAY-USDC',
'raydium',
new PublicKey('23xxxxxxx'),
{
// 0: swap to PC token
// 1: swap to Coin Token
// 2: minimize trading
withdrawType: 2,
// userPosition.lpShares
lpShares: BN,
// userPosition.userInfoPublicKey
currentUserInfoAccount: PublicKey
}
);
// If there is Keypair
versionedTrx.sign([payer]);
fr.connection.sendTransaction(versionedTrx);
// if the wallet supports Versioned Transaction
await fr.sendVersionedTransaction(versionedTrx, wallet);
}
async function getInfo() {
const farmPool = await fr.getFarmPoolTVL();
const lendingPool = await fr.getLendingPoolTVL();
}
fr.getFarmLPPriceInfo();
import { Connection, PublicKey } from '@solana/web3.js';
import FranciumSDK from 'francium-sdk';
const fr = new FranciumSDK({
connection: new Connection('https://free.rpcpool.com')
});
async function rebalance() {
await fr.sendRebalanceTransactions(
new PublicKey('23xxxxxxx'),
targetPosition.userInfoPublicKey.toBase58(), // the userInfoPublicKey string of the target positio, which could be accessible from fr.getUserFarmPosition
wallet,
);
}
// get rebalance Info
async function getRebalanceInfo() {
const rebalanceInfo = await fr.getRebalanceInfo(
new PublicKey('23xxxxxxx'),
targetPosition.userInfoPublicKey.toBase58(), // the userInfoPublicKey string of the target positio, which could be accessible from fr.getUserFarmPosition
);
console.log('rebalanceInfo: ', rebalanceInfo);
}
import { Connection, PublicKey } from '@solana/web3.js';
import FranciumSDK from 'francium-sdk';
const fr = new FranciumSDK({
connection: new Connection('https://free.rpcpool.com')
});
async function deposit() {
const { trx, signers } = await fr.getLendingDepositTransaction('USDC', new BN(1000000), new PublicKey('23fxxxxxxxxxxxxxxxxxxx'));
const { txid, response } = await fr.sendSingleTransaction(trx, wallet, signers);
console.log(txid, response);
}
async function withdraw() {
// You can get this value by getUserLendingPosition method
const rewardAmount = 1002232;
const tokenAmount = 0;
const { trx, signers } = await fr.getLendWithdrawTransaction('USDC', rewardAmount, tokenAmount, new PublicKey('23fxxxxxxxxxxxxxxxxxxx'));
const { txid, response } = await fr.sendSingleTransaction(trx, wallet, signers);
console.log(txid, response);
}
async function depositV0() {
const {trx, signers} = await sdk.getLendingDepositTransactionV0(
'USDC', new BN('1000000'), new PublicKey('23xxxxxxx'));
const { txid, response } = await sdk.sendVersionedTransaction(trx, wallet, signers);
}
async function withdrawV0() {
const rewardAmount = 1002232;
const tokenAmount = 0;
const {trx, signers} = await sdk.getLendingWithdrawTransactionV0(
'USDC', rewardAmount, tokenAmount, new PublicKey('23xxxxxxx'));
const { txid, response } = await sdk.sendVersionedTransaction(trx, wallet, signers);
}
user lending position, the totalAmount
is the token amount.
fr.getUserLendingPosition(new PublicKey('23fxxxxxxxxxxxxxxxxxxx'))
.then((res) => {
console.log(res);
// [
// {
// balancePosition: 0,
// pool: "USDC",
// rewardPosition: 41354540149,
// scale: 6,
// totalAmount: 50386.25041249344,
// totalPosition: 41354540149,
// }
// ]
})
fr.getLendingPoolInfo()
.then((res) => {
console.log(res);
// [
// {
// pool: 'USDC',
// scale: 6,
// avaliableAmount: BN,
// borrowedAmount: BN,
// totalAmount: BN,
// utilization: 0.9,
// totalShareMintSupply: BN,
// apr: 8.36,
// apy: 8.72,
// }
// ]
});
add this to your webpack configuration
node: {
fs: "empty",
net: "empty",
tls: "empty",
}
FAQs
francium sdk
The npm package @mercurial-finance/francium-sdk receives a total of 535 weekly downloads. As such, @mercurial-finance/francium-sdk popularity was classified as not popular.
We found that @mercurial-finance/francium-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.