Skip to content

Commit 7672ee7

Browse files
committed
add sdr configurations for frontend example
1 parent 752def5 commit 7672ee7

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
NEXT_PUBLIC_GIANO_SMART_WALLET_FACTORY_ADDRESS=0x6b15618d20dB7D70e9dE2Ff90B68Ad0996Bc116c
2+
NEXT_PUBLIC_CONFIG_KEY=sdr-testnet
3+
NEXT_PUBLIC_BUNDLER_RPC_URL=http://51.38.208.86:14337/rpc
4+
NEXT_PUBLIC_PRIVATE_ERC20_ADDRESS=0xdEB42467d0BB4CfB86bcB6c431B42104bEe97863
5+
NEXT_PUBLIC_PAYMASTER_ADDRESS=0x1251DCe5637971E36179e18f2B4Ecf82c277A56b
6+
SDR_EOA_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000

services/custom-example/src/wagmi.ts

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { createGianoConnector, createGianoProvider } from '@appliedblockchain/giano-connector';
22
import type { Address, Hex, Transport } from 'viem';
33
import { 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'
59
import { createBundlerClient } from 'viem/account-abstraction';
610
import { createConfig } from 'wagmi';
711
import 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
2451
const 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

71129
const rpcs = <const>{

0 commit comments

Comments
 (0)