{"id":14958575,"url":"https://github.com/ncookiez/dskit","last_synced_at":"2025-10-24T14:32:07.655Z","repository":{"id":254417463,"uuid":"846467871","full_name":"Ncookiez/dskit","owner":"Ncookiez","description":"A lightweight \"Dapp Survival Kit\" to help applications deliver fully functional experiences without sacrificing decentralization, security or privacy","archived":false,"fork":false,"pushed_at":"2025-01-20T22:18:33.000Z","size":170,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T02:31:00.475Z","etag":null,"topics":["arbitrum","base","blockchain","crypto","ethereum","optimism","prices","privacy","rpc","sdk","swaps","viem","zaps"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ncookiez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T09:18:36.000Z","updated_at":"2025-01-20T22:18:36.000Z","dependencies_parsed_at":"2024-08-23T10:50:48.576Z","dependency_job_id":"d74e5cfc-4c3a-4738-8f7f-f9a8faf8a7c9","html_url":"https://github.com/Ncookiez/dskit","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.26530612244897955","last_synced_commit":"ac2a3829482405627827eb659cfb1ef855205022"},"previous_names":["ncookiez/dskit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ncookiez%2Fdskit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ncookiez%2Fdskit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ncookiez%2Fdskit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ncookiez%2Fdskit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ncookiez","download_url":"https://codeload.github.com/Ncookiez/dskit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237990605,"owners_count":19398460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrum","base","blockchain","crypto","ethereum","optimism","prices","privacy","rpc","sdk","swaps","viem","zaps"],"created_at":"2024-09-24T13:17:26.253Z","updated_at":"2025-10-24T14:32:05.368Z","avatar_url":"https://github.com/Ncookiez.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cspan id=\"header\"\u003e\u003c/span\u003e\n![DSKit](./assets/logo_256.png)\n\n_A lightweight **\"Dapp Survival Kit\"** to help applications deliver fully functional experiences **without** sacrificing decentralization, security or privacy_\n\n---\n\n## Contents\n\n- [Quick Start](#quick-start)\n- [Modules](#modules)\n  - [Swaps](#swaps)\n  - [Prices](#prices)\n  - [Zaps](#zaps)\n  - [Events](#events)\n  - [Blocks](#blocks)\n  - [More](#more-to-come)\n- [Why DSKit?](#why-dskit)\n- [Bringing the \"D\" back to \"Dapp\"](#bringing-the-d-back-to-dapp)\n- [Demo Site](#demo-site)\n\n---\n\n## Quick Start\n\n### Installation\n\n```cli\nnpm i dskit-eth\n```\n\n### Using with an RPC\n\n```js\nimport { DSKit } from 'dskit-eth'\n\nconst dskit = new DSKit({ rpcUrl: 'https://your-privacy-respecting-rpc/' })\n```\n\n### Using with Viem\n\n```js\nimport { DSKit } from \"dskit-eth\"\nimport { createPublicClient } from \"viem\"\n\nconst dskit = new DSKit({\n  viemPublicClient: createPublicClient({ ... })\n})\n```\n\n_More Provider Support Coming Soon..._\n\n---\n\n## Modules\n\n### Swaps\n\nSwap or get quotes from one token to another without any external APIs. Current market support includes LPs on Uniswap V3, Uniswap V2, Velodrome, Aerodrome and Ramses.\n\n#### Example:\n\n```js\n// Get a quote and swap tx data for USDC -\u003e WETH on Optimism\nconst swap = await dskit.swap.route({\n  tokenIn: { address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', decimals: 6, amount: 10n ** 8n }, // USDC\n  tokenOut: { address: '0x4200000000000000000000000000000000000006', decimals: 18 }, // WETH\n  executionOptions: {\n    recipient: '0xbE4FeAE32210f682A41e1C41e3eaF4f8204cD29E'; // Recipient of the WETH\n    slippage: 0.001; // 0.1% slippage\n  }\n})\nconst quoteAmountWeth = swap.quote\nconst swapRequest = swap.request\n```\n\n---\n\n### Prices\n\nGet token prices for your dapp using live onchain market data.\n\n#### Example:\n\n```js\n// Price of WETH in USDC on Optimism\nconst priceOfWethInUsdc = await dskit.price.ofToken({\n  token: {\n    address: '0x4200000000000000000000000000000000000006',\n    decimals: 18\n  },\n  tokenDenominator: {\n    address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',\n    decimals: 6\n  }\n})\n```\n\n---\n\n### Zaps\n\nZap native ETH or tokens into other tokens and bundle actions together.\n\n#### Example:\n\n```js\n// Zap from native ETH on Optimism into the PoolTogether Prize USDC vault.\n// This performs 3 steps in one tx:\n//  1. wraps ETH to WETH\n//  2. swaps WETH to USDC\n//  3. deposits USDC to przUSDC as an additional action\nimport { dolphinAddress, zapRouter } from 'dskit-eth'\nimport { parseAbi } from 'viem'\n\nconst nativeEth = {\n  address: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', // use this for native ETH\n  decimals: 18,\n  amount: 10n ** 12n\n}\n\nconst usdc = {\n  address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',\n  decimals: 6\n}\n\nconst zapTx = await dskit.zap.tx({\n  tokenIn: nativeEth,\n  swapTo: usdc,\n  action: {\n    address: '0x03D3CE84279cB6F54f5e6074ff0F8319d830dafe',\n    abi: parseAbi(['function deposit(uint256,address) returns (uint256)']),\n    functionName: 'deposit',\n    args: [0n, zapRouter[10]],\n    injectedAmountIndex: 4 // replaces the first arg with the output from the swap\n  },\n  tokenOut: { address: '0x03D3CE84279cB6F54f5e6074ff0F8319d830dafe', minAmount: 1n },\n  userAddress: '0xbE4FeAE32210f682A41e1C41e3eaF4f8204cD29E'\n})\n\nconst config = zapTx.config\nconst gasEstimate = zapTx.gasEstimate\nconst zapRequest = zapTx.request\nconst route = zapTx.route\n```\n\n---\n\n### Events\n\nQuery event logs without worrying about rate limits, block range limits, setting up callbacks, etc.\n\n#### Example:\n\n```js\nconst transferEvents = await dskit.event.query(\n  {\n    address: '0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e',\n    event: {\n      type: 'event',\n      name: 'Transfer',\n      inputs: [\n        { indexed: true, name: 'from', type: 'address' },\n        { indexed: true, name: 'to', type: 'address' },\n        { indexed: false, name: 'value', type: 'uint256' }\n      ]\n    },\n    args: { to: '0xbE4FeAE32210f682A41e1C41e3eaF4f8204cD29E' },\n    fromBlock: 16_078_500n,\n    toBlock: 16_235_800n\n  },\n  {\n    maxPageSizeInBlocks: 100_000n,\n    paginationDelayInMs: 500,\n    callback: (log) =\u003e {\n      // handle new event log found (indexing, caching, etc.)\n    }\n  }\n)\n```\n\n---\n\n### Blocks\n\nProvides block tooling for fetching a block within (or close to) a given\ntimestamp range.\n\n#### Examples\n\n```js\nconst block = await dskit.block.nearTimestamp({\n  targetTimestamp: Math.floor(Date.now() / 1000) - 86_400_000, // yesterday\n  targetRangeSeconds: 60\n})\nconst blockNumber = block.number\n```\n\n---\n\n### More to Come...\n\n- Web3 Social Integrations\n- NFT tooling\n\n---\n\n## Why DSKit?\n\n**Third party dependencies** have become commonplace in dapps, but many of these services have significant privacy concerns when it comes to gathering data about their users, and inherently introduce additional dependency risk and fail-points. The number of dapps that would fail if Coingecko, Covalent or Etherscan went down for a few hours or were blocked by a user's ISP is - in our opinion - concerning.\n\n**Domain security** in web3 has been a huge point of failure causing consumers massive losses due to domain takeovers or phishing attacks. Enabling a future where dapps can focus on client-side infrastructure rather than server-side or back-end infrastructure allows dapps to be easily distributed through alternative hosting methods, such as IPFS, Arweave or otherwise. Dapps should not have users - users should have dapps.\n\n---\n\n## Bringing the \"D\" back to \"Dapp\"\n\nDSKit offers functionality previously only easily accessible through third party services and APIs, but through a single data access point: an RPC. This includes features like finding swap routes, arbitrary zap routes such as zapping into ERC4626 vaults, finding token prices, fetching block data given a specific timestamp, event and transaction indexing, and more.\n\nThis increases a dapp's resilience to third party service updates and failures, and assures the user of the privacy of their data. Furthermore, a dapp can easily utilize a network connection specified by the user (ideally linked to their own locally hosted node), at which point the user has a standalone application where all onchain data is being accessed through a source they trust. In such a dapp, a user can have complete confidence that the only data they are publishing is the data they sign onchain.\n\n---\n\n## Demo Site\n\nCheck DSKit in action on the [DSKit Demo Site](https://demo.dskit.eth.limo/)!\n\nThe demo site repository can be found here: https://github.com/Ncookiez/dskit-demo\n\n![DSKit demo site with wallet management, block tools, and more](./assets/demo_site.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncookiez%2Fdskit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncookiez%2Fdskit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncookiez%2Fdskit/lists"}