@renegade-fi/core
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -7,3 +7,3 @@ import invariant from 'tiny-invariant'; | ||
export async function getExternalMatchBundle(config, parameters) { | ||
const { base, quote, side, amount, minFillSize = BigInt(0) } = parameters; | ||
const { order: { base, quote, side, baseAmount = BigInt(0), quoteAmount = BigInt(0), minFillSize = BigInt(0), }, doGasEstimation = false, } = parameters; | ||
const { apiSecret, apiKey } = config; | ||
@@ -13,3 +13,3 @@ invariant(apiSecret, 'API secret not specified in config'); | ||
const symmetricKey = config.utils.b64_to_hex_hmac_key(apiSecret); | ||
const body = config.utils.new_external_order(base, quote, side, toHex(amount), toHex(minFillSize)); | ||
const body = config.utils.new_external_order(base, quote, side, toHex(baseAmount), toHex(quoteAmount), toHex(minFillSize), doGasEstimation); | ||
const res = await postWithSymmetricKey(config, { | ||
@@ -16,0 +16,0 @@ url: config.getAuthServerUrl(REQUEST_EXTERNAL_MATCH_ROUTE), |
@@ -5,7 +5,11 @@ import type { AuthConfig } from '../createAuthConfig.js'; | ||
export type GetExternalMatchBundleParameters = { | ||
base: `0x${string}`; | ||
quote: `0x${string}`; | ||
side: 'buy' | 'sell'; | ||
amount: bigint; | ||
minFillSize?: bigint; | ||
order: { | ||
base: `0x${string}`; | ||
quote: `0x${string}`; | ||
side: 'buy' | 'sell'; | ||
baseAmount?: bigint; | ||
quoteAmount?: bigint; | ||
minFillSize?: bigint; | ||
}; | ||
doGasEstimation?: boolean; | ||
}; | ||
@@ -12,0 +16,0 @@ export type GetExternalMatchBundleReturnType = ExternalMatchBundle; |
@@ -15,2 +15,3 @@ import type { AccessList } from 'viem'; | ||
accessList: AccessList; | ||
gas?: `0x${string}`; | ||
}; | ||
@@ -17,0 +18,0 @@ export type ExternalMatchBundle = { |
{ | ||
"name": "@renegade-fi/core", | ||
"description": "VanillaJS library for Renegade", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -13,7 +13,11 @@ import invariant from 'tiny-invariant' | ||
export type GetExternalMatchBundleParameters = { | ||
base: `0x${string}` | ||
quote: `0x${string}` | ||
side: 'buy' | 'sell' | ||
amount: bigint | ||
minFillSize?: bigint | ||
order: { | ||
base: `0x${string}` | ||
quote: `0x${string}` | ||
side: 'buy' | 'sell' | ||
baseAmount?: bigint | ||
quoteAmount?: bigint | ||
minFillSize?: bigint | ||
} | ||
doGasEstimation?: boolean | ||
} | ||
@@ -29,3 +33,13 @@ | ||
): Promise<GetExternalMatchBundleReturnType> { | ||
const { base, quote, side, amount, minFillSize = BigInt(0) } = parameters | ||
const { | ||
order: { | ||
base, | ||
quote, | ||
side, | ||
baseAmount = BigInt(0), | ||
quoteAmount = BigInt(0), | ||
minFillSize = BigInt(0), | ||
}, | ||
doGasEstimation = false, | ||
} = parameters | ||
const { apiSecret, apiKey } = config | ||
@@ -40,4 +54,6 @@ invariant(apiSecret, 'API secret not specified in config') | ||
side, | ||
toHex(amount), | ||
toHex(baseAmount), | ||
toHex(quoteAmount), | ||
toHex(minFillSize), | ||
doGasEstimation, | ||
) | ||
@@ -44,0 +60,0 @@ |
@@ -17,2 +17,3 @@ import type { AccessList } from 'viem' | ||
accessList: AccessList | ||
gas?: `0x${string}` | ||
} | ||
@@ -19,0 +20,0 @@ |
@@ -98,7 +98,9 @@ /* tslint:disable */ | ||
* @param {string} side | ||
* @param {string} amount | ||
* @param {string} base_amount | ||
* @param {string} quote_amount | ||
* @param {string} min_fill_size | ||
* @param {boolean} do_gas_estimation | ||
* @returns {any} | ||
*/ | ||
export function new_external_order(base_mint: string, quote_mint: string, side: string, amount: string, min_fill_size: string): any; | ||
export function new_external_order(base_mint: string, quote_mint: string, side: string, base_amount: string, quote_amount: string, min_fill_size: string, do_gas_estimation: boolean): any; | ||
/** | ||
@@ -105,0 +107,0 @@ * @param {string} path |
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
748370
8209