@hardkas/sdk 0.8.18-alpha → 0.8.20-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +14 -1
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -185,7 +185,20 @@ var HardkasTx = class {
185
185
  });
186
186
  } else {
187
187
  const rpcUtxos = await this.sdk.rpc.getUtxosByAddress(fromAccount.address);
188
- allFetchedUtxos = rpcUtxos.map((u) => ({
188
+ const COINBASE_MATURITY = 1000n;
189
+ let virtualDaaScore;
190
+ try {
191
+ const dagInfo = await this.sdk.rpc.getBlockDagInfo();
192
+ virtualDaaScore = dagInfo.virtualDaaScore;
193
+ } catch {
194
+ }
195
+ const matureUtxos = virtualDaaScore !== void 0 ? rpcUtxos.filter((u) => {
196
+ if (!u.isCoinbase) return true;
197
+ const score = u.blockDaaScore !== void 0 ? BigInt(u.blockDaaScore) : void 0;
198
+ if (score === void 0) return true;
199
+ return virtualDaaScore - score >= COINBASE_MATURITY;
200
+ }) : rpcUtxos;
201
+ allFetchedUtxos = matureUtxos.map((u) => ({
189
202
  outpoint: {
190
203
  transactionId: u.outpoint.transactionId,
191
204
  index: u.outpoint.index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/sdk",
3
- "version": "0.8.18-alpha",
3
+ "version": "0.8.20-alpha",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -24,18 +24,18 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@kaspa/core-lib": "^1.6.5",
27
- "@hardkas/artifacts": "0.8.18-alpha",
28
- "@hardkas/core": "0.8.18-alpha",
29
- "@hardkas/config": "0.8.18-alpha",
30
- "@hardkas/accounts": "0.8.18-alpha",
31
- "@hardkas/kaspa-rpc": "0.8.18-alpha",
32
- "@hardkas/l2": "0.8.18-alpha",
33
- "@hardkas/query": "0.8.18-alpha",
34
- "@hardkas/localnet": "0.8.18-alpha",
35
- "@hardkas/query-store": "0.8.18-alpha",
36
- "@hardkas/simulator": "0.8.18-alpha",
37
- "@hardkas/tx-builder": "0.8.18-alpha",
38
- "@hardkas/wallet-adapter": "0.8.18-alpha"
27
+ "@hardkas/config": "0.8.20-alpha",
28
+ "@hardkas/artifacts": "0.8.20-alpha",
29
+ "@hardkas/accounts": "0.8.20-alpha",
30
+ "@hardkas/core": "0.8.20-alpha",
31
+ "@hardkas/localnet": "0.8.20-alpha",
32
+ "@hardkas/query": "0.8.20-alpha",
33
+ "@hardkas/l2": "0.8.20-alpha",
34
+ "@hardkas/query-store": "0.8.20-alpha",
35
+ "@hardkas/simulator": "0.8.20-alpha",
36
+ "@hardkas/tx-builder": "0.8.20-alpha",
37
+ "@hardkas/kaspa-rpc": "0.8.20-alpha",
38
+ "@hardkas/wallet-adapter": "0.8.20-alpha"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^20.12.7",