Skip to content

Commit

Permalink
Fix balance not updating properly
Browse files Browse the repository at this point in the history
  • Loading branch information
kewbish committed Jun 4, 2023
1 parent c71556d commit 828bafd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
Binary file modified cobweb.crx
Binary file not shown.
2 changes: 1 addition & 1 deletion landing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h2 class="display mx-auto text-center mb-3">get started</h2>
<a href="https://github.com/kewbish/cobweb">available on GitHub</a>
should you wish to build from source. The checksum of the current
version is
<code style="word-break: break-all">7b0e3fa8f5f2217bfd597700ba4689da9d32375347d9da41b6b5ef0380e67ab5</code>.
<code style="word-break: break-all">f8fcf1dcb877899b6b8d9819784605dbb2eb69e8aa11cf075ffc454c6a2cf5df</code>.
</p>
<a href="https://github.com/kewbish/cobweb" class="btn glassy-cw-btn mt-1" role="button">view source</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion release/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Release notes:
- Fixed bug where errors reading a past stream would prevent the creation of a new one.
- Fixed overflow bug on Help page.

Download on the [Chrome Webstore](https://chrome.google.com/webstore/detail/agdomcadfhkpkcjceenogkiglbhgpclg?authuser=0&hl=en-GB) ◦ Checksum: `7b0e3fa8f5f2217bfd597700ba4689da9d32375347d9da41b6b5ef0380e67ab5`
Download on the [Chrome Webstore](https://chrome.google.com/webstore/detail/agdomcadfhkpkcjceenogkiglbhgpclg?authuser=0&hl=en-GB) ◦ Checksum: `f8fcf1dcb877899b6b8d9819784605dbb2eb69e8aa11cf075ffc454c6a2cf5df`

**Full Changelog**: https://github.com/kewbish/cobweb/compare/v0.0.10...v0.0.11
22 changes: 9 additions & 13 deletions release/generateRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ const { exit } = require("process");
const semver = require("semver");
const shell = require("shelljs");
const cheerio = require("cheerio");
const process = require("node:process");

if (process.cwd() !== "/home/kewbish/Downloads/dev/cobweb-rise") {
console.log("cd to project root first.");
exit(1);
}

// increment version numbers in package.json and manifest.json
const rawdata = fs.readFileSync("package.json");
Expand Down Expand Up @@ -36,7 +42,7 @@ if (code !== 0) {
console.error("Packing extension failed.");
exit(1);
}
shell.mv("build.crx", "cobweb.crx");*/
shell.mv("build.crx", "cobweb.crx");

// zip extension to Downloads folder
({ code } = shell.exec("zip /home/kewbish/Downloads/build.zip -r build"));
Expand All @@ -57,7 +63,7 @@ const checksum = stdout.trim();
// write to landing page HTML
const rawhtml = fs.readFileSync("landing/index.html");
const $ = cheerio.load(rawhtml);
$('code[style="word-break:break-all;"]').text(checksum);
$('code[style="word-break: break-all"]').text(checksum);
fs.writeFileSync("landing/index.html", $.html());

// update release notes
Expand All @@ -69,14 +75,4 @@ rawMD = rawMD.replace(
);
fs.writeFileSync("release/RELEASE_NOTES.md", rawMD);

({ stdout } = shell.exec(`git diff HEAD`));
if (stdout) {
console.log("Repository dirty, skipping tagging")
exit(0)
}

({ code, stdout } = shell.exec(`git add . && git commit --amend --no-edit && git tag v${newVersion}`));
if (code !== 0) {
console.error("Packing extension failed.");
exit(1);
}
console.log(`Remember to tag releases: git tag v${newVersion}`);
12 changes: 5 additions & 7 deletions src/pages/Background/lib/fetchAndUpdateBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ const fetchAndUpdateBalance = async ({
const balance = await infuraProvider.getBalance(address);
storage.local.set({ mmBalance: BigNumber.from(balance) });

const mmSigner = mmProvider.getSigner();

if (!cwInitialized || !mmSigner) {
return;
}

({ availableBalance, deposit } = await sfToken.realtimeBalanceOf({
account: address,
providerOrSigner: mmProvider,
Expand All @@ -76,7 +70,11 @@ const fetchAndUpdateBalance = async ({
if (balanceRes.eq(constants.Zero)) {
return;
}
if (balanceRes.gt(constants.Zero) && balanceRes.lte(deposit)) {
if (
balanceRes.gt(constants.Zero) &&
balanceRes.lte(deposit) &&
mmProvider.getSigner()
) {
// critical balance
if (sf && mmProvider) {
cleanUpStreams({
Expand Down

0 comments on commit 828bafd

Please sign in to comment.