Skip to content

Commit

Permalink
feat: getExtractions method
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed May 29, 2024
1 parent f41faee commit 85d96f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ To fetch the extraction for a principal, use the following command:
dfx canister call fortune-wheel-booth-backend getExtraction '(principal "<the-principal-you-want-to-fetch-the-extraction-for>")'
```

#### `getExtractions`

To fetch all extractions, use the following command:

```bash
dfx canister call fortune-wheel-booth-backend getExtractions
```

#### `manualTransfer`

To manually send tokens to a principal, use the following command:
Expand Down
8 changes: 8 additions & 0 deletions src/fortune-wheel-booth-backend/main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ shared ({ caller = initialController }) actor class Main() {
sorted_entries.next();
};

public shared query ({ caller }) func getExtractions() : async [(Principal, Extraction)] {
if (not isAdmin(caller)) {
throw Error.reject("Only admins can read extractions");
};

Iter.toArray(extractedPrincipals.entries());
};

type ManualSendTokens = {
#icp : Nat;
#ckBtc : Nat;
Expand Down

0 comments on commit 85d96f2

Please sign in to comment.