@exodus/bitcoin-plugin 1.27.0 → 1.28.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,18 @@
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
+ ## [1.28.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-plugin@1.27.0...@exodus/bitcoin-plugin@1.28.0) (2024-09-25)
7
+
8
+
9
+ ### Features
10
+
11
+ * make secp256k1 ecc dependency explicit in bitcoin-plugin ([#3991](https://github.com/ExodusMovement/assets/issues/3991)) ([048f06e](https://github.com/ExodusMovement/assets/commit/048f06e05f23f23cabc6c6540c578ac73886bb4a))
12
+ * move ec-pair and script-classify to bitcoinjs ([#4001](https://github.com/ExodusMovement/assets/issues/4001)) ([adb759b](https://github.com/ExodusMovement/assets/commit/adb759be5b264194f216b6a8f65d370f63555d81))
13
+ * unfork bitcoinjs-lib ([#3968](https://github.com/ExodusMovement/assets/issues/3968)) ([287ba8f](https://github.com/ExodusMovement/assets/commit/287ba8f4e7dacb0f4eb91f31090b74a67eb78733))
14
+ * use a single secp256k1 impl in bitcoin-plugin ([#3992](https://github.com/ExodusMovement/assets/issues/3992)) ([b37ee99](https://github.com/ExodusMovement/assets/commit/b37ee99f684ee164bb872be7b1ee3d5bd1f72276))
15
+
16
+
17
+
6
18
  ## [1.27.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-plugin@1.26.1...@exodus/bitcoin-plugin@1.27.0) (2024-09-24)
7
19
 
8
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-plugin",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Exodus bitcoin-plugin",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -24,10 +24,11 @@
24
24
  "@exodus/asset-lib": "^5.0.0",
25
25
  "@exodus/bip32": "^3.1.0",
26
26
  "@exodus/bip44-constants": "^195.0.0",
27
- "@exodus/bitcoin-api": "^2.24.0",
27
+ "@exodus/bitcoin-api": "^2.25.0",
28
28
  "@exodus/bitcoin-lib": "^2.4.2",
29
29
  "@exodus/bitcoin-meta": "^2.0.0",
30
- "@exodus/bitcoinjs-lib": "^6.1.6",
30
+ "@exodus/bitcoinerlab-secp256k1": "^1.0.5-exodus.1",
31
+ "@exodus/bitcoinjs": "^1.1.0",
31
32
  "@exodus/crypto": "^1.0.0-rc.1",
32
33
  "@exodus/fetch": "^1.3.0",
33
34
  "@exodus/models": "^12.0.1",
@@ -36,8 +37,7 @@
36
37
  "coininfo": "^5.1.0",
37
38
  "lodash": "^4.17.21",
38
39
  "minimalistic-assert": "^1.0.1",
39
- "ms": "^2.1.3",
40
- "secp256k1": "^3.4.0"
40
+ "ms": "^2.1.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@exodus/assets-testing": "^1.0.0",
@@ -61,5 +61,5 @@
61
61
  "type": "git",
62
62
  "url": "git+https://github.com/ExodusMovement/assets.git"
63
63
  },
64
- "gitHead": "fab5429fe99be08b08575100e4be6f151ce9638f"
64
+ "gitHead": "823ab98b35624d4cc58dc75fa5d081e09fdc1ee6"
65
65
  }
@@ -24,7 +24,7 @@ import {
24
24
  } from '@exodus/bitcoin-api'
25
25
  import { parseCurrency } from '@exodus/bitcoin-api/src/fee/fee-utils.js'
26
26
  import { createGetKeyIdentifier } from '@exodus/bitcoin-lib'
27
- import * as bitcoinjsLib from '@exodus/bitcoinjs-lib'
27
+ import * as bitcoinjsLib from '@exodus/bitcoinjs'
28
28
  import { Tx } from '@exodus/models'
29
29
  import _coinInfo from 'coininfo'
30
30
  import assert from 'minimalistic-assert'
@@ -1,11 +1,10 @@
1
- import { ecc, getECPair, getOrdinalsUtxos, toAsyncSigner, toXOnly } from '@exodus/bitcoin-api'
1
+ import { getOrdinalsUtxos, toAsyncSigner } from '@exodus/bitcoin-api'
2
2
  import { getTxSequence } from '@exodus/bitcoin-lib'
3
- import * as bitcoinjsLib from '@exodus/bitcoinjs-lib'
4
- import { witnessStackToScriptWitness } from '@exodus/bitcoinjs-lib/src/psbt/psbtutils.js'
3
+ import ecc from '@exodus/bitcoinerlab-secp256k1'
4
+ import * as bitcoinjsLib from '@exodus/bitcoinjs'
5
5
  import { randomBytes } from '@exodus/crypto/randomBytes'
6
6
  import { TextEncoder } from '@exodus/text-encoding-utf8'
7
7
  import assert from 'minimalistic-assert'
8
- import secp256k1 from 'secp256k1'
9
8
 
10
9
  import { DEFAULT_BRC20_POSTAGE, DEFAULT_ORDINAL_POSTAGE } from './ordinals-constants.js'
11
10
 
@@ -84,7 +83,7 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
84
83
  function createCommitTxData({ publicKey, inscription }) {
85
84
  assert(publicKey, 'encodePublic is required')
86
85
  assert(inscription, 'inscription is required')
87
- const xOnlyPublicKey = toXOnly(publicKey)
86
+ const xOnlyPublicKey = ecc.xOnlyPointFromPoint(publicKey)
88
87
  const script = createInscriptionScript({ xOnlyPublicKey, inscription })
89
88
 
90
89
  const outputScript = bitcoinjsLib.script.compile(script)
@@ -149,7 +148,7 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
149
148
  ]
150
149
 
151
150
  return {
152
- finalScriptWitness: witnessStackToScriptWitness(witness),
151
+ finalScriptWitness: bitcoinjsLib.witnessStackToScriptWitness(witness),
153
152
  }
154
153
  }
155
154
 
@@ -206,9 +205,7 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
206
205
  ...commitTxData,
207
206
  })
208
207
 
209
- const ECPair = getECPair()
210
-
211
- const keypair = ECPair.fromPrivateKey(privateKey, { network })
208
+ const keypair = bitcoinjsLib.ECPair.fromPrivateKey(privateKey, { network })
212
209
 
213
210
  await psbt.signInputAsync(0, toAsyncSigner({ keyPair: keypair, ecc }))
214
211
 
@@ -280,7 +277,7 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
280
277
 
281
278
  const postage = inscription.postage
282
279
 
283
- const publicKey = secp256k1.publicKeyCreate(privateKey, false)
280
+ const publicKey = Buffer.from(ecc.pointFromScalar(privateKey, false))
284
281
  const commitTxData = createCommitTxData({ publicKey, inscription })
285
282
 
286
283
  const feeData = await assetClientInterface.getFeeConfig({ assetName })