-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from permaweb/jfrain99/reimplement-stampjs
Reimplement stampjs
- Loading branch information
Showing
6 changed files
with
26 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
// import Stamps from "@permaweb/stampjs"; | ||
// import { prop } from "ramda"; | ||
import Stamps from "@permaweb/stampjs"; | ||
import { prop } from "ramda"; | ||
|
||
// const stamps = Stamps.init({}); | ||
const stamps = Stamps.init({}); | ||
|
||
export const stampCounts = (txs: string[]) => { | ||
return Promise.resolve(txs.map(tx => ({ tx: { total: 0, vouched: 0 }}))) | ||
// return stamps.counts(txs); | ||
return stamps.counts(txs); | ||
} | ||
|
||
export const stamp = (tx: string) => { | ||
return Promise.reject("Stamping disabled") | ||
// return stamps.hasStamped(tx).then((s) => { | ||
// console.log({ s }) | ||
// return !s | ||
// ? stamps | ||
// .stamp(tx) | ||
// .then(() => new Promise((r) => setTimeout(r, 500))) | ||
// .then(() => stamps.count(tx).then(prop("vouched"))) | ||
// : Promise.reject("Already Stamped!") | ||
// } | ||
// ) | ||
return stamps.hasStamped(tx).then((s) => { | ||
return !s | ||
? stamps | ||
.stamp(tx) | ||
.then(() => new Promise((r) => setTimeout(r, 500))) | ||
.then(() => stamps.count(tx).then(prop("vouched"))) | ||
: Promise.reject("Already Stamped!") | ||
} | ||
) | ||
} | ||
|
||
export const stampCount = (tx) => { | ||
return Promise.resolve({ total: 0, vouched: 0 }) | ||
// stamps.count(tx).then(prop("vouched")); | ||
} | ||
return stamps.count(tx).then(prop("vouched")); | ||
} |