Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jul 15, 2024
1 parent 9d1b92f commit 4d1ab47
Show file tree
Hide file tree
Showing 14 changed files with 3,507 additions and 67 deletions.
688 changes: 685 additions & 3 deletions examples/motoko_examples/persistent-storage/package-lock.json

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions examples/motoko_examples/persistent-storage/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export default Canister({
increment: update([], nat, () => {
const counterOpt = stableStorage.get('counter');
const counter =
'None' in counterOpt
counterOpt === null
? ic.trap('counter not defined')
: counterOpt.Some + 1n;
: counterOpt + 1n;

stableStorage.insert('counter', counter);

Expand All @@ -38,9 +38,7 @@ export default Canister({
get: query([], nat, () => {
const counterOpt = stableStorage.get('counter');
const counter =
'None' in counterOpt
? ic.trap('counter not defined')
: counterOpt.Some;
counterOpt === null ? ic.trap('counter not defined') : counterOpt;

return counter;
}),
Expand All @@ -49,9 +47,7 @@ export default Canister({

const counterOpt = stableStorage.get('counter');
const counter =
'None' in counterOpt
? ic.trap('counter not defined')
: counterOpt.Some;
counterOpt === null ? ic.trap('counter not defined') : counterOpt;

return counter;
})
Expand Down
Loading

0 comments on commit 4d1ab47

Please sign in to comment.