zksync-web3
Advanced tools
Comparing version 0.13.0-beta.0 to 0.13.0-beta.1
import { BigNumber, BigNumberish, ethers, BytesLike } from 'ethers'; | ||
import { Provider } from './provider'; | ||
import { Address, PriorityOpResponse, BlockTag, Eip712Meta, TransactionResponse, BalancesMap } from './types'; | ||
declare type Constructor<T = {}> = new (...args: any[]) => T; | ||
type Constructor<T = {}> = new (...args: any[]) => T; | ||
interface TxSender { | ||
@@ -16,3 +16,2 @@ sendTransaction(tx: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>; | ||
getL1BridgeContracts(): Promise<{ | ||
eth: import("../typechain").IL1Bridge; | ||
erc20: import("../typechain").IL1Bridge; | ||
@@ -75,3 +74,2 @@ }>; | ||
getL2BridgeContracts(): Promise<{ | ||
eth: import("../typechain").IL2Bridge; | ||
erc20: import("../typechain").IL2Bridge; | ||
@@ -78,0 +76,0 @@ }>; |
@@ -25,3 +25,2 @@ "use strict"; | ||
return { | ||
eth: typechain_1.IL1BridgeFactory.connect(addresses.ethL1, this._signerL1()), | ||
erc20: typechain_1.IL1BridgeFactory.connect(addresses.erc20L1, this._signerL1()) | ||
@@ -87,3 +86,2 @@ }; | ||
if (transaction.bridgeAddress) { | ||
bridgeContracts.eth.attach(transaction.bridgeAddress); | ||
bridgeContracts.erc20.attach(transaction.bridgeAddress); | ||
@@ -252,3 +250,2 @@ } | ||
return { | ||
eth: typechain_1.IL2BridgeFactory.connect(addresses.ethL2, this._signerL2()), | ||
erc20: typechain_1.IL2BridgeFactory.connect(addresses.erc20L2, this._signerL2()) | ||
@@ -255,0 +252,0 @@ }; |
@@ -10,4 +10,2 @@ import { ethers, BigNumber, BigNumberish, utils, providers, BytesLike } from 'ethers'; | ||
mainContract?: Address; | ||
ethBridgeL1?: Address; | ||
ethBridgeL2?: Address; | ||
erc20BridgeL1?: Address; | ||
@@ -35,5 +33,3 @@ erc20BridgeL2?: Address; | ||
getDefaultBridgeAddresses(): Promise<{ | ||
ethL1: string; | ||
erc20L1: string; | ||
ethL2: string; | ||
erc20L2: string; | ||
@@ -40,0 +36,0 @@ }>; |
@@ -13,15 +13,2 @@ "use strict"; | ||
class Provider extends ethers_1.ethers.providers.JsonRpcProvider { | ||
constructor(url, network) { | ||
super(url, network); | ||
this.pollingInterval = 500; | ||
const blockTag = this.formatter.blockTag.bind(this.formatter); | ||
this.formatter.blockTag = (tag) => { | ||
if (tag == 'committed' || tag == 'finalized') { | ||
return tag; | ||
} | ||
return blockTag(tag); | ||
}; | ||
this.contractAddresses = {}; | ||
this.formatter.transaction = utils_1.parseTransaction; | ||
} | ||
async getTransactionReceipt(transactionHash) { | ||
@@ -209,2 +196,15 @@ await this.getNetwork(); | ||
} | ||
constructor(url, network) { | ||
super(url, network); | ||
this.pollingInterval = 500; | ||
const blockTag = this.formatter.blockTag.bind(this.formatter); | ||
this.formatter.blockTag = (tag) => { | ||
if (tag == 'committed' || tag == 'finalized') { | ||
return tag; | ||
} | ||
return blockTag(tag); | ||
}; | ||
this.contractAddresses = {}; | ||
this.formatter.transaction = utils_1.parseTransaction; | ||
} | ||
async getMessageProof(blockNumber, sender, messageHash, logIndex) { | ||
@@ -240,13 +240,9 @@ return await this.send('zks_getL2ToL1MsgProof', [ | ||
async getDefaultBridgeAddresses() { | ||
if (!this.contractAddresses.ethBridgeL1) { | ||
if (!this.contractAddresses.erc20BridgeL1) { | ||
let addresses = await this.send('zks_getBridgeContracts', []); | ||
this.contractAddresses.ethBridgeL1 = addresses.l1EthDefaultBridge; | ||
this.contractAddresses.erc20BridgeL1 = addresses.l1Erc20DefaultBridge; | ||
this.contractAddresses.ethBridgeL2 = addresses.l2EthDefaultBridge; | ||
this.contractAddresses.erc20BridgeL2 = addresses.l2Erc20DefaultBridge; | ||
} | ||
return { | ||
ethL1: this.contractAddresses.ethBridgeL1, | ||
erc20L1: this.contractAddresses.erc20BridgeL1, | ||
ethL2: this.contractAddresses.ethBridgeL2, | ||
erc20L2: this.contractAddresses.erc20BridgeL2 | ||
@@ -253,0 +249,0 @@ }; |
@@ -40,3 +40,2 @@ import { ethers } from 'ethers'; | ||
getL2BridgeContracts(): Promise<{ | ||
eth: import("../typechain").IL2Bridge; | ||
erc20: import("../typechain").IL2Bridge; | ||
@@ -80,3 +79,2 @@ }>; | ||
getL1BridgeContracts(): Promise<{ | ||
eth: import("../typechain").IL1Bridge; | ||
erc20: import("../typechain").IL1Bridge; | ||
@@ -83,0 +81,0 @@ }>; |
import { BytesLike, BigNumberish, providers, BigNumber } from 'ethers'; | ||
import { BlockWithTransactions as EthersBlockWithTransactions } from '@ethersproject/abstract-provider'; | ||
export declare type Address = string; | ||
export declare type Signature = string; | ||
export type Address = string; | ||
export type Signature = string; | ||
export declare enum Network { | ||
@@ -27,7 +27,7 @@ Mainnet = 1, | ||
} | ||
export declare type PaymasterParams = { | ||
export type PaymasterParams = { | ||
paymaster: Address; | ||
paymasterInput: BytesLike; | ||
}; | ||
export declare type Eip712Meta = { | ||
export type Eip712Meta = { | ||
ergsPerPubdata?: BigNumberish; | ||
@@ -38,4 +38,4 @@ factoryDeps?: BytesLike[]; | ||
}; | ||
export declare type BlockTag = number | string | 'committed' | 'finalized' | 'latest' | 'earliest' | 'pending'; | ||
export declare type DeploymentType = 'create' | 'createAccount'; | ||
export type BlockTag = number | string | 'committed' | 'finalized' | 'latest' | 'earliest' | 'pending'; | ||
export type DeploymentType = 'create' | 'createAccount'; | ||
export interface Token { | ||
@@ -98,3 +98,3 @@ l1Address: Address; | ||
} | ||
export declare type TransactionRequest = providers.TransactionRequest & { | ||
export type TransactionRequest = providers.TransactionRequest & { | ||
customData?: Eip712Meta; | ||
@@ -105,3 +105,3 @@ }; | ||
} | ||
export declare type BalancesMap = { | ||
export type BalancesMap = { | ||
[key: string]: BigNumber; | ||
@@ -129,3 +129,3 @@ }; | ||
} | ||
export declare type PaymasterInput = ApprovalBasedPaymasterInput | GeneralPaymasterInput; | ||
export type PaymasterInput = ApprovalBasedPaymasterInput | GeneralPaymasterInput; | ||
export declare enum AccountAbstractionVersion { | ||
@@ -132,0 +132,0 @@ None = 0, |
@@ -13,3 +13,2 @@ import { EIP712Signer } from './signer'; | ||
getL2BridgeContracts(): Promise<{ | ||
eth: import("../typechain").IL2Bridge; | ||
erc20: import("../typechain").IL2Bridge; | ||
@@ -41,3 +40,2 @@ }>; | ||
getL1BridgeContracts(): Promise<{ | ||
eth: import("../typechain").IL1Bridge; | ||
erc20: import("../typechain").IL1Bridge; | ||
@@ -44,0 +42,0 @@ }>; |
@@ -9,11 +9,2 @@ "use strict"; | ||
class Wallet extends (0, adapters_1.AdapterL2)((0, adapters_1.AdapterL1)(ethers_1.ethers.Wallet)) { | ||
constructor(privateKey, providerL2, providerL1) { | ||
super(privateKey, providerL2); | ||
if (this.provider != null) { | ||
const chainId = this.getChainId(); | ||
// @ts-ignore | ||
this.eip712 = new signer_1.EIP712Signer(this, chainId); | ||
} | ||
this.providerL1 = providerL1; | ||
} | ||
_providerL1() { | ||
@@ -63,2 +54,11 @@ if (this.providerL1 == null) { | ||
} | ||
constructor(privateKey, providerL2, providerL1) { | ||
super(privateKey, providerL2); | ||
if (this.provider != null) { | ||
const chainId = this.getChainId(); | ||
// @ts-ignore | ||
this.eip712 = new signer_1.EIP712Signer(this, chainId); | ||
} | ||
this.providerL1 = providerL1; | ||
} | ||
async populateTransaction(transaction) { | ||
@@ -65,0 +65,0 @@ var _a, _b; |
{ | ||
"name": "zksync-web3", | ||
"version": "0.13.0-beta.0", | ||
"version": "0.13.0-beta.1", | ||
"main": "build/src/index.js", | ||
@@ -5,0 +5,0 @@ "types": "build/src/index.d.ts", |
@@ -45,3 +45,2 @@ import { BigNumber, BigNumberish, ethers, BytesLike } from 'ethers'; | ||
return { | ||
eth: IL1BridgeFactory.connect(addresses.ethL1, this._signerL1()), | ||
erc20: IL1BridgeFactory.connect(addresses.erc20L1, this._signerL1()) | ||
@@ -136,3 +135,2 @@ }; | ||
if (transaction.bridgeAddress) { | ||
bridgeContracts.eth.attach(transaction.bridgeAddress); | ||
bridgeContracts.erc20.attach(transaction.bridgeAddress); | ||
@@ -401,3 +399,2 @@ } | ||
return { | ||
eth: IL2BridgeFactory.connect(addresses.ethL2, this._signerL2()), | ||
erc20: IL2BridgeFactory.connect(addresses.erc20L2, this._signerL2()) | ||
@@ -404,0 +401,0 @@ }; |
@@ -43,4 +43,2 @@ import { ethers, BigNumber, BigNumberish, utils, providers, BytesLike, Contract } from 'ethers'; | ||
mainContract?: Address; | ||
ethBridgeL1?: Address; | ||
ethBridgeL2?: Address; | ||
erc20BridgeL1?: Address; | ||
@@ -312,13 +310,9 @@ erc20BridgeL2?: Address; | ||
async getDefaultBridgeAddresses() { | ||
if (!this.contractAddresses.ethBridgeL1) { | ||
if (!this.contractAddresses.erc20BridgeL1) { | ||
let addresses = await this.send('zks_getBridgeContracts', []); | ||
this.contractAddresses.ethBridgeL1 = addresses.l1EthDefaultBridge; | ||
this.contractAddresses.erc20BridgeL1 = addresses.l1Erc20DefaultBridge; | ||
this.contractAddresses.ethBridgeL2 = addresses.l2EthDefaultBridge; | ||
this.contractAddresses.erc20BridgeL2 = addresses.l2Erc20DefaultBridge; | ||
} | ||
return { | ||
ethL1: this.contractAddresses.ethBridgeL1, | ||
erc20L1: this.contractAddresses.erc20BridgeL1, | ||
ethL2: this.contractAddresses.ethBridgeL2, | ||
erc20L2: this.contractAddresses.erc20BridgeL2 | ||
@@ -325,0 +319,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
860312
74
27846