@renegade-fi/node
Version:
Node.js library for Renegade
53 lines • 1.91 kB
JavaScript
import { createConfig } from "@renegade-fi/core";
import { createOrderInMatchingPool, } from "@renegade-fi/core/actions";
import * as rustUtils from "../../../renegade-utils/index.js";
import { RenegadeClient } from "./base.js";
/**
* The client for interacting with the Renegade relayer's admin API, with a keychain.
*/
export class AdminRenegadeClient extends RenegadeClient {
/**
* @internal
*/
constructor(params) {
const { apiKey, ...renegadeParams } = params;
super(renegadeParams);
Object.defineProperty(this, "apiKey", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.apiKey = apiKey;
}
/**
* Create an admin client for any chain by seed.
*
* @param params.chainId the chain ID (e.g. CHAIN_IDS.ArbitrumMainnet)
* @param params.seed your 0x… seed
* @param params.apiKey your admin API key
* @param params.overrides optional overrides for SDK config values
*/
static new({ chainId, seed, apiKey, overrides, }) {
return new AdminRenegadeClient({ chainId, mode: "seed", seed, apiKey, overrides });
}
/**
* Create an order in a matching pool
*
* @param params.matchingPool – the matching pool address
*/
async createOrderInMatchingPool(params) {
const config = createConfig({
darkPoolAddress: this.configv2.darkpoolAddress,
priceReporterUrl: this.configv2.priceReporterUrl,
relayerUrl: this.configv2.relayerUrl,
chainId: this.configv2.id,
utils: rustUtils,
// Inject the admin key
adminKey: this.apiKey,
});
config.setState((s) => ({ ...s, seed: this.seed }));
return createOrderInMatchingPool(config, params);
}
}
//# sourceMappingURL=admin.js.map