1.1.7 • Published 4 months ago
ph-typescript-lib-uniswap v1.1.7
Introduction
Uniswap wrapper - original source code taken from here. Adapted for the NPM package publishing and downstream usages purposes.
Installations
- Node.js (version >= 18.10.0)
- Visual Studio Code (and "Prettier - Code formatter" extension)
Setup
- Prerequisites:
- must have installed tools from the "Installations" section
- must have checked out / cloned source code from this repository
Open up the cloned repository/project/folder and run following commands in the given order, one by one:
npm install npm run build
Both of the above commands should have completed successfully, and should have not caused any "package.json" or "package-lock.json" changes.
Example balance fetch
import { generatePrivateKeyAndContractAddress, UniswapClient } from '.';
(async function () {
const { key, address, contract } = await generatePrivateKeyAndContractAddress(
'mnemonic',
'USDC'
);
const client = new UniswapClient({
privKey: key,
});
try {
console.log(await client.getBalance(contract ?? address));
} catch (e) {
console.error(e);
}
})();