viem 2.21.58 → 2.21.60
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/CHANGELOG.md +18 -0
- package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +1 -1
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/index.js.map +1 -1
- package/_cjs/account-abstraction/utils/errors/getUserOperationError.js.map +1 -1
- package/_cjs/actions/index.js +4 -2
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/createAccessList.js +49 -0
- package/_cjs/actions/public/createAccessList.js.map +1 -0
- package/_cjs/clients/decorators/public.js +2 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/erc7821/actions/execute.js +78 -0
- package/_cjs/experimental/erc7821/actions/execute.js.map +1 -0
- package/_cjs/experimental/erc7821/actions/supportsExecutionMode.js +21 -0
- package/_cjs/experimental/erc7821/actions/supportsExecutionMode.js.map +1 -0
- package/_cjs/experimental/erc7821/constants.js +65 -0
- package/_cjs/experimental/erc7821/constants.js.map +1 -0
- package/_cjs/experimental/erc7821/decorators/erc7821.js +14 -0
- package/_cjs/experimental/erc7821/decorators/erc7821.js.map +1 -0
- package/_cjs/experimental/erc7821/errors.js +26 -0
- package/_cjs/experimental/erc7821/errors.js.map +1 -0
- package/_cjs/experimental/erc7821/index.js +13 -0
- package/_cjs/experimental/erc7821/index.js.map +1 -0
- package/_cjs/experimental/index.js +3 -1
- package/_cjs/experimental/index.js.map +1 -1
- package/_cjs/types/calls.js +3 -0
- package/_cjs/types/calls.js.map +1 -0
- package/_cjs/types/eip1193.js.map +1 -1
- package/_cjs/zksync/actions/deployContract.js +3 -1
- package/_cjs/zksync/actions/deployContract.js.map +1 -1
- package/_cjs/zksync/actions/getL1TokenAddress.js +21 -0
- package/_cjs/zksync/actions/getL1TokenAddress.js.map +1 -0
- package/_cjs/zksync/actions/getL2TokenAddress.js +25 -0
- package/_cjs/zksync/actions/getL2TokenAddress.js.map +1 -0
- package/_cjs/zksync/actions/sendEip712Transaction.js +3 -3
- package/_cjs/zksync/actions/sendEip712Transaction.js.map +1 -1
- package/_cjs/zksync/actions/signEip712Transaction.js +2 -2
- package/_cjs/zksync/actions/signEip712Transaction.js.map +1 -1
- package/_cjs/zksync/constants/abis.js +185 -1
- package/_cjs/zksync/constants/abis.js.map +1 -1
- package/_cjs/zksync/constants/address.js +2 -1
- package/_cjs/zksync/constants/address.js.map +1 -1
- package/_cjs/zksync/decorators/publicL2.js +4 -0
- package/_cjs/zksync/decorators/publicL2.js.map +1 -1
- package/_cjs/zksync/index.js +5 -1
- package/_cjs/zksync/index.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +1 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/account-abstraction/index.js.map +1 -1
- package/_esm/account-abstraction/utils/errors/getUserOperationError.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/createAccessList.js +72 -0
- package/_esm/actions/public/createAccessList.js.map +1 -0
- package/_esm/clients/decorators/public.js +2 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/erc7821/actions/execute.js +143 -0
- package/_esm/experimental/erc7821/actions/execute.js.map +1 -0
- package/_esm/experimental/erc7821/actions/supportsExecutionMode.js +41 -0
- package/_esm/experimental/erc7821/actions/supportsExecutionMode.js.map +1 -0
- package/_esm/experimental/erc7821/constants.js +62 -0
- package/_esm/experimental/erc7821/constants.js.map +1 -0
- package/_esm/experimental/erc7821/decorators/erc7821.js +24 -0
- package/_esm/experimental/erc7821/decorators/erc7821.js.map +1 -0
- package/_esm/experimental/erc7821/errors.js +21 -0
- package/_esm/experimental/erc7821/errors.js.map +1 -0
- package/_esm/experimental/erc7821/index.js +7 -0
- package/_esm/experimental/erc7821/index.js.map +1 -0
- package/_esm/experimental/index.js +1 -0
- package/_esm/experimental/index.js.map +1 -1
- package/_esm/types/calls.js +2 -0
- package/_esm/types/calls.js.map +1 -0
- package/_esm/types/eip1193.js.map +1 -1
- package/_esm/zksync/actions/deployContract.js +5 -3
- package/_esm/zksync/actions/deployContract.js.map +1 -1
- package/_esm/zksync/actions/getL1TokenAddress.js +40 -0
- package/_esm/zksync/actions/getL1TokenAddress.js.map +1 -0
- package/_esm/zksync/actions/getL2TokenAddress.js +45 -0
- package/_esm/zksync/actions/getL2TokenAddress.js.map +1 -0
- package/_esm/zksync/actions/sendEip712Transaction.js +3 -3
- package/_esm/zksync/actions/sendEip712Transaction.js.map +1 -1
- package/_esm/zksync/actions/signEip712Transaction.js +4 -2
- package/_esm/zksync/actions/signEip712Transaction.js.map +1 -1
- package/_esm/zksync/constants/abis.js +184 -0
- package/_esm/zksync/constants/abis.js.map +1 -1
- package/_esm/zksync/constants/address.js +1 -0
- package/_esm/zksync/constants/address.js.map +1 -1
- package/_esm/zksync/decorators/publicL2.js +4 -0
- package/_esm/zksync/decorators/publicL2.js.map +1 -1
- package/_esm/zksync/index.js +2 -0
- package/_esm/zksync/index.js.map +1 -1
- package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts +3 -2
- package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts +3 -2
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/sendUserOperation.d.ts +3 -2
- package/_types/account-abstraction/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/index.d.ts +1 -1
- package/_types/account-abstraction/index.d.ts.map +1 -1
- package/_types/account-abstraction/types/userOperation.d.ts +2 -30
- package/_types/account-abstraction/types/userOperation.d.ts.map +1 -1
- package/_types/account-abstraction/utils/errors/getUserOperationError.d.ts.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/createAccessList.d.ts +61 -0
- package/_types/actions/public/createAccessList.d.ts.map +1 -0
- package/_types/clients/decorators/public.d.ts +25 -0
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/experimental/erc7821/actions/execute.d.ts +94 -0
- package/_types/experimental/erc7821/actions/execute.d.ts.map +1 -0
- package/_types/experimental/erc7821/actions/supportsExecutionMode.d.ts +37 -0
- package/_types/experimental/erc7821/actions/supportsExecutionMode.d.ts.map +1 -0
- package/_types/experimental/erc7821/constants.d.ts +48 -0
- package/_types/experimental/erc7821/constants.d.ts.map +1 -0
- package/_types/experimental/erc7821/decorators/erc7821.d.ts +116 -0
- package/_types/experimental/erc7821/decorators/erc7821.d.ts.map +1 -0
- package/_types/experimental/erc7821/errors.d.ts +14 -0
- package/_types/experimental/erc7821/errors.d.ts.map +1 -0
- package/_types/experimental/erc7821/index.d.ts +6 -0
- package/_types/experimental/erc7821/index.d.ts.map +1 -0
- package/_types/experimental/index.d.ts +1 -0
- package/_types/experimental/index.d.ts.map +1 -1
- package/_types/types/calls.d.ts +14 -0
- package/_types/types/calls.d.ts.map +1 -0
- package/_types/types/eip1193.d.ts +19 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/zksync/actions/deployContract.d.ts +1 -1
- package/_types/zksync/actions/deployContract.d.ts.map +1 -1
- package/_types/zksync/actions/getL1TokenAddress.d.ts +34 -0
- package/_types/zksync/actions/getL1TokenAddress.d.ts.map +1 -0
- package/_types/zksync/actions/getL2TokenAddress.d.ts +37 -0
- package/_types/zksync/actions/getL2TokenAddress.d.ts.map +1 -0
- package/_types/zksync/actions/sendEip712Transaction.d.ts.map +1 -1
- package/_types/zksync/actions/signEip712Transaction.d.ts +2 -0
- package/_types/zksync/actions/signEip712Transaction.d.ts.map +1 -1
- package/_types/zksync/constants/abis.d.ts +143 -0
- package/_types/zksync/constants/abis.d.ts.map +1 -1
- package/_types/zksync/constants/address.d.ts +1 -0
- package/_types/zksync/constants/address.d.ts.map +1 -1
- package/_types/zksync/decorators/publicL2.d.ts +46 -0
- package/_types/zksync/decorators/publicL2.d.ts.map +1 -1
- package/_types/zksync/index.d.ts +2 -0
- package/_types/zksync/index.d.ts.map +1 -1
- package/account-abstraction/actions/bundler/estimateUserOperationGas.ts +2 -4
- package/account-abstraction/actions/bundler/prepareUserOperation.ts +6 -10
- package/account-abstraction/actions/bundler/sendUserOperation.ts +2 -4
- package/account-abstraction/index.ts +0 -2
- package/account-abstraction/types/userOperation.ts +2 -72
- package/account-abstraction/utils/errors/getUserOperationError.ts +10 -16
- package/actions/index.ts +6 -0
- package/actions/public/createAccessList.ts +159 -0
- package/clients/decorators/public.ts +32 -0
- package/errors/version.ts +1 -1
- package/experimental/erc7821/actions/execute.ts +232 -0
- package/experimental/erc7821/actions/supportsExecutionMode.ts +60 -0
- package/experimental/erc7821/constants.ts +62 -0
- package/experimental/erc7821/decorators/erc7821.ts +149 -0
- package/experimental/erc7821/errors.ts +29 -0
- package/experimental/erc7821/index.ts +23 -0
- package/experimental/index.ts +5 -0
- package/package.json +6 -1
- package/types/calls.ts +38 -0
- package/types/eip1193.ts +21 -0
- package/zksync/actions/deployContract.ts +9 -3
- package/zksync/actions/getL1TokenAddress.ts +59 -0
- package/zksync/actions/getL2TokenAddress.ts +70 -0
- package/zksync/actions/sendEip712Transaction.ts +5 -3
- package/zksync/actions/signEip712Transaction.ts +5 -2
- package/zksync/constants/abis.ts +185 -0
- package/zksync/constants/address.ts +3 -0
- package/zksync/decorators/publicL2.ts +62 -0
- package/zksync/index.ts +10 -0
package/zksync/constants/abis.ts
CHANGED
@@ -461,3 +461,188 @@ export const paymasterAbi = [
|
|
461
461
|
type: 'function',
|
462
462
|
},
|
463
463
|
]
|
464
|
+
|
465
|
+
export const l2SharedBridgeAbi = [
|
466
|
+
{
|
467
|
+
anonymous: false,
|
468
|
+
inputs: [
|
469
|
+
{
|
470
|
+
indexed: true,
|
471
|
+
internalType: 'address',
|
472
|
+
name: 'l1Sender',
|
473
|
+
type: 'address',
|
474
|
+
},
|
475
|
+
{
|
476
|
+
indexed: true,
|
477
|
+
internalType: 'address',
|
478
|
+
name: 'l2Receiver',
|
479
|
+
type: 'address',
|
480
|
+
},
|
481
|
+
{
|
482
|
+
indexed: true,
|
483
|
+
internalType: 'address',
|
484
|
+
name: 'l2Token',
|
485
|
+
type: 'address',
|
486
|
+
},
|
487
|
+
{
|
488
|
+
indexed: false,
|
489
|
+
internalType: 'uint256',
|
490
|
+
name: 'amount',
|
491
|
+
type: 'uint256',
|
492
|
+
},
|
493
|
+
],
|
494
|
+
name: 'FinalizeDeposit',
|
495
|
+
type: 'event',
|
496
|
+
},
|
497
|
+
{
|
498
|
+
anonymous: false,
|
499
|
+
inputs: [
|
500
|
+
{
|
501
|
+
indexed: true,
|
502
|
+
internalType: 'address',
|
503
|
+
name: 'l2Sender',
|
504
|
+
type: 'address',
|
505
|
+
},
|
506
|
+
{
|
507
|
+
indexed: true,
|
508
|
+
internalType: 'address',
|
509
|
+
name: 'l1Receiver',
|
510
|
+
type: 'address',
|
511
|
+
},
|
512
|
+
{
|
513
|
+
indexed: true,
|
514
|
+
internalType: 'address',
|
515
|
+
name: 'l2Token',
|
516
|
+
type: 'address',
|
517
|
+
},
|
518
|
+
{
|
519
|
+
indexed: false,
|
520
|
+
internalType: 'uint256',
|
521
|
+
name: 'amount',
|
522
|
+
type: 'uint256',
|
523
|
+
},
|
524
|
+
],
|
525
|
+
name: 'WithdrawalInitiated',
|
526
|
+
type: 'event',
|
527
|
+
},
|
528
|
+
{
|
529
|
+
inputs: [
|
530
|
+
{
|
531
|
+
internalType: 'address',
|
532
|
+
name: '_l1Sender',
|
533
|
+
type: 'address',
|
534
|
+
},
|
535
|
+
{
|
536
|
+
internalType: 'address',
|
537
|
+
name: '_l2Receiver',
|
538
|
+
type: 'address',
|
539
|
+
},
|
540
|
+
{
|
541
|
+
internalType: 'address',
|
542
|
+
name: '_l1Token',
|
543
|
+
type: 'address',
|
544
|
+
},
|
545
|
+
{
|
546
|
+
internalType: 'uint256',
|
547
|
+
name: '_amount',
|
548
|
+
type: 'uint256',
|
549
|
+
},
|
550
|
+
{
|
551
|
+
internalType: 'bytes',
|
552
|
+
name: '_data',
|
553
|
+
type: 'bytes',
|
554
|
+
},
|
555
|
+
],
|
556
|
+
name: 'finalizeDeposit',
|
557
|
+
outputs: [],
|
558
|
+
stateMutability: 'nonpayable',
|
559
|
+
type: 'function',
|
560
|
+
},
|
561
|
+
{
|
562
|
+
inputs: [],
|
563
|
+
name: 'l1Bridge',
|
564
|
+
outputs: [
|
565
|
+
{
|
566
|
+
internalType: 'address',
|
567
|
+
name: '',
|
568
|
+
type: 'address',
|
569
|
+
},
|
570
|
+
],
|
571
|
+
stateMutability: 'view',
|
572
|
+
type: 'function',
|
573
|
+
},
|
574
|
+
{
|
575
|
+
inputs: [],
|
576
|
+
name: 'l1SharedBridge',
|
577
|
+
outputs: [
|
578
|
+
{
|
579
|
+
internalType: 'address',
|
580
|
+
name: '',
|
581
|
+
type: 'address',
|
582
|
+
},
|
583
|
+
],
|
584
|
+
stateMutability: 'view',
|
585
|
+
type: 'function',
|
586
|
+
},
|
587
|
+
{
|
588
|
+
inputs: [
|
589
|
+
{
|
590
|
+
internalType: 'address',
|
591
|
+
name: '_l2Token',
|
592
|
+
type: 'address',
|
593
|
+
},
|
594
|
+
],
|
595
|
+
name: 'l1TokenAddress',
|
596
|
+
outputs: [
|
597
|
+
{
|
598
|
+
internalType: 'address',
|
599
|
+
name: '',
|
600
|
+
type: 'address',
|
601
|
+
},
|
602
|
+
],
|
603
|
+
stateMutability: 'view',
|
604
|
+
type: 'function',
|
605
|
+
},
|
606
|
+
{
|
607
|
+
inputs: [
|
608
|
+
{
|
609
|
+
internalType: 'address',
|
610
|
+
name: '_l1Token',
|
611
|
+
type: 'address',
|
612
|
+
},
|
613
|
+
],
|
614
|
+
name: 'l2TokenAddress',
|
615
|
+
outputs: [
|
616
|
+
{
|
617
|
+
internalType: 'address',
|
618
|
+
name: '',
|
619
|
+
type: 'address',
|
620
|
+
},
|
621
|
+
],
|
622
|
+
stateMutability: 'view',
|
623
|
+
type: 'function',
|
624
|
+
},
|
625
|
+
{
|
626
|
+
inputs: [
|
627
|
+
{
|
628
|
+
internalType: 'address',
|
629
|
+
name: '_l1Receiver',
|
630
|
+
type: 'address',
|
631
|
+
},
|
632
|
+
{
|
633
|
+
internalType: 'address',
|
634
|
+
name: '_l2Token',
|
635
|
+
type: 'address',
|
636
|
+
},
|
637
|
+
{
|
638
|
+
internalType: 'uint256',
|
639
|
+
name: '_amount',
|
640
|
+
type: 'uint256',
|
641
|
+
},
|
642
|
+
],
|
643
|
+
name: 'withdraw',
|
644
|
+
outputs: [],
|
645
|
+
stateMutability: 'nonpayable',
|
646
|
+
type: 'function',
|
647
|
+
},
|
648
|
+
] as const
|
@@ -1,6 +1,9 @@
|
|
1
1
|
export const contractDeployerAddress =
|
2
2
|
'0x0000000000000000000000000000000000008006' as const
|
3
3
|
|
4
|
+
export const contract2FactoryAddress =
|
5
|
+
'0x0000000000000000000000000000000000010000' as const
|
6
|
+
|
4
7
|
export const legacyEthAddress =
|
5
8
|
'0x0000000000000000000000000000000000000000' as const
|
6
9
|
|
@@ -52,6 +52,16 @@ import {
|
|
52
52
|
type GetL1ChainIdReturnType,
|
53
53
|
getL1ChainId,
|
54
54
|
} from '../actions/getL1ChainId.js'
|
55
|
+
import {
|
56
|
+
type GetL1TokenAddressParameters,
|
57
|
+
type GetL1TokenAddressReturnType,
|
58
|
+
getL1TokenAddress,
|
59
|
+
} from '../actions/getL1TokenAddress.js'
|
60
|
+
import {
|
61
|
+
type GetL2TokenAddressParameters,
|
62
|
+
type GetL2TokenAddressReturnType,
|
63
|
+
getL2TokenAddress,
|
64
|
+
} from '../actions/getL2TokenAddress.js'
|
55
65
|
import {
|
56
66
|
type GetLogProofParameters,
|
57
67
|
type GetLogProofReturnType,
|
@@ -411,6 +421,56 @@ export type PublicActionsL2<
|
|
411
421
|
* const address = await client.getBaseTokenL1Address();
|
412
422
|
*/
|
413
423
|
getBaseTokenL1Address: () => Promise<GetBaseTokenL1AddressReturnType>
|
424
|
+
|
425
|
+
/**
|
426
|
+
* Returns the L2 token address equivalent for a L1 token address as they are not equal.
|
427
|
+
* ETH address is set to zero address.
|
428
|
+
*
|
429
|
+
* @remarks Only works for tokens bridged on default ZKsync Era bridges.
|
430
|
+
*
|
431
|
+
* @param args - {@link GetL2TokenAddressParameters}
|
432
|
+
* @returns The L2 token address equivalent for a L1 token address.
|
433
|
+
*
|
434
|
+
* @example
|
435
|
+
* import { createPublicClient, http } from 'viem'
|
436
|
+
* import { zksync } from 'viem/chains'
|
437
|
+
* import { publicActionsL2 } from 'viem/zksync'
|
438
|
+
*
|
439
|
+
* const client = createPublicClient({
|
440
|
+
* chain: zksync,
|
441
|
+
* transport: http(),
|
442
|
+
* }).extend(publicActionsL2())
|
443
|
+
*
|
444
|
+
* const address = await client.getL2TokenAddress({token: '0x...'});
|
445
|
+
*/
|
446
|
+
getL2TokenAddress: (
|
447
|
+
args: GetL2TokenAddressParameters,
|
448
|
+
) => Promise<GetL2TokenAddressReturnType>
|
449
|
+
|
450
|
+
/**
|
451
|
+
* Returns the L1 token address equivalent for a L2 token address as they are not equal.
|
452
|
+
* ETH address is set to zero address.
|
453
|
+
*
|
454
|
+
* @remarks Only works for tokens bridged on default ZKsync Era bridges.
|
455
|
+
*
|
456
|
+
* @param args - {@link GetL1TokenAddressParameters}
|
457
|
+
* @returns The L1 token address equivalent for a L2 token address.
|
458
|
+
*
|
459
|
+
* @example
|
460
|
+
* import { createPublicClient, http } from 'viem'
|
461
|
+
* import { zksync } from 'viem/chains'
|
462
|
+
* import { publicActionsL2 } from 'viem/zksync'
|
463
|
+
*
|
464
|
+
* const client = createPublicClient({
|
465
|
+
* chain: zksync,
|
466
|
+
* transport: http(),
|
467
|
+
* }).extend(publicActionsL2())
|
468
|
+
*
|
469
|
+
* const address = await client.getL1TokenAddress({token: '0x...'});
|
470
|
+
*/
|
471
|
+
getL1TokenAddress: (
|
472
|
+
args: GetL1TokenAddressParameters,
|
473
|
+
) => Promise<GetL1TokenAddressReturnType>
|
414
474
|
}
|
415
475
|
|
416
476
|
export function publicActionsL2() {
|
@@ -438,6 +498,8 @@ export function publicActionsL2() {
|
|
438
498
|
estimateFee: (args) => estimateFee(client, args),
|
439
499
|
getBridgehubContractAddress: () => getBridgehubContractAddress(client),
|
440
500
|
getBaseTokenL1Address: () => getBaseTokenL1Address(client),
|
501
|
+
getL2TokenAddress: (args) => getL2TokenAddress(client, args),
|
502
|
+
getL1TokenAddress: (args) => getL1TokenAddress(client, args),
|
441
503
|
}
|
442
504
|
}
|
443
505
|
}
|
package/zksync/index.ts
CHANGED
@@ -119,6 +119,16 @@ export {
|
|
119
119
|
type SignTransactionReturnType,
|
120
120
|
signTransaction,
|
121
121
|
} from './actions/signTransaction.js'
|
122
|
+
export {
|
123
|
+
type GetL2TokenAddressReturnType,
|
124
|
+
type GetL2TokenAddressParameters,
|
125
|
+
getL2TokenAddress,
|
126
|
+
} from './actions/getL2TokenAddress.js'
|
127
|
+
export {
|
128
|
+
type GetL1TokenAddressReturnType,
|
129
|
+
type GetL1TokenAddressParameters,
|
130
|
+
getL1TokenAddress,
|
131
|
+
} from './actions/getL1TokenAddress.js'
|
122
132
|
|
123
133
|
export {
|
124
134
|
/** @deprecated Use `zksync` instead */
|