Skip to content

Commit ff33b66

Browse files
committed
cleaning up connect page
1 parent 614862b commit ff33b66

File tree

1 file changed

+41
-19
lines changed

1 file changed

+41
-19
lines changed

content/connect.md

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,53 @@ For developers integrating Rubix Wallet with their dApps or requiring extended f
2828

2929
## **API Endpoints**
3030

31-
{{< tabs "uniqueid" >}}
31+
{{< tabs "uniqued" >}}
3232

3333
{{< tab "Wallet" >}}
3434
| Operation | Endpoint | Description | Sample Request | Sample Response |
3535
|------------------|---------------|-------------|-------|------|
36-
| Create Wallet | `/create` | Creates a new wallet and returns a DID | ```curl -X POST http://20.193.136.169:8080/create -d '{"email":"bob@c.com","password":"123","name":"bob", "wallet_type":"self-custody", "public_key":"041756d13ad46e7811c99c961762472aa64a67554ae09e78b9c096350bc6a8bed3798fe19e3e3203a69d0ac00a60dc32b3652a2e7e372a7c60a64a1f3e06ec4c18"}'```<br><br>`"wallet_type" string`<br>"self-custody": when user manages keys and on-demand signing, else pass empty string ""<br>`"public_key" string`<br>in case "wallet_type" is self-custody, pass user's public key to get DID<br>`"secret_key" string (optional)`<br>to encrypt user's private key, in case "wallet_type" is not self-custody <br> | ```json { "did": "bafybmiatw5srgqlw3t5sm4buktu5gcgbfhkgujohem3o3a4cusvt424sei", "email": "bob@c.com", "name": "bob" }```<br><br>`"did"`<br>Rubix DID generated from user's public key<br> |
37-
| Login | `/login` | Authenticates user and returns jwt token| ```curl -L -X POST 'http://20.193.136.169:8080/login' --data-raw '{ "email": "bob@c.com", "password": "123" }'``` | ```json { "token": "<jwt token>" }``` <br><br> `"token"` is the authorzation header that the user needs to pass to access the subsequent operations<br> |
38-
| Register DID | `/register_did` | Registers user DID on the network | ```curl -L -X POST http://20.193.136.169:8080/register_did -H 'Authorization: Bearer <jwt token>' -d '{ "did":"<user DID>" }'``` | ```json { "status": true, "message": "DID registered successfully", "result": null }``` |
39-
| Get Balance | `/request_balance` | Fetches current balance of the user | ```curl -L -X GET "http://20.193.136.169:8080/request_balance?did=<user DID>" -H 'Authorization: Bearer <jwt token>'``` | ```json { "status": true, "message": "Got account info successfully", "result": [{ "Did": "<user DID>", "Rbt_amount": 1 }] }``` |
40-
| Transfer RBT | `/request_txn` | Initiates an RBT transfer | ```curl -L -X POST http://20.193.136.169:8080/request_txn -H 'Authorization: Bearer <jwt token>' -d '{ "did":"<sender DID>", "receiver":"<receiver DID>", "rbt_amount": <transaction amount> }'```<br><br>`"rbt_amount" float64`<br>transaction amount with 3 decimals limit<br> | In case of self-custodial wallet:<br>```json { "status": true, "message": "Transaction initiated", "result": { "did": "<user DID>", "sign_data": { "hash": "<string>", "id": "<string>", "mode": 4 } } }```<br>`"hash"` is the message to be signed<br>`"id"` is the unique signature session Id<br>`"mode"` is the requested signature mode(mode:4 represents secp256k1 curve based signature)<br><br>In other cases:<br>```{"status":true,"message":"Transfer finished successfully in 14.059856393s with trnxid d5e06dbdb20e235031afdbc958fe153357ee748dcb79d3b50d49a6f0413d39e4","result":null}``` |
41-
| Pass Signature | `/pass_signature` | Provides signature for transaction finalization | ```curl -L -X POST http://20.193.136.169:8080/pass_signature -H 'Authorization: Bearer <jwt token>' -d '{ "did": "<sender DID>", "sign_response": { "id": "<string>", "mode": 4, "signature": { "Signature": "<[]byte>" } } }'```<br><br>*Note: use this operation in case of self-custodial wallet*<br> | ```json { "status": true, "message": "Transfer finished successfully in <time> with trnxid <transaction id>", "result": null }``` |
42-
| Create FT | `/create_ft` | Creates required number of FTs, each of same value | ```curl -L -X POST "http://localhost:8080/create_ft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "ft_count":<number of FTs in int>, "ft_name":"<ft name>", "token_count":<number of RBTs in int>}'``` | ```{"status":true,"message":"FT created successfully","result":null}``` |
43-
| Transfer FT | `/transfer_ft` | Initiates an FT transfer | ```curl -L -X POST "http://localhost:8080/transfer_ft -H 'Authorization: Bearer <jwt token>' -d '{"sender":"<sender DID>", "receiver":<receiver DID>, "ft_count":<number of FTs in int>, "ft_name":"<ft name>", "creatorDID":<DID of FT creator>}'``` | ```{"status":true,"message":"FT Transfer finished successfully in 12.41772759s with trnxid 8effdf7d21d8a4b019ddb30c4441bfa8c575a6b055785d160fd4d11a7d9ee633","result":null}``` |
44-
| Get All FTs | `/get_all_ft` | Fetches information of all FTs owned by user | ```curl -L -X GET "http://localhost:8080/get_all_ft?did=<user DID>" -H 'Authorization: Bearer <jwt token>'``` | ```{"status":true,"message":"Got FT info successfully","result":[{"creator_did":"bafybmiaysyb5hbdb6clsk7jncdejxwomxumv3zos5t57f6bwz7numvaina","ft_count":4,"ft_name":"testFT-1"}]}``` |
45-
| Create NFT | `/create_nft` | Creates NFT of the provided artifact | ```curl -L -X POST "http://localhost:8080/create_nft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "metadata":"<metadata file path in string>", "artifact":"<artifact file path in string>"}'``` | ```{"status":true,"message":"NFT Token generated successfully","result":null}``` |
46-
| Subscribe FT | `/subscribe_nft` | Subscribes an NFT to get all updates and be able to execute the NFT | ```curl -L -X POST "http://localhost:8080/subscribe_nft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "nft":<nft token ID>}'``` | ```{"status":true,"message":"NFT subscribed successfully","result":null}``` |
47-
| Deploy NFT | `/deploy_nft` | Initiates NFT deployment on chain | ```curl -L -X POST "http://localhost:8080/deploy_nft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "nft":"<nft ID>", "quorum_type":<1 or 2>}'``` | ```{"status":true,"message":"NFT Deployed successfully in 10.891008617s","result":null}``` |
48-
| Transfer NFT | `/execute_nft` | Initiates NFT transfer | ```curl -L -X POST http://localhost:8080/execute_nft -H 'Authorization: Bearer <jwt token>' -d '{"comment": "<string>", "nft": "<NFT tokenID>", "nft_data": "<string>", "nft_value": <value assigned to NFT in float64>, "owner": "<sender DID>", "quorum_type": <1 or 2 int>, "receiver": "<receiver DID>"}'``` | ```{"status":true,"message":"NFT Deployed successfully in 10.891008617s","result":null}``` |
49-
| Get All NFTs | `/get_all_nft` | Fetches information of all NFTs owned by user | ```curl -L -X GET "http://localhost:8080/get_all_nft?did=<string>" -H 'Authorization: Bearer <jwt token returned while logging in>'``` | ```{"status":true,"message":"Got All NFTs","result":[{"nft":"QmNMBaU9B6ZaBjaPgufTaTsTu9dHjtf3XWWogFPJ3zy9u6","nft_value":0,"owner_did":"bafybmiaysyb5hbdb6clsk7jncdejxwomxumv3zos5t57f6bwz7numvaina"}]}``` |
50-
| Generate Smart Contract Token | `/generate-smart-contract` | Genertaes a smart contract tokenID | ```curl -L -X POST 'http://localhost:8080/generate-smart-contract' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Mzc3MjExODgsInN1YiI6ImJhZnlibWlheXN5YjVoYmRiNmNsc2s3am5jZGVqeHdvbXh1bXYzem9zNXQ1N2Y2Ynd6N251bXZhaW5hIn0.WU8P4UJiq-Jap_NhmHONhCah6d5xtoL6lHaH6ceUFJ4' \ -F 'did=<user DID>' \ -F 'binaryCodePath=@/path/to/bidding_contract.wasm' \ -F 'rawCodePath=@/path/to/lib.rs' \ -F 'schemaFilePath=@/path/to/bidding_contract.json'``` | ```{"status":true,"message":"Smart contract generated successfully","result":{"binaryFilePath":"binary/file/path_binaryCodePath","rawFilePath":"raw/code/path_rawCodePath","schemaFilePath":"schema/file/path_schemaFilePath"}}``` |
51-
| Subscribe Smart Contract | `/subscribe-smart-contract` | Subscribes a smart contract to get all updates and be able to execute it | ```curl -L -X POST "http://localhost:8080/subscribe-smart-contract -H 'Authorization: Bearer <jwt token returned while logging in>' -d '{"did":"<user DID>", "smartContractToken":<smart contract token ID>}'``` | ```{"status":true,"message":"Smart contract subscribed successfully","result":null}``` |
52-
| Deploy Smart Contract | `/deploy-smart-contract` | Initiates smart contract deployment on chain | ```curl -L -X POST "http://localhost:8080/deploy-smart-contract -H 'Authorization: Bearer <jwt token returned while logging in>' -d '{"deployerAddr":"<user DID>", "smartContractToken":"<smart Contract Token ID>", "quorumType":<1 or 2>, "rbtAmount":<float64>,"comment":"<string>"}'``` | ```{"status":true,"message":"Smart Contract Token Deployed successfully in 16.916829104s","result":null}``` |
53-
| Execute Smart Contract | `/execute-smart-contract` | Initiates smart contract execution | ```curl -L -X POST http://localhost:8080/execute-smart-contract -H 'Authorization: Bearer <jwt token returned while logging in>' -d '{"comment": "<comment>","smartContractToken": "<smart Contract Token ID>","smartContractData": "<string>","executorAddr": "<executor DID>","quorumType": <1 or 2>}'``` | ```{"status":true,"message":"Smart Contract Token Executed successfully in 11.302358297s","result":null}``` |
36+
| Create Wallet | `/create` | Creates a new wallet and returns a DID | ```curl -X POST https://safepass.rubix.net/create -d '{"email":"bob@c.com","password":"123","name":"bob", "wallet_type":"self-custody", "public_key":"041756d13ad46e7811c99c961762472aa64a67554ae09e78b9c096350bc6a8bed3798fe19e3e3203a69d0ac00a60dc32b3652a2e7e372a7c60a64a1f3e06ec4c18"}'```<br><br>`"wallet_type" string`<br>"self-custody": when user manages keys and on-demand signing, else pass empty string ""<br>`"public_key" string`<br>in case "wallet_type" is self-custody, pass user's public key to get DID<br>`"secret_key" string (optional)`<br>to encrypt user's private key, in case "wallet_type" is not self-custody <br> | ```json { "did": "bafybmiatw5srgqlw3t5sm4buktu5gcgbfhkgujohem3o3a4cusvt424sei", "email": "bob@c.com", "name": "bob" }```<br><br>`"did"`<br>Rubix DID generated from user's public key<br> |
37+
| Login | `/login` | Authenticates user and returns web token| ```curl -L -X POST 'https://safepass.rubix.net/login' --data-raw '{ "email": "bob@c.com", "password": "123" }'``` | ```json { "token": "<jwt token>" }``` <br><br> `"token"` is the authorization header that the user needs to pass to access the subsequent operations<br> |
38+
| Register DID | `/register_did` | Registers user DID on the network | ```curl -L -X POST https://safepass.rubix.net/register_did -H 'Authorization: Bearer <jwt token>' -d '{ "did":"<user DID>" }'``` | ```json { "status": true, "message": "DID registered successfully", "result": null }``` |
39+
| Get Balance | `/request_balance` | Fetches current balance of the user | ```curl -L -X GET "https://safepass.rubix.net/request_balance?did=<user DID>" -H 'Authorization: Bearer <jwt token>'``` | ```json { "status": true, "message": "Got account info successfully", "result": [{ "Did": "<user DID>", "Rbt_amount": 1 }] }``` |
40+
| Transfer RBT | `/request_txn` | Initiates an RBT transfer | ```curl -L -X POST https://safepass.rubix.net/request_txn -H 'Authorization: Bearer <jwt token>' -d '{ "did":"<sender DID>", "receiver":"<receiver DID>", "rbt_amount": <transaction amount> }'```<br><br>`"rbt_amount" float64`<br>transaction amount with 3 decimals limit<br> | In case of self-custodial wallet:<br>```json { "status": true, "message": "Transaction initiated", "result": { "did": "<user DID>", "sign_data": { "hash": "<string>", "id": "<string>", "mode": 4 } } }```<br>`"hash"` is the message to be signed<br>`"id"` is the unique signature session Id<br>`"mode"` is the requested signature mode(mode:4 represents secp256k1 curve based signature)<br><br>In other cases:<br>```{"status":true,"message":"Transfer finished successfully in 14.059856393s with trnxid d5e06dbdb20e235031afdbc958fe153357ee748dcb79d3b50d49a6f0413d39e4","result":null}``` |
5441

