Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@uniswap/uniswapx-sdk
Advanced tools
SDK for the UniswapX protocol
The SDK contains bindings for two main flows: parsing serialized orders & building new orders.
import { DutchOrder, NonceManager } from '@uniswap/uniswapx-sdk';
import { ethers } from 'ethers';
const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
const account = await provider.getSigner().getAddress();
const nonceMgr = new NonceManager(provider, 1);
const nonce = await nonceMgr.useNonce(account);
const chainId = 1;
const builder = new DutchOrderBuilder(chainId);
const order = builder
.deadline(deadline)
.decayEndTime(deadline)
.decayStartTime(deadline - 100)
.nonce(nonce)
.input({
token: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
amount: BigNumber.from('1000000'),
})
.output({
token: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
startAmount: BigNumber.from('1000000000000000000'),
endAmount: BigNumber.from('900000000000000000'),
recipient: '0x0000000000000000000000000000000000000000',
})
.build();
// Sign the built order
const { domain, types, values } = order.permitData();
const signature = wallet._signTypedData(domain, types, values);
const serializedOrder = order.serialize();
// submit serializedOrder and signature to order pool
import { DutchOrder, Order } from '@uniswap/uniswapx-sdk';
const serializedOrder = '0x1111222233334444555500000000234300234...';
const chainId = 1;
const order: Order = DutchOrder.parse(serializedOrder, chainId);
const orderData = order.info;
const orderHash = order.hash();
import { ethers } from 'ethers';
import { OrderValidator } from 'uniswapx-sdk';
const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
const validator = new OrderValidator(provider, CHAIN_ID);
const orders: SignedOrder[] = [
{
order: order1,
signature: signature1
},
{
order: order2,
signature: signature2
}
];
try {
const statusList: OrderValidation[] = await validator.validateBatch(orders);
// Do something with list of statuses
}
catch(e) {
// Handle error
}
serialize()
Returns an abi-encoded serialization of the order. This serialized format is passed into the corresponding reactor contract for execution.
getSigner(signature)
Recovers the address which created the given signature over the order. Used to determine the order maker.
permitData()
Returns the domain, types, and values used to generate an EIP-712 signature over the order. Note that this signature both approves the release of the order's input tokens and the execution of the order itself.
hash()
Returns the order hash. This is used as a key to track order fulfillment on-chain. It may also be useful as a unique order identifier for off-chain purposes.
FAQs
SDK for the UniswapX protocol
The npm package @uniswap/uniswapx-sdk receives a total of 2,335 weekly downloads. As such, @uniswap/uniswapx-sdk popularity was classified as popular.
We found that @uniswap/uniswapx-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 23 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.