
Research
Security News
Malicious npm Packages Target BSC and Ethereum to Drain Crypto Wallets
Socket uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
@rolla-finance/mm-api-client
Advanced tools
This package contains
The REST client is generated from the OpenAPI specification, is type-safe and easy to use.
npm install @rolla-finance/mm-api-client
Some of the calls that the client makes require jwt token authentication, generated using Sign-In with Ethereum. For that reason we require that you provide private key and chain id that we use to generate the authentication string, or provide a function that returns the authentication string. These credentials are used to generate the jwt token that is used for authentication. MM api client automatically refreshes the token when it expires.
The client uses Axios for http requests. You can pass in an existing Axios instance as well as other axios options in the second constructor argument.
Basic api client usage is as follows:
import { RollaApiClient } from '@rolla-finance/mm-api-client';
const client = new RollaApiClient({
privateKey: 'private_key',
chainId: 96,
});
// or construct with a function that returns the authentication string
const apiClient = new RollaApiClient(() =>
someFunctionToGetAuthenticationString()
);
const assetsResponse = await client.getAllAssets();
await client.getMarketMakerActiveQuotes({
optionAddress: '0x1',
underlyingAddress: '0x2',
});
// etc.
Websocket is used for receiving quote requests and metatransactions. The client is a wrapper around the ws package. As a market maker receiving data, you need to authenticate with the server. The authentication is done using a similar mechanism as the REST api, using ethereum private key and chain id.
import {
MarketMakerQuoteRequestDto,
MarketMakerQuoteResponseDto,
RollaWS,
RollaApiClient
} from "@rolla-finance/mm-api-client";
export const apiClient = new RollaApiClient({
privateKey: 'private_key',
chainId: 96,
});
const rollaWs = await apiClient.initRollaWS({
// if set to true, this will generate additional logs
debugMode: true,
// how many times to retry connecting to the server until giving up
retryCount: Infinity,
// how long to wait between retries
retryInterval: 1000,
});
// subscribe to quote requests, this will call the provided function when one or more quote requests are received
rollaWs.subscribeToQuoteRequests(listenAndRespondToQuotes);
// subscribe to meta transactions, this will call the provided function when one or more meta transactions are received
rollaWs.subscribeToMetaTxs(listenAndRespondToMetaTransactions);
const listenAndRespondToQuotes = async (requests: MarketMakerQuoteRequestDto[]) {
const responses = await yourLogicForGeneratingQuotes(requests);
if (responses.length) {
await apiClient.postQuoteResponses({
marketMakerQuoteResponseDto: responses,
});
}
}
const listenAndRespondToMetaTransactions = async (lastLookRequests: SignedMetaTransactionDto[]) {
const signedResponses = await yourLogicForProcessingLastLookResponses(lastLookRequests);
await apiClient.postMetaTransactionResponses({
lastLookResponseWithOrderSignatureDto: signedResponses,
});
}
BSL-1.0
FAQs
Client library to interact with the Rolla ecosystem
The npm package @rolla-finance/mm-api-client receives a total of 0 weekly downloads. As such, @rolla-finance/mm-api-client popularity was classified as not popular.
We found that @rolla-finance/mm-api-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
Security News
TC39 advances 9 JavaScript proposals, including Array.fromAsync, Error.isError, and Explicit Resource Management, which are now headed into the ECMAScript spec.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.