5542
{{< /tab >}}
5643

44+
{{< tab "FTs" >}}
45+
| Operation | Endpoint | Description | Sample Request | Sample Response |
46+
|------------------|---------------|-------------|-------|------|
47+
| Create FT | `/create_ft` | Creates required number of FTs, each of same value | ```curl -L -X POST "https://safepass.rubix.net/create_ft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "ft_count":<number of FTs in int>, "ft_name":"<ft name>", "token_count":<number of RBTs in int>}'``` | ```{"status":true,"message":"FT created successfully","result":null}``` |
48+
| Transfer FT | `/transfer_ft` | Initiates an FT transfer | ```curl -L -X POST "https://safepass.rubix.net/transfer_ft -H 'Authorization: Bearer <jwt token>' -d '{"sender":"<sender DID>", "receiver":<receiver DID>, "ft_count":<number of FTs in int>, "ft_name":"<ft name>", "creatorDID":<DID of FT creator>}'``` | ```{"status":true,"message":"FT Transfer finished successfully in 12.41772759s with trnxid 8effdf7d21d8a4b019ddb30c4441bfa8c575a6b055785d160fd4d11a7d9ee633","result":null}``` |
49+
| Get All FTs | `/get_all_ft` | Fetches information of all FTs owned by user | ```curl -L -X GET "https://safepass.rubix.net/get_all_ft?did=<user DID>" -H 'Authorization: Bearer <jwt token>'``` | ```{"status":true,"message":"Got FT info successfully","result":[{"creator_did":"bafybmiaysyb5hbdb6clsk7jncdejxwomxumv3zos5t57f6bwz7numvaina","ft_count":4,"ft_name":"testFT-1"}]}``` |
50+
{{< /tab >}}
51+
52+
{{< tab "NFTs" >}}
53+
| Operation | Endpoint | Description | Sample Request | Sample Response |
54+
|------------------|---------------|-------------|-------|------|
55+
| Create NFT | `/create_nft` | Creates NFT of the provided artifact | ```curl -L -X POST "https://safepass.rubix.net/create_nft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "metadata":"<metadata file path in string>", "artifact":"<artifact file path in string>"}'``` | ```{"status":true,"message":"NFT Token generated successfully","result":null}``` |
56+
| Subscribe FT | `/subscribe_nft` | Subscribes an NFT to get all updates and be able to execute the NFT | ```curl -L -X POST "https://safepass.rubix.net/subscribe_nft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "nft":<nft token ID>}'``` | ```{"status":true,"message":"NFT subscribed successfully","result":null}``` |
57+
| Deploy NFT | `/deploy_nft` | Initiates NFT deployment on chain | ```curl -L -X POST "https://safepass.rubix.net/deploy_nft -H 'Authorization: Bearer <jwt token>' -d '{"did":"<user DID>", "nft":"<nft ID>", "quorum_type":<1 or 2>}'``` | ```{"status":true,"message":"NFT Deployed successfully in 10.891008617s","result":null}``` |
58+
| Transfer NFT | `/execute_nft` | Initiates NFT transfer | ```curl -L -X POST https://safepass.rubix.net/execute_nft -H 'Authorization: Bearer <jwt token>' -d '{"comment": "<string>", "nft": "<NFT tokenID>", "nft_data": "<string>", "nft_value": <value assigned to NFT in float64>, "owner": "<sender DID>", "quorum_type": <1 or 2 int>, "receiver": "<receiver DID>"}'``` | ```{"status":true,"message":"NFT Deployed successfully in 10.891008617s","result":null}``` |
59+
| Get All NFTs | `/get_all_nft` | Fetches information of all NFTs owned by user | ```curl -L -X GET "https://safepass.rubix.net/get_all_nft?did=<string>" -H 'Authorization: Bearer <jwt token returned while logging in>'``` | ```{"status":true,"message":"Got All NFTs","result":[{"nft":"QmNMBaU9B6ZaBjaPgufTaTsTu9dHjtf3XWWogFPJ3zy9u6","nft_value":0,"owner_did":"bafybmiaysyb5hbdb6clsk7jncdejxwomxumv3zos5t57f6bwz7numvaina"}]}``` |
60+
61+
{{< /tab >}}
62+
63+
{{< tab "Smart Contracts" >}}
64+
| Operation | Endpoint | Description | Sample Request | Sample Response |
65+
|------------------|---------------|-------------|-------|------|
66+
| Generate Smart Contract Token | `/generate-smart-contract` | Generates a smart contract tokenID | ```curl -L -X POST 'https://safepass.rubix.net/generate-smart-contract' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Mzc3MjExODgsInN1YiI6ImJhZnlibWlheXN5YjVoYmRiNmNsc2s3am5jZGVqeHdvbXh1bXYxzem9zNXQ1N2Y2Ynd6N251bXZhaW5hIn0.WU8P4UJiq-Jap_NhmHONhCah6d5xtoL6lHaH6ceUFJ4' \ -F 'did=<user DID>' \ -F 'binaryCodePath=@/path/to/bidding_contract.wasm' \ -F 'rawCodePath=@/path/to/lib.rs' \ -F 'schemaFilePath=@/path/to/bidding_contract.json'``` | ```{"status":true,"message":"Smart contract generated successfully","result":{"binaryFilePath":"binary/file/path_binaryCodePath","rawFilePath":"raw/code/path_rawCodePath","schemaFilePath":"schema/file/path_schemaFilePath"}}``` |
67+
| Subscribe Smart Contract | `/subscribe-smart-contract` | Subscribes a smart contract to get all updates and be able to execute it | ```curl -L -X POST "https://safepass.rubix.net/subscribe-smart-contract -H 'Authorization: Bearer <jwt token returned while logging in>' -d '{"did":"<user DID>", "smartContractToken":<smart contract token ID>}'``` | ```{"status":true,"message":"Smart contract subscribed successfully","result":null}``` |
68+
| Deploy Smart Contract | `/deploy-smart-contract` | Initiates smart contract deployment on chain | ```curl -L -X POST "https://safepass.rubix.net/deploy-smart-contract -H 'Authorization: Bearer <jwt token returned while logging in>' -d '{"deployerAddr":"<user DID>", "smartContractToken":"<smart Contract Token ID>", "quorumType":<1 or 2>, "rbtAmount":<float64>,"comment":"<string>"}'``` | ```{"status":true,"message":"Smart Contract Token Deployed successfully in 16.916829104s","result":null}``` |
69+
| Execute Smart Contract | `/execute-smart-contract` | Initiates smart contract execution | ```curl -L -X POST https://safepass.rubix.net/execute-smart-contract -H 'Authorization: Bearer <jwt token returned while logging in>' -d '{"comment": "<comment>","smartContractToken": "<smart Contract Token ID>","smartContractData": "<string>","executorAddr": "<executor DID>","quorumType": <1 or 2>}'``` | ```{"status":true,"message":"Smart Contract Token Executed successfully in 11.302358297s","result":null}``` |
70+
71+
72+
{{< /tab >}}
73+
{{< tab "Signature" >}}
74+
| Operation | Endpoint | Description | Sample Request | Sample Response |
75+
|------------------|---------------|-------------|-------|------|
76+
| Pass Signature | `/pass_signature` | Provides signature for transaction finalization | ```curl -L -X POST https://safepass.rubix.net/pass_signature -H 'Authorization: Bearer <jwt token>' -d '{ "did": "<sender DID>", "sign_response": { "id": "<string>", "mode": 4, "signature": { "Signature": "<[]byte>" } } }'```<br><br>*Note: use this operation in case of self-custodial wallet*<br> | ```json { "status": true, "message": "Transfer finished successfully in <time> with trnxid <transaction id>", "result": null }``` |
77+
{{< /tab >}}
78+
5779
{{< /tabs >}}
5880

0 commit comments

Comments
 (0)