@airgap/coinlib-core 0.13.11-beta.1 → 0.13.11-beta.3
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/actions/Action.d.ts +24 -0
- package/actions/Action.js +119 -0
- package/actions/Action.js.map +1 -0
- package/actions/LinkedAction.d.ts +10 -0
- package/actions/LinkedAction.js +95 -0
- package/actions/LinkedAction.js.map +1 -0
- package/actions/RepeatableAction.d.ts +8 -0
- package/actions/RepeatableAction.js +92 -0
- package/actions/RepeatableAction.js.map +1 -0
- package/actions/SimpleAction.d.ts +7 -0
- package/actions/SimpleAction.js +80 -0
- package/actions/SimpleAction.js.map +1 -0
- package/actions/StateMachine.d.ts +9 -0
- package/actions/StateMachine.js +42 -0
- package/actions/StateMachine.js.map +1 -0
- package/data/KeyPair.d.ts +5 -0
- package/data/KeyPair.js +3 -0
- package/data/KeyPair.js.map +1 -0
- package/data/Lazy.d.ts +14 -0
- package/data/Lazy.js +83 -0
- package/data/Lazy.js.map +1 -0
- package/data/RPCBody.d.ts +7 -0
- package/data/RPCBody.js +16 -0
- package/data/RPCBody.js.map +1 -0
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +230 -0
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +471 -0
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -0
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +76 -0
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +455 -0
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -0
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.d.ts +27 -0
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +848 -0
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -0
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.d.ts +22 -0
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +14 -0
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -0
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.d.ts +29 -0
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +63 -0
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.d.ts +36 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +87 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.d.ts +8 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +33 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.d.ts +11 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js +5 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.d.ts +8 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +43 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.d.ts +8 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +37 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -0
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +73 -0
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +552 -0
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -0
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +73 -0
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +552 -0
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -0
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +18 -0
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +29 -0
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.d.ts +57 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +384 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.d.ts +63 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +264 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +5 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +82 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +4 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +67 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.d.ts +89 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +169 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +9 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js +3 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +42 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +270 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.d.ts +15 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +80 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.d.ts +12 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +184 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +5 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +81 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +4 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +76 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.d.ts +14 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +150 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.d.ts +17 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +41 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +150 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +217 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.d.ts +26 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +115 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.d.ts +9 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +35 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +3 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +26 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.d.ts +13 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +52 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.d.ts +4 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js +9 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.d.ts +34 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +39 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +1590 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +35 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +91 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +127 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.d.ts +145 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +270 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +4 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +33 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.d.ts +163 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +438 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.d.ts +158 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +254 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +24 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +126 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.d.ts +4 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js +9 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js.map +1 -0
- package/dependencies/src/axios-0.19.0/index.d.ts +152 -0
- package/dependencies/src/axios-0.19.0/index.js +1 -0
- package/dependencies/src/axios-0.19.0/lib/adapters/http.js +275 -0
- package/dependencies/src/axios-0.19.0/lib/adapters/xhr.js +174 -0
- package/dependencies/src/axios-0.19.0/lib/axios.js +53 -0
- package/dependencies/src/axios-0.19.0/lib/cancel/Cancel.js +19 -0
- package/dependencies/src/axios-0.19.0/lib/cancel/CancelToken.js +57 -0
- package/dependencies/src/axios-0.19.0/lib/cancel/isCancel.js +5 -0
- package/dependencies/src/axios-0.19.0/lib/core/Axios.js +86 -0
- package/dependencies/src/axios-0.19.0/lib/core/InterceptorManager.js +52 -0
- package/dependencies/src/axios-0.19.0/lib/core/createError.js +18 -0
- package/dependencies/src/axios-0.19.0/lib/core/dispatchRequest.js +86 -0
- package/dependencies/src/axios-0.19.0/lib/core/enhanceError.js +42 -0
- package/dependencies/src/axios-0.19.0/lib/core/mergeConfig.js +51 -0
- package/dependencies/src/axios-0.19.0/lib/core/settle.js +25 -0
- package/dependencies/src/axios-0.19.0/lib/core/transformData.js +20 -0
- package/dependencies/src/axios-0.19.0/lib/defaults.js +98 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/bind.js +11 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/buildURL.js +71 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/combineURLs.js +14 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/cookies.js +53 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/deprecatedMethod.js +24 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/isAbsoluteURL.js +14 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/isURLSameOrigin.js +68 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/normalizeHeaderName.js +12 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/parseHeaders.js +53 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/spread.js +27 -0
- package/dependencies/src/axios-0.19.0/lib/utils.js +334 -0
- package/dependencies/src/axios-0.19.0/package.json +85 -0
- package/dependencies/src/base-x-3.0.7/src/index.d.ts +10 -0
- package/dependencies/src/base-x-3.0.7/src/index.js +120 -0
- package/dependencies/src/base64-js-1.3.1/index.js +152 -0
- package/dependencies/src/bech32-0.0.3/index.js +139 -0
- package/dependencies/src/bech32-1.1.3/index.js +147 -0
- package/dependencies/src/big-integer-1.6.45/BigInteger.d.ts +2393 -0
- package/dependencies/src/big-integer-1.6.45/BigInteger.js +1452 -0
- package/dependencies/src/bigi-1.4.2/lib/bigi.js +1509 -0
- package/dependencies/src/bigi-1.4.2/lib/convert.js +91 -0
- package/dependencies/src/bigi-1.4.2/lib/index.js +6 -0
- package/dependencies/src/bigi-1.4.2/package.json +55 -0
- package/dependencies/src/bignumber.js-9.0.0/bignumber.d.ts +1829 -0
- package/dependencies/src/bignumber.js-9.0.0/bignumber.js +2902 -0
- package/dependencies/src/bip32-2.0.4/src/bip32.js +290 -0
- package/dependencies/src/bip32-2.0.4/src/crypto.js +26 -0
- package/dependencies/src/bip32-2.0.4/src/index.js +7 -0
- package/dependencies/src/bip32-path-0.4.2/index.js +96 -0
- package/dependencies/src/bip39-2.5.0/index.js +153 -0
- package/dependencies/src/bip39-2.5.0/wordlists/chinese_simplified.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/chinese_traditional.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/english.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/french.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/italian.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/japanese.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/korean.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/spanish.json +2050 -0
- package/dependencies/src/bip66-1.1.5/index.js +113 -0
- package/dependencies/src/bitcoin-ops-1.4.1/index.json +120 -0
- package/dependencies/src/bitcoin-ops-1.4.1/map.js +9 -0
- package/dependencies/src/bitcoinjs-message-2.1.1/index.js +157 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/address.js +109 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/block.js +234 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferWriter.js +40 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferutils.js +65 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/coins.js +53 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/crypto.js +43 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecdsa.js +161 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecpair.js +155 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecsignature.js +97 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/fastcurve.js +92 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/hdnode.js +363 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/index.js +24 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/networks.js +214 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script.js +214 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script_number.js +68 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/index.js +74 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/input.js +71 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/output.js +64 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/nulldata.js +39 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/input.js +39 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/output.js +33 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/input.js +51 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/output.js +42 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/input.js +84 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/output.js +34 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/index.js +3 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/output.js +42 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/input.js +44 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/output.js +33 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/input.js +63 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/output.js +33 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction.js +1125 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction_builder.js +892 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/types.js +55 -0
- package/dependencies/src/blake2b-6268e6dd678661e0acc4359e9171b97eb1ebf8ac/index.js +313 -0
- package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/blake2b.js +63 -0
- package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/index.js +128 -0
- package/dependencies/src/blakejs-1.1.0/blake2b.js +273 -0
- package/dependencies/src/blakejs-1.1.0/blake2s.js +190 -0
- package/dependencies/src/blakejs-1.1.0/index.js +15 -0
- package/dependencies/src/blakejs-1.1.0/util.js +81 -0
- package/dependencies/src/bn.js-4.11.8/lib/bn.js +3427 -0
- package/dependencies/src/brorand-1.1.0/index.js +65 -0
- package/dependencies/src/bs58-4.0.1/index.js +4 -0
- package/dependencies/src/bs58check-2.1.2/base.js +50 -0
- package/dependencies/src/bs58check-2.1.2/index.js +12 -0
- package/dependencies/src/bs58grscheck-2.1.2/base.js +50 -0
- package/dependencies/src/bs58grscheck-2.1.2/index.js +12 -0
- package/dependencies/src/buffer-5.6.0/index.d.ts +186 -0
- package/dependencies/src/buffer-5.6.0/index.js +1794 -0
- package/dependencies/src/buffer-equals-1.0.4/index.js +26 -0
- package/dependencies/src/cbor-sync-1.0.4/index.d.ts +11 -0
- package/dependencies/src/cbor-sync-1.0.4/index.js +632 -0
- package/dependencies/src/cipher-base-1.0.4/index.js +99 -0
- package/dependencies/src/cosmjs/index.d.ts +379 -0
- package/dependencies/src/cosmjs/index.js +1297 -0
- package/dependencies/src/cosmjs/index.js.map +1 -0
- package/dependencies/src/create-hash-1.2.0/browser.js +30 -0
- package/dependencies/src/create-hash-1.2.0/index.js +1 -0
- package/dependencies/src/create-hash-1.2.0/md5.js +5 -0
- package/dependencies/src/create-hmac-1.1.4/browser.js +68 -0
- package/dependencies/src/create-hmac-1.1.4/index.js +1 -0
- package/dependencies/src/create-hmac-1.1.7/browser.js +62 -0
- package/dependencies/src/create-hmac-1.1.7/legacy.js +46 -0
- package/dependencies/src/cryptocompare-0.5.0/index.js +138 -0
- package/dependencies/src/cuint-0.2.2/index.js +2 -0
- package/dependencies/src/cuint-0.2.2/lib/uint32.js +451 -0
- package/dependencies/src/cuint-0.2.2/lib/uint64.js +648 -0
- package/dependencies/src/debug-3.1.0/src/browser.js +195 -0
- package/dependencies/src/debug-3.1.0/src/debug.js +225 -0
- package/dependencies/src/drbg.js-1.0.1/hash.js +92 -0
- package/dependencies/src/drbg.js-1.0.1/hmac.js +71 -0
- package/dependencies/src/drbg.js-1.0.1/index.js +4 -0
- package/dependencies/src/drbg.js-1.0.1/lib/hash-info.json +27 -0
- package/dependencies/src/drbg.js-1.0.1/lib/util.js +36 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +12 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.js +35 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +12 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +62 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +11 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +65 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.d.ts +2 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.js +11 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +6 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +65 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -0
- package/dependencies/src/ecurve-1.0.6/lib/curve.js +77 -0
- package/dependencies/src/ecurve-1.0.6/lib/curves.json +65 -0
- package/dependencies/src/ecurve-1.0.6/lib/index.js +10 -0
- package/dependencies/src/ecurve-1.0.6/lib/names.js +21 -0
- package/dependencies/src/ecurve-1.0.6/lib/point.js +244 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/base.js +374 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/edwards.js +432 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/index.js +8 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/mont.js +178 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/short.js +937 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curves.js +206 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/index.js +241 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/key.js +118 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/signature.js +134 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/index.js +118 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/key.js +95 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/signature.js +65 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/precomputed/secp256k1.js +780 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/utils.js +120 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic.js +13 -0
- package/dependencies/src/elliptic-6.5.1/package.json +55 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/base.js +376 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/edwards.js +432 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/index.js +8 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/mont.js +178 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/short.js +937 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curves.js +206 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/index.js +241 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/key.js +118 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/signature.js +166 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/index.js +118 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/key.js +95 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/signature.js +65 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/precomputed/secp256k1.js +780 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/utils.js +119 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic.js +13 -0
- package/dependencies/src/elliptic-6.5.3/package.json +55 -0
- package/dependencies/src/ethereum-common-0.2.1/bootstrapNodes.json +92 -0
- package/dependencies/src/ethereum-common-0.2.1/genesisState.json +8895 -0
- package/dependencies/src/ethereum-common-0.2.1/index.js +4 -0
- package/dependencies/src/ethereum-common-0.2.1/params.json +245 -0
- package/dependencies/src/ethereumjs-tx-1.3.7/index.js +298 -0
- package/dependencies/src/ethereumjs-util-5.2.0/index.js +714 -0
- package/dependencies/src/ethjs-util-0.1.4/src/index.js +203 -0
- package/dependencies/src/follow-redirects-1.5.10/http.js +1 -0
- package/dependencies/src/follow-redirects-1.5.10/https.js +1 -0
- package/dependencies/src/follow-redirects-1.5.10/index.js +322 -0
- package/dependencies/src/futoin-hkdf-1.3.3/hkdf.d.ts +29 -0
- package/dependencies/src/futoin-hkdf-1.3.3/hkdf.js +174 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/index.js +39 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/groestl.js +1248 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/helper.js +253 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/op.js +462 -0
- package/dependencies/src/groestlcoinjs-message-2.1.0/index.js +245 -0
- package/dependencies/src/hash-base-3.0.4/index.js +95 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/common.js +92 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/hmac.js +47 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/ripemd.js +146 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/1.js +74 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/224.js +30 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/256.js +105 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/384.js +35 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/512.js +330 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/common.js +49 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha.js +7 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/utils.js +278 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash.js +15 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.d.ts +15 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +101 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.d.ts +3 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +37 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.d.ts +1 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js +34 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js.map +1 -0
- package/dependencies/src/hmac-drbg-1.0.1/lib/hmac-drbg.js +113 -0
- package/dependencies/src/idna-uts46-hx-3.4.0/idna-map.js +23865 -0
- package/dependencies/src/idna-uts46-hx-3.4.0/index.d.ts +6 -0
- package/dependencies/src/idna-uts46-hx-3.4.0/uts46.js +170 -0
- package/dependencies/src/ieee754-1.1.13/index.js +84 -0
- package/dependencies/src/inherits-2.0.4/inherits.js +9 -0
- package/dependencies/src/inherits-2.0.4/inherits_browser.js +27 -0
- package/dependencies/src/is-buffer-2.0.3/index.js +11 -0
- package/dependencies/src/is-hex-prefixed-1.0.0/src/index.js +13 -0
- package/dependencies/src/js-cuint-0.2.2/index.js +2 -0
- package/dependencies/src/js-cuint-0.2.2/lib/uint32.js +451 -0
- package/dependencies/src/js-cuint-0.2.2/lib/uint64.js +648 -0
- package/dependencies/src/keccak-1.0.2/js.js +2 -0
- package/dependencies/src/keccak-1.0.2/lib/api/index.js +28 -0
- package/dependencies/src/keccak-1.0.2/lib/api/keccak.js +83 -0
- package/dependencies/src/keccak-1.0.2/lib/api/shake.js +74 -0
- package/dependencies/src/keccak-1.0.2/lib/keccak-state.js +187 -0
- package/dependencies/src/keccak-1.0.2/lib/keccak.js +69 -0
- package/dependencies/src/md5.js-1.3.5/index.js +146 -0
- package/dependencies/src/merkle-lib-2.0.10/fastRoot.js +24 -0
- package/dependencies/src/merkle-lib-2.0.10/index.js +34 -0
- package/dependencies/src/minimalistic-assert-1.0.1/index.js +11 -0
- package/dependencies/src/minimalistic-crypto-utils-1.0.1/lib/utils.js +58 -0
- package/dependencies/src/ms-2.1.2/index.js +162 -0
- package/dependencies/src/nan-2.14.0/include_dirs.js +1 -0
- package/dependencies/src/nanoassert-1.1.0/index.js +22 -0
- package/dependencies/src/pako-2.0.3/index.js +18 -0
- package/dependencies/src/pako-2.0.3/lib/deflate.js +373 -0
- package/dependencies/src/pako-2.0.3/lib/inflate.js +402 -0
- package/dependencies/src/pako-2.0.3/lib/utils/common.js +48 -0
- package/dependencies/src/pako-2.0.3/lib/utils/strings.js +187 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/adler32.js +50 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/constants.js +66 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/crc32.js +58 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/deflate.js +1849 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/gzheader.js +58 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/inffast.js +347 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/inflate.js +1625 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/inftrees.js +462 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/messages.js +32 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/trees.js +1192 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/zstream.js +47 -0
- package/dependencies/src/pbkdf2-3.0.17/bench/index.js +35 -0
- package/dependencies/src/pbkdf2-3.0.17/bench/old.js +47 -0
- package/dependencies/src/pbkdf2-3.0.17/browser.js +2 -0
- package/dependencies/src/pbkdf2-3.0.17/index.js +31 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/async.js +100 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/default-encoding.js +10 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/precondition.js +28 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/sync-browser.js +104 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/sync.js +51 -0
- package/dependencies/src/punycode-2.1.1/punycode.js +429 -0
- package/dependencies/src/pushdata-bitcoin-1.0.1/index.js +77 -0
- package/dependencies/src/randombytes-2.1.0/browser.js +50 -0
- package/dependencies/src/randombytes-2.1.0/index.js +1 -0
- package/dependencies/src/ripemd160-2.0.2/index.js +163 -0
- package/dependencies/src/rlp-2.2.3/index.js +230 -0
- package/dependencies/src/safe-buffer-5.2.0/index.js +64 -0
- package/dependencies/src/secp256k1-3.7.1/elliptic.js +2 -0
- package/dependencies/src/secp256k1-3.7.1/lib/assert.js +44 -0
- package/dependencies/src/secp256k1-3.7.1/lib/der.js +193 -0
- package/dependencies/src/secp256k1-3.7.1/lib/elliptic/index.js +263 -0
- package/dependencies/src/secp256k1-3.7.1/lib/index.js +245 -0
- package/dependencies/src/secp256k1-3.7.1/lib/messages.json +37 -0
- package/dependencies/src/secp256k1-4.0.2/elliptic.js +1 -0
- package/dependencies/src/secp256k1-4.0.2/lib/elliptic.js +402 -0
- package/dependencies/src/secp256k1-4.0.2/lib/index.js +336 -0
- package/dependencies/src/sha.js-2.4.11/hash.js +81 -0
- package/dependencies/src/sha.js-2.4.11/index.js +16 -0
- package/dependencies/src/sha.js-2.4.11/sha.js +94 -0
- package/dependencies/src/sha.js-2.4.11/sha1.js +99 -0
- package/dependencies/src/sha.js-2.4.11/sha224.js +53 -0
- package/dependencies/src/sha.js-2.4.11/sha256.js +135 -0
- package/dependencies/src/sha.js-2.4.11/sha384.js +57 -0
- package/dependencies/src/sha.js-2.4.11/sha512.js +260 -0
- package/dependencies/src/strip-hex-prefix-1.0.0/src/index.js +14 -0
- package/dependencies/src/tiny-secp256k1-1.1.3/js.js +276 -0
- package/dependencies/src/tiny-secp256k1-1.1.3/rfc6979.js +62 -0
- package/dependencies/src/tweetnacl-1.0.1/nacl.d.ts +98 -0
- package/dependencies/src/tweetnacl-1.0.1/nacl.js +1164 -0
- package/dependencies/src/tweetnacl-auth-1.0.1/nacl-auth.js +47 -0
- package/dependencies/src/typedarray-to-buffer-4.0.0/index.js +17 -0
- package/dependencies/src/typeforce-1.18.0/errors.js +110 -0
- package/dependencies/src/typeforce-1.18.0/extra.js +91 -0
- package/dependencies/src/typeforce-1.18.0/index.js +260 -0
- package/dependencies/src/typeforce-1.18.0/native.js +21 -0
- package/dependencies/src/unorm-1.6.0/lib/unorm.js +452 -0
- package/dependencies/src/utf8-3.0.0/utf8.js +202 -0
- package/dependencies/src/validate.js-0.13.1/validate.d.ts +55 -0
- package/dependencies/src/validate.js-0.13.1/validate.js +1253 -0
- package/dependencies/src/varuint-bitcoin-1.1.2/index.d.ts +13 -0
- package/dependencies/src/varuint-bitcoin-1.1.2/index.js +90 -0
- package/dependencies/src/wif-2.0.6/index.js +63 -0
- package/dependencies/src/xxhashjs-0.2.2/lib/index.js +4 -0
- package/dependencies/src/xxhashjs-0.2.2/lib/xxhash.js +389 -0
- package/dependencies/src/xxhashjs-0.2.2/lib/xxhash64.js +444 -0
- package/errors/coinlib-error.d.ts +30 -0
- package/errors/coinlib-error.js +62 -0
- package/errors/coinlib-error.js.map +1 -0
- package/errors/index.d.ts +156 -0
- package/errors/index.js +281 -0
- package/errors/index.js.map +1 -0
- package/errors/network.d.ts +0 -0
- package/errors/network.js +2 -0
- package/errors/network.js.map +1 -0
- package/index.d.ts +33 -0
- package/index.js +58 -0
- package/index.js.map +1 -0
- package/interfaces/IAirGapAddress.d.ts +10 -0
- package/interfaces/IAirGapAddress.js +3 -0
- package/interfaces/IAirGapAddress.js.map +1 -0
- package/interfaces/IAirGapSignedTransaction.d.ts +1 -0
- package/interfaces/IAirGapSignedTransaction.js +3 -0
- package/interfaces/IAirGapSignedTransaction.js.map +1 -0
- package/interfaces/IAirGapTransaction.d.ts +53 -0
- package/interfaces/IAirGapTransaction.js +22 -0
- package/interfaces/IAirGapTransaction.js.map +1 -0
- package/interfaces/IAirGapWallet.d.ts +6 -0
- package/interfaces/IAirGapWallet.js +3 -0
- package/interfaces/IAirGapWallet.js.map +1 -0
- package/interfaces/JSONConvertible.d.ts +3 -0
- package/interfaces/JSONConvertible.js +3 -0
- package/interfaces/JSONConvertible.js.map +1 -0
- package/interfaces/RPCConvertible.d.ts +3 -0
- package/interfaces/RPCConvertible.js +3 -0
- package/interfaces/RPCConvertible.js.map +1 -0
- package/networks.d.ts +19 -0
- package/networks.js +1341 -0
- package/networks.js.map +1 -0
- package/package.json +1 -5
- package/protocols/BlockExplorerProtocol.d.ts +6 -0
- package/protocols/BlockExplorerProtocol.js +60 -0
- package/protocols/BlockExplorerProtocol.js.map +1 -0
- package/protocols/CryptoClient.d.ts +15 -0
- package/protocols/CryptoClient.js +84 -0
- package/protocols/CryptoClient.js.map +1 -0
- package/protocols/Ed25519CryptoClient.d.ts +8 -0
- package/protocols/Ed25519CryptoClient.js +107 -0
- package/protocols/Ed25519CryptoClient.js.map +1 -0
- package/protocols/HasConfigurableContract.d.ts +4 -0
- package/protocols/HasConfigurableContract.js +3 -0
- package/protocols/HasConfigurableContract.js.map +1 -0
- package/protocols/ICoinBaseProtocol.d.ts +107 -0
- package/protocols/ICoinBaseProtocol.js +3 -0
- package/protocols/ICoinBaseProtocol.js.map +1 -0
- package/protocols/ICoinDelegateProtocol.d.ts +40 -0
- package/protocols/ICoinDelegateProtocol.js +3 -0
- package/protocols/ICoinDelegateProtocol.js.map +1 -0
- package/protocols/ICoinOfflineProtocol.d.ts +24 -0
- package/protocols/ICoinOfflineProtocol.js +3 -0
- package/protocols/ICoinOfflineProtocol.js.map +1 -0
- package/protocols/ICoinOnlineProtocol.d.ts +46 -0
- package/protocols/ICoinOnlineProtocol.js +3 -0
- package/protocols/ICoinOnlineProtocol.js.map +1 -0
- package/protocols/ICoinProtocol.d.ts +9 -0
- package/protocols/ICoinProtocol.js +3 -0
- package/protocols/ICoinProtocol.js.map +1 -0
- package/protocols/ICoinSubProtocol.d.ts +22 -0
- package/protocols/ICoinSubProtocol.js +9 -0
- package/protocols/ICoinSubProtocol.js.map +1 -0
- package/protocols/NonExtendedProtocol.d.ts +17 -0
- package/protocols/NonExtendedProtocol.js +49 -0
- package/protocols/NonExtendedProtocol.js.map +1 -0
- package/protocols/Secp256k1CryptoClient.d.ts +8 -0
- package/protocols/Secp256k1CryptoClient.js +79 -0
- package/protocols/Secp256k1CryptoClient.js.map +1 -0
- package/protocols/Sr25519CryptoClient.d.ts +8 -0
- package/protocols/Sr25519CryptoClient.js +82 -0
- package/protocols/Sr25519CryptoClient.js.map +1 -0
- package/types/signed-transaction.d.ts +4 -0
- package/types/signed-transaction.js +3 -0
- package/types/signed-transaction.js.map +1 -0
- package/types/unsigned-transaction.d.ts +5 -0
- package/types/unsigned-transaction.js +3 -0
- package/types/unsigned-transaction.js.map +1 -0
- package/utils/AES.d.ts +10 -0
- package/utils/AES.js +165 -0
- package/utils/AES.js.map +1 -0
- package/utils/ErrorWithData.d.ts +4 -0
- package/utils/ErrorWithData.js +29 -0
- package/utils/ErrorWithData.js.map +1 -0
- package/utils/Network.d.ts +2 -0
- package/utils/Network.js +8 -0
- package/utils/Network.js.map +1 -0
- package/utils/ProtocolBlockExplorer.d.ts +6 -0
- package/utils/ProtocolBlockExplorer.js +11 -0
- package/utils/ProtocolBlockExplorer.js.map +1 -0
- package/utils/ProtocolNetwork.d.ts +15 -0
- package/utils/ProtocolNetwork.js +35 -0
- package/utils/ProtocolNetwork.js.map +1 -0
- package/utils/ProtocolOptions.d.ts +5 -0
- package/utils/ProtocolOptions.js +3 -0
- package/utils/ProtocolOptions.js.map +1 -0
- package/utils/ProtocolSymbols.d.ts +45 -0
- package/utils/ProtocolSymbols.js +59 -0
- package/utils/ProtocolSymbols.js.map +1 -0
- package/utils/array.d.ts +4 -0
- package/utils/array.js +36 -0
- package/utils/array.js.map +1 -0
- package/utils/assert.d.ts +2 -0
- package/utils/assert.js +20 -0
- package/utils/assert.js.map +1 -0
- package/utils/base64Check.d.ts +7 -0
- package/utils/base64Check.js +39 -0
- package/utils/base64Check.js.map +1 -0
- package/utils/blake2b.d.ts +7 -0
- package/utils/blake2b.js +23 -0
- package/utils/blake2b.js.map +1 -0
- package/utils/buffer.d.ts +2 -0
- package/utils/buffer.js +8 -0
- package/utils/buffer.js.map +1 -0
- package/utils/cache.d.ts +15 -0
- package/utils/cache.js +97 -0
- package/utils/cache.js.map +1 -0
- package/utils/error.d.ts +1 -0
- package/utils/error.js +8 -0
- package/utils/error.js.map +1 -0
- package/utils/hex.d.ts +14 -0
- package/utils/hex.js +112 -0
- package/utils/hex.js.map +1 -0
- package/utils/interfaces.d.ts +3 -0
- package/utils/interfaces.js +18 -0
- package/utils/interfaces.js.map +1 -0
- package/utils/object.d.ts +1 -0
- package/utils/object.js +23 -0
- package/utils/object.js.map +1 -0
- package/utils/padStart.d.ts +1 -0
- package/utils/padStart.js +20 -0
- package/utils/padStart.js.map +1 -0
- package/utils/remote-data/HttpRemoteData.d.ts +8 -0
- package/utils/remote-data/HttpRemoteData.js +117 -0
- package/utils/remote-data/HttpRemoteData.js.map +1 -0
- package/utils/remote-data/IpfsRemoteData.d.ts +8 -0
- package/utils/remote-data/IpfsRemoteData.js +142 -0
- package/utils/remote-data/IpfsRemoteData.js.map +1 -0
- package/utils/remote-data/RemoteData.d.ts +11 -0
- package/utils/remote-data/RemoteData.js +11 -0
- package/utils/remote-data/RemoteData.js.map +1 -0
- package/utils/remote-data/RemoteDataFactory.d.ts +11 -0
- package/utils/remote-data/RemoteDataFactory.js +29 -0
- package/utils/remote-data/RemoteDataFactory.js.map +1 -0
- package/utils/remote-data/Sha256RemoteData.d.ts +11 -0
- package/utils/remote-data/Sha256RemoteData.js +139 -0
- package/utils/remote-data/Sha256RemoteData.js.map +1 -0
- package/utils/string.d.ts +7 -0
- package/utils/string.js +50 -0
- package/utils/string.js.map +1 -0
- package/utils/type.d.ts +1 -0
- package/utils/type.js +16 -0
- package/utils/type.js.map +1 -0
- package/utils/xxhash.d.ts +5 -0
- package/utils/xxhash.js +18 -0
- package/utils/xxhash.js.map +1 -0
- package/wallet/AirGapCoinWallet.d.ts +19 -0
- package/wallet/AirGapCoinWallet.js +199 -0
- package/wallet/AirGapCoinWallet.js.map +1 -0
- package/wallet/AirGapMarketWallet.d.ts +40 -0
- package/wallet/AirGapMarketWallet.js +221 -0
- package/wallet/AirGapMarketWallet.js.map +1 -0
- package/wallet/AirGapNFTWallet.d.ts +15 -0
- package/wallet/AirGapNFTWallet.js +179 -0
- package/wallet/AirGapNFTWallet.js.map +1 -0
- package/wallet/AirGapWallet.d.ts +35 -0
- package/wallet/AirGapWallet.js +142 -0
- package/wallet/AirGapWallet.js.map +1 -0
|
@@ -0,0 +1,1253 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* validate.js 0.13.1
|
|
3
|
+
*
|
|
4
|
+
* (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
|
|
5
|
+
* Validate.js may be freely distributed under the MIT license.
|
|
6
|
+
* For all details and documentation:
|
|
7
|
+
* http://validatejs.org/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(function(exports, module, define) {
|
|
11
|
+
"use strict";
|
|
12
|
+
|
|
13
|
+
// The main function that calls the validators specified by the constraints.
|
|
14
|
+
// The options are the following:
|
|
15
|
+
// - format (string) - An option that controls how the returned value is formatted
|
|
16
|
+
// * flat - Returns a flat array of just the error messages
|
|
17
|
+
// * grouped - Returns the messages grouped by attribute (default)
|
|
18
|
+
// * detailed - Returns an array of the raw validation data
|
|
19
|
+
// - fullMessages (boolean) - If `true` (default) the attribute name is prepended to the error.
|
|
20
|
+
//
|
|
21
|
+
// Please note that the options are also passed to each validator.
|
|
22
|
+
var validate = function(attributes, constraints, options) {
|
|
23
|
+
options = v.extend({}, v.options, options);
|
|
24
|
+
|
|
25
|
+
var results = v.runValidations(attributes, constraints, options)
|
|
26
|
+
, attr
|
|
27
|
+
, validator;
|
|
28
|
+
|
|
29
|
+
if (results.some(function(r) { return v.isPromise(r.error); })) {
|
|
30
|
+
throw new Error("Use validate.async if you want support for promises");
|
|
31
|
+
}
|
|
32
|
+
return validate.processValidationResults(results, options);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var v = validate;
|
|
36
|
+
|
|
37
|
+
// Copies over attributes from one or more sources to a single destination.
|
|
38
|
+
// Very much similar to underscore's extend.
|
|
39
|
+
// The first argument is the target object and the remaining arguments will be
|
|
40
|
+
// used as sources.
|
|
41
|
+
v.extend = function(obj) {
|
|
42
|
+
[].slice.call(arguments, 1).forEach(function(source) {
|
|
43
|
+
for (var attr in source) {
|
|
44
|
+
obj[attr] = source[attr];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return obj;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
v.extend(validate, {
|
|
51
|
+
// This is the version of the library as a semver.
|
|
52
|
+
// The toString function will allow it to be coerced into a string
|
|
53
|
+
version: {
|
|
54
|
+
major: 0,
|
|
55
|
+
minor: 13,
|
|
56
|
+
patch: 1,
|
|
57
|
+
metadata: null,
|
|
58
|
+
toString: function() {
|
|
59
|
+
var version = v.format("%{major}.%{minor}.%{patch}", v.version);
|
|
60
|
+
if (!v.isEmpty(v.version.metadata)) {
|
|
61
|
+
version += "+" + v.version.metadata;
|
|
62
|
+
}
|
|
63
|
+
return version;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
// Below is the dependencies that are used in validate.js
|
|
68
|
+
|
|
69
|
+
// The constructor of the Promise implementation.
|
|
70
|
+
// If you are using Q.js, RSVP or any other A+ compatible implementation
|
|
71
|
+
// override this attribute to be the constructor of that promise.
|
|
72
|
+
// Since jQuery promises aren't A+ compatible they won't work.
|
|
73
|
+
Promise: typeof Promise !== "undefined" ? Promise : /* istanbul ignore next */ null,
|
|
74
|
+
|
|
75
|
+
EMPTY_STRING_REGEXP: /^\s*$/,
|
|
76
|
+
|
|
77
|
+
// Runs the validators specified by the constraints object.
|
|
78
|
+
// Will return an array of the format:
|
|
79
|
+
// [{attribute: "<attribute name>", error: "<validation result>"}, ...]
|
|
80
|
+
runValidations: function(attributes, constraints, options) {
|
|
81
|
+
var results = []
|
|
82
|
+
, attr
|
|
83
|
+
, validatorName
|
|
84
|
+
, value
|
|
85
|
+
, validators
|
|
86
|
+
, validator
|
|
87
|
+
, validatorOptions
|
|
88
|
+
, error;
|
|
89
|
+
|
|
90
|
+
if (v.isDomElement(attributes) || v.isJqueryElement(attributes)) {
|
|
91
|
+
attributes = v.collectFormValues(attributes);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Loops through each constraints, finds the correct validator and run it.
|
|
95
|
+
for (attr in constraints) {
|
|
96
|
+
value = v.getDeepObjectValue(attributes, attr);
|
|
97
|
+
// This allows the constraints for an attribute to be a function.
|
|
98
|
+
// The function will be called with the value, attribute name, the complete dict of
|
|
99
|
+
// attributes as well as the options and constraints passed in.
|
|
100
|
+
// This is useful when you want to have different
|
|
101
|
+
// validations depending on the attribute value.
|
|
102
|
+
validators = v.result(constraints[attr], value, attributes, attr, options, constraints);
|
|
103
|
+
|
|
104
|
+
for (validatorName in validators) {
|
|
105
|
+
validator = v.validators[validatorName];
|
|
106
|
+
|
|
107
|
+
if (!validator) {
|
|
108
|
+
error = v.format("Unknown validator %{name}", {name: validatorName});
|
|
109
|
+
throw new Error(error);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
validatorOptions = validators[validatorName];
|
|
113
|
+
// This allows the options to be a function. The function will be
|
|
114
|
+
// called with the value, attribute name, the complete dict of
|
|
115
|
+
// attributes as well as the options and constraints passed in.
|
|
116
|
+
// This is useful when you want to have different
|
|
117
|
+
// validations depending on the attribute value.
|
|
118
|
+
validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints);
|
|
119
|
+
if (!validatorOptions) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
results.push({
|
|
123
|
+
attribute: attr,
|
|
124
|
+
value: value,
|
|
125
|
+
validator: validatorName,
|
|
126
|
+
globalOptions: options,
|
|
127
|
+
attributes: attributes,
|
|
128
|
+
options: validatorOptions,
|
|
129
|
+
error: validator.call(validator,
|
|
130
|
+
value,
|
|
131
|
+
validatorOptions,
|
|
132
|
+
attr,
|
|
133
|
+
attributes,
|
|
134
|
+
options)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return results;
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
// Takes the output from runValidations and converts it to the correct
|
|
143
|
+
// output format.
|
|
144
|
+
processValidationResults: function(errors, options) {
|
|
145
|
+
errors = v.pruneEmptyErrors(errors, options);
|
|
146
|
+
errors = v.expandMultipleErrors(errors, options);
|
|
147
|
+
errors = v.convertErrorMessages(errors, options);
|
|
148
|
+
|
|
149
|
+
var format = options.format || "grouped";
|
|
150
|
+
|
|
151
|
+
if (typeof v.formatters[format] === 'function') {
|
|
152
|
+
errors = v.formatters[format](errors);
|
|
153
|
+
} else {
|
|
154
|
+
throw new Error(v.format("Unknown format %{format}", options));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return v.isEmpty(errors) ? undefined : errors;
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// Runs the validations with support for promises.
|
|
161
|
+
// This function will return a promise that is settled when all the
|
|
162
|
+
// validation promises have been completed.
|
|
163
|
+
// It can be called even if no validations returned a promise.
|
|
164
|
+
async: function(attributes, constraints, options) {
|
|
165
|
+
options = v.extend({}, v.async.options, options);
|
|
166
|
+
|
|
167
|
+
var WrapErrors = options.wrapErrors || function(errors) {
|
|
168
|
+
return errors;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// Removes unknown attributes
|
|
172
|
+
if (options.cleanAttributes !== false) {
|
|
173
|
+
attributes = v.cleanAttributes(attributes, constraints);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var results = v.runValidations(attributes, constraints, options);
|
|
177
|
+
|
|
178
|
+
return new v.Promise(function(resolve, reject) {
|
|
179
|
+
v.waitForResults(results).then(function() {
|
|
180
|
+
var errors = v.processValidationResults(results, options);
|
|
181
|
+
if (errors) {
|
|
182
|
+
reject(new WrapErrors(errors, options, attributes, constraints));
|
|
183
|
+
} else {
|
|
184
|
+
resolve(attributes);
|
|
185
|
+
}
|
|
186
|
+
}, function(err) {
|
|
187
|
+
reject(err);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
single: function(value, constraints, options) {
|
|
193
|
+
options = v.extend({}, v.single.options, options, {
|
|
194
|
+
format: "flat",
|
|
195
|
+
fullMessages: false
|
|
196
|
+
});
|
|
197
|
+
return v({single: value}, {single: constraints}, options);
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
// Returns a promise that is resolved when all promises in the results array
|
|
201
|
+
// are settled. The promise returned from this function is always resolved,
|
|
202
|
+
// never rejected.
|
|
203
|
+
// This function modifies the input argument, it replaces the promises
|
|
204
|
+
// with the value returned from the promise.
|
|
205
|
+
waitForResults: function(results) {
|
|
206
|
+
// Create a sequence of all the results starting with a resolved promise.
|
|
207
|
+
return results.reduce(function(memo, result) {
|
|
208
|
+
// If this result isn't a promise skip it in the sequence.
|
|
209
|
+
if (!v.isPromise(result.error)) {
|
|
210
|
+
return memo;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return memo.then(function() {
|
|
214
|
+
return result.error.then(function(error) {
|
|
215
|
+
result.error = error || null;
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}, new v.Promise(function(r) { r(); })); // A resolved promise
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
// If the given argument is a call: function the and: function return the value
|
|
222
|
+
// otherwise just return the value. Additional arguments will be passed as
|
|
223
|
+
// arguments to the function.
|
|
224
|
+
// Example:
|
|
225
|
+
// ```
|
|
226
|
+
// result('foo') // 'foo'
|
|
227
|
+
// result(Math.max, 1, 2) // 2
|
|
228
|
+
// ```
|
|
229
|
+
result: function(value) {
|
|
230
|
+
var args = [].slice.call(arguments, 1);
|
|
231
|
+
if (typeof value === 'function') {
|
|
232
|
+
value = value.apply(null, args);
|
|
233
|
+
}
|
|
234
|
+
return value;
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
// Checks if the value is a number. This function does not consider NaN a
|
|
238
|
+
// number like many other `isNumber` functions do.
|
|
239
|
+
isNumber: function(value) {
|
|
240
|
+
return typeof value === 'number' && !isNaN(value);
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// Returns false if the object is not a function
|
|
244
|
+
isFunction: function(value) {
|
|
245
|
+
return typeof value === 'function';
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
// A simple check to verify that the value is an integer. Uses `isNumber`
|
|
249
|
+
// and a simple modulo check.
|
|
250
|
+
isInteger: function(value) {
|
|
251
|
+
return v.isNumber(value) && value % 1 === 0;
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
// Checks if the value is a boolean
|
|
255
|
+
isBoolean: function(value) {
|
|
256
|
+
return typeof value === 'boolean';
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
// Uses the `Object` function to check if the given argument is an object.
|
|
260
|
+
isObject: function(obj) {
|
|
261
|
+
return obj === Object(obj);
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
// Simply checks if the object is an instance of a date
|
|
265
|
+
isDate: function(obj) {
|
|
266
|
+
return obj instanceof Date;
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
// Returns false if the object is `null` of `undefined`
|
|
270
|
+
isDefined: function(obj) {
|
|
271
|
+
return obj !== null && obj !== undefined;
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
// Checks if the given argument is a promise. Anything with a `then`
|
|
275
|
+
// function is considered a promise.
|
|
276
|
+
isPromise: function(p) {
|
|
277
|
+
return !!p && v.isFunction(p.then);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
isJqueryElement: function(o) {
|
|
281
|
+
return o && v.isString(o.jquery);
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
isDomElement: function(o) {
|
|
285
|
+
if (!o) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (!o.querySelectorAll || !o.querySelector) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (v.isObject(document) && o === document) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// http://stackoverflow.com/a/384380/699304
|
|
298
|
+
/* istanbul ignore else */
|
|
299
|
+
if (typeof HTMLElement === "object") {
|
|
300
|
+
return o instanceof HTMLElement;
|
|
301
|
+
} else {
|
|
302
|
+
return o &&
|
|
303
|
+
typeof o === "object" &&
|
|
304
|
+
o !== null &&
|
|
305
|
+
o.nodeType === 1 &&
|
|
306
|
+
typeof o.nodeName === "string";
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
isEmpty: function(value) {
|
|
311
|
+
var attr;
|
|
312
|
+
|
|
313
|
+
// Null and undefined are empty
|
|
314
|
+
if (!v.isDefined(value)) {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// functions are non empty
|
|
319
|
+
if (v.isFunction(value)) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Whitespace only strings are empty
|
|
324
|
+
if (v.isString(value)) {
|
|
325
|
+
return v.EMPTY_STRING_REGEXP.test(value);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// For arrays we use the length property
|
|
329
|
+
if (v.isArray(value)) {
|
|
330
|
+
return value.length === 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Dates have no attributes but aren't empty
|
|
334
|
+
if (v.isDate(value)) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// If we find at least one property we consider it non empty
|
|
339
|
+
if (v.isObject(value)) {
|
|
340
|
+
for (attr in value) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return false;
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
// Formats the specified strings with the given values like so:
|
|
350
|
+
// ```
|
|
351
|
+
// format("Foo: %{foo}", {foo: "bar"}) // "Foo bar"
|
|
352
|
+
// ```
|
|
353
|
+
// If you want to write %{...} without having it replaced simply
|
|
354
|
+
// prefix it with % like this `Foo: %%{foo}` and it will be returned
|
|
355
|
+
// as `"Foo: %{foo}"`
|
|
356
|
+
format: v.extend(function(str, vals) {
|
|
357
|
+
if (!v.isString(str)) {
|
|
358
|
+
return str;
|
|
359
|
+
}
|
|
360
|
+
return str.replace(v.format.FORMAT_REGEXP, function(m0, m1, m2) {
|
|
361
|
+
if (m1 === '%') {
|
|
362
|
+
return "%{" + m2 + "}";
|
|
363
|
+
} else {
|
|
364
|
+
return String(vals[m2]);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}, {
|
|
368
|
+
// Finds %{key} style patterns in the given string
|
|
369
|
+
FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g
|
|
370
|
+
}),
|
|
371
|
+
|
|
372
|
+
// "Prettifies" the given string.
|
|
373
|
+
// Prettifying means replacing [.\_-] with spaces as well as splitting
|
|
374
|
+
// camel case words.
|
|
375
|
+
prettify: function(str) {
|
|
376
|
+
if (v.isNumber(str)) {
|
|
377
|
+
// If there are more than 2 decimals round it to two
|
|
378
|
+
if ((str * 100) % 1 === 0) {
|
|
379
|
+
return "" + str;
|
|
380
|
+
} else {
|
|
381
|
+
return parseFloat(Math.round(str * 100) / 100).toFixed(2);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (v.isArray(str)) {
|
|
386
|
+
return str.map(function(s) { return v.prettify(s); }).join(", ");
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (v.isObject(str)) {
|
|
390
|
+
if (!v.isDefined(str.toString)) {
|
|
391
|
+
return JSON.stringify(str);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return str.toString();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Ensure the string is actually a string
|
|
398
|
+
str = "" + str;
|
|
399
|
+
|
|
400
|
+
return str
|
|
401
|
+
// Splits keys separated by periods
|
|
402
|
+
.replace(/([^\s])\.([^\s])/g, '$1 $2')
|
|
403
|
+
// Removes backslashes
|
|
404
|
+
.replace(/\\+/g, '')
|
|
405
|
+
// Replaces - and - with space
|
|
406
|
+
.replace(/[_-]/g, ' ')
|
|
407
|
+
// Splits camel cased words
|
|
408
|
+
.replace(/([a-z])([A-Z])/g, function(m0, m1, m2) {
|
|
409
|
+
return "" + m1 + " " + m2.toLowerCase();
|
|
410
|
+
})
|
|
411
|
+
.toLowerCase();
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
stringifyValue: function(value, options) {
|
|
415
|
+
var prettify = options && options.prettify || v.prettify;
|
|
416
|
+
return prettify(value);
|
|
417
|
+
},
|
|
418
|
+
|
|
419
|
+
isString: function(value) {
|
|
420
|
+
return typeof value === 'string';
|
|
421
|
+
},
|
|
422
|
+
|
|
423
|
+
isArray: function(value) {
|
|
424
|
+
return {}.toString.call(value) === '[object Array]';
|
|
425
|
+
},
|
|
426
|
+
|
|
427
|
+
// Checks if the object is a hash, which is equivalent to an object that
|
|
428
|
+
// is neither an array nor a function.
|
|
429
|
+
isHash: function(value) {
|
|
430
|
+
return v.isObject(value) && !v.isArray(value) && !v.isFunction(value);
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
contains: function(obj, value) {
|
|
434
|
+
if (!v.isDefined(obj)) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
if (v.isArray(obj)) {
|
|
438
|
+
return obj.indexOf(value) !== -1;
|
|
439
|
+
}
|
|
440
|
+
return value in obj;
|
|
441
|
+
},
|
|
442
|
+
|
|
443
|
+
unique: function(array) {
|
|
444
|
+
if (!v.isArray(array)) {
|
|
445
|
+
return array;
|
|
446
|
+
}
|
|
447
|
+
return array.filter(function(el, index, array) {
|
|
448
|
+
return array.indexOf(el) == index;
|
|
449
|
+
});
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
forEachKeyInKeypath: function(object, keypath, callback) {
|
|
453
|
+
if (!v.isString(keypath)) {
|
|
454
|
+
return undefined;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
var key = ""
|
|
458
|
+
, i
|
|
459
|
+
, escape = false;
|
|
460
|
+
|
|
461
|
+
for (i = 0; i < keypath.length; ++i) {
|
|
462
|
+
switch (keypath[i]) {
|
|
463
|
+
case '.':
|
|
464
|
+
if (escape) {
|
|
465
|
+
escape = false;
|
|
466
|
+
key += '.';
|
|
467
|
+
} else {
|
|
468
|
+
object = callback(object, key, false);
|
|
469
|
+
key = "";
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
|
|
473
|
+
case '\\':
|
|
474
|
+
if (escape) {
|
|
475
|
+
escape = false;
|
|
476
|
+
key += '\\';
|
|
477
|
+
} else {
|
|
478
|
+
escape = true;
|
|
479
|
+
}
|
|
480
|
+
break;
|
|
481
|
+
|
|
482
|
+
default:
|
|
483
|
+
escape = false;
|
|
484
|
+
key += keypath[i];
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return callback(object, key, true);
|
|
490
|
+
},
|
|
491
|
+
|
|
492
|
+
getDeepObjectValue: function(obj, keypath) {
|
|
493
|
+
if (!v.isObject(obj)) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return v.forEachKeyInKeypath(obj, keypath, function(obj, key) {
|
|
498
|
+
if (v.isObject(obj)) {
|
|
499
|
+
return obj[key];
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
},
|
|
503
|
+
|
|
504
|
+
// This returns an object with all the values of the form.
|
|
505
|
+
// It uses the input name as key and the value as value
|
|
506
|
+
// So for example this:
|
|
507
|
+
// <input type="text" name="email" value="foo@bar.com" />
|
|
508
|
+
// would return:
|
|
509
|
+
// {email: "foo@bar.com"}
|
|
510
|
+
collectFormValues: function(form, options) {
|
|
511
|
+
var values = {}
|
|
512
|
+
, i
|
|
513
|
+
, j
|
|
514
|
+
, input
|
|
515
|
+
, inputs
|
|
516
|
+
, option
|
|
517
|
+
, value;
|
|
518
|
+
|
|
519
|
+
if (v.isJqueryElement(form)) {
|
|
520
|
+
form = form[0];
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (!form) {
|
|
524
|
+
return values;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
options = options || {};
|
|
528
|
+
|
|
529
|
+
inputs = form.querySelectorAll("input[name], textarea[name]");
|
|
530
|
+
for (i = 0; i < inputs.length; ++i) {
|
|
531
|
+
input = inputs.item(i);
|
|
532
|
+
|
|
533
|
+
if (v.isDefined(input.getAttribute("data-ignored"))) {
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
var name = input.name.replace(/\./g, "\\\\.");
|
|
538
|
+
value = v.sanitizeFormValue(input.value, options);
|
|
539
|
+
if (input.type === "number") {
|
|
540
|
+
value = value ? +value : null;
|
|
541
|
+
} else if (input.type === "checkbox") {
|
|
542
|
+
if (input.attributes.value) {
|
|
543
|
+
if (!input.checked) {
|
|
544
|
+
value = values[name] || null;
|
|
545
|
+
}
|
|
546
|
+
} else {
|
|
547
|
+
value = input.checked;
|
|
548
|
+
}
|
|
549
|
+
} else if (input.type === "radio") {
|
|
550
|
+
if (!input.checked) {
|
|
551
|
+
value = values[name] || null;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
values[name] = value;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
inputs = form.querySelectorAll("select[name]");
|
|
558
|
+
for (i = 0; i < inputs.length; ++i) {
|
|
559
|
+
input = inputs.item(i);
|
|
560
|
+
if (v.isDefined(input.getAttribute("data-ignored"))) {
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (input.multiple) {
|
|
565
|
+
value = [];
|
|
566
|
+
for (j in input.options) {
|
|
567
|
+
option = input.options[j];
|
|
568
|
+
if (option && option.selected) {
|
|
569
|
+
value.push(v.sanitizeFormValue(option.value, options));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
} else {
|
|
573
|
+
var _val = typeof input.options[input.selectedIndex] !== 'undefined' ? input.options[input.selectedIndex].value : /* istanbul ignore next */ '';
|
|
574
|
+
value = v.sanitizeFormValue(_val, options);
|
|
575
|
+
}
|
|
576
|
+
values[input.name] = value;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return values;
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
sanitizeFormValue: function(value, options) {
|
|
583
|
+
if (options.trim && v.isString(value)) {
|
|
584
|
+
value = value.trim();
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (options.nullify !== false && value === "") {
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
return value;
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
capitalize: function(str) {
|
|
594
|
+
if (!v.isString(str)) {
|
|
595
|
+
return str;
|
|
596
|
+
}
|
|
597
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
598
|
+
},
|
|
599
|
+
|
|
600
|
+
// Remove all errors who's error attribute is empty (null or undefined)
|
|
601
|
+
pruneEmptyErrors: function(errors) {
|
|
602
|
+
return errors.filter(function(error) {
|
|
603
|
+
return !v.isEmpty(error.error);
|
|
604
|
+
});
|
|
605
|
+
},
|
|
606
|
+
|
|
607
|
+
// In
|
|
608
|
+
// [{error: ["err1", "err2"], ...}]
|
|
609
|
+
// Out
|
|
610
|
+
// [{error: "err1", ...}, {error: "err2", ...}]
|
|
611
|
+
//
|
|
612
|
+
// All attributes in an error with multiple messages are duplicated
|
|
613
|
+
// when expanding the errors.
|
|
614
|
+
expandMultipleErrors: function(errors) {
|
|
615
|
+
var ret = [];
|
|
616
|
+
errors.forEach(function(error) {
|
|
617
|
+
// Removes errors without a message
|
|
618
|
+
if (v.isArray(error.error)) {
|
|
619
|
+
error.error.forEach(function(msg) {
|
|
620
|
+
ret.push(v.extend({}, error, {error: msg}));
|
|
621
|
+
});
|
|
622
|
+
} else {
|
|
623
|
+
ret.push(error);
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
return ret;
|
|
627
|
+
},
|
|
628
|
+
|
|
629
|
+
// Converts the error mesages by prepending the attribute name unless the
|
|
630
|
+
// message is prefixed by ^
|
|
631
|
+
convertErrorMessages: function(errors, options) {
|
|
632
|
+
options = options || {};
|
|
633
|
+
|
|
634
|
+
var ret = []
|
|
635
|
+
, prettify = options.prettify || v.prettify;
|
|
636
|
+
errors.forEach(function(errorInfo) {
|
|
637
|
+
var error = v.result(errorInfo.error,
|
|
638
|
+
errorInfo.value,
|
|
639
|
+
errorInfo.attribute,
|
|
640
|
+
errorInfo.options,
|
|
641
|
+
errorInfo.attributes,
|
|
642
|
+
errorInfo.globalOptions);
|
|
643
|
+
|
|
644
|
+
if (!v.isString(error)) {
|
|
645
|
+
ret.push(errorInfo);
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
if (error[0] === '^') {
|
|
650
|
+
error = error.slice(1);
|
|
651
|
+
} else if (options.fullMessages !== false) {
|
|
652
|
+
error = v.capitalize(prettify(errorInfo.attribute)) + " " + error;
|
|
653
|
+
}
|
|
654
|
+
error = error.replace(/\\\^/g, "^");
|
|
655
|
+
error = v.format(error, {
|
|
656
|
+
value: v.stringifyValue(errorInfo.value, options)
|
|
657
|
+
});
|
|
658
|
+
ret.push(v.extend({}, errorInfo, {error: error}));
|
|
659
|
+
});
|
|
660
|
+
return ret;
|
|
661
|
+
},
|
|
662
|
+
|
|
663
|
+
// In:
|
|
664
|
+
// [{attribute: "<attributeName>", ...}]
|
|
665
|
+
// Out:
|
|
666
|
+
// {"<attributeName>": [{attribute: "<attributeName>", ...}]}
|
|
667
|
+
groupErrorsByAttribute: function(errors) {
|
|
668
|
+
var ret = {};
|
|
669
|
+
errors.forEach(function(error) {
|
|
670
|
+
var list = ret[error.attribute];
|
|
671
|
+
if (list) {
|
|
672
|
+
list.push(error);
|
|
673
|
+
} else {
|
|
674
|
+
ret[error.attribute] = [error];
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
return ret;
|
|
678
|
+
},
|
|
679
|
+
|
|
680
|
+
// In:
|
|
681
|
+
// [{error: "<message 1>", ...}, {error: "<message 2>", ...}]
|
|
682
|
+
// Out:
|
|
683
|
+
// ["<message 1>", "<message 2>"]
|
|
684
|
+
flattenErrorsToArray: function(errors) {
|
|
685
|
+
return errors
|
|
686
|
+
.map(function(error) { return error.error; })
|
|
687
|
+
.filter(function(value, index, self) {
|
|
688
|
+
return self.indexOf(value) === index;
|
|
689
|
+
});
|
|
690
|
+
},
|
|
691
|
+
|
|
692
|
+
cleanAttributes: function(attributes, whitelist) {
|
|
693
|
+
function whitelistCreator(obj, key, last) {
|
|
694
|
+
if (v.isObject(obj[key])) {
|
|
695
|
+
return obj[key];
|
|
696
|
+
}
|
|
697
|
+
return (obj[key] = last ? true : {});
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function buildObjectWhitelist(whitelist) {
|
|
701
|
+
var ow = {}
|
|
702
|
+
, lastObject
|
|
703
|
+
, attr;
|
|
704
|
+
for (attr in whitelist) {
|
|
705
|
+
if (!whitelist[attr]) {
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
v.forEachKeyInKeypath(ow, attr, whitelistCreator);
|
|
709
|
+
}
|
|
710
|
+
return ow;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function cleanRecursive(attributes, whitelist) {
|
|
714
|
+
if (!v.isObject(attributes)) {
|
|
715
|
+
return attributes;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
var ret = v.extend({}, attributes)
|
|
719
|
+
, w
|
|
720
|
+
, attribute;
|
|
721
|
+
|
|
722
|
+
for (attribute in attributes) {
|
|
723
|
+
w = whitelist[attribute];
|
|
724
|
+
|
|
725
|
+
if (v.isObject(w)) {
|
|
726
|
+
ret[attribute] = cleanRecursive(ret[attribute], w);
|
|
727
|
+
} else if (!w) {
|
|
728
|
+
delete ret[attribute];
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return ret;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
if (!v.isObject(whitelist) || !v.isObject(attributes)) {
|
|
735
|
+
return {};
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
whitelist = buildObjectWhitelist(whitelist);
|
|
739
|
+
return cleanRecursive(attributes, whitelist);
|
|
740
|
+
},
|
|
741
|
+
|
|
742
|
+
exposeModule: function(validate, root, exports, module, define) {
|
|
743
|
+
if (exports) {
|
|
744
|
+
if (module && module.exports) {
|
|
745
|
+
exports = module.exports = validate;
|
|
746
|
+
}
|
|
747
|
+
exports.validate = validate;
|
|
748
|
+
} else {
|
|
749
|
+
root.validate = validate;
|
|
750
|
+
if (validate.isFunction(define) && define.amd) {
|
|
751
|
+
define([], function () { return validate; });
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
|
|
756
|
+
warn: function(msg) {
|
|
757
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
758
|
+
console.warn("[validate.js] " + msg);
|
|
759
|
+
}
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
error: function(msg) {
|
|
763
|
+
if (typeof console !== "undefined" && console.error) {
|
|
764
|
+
console.error("[validate.js] " + msg);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
validate.validators = {
|
|
770
|
+
// Presence validates that the value isn't empty
|
|
771
|
+
presence: function(value, options) {
|
|
772
|
+
options = v.extend({}, this.options, options);
|
|
773
|
+
if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) {
|
|
774
|
+
return options.message || this.message || "can't be blank";
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
length: function(value, options, attribute) {
|
|
778
|
+
// Empty values are allowed
|
|
779
|
+
if (!v.isDefined(value)) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
options = v.extend({}, this.options, options);
|
|
784
|
+
|
|
785
|
+
var is = options.is
|
|
786
|
+
, maximum = options.maximum
|
|
787
|
+
, minimum = options.minimum
|
|
788
|
+
, tokenizer = options.tokenizer || function(val) { return val; }
|
|
789
|
+
, err
|
|
790
|
+
, errors = [];
|
|
791
|
+
|
|
792
|
+
value = tokenizer(value);
|
|
793
|
+
var length = value.length;
|
|
794
|
+
if(!v.isNumber(length)) {
|
|
795
|
+
return options.message || this.notValid || "has an incorrect length";
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// Is checks
|
|
799
|
+
if (v.isNumber(is) && length !== is) {
|
|
800
|
+
err = options.wrongLength ||
|
|
801
|
+
this.wrongLength ||
|
|
802
|
+
"is the wrong length (should be %{count} characters)";
|
|
803
|
+
errors.push(v.format(err, {count: is}));
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
if (v.isNumber(minimum) && length < minimum) {
|
|
807
|
+
err = options.tooShort ||
|
|
808
|
+
this.tooShort ||
|
|
809
|
+
"is too short (minimum is %{count} characters)";
|
|
810
|
+
errors.push(v.format(err, {count: minimum}));
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
if (v.isNumber(maximum) && length > maximum) {
|
|
814
|
+
err = options.tooLong ||
|
|
815
|
+
this.tooLong ||
|
|
816
|
+
"is too long (maximum is %{count} characters)";
|
|
817
|
+
errors.push(v.format(err, {count: maximum}));
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
if (errors.length > 0) {
|
|
821
|
+
return options.message || errors;
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
numericality: function(value, options, attribute, attributes, globalOptions) {
|
|
825
|
+
// Empty values are fine
|
|
826
|
+
if (!v.isDefined(value)) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
options = v.extend({}, this.options, options);
|
|
831
|
+
|
|
832
|
+
var errors = []
|
|
833
|
+
, name
|
|
834
|
+
, count
|
|
835
|
+
, checks = {
|
|
836
|
+
greaterThan: function(v, c) { return v > c; },
|
|
837
|
+
greaterThanOrEqualTo: function(v, c) { return v >= c; },
|
|
838
|
+
equalTo: function(v, c) { return v === c; },
|
|
839
|
+
lessThan: function(v, c) { return v < c; },
|
|
840
|
+
lessThanOrEqualTo: function(v, c) { return v <= c; },
|
|
841
|
+
divisibleBy: function(v, c) { return v % c === 0; }
|
|
842
|
+
}
|
|
843
|
+
, prettify = options.prettify ||
|
|
844
|
+
(globalOptions && globalOptions.prettify) ||
|
|
845
|
+
v.prettify;
|
|
846
|
+
|
|
847
|
+
// Strict will check that it is a valid looking number
|
|
848
|
+
if (v.isString(value) && options.strict) {
|
|
849
|
+
var pattern = "^-?(0|[1-9]\\d*)";
|
|
850
|
+
if (!options.onlyInteger) {
|
|
851
|
+
pattern += "(\\.\\d+)?";
|
|
852
|
+
}
|
|
853
|
+
pattern += "$";
|
|
854
|
+
|
|
855
|
+
if (!(new RegExp(pattern).test(value))) {
|
|
856
|
+
return options.message ||
|
|
857
|
+
options.notValid ||
|
|
858
|
+
this.notValid ||
|
|
859
|
+
this.message ||
|
|
860
|
+
"must be a valid number";
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
// Coerce the value to a number unless we're being strict.
|
|
865
|
+
if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) {
|
|
866
|
+
value = +value;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// If it's not a number we shouldn't continue since it will compare it.
|
|
870
|
+
if (!v.isNumber(value)) {
|
|
871
|
+
return options.message ||
|
|
872
|
+
options.notValid ||
|
|
873
|
+
this.notValid ||
|
|
874
|
+
this.message ||
|
|
875
|
+
"is not a number";
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// Same logic as above, sort of. Don't bother with comparisons if this
|
|
879
|
+
// doesn't pass.
|
|
880
|
+
if (options.onlyInteger && !v.isInteger(value)) {
|
|
881
|
+
return options.message ||
|
|
882
|
+
options.notInteger ||
|
|
883
|
+
this.notInteger ||
|
|
884
|
+
this.message ||
|
|
885
|
+
"must be an integer";
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
for (name in checks) {
|
|
889
|
+
count = options[name];
|
|
890
|
+
if (v.isNumber(count) && !checks[name](value, count)) {
|
|
891
|
+
// This picks the default message if specified
|
|
892
|
+
// For example the greaterThan check uses the message from
|
|
893
|
+
// this.notGreaterThan so we capitalize the name and prepend "not"
|
|
894
|
+
var key = "not" + v.capitalize(name);
|
|
895
|
+
var msg = options[key] ||
|
|
896
|
+
this[key] ||
|
|
897
|
+
this.message ||
|
|
898
|
+
"must be %{type} %{count}";
|
|
899
|
+
|
|
900
|
+
errors.push(v.format(msg, {
|
|
901
|
+
count: count,
|
|
902
|
+
type: prettify(name)
|
|
903
|
+
}));
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
if (options.odd && value % 2 !== 1) {
|
|
908
|
+
errors.push(options.notOdd ||
|
|
909
|
+
this.notOdd ||
|
|
910
|
+
this.message ||
|
|
911
|
+
"must be odd");
|
|
912
|
+
}
|
|
913
|
+
if (options.even && value % 2 !== 0) {
|
|
914
|
+
errors.push(options.notEven ||
|
|
915
|
+
this.notEven ||
|
|
916
|
+
this.message ||
|
|
917
|
+
"must be even");
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (errors.length) {
|
|
921
|
+
return options.message || errors;
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
datetime: v.extend(function(value, options) {
|
|
925
|
+
if (!v.isFunction(this.parse) || !v.isFunction(this.format)) {
|
|
926
|
+
throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// Empty values are fine
|
|
930
|
+
if (!v.isDefined(value)) {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
options = v.extend({}, this.options, options);
|
|
935
|
+
|
|
936
|
+
var err
|
|
937
|
+
, errors = []
|
|
938
|
+
, earliest = options.earliest ? this.parse(options.earliest, options) : NaN
|
|
939
|
+
, latest = options.latest ? this.parse(options.latest, options) : NaN;
|
|
940
|
+
|
|
941
|
+
value = this.parse(value, options);
|
|
942
|
+
|
|
943
|
+
// 86400000 is the number of milliseconds in a day, this is used to remove
|
|
944
|
+
// the time from the date
|
|
945
|
+
if (isNaN(value) || options.dateOnly && value % 86400000 !== 0) {
|
|
946
|
+
err = options.notValid ||
|
|
947
|
+
options.message ||
|
|
948
|
+
this.notValid ||
|
|
949
|
+
"must be a valid date";
|
|
950
|
+
return v.format(err, {value: arguments[0]});
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
if (!isNaN(earliest) && value < earliest) {
|
|
954
|
+
err = options.tooEarly ||
|
|
955
|
+
options.message ||
|
|
956
|
+
this.tooEarly ||
|
|
957
|
+
"must be no earlier than %{date}";
|
|
958
|
+
err = v.format(err, {
|
|
959
|
+
value: this.format(value, options),
|
|
960
|
+
date: this.format(earliest, options)
|
|
961
|
+
});
|
|
962
|
+
errors.push(err);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
if (!isNaN(latest) && value > latest) {
|
|
966
|
+
err = options.tooLate ||
|
|
967
|
+
options.message ||
|
|
968
|
+
this.tooLate ||
|
|
969
|
+
"must be no later than %{date}";
|
|
970
|
+
err = v.format(err, {
|
|
971
|
+
date: this.format(latest, options),
|
|
972
|
+
value: this.format(value, options)
|
|
973
|
+
});
|
|
974
|
+
errors.push(err);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
if (errors.length) {
|
|
978
|
+
return v.unique(errors);
|
|
979
|
+
}
|
|
980
|
+
}, {
|
|
981
|
+
parse: null,
|
|
982
|
+
format: null
|
|
983
|
+
}),
|
|
984
|
+
date: function(value, options) {
|
|
985
|
+
options = v.extend({}, options, {dateOnly: true});
|
|
986
|
+
return v.validators.datetime.call(v.validators.datetime, value, options);
|
|
987
|
+
},
|
|
988
|
+
format: function(value, options) {
|
|
989
|
+
if (v.isString(options) || (options instanceof RegExp)) {
|
|
990
|
+
options = {pattern: options};
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
options = v.extend({}, this.options, options);
|
|
994
|
+
|
|
995
|
+
var message = options.message || this.message || "is invalid"
|
|
996
|
+
, pattern = options.pattern
|
|
997
|
+
, match;
|
|
998
|
+
|
|
999
|
+
// Empty values are allowed
|
|
1000
|
+
if (!v.isDefined(value)) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
if (!v.isString(value)) {
|
|
1004
|
+
return message;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
if (v.isString(pattern)) {
|
|
1008
|
+
pattern = new RegExp(options.pattern, options.flags);
|
|
1009
|
+
}
|
|
1010
|
+
match = pattern.exec(value);
|
|
1011
|
+
if (!match || match[0].length != value.length) {
|
|
1012
|
+
return message;
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
inclusion: function(value, options) {
|
|
1016
|
+
// Empty values are fine
|
|
1017
|
+
if (!v.isDefined(value)) {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
if (v.isArray(options)) {
|
|
1021
|
+
options = {within: options};
|
|
1022
|
+
}
|
|
1023
|
+
options = v.extend({}, this.options, options);
|
|
1024
|
+
if (v.contains(options.within, value)) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
var message = options.message ||
|
|
1028
|
+
this.message ||
|
|
1029
|
+
"^%{value} is not included in the list";
|
|
1030
|
+
return v.format(message, {value: value});
|
|
1031
|
+
},
|
|
1032
|
+
exclusion: function(value, options) {
|
|
1033
|
+
// Empty values are fine
|
|
1034
|
+
if (!v.isDefined(value)) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (v.isArray(options)) {
|
|
1038
|
+
options = {within: options};
|
|
1039
|
+
}
|
|
1040
|
+
options = v.extend({}, this.options, options);
|
|
1041
|
+
if (!v.contains(options.within, value)) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
var message = options.message || this.message || "^%{value} is restricted";
|
|
1045
|
+
if (v.isString(options.within[value])) {
|
|
1046
|
+
value = options.within[value];
|
|
1047
|
+
}
|
|
1048
|
+
return v.format(message, {value: value});
|
|
1049
|
+
},
|
|
1050
|
+
email: v.extend(function(value, options) {
|
|
1051
|
+
options = v.extend({}, this.options, options);
|
|
1052
|
+
var message = options.message || this.message || "is not a valid email";
|
|
1053
|
+
// Empty values are fine
|
|
1054
|
+
if (!v.isDefined(value)) {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
if (!v.isString(value)) {
|
|
1058
|
+
return message;
|
|
1059
|
+
}
|
|
1060
|
+
if (!this.PATTERN.exec(value)) {
|
|
1061
|
+
return message;
|
|
1062
|
+
}
|
|
1063
|
+
}, {
|
|
1064
|
+
PATTERN: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i
|
|
1065
|
+
}),
|
|
1066
|
+
equality: function(value, options, attribute, attributes, globalOptions) {
|
|
1067
|
+
if (!v.isDefined(value)) {
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
if (v.isString(options)) {
|
|
1072
|
+
options = {attribute: options};
|
|
1073
|
+
}
|
|
1074
|
+
options = v.extend({}, this.options, options);
|
|
1075
|
+
var message = options.message ||
|
|
1076
|
+
this.message ||
|
|
1077
|
+
"is not equal to %{attribute}";
|
|
1078
|
+
|
|
1079
|
+
if (v.isEmpty(options.attribute) || !v.isString(options.attribute)) {
|
|
1080
|
+
throw new Error("The attribute must be a non empty string");
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
var otherValue = v.getDeepObjectValue(attributes, options.attribute)
|
|
1084
|
+
, comparator = options.comparator || function(v1, v2) {
|
|
1085
|
+
return v1 === v2;
|
|
1086
|
+
}
|
|
1087
|
+
, prettify = options.prettify ||
|
|
1088
|
+
(globalOptions && globalOptions.prettify) ||
|
|
1089
|
+
v.prettify;
|
|
1090
|
+
|
|
1091
|
+
if (!comparator(value, otherValue, options, attribute, attributes)) {
|
|
1092
|
+
return v.format(message, {attribute: prettify(options.attribute)});
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
// A URL validator that is used to validate URLs with the ability to
|
|
1096
|
+
// restrict schemes and some domains.
|
|
1097
|
+
url: function(value, options) {
|
|
1098
|
+
if (!v.isDefined(value)) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
options = v.extend({}, this.options, options);
|
|
1103
|
+
|
|
1104
|
+
var message = options.message || this.message || "is not a valid url"
|
|
1105
|
+
, schemes = options.schemes || this.schemes || ['http', 'https']
|
|
1106
|
+
, allowLocal = options.allowLocal || this.allowLocal || false
|
|
1107
|
+
, allowDataUrl = options.allowDataUrl || this.allowDataUrl || false;
|
|
1108
|
+
if (!v.isString(value)) {
|
|
1109
|
+
return message;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// https://gist.github.com/dperini/729294
|
|
1113
|
+
var regex =
|
|
1114
|
+
"^" +
|
|
1115
|
+
// protocol identifier
|
|
1116
|
+
"(?:(?:" + schemes.join("|") + ")://)" +
|
|
1117
|
+
// user:pass authentication
|
|
1118
|
+
"(?:\\S+(?::\\S*)?@)?" +
|
|
1119
|
+
"(?:";
|
|
1120
|
+
|
|
1121
|
+
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
|
|
1122
|
+
|
|
1123
|
+
if (allowLocal) {
|
|
1124
|
+
tld += "?";
|
|
1125
|
+
} else {
|
|
1126
|
+
regex +=
|
|
1127
|
+
// IP address exclusion
|
|
1128
|
+
// private & local networks
|
|
1129
|
+
"(?!(?:10|127)(?:\\.\\d{1,3}){3})" +
|
|
1130
|
+
"(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" +
|
|
1131
|
+
"(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})";
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
regex +=
|
|
1135
|
+
// IP address dotted notation octets
|
|
1136
|
+
// excludes loopback network 0.0.0.0
|
|
1137
|
+
// excludes reserved space >= 224.0.0.0
|
|
1138
|
+
// excludes network & broacast addresses
|
|
1139
|
+
// (first & last IP address of each class)
|
|
1140
|
+
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" +
|
|
1141
|
+
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" +
|
|
1142
|
+
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" +
|
|
1143
|
+
"|" +
|
|
1144
|
+
// host name
|
|
1145
|
+
"(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" +
|
|
1146
|
+
// domain name
|
|
1147
|
+
"(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" +
|
|
1148
|
+
tld +
|
|
1149
|
+
")" +
|
|
1150
|
+
// port number
|
|
1151
|
+
"(?::\\d{2,5})?" +
|
|
1152
|
+
// resource path
|
|
1153
|
+
"(?:[/?#]\\S*)?" +
|
|
1154
|
+
"$";
|
|
1155
|
+
|
|
1156
|
+
if (allowDataUrl) {
|
|
1157
|
+
// RFC 2397
|
|
1158
|
+
var mediaType = "\\w+\\/[-+.\\w]+(?:;[\\w=]+)*";
|
|
1159
|
+
var urlchar = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*";
|
|
1160
|
+
var dataurl = "data:(?:"+mediaType+")?(?:;base64)?,"+urlchar;
|
|
1161
|
+
regex = "(?:"+regex+")|(?:^"+dataurl+"$)";
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
var PATTERN = new RegExp(regex, 'i');
|
|
1165
|
+
if (!PATTERN.exec(value)) {
|
|
1166
|
+
return message;
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
type: v.extend(function(value, originalOptions, attribute, attributes, globalOptions) {
|
|
1170
|
+
if (v.isString(originalOptions)) {
|
|
1171
|
+
originalOptions = {type: originalOptions};
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
if (!v.isDefined(value)) {
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
var options = v.extend({}, this.options, originalOptions);
|
|
1179
|
+
|
|
1180
|
+
var type = options.type;
|
|
1181
|
+
if (!v.isDefined(type)) {
|
|
1182
|
+
throw new Error("No type was specified");
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
var check;
|
|
1186
|
+
if (v.isFunction(type)) {
|
|
1187
|
+
check = type;
|
|
1188
|
+
} else {
|
|
1189
|
+
check = this.types[type];
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
if (!v.isFunction(check)) {
|
|
1193
|
+
throw new Error("validate.validators.type.types." + type + " must be a function.");
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
if (!check(value, options, attribute, attributes, globalOptions)) {
|
|
1197
|
+
var message = originalOptions.message ||
|
|
1198
|
+
this.messages[type] ||
|
|
1199
|
+
this.message ||
|
|
1200
|
+
options.message ||
|
|
1201
|
+
(v.isFunction(type) ? "must be of the correct type" : "must be of type %{type}");
|
|
1202
|
+
|
|
1203
|
+
if (v.isFunction(message)) {
|
|
1204
|
+
message = message(value, originalOptions, attribute, attributes, globalOptions);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
return v.format(message, {attribute: v.prettify(attribute), type: type});
|
|
1208
|
+
}
|
|
1209
|
+
}, {
|
|
1210
|
+
types: {
|
|
1211
|
+
object: function(value) {
|
|
1212
|
+
return v.isObject(value) && !v.isArray(value);
|
|
1213
|
+
},
|
|
1214
|
+
array: v.isArray,
|
|
1215
|
+
integer: v.isInteger,
|
|
1216
|
+
number: v.isNumber,
|
|
1217
|
+
string: v.isString,
|
|
1218
|
+
date: v.isDate,
|
|
1219
|
+
boolean: v.isBoolean
|
|
1220
|
+
},
|
|
1221
|
+
messages: {}
|
|
1222
|
+
})
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
validate.formatters = {
|
|
1226
|
+
detailed: function(errors) {return errors;},
|
|
1227
|
+
flat: v.flattenErrorsToArray,
|
|
1228
|
+
grouped: function(errors) {
|
|
1229
|
+
var attr;
|
|
1230
|
+
|
|
1231
|
+
errors = v.groupErrorsByAttribute(errors);
|
|
1232
|
+
for (attr in errors) {
|
|
1233
|
+
errors[attr] = v.flattenErrorsToArray(errors[attr]);
|
|
1234
|
+
}
|
|
1235
|
+
return errors;
|
|
1236
|
+
},
|
|
1237
|
+
constraint: function(errors) {
|
|
1238
|
+
var attr;
|
|
1239
|
+
errors = v.groupErrorsByAttribute(errors);
|
|
1240
|
+
for (attr in errors) {
|
|
1241
|
+
errors[attr] = errors[attr].map(function(result) {
|
|
1242
|
+
return result.validator;
|
|
1243
|
+
}).sort();
|
|
1244
|
+
}
|
|
1245
|
+
return errors;
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
validate.exposeModule(validate, this, exports, module, define);
|
|
1250
|
+
}).call(this,
|
|
1251
|
+
typeof exports !== 'undefined' ? /* istanbul ignore next */ exports : null,
|
|
1252
|
+
typeof module !== 'undefined' ? /* istanbul ignore next */ module : null,
|
|
1253
|
+
typeof define !== 'undefined' ? /* istanbul ignore next */ define : null);
|