Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not wait for refresh to finish on wallet create #82

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beignet",
"version": "0.0.46",
"version": "0.0.47",
"description": "A self-custodial, JS Bitcoin wallet management library.",
"main": "dist/index.js",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions src/wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ export class Wallet {
const res = await wallet.setWalletData();
if (res.isErr()) return err(res.error.message);
wallet.updateFeeEstimates(true);
console.log('Syncing Wallet...');
await wallet.refreshWallet({});
wallet.refreshWallet({});
if (wallet._disableMessagesOnCreate) wallet.disableMessages = false;
return ok(wallet);
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions tests/boost.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ beforeEach(async function () {
throw res.error;
}
wallet = res.value;
await wallet.refreshWallet({});
});

describe('Boost', async function () {
Expand Down
4 changes: 3 additions & 1 deletion tests/electrum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const expect = chai.expect;

const testTimeout = 60000;

let wallet;
let wallet: Wallet;

before(async function () {
this.timeout(testTimeout);
Expand All @@ -33,13 +33,15 @@ before(async function () {
return;
}
wallet = res.value;
await wallet.refreshWallet({});
});

describe('Electrum Methods', async function (): Promise<void> {
this.timeout(testTimeout);
it('connectToElectrum: Should connect to a random Electrum server', async () => {
const connectResponse = await wallet.connectToElectrum();
expect(connectResponse.isErr()).to.equal(false);
if (connectResponse.isErr()) return;
expect(connectResponse.value).to.equal('Connected to Electrum server.');
});

Expand Down
2 changes: 1 addition & 1 deletion tests/storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const expect = chai.expect;

const testTimeout = 60000;

let wallet;
let wallet: Wallet;
const WALLET_NAME = 'storagetestwallet0';

before(async function () {
Expand Down
9 changes: 7 additions & 2 deletions tests/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const expect = chai.expect;

const testTimeout = 60000;

let wallet;
let wallet: Wallet;

before(async function () {
this.timeout(testTimeout);
Expand All @@ -35,6 +35,7 @@ before(async function () {
return;
}
wallet = res.value;
await wallet.refreshWallet({});
});

describe('Transaction Test', async function (): Promise<void> {
Expand Down Expand Up @@ -158,7 +159,11 @@ describe('Transaction Test', async function (): Promise<void> {
await wallet.transaction.resetSendTransaction();
const setupResponse = await wallet.transaction.setupTransaction({
outputs: [
{ address: 'tb1qaq7jszepjuntxx494xhwrxs746v94583ls02ke', value: 5000 }
{
index: 0,
address: 'tb1qaq7jszepjuntxx494xhwrxs746v94583ls02ke',
value: 5000
}
]
});
expect(setupResponse.isErr()).to.equal(false);
Expand Down
1 change: 1 addition & 0 deletions tests/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ before(async function () {
return;
}
wallet = res.value;
await wallet.refreshWallet({});
});

describe('Wallet Library', async function () {
Expand Down