File tree Expand file tree Collapse file tree 5 files changed +23
-7
lines changed
content/10.zk-stack/35.prividium/_partials/quickstart Expand file tree Collapse file tree 5 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,18 @@ The permissions config file at
77` /chains/prividium_chain/configs/private-rpc-permissions.yaml `
88can be edited based on what access you want end users to have.
99
10- There are two sections in the permissions file:
10+ There are three sections in the permissions file:
1111
12+ - ` whitelisted_wallets ` : Wallet addresses that are allowed to access the network.
1213- ` groups ` : Logical collections of users or addresses sharing the same permissions.
1314- ` contracts ` : Specific contracts or methods that a group is allowed to access.
1415
16+ ### Wallets Access
17+
18+ The ` whitelisted_wallets ` section defines wallet addresses that are allowed to access the network.
19+ To allow any wallet access, you can use the string ` all ` .
20+ Otherwise, you must define a list of allowed addresses.
21+
1522### Groups Access
1623
1724You can define hard-coded groups of administrative addresses in the ` groups ` section.
Original file line number Diff line number Diff line change 1+ # To allow any wallet to connect, use the literal string "all".
2+ # Example: whitelisted_wallets: "all"
3+
4+ # To restrict access to specific wallets, provide a non-empty list of addresses.
5+ whitelisted_wallets :
6+ - ' 0x742d35Cc6634C0532925a3b8D69C7F16F6d34d2c' # Example wallet address
7+
18groups :
29 - name : ' group1'
310 members :
Original file line number Diff line number Diff line change 1+ whitelisted_wallets : ' all'
12groups :
23 - name : ' admins_group1'
34 members :
Original file line number Diff line number Diff line change @@ -5,17 +5,16 @@ import { Provider } from 'zksync-ethers';
55const CONTRACT_ADDRESS = process . env . CONTRACT_ADDRESS || '' ;
66const BASE_URL = process . env . BASE_URL || 'http://localhost:4041' ;
77const USER_TOKEN = process . env . USER_TOKEN || '' ;
8+ const PRIVATE_KEY = process . env . WALLET_PRIVATE_KEY ;
89if ( ! CONTRACT_ADDRESS || ! USER_TOKEN ) throw '⛔️ Provide address of the contract and user token.' ;
910
1011async function main ( ) {
1112 console . log ( `Running script to check balance of token ${ CONTRACT_ADDRESS } ` ) ;
12-
13- // Get wallet address
14- const [ wallet ] = await ethers . getWallets ( ) ;
13+ if ( ! PRIVATE_KEY ) throw '⛔️ Provide private key.' ;
1514
1615 // Connect to user-specific url
1716 const provider = new Provider ( `${ BASE_URL } /rpc/${ USER_TOKEN } ` ) ;
18- const signer = new ethers . Wallet ( wallet . privateKey , provider ) ;
17+ const signer = new ethers . Wallet ( PRIVATE_KEY , provider ) ;
1918
2019 // Get the ERC20 deployed contract
2120 const ERC20Factory = await ethers . getContractFactory ( 'MyERC20Token' ) ;
Original file line number Diff line number Diff line change @@ -7,13 +7,15 @@ const CONTRACT_ADDRESS = process.env.CONTRACT_ADDRESS || '';
77const RECIPIENT_ADDRESS = process . env . RECIPIENT_ADDRESS || '' ;
88// Base URL of the private proxy RPC API
99const BASE_URL = process . env . BASE_URL || 'http://localhost:4041' ;
10+ const PRIVATE_KEY = process . env . WALLET_PRIVATE_KEY ;
1011if ( ! CONTRACT_ADDRESS || ! RECIPIENT_ADDRESS ) throw '⛔️ Provide address of the contract and recipient.' ;
1112
1213async function main ( ) {
1314 console . log ( `Running script to interact with token contract ${ CONTRACT_ADDRESS } ` ) ;
15+ if ( ! PRIVATE_KEY ) throw '⛔️ Provide private key.' ;
1416
1517 // Get deployer address
16- const [ deployer ] = await ethers . getWallets ( ) ;
18+ const [ deployer ] = await ethers . getSigners ( ) ;
1719
1820 // Register the user and get user access token
1921 const userToken = await registerUser ( deployer . address ) ;
@@ -23,7 +25,7 @@ async function main() {
2325
2426 // Connect to user-specific url
2527 const provider = new Provider ( `${ BASE_URL } /rpc/${ userToken } ` ) ;
26- const signer = new ethers . Wallet ( deployer . privateKey , provider ) ;
28+ const signer = new ethers . Wallet ( PRIVATE_KEY , provider ) ;
2729
2830 // Get the ERC20 deployed contract
2931 const ERC20Factory = await ethers . getContractFactory ( 'MyERC20Token' ) ;
You can’t perform that action at this time.
0 commit comments