@matterlabs/zksync-js 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/adapters/ethers/client.cjs +642 -1
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.js +6 -5
- package/dist/adapters/ethers/estimator.d.ts +4 -0
- package/dist/adapters/ethers/index.cjs +1279 -925
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.d.ts +1 -0
- package/dist/adapters/ethers/index.js +9 -8
- package/dist/adapters/ethers/resources/contracts/contracts.d.ts +9 -0
- package/dist/adapters/ethers/resources/contracts/index.d.ts +2 -0
- package/dist/adapters/ethers/resources/contracts/types.d.ts +60 -0
- package/dist/adapters/ethers/resources/deposits/context.d.ts +21 -7
- package/dist/adapters/ethers/resources/deposits/index.d.ts +3 -1
- package/dist/adapters/ethers/resources/deposits/routes/types.d.ts +2 -6
- package/dist/adapters/ethers/resources/deposits/services/fee.d.ts +6 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +41 -0
- package/dist/adapters/ethers/resources/tokens/index.d.ts +1 -0
- package/dist/adapters/ethers/resources/tokens/tokens.d.ts +10 -0
- package/dist/adapters/ethers/resources/utils.d.ts +3 -17
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +15 -7
- package/dist/adapters/ethers/resources/withdrawals/index.d.ts +3 -1
- package/dist/adapters/ethers/resources/withdrawals/routes/types.d.ts +2 -2
- package/dist/adapters/ethers/resources/withdrawals/services/fees.d.ts +14 -0
- package/dist/adapters/ethers/resources/withdrawals/services/gas.d.ts +12 -0
- package/dist/adapters/ethers/sdk.cjs +1388 -1501
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +5 -22
- package/dist/adapters/ethers/sdk.js +7 -6
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.d.ts +1 -1
- package/dist/adapters/viem/client.js +4 -5
- package/dist/adapters/viem/estimator.d.ts +4 -0
- package/dist/adapters/viem/index.cjs +1233 -744
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +3 -0
- package/dist/adapters/viem/index.js +8 -8
- package/dist/adapters/viem/resources/contracts/contracts.d.ts +9 -0
- package/dist/adapters/viem/resources/contracts/index.d.ts +2 -0
- package/dist/adapters/viem/resources/contracts/types.d.ts +61 -0
- package/dist/adapters/viem/resources/deposits/context.d.ts +21 -7
- package/dist/adapters/viem/resources/deposits/index.d.ts +3 -1
- package/dist/adapters/viem/resources/deposits/routes/types.d.ts +2 -6
- package/dist/adapters/viem/resources/deposits/services/fee.d.ts +6 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +37 -0
- package/dist/adapters/viem/resources/tokens/index.d.ts +1 -0
- package/dist/adapters/viem/resources/tokens/tokens.d.ts +3 -0
- package/dist/adapters/viem/resources/utils.d.ts +3 -19
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +14 -9
- package/dist/adapters/viem/resources/withdrawals/index.d.ts +3 -1
- package/dist/adapters/viem/resources/withdrawals/routes/types.d.ts +12 -2
- package/dist/adapters/viem/resources/withdrawals/services/fee.d.ts +17 -0
- package/dist/adapters/viem/resources/withdrawals/services/gas.d.ts +12 -0
- package/dist/adapters/viem/sdk.cjs +1225 -699
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.d.ts +5 -25
- package/dist/adapters/viem/sdk.js +6 -6
- package/dist/{chunk-3LALBFFE.js → chunk-3MRGU4HV.js} +9 -5
- package/dist/{chunk-CGO27P7F.js → chunk-5YWP4CZP.js} +849 -835
- package/dist/{chunk-4HLJJKIY.js → chunk-6K6VJQAL.js} +2 -2
- package/dist/{chunk-6GCT6TLS.js → chunk-F2ENUV3A.js} +13 -1
- package/dist/{chunk-7M4V3FMT.js → chunk-JXUFGIJG.js} +986 -678
- package/dist/chunk-LL3WKCFJ.js +231 -0
- package/dist/{chunk-Y75OMFK6.js → chunk-M5J2MM2U.js} +351 -1
- package/dist/{chunk-263G6636.js → chunk-NCAIVYBR.js} +1 -14
- package/dist/{chunk-DI2CJDPZ.js → chunk-NEC2ZKHI.js} +5 -13
- package/dist/chunk-NTEIA5KA.js +13 -0
- package/dist/chunk-XRE7H466.js +157 -0
- package/dist/{chunk-BD2LUO5T.js → chunk-YUK547UF.js} +3 -3
- package/dist/core/abi.d.ts +9 -0
- package/dist/core/adapters/interfaces.d.ts +25 -0
- package/dist/core/codec/ntv.d.ts +48 -0
- package/dist/core/constants.cjs +12 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +6 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +4508 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +5 -4
- package/dist/core/resources/deposits/fee.d.ts +15 -0
- package/dist/core/resources/deposits/gas.d.ts +38 -0
- package/dist/core/resources/withdrawals/gas.d.ts +14 -0
- package/dist/core/types/errors.d.ts +1 -1
- package/dist/core/types/fees.d.ts +40 -0
- package/dist/core/types/flows/base.d.ts +0 -10
- package/dist/core/types/flows/deposits.d.ts +20 -6
- package/dist/core/types/flows/route.d.ts +2 -3
- package/dist/core/types/flows/token.d.ts +192 -0
- package/dist/core/types/flows/withdrawals.d.ts +12 -6
- package/dist/core/utils/addr.d.ts +2 -0
- package/dist/index.cjs +4520 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -4
- package/package.json +5 -1
- package/dist/adapters/ethers/resources/token-info.d.ts +0 -31
- package/dist/adapters/ethers/resources/withdrawals/routes/eth-nonbase.d.ts +0 -2
- package/dist/adapters/viem/resources/token-info.d.ts +0 -34
- package/dist/adapters/viem/resources/withdrawals/routes/eth-nonbase.d.ts +0 -2
- package/dist/chunk-B77GWPO5.js +0 -339
- package/dist/core/internal/abi-registry.d.ts +0 -9
- package/dist/core/utils/gas.d.ts +0 -13
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ViemClient, ResolvedAddresses } from './client';
|
|
1
|
+
import type { ViemClient } from './client';
|
|
3
2
|
import { type DepositsResource as DepositsResourceType } from './resources/deposits/index';
|
|
4
3
|
import { type WithdrawalsResource as WithdrawalsResourceType } from './resources/withdrawals/index';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
type ViemContracts = {
|
|
8
|
-
bridgehub: GetContractReturnType<typeof IBridgehubABI, PublicClient>;
|
|
9
|
-
l1AssetRouter: GetContractReturnType<typeof IL1AssetRouterABI, PublicClient>;
|
|
10
|
-
l1Nullifier: GetContractReturnType<typeof IL1NullifierABI, PublicClient>;
|
|
11
|
-
l1NativeTokenVault: GetContractReturnType<typeof L1NativeTokenVaultABI, PublicClient>;
|
|
12
|
-
l2AssetRouter: GetContractReturnType<typeof IL2AssetRouterABI, PublicClient>;
|
|
13
|
-
l2NativeTokenVault: GetContractReturnType<typeof L2NativeTokenVaultABI, PublicClient>;
|
|
14
|
-
l2BaseTokenSystem: GetContractReturnType<typeof IBaseTokenABI, PublicClient>;
|
|
15
|
-
};
|
|
4
|
+
import type { TokensResource as TokensResourceType } from '../../core/types/flows/token';
|
|
5
|
+
import type { ContractsResource as ContractsResourceType } from './resources/contracts';
|
|
16
6
|
export interface ViemSdk {
|
|
17
7
|
deposits: DepositsResourceType;
|
|
18
8
|
withdrawals: WithdrawalsResourceType;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
contracts(): Promise<ViemContracts>;
|
|
22
|
-
l1AssetRouter(): Promise<ViemContracts['l1AssetRouter']>;
|
|
23
|
-
l1NativeTokenVault(): Promise<ViemContracts['l1NativeTokenVault']>;
|
|
24
|
-
l1Nullifier(): Promise<ViemContracts['l1Nullifier']>;
|
|
25
|
-
baseToken(chainId?: bigint): Promise<Address>;
|
|
26
|
-
l2TokenAddress(l1Token: Address): Promise<Address>;
|
|
27
|
-
l1TokenAddress(l2Token: Address): Promise<Address>;
|
|
28
|
-
assetId(l1Token: Address): Promise<Hex>;
|
|
29
|
-
};
|
|
9
|
+
tokens: TokensResourceType;
|
|
10
|
+
contracts: ContractsResourceType;
|
|
30
11
|
}
|
|
31
12
|
export declare function createViemSdk(client: ViemClient): ViemSdk;
|
|
32
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createViemSdk } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
1
|
+
export { createViemSdk } from '../../chunk-JXUFGIJG.js';
|
|
2
|
+
import '../../chunk-LL3WKCFJ.js';
|
|
3
|
+
import '../../chunk-NEC2ZKHI.js';
|
|
4
|
+
import '../../chunk-NCAIVYBR.js';
|
|
5
|
+
import '../../chunk-M5J2MM2U.js';
|
|
6
|
+
import '../../chunk-F2ENUV3A.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createError } from './chunk-
|
|
4
|
-
import { L2_ASSET_ROUTER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_BASE_TOKEN_ADDRESS } from './chunk-
|
|
1
|
+
import { createErrorHandlers } from './chunk-XRE7H466.js';
|
|
2
|
+
import { createZksRpc, makeTransportFromEthers } from './chunk-6K6VJQAL.js';
|
|
3
|
+
import { createError, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default, OP_DEPOSITS } from './chunk-M5J2MM2U.js';
|
|
4
|
+
import { L2_ASSET_ROUTER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_BASE_TOKEN_ADDRESS } from './chunk-F2ENUV3A.js';
|
|
5
5
|
import { BrowserProvider, Interface, Contract } from 'ethers';
|
|
6
6
|
|
|
7
7
|
// src/adapters/ethers/rpc.ts
|
|
@@ -16,6 +16,7 @@ function zksRpcFromEthers(l2Provider) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// src/adapters/ethers/client.ts
|
|
19
|
+
var { wrapAs } = createErrorHandlers("client");
|
|
19
20
|
function createEthersClient(args) {
|
|
20
21
|
const { l1, l2, signer } = args;
|
|
21
22
|
let boundSigner = signer;
|
|
@@ -113,7 +114,10 @@ function createEthersClient(args) {
|
|
|
113
114
|
async function baseToken(chainId) {
|
|
114
115
|
const { bridgehub } = await ensureAddresses();
|
|
115
116
|
const bh = new Contract(bridgehub, IBridgehub_default, l1);
|
|
116
|
-
return await bh.baseToken(chainId)
|
|
117
|
+
return await wrapAs("CONTRACT", OP_DEPOSITS.base.baseToken, () => bh.baseToken(chainId), {
|
|
118
|
+
ctx: { where: "bridgehub.baseToken", chainIdL2: chainId },
|
|
119
|
+
message: "Failed to read base token."
|
|
120
|
+
});
|
|
117
121
|
}
|
|
118
122
|
const client = {
|
|
119
123
|
kind: "ethers",
|