Skip to content

Commit 5cd758b

Browse files
authored
Add documentation for AllowancesGiven and AllowancesReceived queries (#78)
* add snip25 allowances doc * table header fix
1 parent 2eadebb commit 5cd758b

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

README.md

+77-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,83 @@ All transactions are encrypted, so if you want to see the error returned by a fa
9595
```secretcli tx compute execute <contract-address> '{"transfer":{"recipient":"<address>","amount":"<amount>", "entropy":"<base64_encoded_entropy>", "decoys":<[addresses_list]>}}' --from <account>```
9696

9797
## Future Work
98-
| Topic | Immidiate-term solution | Medium-term solution | Long-term solution |
98+
| Topic | Immediate-term solution | Medium-term solution | Long-term solution |
9999
| --- | --- | --- | --- |
100100
| Receiver privacy | Decoys - offer limited privacy, since it depends a lot on how you choose decoys. There’s probably no way to select decoys effectively enough, and thus it only makes it a bit harder but effectively doesn’t provide receiver privacy to a sophisticated long-term attacker | Some sort of bucketing? - still no clear path forward| ORAM? - still no clear path forward |
101101
| Transfer amount privacy - subtractions (Transfer/Send/Burn) | None | None | Merkle proofs for storage reads - will make it very difficult to simulate transactions and play with storage. |
102+
103+
# SNIP 25 Other Updates
104+
105+
## All Allowances
106+
Adds the ability for an owner to query for all allowances they have given out, as well as for a spender to query for all allowances they have received.
107+
108+
## Queries
109+
110+
### AllowancesGiven
111+
112+
This query MUST be authenticated.
113+
114+
Returns the list of allowances given out by the current account as an owner, as well as the total count of allowances given out.
115+
116+
Results SHOULD be paginated. Results MUST be sorted in reverse chronological order by the datetime at which the allowance was first created (i.e., order is not determined by expiration, nor by last modified).
117+
118+
#### Request
119+
120+
| Name | Type | Description | optional |
121+
| ---- | ---- | ----------- | -------- |
122+
| [with_permit].query.allowances_given.owner | string | Account from which tokens are allowed to be taken | no |
123+
| [with_permit].query.allowances_given.page_size | number | Number of allowances to return, starting from the latest. i.e. n=1 will return only the latest allowance | no |
124+
| [with_permit].query.allowances_given.page | number | Defaults to 0. Specifying a positive number will skip page * page_size txs from the start. | yes |
125+
126+
#### Response
127+
```json
128+
{
129+
"allowances_given": {
130+
"owner": "<address>",
131+
"allowances": [
132+
{
133+
"spender": "<address>",
134+
"allowance": "Uint128",
135+
"expiration": 1234,
136+
},
137+
{ "...": "..." }
138+
],
139+
"count": 200
140+
}
141+
}
142+
```
143+
144+
### AllowancesReceived
145+
146+
This query MUST be authenticated.
147+
148+
Returns the list of allowances given to the current account as a spender, as well as the total count of allowances received.
149+
150+
Results SHOULD be paginated. Results MUST be sorted in reverse chronological order by the datetime at which the allowance was first created (i.e., order is not determined by expiration).
151+
152+
#### Request
153+
154+
| Name | Type | Description | optional |
155+
| ---- | ---- | ----------- | -------- |
156+
| [with_permit.]query.allowances_received.spender | string | Account which is allowed to spend tokens on behalf of the owner | no |
157+
| [with_permit.]query.allowances_received.page_size | number | Number of allowances to return, starting from the latest. i.e. n=1 will return only the latest allowance | no |
158+
| [with_permit.]query.allowances_received.page | number | Defaults to 0. Specifying a positive number will skip page * page_size txs from the start. | yes |
159+
160+
#### Response
161+
162+
```json
163+
{
164+
"allowances_received": {
165+
"spender": "<address>",
166+
"allowances": [
167+
{
168+
"owner": "<address>",
169+
"allowance": "Uint128",
170+
"expiration": 1234,
171+
},
172+
{ "...": "..." }
173+
],
174+
"count": 200
175+
}
176+
}
177+
```

0 commit comments

Comments
 (0)