@renegade-fi/core
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -10,5 +10,2 @@ import { ADMIN_OPEN_ORDERS_ROUTE } from '../constants.js'; | ||
} | ||
if (parameters.includeFillable) { | ||
url.searchParams.set('include_fillable', String(true)); | ||
} | ||
const res = await getRelayerWithAdmin(config, url.toString()); | ||
@@ -18,4 +15,4 @@ if (!res.orders) { | ||
} | ||
return new Map(res.orders.map((order) => [order.order.id, order])); | ||
return res.orders; | ||
} | ||
//# sourceMappingURL=getOpenOrders.js.map |
@@ -7,3 +7,7 @@ import { ADMIN_ORDER_METADATA_ROUTE } from '../constants.js'; | ||
const { getRelayerBaseUrl } = config; | ||
const res = await getRelayerWithAdmin(config, getRelayerBaseUrl(ADMIN_ORDER_METADATA_ROUTE(id))); | ||
const url = new URL(getRelayerBaseUrl(ADMIN_ORDER_METADATA_ROUTE(id))); | ||
if (parameters.includeFillable) { | ||
url.searchParams.set('include_fillable', String(true)); | ||
} | ||
const res = await getRelayerWithAdmin(config, url.toString()); | ||
if (!res.order) { | ||
@@ -10,0 +14,0 @@ throw new BaseError('No order found'); |
@@ -125,2 +125,7 @@ import invariant from 'tiny-invariant'; | ||
export const ADMIN_GET_ORDER_MATCHING_POOL_ROUTE = (order_id) => `/admin/orders/${order_id}/matching-pool`; | ||
// Route to get all the matchable order IDs for a given wallet | ||
export const ADMIN_WALLET_MATCHABLE_ORDER_IDS_ROUTE = (wallet_id) => `/admin/wallet/${wallet_id}/matchable-order-ids`; | ||
// The admin wallet updates topic, streams opaque event indicating | ||
// updates for all wallets | ||
export const WS_ADMIN_WALLET_UPDATES_ROUTE = '/v0/admin/wallet-updates'; | ||
//////////////////////////////////////////////////////////////////////////////// | ||
@@ -127,0 +132,0 @@ // Price Reporter |
@@ -33,2 +33,3 @@ //////////////////////////////////////////////////////////////////////////////// | ||
export { getWalletId, } from '../actions/getWalletId.js'; | ||
export { getWalletMatchableOrderIds, } from '../actions/getWalletMatchableOrderIds.js'; | ||
export { lookupWallet, } from '../actions/lookupWallet.js'; | ||
@@ -35,0 +36,0 @@ export { payFees } from '../actions/payFees.js'; |
@@ -28,2 +28,3 @@ //////////////////////////////////////////////////////////////////////////////// | ||
export { getWalletId, } from '../actions/getWalletId.js'; | ||
export { getWalletMatchableOrderIds, } from '../actions/getWalletMatchableOrderIds.js'; | ||
export { lookupWallet, } from '../actions/lookupWallet.js'; | ||
@@ -30,0 +31,0 @@ export { payFees, } from '../actions/payFees.js'; |
@@ -126,3 +126,4 @@ import axios from 'axios'; | ||
}; | ||
const headersWithAuth = addExpiringAuthToHeaders(config, path, headers, '', symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
const headersWithAuth = addExpiringAuthToHeaders(config, path, headers, '', // Body | ||
symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
return await getRelayerRaw(url, headersWithAuth); | ||
@@ -138,3 +139,4 @@ } | ||
}; | ||
const headersWithAuth = addExpiringAuthToHeaders(config, path, headers, '', symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
const headersWithAuth = addExpiringAuthToHeaders(config, path, headers, '', // Body | ||
symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
return await getRelayerRaw(url, headersWithAuth); | ||
@@ -141,0 +143,0 @@ } |
@@ -137,3 +137,4 @@ import { getSymmetricKey } from '../actions/getSymmetricKey.js'; | ||
const symmetricKey = getSymmetricKey(this.config); | ||
return addExpiringAuthToHeaders(this.config, body.topic, {}, JSON.stringify(body), symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
return addExpiringAuthToHeaders(this.config, body.topic, {}, // Headers | ||
JSON.stringify(body), symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
} | ||
@@ -146,3 +147,4 @@ buildAdminAuthHeaders(body) { | ||
const symmetricKey = this.config.utils.b64_to_hex_hmac_key(adminKey); | ||
return addExpiringAuthToHeaders(this.config, body.topic, {}, JSON.stringify(body), symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
return addExpiringAuthToHeaders(this.config, body.topic, {}, // Headers | ||
JSON.stringify(body), symmetricKey, SIG_EXPIRATION_BUFFER_MS); | ||
} | ||
@@ -149,0 +151,0 @@ cleanup() { |
import type { Config } from '../createConfig.js'; | ||
import { type BaseErrorType } from '../errors/base.js'; | ||
import type { OpenOrder } from '../types/order.js'; | ||
export type GetOpenOrdersParams = { | ||
matchingPool?: string; | ||
includeFillable?: boolean; | ||
}; | ||
export type GetOpenOrdersReturnType = Map<string, OpenOrder>; | ||
export type GetOpenOrdersReturnType = string[]; | ||
export type GetOpenOrdersErrorType = BaseErrorType; | ||
export declare function getOpenOrders(config: Config, parameters?: GetOpenOrdersParams): Promise<GetOpenOrdersReturnType>; | ||
//# sourceMappingURL=getOpenOrders.d.ts.map |
import type { Config } from '../createConfig.js'; | ||
import { type BaseErrorType } from '../errors/base.js'; | ||
import type { OrderMetadata } from '../types/order.js'; | ||
import type { AdminOrderMetadata } from '../types/order.js'; | ||
export type GetOrderMetadataParameters = { | ||
id: string; | ||
includeFillable?: boolean; | ||
}; | ||
export type GetOrderMetadataReturnType = OrderMetadata; | ||
export type GetOrderMetadataReturnType = AdminOrderMetadata; | ||
export type GetOrderMetadataErrorType = BaseErrorType; | ||
export declare function getOrderMetadata(config: Config, parameters: GetOrderMetadataParameters): Promise<GetOrderMetadataReturnType>; | ||
//# sourceMappingURL=getOrderMetadata.d.ts.map |
@@ -49,2 +49,4 @@ import type { Address } from 'viem'; | ||
export declare const ADMIN_GET_ORDER_MATCHING_POOL_ROUTE: (order_id: string) => string; | ||
export declare const ADMIN_WALLET_MATCHABLE_ORDER_IDS_ROUTE: (wallet_id: string) => string; | ||
export declare const WS_ADMIN_WALLET_UPDATES_ROUTE = "/v0/admin/wallet-updates"; | ||
export declare const PRICE_REPORTER_TOPIC: (exchange: string, base: Address, quote: Address) => string; | ||
@@ -51,0 +53,0 @@ export declare const PRICE_REPORTER_ROUTE: (exchange: string, base: Address, quote: Address) => string; |
@@ -30,2 +30,3 @@ export { type AssignOrderParameters, assignOrder, } from '../actions/assignOrder.js'; | ||
export { type GetWalletIdReturnType, getWalletId, } from '../actions/getWalletId.js'; | ||
export { type GetWalletMatchableOrderIdsParameters, type GetWalletMatchableOrderIdsReturnType, type GetWalletMatchableOrderIdsErrorType, getWalletMatchableOrderIds, } from '../actions/getWalletMatchableOrderIds.js'; | ||
export { type LookupWalletReturnType, lookupWallet, } from '../actions/lookupWallet.js'; | ||
@@ -32,0 +33,0 @@ export { type PayFeesReturnType, payFees } from '../actions/payFees.js'; |
@@ -25,2 +25,3 @@ export { type CancelOrderRequestErrorType, type CancelOrderRequestParameters, type CancelOrderRequestReturnType, cancelOrderRequest, } from '../actions/cancelOrderRequest.js'; | ||
export { type GetWalletIdReturnType, getWalletId, } from '../actions/getWalletId.js'; | ||
export { type GetWalletMatchableOrderIdsParameters, type GetWalletMatchableOrderIdsReturnType, type GetWalletMatchableOrderIdsErrorType, getWalletMatchableOrderIds, } from '../actions/getWalletMatchableOrderIds.js'; | ||
export { type LookupWalletReturnType, lookupWallet, } from '../actions/lookupWallet.js'; | ||
@@ -27,0 +28,0 @@ export { type PayFeesReturnType, type PayFeesErrorType, payFees, } from '../actions/payFees.js'; |
@@ -10,3 +10,2 @@ import { type GetOpenOrdersParams, type GetOpenOrdersReturnType } from '../actions/getOpenOrders.js'; | ||
matchingPool?: string | undefined; | ||
includeFillable?: boolean | undefined; | ||
scopeKey?: string | undefined; | ||
@@ -21,3 +20,2 @@ }]; | ||
matchingPool?: string | undefined; | ||
includeFillable?: boolean | undefined; | ||
scopeKey?: string | undefined; | ||
@@ -30,3 +28,2 @@ }]; | ||
matchingPool?: string | undefined; | ||
includeFillable?: boolean | undefined; | ||
scopeKey?: string | undefined; | ||
@@ -33,0 +30,0 @@ }]; |
@@ -10,2 +10,3 @@ import { type GetOrderMetadataParameters, type GetOrderMetadataReturnType } from '../actions/getOrderMetadata.js'; | ||
id: string; | ||
includeFillable?: boolean | undefined; | ||
scopeKey?: string | undefined; | ||
@@ -17,5 +18,6 @@ }]; | ||
direction?: unknown; | ||
}) => Promise<import("../types/order.js").OrderMetadata>; | ||
}) => Promise<import("../types/order.js").AdminOrderMetadata>; | ||
readonly queryKey: readonly ["order-metadata", { | ||
id: string; | ||
includeFillable?: boolean | undefined; | ||
scopeKey?: string | undefined; | ||
@@ -28,2 +30,3 @@ }]; | ||
id: string; | ||
includeFillable?: boolean | undefined; | ||
scopeKey?: string | undefined; | ||
@@ -30,0 +33,0 @@ }]; |
@@ -34,3 +34,3 @@ export type Order = { | ||
}; | ||
export type OpenOrder = { | ||
export type AdminOrderMetadata = { | ||
order: OrderMetadata; | ||
@@ -37,0 +37,0 @@ wallet_id: string; |
{ | ||
"name": "@renegade-fi/core", | ||
"description": "VanillaJS library for Renegade", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
import { ADMIN_OPEN_ORDERS_ROUTE } from '../constants.js' | ||
import type { Config } from '../createConfig.js' | ||
import { BaseError, type BaseErrorType } from '../errors/base.js' | ||
import type { OpenOrder } from '../types/order.js' | ||
import { getRelayerWithAdmin } from '../utils/http.js' | ||
@@ -9,6 +8,5 @@ | ||
matchingPool?: string | ||
includeFillable?: boolean | ||
} | ||
export type GetOpenOrdersReturnType = Map<string, OpenOrder> | ||
export type GetOpenOrdersReturnType = string[] | ||
@@ -29,6 +27,2 @@ export type GetOpenOrdersErrorType = BaseErrorType | ||
if (parameters.includeFillable) { | ||
url.searchParams.set('include_fillable', String(true)) | ||
} | ||
const res = await getRelayerWithAdmin(config, url.toString()) | ||
@@ -39,3 +33,3 @@ | ||
} | ||
return new Map(res.orders.map((order: OpenOrder) => [order.order.id, order])) | ||
return res.orders | ||
} |
import { ADMIN_ORDER_METADATA_ROUTE } from '../constants.js' | ||
import type { Config } from '../createConfig.js' | ||
import { BaseError, type BaseErrorType } from '../errors/base.js' | ||
import type { OrderMetadata } from '../types/order.js' | ||
import type { AdminOrderMetadata } from '../types/order.js' | ||
import { getRelayerWithAdmin } from '../utils/http.js' | ||
export type GetOrderMetadataParameters = { id: string } | ||
export type GetOrderMetadataParameters = { | ||
id: string | ||
includeFillable?: boolean | ||
} | ||
export type GetOrderMetadataReturnType = OrderMetadata | ||
export type GetOrderMetadataReturnType = AdminOrderMetadata | ||
@@ -20,7 +23,10 @@ export type GetOrderMetadataErrorType = BaseErrorType | ||
const res = await getRelayerWithAdmin( | ||
config, | ||
getRelayerBaseUrl(ADMIN_ORDER_METADATA_ROUTE(id)), | ||
) | ||
const url = new URL(getRelayerBaseUrl(ADMIN_ORDER_METADATA_ROUTE(id))) | ||
if (parameters.includeFillable) { | ||
url.searchParams.set('include_fillable', String(true)) | ||
} | ||
const res = await getRelayerWithAdmin(config, url.toString()) | ||
if (!res.order) { | ||
@@ -27,0 +33,0 @@ throw new BaseError('No order found') |
@@ -178,3 +178,10 @@ import invariant from 'tiny-invariant' | ||
`/admin/orders/${order_id}/matching-pool` | ||
// Route to get all the matchable order IDs for a given wallet | ||
export const ADMIN_WALLET_MATCHABLE_ORDER_IDS_ROUTE = (wallet_id: string) => | ||
`/admin/wallet/${wallet_id}/matchable-order-ids` | ||
// The admin wallet updates topic, streams opaque event indicating | ||
// updates for all wallets | ||
export const WS_ADMIN_WALLET_UPDATES_ROUTE = '/v0/admin/wallet-updates' | ||
//////////////////////////////////////////////////////////////////////////////// | ||
@@ -181,0 +188,0 @@ // Price Reporter |
@@ -159,2 +159,9 @@ //////////////////////////////////////////////////////////////////////////////// | ||
export { | ||
type GetWalletMatchableOrderIdsParameters, | ||
type GetWalletMatchableOrderIdsReturnType, | ||
type GetWalletMatchableOrderIdsErrorType, | ||
getWalletMatchableOrderIds, | ||
} from '../actions/getWalletMatchableOrderIds.js' | ||
export { | ||
type LookupWalletReturnType, | ||
@@ -161,0 +168,0 @@ lookupWallet, |
@@ -151,2 +151,9 @@ //////////////////////////////////////////////////////////////////////////////// | ||
export { | ||
type GetWalletMatchableOrderIdsParameters, | ||
type GetWalletMatchableOrderIdsReturnType, | ||
type GetWalletMatchableOrderIdsErrorType, | ||
getWalletMatchableOrderIds, | ||
} from '../actions/getWalletMatchableOrderIds.js' | ||
export { | ||
type LookupWalletReturnType, | ||
@@ -153,0 +160,0 @@ lookupWallet, |
@@ -43,3 +43,3 @@ export type Order = { | ||
export type OpenOrder = { | ||
export type AdminOrderMetadata = { | ||
order: OrderMetadata | ||
@@ -46,0 +46,0 @@ wallet_id: string |
@@ -5,4 +5,38 @@ /* tslint:disable */ | ||
* @param {string} seed | ||
* @param {bigint} nonce | ||
* @returns {any} | ||
*/ | ||
export function derive_sk_root_from_seed(seed: string, nonce: bigint): any; | ||
/** | ||
* @param {string} seed | ||
* @param {bigint} nonce | ||
* @returns {any} | ||
*/ | ||
export function get_pk_root(seed: string, nonce: bigint): any; | ||
/** | ||
* @param {string} seed | ||
* @param {bigint} nonce | ||
* @returns {any[]} | ||
*/ | ||
export function get_pk_root_scalars(seed: string, nonce: bigint): any[]; | ||
/** | ||
* @param {string} seed | ||
* @returns {any} | ||
*/ | ||
export function get_symmetric_key(seed: string): any; | ||
/** | ||
* @param {string} sk_root | ||
* @param {string} message | ||
* @returns {any} | ||
*/ | ||
export function sign_message(sk_root: string, message: string): any; | ||
/** | ||
* @param {string} value | ||
* @returns {any} | ||
*/ | ||
export function bigint_to_limbs(value: string): any; | ||
/** | ||
* @param {string} seed | ||
* @returns {any} | ||
*/ | ||
export function create_wallet(seed: string): any; | ||
@@ -96,36 +130,2 @@ /** | ||
/** | ||
* @param {string} seed | ||
* @param {bigint} nonce | ||
* @returns {any} | ||
*/ | ||
export function derive_sk_root_from_seed(seed: string, nonce: bigint): any; | ||
/** | ||
* @param {string} seed | ||
* @param {bigint} nonce | ||
* @returns {any} | ||
*/ | ||
export function get_pk_root(seed: string, nonce: bigint): any; | ||
/** | ||
* @param {string} seed | ||
* @param {bigint} nonce | ||
* @returns {any[]} | ||
*/ | ||
export function get_pk_root_scalars(seed: string, nonce: bigint): any[]; | ||
/** | ||
* @param {string} seed | ||
* @returns {any} | ||
*/ | ||
export function get_symmetric_key(seed: string): any; | ||
/** | ||
* @param {string} sk_root | ||
* @param {string} message | ||
* @returns {any} | ||
*/ | ||
export function sign_message(sk_root: string, message: string): any; | ||
/** | ||
* @param {string} value | ||
* @returns {any} | ||
*/ | ||
export function bigint_to_limbs(value: string): any; | ||
/** | ||
* @param {string} path | ||
@@ -132,0 +132,0 @@ * @param {any} headers |
@@ -163,3 +163,3 @@ import axios from 'axios' | ||
headers, | ||
'', | ||
'', // Body | ||
symmetricKey, | ||
@@ -184,3 +184,3 @@ SIG_EXPIRATION_BUFFER_MS, | ||
headers, | ||
'', | ||
'', // Body | ||
symmetricKey, | ||
@@ -187,0 +187,0 @@ SIG_EXPIRATION_BUFFER_MS, |
@@ -157,3 +157,3 @@ import { getSymmetricKey } from '../actions/getSymmetricKey.js' | ||
body.topic, | ||
{}, | ||
{}, // Headers | ||
JSON.stringify(body), | ||
@@ -177,3 +177,3 @@ symmetricKey, | ||
body.topic, | ||
{}, | ||
{}, // Headers | ||
JSON.stringify(body), | ||
@@ -180,0 +180,0 @@ symmetricKey, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
444
7939
715803