zano companion methods

Signed-off-by: ravaga <trueravaga@gmail.com>
This commit is contained in:
ravaga 2024-06-12 14:12:02 +02:00
parent 5395bd6f4f
commit 2cff2f372d
No known key found for this signature in database
GPG key ID: 995E84818B97A2F0
8 changed files with 308 additions and 0 deletions

View file

@ -0,0 +1,4 @@
{
"label": "Zano Companion",
"position": 5
}

View file

@ -0,0 +1,38 @@
# Accept Ionic Swap proposal
Accepts Ionic Swap proposal
In your web app, call extension Ionic Swap proposal method, while extension is on.
### Request
```jsx
window.zano.request(
'IONIC_SWAP_ACCEPT',
{
hex_raw_proposal: ""
},
timeout
);
```
where:
- hex_raw_proposal - Hex-encoded proposal raw data(encrypted with common shared key). Includes half-created transaction template and some extra information that would be needed counterparty to finialize and sign transaction
- timeout - Timeout of request in ms (set to null to disable)
### Response
```json
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"result_tx_id": ""
}
}
```
where:
- result_tx_id - Result transaction ID

View file

@ -0,0 +1,45 @@
# Get Alias Details
Gets common info of specified alias. Proxy of [get_alias_details](/docs/build/rpc-api/daemon-rpc-api/get_alias_details/) method.
In your web app, call extension Get Alias Details method, while extension is on.
### Request
```jsx
window.zano.request(
'GET_ALIAS_DETAILS',
{
alias: ""
}
);
```
where:
- alias - alias of the request
### Response
```json
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"alias_details": {
"address": "",
"comment": "",
"tracking_key": ""
},
"status": "OK"
}
}
```
where:
- "alias_details": Contains the detailed information about the specified alias, including the associated wallet address, tracking key, comment etc..
- "address": Address of the alias.
- "comment": Arbitrary comment (optional).
- "tracking_key": View secret key of the corresponding address (optional).
- "status": Status of the call.

View file

@ -0,0 +1,61 @@
# Get Wallet Balance
Gets balance of current wallet
In your web app, call extension Get Wallet Balance method, while extension is on.
### Request
```jsx
window.zano.request('GET_WALLET_BALANCE');
```
### Response
```json
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"balance": 10000000000,
"balances": [{
"asset_info": {
"asset_id": "f74bb56a5b4fa562e679ccaadd697463498a66de4f1760b2cd40f11c3a00a7a8",
"current_supply": 500000000000000000,
"decimal_point": 12,
"full_name": "Zano wrapped USD",
"hidden_supply": false,
"meta_info": "Stable and private",
"owner": "f74bb56a5b4fa562e679ccaadd697463498a66de4f1760b2cd40f11c3a00a7a8",
"ticker": "ZUSD",
"total_max_supply": 1000000000000000000
},
"awaiting_in": 1000000000000,
"awaiting_out": 2000000000000,
"total": 100000000000000,
"unlocked": 50000000000000
}],
"unlocked_balance": 11000000000
}
}
```
where:
- "balance": Native coins total amount
- "balances": Balances groupped by it's asset_id
- "asset_info": Asset info details
- "asset_id": Asset ID
- "current_supply": Currently emitted supply for given asset
- "decimal_point": Decimal point
- "full_name": Full name of the asset
- "hidden_supply": This one reserved for future use, will be documented later
- "meta_info": Any other information assetiaded with asset in a free form
- "owner": Owner's key, used to validate any operations on the asset altering, could be changed in case of transfer ownership
- "ticker": Ticker associated with asset
- "total_max_supply": Maximum possible supply for given asset, can't be changed after deployment
- "awaiting_in": Unconfirmed amount for receive
- "awaiting_out": Unconfirmed amount for send
- "total": Total coins available(including locked)
- "unlocked": Unlocked coins available(the ones that could be used right now)
- "unlocked_balance": Native coins total unlocked amount

View file

@ -0,0 +1,47 @@
# Get Wallet Data
Gets common info of this wallet
In your web app, call extension Get Wallet Data method, while extension is on.
### Request
```jsx
window.zano.request('GET_WALLET_DATA');
```
### Response
```json
{
"data": {
"address": "",
"alias": "",
"balance": 0,
"transactions": [{
"isConfirmed": true,
"txHash": "",
"blobSize": 0,
"timestamp": 1700000000,
"height": 0,
"paymentId": "",
"comment": "",
"fee": "0.01",
"addresses": [""],
"transfers": [{
"amount": "",
"assetId": "",
"incoming": false
}]
}],
"assets": [{
"name": "",
"ticker": "",
"assetId": "",
"decimalPoint": 12,
"balance": "",
"unlockedBalance": ""
}]
}
}
```

View file

@ -0,0 +1,31 @@
# Get Whitelist
Returns [whitelisted assets](https://api.zano.org/assets_whitelist.json).
In your web app, call extension Get Whitelist method, while extension is on.
### Request
```jsx
window.zano.request('GET_WHITELIST');
```
### Response
```json
{
"data": [{
"asset_id": "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a",
"decimal_point": 12,
"full_name": "Zano",
"ticker": "ZANO"
}]
}
```
where:
- asset_id - ID of the asset
- decimal_point - Decimal point of the asset
- full_name - Full Name of the asset
- ticker - Ticker of the asset

View file

@ -0,0 +1,46 @@
# Ionic Swap proposal
Creates Ionic Swap proposal.
In your web app, call extension Ionic Swap proposal method, while extension is on.
### Request
```jsx
window.zano.request(
'IONIC_SWAP',
{
destinationAddress: "",
destinationAssetID: "",
destinationAssetAmount: 1,
currentAssetID: "",
currentAssetAmount: 1
},
timeout
);
```
where:
- destinationAddress - Proposal destination address
- destinationAssetID - The ID of asset that proposal creator would receive
- destinationAssetAmount - Amount of asset that proposal creator would receive
- currentAssetID - The ID of asset that proposal creator would send
- currentAssetAmount - Amount of asset that proposal creator would send
- timeout - Timeout of request in ms (set to null to disable)
### Response
```json
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"hex_raw_proposal": ""
}
}
```
where:
- hex_raw_proposal - Hex-encoded proposal raw data(encrypted with common shared key). Includes half-created transaction template and some extra information that would be needed counterparty to finialize and sign transaction

View file

@ -0,0 +1,36 @@
# Message Sign
Usage of Zano Extension message sign.
1. In your web app, call extension sign method, while extension is on.
### Request
```jsx
window.zano.request('REQUEST_MESSAGE_SIGN', {message}, timeout);
```
where:
- message - Any message you want to sign (it could be one-time text (nonce) that is used for wallet sign)
- timeout - Timeout of request in ms (set to null to disable)
### Response
```json
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"pkey": "",
"sig": ""
}
}
```
where:
- pkey - Wallet's public key represented as a hexadecimal string
- sig - Signature represented as a hexadecimal string
2. As the result of method call, get signature and public key.
3. Validate signature with validate_signature daemon method (either pkey or alias can be passed to daemon method alternatively). validate_signature method description: [https://docs.zano.org/docs/build/rpc-api/daemon-rpc-api/validate_signature](https://docs.zano.org/docs/build/rpc-api/daemon-rpc-api/validate_signature). You might also need to use get_alias_by_address method: [https://docs.zano.org/docs/build/rpc-api/daemon-rpc-api/get_alias_by_address](https://docs.zano.org/docs/build/rpc-api/daemon-rpc-api/get_alias_by_address).