Skip to content

Commit

Permalink
fix: refactor approval owner_id to approval_owner_id
Browse files Browse the repository at this point in the history
  • Loading branch information
zcstarr committed Mar 31, 2022
1 parent c8a856e commit 65af2d1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions specs/Standards/MultiToken/ApprovalManagement.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,17 @@ Again, note that no previous approvers will get cross-contract calls in this cas

## Reference-level explanation

The `TokenApproval` structure returned by `mt_token_approvals` returns `approved_account_ids` field, which is a map of account IDs to `Approval` and `owner_id` which is the associated account approved for removal from. The `amount` field though wrapped in quotes and treated like strings, the number will be stored as an unsigned integer with 128 bits.
The `TokenApproval` structure returned by `mt_token_approvals` returns `approved_account_ids` field, which is a map of account IDs to `Approval` and `approval_owner_id` which is the associated account approved for removal from. The `amount` field though wrapped in quotes and treated like strings, the number will be stored as an unsigned integer with 128 bits.
in approval is Using TypeScript's [Record type](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeystype) notation:

```diff
+ type Approval = {
+ amount: string
+ approval_id: string
+ }
+
+ type TokenApproval = {
+ owner_id: string,
+ approval_owner_id: string,
+ approved_account_ids: Record<string, Approval>,
+ };
```
Expand All @@ -240,7 +241,7 @@ Example token approval data:

```json
[{
"owner_id": "alice.near",
"approval_owner_id": "alice.near",
"approved_account_ids": {
"bob.near": {
"amount": "100",
Expand Down Expand Up @@ -272,7 +273,7 @@ Keeping with the example above, say the initial approval of the second marketpla

```json
{
"owner_id": "alice.near",
"approval_owner_id": "alice.near",
"approved_account_ids": {
"marketplace_1.near": {
"approval_id": 1,
Expand All @@ -289,7 +290,7 @@ But after the transfers and re-approval described above, the token might have `a

```json
{
"owner_id": "alice.near",
"approval_owner_id": "alice.near",
"approved_account_ids": {
"marketplace_2.near": {
"approval_id": 3,
Expand Down Expand Up @@ -416,7 +417,7 @@ function mt_is_approved(
//
// Arguments:
// * `token_id`: the token for which to check an approval
// * `account_id`: the account to check the existence of approvals for
// * `account_id`: the account to retrieve approvals for
//
// Returns a TokenApproval object, as described in Approval Management standard
function mt_token_approval(
Expand Down

0 comments on commit 65af2d1

Please sign in to comment.