Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3436f8e
pkg: nb version
nodech Jul 25, 2025
d7a4578
wallet: add get/recv address endpoints that dont increment depth.
nodech Jul 25, 2025
9270407
wallet-http: validate index in get recv/change addr.
nodech Jul 28, 2025
ab4d96a
node-rpc: add namebase emitnamebaseevent.
nodech Aug 4, 2025
8867cc3
wallet: update/register will accept Buffer instead of Resource.
nodech Aug 6, 2025
29a0fde
wallet: have proper rawResource default.
nodech Aug 6, 2025
fe7dcc4
pkg: nb version
nodech Jul 25, 2025
2c19151
Merge PR #88 from 'nodech/nb-get-addr'
nodech Aug 11, 2025
e6c6096
Merge PR #90 from 'nodech/nb-events'
nodech Aug 11, 2025
b65fdee
Merge PR #91 from 'nodech/raw-update-register'
nodech Aug 11, 2025
b44fc8a
wallet: add abort controller to the wallet http and all send methods.
nodech Jul 28, 2025
2d915a8
wallet: add abort controller to the coin selection.
nodech Jul 30, 2025
06e9659
wallet: return AbortError with cause.
nodech Jul 30, 2025
dc05c2f
Merge PR #89 from 'nodech/nb-abort'
nodech Aug 11, 2025
1f841c7
wdb: add min sweep dust configuration.
nodech Aug 18, 2025
1d80d87
Merge PR #92 from 'nodech/nb-dust-config'
nodech Aug 18, 2025
84023ef
Merge branch 'hsd/master' into production-namebase-8x
nodech Aug 22, 2025
1eaf7fd
wallet: fix partial batches for nb and abort on close.
nodech Aug 22, 2025
88845ee
Merge PR #93 from 'nodech/nb-partial-batches'
nodech Aug 22, 2025
8e80cb7
wallet: Return output to action.id mappings.
nodech Aug 22, 2025
8ff367e
Merge PR #94 from 'nodech/nb-output-map'
nodech Aug 22, 2025
e1a69dc
wallet: consensus limits in batches will not throw the whole tx when …
nodech Aug 25, 2025
a2278cf
wallet: add maxOutputs configuration per batch.
nodech Aug 25, 2025
4735806
Merge PR #95 from 'nodech/nb-batch-limits'
nodech Aug 25, 2025
4700b7f
wallet: Add FINISH type to the Batch API.
nodech Aug 27, 2025
c41518a
Merge PR #96 from 'nodech/nb-batch-finish'
nodech Aug 29, 2025
8654bae
wallet: wallet.zap returns zapped tx hashes.
nodech Sep 4, 2025
17a7251
Merge PR #97 from 'nodech/nb-zap-hashes'
nodech Sep 4, 2025
44ee232
txdb: update bid.
nodech Sep 9, 2025
84e5b42
Merge PR #98 from 'nodech/update-bid'
nodech Sep 9, 2025
2ae481a
wallet: use sweepdust min value configuration for value selection as …
nodech Sep 11, 2025
60f5b6a
Merge PR #99 from 'nodech/nb-sweepdust-all'
nodech Sep 11, 2025
3f63e2a
wallet-http: introduce timeout to tx creation methods.
nodech Oct 21, 2025
3600281
Merge PR #101 from 'nodech/nb-timeout-abort'
nodech Oct 23, 2025
8df7b1e
wallet-http: move tx creation timeout outside.
nodech Nov 11, 2025
b83963a
wallet-http: setup controller if it exists.
nodech Nov 11, 2025
81aca5a
wallet-http: print walletdb state
nodech Nov 12, 2025
6d59a48
pkg: v8.0.0-nb.0.0.1
nodech Nov 25, 2025
57c4596
wallet: remap coin selections.
nodech Nov 29, 2025
8454fd8
wallet: add sweepdust alias.
nodech Nov 29, 2025
c387710
wallet: pass workers to the wallet.
nodech Nov 29, 2025
e4f7fda
mtx: have template yield to event loop.
nodech Nov 29, 2025
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
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [14.x, 16.x, 18.x, 20.x, 22.x, 24.x]
node: [16.x, 18.x, 20.x, 22.x, 24.x]

steps:
- uses: actions/checkout@v4
Expand All @@ -71,12 +71,6 @@ jobs:
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -y libunbound-dev

# Pythong 3.10->3.11 broke node-gyp. This upgrades node-gyp for older nodejs.
# https://github.com/nodejs/node-gyp/issues/2219
- name: Update npm.
if: contains(matrix.node, '14.x')
run: npm i -g npm@9

- name: Install dependencies
run: npm install

