11import { createGianoConnector , createGianoProvider } from '@appliedblockchain/giano-connector' ;
22import type { Address , Hex , Transport } from 'viem' ;
33import { custom , http , parseGwei } from 'viem' ;
4- import type { BundlerClient , GetPaymasterDataReturnType , GetPaymasterStubDataReturnType , PaymasterActions } from 'viem/account-abstraction' ;
4+ import type {
5+ BundlerClient ,
6+ GetPaymasterDataReturnType ,
7+ GetPaymasterStubDataReturnType ,
8+ } from 'viem/account-abstraction'
59import { createBundlerClient } from 'viem/account-abstraction' ;
610import { createConfig } from 'wagmi' ;
711import type { Chain } from 'wagmi/chains' ;
@@ -20,6 +24,29 @@ type ConfigMap = Record<
2024 }
2125> ;
2226
27+ const sdrTestNet = {
28+ id : 381185 ,
29+ name : 'SilentDataRollup Testnet' ,
30+ testnet : true ,
31+ nativeCurrency : {
32+ // this should be same as ethereum
33+ name : 'Ether' ,
34+ symbol : 'ETH' ,
35+ decimals : 18 ,
36+ } ,
37+ rpcUrls : {
38+ default : {
39+ http : [ 'https://testnet.silentdata.com/ec7e8b3eb491df99357e4cb7903cbc21' ] ,
40+ } ,
41+ } ,
42+ blockExplorers : {
43+ default : {
44+ name : 'SilentDataRollup Explorer' ,
45+ url : 'https://explorer-testnet.rollup.silentdata.com/' ,
46+ } ,
47+ } ,
48+ } satisfies Chain ;
49+
2350// TODO this is creating creating instances for all options unnecessarily
2451const configMap : ConfigMap = {
2552 hardhat : {
@@ -66,6 +93,37 @@ const configMap: ConfigMap = {
6693 paymaster : true ,
6794 } ) ,
6895 } ,
96+ 'sdr-testnet' : {
97+ chain : sdrTestNet ,
98+ transport : http ( ) ,
99+ bundler : createBundlerClient ( {
100+ chain : sdrTestNet ,
101+ transport : http ( envConfig . bundlerRpcUrl ) ,
102+ paymaster : {
103+ getPaymasterData : async ( ) => ( {
104+ paymaster : envConfig . paymasterAddress as Address ,
105+ paymasterData : '0x' ,
106+ paymasterVerificationGasLimit : BigInt ( 100_000 ) ,
107+ paymasterPostOpGasLimit : BigInt ( 80_000 ) ,
108+ } ) ,
109+ getPaymasterStubData : async ( ) => ( {
110+ paymaster : envConfig . paymasterAddress as Address ,
111+ paymasterData : '0x' ,
112+ paymasterVerificationGasLimit : BigInt ( 100_000 ) ,
113+ paymasterPostOpGasLimit : BigInt ( 80_000 ) ,
114+ isFinal : true ,
115+ } ) ,
116+ } ,
117+ userOperation : {
118+ estimateFeesPerGas : async ( ) => {
119+ return {
120+ maxFeePerGas : parseGwei ( '200' ) ,
121+ maxPriorityFeePerGas : parseGwei ( '400' ) ,
122+ } ;
123+ } ,
124+ } ,
125+ } ) ,
126+ } ,
69127} ;
70128
71129const rpcs = < const > {
0 commit comments