@airgap/coinlib-core 0.13.11-beta.0 → 0.13.11-beta.1
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/package.json +6 -3
- package/actions/Action.d.ts +0 -24
- package/actions/Action.js +0 -119
- package/actions/Action.js.map +0 -1
- package/actions/LinkedAction.d.ts +0 -10
- package/actions/LinkedAction.js +0 -95
- package/actions/LinkedAction.js.map +0 -1
- package/actions/RepeatableAction.d.ts +0 -8
- package/actions/RepeatableAction.js +0 -92
- package/actions/RepeatableAction.js.map +0 -1
- package/actions/SimpleAction.d.ts +0 -7
- package/actions/SimpleAction.js +0 -80
- package/actions/SimpleAction.js.map +0 -1
- package/actions/StateMachine.d.ts +0 -9
- package/actions/StateMachine.js +0 -42
- package/actions/StateMachine.js.map +0 -1
- package/airgap-coinlib-core.min.js +0 -31685
- package/data/KeyPair.d.ts +0 -5
- package/data/KeyPair.js +0 -3
- package/data/KeyPair.js.map +0 -1
- package/data/Lazy.d.ts +0 -14
- package/data/Lazy.js +0 -83
- package/data/Lazy.js.map +0 -1
- package/data/RPCBody.d.ts +0 -7
- package/data/RPCBody.js +0 -16
- package/data/RPCBody.js.map +0 -1
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +0 -230
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +0 -471
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +0 -1
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +0 -76
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +0 -455
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +0 -1
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.d.ts +0 -27
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +0 -848
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +0 -1
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.d.ts +0 -22
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +0 -14
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +0 -1
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.d.ts +0 -29
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +0 -63
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +0 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.d.ts +0 -36
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +0 -87
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +0 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.d.ts +0 -8
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +0 -33
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +0 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.d.ts +0 -11
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js +0 -5
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js.map +0 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.d.ts +0 -8
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +0 -43
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +0 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.d.ts +0 -8
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +0 -37
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +0 -1
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +0 -73
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +0 -552
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +0 -1
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +0 -73
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +0 -552
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +0 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +0 -18
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +0 -29
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.d.ts +0 -57
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +0 -384
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.d.ts +0 -63
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +0 -264
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +0 -5
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +0 -82
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +0 -4
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +0 -67
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.d.ts +0 -89
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +0 -169
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +0 -9
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js +0 -3
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +0 -42
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +0 -270
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.d.ts +0 -15
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +0 -80
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.d.ts +0 -12
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +0 -184
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +0 -5
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +0 -81
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +0 -4
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +0 -76
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.d.ts +0 -14
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +0 -150
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.d.ts +0 -17
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +0 -41
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +0 -150
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +0 -217
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.d.ts +0 -26
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +0 -115
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.d.ts +0 -9
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +0 -35
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +0 -3
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +0 -26
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.d.ts +0 -13
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +0 -52
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.d.ts +0 -4
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js +0 -9
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.d.ts +0 -34
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +0 -39
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +0 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +0 -1590
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +0 -35
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +0 -91
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +0 -127
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.d.ts +0 -145
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +0 -270
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +0 -4
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +0 -33
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.d.ts +0 -163
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +0 -438
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.d.ts +0 -158
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +0 -254
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +0 -24
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +0 -126
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +0 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.d.ts +0 -4
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js +0 -9
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js.map +0 -1
- package/dependencies/src/axios-0.19.0/index.d.ts +0 -152
- package/dependencies/src/axios-0.19.0/index.js +0 -1
- package/dependencies/src/axios-0.19.0/lib/adapters/http.js +0 -275
- package/dependencies/src/axios-0.19.0/lib/adapters/xhr.js +0 -174
- package/dependencies/src/axios-0.19.0/lib/axios.js +0 -53
- package/dependencies/src/axios-0.19.0/lib/cancel/Cancel.js +0 -19
- package/dependencies/src/axios-0.19.0/lib/cancel/CancelToken.js +0 -57
- package/dependencies/src/axios-0.19.0/lib/cancel/isCancel.js +0 -5
- package/dependencies/src/axios-0.19.0/lib/core/Axios.js +0 -86
- package/dependencies/src/axios-0.19.0/lib/core/InterceptorManager.js +0 -52
- package/dependencies/src/axios-0.19.0/lib/core/createError.js +0 -18
- package/dependencies/src/axios-0.19.0/lib/core/dispatchRequest.js +0 -86
- package/dependencies/src/axios-0.19.0/lib/core/enhanceError.js +0 -42
- package/dependencies/src/axios-0.19.0/lib/core/mergeConfig.js +0 -51
- package/dependencies/src/axios-0.19.0/lib/core/settle.js +0 -25
- package/dependencies/src/axios-0.19.0/lib/core/transformData.js +0 -20
- package/dependencies/src/axios-0.19.0/lib/defaults.js +0 -98
- package/dependencies/src/axios-0.19.0/lib/helpers/bind.js +0 -11
- package/dependencies/src/axios-0.19.0/lib/helpers/buildURL.js +0 -71
- package/dependencies/src/axios-0.19.0/lib/helpers/combineURLs.js +0 -14
- package/dependencies/src/axios-0.19.0/lib/helpers/cookies.js +0 -53
- package/dependencies/src/axios-0.19.0/lib/helpers/deprecatedMethod.js +0 -24
- package/dependencies/src/axios-0.19.0/lib/helpers/isAbsoluteURL.js +0 -14
- package/dependencies/src/axios-0.19.0/lib/helpers/isURLSameOrigin.js +0 -68
- package/dependencies/src/axios-0.19.0/lib/helpers/normalizeHeaderName.js +0 -12
- package/dependencies/src/axios-0.19.0/lib/helpers/parseHeaders.js +0 -53
- package/dependencies/src/axios-0.19.0/lib/helpers/spread.js +0 -27
- package/dependencies/src/axios-0.19.0/lib/utils.js +0 -334
- package/dependencies/src/axios-0.19.0/package.json +0 -85
- package/dependencies/src/base-x-3.0.7/src/index.d.ts +0 -10
- package/dependencies/src/base-x-3.0.7/src/index.js +0 -120
- package/dependencies/src/base64-js-1.3.1/index.js +0 -152
- package/dependencies/src/bech32-0.0.3/index.js +0 -139
- package/dependencies/src/bech32-1.1.3/index.js +0 -147
- package/dependencies/src/big-integer-1.6.45/BigInteger.d.ts +0 -2393
- package/dependencies/src/big-integer-1.6.45/BigInteger.js +0 -1452
- package/dependencies/src/bigi-1.4.2/lib/bigi.js +0 -1509
- package/dependencies/src/bigi-1.4.2/lib/convert.js +0 -91
- package/dependencies/src/bigi-1.4.2/lib/index.js +0 -6
- package/dependencies/src/bigi-1.4.2/package.json +0 -55
- package/dependencies/src/bignumber.js-9.0.0/bignumber.d.ts +0 -1829
- package/dependencies/src/bignumber.js-9.0.0/bignumber.js +0 -2902
- package/dependencies/src/bip32-2.0.4/src/bip32.js +0 -290
- package/dependencies/src/bip32-2.0.4/src/crypto.js +0 -26
- package/dependencies/src/bip32-2.0.4/src/index.js +0 -7
- package/dependencies/src/bip32-path-0.4.2/index.js +0 -96
- package/dependencies/src/bip39-2.5.0/index.js +0 -153
- package/dependencies/src/bip39-2.5.0/wordlists/chinese_simplified.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/chinese_traditional.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/english.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/french.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/italian.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/japanese.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/korean.json +0 -2050
- package/dependencies/src/bip39-2.5.0/wordlists/spanish.json +0 -2050
- package/dependencies/src/bip66-1.1.5/index.js +0 -113
- package/dependencies/src/bitcoin-ops-1.4.1/index.json +0 -120
- package/dependencies/src/bitcoin-ops-1.4.1/map.js +0 -9
- package/dependencies/src/bitcoinjs-message-2.1.1/index.js +0 -157
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/address.js +0 -109
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/block.js +0 -234
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferWriter.js +0 -40
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferutils.js +0 -65
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/coins.js +0 -53
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/crypto.js +0 -43
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecdsa.js +0 -161
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecpair.js +0 -155
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecsignature.js +0 -97
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/fastcurve.js +0 -92
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/hdnode.js +0 -363
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/index.js +0 -24
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/networks.js +0 -214
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script.js +0 -214
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script_number.js +0 -68
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/index.js +0 -74
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/index.js +0 -4
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/input.js +0 -71
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/output.js +0 -64
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/nulldata.js +0 -39
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/index.js +0 -4
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/input.js +0 -39
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/output.js +0 -33
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/index.js +0 -4
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/input.js +0 -51
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/output.js +0 -42
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/index.js +0 -4
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/input.js +0 -84
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/output.js +0 -34
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/index.js +0 -3
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/output.js +0 -42
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/index.js +0 -4
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/input.js +0 -44
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/output.js +0 -33
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/index.js +0 -4
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/input.js +0 -63
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/output.js +0 -33
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction.js +0 -1125
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction_builder.js +0 -892
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/types.js +0 -55
- package/dependencies/src/blake2b-6268e6dd678661e0acc4359e9171b97eb1ebf8ac/index.js +0 -313
- package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/blake2b.js +0 -63
- package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/index.js +0 -128
- package/dependencies/src/blakejs-1.1.0/blake2b.js +0 -273
- package/dependencies/src/blakejs-1.1.0/blake2s.js +0 -190
- package/dependencies/src/blakejs-1.1.0/index.js +0 -15
- package/dependencies/src/blakejs-1.1.0/util.js +0 -81
- package/dependencies/src/bn.js-4.11.8/lib/bn.js +0 -3427
- package/dependencies/src/brorand-1.1.0/index.js +0 -65
- package/dependencies/src/bs58-4.0.1/index.js +0 -4
- package/dependencies/src/bs58check-2.1.2/base.js +0 -50
- package/dependencies/src/bs58check-2.1.2/index.js +0 -12
- package/dependencies/src/bs58grscheck-2.1.2/base.js +0 -50
- package/dependencies/src/bs58grscheck-2.1.2/index.js +0 -12
- package/dependencies/src/buffer-5.6.0/index.d.ts +0 -186
- package/dependencies/src/buffer-5.6.0/index.js +0 -1794
- package/dependencies/src/buffer-equals-1.0.4/index.js +0 -26
- package/dependencies/src/cbor-sync-1.0.4/index.d.ts +0 -11
- package/dependencies/src/cbor-sync-1.0.4/index.js +0 -632
- package/dependencies/src/cipher-base-1.0.4/index.js +0 -99
- package/dependencies/src/cosmjs/index.d.ts +0 -379
- package/dependencies/src/cosmjs/index.js +0 -1297
- package/dependencies/src/cosmjs/index.js.map +0 -1
- package/dependencies/src/create-hash-1.2.0/browser.js +0 -30
- package/dependencies/src/create-hash-1.2.0/index.js +0 -1
- package/dependencies/src/create-hash-1.2.0/md5.js +0 -5
- package/dependencies/src/create-hmac-1.1.4/browser.js +0 -68
- package/dependencies/src/create-hmac-1.1.4/index.js +0 -1
- package/dependencies/src/create-hmac-1.1.7/browser.js +0 -62
- package/dependencies/src/create-hmac-1.1.7/legacy.js +0 -46
- package/dependencies/src/cryptocompare-0.5.0/index.js +0 -138
- package/dependencies/src/cuint-0.2.2/index.js +0 -2
- package/dependencies/src/cuint-0.2.2/lib/uint32.js +0 -451
- package/dependencies/src/cuint-0.2.2/lib/uint64.js +0 -648
- package/dependencies/src/debug-3.1.0/src/browser.js +0 -195
- package/dependencies/src/debug-3.1.0/src/debug.js +0 -225
- package/dependencies/src/drbg.js-1.0.1/hash.js +0 -92
- package/dependencies/src/drbg.js-1.0.1/hmac.js +0 -71
- package/dependencies/src/drbg.js-1.0.1/index.js +0 -4
- package/dependencies/src/drbg.js-1.0.1/lib/hash-info.json +0 -27
- package/dependencies/src/drbg.js-1.0.1/lib/util.js +0 -36
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +0 -12
- package/dependencies/src/eciesjs-0.3.9/src/index.js +0 -35
- package/dependencies/src/eciesjs-0.3.9/src/index.js.map +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +0 -12
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +0 -62
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +0 -11
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +0 -65
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.d.ts +0 -2
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.js +0 -11
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.js.map +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +0 -6
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +0 -65
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +0 -1
- package/dependencies/src/ecurve-1.0.6/lib/curve.js +0 -77
- package/dependencies/src/ecurve-1.0.6/lib/curves.json +0 -65
- package/dependencies/src/ecurve-1.0.6/lib/index.js +0 -10
- package/dependencies/src/ecurve-1.0.6/lib/names.js +0 -21
- package/dependencies/src/ecurve-1.0.6/lib/point.js +0 -244
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/base.js +0 -374
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/edwards.js +0 -432
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/index.js +0 -8
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/mont.js +0 -178
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/short.js +0 -937
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curves.js +0 -206
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/index.js +0 -241
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/key.js +0 -118
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/signature.js +0 -134
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/index.js +0 -118
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/key.js +0 -95
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/signature.js +0 -65
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/precomputed/secp256k1.js +0 -780
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/utils.js +0 -120
- package/dependencies/src/elliptic-6.5.1/lib/elliptic.js +0 -13
- package/dependencies/src/elliptic-6.5.1/package.json +0 -55
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/base.js +0 -376
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/edwards.js +0 -432
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/index.js +0 -8
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/mont.js +0 -178
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/short.js +0 -937
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curves.js +0 -206
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/index.js +0 -241
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/key.js +0 -118
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/signature.js +0 -166
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/index.js +0 -118
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/key.js +0 -95
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/signature.js +0 -65
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/precomputed/secp256k1.js +0 -780
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/utils.js +0 -119
- package/dependencies/src/elliptic-6.5.3/lib/elliptic.js +0 -13
- package/dependencies/src/elliptic-6.5.3/package.json +0 -55
- package/dependencies/src/ethereum-common-0.2.1/bootstrapNodes.json +0 -92
- package/dependencies/src/ethereum-common-0.2.1/genesisState.json +0 -8895
- package/dependencies/src/ethereum-common-0.2.1/index.js +0 -4
- package/dependencies/src/ethereum-common-0.2.1/params.json +0 -245
- package/dependencies/src/ethereumjs-tx-1.3.7/index.js +0 -298
- package/dependencies/src/ethereumjs-util-5.2.0/index.js +0 -714
- package/dependencies/src/ethjs-util-0.1.4/src/index.js +0 -203
- package/dependencies/src/follow-redirects-1.5.10/http.js +0 -1
- package/dependencies/src/follow-redirects-1.5.10/https.js +0 -1
- package/dependencies/src/follow-redirects-1.5.10/index.js +0 -322
- package/dependencies/src/futoin-hkdf-1.3.3/hkdf.d.ts +0 -29
- package/dependencies/src/futoin-hkdf-1.3.3/hkdf.js +0 -174
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/index.js +0 -39
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/groestl.js +0 -1248
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/helper.js +0 -253
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/op.js +0 -462
- package/dependencies/src/groestlcoinjs-message-2.1.0/index.js +0 -245
- package/dependencies/src/hash-base-3.0.4/index.js +0 -95
- package/dependencies/src/hash.js-1.1.7/lib/hash/common.js +0 -92
- package/dependencies/src/hash.js-1.1.7/lib/hash/hmac.js +0 -47
- package/dependencies/src/hash.js-1.1.7/lib/hash/ripemd.js +0 -146
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/1.js +0 -74
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/224.js +0 -30
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/256.js +0 -105
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/384.js +0 -35
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/512.js +0 -330
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/common.js +0 -49
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha.js +0 -7
- package/dependencies/src/hash.js-1.1.7/lib/hash/utils.js +0 -278
- package/dependencies/src/hash.js-1.1.7/lib/hash.js +0 -15
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.d.ts +0 -15
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +0 -101
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +0 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.d.ts +0 -3
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +0 -37
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +0 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.d.ts +0 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js +0 -34
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js.map +0 -1
- package/dependencies/src/hmac-drbg-1.0.1/lib/hmac-drbg.js +0 -113
- package/dependencies/src/idna-uts46-hx-3.4.0/idna-map.js +0 -23865
- package/dependencies/src/idna-uts46-hx-3.4.0/index.d.ts +0 -6
- package/dependencies/src/idna-uts46-hx-3.4.0/uts46.js +0 -170
- package/dependencies/src/ieee754-1.1.13/index.js +0 -84
- package/dependencies/src/inherits-2.0.4/inherits.js +0 -9
- package/dependencies/src/inherits-2.0.4/inherits_browser.js +0 -27
- package/dependencies/src/is-buffer-2.0.3/index.js +0 -11
- package/dependencies/src/is-hex-prefixed-1.0.0/src/index.js +0 -13
- package/dependencies/src/js-cuint-0.2.2/index.js +0 -2
- package/dependencies/src/js-cuint-0.2.2/lib/uint32.js +0 -451
- package/dependencies/src/js-cuint-0.2.2/lib/uint64.js +0 -648
- package/dependencies/src/keccak-1.0.2/js.js +0 -2
- package/dependencies/src/keccak-1.0.2/lib/api/index.js +0 -28
- package/dependencies/src/keccak-1.0.2/lib/api/keccak.js +0 -83
- package/dependencies/src/keccak-1.0.2/lib/api/shake.js +0 -74
- package/dependencies/src/keccak-1.0.2/lib/keccak-state.js +0 -187
- package/dependencies/src/keccak-1.0.2/lib/keccak.js +0 -69
- package/dependencies/src/md5.js-1.3.5/index.js +0 -146
- package/dependencies/src/merkle-lib-2.0.10/fastRoot.js +0 -24
- package/dependencies/src/merkle-lib-2.0.10/index.js +0 -34
- package/dependencies/src/minimalistic-assert-1.0.1/index.js +0 -11
- package/dependencies/src/minimalistic-crypto-utils-1.0.1/lib/utils.js +0 -58
- package/dependencies/src/ms-2.1.2/index.js +0 -162
- package/dependencies/src/nan-2.14.0/include_dirs.js +0 -1
- package/dependencies/src/nanoassert-1.1.0/index.js +0 -22
- package/dependencies/src/pako-2.0.3/index.js +0 -18
- package/dependencies/src/pako-2.0.3/lib/deflate.js +0 -373
- package/dependencies/src/pako-2.0.3/lib/inflate.js +0 -402
- package/dependencies/src/pako-2.0.3/lib/utils/common.js +0 -48
- package/dependencies/src/pako-2.0.3/lib/utils/strings.js +0 -187
- package/dependencies/src/pako-2.0.3/lib/zlib/adler32.js +0 -50
- package/dependencies/src/pako-2.0.3/lib/zlib/constants.js +0 -66
- package/dependencies/src/pako-2.0.3/lib/zlib/crc32.js +0 -58
- package/dependencies/src/pako-2.0.3/lib/zlib/deflate.js +0 -1849
- package/dependencies/src/pako-2.0.3/lib/zlib/gzheader.js +0 -58
- package/dependencies/src/pako-2.0.3/lib/zlib/inffast.js +0 -347
- package/dependencies/src/pako-2.0.3/lib/zlib/inflate.js +0 -1625
- package/dependencies/src/pako-2.0.3/lib/zlib/inftrees.js +0 -462
- package/dependencies/src/pako-2.0.3/lib/zlib/messages.js +0 -32
- package/dependencies/src/pako-2.0.3/lib/zlib/trees.js +0 -1192
- package/dependencies/src/pako-2.0.3/lib/zlib/zstream.js +0 -47
- package/dependencies/src/pbkdf2-3.0.17/bench/index.js +0 -35
- package/dependencies/src/pbkdf2-3.0.17/bench/old.js +0 -47
- package/dependencies/src/pbkdf2-3.0.17/browser.js +0 -2
- package/dependencies/src/pbkdf2-3.0.17/index.js +0 -31
- package/dependencies/src/pbkdf2-3.0.17/lib/async.js +0 -100
- package/dependencies/src/pbkdf2-3.0.17/lib/default-encoding.js +0 -10
- package/dependencies/src/pbkdf2-3.0.17/lib/precondition.js +0 -28
- package/dependencies/src/pbkdf2-3.0.17/lib/sync-browser.js +0 -104
- package/dependencies/src/pbkdf2-3.0.17/lib/sync.js +0 -51
- package/dependencies/src/punycode-2.1.1/punycode.js +0 -429
- package/dependencies/src/pushdata-bitcoin-1.0.1/index.js +0 -77
- package/dependencies/src/randombytes-2.1.0/browser.js +0 -50
- package/dependencies/src/randombytes-2.1.0/index.js +0 -1
- package/dependencies/src/ripemd160-2.0.2/index.js +0 -163
- package/dependencies/src/rlp-2.2.3/index.js +0 -230
- package/dependencies/src/safe-buffer-5.2.0/index.js +0 -64
- package/dependencies/src/secp256k1-3.7.1/elliptic.js +0 -2
- package/dependencies/src/secp256k1-3.7.1/lib/assert.js +0 -44
- package/dependencies/src/secp256k1-3.7.1/lib/der.js +0 -193
- package/dependencies/src/secp256k1-3.7.1/lib/elliptic/index.js +0 -263
- package/dependencies/src/secp256k1-3.7.1/lib/index.js +0 -245
- package/dependencies/src/secp256k1-3.7.1/lib/messages.json +0 -37
- package/dependencies/src/secp256k1-4.0.2/elliptic.js +0 -1
- package/dependencies/src/secp256k1-4.0.2/lib/elliptic.js +0 -402
- package/dependencies/src/secp256k1-4.0.2/lib/index.js +0 -336
- package/dependencies/src/sha.js-2.4.11/hash.js +0 -81
- package/dependencies/src/sha.js-2.4.11/index.js +0 -16
- package/dependencies/src/sha.js-2.4.11/sha.js +0 -94
- package/dependencies/src/sha.js-2.4.11/sha1.js +0 -99
- package/dependencies/src/sha.js-2.4.11/sha224.js +0 -53
- package/dependencies/src/sha.js-2.4.11/sha256.js +0 -135
- package/dependencies/src/sha.js-2.4.11/sha384.js +0 -57
- package/dependencies/src/sha.js-2.4.11/sha512.js +0 -260
- package/dependencies/src/strip-hex-prefix-1.0.0/src/index.js +0 -14
- package/dependencies/src/tiny-secp256k1-1.1.3/js.js +0 -276
- package/dependencies/src/tiny-secp256k1-1.1.3/rfc6979.js +0 -62
- package/dependencies/src/tweetnacl-1.0.1/nacl.d.ts +0 -98
- package/dependencies/src/tweetnacl-1.0.1/nacl.js +0 -1164
- package/dependencies/src/tweetnacl-auth-1.0.1/nacl-auth.js +0 -47
- package/dependencies/src/typedarray-to-buffer-4.0.0/index.js +0 -17
- package/dependencies/src/typeforce-1.18.0/errors.js +0 -110
- package/dependencies/src/typeforce-1.18.0/extra.js +0 -91
- package/dependencies/src/typeforce-1.18.0/index.js +0 -260
- package/dependencies/src/typeforce-1.18.0/native.js +0 -21
- package/dependencies/src/unorm-1.6.0/lib/unorm.js +0 -452
- package/dependencies/src/utf8-3.0.0/utf8.js +0 -202
- package/dependencies/src/validate.js-0.13.1/validate.d.ts +0 -55
- package/dependencies/src/validate.js-0.13.1/validate.js +0 -1253
- package/dependencies/src/varuint-bitcoin-1.1.2/index.d.ts +0 -13
- package/dependencies/src/varuint-bitcoin-1.1.2/index.js +0 -90
- package/dependencies/src/wif-2.0.6/index.js +0 -63
- package/dependencies/src/xxhashjs-0.2.2/lib/index.js +0 -4
- package/dependencies/src/xxhashjs-0.2.2/lib/xxhash.js +0 -389
- package/dependencies/src/xxhashjs-0.2.2/lib/xxhash64.js +0 -444
- package/errors/coinlib-error.d.ts +0 -30
- package/errors/coinlib-error.js +0 -62
- package/errors/coinlib-error.js.map +0 -1
- package/errors/index.d.ts +0 -156
- package/errors/index.js +0 -281
- package/errors/index.js.map +0 -1
- package/errors/network.d.ts +0 -0
- package/errors/network.js +0 -2
- package/errors/network.js.map +0 -1
- package/index.d.ts +0 -33
- package/index.js +0 -58
- package/index.js.map +0 -1
- package/interfaces/IAirGapAddress.d.ts +0 -10
- package/interfaces/IAirGapAddress.js +0 -3
- package/interfaces/IAirGapAddress.js.map +0 -1
- package/interfaces/IAirGapSignedTransaction.d.ts +0 -1
- package/interfaces/IAirGapSignedTransaction.js +0 -3
- package/interfaces/IAirGapSignedTransaction.js.map +0 -1
- package/interfaces/IAirGapTransaction.d.ts +0 -53
- package/interfaces/IAirGapTransaction.js +0 -22
- package/interfaces/IAirGapTransaction.js.map +0 -1
- package/interfaces/IAirGapWallet.d.ts +0 -6
- package/interfaces/IAirGapWallet.js +0 -3
- package/interfaces/IAirGapWallet.js.map +0 -1
- package/interfaces/JSONConvertible.d.ts +0 -3
- package/interfaces/JSONConvertible.js +0 -3
- package/interfaces/JSONConvertible.js.map +0 -1
- package/interfaces/RPCConvertible.d.ts +0 -3
- package/interfaces/RPCConvertible.js +0 -3
- package/interfaces/RPCConvertible.js.map +0 -1
- package/networks.d.ts +0 -19
- package/networks.js +0 -1341
- package/networks.js.map +0 -1
- package/protocols/BlockExplorerProtocol.d.ts +0 -6
- package/protocols/BlockExplorerProtocol.js +0 -60
- package/protocols/BlockExplorerProtocol.js.map +0 -1
- package/protocols/CryptoClient.d.ts +0 -15
- package/protocols/CryptoClient.js +0 -84
- package/protocols/CryptoClient.js.map +0 -1
- package/protocols/Ed25519CryptoClient.d.ts +0 -8
- package/protocols/Ed25519CryptoClient.js +0 -107
- package/protocols/Ed25519CryptoClient.js.map +0 -1
- package/protocols/HasConfigurableContract.d.ts +0 -4
- package/protocols/HasConfigurableContract.js +0 -3
- package/protocols/HasConfigurableContract.js.map +0 -1
- package/protocols/ICoinBaseProtocol.d.ts +0 -107
- package/protocols/ICoinBaseProtocol.js +0 -3
- package/protocols/ICoinBaseProtocol.js.map +0 -1
- package/protocols/ICoinDelegateProtocol.d.ts +0 -40
- package/protocols/ICoinDelegateProtocol.js +0 -3
- package/protocols/ICoinDelegateProtocol.js.map +0 -1
- package/protocols/ICoinOfflineProtocol.d.ts +0 -24
- package/protocols/ICoinOfflineProtocol.js +0 -3
- package/protocols/ICoinOfflineProtocol.js.map +0 -1
- package/protocols/ICoinOnlineProtocol.d.ts +0 -46
- package/protocols/ICoinOnlineProtocol.js +0 -3
- package/protocols/ICoinOnlineProtocol.js.map +0 -1
- package/protocols/ICoinProtocol.d.ts +0 -9
- package/protocols/ICoinProtocol.js +0 -3
- package/protocols/ICoinProtocol.js.map +0 -1
- package/protocols/ICoinSubProtocol.d.ts +0 -22
- package/protocols/ICoinSubProtocol.js +0 -9
- package/protocols/ICoinSubProtocol.js.map +0 -1
- package/protocols/NonExtendedProtocol.d.ts +0 -17
- package/protocols/NonExtendedProtocol.js +0 -49
- package/protocols/NonExtendedProtocol.js.map +0 -1
- package/protocols/Secp256k1CryptoClient.d.ts +0 -8
- package/protocols/Secp256k1CryptoClient.js +0 -79
- package/protocols/Secp256k1CryptoClient.js.map +0 -1
- package/protocols/Sr25519CryptoClient.d.ts +0 -8
- package/protocols/Sr25519CryptoClient.js +0 -82
- package/protocols/Sr25519CryptoClient.js.map +0 -1
- package/types/signed-transaction.d.ts +0 -4
- package/types/signed-transaction.js +0 -3
- package/types/signed-transaction.js.map +0 -1
- package/types/unsigned-transaction.d.ts +0 -5
- package/types/unsigned-transaction.js +0 -3
- package/types/unsigned-transaction.js.map +0 -1
- package/utils/AES.d.ts +0 -10
- package/utils/AES.js +0 -165
- package/utils/AES.js.map +0 -1
- package/utils/ErrorWithData.d.ts +0 -4
- package/utils/ErrorWithData.js +0 -29
- package/utils/ErrorWithData.js.map +0 -1
- package/utils/Network.d.ts +0 -2
- package/utils/Network.js +0 -8
- package/utils/Network.js.map +0 -1
- package/utils/ProtocolBlockExplorer.d.ts +0 -6
- package/utils/ProtocolBlockExplorer.js +0 -11
- package/utils/ProtocolBlockExplorer.js.map +0 -1
- package/utils/ProtocolNetwork.d.ts +0 -15
- package/utils/ProtocolNetwork.js +0 -35
- package/utils/ProtocolNetwork.js.map +0 -1
- package/utils/ProtocolOptions.d.ts +0 -5
- package/utils/ProtocolOptions.js +0 -3
- package/utils/ProtocolOptions.js.map +0 -1
- package/utils/ProtocolSymbols.d.ts +0 -45
- package/utils/ProtocolSymbols.js +0 -59
- package/utils/ProtocolSymbols.js.map +0 -1
- package/utils/array.d.ts +0 -4
- package/utils/array.js +0 -36
- package/utils/array.js.map +0 -1
- package/utils/assert.d.ts +0 -2
- package/utils/assert.js +0 -20
- package/utils/assert.js.map +0 -1
- package/utils/base64Check.d.ts +0 -7
- package/utils/base64Check.js +0 -39
- package/utils/base64Check.js.map +0 -1
- package/utils/blake2b.d.ts +0 -7
- package/utils/blake2b.js +0 -23
- package/utils/blake2b.js.map +0 -1
- package/utils/buffer.d.ts +0 -2
- package/utils/buffer.js +0 -8
- package/utils/buffer.js.map +0 -1
- package/utils/cache.d.ts +0 -15
- package/utils/cache.js +0 -97
- package/utils/cache.js.map +0 -1
- package/utils/error.d.ts +0 -1
- package/utils/error.js +0 -8
- package/utils/error.js.map +0 -1
- package/utils/hex.d.ts +0 -14
- package/utils/hex.js +0 -112
- package/utils/hex.js.map +0 -1
- package/utils/interfaces.d.ts +0 -3
- package/utils/interfaces.js +0 -18
- package/utils/interfaces.js.map +0 -1
- package/utils/object.d.ts +0 -1
- package/utils/object.js +0 -23
- package/utils/object.js.map +0 -1
- package/utils/padStart.d.ts +0 -1
- package/utils/padStart.js +0 -20
- package/utils/padStart.js.map +0 -1
- package/utils/remote-data/HttpRemoteData.d.ts +0 -8
- package/utils/remote-data/HttpRemoteData.js +0 -117
- package/utils/remote-data/HttpRemoteData.js.map +0 -1
- package/utils/remote-data/IpfsRemoteData.d.ts +0 -8
- package/utils/remote-data/IpfsRemoteData.js +0 -142
- package/utils/remote-data/IpfsRemoteData.js.map +0 -1
- package/utils/remote-data/RemoteData.d.ts +0 -11
- package/utils/remote-data/RemoteData.js +0 -11
- package/utils/remote-data/RemoteData.js.map +0 -1
- package/utils/remote-data/RemoteDataFactory.d.ts +0 -11
- package/utils/remote-data/RemoteDataFactory.js +0 -29
- package/utils/remote-data/RemoteDataFactory.js.map +0 -1
- package/utils/remote-data/Sha256RemoteData.d.ts +0 -11
- package/utils/remote-data/Sha256RemoteData.js +0 -139
- package/utils/remote-data/Sha256RemoteData.js.map +0 -1
- package/utils/string.d.ts +0 -7
- package/utils/string.js +0 -50
- package/utils/string.js.map +0 -1
- package/utils/type.d.ts +0 -1
- package/utils/type.js +0 -16
- package/utils/type.js.map +0 -1
- package/utils/xxhash.d.ts +0 -5
- package/utils/xxhash.js +0 -18
- package/utils/xxhash.js.map +0 -1
- package/wallet/AirGapCoinWallet.d.ts +0 -19
- package/wallet/AirGapCoinWallet.js +0 -199
- package/wallet/AirGapCoinWallet.js.map +0 -1
- package/wallet/AirGapMarketWallet.d.ts +0 -40
- package/wallet/AirGapMarketWallet.js +0 -221
- package/wallet/AirGapMarketWallet.js.map +0 -1
- package/wallet/AirGapNFTWallet.d.ts +0 -15
- package/wallet/AirGapNFTWallet.js +0 -179
- package/wallet/AirGapNFTWallet.js.map +0 -1
- package/wallet/AirGapWallet.d.ts +0 -35
- package/wallet/AirGapWallet.js +0 -142
- package/wallet/AirGapWallet.js.map +0 -1
|
@@ -1,892 +0,0 @@
|
|
|
1
|
-
var Buffer = require('../../safe-buffer-5.2.0/index').Buffer
|
|
2
|
-
var baddress = require('./address')
|
|
3
|
-
var bcrypto = require('./crypto')
|
|
4
|
-
var bscript = require('./script')
|
|
5
|
-
var btemplates = require('./templates')
|
|
6
|
-
var coins = require('./coins')
|
|
7
|
-
var networks = require('./networks')
|
|
8
|
-
var ops = require('../../bitcoin-ops-1.4.1/index.json')
|
|
9
|
-
var typeforce = require('../../typeforce-1.18.0/index')
|
|
10
|
-
var types = require('./types')
|
|
11
|
-
var scriptTypes = btemplates.types
|
|
12
|
-
var SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG]
|
|
13
|
-
var P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH])
|
|
14
|
-
|
|
15
|
-
var ECPair = require('./ecpair')
|
|
16
|
-
var ECSignature = require('./ecsignature')
|
|
17
|
-
var Transaction = require('./transaction')
|
|
18
|
-
|
|
19
|
-
var debug = require('../../debug-3.1.0/src/browser')('bitgo:utxolib:txbuilder')
|
|
20
|
-
|
|
21
|
-
function supportedType (type) {
|
|
22
|
-
return SIGNABLE.indexOf(type) !== -1
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function supportedP2SHType (type) {
|
|
26
|
-
return P2SH.indexOf(type) !== -1
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function extractChunks (type, chunks, script) {
|
|
30
|
-
var pubKeys = []
|
|
31
|
-
var signatures = []
|
|
32
|
-
switch (type) {
|
|
33
|
-
case scriptTypes.P2PKH:
|
|
34
|
-
// if (redeemScript) throw new Error('Nonstandard... P2SH(P2PKH)')
|
|
35
|
-
pubKeys = chunks.slice(1)
|
|
36
|
-
signatures = chunks.slice(0, 1)
|
|
37
|
-
break
|
|
38
|
-
|
|
39
|
-
case scriptTypes.P2PK:
|
|
40
|
-
pubKeys[0] = script ? btemplates.pubKey.output.decode(script) : undefined
|
|
41
|
-
signatures = chunks.slice(0, 1)
|
|
42
|
-
break
|
|
43
|
-
|
|
44
|
-
case scriptTypes.MULTISIG:
|
|
45
|
-
if (script) {
|
|
46
|
-
var multisig = btemplates.multisig.output.decode(script)
|
|
47
|
-
pubKeys = multisig.pubKeys
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
signatures = chunks.slice(1).map(function (chunk) {
|
|
51
|
-
return chunk.length === 0 ? undefined : chunk
|
|
52
|
-
})
|
|
53
|
-
break
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
pubKeys: pubKeys,
|
|
58
|
-
signatures: signatures
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function expandInput (scriptSig, witnessStack) {
|
|
62
|
-
if (scriptSig.length === 0 && witnessStack.length === 0) return {}
|
|
63
|
-
|
|
64
|
-
var prevOutScript
|
|
65
|
-
var prevOutType
|
|
66
|
-
var scriptType
|
|
67
|
-
var script
|
|
68
|
-
var redeemScript
|
|
69
|
-
var witnessScript
|
|
70
|
-
var witnessScriptType
|
|
71
|
-
var redeemScriptType
|
|
72
|
-
var witness = false
|
|
73
|
-
var p2wsh = false
|
|
74
|
-
var p2sh = false
|
|
75
|
-
var witnessProgram
|
|
76
|
-
var chunks
|
|
77
|
-
|
|
78
|
-
var scriptSigChunks = bscript.decompile(scriptSig)
|
|
79
|
-
var sigType = btemplates.classifyInput(scriptSigChunks, true)
|
|
80
|
-
if (sigType === scriptTypes.P2SH) {
|
|
81
|
-
p2sh = true
|
|
82
|
-
redeemScript = scriptSigChunks[scriptSigChunks.length - 1]
|
|
83
|
-
redeemScriptType = btemplates.classifyOutput(redeemScript)
|
|
84
|
-
prevOutScript = btemplates.scriptHash.output.encode(bcrypto.hash160(redeemScript))
|
|
85
|
-
prevOutType = scriptTypes.P2SH
|
|
86
|
-
script = redeemScript
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
var classifyWitness = btemplates.classifyWitness(witnessStack, true)
|
|
90
|
-
if (classifyWitness === scriptTypes.P2WSH) {
|
|
91
|
-
witnessScript = witnessStack[witnessStack.length - 1]
|
|
92
|
-
witnessScriptType = btemplates.classifyOutput(witnessScript)
|
|
93
|
-
p2wsh = true
|
|
94
|
-
witness = true
|
|
95
|
-
if (scriptSig.length === 0) {
|
|
96
|
-
prevOutScript = btemplates.witnessScriptHash.output.encode(bcrypto.sha256(witnessScript))
|
|
97
|
-
prevOutType = scriptTypes.P2WSH
|
|
98
|
-
if (redeemScript !== undefined) {
|
|
99
|
-
throw new Error('Redeem script given when unnecessary')
|
|
100
|
-
}
|
|
101
|
-
// bare witness
|
|
102
|
-
} else {
|
|
103
|
-
if (!redeemScript) {
|
|
104
|
-
throw new Error('No redeemScript provided for P2WSH, but scriptSig non-empty')
|
|
105
|
-
}
|
|
106
|
-
witnessProgram = btemplates.witnessScriptHash.output.encode(bcrypto.sha256(witnessScript))
|
|
107
|
-
if (!redeemScript.equals(witnessProgram)) {
|
|
108
|
-
throw new Error('Redeem script didn\'t match witnessScript')
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (!supportedType(btemplates.classifyOutput(witnessScript))) {
|
|
113
|
-
throw new Error('unsupported witness script')
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
script = witnessScript
|
|
117
|
-
scriptType = witnessScriptType
|
|
118
|
-
chunks = witnessStack.slice(0, -1)
|
|
119
|
-
} else if (classifyWitness === scriptTypes.P2WPKH) {
|
|
120
|
-
witness = true
|
|
121
|
-
var key = witnessStack[witnessStack.length - 1]
|
|
122
|
-
var keyHash = bcrypto.hash160(key)
|
|
123
|
-
if (scriptSig.length === 0) {
|
|
124
|
-
prevOutScript = btemplates.witnessPubKeyHash.output.encode(keyHash)
|
|
125
|
-
prevOutType = scriptTypes.P2WPKH
|
|
126
|
-
if (typeof redeemScript !== 'undefined') {
|
|
127
|
-
throw new Error('Redeem script given when unnecessary')
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
if (!redeemScript) {
|
|
131
|
-
throw new Error('No redeemScript provided for P2WPKH, but scriptSig wasn\'t empty')
|
|
132
|
-
}
|
|
133
|
-
witnessProgram = btemplates.witnessPubKeyHash.output.encode(keyHash)
|
|
134
|
-
if (!redeemScript.equals(witnessProgram)) {
|
|
135
|
-
throw new Error('Redeem script did not have the right witness program')
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
scriptType = scriptTypes.P2PKH
|
|
140
|
-
chunks = witnessStack
|
|
141
|
-
} else if (redeemScript) {
|
|
142
|
-
if (!supportedP2SHType(redeemScriptType)) {
|
|
143
|
-
throw new Error('Bad redeemscript!')
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
script = redeemScript
|
|
147
|
-
scriptType = redeemScriptType
|
|
148
|
-
chunks = scriptSigChunks.slice(0, -1)
|
|
149
|
-
} else {
|
|
150
|
-
prevOutType = scriptType = btemplates.classifyInput(scriptSig)
|
|
151
|
-
chunks = scriptSigChunks
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
var expanded = extractChunks(scriptType, chunks, script)
|
|
155
|
-
|
|
156
|
-
var result = {
|
|
157
|
-
pubKeys: expanded.pubKeys,
|
|
158
|
-
signatures: expanded.signatures,
|
|
159
|
-
prevOutScript: prevOutScript,
|
|
160
|
-
prevOutType: prevOutType,
|
|
161
|
-
signType: scriptType,
|
|
162
|
-
signScript: script,
|
|
163
|
-
witness: Boolean(witness)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (p2sh) {
|
|
167
|
-
result.redeemScript = redeemScript
|
|
168
|
-
result.redeemScriptType = redeemScriptType
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (p2wsh) {
|
|
172
|
-
result.witnessScript = witnessScript
|
|
173
|
-
result.witnessScriptType = witnessScriptType
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return result
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// could be done in expandInput, but requires the original Transaction for hashForSignature
|
|
180
|
-
function fixMultisigOrder (input, transaction, vin, value, network) {
|
|
181
|
-
if (input.redeemScriptType !== scriptTypes.MULTISIG || !input.redeemScript) return
|
|
182
|
-
if (input.pubKeys.length === input.signatures.length) return
|
|
183
|
-
|
|
184
|
-
network = network || networks.bitcoin
|
|
185
|
-
var unmatched = input.signatures.concat()
|
|
186
|
-
|
|
187
|
-
input.signatures = input.pubKeys.map(function (pubKey) {
|
|
188
|
-
var keyPair = ECPair.fromPublicKeyBuffer(pubKey)
|
|
189
|
-
var match
|
|
190
|
-
|
|
191
|
-
// check for a signature
|
|
192
|
-
unmatched.some(function (signature, i) {
|
|
193
|
-
// skip if undefined || OP_0
|
|
194
|
-
if (!signature) return false
|
|
195
|
-
|
|
196
|
-
// TODO: avoid O(n) hashForSignature
|
|
197
|
-
var parsed = ECSignature.parseScriptSignature(signature)
|
|
198
|
-
var hash
|
|
199
|
-
switch (network.coin) {
|
|
200
|
-
case coins.BSV:
|
|
201
|
-
case coins.BCH:
|
|
202
|
-
hash = transaction.hashForCashSignature(vin, input.signScript, value, parsed.hashType)
|
|
203
|
-
break
|
|
204
|
-
case coins.BTG:
|
|
205
|
-
hash = transaction.hashForGoldSignature(vin, input.signScript, value, parsed.hashType)
|
|
206
|
-
break
|
|
207
|
-
case coins.ZEC:
|
|
208
|
-
if (value === undefined) {
|
|
209
|
-
return false
|
|
210
|
-
}
|
|
211
|
-
hash = transaction.hashForZcashSignature(vin, input.signScript, value, parsed.hashType)
|
|
212
|
-
break
|
|
213
|
-
default:
|
|
214
|
-
if (input.witness) {
|
|
215
|
-
hash = transaction.hashForWitnessV0(vin, input.signScript, value, parsed.hashType)
|
|
216
|
-
} else {
|
|
217
|
-
hash = transaction.hashForSignature(vin, input.signScript, parsed.hashType)
|
|
218
|
-
}
|
|
219
|
-
break
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// skip if signature does not match pubKey
|
|
223
|
-
if (!keyPair.verify(hash, parsed.signature)) return false
|
|
224
|
-
|
|
225
|
-
// remove matched signature from unmatched
|
|
226
|
-
unmatched[i] = undefined
|
|
227
|
-
match = signature
|
|
228
|
-
|
|
229
|
-
return true
|
|
230
|
-
})
|
|
231
|
-
|
|
232
|
-
return match
|
|
233
|
-
})
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function expandOutput (script, scriptType, ourPubKey) {
|
|
237
|
-
typeforce(types.Buffer, script)
|
|
238
|
-
|
|
239
|
-
var scriptChunks = bscript.decompile(script)
|
|
240
|
-
if (!scriptType) {
|
|
241
|
-
scriptType = btemplates.classifyOutput(script)
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
var pubKeys = []
|
|
245
|
-
|
|
246
|
-
switch (scriptType) {
|
|
247
|
-
// does our hash160(pubKey) match the output scripts?
|
|
248
|
-
case scriptTypes.P2PKH:
|
|
249
|
-
if (!ourPubKey) break
|
|
250
|
-
|
|
251
|
-
var pkh1 = scriptChunks[2]
|
|
252
|
-
var pkh2 = bcrypto.hash160(ourPubKey)
|
|
253
|
-
if (pkh1.equals(pkh2)) pubKeys = [ourPubKey]
|
|
254
|
-
break
|
|
255
|
-
|
|
256
|
-
// does our hash160(pubKey) match the output scripts?
|
|
257
|
-
case scriptTypes.P2WPKH:
|
|
258
|
-
if (!ourPubKey) break
|
|
259
|
-
|
|
260
|
-
var wpkh1 = scriptChunks[1]
|
|
261
|
-
var wpkh2 = bcrypto.hash160(ourPubKey)
|
|
262
|
-
if (wpkh1.equals(wpkh2)) pubKeys = [ourPubKey]
|
|
263
|
-
break
|
|
264
|
-
|
|
265
|
-
case scriptTypes.P2PK:
|
|
266
|
-
pubKeys = scriptChunks.slice(0, 1)
|
|
267
|
-
break
|
|
268
|
-
|
|
269
|
-
case scriptTypes.MULTISIG:
|
|
270
|
-
pubKeys = scriptChunks.slice(1, -2)
|
|
271
|
-
break
|
|
272
|
-
|
|
273
|
-
default: return { scriptType: scriptType }
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return {
|
|
277
|
-
pubKeys: pubKeys,
|
|
278
|
-
scriptType: scriptType,
|
|
279
|
-
signatures: pubKeys.map(function () { return undefined })
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function checkP2SHInput (input, redeemScriptHash) {
|
|
284
|
-
if (input.prevOutType) {
|
|
285
|
-
if (input.prevOutType !== scriptTypes.P2SH) throw new Error('PrevOutScript must be P2SH')
|
|
286
|
-
|
|
287
|
-
var prevOutScriptScriptHash = bscript.decompile(input.prevOutScript)[1]
|
|
288
|
-
if (!prevOutScriptScriptHash.equals(redeemScriptHash)) throw new Error('Inconsistent hash160(RedeemScript)')
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function checkP2WSHInput (input, witnessScriptHash) {
|
|
293
|
-
if (input.prevOutType) {
|
|
294
|
-
if (input.prevOutType !== scriptTypes.P2WSH) throw new Error('PrevOutScript must be P2WSH')
|
|
295
|
-
|
|
296
|
-
var scriptHash = bscript.decompile(input.prevOutScript)[1]
|
|
297
|
-
if (!scriptHash.equals(witnessScriptHash)) throw new Error('Inconsistent sha25(WitnessScript)')
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function prepareInput (input, kpPubKey, redeemScript, witnessValue, witnessScript) {
|
|
302
|
-
var expanded
|
|
303
|
-
var prevOutType
|
|
304
|
-
var prevOutScript
|
|
305
|
-
|
|
306
|
-
var p2sh = false
|
|
307
|
-
var p2shType
|
|
308
|
-
var redeemScriptHash
|
|
309
|
-
|
|
310
|
-
var witness = false
|
|
311
|
-
var p2wsh = false
|
|
312
|
-
var witnessType
|
|
313
|
-
var witnessScriptHash
|
|
314
|
-
|
|
315
|
-
var signType
|
|
316
|
-
var signScript
|
|
317
|
-
|
|
318
|
-
if (redeemScript && witnessScript) {
|
|
319
|
-
redeemScriptHash = bcrypto.hash160(redeemScript)
|
|
320
|
-
witnessScriptHash = bcrypto.sha256(witnessScript)
|
|
321
|
-
checkP2SHInput(input, redeemScriptHash)
|
|
322
|
-
|
|
323
|
-
if (!redeemScript.equals(btemplates.witnessScriptHash.output.encode(witnessScriptHash))) throw new Error('Witness script inconsistent with redeem script')
|
|
324
|
-
|
|
325
|
-
expanded = expandOutput(witnessScript, undefined, kpPubKey)
|
|
326
|
-
if (!expanded.pubKeys) throw new Error('WitnessScript not supported "' + bscript.toASM(redeemScript) + '"')
|
|
327
|
-
|
|
328
|
-
prevOutType = btemplates.types.P2SH
|
|
329
|
-
prevOutScript = btemplates.scriptHash.output.encode(redeemScriptHash)
|
|
330
|
-
p2sh = witness = p2wsh = true
|
|
331
|
-
p2shType = btemplates.types.P2WSH
|
|
332
|
-
signType = witnessType = expanded.scriptType
|
|
333
|
-
signScript = witnessScript
|
|
334
|
-
} else if (redeemScript) {
|
|
335
|
-
redeemScriptHash = bcrypto.hash160(redeemScript)
|
|
336
|
-
checkP2SHInput(input, redeemScriptHash)
|
|
337
|
-
|
|
338
|
-
expanded = expandOutput(redeemScript, undefined, kpPubKey)
|
|
339
|
-
if (!expanded.pubKeys) throw new Error('RedeemScript not supported "' + bscript.toASM(redeemScript) + '"')
|
|
340
|
-
|
|
341
|
-
prevOutType = btemplates.types.P2SH
|
|
342
|
-
prevOutScript = btemplates.scriptHash.output.encode(redeemScriptHash)
|
|
343
|
-
p2sh = true
|
|
344
|
-
signType = p2shType = expanded.scriptType
|
|
345
|
-
signScript = redeemScript
|
|
346
|
-
witness = signType === btemplates.types.P2WPKH
|
|
347
|
-
} else if (witnessScript) {
|
|
348
|
-
witnessScriptHash = bcrypto.sha256(witnessScript)
|
|
349
|
-
checkP2WSHInput(input, witnessScriptHash)
|
|
350
|
-
|
|
351
|
-
expanded = expandOutput(witnessScript, undefined, kpPubKey)
|
|
352
|
-
if (!expanded.pubKeys) throw new Error('WitnessScript not supported "' + bscript.toASM(redeemScript) + '"')
|
|
353
|
-
|
|
354
|
-
prevOutType = btemplates.types.P2WSH
|
|
355
|
-
prevOutScript = btemplates.witnessScriptHash.output.encode(witnessScriptHash)
|
|
356
|
-
witness = p2wsh = true
|
|
357
|
-
signType = witnessType = expanded.scriptType
|
|
358
|
-
signScript = witnessScript
|
|
359
|
-
} else if (input.prevOutType) {
|
|
360
|
-
// embedded scripts are not possible without a redeemScript
|
|
361
|
-
if (input.prevOutType === scriptTypes.P2SH ||
|
|
362
|
-
input.prevOutType === scriptTypes.P2WSH) {
|
|
363
|
-
throw new Error('PrevOutScript is ' + input.prevOutType + ', requires redeemScript')
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
prevOutType = input.prevOutType
|
|
367
|
-
prevOutScript = input.prevOutScript
|
|
368
|
-
expanded = expandOutput(input.prevOutScript, input.prevOutType, kpPubKey)
|
|
369
|
-
if (!expanded.pubKeys) return
|
|
370
|
-
|
|
371
|
-
witness = (input.prevOutType === scriptTypes.P2WPKH)
|
|
372
|
-
signType = prevOutType
|
|
373
|
-
signScript = prevOutScript
|
|
374
|
-
} else {
|
|
375
|
-
prevOutScript = btemplates.pubKeyHash.output.encode(bcrypto.hash160(kpPubKey))
|
|
376
|
-
expanded = expandOutput(prevOutScript, scriptTypes.P2PKH, kpPubKey)
|
|
377
|
-
|
|
378
|
-
prevOutType = scriptTypes.P2PKH
|
|
379
|
-
witness = false
|
|
380
|
-
signType = prevOutType
|
|
381
|
-
signScript = prevOutScript
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if (signType === scriptTypes.P2WPKH) {
|
|
385
|
-
signScript = btemplates.pubKeyHash.output.encode(btemplates.witnessPubKeyHash.output.decode(signScript))
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (p2sh) {
|
|
389
|
-
input.redeemScript = redeemScript
|
|
390
|
-
input.redeemScriptType = p2shType
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (p2wsh) {
|
|
394
|
-
input.witnessScript = witnessScript
|
|
395
|
-
input.witnessScriptType = witnessType
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
input.pubKeys = expanded.pubKeys
|
|
399
|
-
input.signatures = expanded.signatures
|
|
400
|
-
input.signScript = signScript
|
|
401
|
-
input.signType = signType
|
|
402
|
-
input.prevOutScript = prevOutScript
|
|
403
|
-
input.prevOutType = prevOutType
|
|
404
|
-
input.witness = witness
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
function buildStack (type, signatures, pubKeys, allowIncomplete) {
|
|
408
|
-
if (type === scriptTypes.P2PKH) {
|
|
409
|
-
if (signatures.length === 1 && Buffer.isBuffer(signatures[0]) && pubKeys.length === 1) return btemplates.pubKeyHash.input.encodeStack(signatures[0], pubKeys[0])
|
|
410
|
-
} else if (type === scriptTypes.P2PK) {
|
|
411
|
-
if (signatures.length === 1 && Buffer.isBuffer(signatures[0])) return btemplates.pubKey.input.encodeStack(signatures[0])
|
|
412
|
-
} else if (type === scriptTypes.MULTISIG) {
|
|
413
|
-
if (signatures.length > 0) {
|
|
414
|
-
signatures = signatures.map(function (signature) {
|
|
415
|
-
return signature || ops.OP_0
|
|
416
|
-
})
|
|
417
|
-
if (!allowIncomplete) {
|
|
418
|
-
// remove blank signatures
|
|
419
|
-
signatures = signatures.filter(function (x) { return x !== ops.OP_0 })
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
return btemplates.multisig.input.encodeStack(signatures)
|
|
423
|
-
}
|
|
424
|
-
} else {
|
|
425
|
-
throw new Error('Not yet supported')
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
if (!allowIncomplete) throw new Error('Not enough signatures provided')
|
|
429
|
-
return []
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function buildInput (input, allowIncomplete) {
|
|
433
|
-
var scriptType = input.prevOutType
|
|
434
|
-
var sig = []
|
|
435
|
-
var witness = []
|
|
436
|
-
|
|
437
|
-
if (supportedType(scriptType)) {
|
|
438
|
-
sig = buildStack(scriptType, input.signatures, input.pubKeys, allowIncomplete)
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
var p2sh = false
|
|
442
|
-
if (scriptType === btemplates.types.P2SH) {
|
|
443
|
-
// We can remove this error later when we have a guarantee prepareInput
|
|
444
|
-
// rejects unsignable scripts - it MUST be signable at this point.
|
|
445
|
-
if (!allowIncomplete && !supportedP2SHType(input.redeemScriptType)) {
|
|
446
|
-
throw new Error('Impossible to sign this type')
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (supportedType(input.redeemScriptType)) {
|
|
450
|
-
sig = buildStack(input.redeemScriptType, input.signatures, input.pubKeys, allowIncomplete)
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// If it wasn't SIGNABLE, it's witness, defer to that
|
|
454
|
-
if (input.redeemScriptType) {
|
|
455
|
-
p2sh = true
|
|
456
|
-
scriptType = input.redeemScriptType
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
switch (scriptType) {
|
|
461
|
-
// P2WPKH is a special case of P2PKH
|
|
462
|
-
case btemplates.types.P2WPKH:
|
|
463
|
-
witness = buildStack(btemplates.types.P2PKH, input.signatures, input.pubKeys, allowIncomplete)
|
|
464
|
-
break
|
|
465
|
-
|
|
466
|
-
case btemplates.types.P2WSH:
|
|
467
|
-
// We can remove this check later
|
|
468
|
-
if (!allowIncomplete && !supportedType(input.witnessScriptType)) {
|
|
469
|
-
throw new Error('Impossible to sign this type')
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (supportedType(input.witnessScriptType)) {
|
|
473
|
-
witness = buildStack(input.witnessScriptType, input.signatures, input.pubKeys, allowIncomplete)
|
|
474
|
-
witness.push(input.witnessScript)
|
|
475
|
-
scriptType = input.witnessScriptType
|
|
476
|
-
}
|
|
477
|
-
break
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// append redeemScript if necessary
|
|
481
|
-
if (p2sh) {
|
|
482
|
-
sig.push(input.redeemScript)
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
return {
|
|
486
|
-
type: scriptType,
|
|
487
|
-
script: bscript.compile(sig),
|
|
488
|
-
witness: witness
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// By default, assume is a bitcoin transaction
|
|
493
|
-
function TransactionBuilder (network, maximumFeeRate) {
|
|
494
|
-
this.prevTxMap = {}
|
|
495
|
-
this.network = network || networks.bitcoin
|
|
496
|
-
|
|
497
|
-
// WARNING: This is __NOT__ to be relied on, its just another potential safety mechanism (safety in-depth)
|
|
498
|
-
this.maximumFeeRate = maximumFeeRate || 2500
|
|
499
|
-
|
|
500
|
-
this.inputs = []
|
|
501
|
-
this.tx = new Transaction(this.network)
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
TransactionBuilder.prototype.setLockTime = function (locktime) {
|
|
505
|
-
typeforce(types.UInt32, locktime)
|
|
506
|
-
|
|
507
|
-
// if any signatures exist, throw
|
|
508
|
-
if (this.inputs.some(function (input) {
|
|
509
|
-
if (!input.signatures) return false
|
|
510
|
-
|
|
511
|
-
return input.signatures.some(function (s) { return s })
|
|
512
|
-
})) {
|
|
513
|
-
throw new Error('No, this would invalidate signatures')
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
this.tx.locktime = locktime
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
TransactionBuilder.prototype.setVersion = function (version, overwinter = true) {
|
|
520
|
-
typeforce(types.UInt32, version)
|
|
521
|
-
|
|
522
|
-
if (coins.isZcash(this.network)) {
|
|
523
|
-
if (!this.network.consensusBranchId.hasOwnProperty(this.tx.version)) {
|
|
524
|
-
throw new Error('Unsupported Zcash transaction')
|
|
525
|
-
}
|
|
526
|
-
this.tx.overwintered = (overwinter ? 1 : 0)
|
|
527
|
-
}
|
|
528
|
-
this.tx.version = version
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
TransactionBuilder.prototype.setVersionGroupId = function (versionGroupId) {
|
|
532
|
-
if (!(coins.isZcash(this.network) && this.tx.isOverwinterCompatible())) {
|
|
533
|
-
throw new Error('expiryHeight can only be set for Zcash starting at overwinter version. Current network coin: ' +
|
|
534
|
-
this.network.coin + ', version: ' + this.tx.version)
|
|
535
|
-
}
|
|
536
|
-
typeforce(types.UInt32, versionGroupId)
|
|
537
|
-
this.tx.versionGroupId = versionGroupId
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
TransactionBuilder.prototype.setExpiryHeight = function (expiryHeight) {
|
|
541
|
-
if (!(coins.isZcash(this.network) && this.tx.isOverwinterCompatible())) {
|
|
542
|
-
throw new Error('expiryHeight can only be set for Zcash starting at overwinter version. Current network coin: ' +
|
|
543
|
-
this.network.coin + ', version: ' + this.tx.version)
|
|
544
|
-
}
|
|
545
|
-
typeforce(types.UInt32, expiryHeight)
|
|
546
|
-
this.tx.expiryHeight = expiryHeight
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
TransactionBuilder.prototype.setJoinSplits = function (transaction) {
|
|
550
|
-
if (!(coins.isZcash(this.network) && this.tx.supportsJoinSplits())) {
|
|
551
|
-
throw new Error('joinsplits can only be set for Zcash starting at version 2. Current network coin: ' +
|
|
552
|
-
this.network.coin + ', version: ' + this.tx.version)
|
|
553
|
-
}
|
|
554
|
-
if (transaction && transaction.joinsplits) {
|
|
555
|
-
this.tx.joinsplits = transaction.joinsplits.map(function (txJoinsplit) {
|
|
556
|
-
return {
|
|
557
|
-
vpubOld: txJoinsplit.vpubOld,
|
|
558
|
-
vpubNew: txJoinsplit.vpubNew,
|
|
559
|
-
anchor: txJoinsplit.anchor,
|
|
560
|
-
nullifiers: txJoinsplit.nullifiers,
|
|
561
|
-
commitments: txJoinsplit.commitments,
|
|
562
|
-
ephemeralKey: txJoinsplit.ephemeralKey,
|
|
563
|
-
randomSeed: txJoinsplit.randomSeed,
|
|
564
|
-
macs: txJoinsplit.macs,
|
|
565
|
-
zproof: txJoinsplit.zproof,
|
|
566
|
-
ciphertexts: txJoinsplit.ciphertexts
|
|
567
|
-
}
|
|
568
|
-
})
|
|
569
|
-
|
|
570
|
-
this.tx.joinsplitPubkey = transaction.joinsplitPubkey
|
|
571
|
-
this.tx.joinsplitSig = transaction.joinsplitSig
|
|
572
|
-
return
|
|
573
|
-
}
|
|
574
|
-
throw new Error('Invalid transaction with joinsplits')
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
TransactionBuilder.fromTransaction = function (transaction, network) {
|
|
578
|
-
var txbNetwork = network || networks.bitcoin
|
|
579
|
-
var txb = new TransactionBuilder(txbNetwork)
|
|
580
|
-
|
|
581
|
-
if (txb.network.coin !== transaction.network.coin) {
|
|
582
|
-
throw new Error('This transaction is incompatible with the transaction builder')
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// Copy transaction fields
|
|
586
|
-
txb.setVersion(transaction.version, transaction.overwintered)
|
|
587
|
-
txb.setLockTime(transaction.locktime)
|
|
588
|
-
|
|
589
|
-
if (coins.isZcash(txbNetwork)) {
|
|
590
|
-
// Copy Zcash overwinter fields. If the transaction builder is not for Zcash, they will be omitted
|
|
591
|
-
if (txb.tx.isOverwinterCompatible()) {
|
|
592
|
-
txb.setVersionGroupId(transaction.versionGroupId)
|
|
593
|
-
txb.setExpiryHeight(transaction.expiryHeight)
|
|
594
|
-
}
|
|
595
|
-
// We don't support protected transactions but we copy the joinsplits for consistency. However, the transaction
|
|
596
|
-
// builder will fail when we try to sign one of these transactions
|
|
597
|
-
if (txb.tx.supportsJoinSplits()) {
|
|
598
|
-
txb.setJoinSplits(transaction)
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
// Copy outputs (done first to avoid signature invalidation)
|
|
602
|
-
transaction.outs.forEach(function (txOut) {
|
|
603
|
-
txb.addOutput(txOut.script, txOut.value)
|
|
604
|
-
})
|
|
605
|
-
|
|
606
|
-
// Copy inputs
|
|
607
|
-
transaction.ins.forEach(function (txIn) {
|
|
608
|
-
txb.__addInputUnsafe(txIn.hash, txIn.index, {
|
|
609
|
-
sequence: txIn.sequence,
|
|
610
|
-
script: txIn.script,
|
|
611
|
-
witness: txIn.witness,
|
|
612
|
-
value: txIn.value
|
|
613
|
-
})
|
|
614
|
-
})
|
|
615
|
-
|
|
616
|
-
// fix some things not possible through the public API
|
|
617
|
-
txb.inputs.forEach(function (input, i) {
|
|
618
|
-
fixMultisigOrder(input, transaction, i, input.value, txbNetwork)
|
|
619
|
-
})
|
|
620
|
-
|
|
621
|
-
return txb
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
TransactionBuilder.prototype.addInput = function (txHash, vout, sequence, prevOutScript) {
|
|
625
|
-
if (!this.__canModifyInputs()) {
|
|
626
|
-
throw new Error('No, this would invalidate signatures')
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
var value
|
|
630
|
-
|
|
631
|
-
// is it a hex string?
|
|
632
|
-
if (typeof txHash === 'string') {
|
|
633
|
-
// transaction hashs's are displayed in reverse order, un-reverse it
|
|
634
|
-
txHash = Buffer.from(txHash, 'hex').reverse()
|
|
635
|
-
|
|
636
|
-
// is it a Transaction object?
|
|
637
|
-
} else if (txHash instanceof Transaction) {
|
|
638
|
-
var txOut = txHash.outs[vout]
|
|
639
|
-
prevOutScript = txOut.script
|
|
640
|
-
value = txOut.value
|
|
641
|
-
|
|
642
|
-
txHash = txHash.getHash()
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
return this.__addInputUnsafe(txHash, vout, {
|
|
646
|
-
sequence: sequence,
|
|
647
|
-
prevOutScript: prevOutScript,
|
|
648
|
-
value: value
|
|
649
|
-
})
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
TransactionBuilder.prototype.__addInputUnsafe = function (txHash, vout, options) {
|
|
653
|
-
if (Transaction.isCoinbaseHash(txHash)) {
|
|
654
|
-
throw new Error('coinbase inputs not supported')
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
var prevTxOut = txHash.toString('hex') + ':' + vout
|
|
658
|
-
if (this.prevTxMap[prevTxOut] !== undefined) throw new Error('Duplicate TxOut: ' + prevTxOut)
|
|
659
|
-
|
|
660
|
-
var input = {}
|
|
661
|
-
|
|
662
|
-
// derive what we can from the scriptSig
|
|
663
|
-
if (options.script !== undefined) {
|
|
664
|
-
input = expandInput(options.script, options.witness || [])
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// if an input value was given, retain it
|
|
668
|
-
if (options.value !== undefined) {
|
|
669
|
-
input.value = options.value
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// derive what we can from the previous transactions output script
|
|
673
|
-
if (!input.prevOutScript && options.prevOutScript) {
|
|
674
|
-
var prevOutType
|
|
675
|
-
|
|
676
|
-
if (!input.pubKeys && !input.signatures) {
|
|
677
|
-
var expanded = expandOutput(options.prevOutScript)
|
|
678
|
-
|
|
679
|
-
if (expanded.pubKeys) {
|
|
680
|
-
input.pubKeys = expanded.pubKeys
|
|
681
|
-
input.signatures = expanded.signatures
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
prevOutType = expanded.scriptType
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
input.prevOutScript = options.prevOutScript
|
|
688
|
-
input.prevOutType = prevOutType || btemplates.classifyOutput(options.prevOutScript)
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
var vin = this.tx.addInput(txHash, vout, options.sequence, options.scriptSig)
|
|
692
|
-
this.inputs[vin] = input
|
|
693
|
-
this.prevTxMap[prevTxOut] = vin
|
|
694
|
-
return vin
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
TransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {
|
|
698
|
-
if (!this.__canModifyOutputs()) {
|
|
699
|
-
throw new Error('No, this would invalidate signatures')
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// Attempt to get a script if it's a base58 address string
|
|
703
|
-
if (typeof scriptPubKey === 'string') {
|
|
704
|
-
scriptPubKey = baddress.toOutputScript(scriptPubKey, this.network)
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
return this.tx.addOutput(scriptPubKey, value)
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
TransactionBuilder.prototype.build = function () {
|
|
711
|
-
return this.__build(false)
|
|
712
|
-
}
|
|
713
|
-
TransactionBuilder.prototype.buildIncomplete = function () {
|
|
714
|
-
return this.__build(true)
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
TransactionBuilder.prototype.__build = function (allowIncomplete) {
|
|
718
|
-
if (!allowIncomplete) {
|
|
719
|
-
if (!this.tx.ins.length) throw new Error('Transaction has no inputs')
|
|
720
|
-
if (!this.tx.outs.length) throw new Error('Transaction has no outputs')
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
var tx = this.tx.clone()
|
|
724
|
-
// Create script signatures from inputs
|
|
725
|
-
this.inputs.forEach(function (input, i) {
|
|
726
|
-
var scriptType = input.witnessScriptType || input.redeemScriptType || input.prevOutType
|
|
727
|
-
if (!scriptType && !allowIncomplete) throw new Error('Transaction is not complete')
|
|
728
|
-
var result = buildInput(input, allowIncomplete)
|
|
729
|
-
|
|
730
|
-
// skip if no result
|
|
731
|
-
if (!allowIncomplete) {
|
|
732
|
-
if (!supportedType(result.type) && result.type !== btemplates.types.P2WPKH) {
|
|
733
|
-
throw new Error(result.type + ' not supported')
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
tx.setInputScript(i, result.script)
|
|
738
|
-
tx.setWitness(i, result.witness)
|
|
739
|
-
})
|
|
740
|
-
|
|
741
|
-
if (!allowIncomplete) {
|
|
742
|
-
// do not rely on this, its merely a last resort
|
|
743
|
-
if (this.__overMaximumFees(tx.virtualSize())) {
|
|
744
|
-
throw new Error('Transaction has absurd fees')
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
return tx
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
function canSign (input) {
|
|
752
|
-
return input.prevOutScript !== undefined &&
|
|
753
|
-
input.signScript !== undefined &&
|
|
754
|
-
input.pubKeys !== undefined &&
|
|
755
|
-
input.signatures !== undefined &&
|
|
756
|
-
input.signatures.length === input.pubKeys.length &&
|
|
757
|
-
input.pubKeys.length > 0 &&
|
|
758
|
-
(
|
|
759
|
-
input.witness === false ||
|
|
760
|
-
(input.witness === true && input.value !== undefined)
|
|
761
|
-
)
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashType, witnessValue, witnessScript) {
|
|
765
|
-
debug('Signing transaction: (input: %d, hashType: %d, witnessVal: %s, witnessScript: %j)', vin, hashType, witnessValue, witnessScript)
|
|
766
|
-
debug('Transaction Builder network: %j', this.network)
|
|
767
|
-
|
|
768
|
-
// TODO: remove keyPair.network matching in 4.0.0
|
|
769
|
-
if (keyPair.network && keyPair.network !== this.network) throw new TypeError('Inconsistent network')
|
|
770
|
-
if (!this.inputs[vin]) throw new Error('No input at index: ' + vin)
|
|
771
|
-
hashType = hashType || Transaction.SIGHASH_ALL
|
|
772
|
-
|
|
773
|
-
var input = this.inputs[vin]
|
|
774
|
-
|
|
775
|
-
// if redeemScript was previously provided, enforce consistency
|
|
776
|
-
if (input.redeemScript !== undefined &&
|
|
777
|
-
redeemScript &&
|
|
778
|
-
!input.redeemScript.equals(redeemScript)) {
|
|
779
|
-
throw new Error('Inconsistent redeemScript')
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
var kpPubKey = keyPair.publicKey || keyPair.getPublicKeyBuffer()
|
|
783
|
-
if (!canSign(input)) {
|
|
784
|
-
if (witnessValue !== undefined) {
|
|
785
|
-
if (input.value !== undefined && input.value !== witnessValue) throw new Error('Input didn\'t match witnessValue')
|
|
786
|
-
typeforce(types.Satoshi, witnessValue)
|
|
787
|
-
input.value = witnessValue
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
debug('Preparing input %d for signing', vin)
|
|
791
|
-
|
|
792
|
-
if (!canSign(input)) prepareInput(input, kpPubKey, redeemScript, witnessValue, witnessScript)
|
|
793
|
-
if (!canSign(input)) throw Error(input.prevOutType + ' not supported')
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
// ready to sign
|
|
797
|
-
var signatureHash
|
|
798
|
-
if (coins.isBitcoinGold(this.network)) {
|
|
799
|
-
signatureHash = this.tx.hashForGoldSignature(vin, input.signScript, witnessValue, hashType, input.witness)
|
|
800
|
-
debug('Calculated BTG sighash (%s)', signatureHash.toString('hex'))
|
|
801
|
-
} else if (coins.isBitcoinCash(this.network) || coins.isBitcoinSV(this.network)) {
|
|
802
|
-
signatureHash = this.tx.hashForCashSignature(vin, input.signScript, witnessValue, hashType)
|
|
803
|
-
debug('Calculated BCH sighash (%s)', signatureHash.toString('hex'))
|
|
804
|
-
} else if (coins.isZcash(this.network)) {
|
|
805
|
-
signatureHash = this.tx.hashForZcashSignature(vin, input.signScript, witnessValue, hashType)
|
|
806
|
-
debug('Calculated ZEC sighash (%s)', signatureHash.toString('hex'))
|
|
807
|
-
} else {
|
|
808
|
-
if (input.witness) {
|
|
809
|
-
signatureHash = this.tx.hashForWitnessV0(vin, input.signScript, witnessValue, hashType)
|
|
810
|
-
debug('Calculated witnessv0 sighash (%s)', signatureHash.toString('hex'))
|
|
811
|
-
} else {
|
|
812
|
-
signatureHash = this.tx.hashForSignature(vin, input.signScript, hashType)
|
|
813
|
-
debug('Calculated sighash (%s)', signatureHash.toString('hex'))
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
// enforce in order signing of public keys
|
|
818
|
-
var signed = input.pubKeys.some(function (pubKey, i) {
|
|
819
|
-
if (!kpPubKey.equals(pubKey)) return false
|
|
820
|
-
if (input.signatures[i]) throw new Error('Signature already exists')
|
|
821
|
-
if (kpPubKey.length !== 33 &&
|
|
822
|
-
input.signType === scriptTypes.P2WPKH) throw new Error('BIP143 rejects uncompressed public keys in P2WPKH or P2WSH')
|
|
823
|
-
|
|
824
|
-
var signature = keyPair.sign(signatureHash)
|
|
825
|
-
if (Buffer.isBuffer(signature)) signature = ECSignature.fromRSBuffer(signature)
|
|
826
|
-
|
|
827
|
-
debug('Produced signature (r: %s, s: %s)', signature.r, signature.s)
|
|
828
|
-
|
|
829
|
-
input.signatures[i] = signature.toScriptSignature(hashType)
|
|
830
|
-
return true
|
|
831
|
-
})
|
|
832
|
-
|
|
833
|
-
if (!signed) throw new Error('Key pair cannot sign for this input')
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
function signatureHashType (buffer) {
|
|
837
|
-
return buffer.readUInt8(buffer.length - 1)
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
TransactionBuilder.prototype.__canModifyInputs = function () {
|
|
841
|
-
return this.inputs.every(function (input) {
|
|
842
|
-
// any signatures?
|
|
843
|
-
if (input.signatures === undefined) return true
|
|
844
|
-
|
|
845
|
-
return input.signatures.every(function (signature) {
|
|
846
|
-
if (!signature) return true
|
|
847
|
-
var hashType = signatureHashType(signature)
|
|
848
|
-
|
|
849
|
-
// if SIGHASH_ANYONECANPAY is set, signatures would not
|
|
850
|
-
// be invalidated by more inputs
|
|
851
|
-
return hashType & Transaction.SIGHASH_ANYONECANPAY
|
|
852
|
-
})
|
|
853
|
-
})
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
TransactionBuilder.prototype.__canModifyOutputs = function () {
|
|
857
|
-
var nInputs = this.tx.ins.length
|
|
858
|
-
var nOutputs = this.tx.outs.length
|
|
859
|
-
|
|
860
|
-
return this.inputs.every(function (input) {
|
|
861
|
-
if (input.signatures === undefined) return true
|
|
862
|
-
|
|
863
|
-
return input.signatures.every(function (signature) {
|
|
864
|
-
if (!signature) return true
|
|
865
|
-
var hashType = signatureHashType(signature)
|
|
866
|
-
|
|
867
|
-
var hashTypeMod = hashType & 0x1f
|
|
868
|
-
if (hashTypeMod === Transaction.SIGHASH_NONE) return true
|
|
869
|
-
if (hashTypeMod === Transaction.SIGHASH_SINGLE) {
|
|
870
|
-
// if SIGHASH_SINGLE is set, and nInputs > nOutputs
|
|
871
|
-
// some signatures would be invalidated by the addition
|
|
872
|
-
// of more outputs
|
|
873
|
-
return nInputs <= nOutputs
|
|
874
|
-
}
|
|
875
|
-
})
|
|
876
|
-
})
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
TransactionBuilder.prototype.__overMaximumFees = function (bytes) {
|
|
880
|
-
// not all inputs will have .value defined
|
|
881
|
-
var incoming = this.inputs.reduce(function (a, x) { return a + (x.value >>> 0) }, 0)
|
|
882
|
-
|
|
883
|
-
// but all outputs do, and if we have any input value
|
|
884
|
-
// we can immediately determine if the outputs are too small
|
|
885
|
-
var outgoing = this.tx.outs.reduce(function (a, x) { return a + x.value }, 0)
|
|
886
|
-
var fee = incoming - outgoing
|
|
887
|
-
var feeRate = fee / bytes
|
|
888
|
-
|
|
889
|
-
return feeRate > this.maximumFeeRate
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
module.exports = TransactionBuilder
|