Coder Social home page Coder Social logo

Comments (7)

BlazeWasHere avatar BlazeWasHere commented on June 6, 2024

Can you send a minimal reproducible code?

from sdk.

Vaulverin avatar Vaulverin commented on June 6, 2024
import {ethers, providers, Wallet} from 'ethers';
import {Bridge, Networks, Tokens} from '@synapseprotocol/sdk';

const WALLET_PRIVATE_KEY = '';
async function main() {
  const provider = new providers.JsonRpcProvider(process.env.ARBITRUM_RPC);
  const walletFrom = new Wallet(WALLET_PRIVATE_KEY, provider);
  const fromNetwork = Networks.ARBITRUM;
  const toNetwork = Networks.AVALANCHE;
  const tokenFrom = Tokens.ETH;
  const tokenTo = Tokens.WETH_E;
  const amountFrom = ethers.constants.WeiPerEther;
  const synapseBridge = new Bridge.SynapseBridge({
    network: fromNetwork.chainId,
    provider: walletFrom.provider,
  });
  const amountTo = await synapseBridge.estimateBridgeTokenOutput({
    tokenFrom,
    chainIdTo: toNetwork.chainId,
    tokenTo,
    amountFrom,
  });
  /** the error occurs in executeBridgeTokenTransaction
   *  reason: 'invalid contract address or ENS name',
   *   code: 'INVALID_ARGUMENT',
   *   argument: 'addressOrName',
   *   value: null
   */
  const tx = await synapseBridge.executeBridgeTokenTransaction(
    {
      amountFrom,
      amountTo: amountTo.amountToReceive,
      chainIdTo: toNetwork.chainId,
      tokenFrom,
      tokenTo,
    },
    walletFrom
  );
  await tx.wait();
  console.log(`Success: ${tx.hash}`);
}

main();

from sdk.

bleaker0x avatar bleaker0x commented on June 6, 2024

@Vaulverin apologies for not seeing this issue (along with your other one) sooner. So, from what I can see, you're passing chainIdTo: fromNetwork.chainId to executeBridgeTokenTransaction which would lead to the "invalid contract address or ENS name" error you're receiving, since WETH.e doesn't exist on Arbitrum.

Let me know if you still have an issue after passing toNetwork.chainId to the chainIdTo parameter.

from sdk.

Vaulverin avatar Vaulverin commented on June 6, 2024

Yeah, it's just a misspell in this example. With toNetwork.chainId i have the same error.

from sdk.

BlazeWasHere avatar BlazeWasHere commented on June 6, 2024

It seems like you made a fork and fixed it with this commit, could you make a PR into the dev branch with that?

from sdk.

Vaulverin avatar Vaulverin commented on June 6, 2024

Yeah, sure

from sdk.

bleaker0x avatar bleaker0x commented on June 6, 2024

Closing as fixed with merge of #58 into dev.

from sdk.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.