Skip to content

Commit 9340416

Browse files
fix: prividium guide (#423)
minor fixes for the prividium guide
1 parent 7f0c6a4 commit 9340416

File tree

5 files changed

+23
-7
lines changed

5 files changed

+23
-7
lines changed

content/10.zk-stack/35.prividium/_partials/quickstart/_access.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ The permissions config file at
77
`/chains/prividium_chain/configs/private-rpc-permissions.yaml`
88
can 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

1724
You can define hard-coded groups of administrative addresses in the `groups` section.

examples/prividium/example-permissions.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
groups:
29
- name: 'group1'
310
members:

examples/prividium/permissions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
whitelisted_wallets: 'all'
12
groups:
23
- name: 'admins_group1'
34
members:

examples/prividium/scripts/check-balance.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ import { Provider } from 'zksync-ethers';
55
const CONTRACT_ADDRESS = process.env.CONTRACT_ADDRESS || '';
66
const BASE_URL = process.env.BASE_URL || 'http://localhost:4041';
77
const USER_TOKEN = process.env.USER_TOKEN || '';
8+
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY;
89
if (!CONTRACT_ADDRESS || !USER_TOKEN) throw '⛔️ Provide address of the contract and user token.';
910

1011
async 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');

examples/prividium/scripts/priv-interact.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ const CONTRACT_ADDRESS = process.env.CONTRACT_ADDRESS || '';
77
const RECIPIENT_ADDRESS = process.env.RECIPIENT_ADDRESS || '';
88
// Base URL of the private proxy RPC API
99
const BASE_URL = process.env.BASE_URL || 'http://localhost:4041';
10+
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY;
1011
if (!CONTRACT_ADDRESS || !RECIPIENT_ADDRESS) throw '⛔️ Provide address of the contract and recipient.';
1112

1213
async 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');

0 commit comments

Comments
 (0)