@instadapp/token-price
v0.0.1
Published
<!-- automd:badges color=yellow -->
Keywords
Readme
@instadapp/token-price
Usage
Install the package:
pnpm add @instadapp/token-priceimport { createPublicClient, http } from "viem";
import { arbitrum } from "viem/chains";
import { getTokenPrice } from "@instadapp/token-price";
const client = createPublicClient({
chain: arbitrum,
transport: http(),
});
const price = await getTokenPrice(
client,
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
400567257n,
);
console.log(price); // 3171.84671802import { createPublicClient, http } from "viem";
import { arbitrum } from "viem/chains";
import { TokenPriceActions } from "@instadapp/token-price";
const client = createPublicClient({
chain: arbitrum,
transport: http(),
}).extend(TokenPriceActions);
const price = await client.getTokenPrice(
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
400567257n,
);
console.log(price); // 3171.84671802Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable - Install dependencies using
pnpm install - Run interactive tests using
pnpm dev
License
Published under the MIT license 💛.
