Comments (7)
Can you send a minimal reproducible code?
from sdk.
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.
@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.
Yeah, it's just a misspell in this example. With toNetwork.chainId
i have the same error.
from sdk.
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.
Yeah, sure
from sdk.
Closing as fixed with merge of #58 into dev
.
from sdk.
Related Issues (15)
- license HOT 2
- ESNext and CommonJS issue HOT 1
- Bug: Cannot read property 'error' of undefined HOT 6
- Unique symbols for tokens HOT 8
- cronos new pool HOT 1
- Generated bridge transaction failing HOT 1
- Generated bridge transaction failing HOT 1
- support for coingecko ids HOT 1
- Explorer graph ql error
- Version ^0.95.1-alpha.66 returns zero in amountToReceive
- Dependency Dashboard
- checkCanBridge is private HOT 1
- Add support for Cronos, Metis (New Chains), and Optimism gOHM HOT 1
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.