Skip to content

Commit

Permalink
Merge pull request #48 from Jeff-CCH/fix/zeroex-taker-address
Browse files Browse the repository at this point in the history
fix: ZeroEx takerAddress
  • Loading branch information
Jeff-CCH authored Apr 10, 2024
2 parents f320780 + 45d2a5b commit 876f00c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-penguins-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocolink/logics': patch
---

fix ZeroEx takerAddress
13 changes: 2 additions & 11 deletions src/logics/zeroex-v4/logic.swap-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,8 @@ export class SwapTokenLogic

async quote(params: SwapTokenLogicParams) {
try {
const {
input,
tokenOut,
slippage,
excludedSources,
includedSources,
apiKey,
takerAddress: takerAddressInput,
} = params;
const { input, tokenOut, slippage, excludedSources, includedSources, apiKey, takerAddress } = params;
const slippagePercentage = slippage != null ? slippageToZeroEx(slippage) : undefined;
const takerAddress = takerAddressInput && (await this.calcAgent(takerAddressInput));
const url = this.getAPIBaseUrl(this.chainId) + `swap/v1/price`;
const {
data: { buyAmount },
Expand Down Expand Up @@ -114,7 +105,7 @@ export class SwapTokenLogic
async build(fields: SwapTokenLogicFields, { account }: SwapTokenLogicOptions) {
const { input, output, slippage, excludedSources, includedSources, apiKey } = fields;
const slippagePercentage = slippage != null ? slippageToZeroEx(slippage) : undefined;
const takerAddress = await this.calcAgent(account);
const takerAddress = account;
const url = this.getAPIBaseUrl(this.chainId) + `swap/v1/quote`;
const {
data: { buyAmount, data, to, allowanceTarget: approveTo },
Expand Down

0 comments on commit 876f00c

Please sign in to comment.