
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
intents.js
Advanced tools
You can find the full intents.js documentation at docs.borsa.network
Install intents.js using npm:
npm install intents.js
You can set up intents.js using either a private key or Web3Auth for authentication:
import { Account, IntentBuilder, PROJECTS, CHAINS, toBigInt, amountToBigInt, Asset, Stake } from 'intents.js';
import { ethers } from 'ethers';
const chainConfigs = {
1: {
rpcUrl: 'YOUR_ETH_RPC_URL',
bundlerUrl: 'https://eth.bundler.borsa.network',
},
56: {
rpcUrl: 'YOUR_BNB_RPC_URL',
bundlerUrl: 'https://bsc.bundler.borsa.network',
},
137: {
rpcUrl: 'YOUR_POLYGON_RPC_URL',
bundlerUrl: 'https://polygon.bundler.borsa.network',
},
};
const intentBuilder = await IntentBuilder.createInstance(chainConfigs);
const signer = new ethers.Wallet('your private key');
const account = await Account.createInstance(signer, chainConfigs);
import { Web3Auth } from '@web3auth/web3auth';
import { Account, IntentBuilder } from 'intents.js';
const web3Auth = new Web3Auth({
clientId: 'YOUR_WEB3AUTH_CLIENT_ID', // Replace with your client ID
chainConfig: {
chainId: '0x1', // Ethereum Mainnet
rpcUrl: 'https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID',
},
});
const web3authProvider = await web3Auth.connectWith('google');
const ethersProvider = new ethers.BrowserProvider(web3authProvider as any);
const web3AuthSigner = ethersProvider.getSigner();
const accountInstance = await Account.createInstance(web3AuthSigner, chainConfigs);
const chainConfigs = {
1: {
rpcUrl: 'YOUR_ETH_RPC_URL',
bundlerUrl: 'https://eth.bundler.borsa.network',
},
};
const intentBuilder = await IntentBuilder.createInstance(chainConfigs);
const account = await Account.createInstance(web3AuthSigner, chainConfigs);
You can extend this to use any other provider with ethers and this sdk too
An intent represents a desired outcome. The intent structure consists of two symmetric source and destination states.
In this example, we are using funds from AAVE (BNB Chain) to stake on Lido (Ethereum):
const usdtAddress = '0xdac17f958d2ee523a2206206994597c13d831ec7';
const ethAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
const from = new Loan({
address: PROJECTS.Aave,
amount: amountToBigInt(244.7, 18),
chainId: toBigInt(CHAINS.BNBChain),
asset: usdtAddress,
});
const to = new Stake({
amount: amountToBigInt(0.1, 18),
address: PROJECTS.Lido,
chainId: toBigInt(CHAINS.Ethereum),
asset: ethAddress,
});
Simply provide the source and destination states along with the associated account.
The execute() function will then wrap the intent as an ERC-4337 userOp and submit it to the Borsa network.
const solvedHash = await intentBuilder.execute(from, to, account);
When staking, supplying loan or swapping tokens, you can deposit the swapped tokens to be deposited into another address instead of the address that executed the tx.
The execute takes an optional config object as below
const execOption: ExecutionOptions = {
sourceChainId: 888,
recipient: '0xAddress',
};
const solvedHash = await intentBuilder.execute(source, destination, account, execOption);
import { CrossChainBuilder } from 'intents.js';
const crossChainBuilder = await CrossChainBuilder.createInstance(chainConfigs);
const result = await crossChainBuilder.swapCrossChain(source, destination, account, 1, 56);
After the transaction is executed, you can fetch the receipt:
const receipt = await intentBuilder.getReceipt(1, solvedHash);
const txHash = receipt.result.receipt.transactionHash;
console.log(
`View your tx onchain using any explorer:
Hash: ${txHash}
tx link: https://etherscan.io/tx/${txHash}`,
);
The SDK offers several utility functions for managing conversions and amounts:
toBigInt(value: bigint | number): ProtoBigIntfloatToWei(amount: number): bigintweiToFloat(wei: bigint): numbertokenToFloat(amount: bigint, decimals: number): numberfloatToToken(amount: number, decimals: number): bigintamountToBigInt(amount: number, decimal: number): ProtoBigIntThe Borsa network is fully compatible with the ERC-4337 standard and can operate as a bundler for standard userOps.
await intentBuilder.executeStandardUserOps(account, ChainID, {
calldata: '0x', // optional
callGasLimit: CALL_GAS_LIMIT,
maxFeePerGas: MAX_FEE_PER_GAS,
maxPriorityFeePerGas: MAX_PRIORITY_FEE_PER_GAS,
verificationGasLimit: VERIFICATION_GAS_LIMIT,
});
Contributions to intents.js are welcome! Please refer to our contributing guidelines for more information.
This project is licensed under the MIT License.
FAQs
Abstract State Change Expression Library
The npm package intents.js receives a total of 6 weekly downloads. As such, intents.js popularity was classified as not popular.
We found that intents.js demonstrated a not healthy version release cadence and project activity because the last version was released 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.