生成存款地址时出现400错误

huangapple go评论76阅读模式
英文:

Post 400 Error When Trying To Generate DepositAddress

问题

我正在尝试使用AxelarJS SDK中的getDepositAddress。如在此处引用的那样:

const fromChain = CHAINS.TESTNET.POLYGON,
   toChain = CHAINS.TESTNET.AVALANCHE,
   destinationAddress = "0xF16DfB26e1FEc993E085092563ECFAEaDa7eD7fD",
   thisAsset = "wavax-wei";

const depositAddress = await axelarAssetTransfer.getDepositAddress({
   fromChain,
   toChain,
   destinationAddress,
   thisAsset,
   options: {
     shouldUnwrapIntoNative: false,
   },
});
console.log(depositAddress);

这是我在前端使用的代码,但图片中的错误是在浏览器控制台中弹出的。

生成存款地址时出现400错误

英文:

I am trying to use the getDepositAddress from the AxelarJS Sdk. As referenced here

const fromChain = CHAINS.TESTNET.POLYGON,
   toChain = CHAINS.TESTNET.AVALANCHE,
   destinationAddress = "0xF16DfB26e1FEc993E085092563ECFAEaDa7eD7fD",
   thisAsset = "wavax-wei";

 const depositAddress = await axelarAssetTransfer.getDepositAddress({
   fromChain,
   toChain,
   destinationAddress,
   thisAsset,
   options: {
     shouldUnwrapIntoNative: false,
   },
 });
 console.log(depositAddress);

This is the code I use on the frontend but the error in the picture is what pops up in the console browser.

生成存款地址时出现400错误

答案1

得分: 1

看起来您收到了一个错误,因为未将预期的字段传递给获取存款地址函数,或者传递的字段不正确。

您所做的是:

const depositAddress = await axelarAssetTransfer.getDepositAddress({
  fromChain,
  toChain,
  destinationAddress,
  thisAsset,
  options: {
    shouldUnwrapIntoNative: false,
  },
});

而不是

const depositAddress = await axelarAssetTransfer.getDepositAddress({
  fromChain,
  toChain,
  destinationAddress,
  asset: thisAsset,
  options: {
    shouldUnwrapIntoNative: false,
  },
});

您提供给 asset 的键不正确。希望这可以帮助!

英文:

It seems you received an error because the expected field was not passed into the get deposit address function or was incorrect.

What you did was:

 const depositAddress = await axelarAssetTransfer.getDepositAddress({
      fromChain,
      toChain,
      destinationAddress,
      thisAsset,
      options: {
        shouldUnwrapIntoNative: false,
      },
    });

Instead of

const depositAddress = await axelarAssetTransfer.getDepositAddress({
    fromChain,
    toChain,
    destinationAddress,
    asset: thisAsset,
    options: {
      shouldUnwrapIntoNative: false,
    },
  });

The key you provided for the asset was incorrect. I hope this helps!

答案2

得分: 0

谢谢你。我已经解决了。我认为问题是因为我使用了较新版本的Nextjs和Rainbowkit/Wagmi,我确实收到了一个错误,但最终收到了存款地址。

英文:

Thank you for this. I got it working. I think the issue was that I was using a newer version of Nextjs and Rainbowkit/Wagmi and I do receive an error but finally receive the deposit address

huangapple
  • 本文由 发表于 2023年8月4日 06:05:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76831850.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定