@taquito/wallet-connect 24.3.0-beta.2 → 24.3.0-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/dist/lib/{taquito-wallet-connect/src/taquito-wallet-connect.js → taquito-wallet-connect.js} +1 -4
- package/dist/lib/{taquito-http-utils/src/version.js → version.js} +2 -2
- package/package.json +5 -7
- package/dist/lib/taquito/src/batch/constants.js +0 -16
- package/dist/lib/taquito/src/batch/rpc-batch-provider.js +0 -327
- package/dist/lib/taquito/src/constants.js +0 -135
- package/dist/lib/taquito/src/context.js +0 -178
- package/dist/lib/taquito/src/contract/big-map.js +0 -57
- package/dist/lib/taquito/src/contract/compose.js +0 -6
- package/dist/lib/taquito/src/contract/constants.js +0 -4
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-factory.js +0 -18
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-interface.js +0 -2
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-object-param.js +0 -72
- package/dist/lib/taquito/src/contract/contract-methods/contract-on-chain-view.js +0 -111
- package/dist/lib/taquito/src/contract/contract.js +0 -158
- package/dist/lib/taquito/src/contract/errors.js +0 -140
- package/dist/lib/taquito/src/contract/index.js +0 -30
- package/dist/lib/taquito/src/contract/interface.js +0 -2
- package/dist/lib/taquito/src/contract/manager-lambda.js +0 -71
- package/dist/lib/taquito/src/contract/prepare.js +0 -231
- package/dist/lib/taquito/src/contract/rpc-contract-provider.js +0 -675
- package/dist/lib/taquito/src/contract/sapling-state-abstraction.js +0 -24
- package/dist/lib/taquito/src/contract/semantic.js +0 -43
- package/dist/lib/taquito/src/contract/view_lambda.js +0 -27
- package/dist/lib/taquito/src/errors.js +0 -42
- package/dist/lib/taquito/src/estimate/errors.js +0 -16
- package/dist/lib/taquito/src/estimate/estimate-provider-interface.js +0 -2
- package/dist/lib/taquito/src/estimate/estimate.js +0 -176
- package/dist/lib/taquito/src/estimate/index.js +0 -20
- package/dist/lib/taquito/src/estimate/rpc-estimate-provider.js +0 -640
- package/dist/lib/taquito/src/extension/extension.js +0 -2
- package/dist/lib/taquito/src/forger/composite-forger.js +0 -32
- package/dist/lib/taquito/src/forger/errors.js +0 -30
- package/dist/lib/taquito/src/forger/rpc-forger.js +0 -12
- package/dist/lib/taquito/src/forger/taquito-local-forger.js +0 -21
- package/dist/lib/taquito/src/global-constants/default-global-constants-provider.js +0 -35
- package/dist/lib/taquito/src/global-constants/errors.js +0 -30
- package/dist/lib/taquito/src/global-constants/interface-global-constants-provider.js +0 -2
- package/dist/lib/taquito/src/global-constants/noop-global-constants-provider.js +0 -10
- package/dist/lib/taquito/src/import-key.js +0 -40
- package/dist/lib/taquito/src/injector/helper.js +0 -18
- package/dist/lib/taquito/src/injector/interface.js +0 -2
- package/dist/lib/taquito/src/injector/rpc-injector.js +0 -27
- package/dist/lib/taquito/src/operations/ballot-operation.js +0 -32
- package/dist/lib/taquito/src/operations/batch-operation.js +0 -69
- package/dist/lib/taquito/src/operations/delegate-operation.js +0 -54
- package/dist/lib/taquito/src/operations/drain-delegate-operation.js +0 -31
- package/dist/lib/taquito/src/operations/errors.js +0 -133
- package/dist/lib/taquito/src/operations/failing-noop-operation.js +0 -2
- package/dist/lib/taquito/src/operations/increase-paid-storage-operation.js +0 -49
- package/dist/lib/taquito/src/operations/index.js +0 -54
- package/dist/lib/taquito/src/operations/operations.js +0 -193
- package/dist/lib/taquito/src/operations/origination-operation.js +0 -78
- package/dist/lib/taquito/src/operations/proposals-operation.js +0 -29
- package/dist/lib/taquito/src/operations/register-global-constant-operation.js +0 -52
- package/dist/lib/taquito/src/operations/reveal-operation.js +0 -74
- package/dist/lib/taquito/src/operations/smart-rollup-add-messages-operation.js +0 -44
- package/dist/lib/taquito/src/operations/smart-rollup-execute-outbox-message-operation.js +0 -53
- package/dist/lib/taquito/src/operations/smart-rollup-originate-operation.js +0 -50
- package/dist/lib/taquito/src/operations/transaction-operation.js +0 -73
- package/dist/lib/taquito/src/operations/transfer-ticket-operation.js +0 -47
- package/dist/lib/taquito/src/operations/types.js +0 -88
- package/dist/lib/taquito/src/operations/update-companion-key-operation.js +0 -55
- package/dist/lib/taquito/src/operations/update-consensus-key-operation.js +0 -55
- package/dist/lib/taquito/src/packer/interface.js +0 -2
- package/dist/lib/taquito/src/packer/michel-codec-packer.js +0 -11
- package/dist/lib/taquito/src/packer/rpc-packer.js +0 -12
- package/dist/lib/taquito/src/parser/interface.js +0 -2
- package/dist/lib/taquito/src/parser/michel-codec-parser.js +0 -110
- package/dist/lib/taquito/src/parser/noop-parser.js +0 -9
- package/dist/lib/taquito/src/prepare/index.js +0 -18
- package/dist/lib/taquito/src/prepare/interface.js +0 -2
- package/dist/lib/taquito/src/prepare/prepare-provider.js +0 -1049
- package/dist/lib/taquito/src/provider.js +0 -363
- package/dist/lib/taquito/src/read-provider/interface.js +0 -2
- package/dist/lib/taquito/src/read-provider/rpc-read-adapter.js +0 -183
- package/dist/lib/taquito/src/signer/errors.js +0 -17
- package/dist/lib/taquito/src/signer/noop.js +0 -23
- package/dist/lib/taquito/src/subscribe/create-observable-from-subscription.js +0 -20
- package/dist/lib/taquito/src/subscribe/errors.js +0 -30
- package/dist/lib/taquito/src/subscribe/filters.js +0 -96
- package/dist/lib/taquito/src/subscribe/interface.js +0 -2
- package/dist/lib/taquito/src/subscribe/observable-subscription.js +0 -79
- package/dist/lib/taquito/src/subscribe/polling-subcribe-provider.js +0 -118
- package/dist/lib/taquito/src/taquito.js +0 -404
- package/dist/lib/taquito/src/tz/interface.js +0 -2
- package/dist/lib/taquito/src/tz/rpc-tz-provider.js +0 -46
- package/dist/lib/taquito/src/version.js +0 -8
- package/dist/lib/taquito/src/wallet/batch-operation.js +0 -71
- package/dist/lib/taquito/src/wallet/delegation-operation.js +0 -42
- package/dist/lib/taquito/src/wallet/errors.js +0 -40
- package/dist/lib/taquito/src/wallet/increase-paid-storage-operation.js +0 -42
- package/dist/lib/taquito/src/wallet/index.js +0 -25
- package/dist/lib/taquito/src/wallet/interface.js +0 -2
- package/dist/lib/taquito/src/wallet/legacy.js +0 -51
- package/dist/lib/taquito/src/wallet/operation-factory.js +0 -88
- package/dist/lib/taquito/src/wallet/operation.js +0 -221
- package/dist/lib/taquito/src/wallet/origination-operation.js +0 -53
- package/dist/lib/taquito/src/wallet/receipt.js +0 -46
- package/dist/lib/taquito/src/wallet/register-global-constant-operation.js +0 -45
- package/dist/lib/taquito/src/wallet/transaction-operation.js +0 -38
- package/dist/lib/taquito/src/wallet/transfer-ticket-operation.js +0 -38
- package/dist/lib/taquito/src/wallet/wallet.js +0 -445
- package/dist/lib/taquito-core/src/errors.js +0 -351
- package/dist/lib/taquito-core/src/signer-interfaces.js +0 -2
- package/dist/lib/taquito-core/src/taquito-core.js +0 -22
- package/dist/lib/taquito-http-utils/src/errors.js +0 -103
- package/dist/lib/taquito-http-utils/src/status_code.js +0 -322
- package/dist/lib/taquito-http-utils/src/taquito-http-utils.js +0 -308
- package/dist/lib/taquito-http-utils/src/transport-errors.js +0 -141
- package/dist/lib/taquito-local-forging/src/codec.js +0 -543
- package/dist/lib/taquito-local-forging/src/constants.js +0 -291
- package/dist/lib/taquito-local-forging/src/decoder.js +0 -64
- package/dist/lib/taquito-local-forging/src/encoder.js +0 -63
- package/dist/lib/taquito-local-forging/src/errors.js +0 -179
- package/dist/lib/taquito-local-forging/src/interface.js +0 -2
- package/dist/lib/taquito-local-forging/src/michelson/codec.js +0 -283
- package/dist/lib/taquito-local-forging/src/protocols.js +0 -60
- package/dist/lib/taquito-local-forging/src/schema/operation.js +0 -259
- package/dist/lib/taquito-local-forging/src/taquito-local-forging.js +0 -117
- package/dist/lib/taquito-local-forging/src/uint8array-consumer.js +0 -35
- package/dist/lib/taquito-local-forging/src/utils.js +0 -18
- package/dist/lib/taquito-local-forging/src/validator.js +0 -57
- package/dist/lib/taquito-local-forging/src/version.js +0 -8
- package/dist/lib/taquito-michel-codec/src/base58.js +0 -255
- package/dist/lib/taquito-michel-codec/src/binary.js +0 -1271
- package/dist/lib/taquito-michel-codec/src/errors.js +0 -90
- package/dist/lib/taquito-michel-codec/src/formatters.js +0 -58
- package/dist/lib/taquito-michel-codec/src/global-constants.js +0 -12
- package/dist/lib/taquito-michel-codec/src/macros.js +0 -551
- package/dist/lib/taquito-michel-codec/src/micheline-emitter.js +0 -128
- package/dist/lib/taquito-michel-codec/src/micheline-parser.js +0 -402
- package/dist/lib/taquito-michel-codec/src/micheline.js +0 -5
- package/dist/lib/taquito-michel-codec/src/michelson-contract.js +0 -93
- package/dist/lib/taquito-michel-codec/src/michelson-typecheck.js +0 -1756
- package/dist/lib/taquito-michel-codec/src/michelson-types.js +0 -83
- package/dist/lib/taquito-michel-codec/src/michelson-validator.js +0 -833
- package/dist/lib/taquito-michel-codec/src/scan.js +0 -128
- package/dist/lib/taquito-michel-codec/src/taquito-michel-codec.js +0 -38
- package/dist/lib/taquito-michel-codec/src/utils.js +0 -323
- package/dist/lib/taquito-michel-codec/src/version.js +0 -8
- package/dist/lib/taquito-michelson-encoder/src/constants.js +0 -11
- package/dist/lib/taquito-michelson-encoder/src/errors.js +0 -38
- package/dist/lib/taquito-michelson-encoder/src/michelson-map.js +0 -201
- package/dist/lib/taquito-michelson-encoder/src/schema/errors.js +0 -127
- package/dist/lib/taquito-michelson-encoder/src/schema/event-schema.js +0 -52
- package/dist/lib/taquito-michelson-encoder/src/schema/parameter.js +0 -113
- package/dist/lib/taquito-michelson-encoder/src/schema/storage.js +0 -260
- package/dist/lib/taquito-michelson-encoder/src/schema/types.js +0 -2
- package/dist/lib/taquito-michelson-encoder/src/schema/view-schema.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/taquito-michelson-encoder.js +0 -36
- package/dist/lib/taquito-michelson-encoder/src/tokens/bigmap.js +0 -130
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-fr.js +0 -86
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-g1.js +0 -76
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-g2.js +0 -76
- package/dist/lib/taquito-michelson-encoder/src/tokens/chain-id.js +0 -78
- package/dist/lib/taquito-michelson-encoder/src/tokens/chest-key.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/chest.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/address.js +0 -116
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/bool.js +0 -59
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/bytes.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/int.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/key_hash.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/mutez.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/nat.js +0 -93
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/string.js +0 -48
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/timestamp.js +0 -66
- package/dist/lib/taquito-michelson-encoder/src/tokens/constant.js +0 -80
- package/dist/lib/taquito-michelson-encoder/src/tokens/contract.js +0 -86
- package/dist/lib/taquito-michelson-encoder/src/tokens/createToken.js +0 -35
- package/dist/lib/taquito-michelson-encoder/src/tokens/key.js +0 -97
- package/dist/lib/taquito-michelson-encoder/src/tokens/lambda.js +0 -55
- package/dist/lib/taquito-michelson-encoder/src/tokens/list.js +0 -85
- package/dist/lib/taquito-michelson-encoder/src/tokens/map.js +0 -112
- package/dist/lib/taquito-michelson-encoder/src/tokens/never.js +0 -61
- package/dist/lib/taquito-michelson-encoder/src/tokens/operation.js +0 -39
- package/dist/lib/taquito-michelson-encoder/src/tokens/option.js +0 -88
- package/dist/lib/taquito-michelson-encoder/src/tokens/or.js +0 -282
- package/dist/lib/taquito-michelson-encoder/src/tokens/pair.js +0 -233
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-state.js +0 -84
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-transaction-deprecated.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-transaction.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/set.js +0 -82
- package/dist/lib/taquito-michelson-encoder/src/tokens/signature.js +0 -82
- package/dist/lib/taquito-michelson-encoder/src/tokens/ticket-deprecated.js +0 -92
- package/dist/lib/taquito-michelson-encoder/src/tokens/ticket.js +0 -92
- package/dist/lib/taquito-michelson-encoder/src/tokens/token.js +0 -100
- package/dist/lib/taquito-michelson-encoder/src/tokens/tokens.js +0 -75
- package/dist/lib/taquito-michelson-encoder/src/tokens/unit.js +0 -52
- package/dist/lib/taquito-michelson-encoder/src/version.js +0 -8
- package/dist/lib/taquito-rpc/src/opkind.js +0 -49
- package/dist/lib/taquito-rpc/src/rpc-client-interface.js +0 -60
- package/dist/lib/taquito-rpc/src/rpc-client-modules/rpc-cache.js +0 -1118
- package/dist/lib/taquito-rpc/src/taquito-rpc.js +0 -990
- package/dist/lib/taquito-rpc/src/types.js +0 -114
- package/dist/lib/taquito-rpc/src/utils/utils.js +0 -65
- package/dist/lib/taquito-rpc/src/version.js +0 -8
- package/dist/lib/taquito-signer/src/bls-key.js +0 -104
- package/dist/lib/taquito-signer/src/derivation-tools/ecdsa.js +0 -156
- package/dist/lib/taquito-signer/src/derivation-tools/ed25519.js +0 -82
- package/dist/lib/taquito-signer/src/derivation-tools/index.js +0 -79
- package/dist/lib/taquito-signer/src/derivation-tools/types.js +0 -4
- package/dist/lib/taquito-signer/src/derivation-tools/utils.js +0 -16
- package/dist/lib/taquito-signer/src/ec-key.js +0 -196
- package/dist/lib/taquito-signer/src/ed-key.js +0 -130
- package/dist/lib/taquito-signer/src/errors.js +0 -77
- package/dist/lib/taquito-signer/src/helpers.js +0 -44
- package/dist/lib/taquito-signer/src/in-memory-signer.js +0 -240
- package/dist/lib/taquito-signer/src/key-interface.js +0 -6
- package/dist/lib/taquito-signer/src/taquito-signer.js +0 -28
- package/dist/lib/taquito-signer/src/version.js +0 -8
- package/dist/lib/taquito-utils/src/constants.js +0 -203
- package/dist/lib/taquito-utils/src/encoding.js +0 -606
- package/dist/lib/taquito-utils/src/errors.js +0 -45
- package/dist/lib/taquito-utils/src/format.js +0 -29
- package/dist/lib/taquito-utils/src/taquito-utils.js +0 -42
- package/dist/lib/taquito-utils/src/validators.js +0 -236
- package/dist/lib/taquito-utils/src/verify-signature.js +0 -136
- package/dist/lib/taquito-utils/src/version.js +0 -8
- package/dist/lib/taquito-wallet-connect/src/version.js +0 -8
- package/dist/types/taquito/src/batch/constants.d.ts +0 -3
- package/dist/types/taquito/src/batch/rpc-batch-provider.d.ts +0 -139
- package/dist/types/taquito/src/constants.d.ts +0 -81
- package/dist/types/taquito/src/context.d.ts +0 -100
- package/dist/types/taquito/src/contract/big-map.d.ts +0 -35
- package/dist/types/taquito/src/contract/compose.d.ts +0 -5
- package/dist/types/taquito/src/contract/constants.d.ts +0 -1
- package/dist/types/taquito/src/contract/contract-methods/contract-method-factory.d.ts +0 -14
- package/dist/types/taquito/src/contract/contract-methods/contract-method-interface.d.ts +0 -28
- package/dist/types/taquito/src/contract/contract-methods/contract-method-object-param.d.ts +0 -39
- package/dist/types/taquito/src/contract/contract-methods/contract-on-chain-view.d.ts +0 -43
- package/dist/types/taquito/src/contract/contract.d.ts +0 -75
- package/dist/types/taquito/src/contract/errors.d.ts +0 -83
- package/dist/types/taquito/src/contract/index.d.ts +0 -11
- package/dist/types/taquito/src/contract/interface.d.ts +0 -254
- package/dist/types/taquito/src/contract/manager-lambda.d.ts +0 -73
- package/dist/types/taquito/src/contract/prepare.d.ts +0 -18
- package/dist/types/taquito/src/contract/rpc-contract-provider.d.ts +0 -270
- package/dist/types/taquito/src/contract/sapling-state-abstraction.d.ts +0 -17
- package/dist/types/taquito/src/contract/semantic.d.ts +0 -7
- package/dist/types/taquito/src/contract/view_lambda.d.ts +0 -34
- package/dist/types/taquito/src/errors.d.ts +0 -26
- package/dist/types/taquito/src/estimate/errors.d.ts +0 -8
- package/dist/types/taquito/src/estimate/estimate-provider-interface.d.ts +0 -153
- package/dist/types/taquito/src/estimate/estimate.d.ts +0 -111
- package/dist/types/taquito/src/estimate/index.d.ts +0 -4
- package/dist/types/taquito/src/estimate/rpc-estimate-provider.d.ts +0 -174
- package/dist/types/taquito/src/extension/extension.d.ts +0 -4
- package/dist/types/taquito/src/forger/composite-forger.d.ts +0 -6
- package/dist/types/taquito/src/forger/errors.d.ts +0 -16
- package/dist/types/taquito/src/forger/rpc-forger.d.ts +0 -7
- package/dist/types/taquito/src/forger/taquito-local-forger.d.ts +0 -8
- package/dist/types/taquito/src/global-constants/default-global-constants-provider.d.ts +0 -18
- package/dist/types/taquito/src/global-constants/errors.d.ts +0 -16
- package/dist/types/taquito/src/global-constants/interface-global-constants-provider.d.ts +0 -11
- package/dist/types/taquito/src/global-constants/noop-global-constants-provider.d.ts +0 -5
- package/dist/types/taquito/src/import-key.d.ts +0 -13
- package/dist/types/taquito/src/injector/helper.d.ts +0 -2
- package/dist/types/taquito/src/injector/interface.d.ts +0 -5
- package/dist/types/taquito/src/injector/rpc-injector.d.ts +0 -7
- package/dist/types/taquito/src/operations/ballot-operation.d.ts +0 -18
- package/dist/types/taquito/src/operations/batch-operation.d.ts +0 -19
- package/dist/types/taquito/src/operations/delegate-operation.d.ts +0 -24
- package/dist/types/taquito/src/operations/drain-delegate-operation.d.ts +0 -17
- package/dist/types/taquito/src/operations/errors.d.ts +0 -50
- package/dist/types/taquito/src/operations/failing-noop-operation.d.ts +0 -17
- package/dist/types/taquito/src/operations/increase-paid-storage-operation.d.ts +0 -23
- package/dist/types/taquito/src/operations/index.d.ts +0 -18
- package/dist/types/taquito/src/operations/operations.d.ts +0 -35
- package/dist/types/taquito/src/operations/origination-operation.d.ts +0 -35
- package/dist/types/taquito/src/operations/proposals-operation.d.ts +0 -17
- package/dist/types/taquito/src/operations/register-global-constant-operation.d.ts +0 -25
- package/dist/types/taquito/src/operations/reveal-operation.d.ts +0 -25
- package/dist/types/taquito/src/operations/smart-rollup-add-messages-operation.d.ts +0 -20
- package/dist/types/taquito/src/operations/smart-rollup-execute-outbox-message-operation.d.ts +0 -24
- package/dist/types/taquito/src/operations/smart-rollup-originate-operation.d.ts +0 -23
- package/dist/types/taquito/src/operations/transaction-operation.d.ts +0 -28
- package/dist/types/taquito/src/operations/transfer-ticket-operation.d.ts +0 -22
- package/dist/types/taquito/src/operations/types.d.ts +0 -823
- package/dist/types/taquito/src/operations/update-companion-key-operation.d.ts +0 -23
- package/dist/types/taquito/src/operations/update-consensus-key-operation.d.ts +0 -23
- package/dist/types/taquito/src/packer/interface.d.ts +0 -4
- package/dist/types/taquito/src/packer/michel-codec-packer.d.ts +0 -5
- package/dist/types/taquito/src/packer/rpc-packer.d.ts +0 -8
- package/dist/types/taquito/src/parser/interface.d.ts +0 -4
- package/dist/types/taquito/src/parser/michel-codec-parser.d.ts +0 -16
- package/dist/types/taquito/src/parser/noop-parser.d.ts +0 -5
- package/dist/types/taquito/src/prepare/index.d.ts +0 -2
- package/dist/types/taquito/src/prepare/interface.d.ts +0 -152
- package/dist/types/taquito/src/prepare/prepare-provider.d.ts +0 -187
- package/dist/types/taquito/src/provider.d.ts +0 -50
- package/dist/types/taquito/src/read-provider/interface.d.ts +0 -132
- package/dist/types/taquito/src/read-provider/rpc-read-adapter.d.ts +0 -130
- package/dist/types/taquito/src/signer/errors.d.ts +0 -8
- package/dist/types/taquito/src/signer/noop.d.ts +0 -11
- package/dist/types/taquito/src/subscribe/create-observable-from-subscription.d.ts +0 -4
- package/dist/types/taquito/src/subscribe/errors.d.ts +0 -18
- package/dist/types/taquito/src/subscribe/filters.d.ts +0 -6
- package/dist/types/taquito/src/subscribe/interface.d.ts +0 -48
- package/dist/types/taquito/src/subscribe/observable-subscription.d.ts +0 -21
- package/dist/types/taquito/src/subscribe/polling-subcribe-provider.d.ts +0 -23
- package/dist/types/taquito/src/taquito.d.ts +0 -248
- package/dist/types/taquito/src/tz/interface.d.ts +0 -20
- package/dist/types/taquito/src/tz/rpc-tz-provider.d.ts +0 -13
- package/dist/types/taquito/src/version.d.ts +0 -4
- package/dist/types/taquito/src/wallet/batch-operation.d.ts +0 -13
- package/dist/types/taquito/src/wallet/delegation-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/errors.d.ts +0 -24
- package/dist/types/taquito/src/wallet/increase-paid-storage-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/index.d.ts +0 -9
- package/dist/types/taquito/src/wallet/interface.d.ts +0 -66
- package/dist/types/taquito/src/wallet/legacy.d.ts +0 -21
- package/dist/types/taquito/src/wallet/operation-factory.d.ts +0 -32
- package/dist/types/taquito/src/wallet/operation.d.ts +0 -55
- package/dist/types/taquito/src/wallet/origination-operation.d.ts +0 -14
- package/dist/types/taquito/src/wallet/receipt.d.ts +0 -16
- package/dist/types/taquito/src/wallet/register-global-constant-operation.d.ts +0 -13
- package/dist/types/taquito/src/wallet/transaction-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/transfer-ticket-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/wallet.d.ts +0 -196
- package/dist/types/taquito-core/src/errors.d.ts +0 -213
- package/dist/types/taquito-core/src/signer-interfaces.d.ts +0 -38
- package/dist/types/taquito-core/src/taquito-core.d.ts +0 -6
- package/dist/types/taquito-http-utils/src/errors.d.ts +0 -63
- package/dist/types/taquito-http-utils/src/status_code.d.ts +0 -318
- package/dist/types/taquito-http-utils/src/taquito-http-utils.d.ts +0 -58
- package/dist/types/taquito-http-utils/src/transport-errors.d.ts +0 -28
- package/dist/types/taquito-local-forging/src/codec.d.ts +0 -79
- package/dist/types/taquito-local-forging/src/constants.d.ts +0 -75
- package/dist/types/taquito-local-forging/src/decoder.d.ts +0 -5
- package/dist/types/taquito-local-forging/src/encoder.d.ts +0 -4
- package/dist/types/taquito-local-forging/src/errors.d.ts +0 -109
- package/dist/types/taquito-local-forging/src/interface.d.ts +0 -9
- package/dist/types/taquito-local-forging/src/michelson/codec.d.ts +0 -49
- package/dist/types/taquito-local-forging/src/protocols.d.ts +0 -27
- package/dist/types/taquito-local-forging/src/schema/operation.d.ts +0 -198
- package/dist/types/taquito-local-forging/src/taquito-local-forging.d.ts +0 -27
- package/dist/types/taquito-local-forging/src/uint8array-consumer.d.ts +0 -10
- package/dist/types/taquito-local-forging/src/utils.d.ts +0 -3
- package/dist/types/taquito-local-forging/src/validator.d.ts +0 -13
- package/dist/types/taquito-local-forging/src/version.d.ts +0 -4
- package/dist/types/taquito-michel-codec/src/base58.d.ts +0 -13
- package/dist/types/taquito-michel-codec/src/binary.d.ts +0 -127
- package/dist/types/taquito-michel-codec/src/errors.d.ts +0 -57
- package/dist/types/taquito-michel-codec/src/formatters.d.ts +0 -6
- package/dist/types/taquito-michel-codec/src/global-constants.d.ts +0 -3
- package/dist/types/taquito-michel-codec/src/macros.d.ts +0 -13
- package/dist/types/taquito-michel-codec/src/micheline-emitter.d.ts +0 -17
- package/dist/types/taquito-michel-codec/src/micheline-parser.d.ts +0 -130
- package/dist/types/taquito-michel-codec/src/micheline.d.ts +0 -44
- package/dist/types/taquito-michel-codec/src/michelson-contract.d.ts +0 -24
- package/dist/types/taquito-michel-codec/src/michelson-typecheck.d.ts +0 -38
- package/dist/types/taquito-michel-codec/src/michelson-types.d.ts +0 -147
- package/dist/types/taquito-michel-codec/src/michelson-validator.d.ts +0 -66
- package/dist/types/taquito-michel-codec/src/scan.d.ts +0 -26
- package/dist/types/taquito-michel-codec/src/taquito-michel-codec.d.ts +0 -16
- package/dist/types/taquito-michel-codec/src/utils.d.ts +0 -76
- package/dist/types/taquito-michel-codec/src/version.d.ts +0 -4
- package/dist/types/taquito-michelson-encoder/src/constants.d.ts +0 -8
- package/dist/types/taquito-michelson-encoder/src/errors.d.ts +0 -17
- package/dist/types/taquito-michelson-encoder/src/michelson-map.d.ts +0 -82
- package/dist/types/taquito-michelson-encoder/src/schema/errors.d.ts +0 -83
- package/dist/types/taquito-michelson-encoder/src/schema/event-schema.d.ts +0 -12
- package/dist/types/taquito-michelson-encoder/src/schema/parameter.d.ts +0 -54
- package/dist/types/taquito-michelson-encoder/src/schema/storage.d.ts +0 -97
- package/dist/types/taquito-michelson-encoder/src/schema/types.d.ts +0 -105
- package/dist/types/taquito-michelson-encoder/src/schema/view-schema.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/taquito-michelson-encoder.d.ts +0 -16
- package/dist/types/taquito-michelson-encoder/src/tokens/bigmap.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-fr.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-g1.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-g2.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/chain-id.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/chest-key.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/chest.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/address.d.ts +0 -61
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/bool.d.ts +0 -32
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/bytes.d.ts +0 -52
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/int.d.ts +0 -56
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/key_hash.d.ts +0 -55
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/mutez.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/nat.d.ts +0 -55
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/string.d.ts +0 -31
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/timestamp.d.ts +0 -34
- package/dist/types/taquito-michelson-encoder/src/tokens/constant.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/contract.d.ts +0 -48
- package/dist/types/taquito-michelson-encoder/src/tokens/createToken.d.ts +0 -18
- package/dist/types/taquito-michelson-encoder/src/tokens/key.d.ts +0 -55
- package/dist/types/taquito-michelson-encoder/src/tokens/lambda.d.ts +0 -24
- package/dist/types/taquito-michelson-encoder/src/tokens/list.d.ts +0 -46
- package/dist/types/taquito-michelson-encoder/src/tokens/map.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/never.d.ts +0 -41
- package/dist/types/taquito-michelson-encoder/src/tokens/operation.d.ts +0 -24
- package/dist/types/taquito-michelson-encoder/src/tokens/option.d.ts +0 -37
- package/dist/types/taquito-michelson-encoder/src/tokens/or.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/tokens/pair.d.ts +0 -50
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-state.d.ts +0 -44
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-transaction-deprecated.d.ts +0 -40
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-transaction.d.ts +0 -40
- package/dist/types/taquito-michelson-encoder/src/tokens/set.d.ts +0 -43
- package/dist/types/taquito-michelson-encoder/src/tokens/signature.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/tokens/ticket-deprecated.d.ts +0 -38
- package/dist/types/taquito-michelson-encoder/src/tokens/ticket.d.ts +0 -38
- package/dist/types/taquito-michelson-encoder/src/tokens/token.d.ts +0 -68
- package/dist/types/taquito-michelson-encoder/src/tokens/tokens.d.ts +0 -36
- package/dist/types/taquito-michelson-encoder/src/tokens/unit.d.ts +0 -34
- package/dist/types/taquito-michelson-encoder/src/version.d.ts +0 -4
- package/dist/types/taquito-rpc/src/opkind.d.ts +0 -45
- package/dist/types/taquito-rpc/src/rpc-client-interface.d.ts +0 -126
- package/dist/types/taquito-rpc/src/rpc-client-modules/rpc-cache.d.ts +0 -473
- package/dist/types/taquito-rpc/src/taquito-rpc.d.ts +0 -483
- package/dist/types/taquito-rpc/src/types.d.ts +0 -2362
- package/dist/types/taquito-rpc/src/utils/utils.d.ts +0 -14
- package/dist/types/taquito-rpc/src/version.d.ts +0 -4
- package/dist/types/taquito-signer/src/bls-key.d.ts +0 -21
- package/dist/types/taquito-signer/src/derivation-tools/ecdsa.d.ts +0 -49
- package/dist/types/taquito-signer/src/derivation-tools/ed25519.d.ts +0 -33
- package/dist/types/taquito-signer/src/derivation-tools/index.d.ts +0 -12
- package/dist/types/taquito-signer/src/derivation-tools/types.d.ts +0 -10
- package/dist/types/taquito-signer/src/derivation-tools/utils.d.ts +0 -1
- package/dist/types/taquito-signer/src/ec-key.d.ts +0 -42
- package/dist/types/taquito-signer/src/ed-key.d.ts +0 -39
- package/dist/types/taquito-signer/src/errors.d.ts +0 -51
- package/dist/types/taquito-signer/src/helpers.d.ts +0 -10
- package/dist/types/taquito-signer/src/in-memory-signer.d.ts +0 -56
- package/dist/types/taquito-signer/src/key-interface.d.ts +0 -37
- package/dist/types/taquito-signer/src/taquito-signer.d.ts +0 -10
- package/dist/types/taquito-signer/src/version.d.ts +0 -4
- package/dist/types/taquito-utils/src/constants.d.ts +0 -78
- package/dist/types/taquito-utils/src/encoding.d.ts +0 -184
- package/dist/types/taquito-utils/src/errors.d.ts +0 -20
- package/dist/types/taquito-utils/src/format.d.ts +0 -4
- package/dist/types/taquito-utils/src/taquito-utils.d.ts +0 -11
- package/dist/types/taquito-utils/src/validators.d.ts +0 -167
- package/dist/types/taquito-utils/src/verify-signature.d.ts +0 -22
- package/dist/types/taquito-utils/src/version.d.ts +0 -4
- package/dist/types/taquito-wallet-connect/src/version.d.ts +0 -4
- /package/dist/lib/{taquito-wallet-connect/src/errors.js → errors.js} +0 -0
- /package/dist/lib/{taquito-wallet-connect/src/types.js → types.js} +0 -0
- /package/dist/types/{taquito-wallet-connect/src/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/types/{taquito-wallet-connect/src/taquito-wallet-connect.d.ts → taquito-wallet-connect.d.ts} +0 -0
- /package/dist/types/{taquito-wallet-connect/src/types.d.ts → types.d.ts} +0 -0
- /package/dist/types/{taquito-http-utils/src/version.d.ts → version.d.ts} +0 -0
|
@@ -1,606 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @packageDocumentation
|
|
4
|
-
* @module @taquito/utils
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.signaturePrefixes = exports.publicKeyHashPrefixes = exports.publicKeyPrefixes = exports.addressPrefixes = void 0;
|
|
11
|
-
exports.b58DecodeAndCheckPrefix = b58DecodeAndCheckPrefix;
|
|
12
|
-
exports.b58DecodePublicKey = b58DecodePublicKey;
|
|
13
|
-
exports.b58DecodePublicKeyHash = b58DecodePublicKeyHash;
|
|
14
|
-
exports.b58DecodeBlsAddress = b58DecodeBlsAddress;
|
|
15
|
-
exports.b58DecodeAddress = b58DecodeAddress;
|
|
16
|
-
exports.getPkhfromPk = getPkhfromPk;
|
|
17
|
-
exports.b58Encode = b58Encode;
|
|
18
|
-
exports.encodeKey = encodeKey;
|
|
19
|
-
exports.encodeKeyHash = encodeKeyHash;
|
|
20
|
-
exports.encodeAddress = encodeAddress;
|
|
21
|
-
exports.encodeBlsAddress = encodeBlsAddress;
|
|
22
|
-
exports.encodeExpr = encodeExpr;
|
|
23
|
-
exports.encodeOpHash = encodeOpHash;
|
|
24
|
-
exports.hex2buf = hex2buf;
|
|
25
|
-
exports.mergebuf = mergebuf;
|
|
26
|
-
exports.mic2arr = mic2arr;
|
|
27
|
-
exports.buf2hex = buf2hex;
|
|
28
|
-
exports.stringToBytes = stringToBytes;
|
|
29
|
-
exports.bytesToString = bytesToString;
|
|
30
|
-
exports.hex2Bytes = hex2Bytes;
|
|
31
|
-
exports.toHexBuf = toHexBuf;
|
|
32
|
-
exports.numToHexBuffer = numToHexBuffer;
|
|
33
|
-
exports.num2PaddedHex = num2PaddedHex;
|
|
34
|
-
exports.stripHexPrefix = stripHexPrefix;
|
|
35
|
-
exports.splitAddress = splitAddress;
|
|
36
|
-
exports.compareArrays = compareArrays;
|
|
37
|
-
/*
|
|
38
|
-
* Some code in this file is originally from sotez and eztz
|
|
39
|
-
* Copyright (c) 2018 Andrew Kishino
|
|
40
|
-
* Copyright (c) 2017 Stephen Andrews
|
|
41
|
-
*/
|
|
42
|
-
const buffer_1 = require("buffer");
|
|
43
|
-
const constants_1 = require("./constants");
|
|
44
|
-
const blake2_js_1 = require("@noble/hashes/blake2.js");
|
|
45
|
-
const bs58check_1 = __importDefault(require("bs58check"));
|
|
46
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
47
|
-
const typedarray_to_buffer_1 = __importDefault(require("typedarray-to-buffer"));
|
|
48
|
-
const core_1 = require("@taquito/core");
|
|
49
|
-
/**
|
|
50
|
-
* list of prefixes that can be used to decode an address
|
|
51
|
-
*/
|
|
52
|
-
exports.addressPrefixes = [
|
|
53
|
-
constants_1.PrefixV2.P256PublicKeyHash,
|
|
54
|
-
constants_1.PrefixV2.Secp256k1PublicKeyHash,
|
|
55
|
-
constants_1.PrefixV2.Ed25519PublicKeyHash,
|
|
56
|
-
constants_1.PrefixV2.BLS12_381PublicKeyHash,
|
|
57
|
-
constants_1.PrefixV2.ContractHash,
|
|
58
|
-
constants_1.PrefixV2.SmartRollupHash,
|
|
59
|
-
// PrefixV2.ZkRollupHash,
|
|
60
|
-
];
|
|
61
|
-
/**
|
|
62
|
-
* list of prefixes that can be used to decode a public key
|
|
63
|
-
*/
|
|
64
|
-
exports.publicKeyPrefixes = [
|
|
65
|
-
constants_1.PrefixV2.P256PublicKey,
|
|
66
|
-
constants_1.PrefixV2.Secp256k1PublicKey,
|
|
67
|
-
constants_1.PrefixV2.Ed25519PublicKey,
|
|
68
|
-
constants_1.PrefixV2.BLS12_381PublicKey,
|
|
69
|
-
];
|
|
70
|
-
/**
|
|
71
|
-
* list of prefixes that can be used to decode a public key hash
|
|
72
|
-
*/
|
|
73
|
-
exports.publicKeyHashPrefixes = [
|
|
74
|
-
constants_1.PrefixV2.P256PublicKeyHash,
|
|
75
|
-
constants_1.PrefixV2.Secp256k1PublicKeyHash,
|
|
76
|
-
constants_1.PrefixV2.Ed25519PublicKeyHash,
|
|
77
|
-
constants_1.PrefixV2.BLS12_381PublicKeyHash,
|
|
78
|
-
];
|
|
79
|
-
/**
|
|
80
|
-
* list of prefixes that can be used to decode a signature
|
|
81
|
-
*/
|
|
82
|
-
exports.signaturePrefixes = [
|
|
83
|
-
constants_1.PrefixV2.P256Signature,
|
|
84
|
-
constants_1.PrefixV2.Secp256k1Signature,
|
|
85
|
-
constants_1.PrefixV2.Ed25519Signature,
|
|
86
|
-
constants_1.PrefixV2.BLS12_381Signature,
|
|
87
|
-
constants_1.PrefixV2.GenericSignature,
|
|
88
|
-
];
|
|
89
|
-
function b58DecodeAndCheckPrefix(src, allowed, payloadOnly) {
|
|
90
|
-
const buf = (() => {
|
|
91
|
-
try {
|
|
92
|
-
return bs58check_1.default.decode(src);
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
if (err instanceof Error) {
|
|
96
|
-
if (err.message.includes('checksum')) {
|
|
97
|
-
throw new core_1.ParameterValidationError(core_1.ValidationResult.INVALID_CHECKSUM);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
throw new core_1.ParameterValidationError(core_1.ValidationResult.INVALID_ENCODING);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
throw err;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
})();
|
|
108
|
-
let key;
|
|
109
|
-
for (key in constants_1.PrefixV2) {
|
|
110
|
-
const p = constants_1.PrefixV2[key];
|
|
111
|
-
const pre = constants_1.prefixV2[p];
|
|
112
|
-
if (buf.length === pre.length + constants_1.payloadLength[p] &&
|
|
113
|
-
buf.slice(0, pre.length).every((v, i) => v == pre[i])) {
|
|
114
|
-
if (allowed !== undefined && allowed.indexOf(p) < 0) {
|
|
115
|
-
throw new core_1.ParameterValidationError(core_1.ValidationResult.PREFIX_NOT_ALLOWED);
|
|
116
|
-
}
|
|
117
|
-
if (payloadOnly) {
|
|
118
|
-
return buf.slice(pre.length);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
return [buf.slice(pre.length), p];
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
throw new core_1.ParameterValidationError(core_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
126
|
-
}
|
|
127
|
-
function b58DecodePublicKey(value, fmt) {
|
|
128
|
-
const [data, pre] = b58DecodeAndCheckPrefix(value, exports.publicKeyPrefixes);
|
|
129
|
-
let tag;
|
|
130
|
-
switch (pre) {
|
|
131
|
-
case constants_1.PrefixV2.Ed25519PublicKey:
|
|
132
|
-
tag = 0;
|
|
133
|
-
break;
|
|
134
|
-
case constants_1.PrefixV2.Secp256k1PublicKey:
|
|
135
|
-
tag = 1;
|
|
136
|
-
break;
|
|
137
|
-
case constants_1.PrefixV2.P256PublicKey:
|
|
138
|
-
tag = 2;
|
|
139
|
-
break;
|
|
140
|
-
case constants_1.PrefixV2.BLS12_381PublicKey:
|
|
141
|
-
tag = 3;
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
throw new core_1.InvalidKeyError(core_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
145
|
-
}
|
|
146
|
-
const buf = new Uint8Array(data.length + 1);
|
|
147
|
-
buf[0] = tag;
|
|
148
|
-
buf.set(data, 1);
|
|
149
|
-
if (fmt !== undefined && fmt === 'array') {
|
|
150
|
-
return buf;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return buf2hex(buf);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function b58DecodePublicKeyHash(value, fmt) {
|
|
157
|
-
const [data, pre] = b58DecodeAndCheckPrefix(value, exports.publicKeyHashPrefixes);
|
|
158
|
-
const buf = new Uint8Array(21);
|
|
159
|
-
let tag;
|
|
160
|
-
switch (pre) {
|
|
161
|
-
case constants_1.PrefixV2.Ed25519PublicKeyHash:
|
|
162
|
-
tag = 0;
|
|
163
|
-
break;
|
|
164
|
-
case constants_1.PrefixV2.Secp256k1PublicKeyHash:
|
|
165
|
-
tag = 1;
|
|
166
|
-
break;
|
|
167
|
-
case constants_1.PrefixV2.P256PublicKeyHash:
|
|
168
|
-
tag = 2;
|
|
169
|
-
break;
|
|
170
|
-
case constants_1.PrefixV2.BLS12_381PublicKeyHash:
|
|
171
|
-
tag = 3;
|
|
172
|
-
break;
|
|
173
|
-
default:
|
|
174
|
-
throw new core_1.InvalidAddressError(value, core_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
175
|
-
}
|
|
176
|
-
buf[0] = tag;
|
|
177
|
-
buf.set(data, 1);
|
|
178
|
-
if (fmt !== undefined && fmt === 'array') {
|
|
179
|
-
return buf;
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
return buf2hex(buf);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
function b58DecodeBlsAddress(value, fmt) {
|
|
186
|
-
const [buf, pre] = b58DecodeAndCheckPrefix(value);
|
|
187
|
-
if (pre !== constants_1.PrefixV2.BLS12_381PublicKeyHash) {
|
|
188
|
-
throw new core_1.InvalidKeyError(core_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
189
|
-
}
|
|
190
|
-
if (fmt !== undefined && fmt === 'array') {
|
|
191
|
-
return buf;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
return buf2hex(buf);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function b58DecodeAddress(value, fmt) {
|
|
198
|
-
const i = value.indexOf('%');
|
|
199
|
-
if (i >= 0) {
|
|
200
|
-
value = value.slice(0, i);
|
|
201
|
-
}
|
|
202
|
-
const [data, pre] = b58DecodeAndCheckPrefix(value, exports.addressPrefixes);
|
|
203
|
-
const buf = new Uint8Array(22);
|
|
204
|
-
if (pre === constants_1.PrefixV2.ContractHash ||
|
|
205
|
-
pre === constants_1.PrefixV2.SmartRollupHash ||
|
|
206
|
-
pre === constants_1.PrefixV2.ZkRollupHash) {
|
|
207
|
-
let tag;
|
|
208
|
-
switch (pre) {
|
|
209
|
-
case constants_1.PrefixV2.ContractHash:
|
|
210
|
-
tag = 1;
|
|
211
|
-
break;
|
|
212
|
-
case constants_1.PrefixV2.SmartRollupHash:
|
|
213
|
-
tag = 3;
|
|
214
|
-
break;
|
|
215
|
-
case constants_1.PrefixV2.ZkRollupHash:
|
|
216
|
-
tag = 4;
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
buf[0] = tag;
|
|
220
|
-
buf.set(data, 1);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
let tag;
|
|
224
|
-
switch (pre) {
|
|
225
|
-
case constants_1.PrefixV2.Ed25519PublicKeyHash:
|
|
226
|
-
tag = 0;
|
|
227
|
-
break;
|
|
228
|
-
case constants_1.PrefixV2.Secp256k1PublicKeyHash:
|
|
229
|
-
tag = 1;
|
|
230
|
-
break;
|
|
231
|
-
case constants_1.PrefixV2.P256PublicKeyHash:
|
|
232
|
-
tag = 2;
|
|
233
|
-
break;
|
|
234
|
-
case constants_1.PrefixV2.BLS12_381PublicKeyHash:
|
|
235
|
-
tag = 3;
|
|
236
|
-
break;
|
|
237
|
-
default:
|
|
238
|
-
throw new core_1.InvalidAddressError(value, core_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
239
|
-
}
|
|
240
|
-
buf[0] = 0;
|
|
241
|
-
buf[1] = tag;
|
|
242
|
-
buf.set(data, 2);
|
|
243
|
-
}
|
|
244
|
-
if (fmt !== undefined && fmt === 'array') {
|
|
245
|
-
return buf;
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
return buf2hex(buf);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Gets Tezos address (PKH) from Public Key
|
|
253
|
-
* @param publicKey Base58 Public Key
|
|
254
|
-
* @returns A string of the Tezos address (PKH) that was derived from the given Public Key
|
|
255
|
-
* @example getPkhfromPk('edpkuNjKKT48xBoT5asPrWdmuM1Yw8D93MwgFgVvtca8jb5pstzaCh') // return 'tz2MVED1t9Jery77Bwm1m5YhUx8Wp5KWWRQe'
|
|
256
|
-
*/
|
|
257
|
-
function getPkhfromPk(publicKey) {
|
|
258
|
-
const [key, pre] = b58DecodeAndCheckPrefix(publicKey);
|
|
259
|
-
let pkhPre;
|
|
260
|
-
switch (pre) {
|
|
261
|
-
case constants_1.PrefixV2.P256PublicKey:
|
|
262
|
-
pkhPre = constants_1.PrefixV2.P256PublicKeyHash;
|
|
263
|
-
break;
|
|
264
|
-
case constants_1.PrefixV2.Secp256k1PublicKey:
|
|
265
|
-
pkhPre = constants_1.PrefixV2.Secp256k1PublicKeyHash;
|
|
266
|
-
break;
|
|
267
|
-
case constants_1.PrefixV2.Ed25519PublicKey:
|
|
268
|
-
pkhPre = constants_1.PrefixV2.Ed25519PublicKeyHash;
|
|
269
|
-
break;
|
|
270
|
-
case constants_1.PrefixV2.BLS12_381PublicKey:
|
|
271
|
-
pkhPre = constants_1.PrefixV2.BLS12_381PublicKeyHash;
|
|
272
|
-
break;
|
|
273
|
-
default:
|
|
274
|
-
throw new core_1.InvalidPublicKeyError(publicKey, core_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
275
|
-
}
|
|
276
|
-
const hashed = (0, blake2_js_1.blake2b)(key, { dkLen: 20 });
|
|
277
|
-
return b58Encode(hashed, pkhPre);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Add the prefix to a hex string or Uint8Array and Base58 encode it
|
|
281
|
-
* @param value Value to Base58 encode
|
|
282
|
-
* @param pre prefix ID to append to the encoded string
|
|
283
|
-
* @example b58Encode('e96b9f8b19af9c7ffa0c0480e1977b295850961f', PrefixV2.Ed25519PublicKeyHash) // returns 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM'
|
|
284
|
-
*/
|
|
285
|
-
function b58Encode(value, pre) {
|
|
286
|
-
const data = typeof value === 'string' ? hex2buf(value) : value;
|
|
287
|
-
const p = constants_1.prefixV2[pre];
|
|
288
|
-
const n = new Uint8Array(p.length + data.length);
|
|
289
|
-
n.set(p);
|
|
290
|
-
n.set(data, p.length);
|
|
291
|
-
return bs58check_1.default.encode((0, typedarray_to_buffer_1.default)(n));
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Parse binary public key and return Base58 representation
|
|
295
|
-
* @param value Binary key data
|
|
296
|
-
* @returns return prefixed public key
|
|
297
|
-
* @example encodeKey('02033aba7da4a2e7b5dd9f074555c118829aff16213ea1b65859686bd5fcfeaf3616') // return 'p2pk66xmhjiN7LpfrDGFwpxPtJxkLtPjQ6HUxJbKmRbxSR7RMpamDwi'
|
|
298
|
-
*/
|
|
299
|
-
function encodeKey(value) {
|
|
300
|
-
let buf;
|
|
301
|
-
if (typeof value === 'string') {
|
|
302
|
-
buf = hex2buf(value);
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
buf = value;
|
|
306
|
-
}
|
|
307
|
-
let pre;
|
|
308
|
-
switch (buf[0]) {
|
|
309
|
-
case 0:
|
|
310
|
-
pre = constants_1.PrefixV2.Ed25519PublicKey;
|
|
311
|
-
break;
|
|
312
|
-
case 1:
|
|
313
|
-
pre = constants_1.PrefixV2.Secp256k1PublicKey;
|
|
314
|
-
break;
|
|
315
|
-
case 2:
|
|
316
|
-
pre = constants_1.PrefixV2.P256PublicKey;
|
|
317
|
-
break;
|
|
318
|
-
case 3:
|
|
319
|
-
pre = constants_1.PrefixV2.BLS12_381PublicKey;
|
|
320
|
-
break;
|
|
321
|
-
default:
|
|
322
|
-
throw new Error('invalid address format');
|
|
323
|
-
}
|
|
324
|
-
return b58Encode(buf.slice(1), pre);
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Parse binary public key hash and return Base58 representation
|
|
328
|
-
* @param value Key hash to parse
|
|
329
|
-
* @returns return prefixed public key hash
|
|
330
|
-
* @example encodeKeyHash('0001907d6a7e9f084df840d6e67ffa8db5464f87d4d1') // return 'tz2MVED1t9Jery77Bwm1m5YhUx8Wp5KWWRQe'
|
|
331
|
-
*/
|
|
332
|
-
function encodeKeyHash(value) {
|
|
333
|
-
let buf;
|
|
334
|
-
if (typeof value === 'string') {
|
|
335
|
-
buf = hex2buf(value);
|
|
336
|
-
}
|
|
337
|
-
else {
|
|
338
|
-
buf = value;
|
|
339
|
-
}
|
|
340
|
-
let pre;
|
|
341
|
-
switch (buf[0]) {
|
|
342
|
-
case 0:
|
|
343
|
-
pre = constants_1.PrefixV2.Ed25519PublicKeyHash;
|
|
344
|
-
break;
|
|
345
|
-
case 1:
|
|
346
|
-
pre = constants_1.PrefixV2.Secp256k1PublicKeyHash;
|
|
347
|
-
break;
|
|
348
|
-
case 2:
|
|
349
|
-
pre = constants_1.PrefixV2.P256PublicKeyHash;
|
|
350
|
-
break;
|
|
351
|
-
case 3:
|
|
352
|
-
pre = constants_1.PrefixV2.BLS12_381PublicKeyHash;
|
|
353
|
-
break;
|
|
354
|
-
default:
|
|
355
|
-
throw new Error('invalid address format');
|
|
356
|
-
}
|
|
357
|
-
return b58Encode(buf.slice(1, 21), pre);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Parse binary Contract ID and return Base58 representation
|
|
361
|
-
* @param value Address to parse (tz1, tz2, tz3, KT1, or sr1).
|
|
362
|
-
* @example encodeAddress('0000e96b9f8b19af9c7ffa0c0480e1977b295850961f') // return 'tz1gvF4cD2dDtqitL3ZTraggSR1Mju2BKFEM'
|
|
363
|
-
*/
|
|
364
|
-
function encodeAddress(value) {
|
|
365
|
-
let buf;
|
|
366
|
-
if (typeof value === 'string') {
|
|
367
|
-
buf = hex2buf(value);
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
buf = value;
|
|
371
|
-
}
|
|
372
|
-
switch (buf[0]) {
|
|
373
|
-
case 0: // implicit
|
|
374
|
-
return encodeKeyHash(buf.slice(1));
|
|
375
|
-
case 1: // contract hash
|
|
376
|
-
return b58Encode(buf.slice(1, 21), constants_1.PrefixV2.ContractHash);
|
|
377
|
-
case 3: // smart rollup hash
|
|
378
|
-
return b58Encode(buf.slice(1, 21), constants_1.PrefixV2.SmartRollupHash);
|
|
379
|
-
case 4: // zk rollup hash
|
|
380
|
-
return b58Encode(buf.slice(1, 21), constants_1.PrefixV2.ZkRollupHash);
|
|
381
|
-
default:
|
|
382
|
-
throw new Error('invalid address format');
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Base58 encode an address without predefined prefix
|
|
387
|
-
* @param value Address to base58 encode (tz4) hex dec
|
|
388
|
-
* @returns return address
|
|
389
|
-
* @example encodeBlsAddress('af2dc3c40667abc0e89c0ef40171d22aed08d5eb') // return 'tz4QyWfEiv56CVDATV3DT3CDVhPaMKif2Ce8'
|
|
390
|
-
*/
|
|
391
|
-
function encodeBlsAddress(value) {
|
|
392
|
-
return b58Encode(value, constants_1.PrefixV2.BLS12_381PublicKeyHash);
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* convert a fragment of Michelson code in hex string to an 'expr' prefix + base58 encoded BLAKE2b hash string
|
|
396
|
-
* @param value a fragment of Michelson code in hex string
|
|
397
|
-
* @returns return 'expr' prefix + base58 encoded BLAKE2b hash
|
|
398
|
-
* @example encodeExpr('050a000000160000b2e19a9e74440d86c59f13dab8a18ff873e889ea') // return 'exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN'
|
|
399
|
-
*/
|
|
400
|
-
function encodeExpr(value) {
|
|
401
|
-
const blakeHash = (0, blake2_js_1.blake2b)(hex2buf(value), { dkLen: 32 });
|
|
402
|
-
return b58Encode(blakeHash, constants_1.PrefixV2.ScriptExpr);
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* convert a signed operation in hex string to an 'op' prefix + base58 encoded BLAKE2b hash string
|
|
406
|
-
* @param value signed operation in hex string
|
|
407
|
-
* @returns return 'op' prefix + base58 encoded BLAKE2b hash
|
|
408
|
-
* @example encodeOpHash('0f185d8a30061e8134c162dbb7a6c3ab8f5fdb153363ccd6149b49a33481156a6c00b2e19a9e74440d86c59f13dab8a18ff873e889eaa304ab05da13000001f1585a7384f36e45fb43dc37e8ce172bced3e05700ff0000000002002110c033f3a990c2e46a3d6054ecc2f74072aae7a34b5ac4d9ce9edc11c2410a97695682108951786f05b361da03b97245dc9897e1955e08b5b8d9e153b0bdeb0d') // return 'opapqvVXmebRTCFd2GQFydr4tJj3V5QocQuTmuhbatcHm4Seo2t'
|
|
409
|
-
*/
|
|
410
|
-
function encodeOpHash(value) {
|
|
411
|
-
const blakeHash = (0, blake2_js_1.blake2b)(hex2buf(value), { dkLen: 32 });
|
|
412
|
-
return b58Encode(blakeHash, constants_1.PrefixV2.OperationHash);
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Convert an hex string to a Uint8Array
|
|
416
|
-
* @param hex Hex string to convert
|
|
417
|
-
* @throws {@link ValueConversionError}
|
|
418
|
-
*/
|
|
419
|
-
function hex2buf(hex) {
|
|
420
|
-
hex = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
421
|
-
if (hex.length % 2 !== 0) {
|
|
422
|
-
throw new core_1.InvalidHexStringError(hex, `Expecting even number of characters`);
|
|
423
|
-
}
|
|
424
|
-
if (!hex.match(/^([\da-f]{2})*$/gi)) {
|
|
425
|
-
throw new core_1.InvalidHexStringError(hex, `Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'`);
|
|
426
|
-
}
|
|
427
|
-
const res = new Uint8Array(hex.length / 2);
|
|
428
|
-
let j = 0;
|
|
429
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
430
|
-
const ss = hex.slice(i, i + 2);
|
|
431
|
-
const x = parseInt(ss, 16);
|
|
432
|
-
if (Number.isNaN(x)) {
|
|
433
|
-
throw new core_1.InvalidHexStringError(hex, `Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'`);
|
|
434
|
-
}
|
|
435
|
-
res[j++] = x;
|
|
436
|
-
}
|
|
437
|
-
return res;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Merge 2 buffers together
|
|
441
|
-
* @param b1 First buffer
|
|
442
|
-
* @param b2 Second buffer
|
|
443
|
-
*/
|
|
444
|
-
function mergebuf(b1, b2) {
|
|
445
|
-
const r = new Uint8Array(b1.length + b2.length);
|
|
446
|
-
r.set(b1);
|
|
447
|
-
r.set(b2, b1.length);
|
|
448
|
-
return r;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Flatten a michelson json representation to an array
|
|
452
|
-
* @param s michelson json
|
|
453
|
-
*/
|
|
454
|
-
function mic2arr(s) {
|
|
455
|
-
let ret = [];
|
|
456
|
-
if (Object.prototype.hasOwnProperty.call(s, 'prim')) {
|
|
457
|
-
if (s.prim === 'Pair') {
|
|
458
|
-
ret.push(mic2arr(s.args[0]));
|
|
459
|
-
ret = ret.concat(mic2arr(s.args[1]));
|
|
460
|
-
}
|
|
461
|
-
else if (s.prim === 'Elt') {
|
|
462
|
-
ret = {
|
|
463
|
-
key: mic2arr(s.args[0]),
|
|
464
|
-
val: mic2arr(s.args[1]),
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
else if (s.prim === 'True') {
|
|
468
|
-
ret = true;
|
|
469
|
-
}
|
|
470
|
-
else if (s.prim === 'False') {
|
|
471
|
-
ret = false;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
else if (Array.isArray(s)) {
|
|
475
|
-
const sc = s.length;
|
|
476
|
-
for (let i = 0; i < sc; i++) {
|
|
477
|
-
const n = mic2arr(s[i]);
|
|
478
|
-
if (typeof n.key !== 'undefined') {
|
|
479
|
-
if (Array.isArray(ret)) {
|
|
480
|
-
ret = {
|
|
481
|
-
keys: [],
|
|
482
|
-
vals: [],
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
ret.keys.push(n.key);
|
|
486
|
-
ret.vals.push(n.val);
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
ret.push(n);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
else if (Object.prototype.hasOwnProperty.call(s, 'string')) {
|
|
494
|
-
ret = s.string;
|
|
495
|
-
}
|
|
496
|
-
else if (Object.prototype.hasOwnProperty.call(s, 'int')) {
|
|
497
|
-
ret = parseInt(s.int, 10);
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
ret = s;
|
|
501
|
-
}
|
|
502
|
-
return ret;
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Convert a Uint8Array to an hex string
|
|
506
|
-
* @param bytes Uint8Array to convert
|
|
507
|
-
*/
|
|
508
|
-
function buf2hex(bytes) {
|
|
509
|
-
return Array.from(bytes)
|
|
510
|
-
.map((x) => ((x >> 4) & 0xf).toString(16) + (x & 0xf).toString(16))
|
|
511
|
-
.join('');
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* Convert a string to a byte string representation
|
|
515
|
-
* @param str String to convert
|
|
516
|
-
*/
|
|
517
|
-
function stringToBytes(str) {
|
|
518
|
-
return buffer_1.Buffer.from(str, 'utf8').toString('hex');
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Convert byte string representation to string
|
|
522
|
-
* @param hex byte string to convert
|
|
523
|
-
*/
|
|
524
|
-
function bytesToString(hex) {
|
|
525
|
-
return buffer_1.Buffer.from(hex2buf(hex)).toString('utf8');
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Convert hex string/UintArray/Buffer to bytes
|
|
529
|
-
* @param hex String value to convert to bytes
|
|
530
|
-
*/
|
|
531
|
-
function hex2Bytes(hex) {
|
|
532
|
-
const hexDigits = stripHexPrefix(hex);
|
|
533
|
-
if (!hexDigits.match(/^(0x)?([\da-f]{2})*$/gi)) {
|
|
534
|
-
throw new core_1.InvalidHexStringError(hex, `Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x`);
|
|
535
|
-
}
|
|
536
|
-
return buffer_1.Buffer.from(hexDigits, 'hex');
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Converts a number or Bignumber to hexadecimal string
|
|
540
|
-
* @param val The value that will be converted to a hexadecimal string value
|
|
541
|
-
*/
|
|
542
|
-
function toHexBuf(val, bitLength = 8) {
|
|
543
|
-
return buffer_1.Buffer.from(num2PaddedHex(val, bitLength), 'hex');
|
|
544
|
-
}
|
|
545
|
-
function numToHexBuffer(val, bitLength = 8) {
|
|
546
|
-
return buffer_1.Buffer.from(num2PaddedHex(val, bitLength), 'hex');
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Converts a number or BigNumber to a padded hexadecimal string
|
|
550
|
-
* @param val The value that will be converted into a padded hexadecimal string value
|
|
551
|
-
* @param bitLength The length of bits
|
|
552
|
-
*
|
|
553
|
-
*/
|
|
554
|
-
function num2PaddedHex(val, bitLength = 8) {
|
|
555
|
-
if (new bignumber_js_1.default(val).isPositive()) {
|
|
556
|
-
const nibbleLength = Math.ceil(bitLength / 4);
|
|
557
|
-
const hex = val.toString(16);
|
|
558
|
-
// check whether nibble (4 bits) length is higher or lower than the current hex string length
|
|
559
|
-
let targetLength = hex.length >= nibbleLength ? hex.length : nibbleLength;
|
|
560
|
-
// make sure the hex string target length is even
|
|
561
|
-
targetLength = targetLength % 2 == 0 ? targetLength : targetLength + 1;
|
|
562
|
-
return padHexWithZero(hex, targetLength);
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
const twosCompliment = new bignumber_js_1.default(2)
|
|
566
|
-
.pow(bitLength)
|
|
567
|
-
.minus(new bignumber_js_1.default(val).abs());
|
|
568
|
-
return twosCompliment.toString(16);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
function padHexWithZero(hex, targetLength) {
|
|
572
|
-
const padString = '0';
|
|
573
|
-
if (hex.length >= targetLength) {
|
|
574
|
-
return hex;
|
|
575
|
-
}
|
|
576
|
-
else {
|
|
577
|
-
const padLength = targetLength - hex.length;
|
|
578
|
-
return padString.repeat(padLength) + hex;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
*
|
|
583
|
-
* Strips the first 2 characters of a hex string (0x)
|
|
584
|
-
*
|
|
585
|
-
* @param hex string to strip prefix from
|
|
586
|
-
*/
|
|
587
|
-
function stripHexPrefix(hex) {
|
|
588
|
-
return hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
589
|
-
}
|
|
590
|
-
function splitAddress(addr) {
|
|
591
|
-
const i = addr.indexOf('%');
|
|
592
|
-
if (i >= 0) {
|
|
593
|
-
return [addr.slice(0, i), addr.slice(i)];
|
|
594
|
-
}
|
|
595
|
-
else {
|
|
596
|
-
return [addr, null];
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
function compareArrays(a, b) {
|
|
600
|
-
let i = 0;
|
|
601
|
-
while (i < a.length && i < b.length && a[i] === b[i])
|
|
602
|
-
i++;
|
|
603
|
-
const aa = i < a.length ? a[i] : 0;
|
|
604
|
-
const bb = i < b.length ? b[i] : 0;
|
|
605
|
-
return aa < bb ? -1 : aa > bb ? 1 : 0;
|
|
606
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValueConversionError = exports.InvalidProtocolHashError = exports.ProhibitedActionError = exports.DeprecationError = exports.InvalidOperationKindError = exports.InvalidOperationHashError = exports.InvalidKeyHashError = exports.InvalidChainIdError = exports.InvalidContractAddressError = exports.InvalidSignatureError = exports.InvalidPublicKeyError = exports.InvalidKeyError = exports.InvalidMessageError = exports.InvalidHexStringError = exports.InvalidBlockHashError = exports.InvalidAddressError = void 0;
|
|
4
|
-
const core_1 = require("@taquito/core");
|
|
5
|
-
var core_2 = require("@taquito/core");
|
|
6
|
-
Object.defineProperty(exports, "InvalidAddressError", { enumerable: true, get: function () { return core_2.InvalidAddressError; } });
|
|
7
|
-
Object.defineProperty(exports, "InvalidBlockHashError", { enumerable: true, get: function () { return core_2.InvalidBlockHashError; } });
|
|
8
|
-
Object.defineProperty(exports, "InvalidHexStringError", { enumerable: true, get: function () { return core_2.InvalidHexStringError; } });
|
|
9
|
-
Object.defineProperty(exports, "InvalidMessageError", { enumerable: true, get: function () { return core_2.InvalidMessageError; } });
|
|
10
|
-
Object.defineProperty(exports, "InvalidKeyError", { enumerable: true, get: function () { return core_2.InvalidKeyError; } });
|
|
11
|
-
Object.defineProperty(exports, "InvalidPublicKeyError", { enumerable: true, get: function () { return core_2.InvalidPublicKeyError; } });
|
|
12
|
-
Object.defineProperty(exports, "InvalidSignatureError", { enumerable: true, get: function () { return core_2.InvalidSignatureError; } });
|
|
13
|
-
Object.defineProperty(exports, "InvalidContractAddressError", { enumerable: true, get: function () { return core_2.InvalidContractAddressError; } });
|
|
14
|
-
Object.defineProperty(exports, "InvalidChainIdError", { enumerable: true, get: function () { return core_2.InvalidChainIdError; } });
|
|
15
|
-
Object.defineProperty(exports, "InvalidKeyHashError", { enumerable: true, get: function () { return core_2.InvalidKeyHashError; } });
|
|
16
|
-
Object.defineProperty(exports, "InvalidOperationHashError", { enumerable: true, get: function () { return core_2.InvalidOperationHashError; } });
|
|
17
|
-
Object.defineProperty(exports, "InvalidOperationKindError", { enumerable: true, get: function () { return core_2.InvalidOperationKindError; } });
|
|
18
|
-
Object.defineProperty(exports, "DeprecationError", { enumerable: true, get: function () { return core_2.DeprecationError; } });
|
|
19
|
-
Object.defineProperty(exports, "ProhibitedActionError", { enumerable: true, get: function () { return core_2.ProhibitedActionError; } });
|
|
20
|
-
/**
|
|
21
|
-
* @category Error
|
|
22
|
-
* Error that indicates invalid protocol hash being passed or used
|
|
23
|
-
*/
|
|
24
|
-
class InvalidProtocolHashError extends core_1.ParameterValidationError {
|
|
25
|
-
constructor(protocolHash, errorDetails) {
|
|
26
|
-
super(`The protocol hash '${protocolHash}' is invalid`, errorDetails);
|
|
27
|
-
this.protocolHash = protocolHash;
|
|
28
|
-
this.name = 'InvalidProtocolHashError';
|
|
29
|
-
this.name = this.constructor.name;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.InvalidProtocolHashError = InvalidProtocolHashError;
|
|
33
|
-
/**
|
|
34
|
-
* @category Error
|
|
35
|
-
* Error that indicates unable to convert data type from one to another
|
|
36
|
-
*/
|
|
37
|
-
class ValueConversionError extends core_1.UnsupportedActionError {
|
|
38
|
-
constructor(value, desiredType) {
|
|
39
|
-
super(`Unable to convert ${value} to a ${desiredType}`);
|
|
40
|
-
this.value = value;
|
|
41
|
-
this.desiredType = desiredType;
|
|
42
|
-
this.name = this.constructor.name;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.ValueConversionError = ValueConversionError;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.format = format;
|
|
7
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
-
const TZ_DECIMALS = 6;
|
|
9
|
-
const MTZ_DECIMALS = 3;
|
|
10
|
-
function getDecimal(format) {
|
|
11
|
-
switch (format) {
|
|
12
|
-
case 'tz':
|
|
13
|
-
return TZ_DECIMALS;
|
|
14
|
-
case 'mtz':
|
|
15
|
-
return MTZ_DECIMALS;
|
|
16
|
-
case 'mutez':
|
|
17
|
-
default:
|
|
18
|
-
return 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function format(from = 'mutez', to = 'mutez', amount) {
|
|
22
|
-
const bigNum = new bignumber_js_1.default(amount);
|
|
23
|
-
if (bigNum.isNaN()) {
|
|
24
|
-
return amount;
|
|
25
|
-
}
|
|
26
|
-
return bigNum
|
|
27
|
-
.multipliedBy(Math.pow(10, getDecimal(from)))
|
|
28
|
-
.dividedBy(Math.pow(10, getDecimal(to)));
|
|
29
|
-
}
|