Skip to content

Commit d7b2c4b

Browse files
feat: adding user wallet and scp guide , and fixing youtube video blocking header (#150)
…ader ## Summary by Sourcery Update the Content Security Policy to allow YouTube embeds and add a developer guide for user wallets and the smart contract portal. Bug Fixes: - Fixed YouTube video embedding by updating the Content Security Policy (CSP) to allow iframes from youtube.com Documentation: - Added a new developer guide on how to create user wallets and send transactions using the smart contract portal on the SettleMint platform Co-authored-by: saeeddawod <saeed.dawod@gmail.com>
1 parent 0614069 commit d7b2c4b

File tree

10 files changed

+95
-1
lines changed

10 files changed

+95
-1
lines changed
791 KB
Loading
1.03 MB
Loading
927 KB
Loading
1.11 MB
Loading
394 KB
Loading
942 KB
Loading
946 KB
Loading
671 KB
Loading
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: User Wallets and Smart Contract Portal
3+
description: Guide for creating user wallets and sending transactions using the smart contract portal
4+
---
5+
6+
# User Wallets and Smart Contract Portal
7+
8+
In this document, we will guide you through the creation of user wallets using the smart contract portal on the SettleMint platform. We will also show how you can send transactions to your contracts and sign them with one of the wallets in the portal.
9+
10+
## Required platform deployments:
11+
- Blockchain network (e.g. besu)
12+
- An HD ECDSA private key
13+
- An empty smart contract set
14+
- A smart contract portal
15+
16+
### Blockchain network
17+
For the purpose of this guide, you can set up a Besu network with one validator node and the default parameters in the region of your choice.
18+
19+
### HD ECDSA
20+
Create the user wallet deployment along with one user wallet. For detailed instructions, see:
21+
- [User Wallet Guide](https://console.settlemint.com/documentation/docs/using-platform/user_wallet/)
22+
- [Private Keys Guide](https://console.settlemint.com/documentation/docs/using-platform/private-keys/)
23+
24+
Make sure to enable the address on your node.
25+
26+
### Empty smart contract
27+
Deploy an empty smart contract set on your network and from the IDE, run the Hardhat - Deploy to platform network task.
28+
29+
Keep the address of the smart contract, you will need it to send a transaction in the portal.
30+
31+
32+
33+
![Contract deployment](user-wallet-scp-images/image5.png)
34+
35+
36+
You will also need the contract ABI. You can find it in **out/counter.sol/counter.json**
37+
38+
### Smart contract portal
39+
Deploy the portal on your blockchain network and use the contract that you copied from the IDE. This will create a custom API automatically.
40+
41+
![Smart contract portal](user-wallet-scp-images/image8.png)
42+
43+
## Create a new wallet using the portal
44+
To create a new wallet go to the REST tab of your portal and enter full screen mode. You should see this screen
45+
46+
![REST tab](user-wallet-scp-images/image7.png)
47+
48+
Next, expand the Wallet section on the left and select `/wallets`.
49+
50+
![Wallet section](user-wallet-scp-images/image1.png)
51+
52+
You can test the request directly from the portal by clicking on **Test Request**. This opens a form in which you can enter the **keyVaultId** of your wallet and the user name of your choice:
53+
54+
![Test request form](user-wallet-scp-images/image2.png)
55+
56+
After you've sent the request, you can check your HD ECDSA wallet in the private key section. You should see a new account in the account section:
57+
58+
![Account section](user-wallet-scp-images/image6.png)
59+
60+
Alternatively, you can also send the request using cURL:
61+
62+
```bash
63+
curl https://scs-portal-url/wallets \
64+
--request POST \
65+
--header 'Content-Type: application/json' \
66+
--header 'x-auth-token: application-access-token' \
67+
--data '{
68+
"keyVaultId": "user-wallets-03a52",
69+
"walletInfo": {
70+
"name": "support@settlemint.com"
71+
}
72+
}'
73+
```
74+
75+
Other wallets methods are currently not supported.
76+
77+
## Send a transaction through the portal
78+
You are now going to send a transaction to the counter contract deployed earlier. To do so, expand the **Counter** section on the left and select `/api/counter/{address}/set-number`.
79+
80+
![Counter section](user-wallet-scp-images/image4.png)
81+
82+
Click on **Test Request** to open the details. To successfully send a transaction, you must enter the smart contract address in **Path Variables**. Then, in the body, enter the address of one of the user accounts. You can get it from the **Users** tab of the deployment. Set the **gasLimit**, the **gasPrice**, the **input** and click on **Send**. You should get a transactionHash back.
83+
84+
![Transaction details](user-wallet-scp-images/image3.png)

nginx.conf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ http {
5050
#gzip on;
5151

5252
# Add security headers
53-
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: https:; font-src 'self' https://fonts.gstatic.com; connect-src 'self' https://*.settlemint.com; frame-ancestors 'none'; object-src 'none'" always;
53+
add_header Content-Security-Policy "default-src 'self';
54+
script-src 'self' https://www.google-analytics.com;
55+
style-src 'self' https://fonts.googleapis.com;
56+
img-src 'self' data: https:;
57+
font-src 'self' https://fonts.gstatic.com;
58+
connect-src 'self' https://*.settlemint.com;
59+
frame-src 'self' https://www.youtube.com https://youtube.com;
60+
frame-ancestors 'none';
61+
object-src 'none';
62+
base-uri 'self';
63+
form-action 'self'" always;
5464
add_header X-Frame-Options "DENY" always;
5565
add_header X-Content-Type-Options "nosniff" always;
5666
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

0 commit comments

Comments
 (0)