czbag / zksync Goto Github PK
View Code? Open in Web Editor NEWMultitool soft for ZkSync Era
Multitool soft for ZkSync Era
When using the official bridge span chain, 100 percent when prompted 'insufficient funds for transfer'}.Should we cut the fee?
How to calculate fee?
can't 100% ensure this is one issue, but when i change the code from txn_hash = web3.eth.sendRawTransaction(signed_txn) to txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction), it's working fine.
modules
folder and paste this code:from loguru import logger
import aiohttp
from utils.gas_checker import check_gas
from utils.helpers import retry
from .account import Account
CHAIN_IDS = {
'Ethereum': 1,
'Optimism': 10,
'Arbitrum': 42161,
'Base': 8453,
'Zora': 7777777
}
class Relay(Account):
def __init__(self, account_id: int, private_key: str, proxy: str | None = None) -> None:
super().__init__(account_id=account_id, private_key=private_key, proxy=proxy, chain="zksync")
self.proxy = f"http://{proxy}" if proxy else None
async def get_info(self, dest_chain_id: int, amount: int) -> tuple[str, int, str]:
'return (address_to, amount_wei, tx_data)'
json_data = {
'destinationChainId': dest_chain_id,
'originChainId': 324, # zksync-era chain id
'source': "relay.link",
'txs': [{
'data': '0x',
'to': self.address,
'value': amount
}],
'user': self.address
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Host": "api.relay.link",
"Origin": "https://www.relay.link",
}
async with aiohttp.ClientSession() as session:
async with session.post(
'https://api.relay.link/execute/call',
headers=headers,
json=json_data,
proxy=self.proxy
) as response:
if response.status != 200:
raise Exception(f'Relay response error: CODE - {response.status} | RESP - {await response.text()}')
data = (await response.json())['steps'][0]['items'][0]['data']
return self.w3.to_checksum_address(data['to']), int(data['value']), data['data']
@check_gas
@retry
async def bridge(self, dest_chain: str, amount: float) -> None:
dest_chain_id = CHAIN_IDS[dest_chain]
address_to, amount_send_wei, data = await self.get_info(dest_chain_id, int(amount * 10**18))
logger.info(f'[{self.account_id}][{self.address}] Bridging via Relay - {amount:.5f} ETH ZkSync Era -> ' +
f'{amount:.5f} ETH {dest_chain} | Cost: {amount_send_wei/10**18:.5f} ETH')
tx_data = await self.get_tx_data(amount_send_wei) | {'to': address_to, 'data': data}
signed_txn = await self.sign(tx_data)
txn_hash = await self.send_raw_transaction(signed_txn)
await self.wait_until_tx_finished(txn_hash.hex())
modules_settingsy
file this code:async def relay_bridge(account_id, key, proxy):
'''
Make bridge from zksync-era via Relay.link
Available chains: 'Ethereum', 'Optimism', 'Arbitrum', 'Base', 'Zora'
'''
amount = 0.000001
chain = 'Arbitrum'
relay = Relay(account_id, key, proxy)
await relay.bridge(chain, amount)
def get_module()
in main.py
file this code:result = questionary.select(
"Select a method to get started",
choices=[
...
Choice("52) MultiApprove", multi_approve),
Choice("53) Make bridge on Relay", relay_bridge),
Choice("54) Check transaction count", "tx_checker"),
Choice("55) Exit", "exit"),
],
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.