Skip to content

create-wallet example is not working in the browser #76

Description

@Ekliptor

Tested in Chrome 78
I have uploaded a small sample project to reproduce this error: https://github.com/Ekliptor/BlockchainAPI

I can run the example from here with NodeJS v12 and create a wallet https://github.com/Bitcoin-com/slp-sdk/blob/master/examples/create-wallet/create-wallet.js
However, when I try to run it in the browser I get an error in hdnode.js:

f {message: "Expected property "0" of type ECPair, got g", __label: undefined, __property: 0, __value: g, __type: ƒ, …}
message: "Expected property "0" of type ECPair, got g"
__label: undefined
__property: 0
__type: ƒ t(t)
__value: g {d: n, compressed: true, network: {…}}
__valueTypeName: "g"
stack: "Error: Expected property "0" of type ECPair, got g↵    at a (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:60:76182)↵    at tfSubError (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:60:77360)↵    at http://localhost:63342/BlockchainAPI/blockchain-api.min.js:24:73605↵    at Array.every (<anonymous>)↵    at t (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:24:73547)↵    at d (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:24:74101)↵    at new p (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:72:5919)↵    at Function.p.fromSeedBuffer (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:72:6536)↵    at t.e.fromSeed (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:52:66628)↵    at Object.<anonymous> (http://localhost:63342/BlockchainAPI/blockchain-api.min.js:60:275738)"
__proto__: Error

Stack

(anonymous) | @ | index.js:190
-- | -- | --
  | t | @ | index.js:186
  | d | @ | index.js:233
  | p | @ | hdnode.js:16
  | p.fromSeedBuffer | @ | hdnode.js:48
  | e.fromSeed | @ | HDNode.ts:26
  | (anonymous) | @ | createWallet.ts:40
  | r | @ | bootstrap:19
  | (anonymous) | @ | bootstrap:83
  | (anonymous) | @ | bootstrap:83

Possibly this error should be forwarded to bitcoinjs-lib.

I also remember this worked with SLP-SDK v1.x about 1 year ago, but now even going back to 1.3.2 still results in the same error. So some breaking changes in WebPack (??) could also be the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions