@pioneer-platform/utxo-network 8.25.2 → 8.25.4

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.
@@ -1,2 +1,2 @@
1
1
 
2
- $ tsc -p .
2
+ $ tsc -p . --skipLibCheck
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @pioneer-platform/utxo-network
2
2
 
3
+ ## 8.25.4
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: fix: transaction event channel mismatch + add networkId to event payload
8
+ - Updated dependencies
9
+ - @pioneer-platform/blockbook@8.27.5
10
+ - @pioneer-platform/unchained@8.24.1
11
+ - @pioneer-platform/nodes@8.26.2
12
+
13
+ ## 8.25.3
14
+
15
+ ### Patch Changes
16
+
17
+ - fix: transaction event channel mismatch + add networkId to event payload
18
+ - Updated dependencies
19
+ - @pioneer-platform/blockbook@8.27.4
20
+ - @pioneer-platform/nodes@8.26.1
21
+
3
22
  ## 8.25.2
4
23
 
5
24
  ### Patch Changes
package/build ADDED
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # Fast Bun build (replaces slow tsc)
3
+
4
+ OUTDIR="${1:-lib}"
5
+ ENTRY="${2:-src/index.ts}"
6
+
7
+ # Clean output
8
+ rm -rf "$OUTDIR"
9
+ mkdir -p "$OUTDIR"
10
+
11
+ # Build with Bun (10x faster than tsc)
12
+ bun build "$ENTRY" \
13
+ --outdir "$OUTDIR" \
14
+ --target node \
15
+ --format cjs \
16
+ --sourcemap \
17
+ --minify
18
+
19
+ # Generate TypeScript declarations
20
+ bunx tsc --emitDeclarationOnly --outDir "$OUTDIR" --project .
21
+
22
+ echo "✅ Built $OUTDIR"
package/lib/index.js CHANGED
@@ -248,7 +248,9 @@ const init_network = async function (servers) {
248
248
  // @TODO
249
249
  // const blockbooks = servers.filter((server: { type: string; }) => server.type === 'blockbook');
250
250
  // log.debug(tag,"blockbooks: ",blockbooks)
251
- await blockbook.init();
251
+ // NOTE: Blockbook is initialized globally by the server with all networks
252
+ // Do NOT call blockbook.init() here as it would overwrite the server's initialization
253
+ log.debug(tag, 'Blockbook should already be initialized by server');
252
254
  // @TODO
253
255
  //load daemon servers
254
256
  //load unchained servers
package/lib/utils.js CHANGED
@@ -38,6 +38,9 @@ const Bitcoin = __importStar(require("bitcoinjs-lib")); // https://github.com/bi
38
38
  const sochain = __importStar(require("./sochain-api"));
39
39
  const xchain_util_1 = require("@xchainjs/xchain-util");
40
40
  const const_1 = require("./const");
41
+ // Define AssetBTC locally since it's not exported in xchain-util@0.2.8
42
+ // AssetType.NATIVE = 0
43
+ const AssetBTC = { chain: 'BTC', symbol: 'BTC', ticker: 'BTC', type: 0 };
41
44
  const TX_EMPTY_SIZE = 4 + 1 + 1 + 4; //10
42
45
  const TX_INPUT_BASE = 32 + 4 + 1 + 4; // 41
43
46
  const TX_INPUT_PUBKEYHASH = 107;
@@ -127,7 +130,7 @@ const getBalance = async (params) => {
127
130
  const balance = await sochain.getBalance(params);
128
131
  return [
129
132
  {
130
- asset: xchain_util_1.AssetBTC,
133
+ asset: AssetBTC,
131
134
  amount: balance,
132
135
  },
133
136
  ];
@@ -148,7 +151,7 @@ exports.getBalance = getBalance;
148
151
  const getChange = async ({ valueOut, sochainUrl, network, address }) => {
149
152
  try {
150
153
  const balances = await (0, exports.getBalance)({ sochainUrl, network, address });
151
- const [btcBalance] = balances.filter((balance) => (0, xchain_util_1.assetToString)(balance.asset) === (0, xchain_util_1.assetToString)(xchain_util_1.AssetBTC));
154
+ const [btcBalance] = balances.filter((balance) => (0, xchain_util_1.assetToString)(balance.asset) === (0, xchain_util_1.assetToString)(AssetBTC));
152
155
  let change = 0;
153
156
  if (btcBalance && btcBalance.amount.amount().minus(valueOut).isGreaterThan(DUST_THRESHOLD)) {
154
157
  change = btcBalance.amount.amount().minus(valueOut).toNumber();
@@ -209,7 +212,7 @@ const buildTx = async ({ amount, recipient, memo, feeRate, sender, network, soch
209
212
  return Promise.reject(Error('No utxos to send'));
210
213
  }
211
214
  const balance = await (0, exports.getBalance)({ sochainUrl, network, address: sender });
212
- const [btcBalance] = balance.filter((balance) => balance.asset.symbol === xchain_util_1.AssetBTC.symbol);
215
+ const [btcBalance] = balance.filter((balance) => balance.asset.symbol === AssetBTC.symbol);
213
216
  if (!btcBalance) {
214
217
  return Promise.reject(new Error('No btcBalance found'));
215
218
  }
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@pioneer-platform/utxo-network",
3
- "version": "8.25.2",
3
+ "version": "8.25.4",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {
7
7
  "test": "pnpm run build && node __tests__/test-module.js",
8
8
  "start": "pnpm run build:live",
9
- "build": "tsc -p .",
9
+ "build": "tsc -p . --skipLibCheck",
10
10
  "prepublish": "tsc -p .",
11
11
  "build:live": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts"
12
12
  },
13
13
  "dependencies": {
14
- "@pioneer-platform/blockbook": "^8.27.3",
14
+ "@pioneer-platform/blockbook": "^8.27.5",
15
15
  "@pioneer-platform/loggerdog": "^8.11.0",
16
- "@pioneer-platform/nodes": "^8.26.0",
16
+ "@pioneer-platform/nodes": "^8.26.2",
17
17
  "@pioneer-platform/pioneer-caip": "^9.19.0",
18
- "@pioneer-platform/unchained": "^8.24.0",
18
+ "@pioneer-platform/unchained": "^8.24.1",
19
19
  "@types/request-promise-native": "^1.0.17",
20
20
  "@xchainjs/xchain-client": "^0.7.0",
21
- "@xchainjs/xchain-util": "^0.2.6",
21
+ "@xchainjs/xchain-util": "0.2.8",
22
22
  "axiom": "^0.1.6",
23
23
  "axios": "^1.6.0",
24
24
  "bitcoin-promise": "^1.3.1",
package/tsconfig.json CHANGED
@@ -18,7 +18,11 @@
18
18
  "resolveJsonModule": true,
19
19
  "skipLibCheck": true,
20
20
  "forceConsistentCasingInFileNames": true,
21
- "types": ["node"]
21
+ "types": ["node"],
22
+ "baseUrl": "../../../..",
23
+ "paths": {
24
+ "@xchainjs/*": ["node_modules/@xchainjs/*"]
25
+ }
22
26
  },
23
27
  "include": ["src"],
24
28
  "exclude": ["node_modules", "**/__tests__/*"]