mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
fix: change asset names to asset addresses
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.76-rc102",
|
||||
"version": "0.20.76-rc103",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -66,20 +66,18 @@ export async function generateSwapCalldataWithUnit({
|
||||
}
|
||||
const wethAddress = safeGet(unit.contracts, "WETH");
|
||||
const curveRegistryAddress = safeGet(unit.contracts, "curveRegistry");
|
||||
const { assetToAddress, swapExecutorContractAddress, exchangeContractAddress } = await simpleFetch(
|
||||
const { swapExecutorContractAddress, exchangeContractAddress } = await simpleFetch(
|
||||
unit.blockchainService.getInfo
|
||||
)();
|
||||
|
||||
const arrayLikePathCopy = cloneDeep(arrayLikePath);
|
||||
let path = SafeArray.from(arrayLikePathCopy);
|
||||
|
||||
path = SafeArray.from(arrayLikePathCopy).map((swapInfo) => {
|
||||
swapInfo.assetIn = assetToAddress[swapInfo.assetIn] ?? swapInfo.assetIn
|
||||
swapInfo.assetOut = assetToAddress[swapInfo.assetOut] ?? swapInfo.assetOut
|
||||
swapInfo.assetIn = swapInfo.assetIn.toLowerCase()
|
||||
swapInfo.assetOut = swapInfo.assetOut.toLowerCase()
|
||||
return swapInfo;
|
||||
});
|
||||
path = SafeArray.from(arrayLikePathCopy).map((swapInfo) => ({
|
||||
...swapInfo,
|
||||
assetIn: swapInfo.assetAddressIn.toLowerCase(),
|
||||
assetOut: swapInfo.assetAddressOut.toLowerCase(),
|
||||
}));
|
||||
|
||||
return await generateSwapCalldata({
|
||||
amount,
|
||||
|
||||
@@ -506,6 +506,8 @@ class AggregatorWS {
|
||||
assetIn: path.ai,
|
||||
assetOut: path.ao,
|
||||
factory: path.f,
|
||||
assetAddressIn: path.aai,
|
||||
assetAddressOut: path.aao,
|
||||
})),
|
||||
poolOptimal: json.po,
|
||||
...(json.oi) && {
|
||||
|
||||
@@ -40,6 +40,8 @@ const swapInfoSchemaBase = baseMessageSchema.extend({
|
||||
ai: z.string().toUpperCase(), // asset in
|
||||
ao: z.string().toUpperCase(), // asset out
|
||||
f: factorySchema, // factory
|
||||
aai: z.string(), // asset address in
|
||||
aao: z.string(), // asset address out
|
||||
})),
|
||||
usd: z.object({ // USD info of this swap, nullable
|
||||
aa: z.number().optional(), // available amount in, USD
|
||||
|
||||
@@ -176,6 +176,8 @@ export type SingleSwap = {
|
||||
assetIn: string
|
||||
assetOut: string
|
||||
factory: Factory
|
||||
assetAddressIn: string
|
||||
assetAddressOut: string
|
||||
}
|
||||
|
||||
export type SwapInfoBase = {
|
||||
|
||||
Reference in New Issue
Block a user