
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
@1inch/fusion-sdk
Advanced tools
npm install @1inch/fusion-sdk@2
yarn add @1inch/fusion-sdk@2
import {FusionSDK, NetworkEnum, OrderStatus, PrivateKeyProviderConnector, Web3Like,} from "@1inch/fusion-sdk";
import {computeAddress, formatUnits, JsonRpcProvider} from "ethers";
const PRIVATE_KEY = 'YOUR_PRIVATE_KEY'
const NODE_URL = 'YOUR_WEB3_NODE_URL'
const DEV_PORTAL_API_TOKEN = 'YOUR_DEV_PORTAL_API_TOKEN'
const ethersRpcProvider = new JsonRpcProvider(NODE_URL)
const ethersProviderConnector: Web3Like = {
eth: {
call(transactionConfig): Promise<string> {
return ethersRpcProvider.call(transactionConfig)
}
},
extend(): void {}
}
const connector = new PrivateKeyProviderConnector(
PRIVATE_KEY,
ethersProviderConnector
)
const sdk = new FusionSDK({
url: 'https://api.1inch.dev/fusion',
network: NetworkEnum.BINANCE,
blockchainProvider: connector,
authKey: DEV_PORTAL_API_TOKEN
})
async function main() {
const params = {
fromTokenAddress: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // USDC
toTokenAddress: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', // BNB
amount: '10000000000000000000', // 10 USDC
walletAddress: computeAddress(PRIVATE_KEY),
source: 'sdk-test'
}
const quote = await sdk.getQuote(params)
const dstTokenDecimals = 18
console.log('Auction start amount', formatUnits(quote.presets[quote.recommendedPreset].auctionStartAmount, dstTokenDecimals))
console.log('Auction end amount', formatUnits(quote.presets[quote.recommendedPreset].auctionEndAmount), dstTokenDecimals)
const preparedOrder = await sdk.createOrder(params)
const info = await sdk.submitOrder(preparedOrder.order, preparedOrder.quoteId)
console.log('OrderHash', info.orderHash)
const start = Date.now()
while (true) {
try {
const data = await sdk.getOrderStatus(info.orderHash)
if (data.status === OrderStatus.Filled) {
console.log('fills', data.fills)
break
}
if (data.status === OrderStatus.Expired) {
console.log('Order Expired')
break
}
if (data.status === OrderStatus.Cancelled) {
console.log('Order Cancelled')
break
}
} catch (e) {
console.log(e)
}
}
console.log('Order executed for', (Date.now() - start) / 1000, 'sec')
}
main()
settleOrders function usage and Resolver contract examples you can find here
FAQs
1inch Fusion SDK
The npm package @1inch/fusion-sdk receives a total of 6,222 weekly downloads. As such, @1inch/fusion-sdk popularity was classified as popular.
We found that @1inch/fusion-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.