This library is intended to help anyone interested in downloading, parsing, and analyzing market making transactions in Meteora DLMM Pools. A great use case for this library is the Meteora DLMM Profit Analysis Tool. The library was created to save parsed transaction data in the browser, to speed up future loads of the tool since only the newest transactions would need to be downloaded. The transactions are stored in a SQLite database, and in NodeJS environments they are persisted in a local file and in Browser environments they are persisted in the IndexedDb (using Dexie.js).
- Downloads and parses Meteora DLMM transactions from the blockchain
- Downloads Meteora DLMM transactions from the Meteora DLMM API, to obtain estimated USD values of transactions
- Persists data in a SQLite database
- SQLite database can be persisted both in NodeJS and browser environments
Add the library with your favorite package manager:
npm add [email protected]:GeekLad/meteora-dlmm-db
yarn add [email protected]:GeekLad/meteora-dlmm-db
bun add [email protected]:GeekLad/meteora-dlmm-db
To use it in a browser, you'll need to configure your bundling tool to stub the
fs
package. In the Meteora DLMM Profit Analysis Tool, the next.config.js
file looks like this:
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
productionBrowserSourceMaps: true,
webpack: (config) => {
config.resolve.fallback = {
fs: false,
};
return config;
},
};
module.exports = nextConfig;
To create a new database instance:
const db = await MeteoraDlmmDb.create();
To load an existing database instance:
const db = await MeteoraDlmmDb.load();
Note: If you use the .load()
method and the database doesn't exist, it
will create it for you. If you call the .create()
method and there is an
existing databse, it will be overwritten with a new, blank databse.
To download transactions:
const downloader = db.download({
rpc: "<Valid RPC URL goes here>",
account: "<Valid Solana Wallet Address goes here>",
});
This creates a downloader instance, which has some properties & methods you can use to control the download process. To cancel the download:
db.cancel();
This will stop the downloader from downloading anymore transactions from the
blockchain. However, it will continue to download the USD values for the
transactions from the Meteora API.
If you make a second call to the .cancel()
method, it will terminate the
downloading of the UDS values from the API.
To read all transactions:
db.getTransactions();
This will read the data from the v_transactions
view in the database.