Expand Down
50 changes: 50 additions & 0 deletions lib/client/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,32 @@ class WalletClient extends bcurl.Client {
return this.patch(`/wallet/${id}/account/${name}`, options);
}

/**
* Get receive address. (UNSAFE)
* @param {String} id
* @param {String} account
* @param {Number} index
* @param {Boolean} safe
* @returns {Promise}
*/

getAddress(id, account, index, safe) {
return this.get(`/wallet/${id}/address`, { account, index, safe });
}

/**
* Get change address. (UNSAFE)
* @param {String} id
* @param {String} account
* @param {Number} index
* @param {Boolean} safe
* @returns {Promise}
*/

getChange(id, account, index, safe) {
return this.get(`/wallet/${id}/change`, { account, index, safe });
}

/**
* Create address.
* @param {Object} options
Expand Down Expand Up @@ -1374,6 +1400,30 @@ class Wallet extends EventEmitter {
return this.client.modifyAccount(this.id, name, options);
}

/**
* Get receive address. (UNSAFE)
* @param {String} account
* @param {Number} index
* @param {Boolean} safe
* @returns {Promise}
*/

getAddress(account, index, safe) {
return this.client.getAddress(this.id, account, index, safe);
}

/**
* Get change address. (UNSAFE)
* @param {String} account
* @param {Number} index
* @param {Boolean} safe
* @returns {Promise}
*/

getChange(account, index, safe) {
return this.client.getChange(this.id, account, index, safe);
}

/**
* Create address.
* @param {Object} options
Expand Down
15 changes: 15 additions & 0 deletions lib/node/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ class RPC extends RPCBase {
// this.add('getnameinfo', this.getNameInfo);
// this.add('getnameresource', this.getNameResource);
// this.add('getnameproof', this.getNameProof);

// Namebase specific events.
this.add('emitnamebaseevent', this.emitNamebaseEvent);
}

/*
Expand Down Expand Up @@ -2634,6 +2637,18 @@ class RPC extends RPCBase {
return null;
}

async emitNamebaseEvent(args) {
if (args.length < 1)
throw new RPCError(errs.MISC_ERROR, 'emitnamebaseevent ( ...args )');

const valid = new Validator(args);
const eventName = valid.str(0);

this.emit(`namebase-${eventName}`, args.slice(1));

return null;
}

/*
* Helpers
*/
Expand Down
14 changes: 12 additions & 2 deletions lib/primitives/mtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,11 +870,14 @@ class MTX extends TX {
* @returns {Number} Number of inputs templated.
*/

template(ring) {
async template(ring) {
if (Array.isArray(ring)) {
let total = 0;
for (const key of ring)
for (const key of ring) {
total += this.template(key);
await yieldToRuntime();
}

return total;
}

Expand All @@ -895,6 +898,9 @@ class MTX extends TX {
continue;

total += 1;

if (total % 100 === 0)
await yieldToRuntime();
}

return total;
Expand Down Expand Up @@ -1484,6 +1490,10 @@ function sortLinked(a, b) {
return a[0].compare(b[0]);
}

function yieldToRuntime() {
return new Promise(res => setImmediate(res));
}

/*
* Expose
*/
Expand Down
33 changes: 33 additions & 0 deletions lib/wallet/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,39 @@ class Account extends bio.Struct {
}
}

/**
* Derive an address at `index`. Do not increment depth.
* Optionally check safety.
* @param {Number} branch
* @param {Number} index
* @param {Boolean} [safe]
* @param {MasterKey} [master]
* @returns {WalletKey}
*/

deriveCheckedKey(branch, index, safe, master) {
assert(typeof branch === 'number');

if (safe) {
switch (branch) {
case 0: {
if (index > this.receiveDepth + this.lookahead)
throw new Error('Receive index out of bounds.');

break;
}
case 1: {
if (index > this.changeDepth + this.lookahead)
throw new Error('Change index out of bounds.');

break;
}
}
}

return this.deriveKey(branch, index, master);
}

/**
* Derive an address at `index`. Do not increment depth.
* @param {Number} branch
Expand Down
18 changes: 18 additions & 0 deletions lib/wallet/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,21 @@ common.coinSelectionTypes = {
DB_SWEEPDUST: 'db-sweepdust',
DB_AGE: 'db-age'
};

common.AbortError = class AbortError extends Error {
constructor(message, options) {
super(message, options);
this.name = 'AbortError';
this.message = 'Operation aborted.';

if (message)
this.message = message;

if (options.cause)
this.message += ` (${options.cause})`;

if (Error.captureStackTrace) {
Error.captureStackTrace(this, common.AbortError);
}
}
};
Loading