@exodus/bitcoin-api 2.30.0 → 2.31.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.31.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.30.0...@exodus/bitcoin-api@2.31.0) (2025-01-23)
7
+
8
+
9
+ ### Features
10
+
11
+
12
+ * feat(eth-like,btc-like): make broadcastTx compatible with rawTx (#4911)
13
+
14
+
15
+
6
16
  ## [2.30.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.29.8...@exodus/bitcoin-api@2.30.0) (2025-01-10)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "description": "Bitcoin transaction and fee monitors, RPC with the blockchain node, other networking code.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -56,5 +56,5 @@
56
56
  "type": "git",
57
57
  "url": "git+https://github.com/ExodusMovement/assets.git"
58
58
  },
59
- "gitHead": "94e7e3c3c61802ff79891bf67e66e9f2b87b80a6"
59
+ "gitHead": "1f116146a725da6f3c98abdf233261512a6333fc"
60
60
  }
package/src/balances.js CHANGED
@@ -16,23 +16,6 @@ export const getBalancesFactory = ({ feeData, getSpendableBalance, ordinalsEnabl
16
16
  assert(accountState, 'accountState is required')
17
17
  assert(txLog, 'txLog is required')
18
18
 
19
- if (accountState.magicEdenApiFungibleBalances) {
20
- const validBalances = accountState.magicEdenApiFungibleBalances.filter(
21
- (fungibleBalance) => fungibleBalance.asset.ticker === asset.ticker
22
- )
23
- const parsedBalances = validBalances.map(({ balance }) =>
24
- asset.currency.defaultUnit(balance.balance)
25
- )
26
- const totalBalance = asset.currency.defaultUnit(
27
- parsedBalances.reduce((sum, item) => sum.add(item), asset.currency.ZERO)
28
- )
29
- return {
30
- total: totalBalance,
31
- // legacy
32
- balance: totalBalance,
33
- }
34
- }
35
-
36
19
  const utxos = getUtxos({ asset, accountState })
37
20
  const balance = utxos.value
38
21
  const spendableBalance = getSpendableBalance({
@@ -166,6 +166,7 @@ export default class InsightAPIClient {
166
166
  }
167
167
 
168
168
  async broadcastTx(rawTx) {
169
+ const _rawTx = rawTx instanceof Uint8Array ? Buffer.from(rawTx).toString('hex') : rawTx
169
170
  console.log('gonna broadcastTx')
170
171
  const url = urlJoin(this._baseURL, '/tx/send')
171
172
  const fetchOptions = {
@@ -174,7 +175,7 @@ export default class InsightAPIClient {
174
175
  Accept: 'application/json',
175
176
  'Content-Type': 'application/json',
176
177
  },
177
- body: JSON.stringify({ rawtx: rawTx }),
178
+ body: JSON.stringify({ rawtx: _rawTx }),
178
179
  }
179
180
 
180
181
  const response = await fetch(url, fetchOptions)
@@ -295,12 +295,6 @@ export class Monitor extends BaseMonitor {
295
295
  newData.mem = { unconfirmedTxAncestor }
296
296
  }
297
297
 
298
- if (this.fetchFungibleBalances) {
299
- try {
300
- newData.magicEdenApiFungibleBalances = await this.fetchFungibleBalances(walletAccount)
301
- } catch {}
302
- }
303
-
304
298
  await aci.updateAccountState({
305
299
  assetName,
306
300
  walletAccount,