convert addresslike to string

This commit is contained in:
Steam Deck User
2023-12-18 11:56:27 +04:00
parent 7cd71b2c60
commit b38f0ba424
3 changed files with 10 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.34-rc-2",
"version": "0.20.34-rc-3",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -107,8 +107,8 @@ export async function generateSwapCalldata({
initiatorAddress,
receiverAddress,
path: arrayLikePath,
matcher = ZeroAddress,
feeToken = ZeroAddress,
matcher: matcherAddressLike = ZeroAddress,
feeToken: feeTokenAddressLike = ZeroAddress,
fee = 0,
exchangeContractAddress,
wethAddress: wethAddressLike,
@@ -123,6 +123,8 @@ export async function generateSwapCalldata({
const wethAddress = await addressLikeToString(wethAddressLike);
const curveRegistryAddress = await addressLikeToString(curveRegistryAddressLike);
const swapExecutorContractAddress = await addressLikeToString(swapExecutorContractAddressLike);
const feeToken = await addressLikeToString(feeTokenAddressLike);
const matcher = await addressLikeToString(matcherAddressLike);
let path = SafeArray.from(arrayLikePath);
const { assetIn: srcToken } = path.first();
@@ -333,13 +335,14 @@ async function processMultiFactorySwaps(
}
async function payFeeToMatcher(
matcher: AddressLike,
feeToken: AddressLike,
matcher: string,
feeToken: string,
feeAmount: BigNumberish,
calls: BytesLike[],
swapDescription: LibValidator.SwapDescriptionStruct,
) {
if (feeAmount !== 0n && feeToken === swapDescription.dstToken) {
if (BigInt(feeAmount) !== 0n && feeToken === swapDescription.dstToken) {
const feePaymentCall = generateFeePaymentCall(matcher, feeToken, feeAmount)
calls.push(feePaymentCall)
}

View File

@@ -5,5 +5,5 @@ export async function addressLikeToString(address: AddressLike): Promise<string>
if (typeof address !== 'string') {
address = await address.getAddress()
}
return address
return address.toLowerCase()
}