@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,833 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MichelsonValidationError = exports.instructionIDs = void 0;
|
|
4
|
-
exports.assertMichelsonInstruction = assertMichelsonInstruction;
|
|
5
|
-
exports.assertMichelsonComparableType = assertMichelsonComparableType;
|
|
6
|
-
exports.assertMichelsonPackableType = assertMichelsonPackableType;
|
|
7
|
-
exports.assertMichelsonPushableType = assertMichelsonPushableType;
|
|
8
|
-
exports.assertMichelsonStorableType = assertMichelsonStorableType;
|
|
9
|
-
exports.assertMichelsonPassableType = assertMichelsonPassableType;
|
|
10
|
-
exports.assertMichelsonBigMapStorableType = assertMichelsonBigMapStorableType;
|
|
11
|
-
exports.assertViewNameValid = assertViewNameValid;
|
|
12
|
-
exports.assertMichelsonType = assertMichelsonType;
|
|
13
|
-
exports.assertMichelsonData = assertMichelsonData;
|
|
14
|
-
exports.assertMichelsonContract = assertMichelsonContract;
|
|
15
|
-
exports.isMichelsonScript = isMichelsonScript;
|
|
16
|
-
exports.isMichelsonData = isMichelsonData;
|
|
17
|
-
exports.isMichelsonCode = isMichelsonCode;
|
|
18
|
-
exports.isMichelsonType = isMichelsonType;
|
|
19
|
-
exports.isInstruction = isInstruction;
|
|
20
|
-
exports.assertDataListIfAny = assertDataListIfAny;
|
|
21
|
-
const utils_1 = require("./utils");
|
|
22
|
-
// Michelson validator
|
|
23
|
-
const maxViewNameLength = 31;
|
|
24
|
-
const noArgInstructionIDs = {
|
|
25
|
-
ABS: true,
|
|
26
|
-
ADD: true,
|
|
27
|
-
ADDRESS: true,
|
|
28
|
-
AMOUNT: true,
|
|
29
|
-
AND: true,
|
|
30
|
-
APPLY: true,
|
|
31
|
-
BALANCE: true,
|
|
32
|
-
BLAKE2B: true,
|
|
33
|
-
CAR: true,
|
|
34
|
-
CDR: true,
|
|
35
|
-
CHAIN_ID: true,
|
|
36
|
-
CHECK_SIGNATURE: true,
|
|
37
|
-
COMPARE: true,
|
|
38
|
-
CONCAT: true,
|
|
39
|
-
CONS: true,
|
|
40
|
-
EDIV: true,
|
|
41
|
-
EQ: true,
|
|
42
|
-
EXEC: true,
|
|
43
|
-
FAILWITH: true,
|
|
44
|
-
GE: true,
|
|
45
|
-
GET_AND_UPDATE: true,
|
|
46
|
-
GT: true,
|
|
47
|
-
HASH_KEY: true,
|
|
48
|
-
IMPLICIT_ACCOUNT: true,
|
|
49
|
-
INT: true,
|
|
50
|
-
ISNAT: true,
|
|
51
|
-
JOIN_TICKETS: true,
|
|
52
|
-
KECCAK: true,
|
|
53
|
-
LE: true,
|
|
54
|
-
LEVEL: true,
|
|
55
|
-
LSL: true,
|
|
56
|
-
LSR: true,
|
|
57
|
-
LT: true,
|
|
58
|
-
MEM: true,
|
|
59
|
-
MUL: true,
|
|
60
|
-
NEG: true,
|
|
61
|
-
NEQ: true,
|
|
62
|
-
NEVER: true,
|
|
63
|
-
NOT: true,
|
|
64
|
-
NOW: true,
|
|
65
|
-
OR: true,
|
|
66
|
-
PACK: true,
|
|
67
|
-
PAIRING_CHECK: true,
|
|
68
|
-
READ_TICKET: true,
|
|
69
|
-
SAPLING_VERIFY_UPDATE: true,
|
|
70
|
-
SELF: true,
|
|
71
|
-
SELF_ADDRESS: true,
|
|
72
|
-
SENDER: true,
|
|
73
|
-
SET_DELEGATE: true,
|
|
74
|
-
SHA256: true,
|
|
75
|
-
SHA3: true,
|
|
76
|
-
SHA512: true,
|
|
77
|
-
SIZE: true,
|
|
78
|
-
SLICE: true,
|
|
79
|
-
SOME: true,
|
|
80
|
-
SOURCE: true,
|
|
81
|
-
SPLIT_TICKET: true,
|
|
82
|
-
SUB: true,
|
|
83
|
-
SWAP: true,
|
|
84
|
-
TICKET: true,
|
|
85
|
-
TICKET_DEPRECATED: true,
|
|
86
|
-
TOTAL_VOTING_POWER: true,
|
|
87
|
-
TRANSFER_TOKENS: true,
|
|
88
|
-
UNIT: true,
|
|
89
|
-
VOTING_POWER: true,
|
|
90
|
-
XOR: true,
|
|
91
|
-
RENAME: true,
|
|
92
|
-
OPEN_CHEST: true,
|
|
93
|
-
SUB_MUTEZ: true,
|
|
94
|
-
MIN_BLOCK_TIME: true,
|
|
95
|
-
BYTES: true,
|
|
96
|
-
NAT: true,
|
|
97
|
-
IS_IMPLICIT_ACCOUNT: true,
|
|
98
|
-
INDEX_ADDRESS: true,
|
|
99
|
-
GET_ADDRESS_INDEX: true,
|
|
100
|
-
};
|
|
101
|
-
exports.instructionIDs = Object.assign({}, noArgInstructionIDs, {
|
|
102
|
-
CONTRACT: true,
|
|
103
|
-
CREATE_CONTRACT: true,
|
|
104
|
-
DIG: true,
|
|
105
|
-
DIP: true,
|
|
106
|
-
DROP: true,
|
|
107
|
-
DUG: true,
|
|
108
|
-
DUP: true,
|
|
109
|
-
EMIT: true,
|
|
110
|
-
EMPTY_BIG_MAP: true,
|
|
111
|
-
EMPTY_MAP: true,
|
|
112
|
-
EMPTY_SET: true,
|
|
113
|
-
GET: true,
|
|
114
|
-
IF: true,
|
|
115
|
-
IF_CONS: true,
|
|
116
|
-
IF_LEFT: true,
|
|
117
|
-
IF_NONE: true,
|
|
118
|
-
ITER: true,
|
|
119
|
-
LAMBDA: true,
|
|
120
|
-
LAMBDA_REC: true,
|
|
121
|
-
LEFT: true,
|
|
122
|
-
LOOP: true,
|
|
123
|
-
LOOP_LEFT: true,
|
|
124
|
-
MAP: true,
|
|
125
|
-
NIL: true,
|
|
126
|
-
NONE: true,
|
|
127
|
-
PAIR: true,
|
|
128
|
-
PUSH: true,
|
|
129
|
-
RIGHT: true,
|
|
130
|
-
SAPLING_EMPTY_STATE: true,
|
|
131
|
-
UNPACK: true,
|
|
132
|
-
UNPAIR: true,
|
|
133
|
-
UPDATE: true,
|
|
134
|
-
CAST: true,
|
|
135
|
-
VIEW: true,
|
|
136
|
-
});
|
|
137
|
-
const simpleComparableTypeIDs = {
|
|
138
|
-
unit: true,
|
|
139
|
-
never: true,
|
|
140
|
-
bool: true,
|
|
141
|
-
int: true,
|
|
142
|
-
nat: true,
|
|
143
|
-
string: true,
|
|
144
|
-
chain_id: true,
|
|
145
|
-
bytes: true,
|
|
146
|
-
mutez: true,
|
|
147
|
-
key_hash: true,
|
|
148
|
-
key: true,
|
|
149
|
-
signature: true,
|
|
150
|
-
timestamp: true,
|
|
151
|
-
address: true,
|
|
152
|
-
tx_rollup_l2_address: true,
|
|
153
|
-
};
|
|
154
|
-
const typeIDs = Object.assign({}, simpleComparableTypeIDs, {
|
|
155
|
-
or: true,
|
|
156
|
-
pair: true,
|
|
157
|
-
set: true,
|
|
158
|
-
big_map: true,
|
|
159
|
-
contract: true,
|
|
160
|
-
lambda: true,
|
|
161
|
-
list: true,
|
|
162
|
-
map: true,
|
|
163
|
-
operation: true,
|
|
164
|
-
option: true,
|
|
165
|
-
bls12_381_g1: true,
|
|
166
|
-
bls12_381_g2: true,
|
|
167
|
-
bls12_381_fr: true,
|
|
168
|
-
sapling_transaction: true,
|
|
169
|
-
sapling_transaction_deprecated: true,
|
|
170
|
-
sapling_state: true,
|
|
171
|
-
ticket: true,
|
|
172
|
-
chest_key: true,
|
|
173
|
-
chest: true,
|
|
174
|
-
});
|
|
175
|
-
class MichelsonValidationError extends utils_1.MichelsonError {
|
|
176
|
-
/**
|
|
177
|
-
* @param val Value of a node caused the error
|
|
178
|
-
* @param message An error message
|
|
179
|
-
*/
|
|
180
|
-
constructor(val, message) {
|
|
181
|
-
super(val, message);
|
|
182
|
-
this.val = val;
|
|
183
|
-
this.message = message;
|
|
184
|
-
this.name = 'MichelsonValidationError';
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
exports.MichelsonValidationError = MichelsonValidationError;
|
|
188
|
-
function isPrim(ex) {
|
|
189
|
-
return 'prim' in ex;
|
|
190
|
-
}
|
|
191
|
-
function isPrimOrSeq(ex) {
|
|
192
|
-
return Array.isArray(ex) || 'prim' in ex;
|
|
193
|
-
}
|
|
194
|
-
function assertPrim(ex) {
|
|
195
|
-
if (isPrim(ex)) {
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
throw new MichelsonValidationError(ex, 'prim expression expected');
|
|
199
|
-
}
|
|
200
|
-
function assertSeq(ex) {
|
|
201
|
-
if (Array.isArray(ex)) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
throw new MichelsonValidationError(ex, 'sequence expression expected');
|
|
205
|
-
}
|
|
206
|
-
function assertPrimOrSeq(ex) {
|
|
207
|
-
if (isPrimOrSeq(ex)) {
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
|
-
throw new MichelsonValidationError(ex, 'prim or sequence expression expected');
|
|
211
|
-
}
|
|
212
|
-
function assertNatural(i) {
|
|
213
|
-
if (i.int[0] === '-') {
|
|
214
|
-
throw new MichelsonValidationError(i, 'natural number expected');
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function assertIntLiteral(ex) {
|
|
218
|
-
if ('int' in ex) {
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
throw new MichelsonValidationError(ex, 'int literal expected');
|
|
222
|
-
}
|
|
223
|
-
function assertStringLiteral(ex) {
|
|
224
|
-
if ('string' in ex) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
throw new MichelsonValidationError(ex, 'string literal expected');
|
|
228
|
-
}
|
|
229
|
-
// usually an address
|
|
230
|
-
function assertStringOrBytes(ex) {
|
|
231
|
-
if ('string' in ex || 'bytes' in ex) {
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
throw new MichelsonValidationError(ex, 'string or bytes literal expected');
|
|
235
|
-
}
|
|
236
|
-
function assertArgs(ex, n) {
|
|
237
|
-
if ((n === 0 && ex.args === undefined) || ex.args?.length === n) {
|
|
238
|
-
return true;
|
|
239
|
-
}
|
|
240
|
-
throw new MichelsonValidationError(ex, `${n} arguments expected`);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Checks if the node is a valid Michelson code (sequence of instructions).
|
|
244
|
-
* This is a type guard function which either returns true of throws an exception.
|
|
245
|
-
* @param ex An AST node
|
|
246
|
-
*/
|
|
247
|
-
function assertMichelsonInstruction(ex) {
|
|
248
|
-
if (Array.isArray(ex)) {
|
|
249
|
-
for (const n of ex) {
|
|
250
|
-
if (!Array.isArray(n) && !isPrim(n)) {
|
|
251
|
-
throw new MichelsonValidationError(ex, 'sequence or prim expected');
|
|
252
|
-
}
|
|
253
|
-
assertMichelsonInstruction(n);
|
|
254
|
-
}
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
|
-
if (assertPrim(ex)) {
|
|
258
|
-
if (Object.prototype.hasOwnProperty.call(noArgInstructionIDs, ex.prim)) {
|
|
259
|
-
assertArgs(ex, 0);
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
switch (ex.prim) {
|
|
263
|
-
case 'DROP':
|
|
264
|
-
case 'PAIR':
|
|
265
|
-
case 'UNPAIR':
|
|
266
|
-
case 'DUP':
|
|
267
|
-
case 'UPDATE':
|
|
268
|
-
case 'GET':
|
|
269
|
-
if (ex.args !== undefined && assertArgs(ex, 1)) {
|
|
270
|
-
/* istanbul ignore else */
|
|
271
|
-
if (assertIntLiteral(ex.args[0])) {
|
|
272
|
-
assertNatural(ex.args[0]);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
break;
|
|
276
|
-
case 'DIG':
|
|
277
|
-
case 'DUG':
|
|
278
|
-
case 'SAPLING_EMPTY_STATE':
|
|
279
|
-
/* istanbul ignore else */
|
|
280
|
-
if (assertArgs(ex, 1)) {
|
|
281
|
-
/* istanbul ignore else */
|
|
282
|
-
if (assertIntLiteral(ex.args[0])) {
|
|
283
|
-
assertNatural(ex.args[0]);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
break;
|
|
287
|
-
case 'NONE':
|
|
288
|
-
case 'LEFT':
|
|
289
|
-
case 'RIGHT':
|
|
290
|
-
case 'NIL':
|
|
291
|
-
case 'CAST':
|
|
292
|
-
/* istanbul ignore else */
|
|
293
|
-
if (assertArgs(ex, 1)) {
|
|
294
|
-
assertMichelsonType(ex.args[0]);
|
|
295
|
-
}
|
|
296
|
-
break;
|
|
297
|
-
case 'UNPACK':
|
|
298
|
-
/* istanbul ignore else */
|
|
299
|
-
if (assertArgs(ex, 1)) {
|
|
300
|
-
assertMichelsonPackableType(ex.args[0]);
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
case 'CONTRACT':
|
|
304
|
-
/* istanbul ignore else */
|
|
305
|
-
if (assertArgs(ex, 1)) {
|
|
306
|
-
assertMichelsonPassableType(ex.args[0]);
|
|
307
|
-
}
|
|
308
|
-
break;
|
|
309
|
-
case 'IF_NONE':
|
|
310
|
-
case 'IF_LEFT':
|
|
311
|
-
case 'IF_CONS':
|
|
312
|
-
case 'IF':
|
|
313
|
-
/* istanbul ignore else */
|
|
314
|
-
if (assertArgs(ex, 2)) {
|
|
315
|
-
/* istanbul ignore else */
|
|
316
|
-
if (assertSeq(ex.args[0])) {
|
|
317
|
-
assertMichelsonInstruction(ex.args[0]);
|
|
318
|
-
}
|
|
319
|
-
/* istanbul ignore else */
|
|
320
|
-
if (assertSeq(ex.args[1])) {
|
|
321
|
-
assertMichelsonInstruction(ex.args[1]);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
break;
|
|
325
|
-
case 'MAP':
|
|
326
|
-
case 'ITER':
|
|
327
|
-
case 'LOOP':
|
|
328
|
-
case 'LOOP_LEFT':
|
|
329
|
-
/* istanbul ignore else */
|
|
330
|
-
if (assertArgs(ex, 1)) {
|
|
331
|
-
assertMichelsonInstruction(ex.args[0]);
|
|
332
|
-
}
|
|
333
|
-
break;
|
|
334
|
-
case 'CREATE_CONTRACT':
|
|
335
|
-
/* istanbul ignore else */
|
|
336
|
-
if (assertArgs(ex, 1)) {
|
|
337
|
-
assertMichelsonContract(ex.args[0]);
|
|
338
|
-
}
|
|
339
|
-
break;
|
|
340
|
-
case 'DIP':
|
|
341
|
-
if (ex.args?.length === 2) {
|
|
342
|
-
/* istanbul ignore else */
|
|
343
|
-
if (assertIntLiteral(ex.args[0])) {
|
|
344
|
-
assertNatural(ex.args[0]);
|
|
345
|
-
}
|
|
346
|
-
/* istanbul ignore else */
|
|
347
|
-
if (assertSeq(ex.args[1])) {
|
|
348
|
-
assertMichelsonInstruction(ex.args[1]);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
else if (ex.args?.length === 1) {
|
|
352
|
-
/* istanbul ignore else */
|
|
353
|
-
if (assertSeq(ex.args[0])) {
|
|
354
|
-
assertMichelsonInstruction(ex.args[0]);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
throw new MichelsonValidationError(ex, '1 or 2 arguments expected');
|
|
359
|
-
}
|
|
360
|
-
break;
|
|
361
|
-
case 'PUSH':
|
|
362
|
-
/* istanbul ignore else */
|
|
363
|
-
if (assertArgs(ex, 2)) {
|
|
364
|
-
assertMichelsonPushableType(ex.args[0]);
|
|
365
|
-
assertMichelsonData(ex.args[1]);
|
|
366
|
-
}
|
|
367
|
-
break;
|
|
368
|
-
case 'EMPTY_SET':
|
|
369
|
-
/* istanbul ignore else */
|
|
370
|
-
if (assertArgs(ex, 1)) {
|
|
371
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
372
|
-
}
|
|
373
|
-
break;
|
|
374
|
-
case 'EMPTY_MAP':
|
|
375
|
-
/* istanbul ignore else */
|
|
376
|
-
if (assertArgs(ex, 2)) {
|
|
377
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
378
|
-
assertMichelsonType(ex.args[1]);
|
|
379
|
-
}
|
|
380
|
-
break;
|
|
381
|
-
case 'EMPTY_BIG_MAP':
|
|
382
|
-
/* istanbul ignore else */
|
|
383
|
-
if (assertArgs(ex, 2)) {
|
|
384
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
385
|
-
assertMichelsonBigMapStorableType(ex.args[1]);
|
|
386
|
-
}
|
|
387
|
-
break;
|
|
388
|
-
case 'LAMBDA_REC':
|
|
389
|
-
case 'LAMBDA':
|
|
390
|
-
/* istanbul ignore else */
|
|
391
|
-
if (assertArgs(ex, 3)) {
|
|
392
|
-
assertMichelsonType(ex.args[0]);
|
|
393
|
-
assertMichelsonType(ex.args[1]);
|
|
394
|
-
/* istanbul ignore else */
|
|
395
|
-
if (assertSeq(ex.args[2])) {
|
|
396
|
-
assertMichelsonInstruction(ex.args[2]);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
break;
|
|
400
|
-
case 'VIEW':
|
|
401
|
-
/* istanbul ignore else */
|
|
402
|
-
if (assertArgs(ex, 2)) {
|
|
403
|
-
if (assertStringLiteral(ex.args[0])) {
|
|
404
|
-
assertViewNameValid(ex.args[0]);
|
|
405
|
-
}
|
|
406
|
-
if (assertMichelsonType(ex.args[1])) {
|
|
407
|
-
assertMichelsonPushableType(ex.args[1]);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
break;
|
|
411
|
-
case 'EMIT':
|
|
412
|
-
if (ex.args && ex.args.length > 0) {
|
|
413
|
-
assertArgs(ex, 1);
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
assertArgs(ex, 0);
|
|
417
|
-
}
|
|
418
|
-
break;
|
|
419
|
-
default:
|
|
420
|
-
throw new MichelsonValidationError(ex, 'instruction expected');
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return true;
|
|
424
|
-
}
|
|
425
|
-
function assertMichelsonComparableType(ex) {
|
|
426
|
-
/* istanbul ignore else */
|
|
427
|
-
if (assertPrimOrSeq(ex)) {
|
|
428
|
-
if (Array.isArray(ex) || ex.prim === 'pair' || ex.prim === 'or' || ex.prim === 'option') {
|
|
429
|
-
traverseType(ex, (ex) => assertMichelsonComparableType(ex));
|
|
430
|
-
}
|
|
431
|
-
else if (!Object.prototype.hasOwnProperty.call(simpleComparableTypeIDs, ex.prim)) {
|
|
432
|
-
throw new MichelsonValidationError(ex, `${ex.prim}: type is not comparable`);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
return true;
|
|
436
|
-
}
|
|
437
|
-
function assertMichelsonPackableType(ex) {
|
|
438
|
-
/* istanbul ignore else */
|
|
439
|
-
if (assertPrimOrSeq(ex)) {
|
|
440
|
-
if (isPrim(ex)) {
|
|
441
|
-
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
|
|
442
|
-
ex.prim === 'big_map' ||
|
|
443
|
-
ex.prim === 'operation' ||
|
|
444
|
-
ex.prim === 'sapling_state' ||
|
|
445
|
-
ex.prim === 'ticket') {
|
|
446
|
-
throw new MichelsonValidationError(ex, `${ex.prim}: type can't be used inside PACK/UNPACK instructions`);
|
|
447
|
-
}
|
|
448
|
-
traverseType(ex, (ex) => assertMichelsonPackableType(ex));
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
return true;
|
|
452
|
-
}
|
|
453
|
-
function assertMichelsonPushableType(ex) {
|
|
454
|
-
/* istanbul ignore else */
|
|
455
|
-
if (assertPrimOrSeq(ex)) {
|
|
456
|
-
if (isPrim(ex)) {
|
|
457
|
-
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
|
|
458
|
-
ex.prim === 'big_map' ||
|
|
459
|
-
ex.prim === 'operation' ||
|
|
460
|
-
ex.prim === 'sapling_state' ||
|
|
461
|
-
ex.prim === 'ticket' ||
|
|
462
|
-
ex.prim === 'contract') {
|
|
463
|
-
throw new MichelsonValidationError(ex, `${ex.prim}: type can't be pushed`);
|
|
464
|
-
}
|
|
465
|
-
traverseType(ex, (ex) => assertMichelsonPushableType(ex));
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
function assertMichelsonStorableType(ex) {
|
|
471
|
-
/* istanbul ignore else */
|
|
472
|
-
if (assertPrimOrSeq(ex)) {
|
|
473
|
-
if (isPrim(ex)) {
|
|
474
|
-
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
|
|
475
|
-
ex.prim === 'operation' ||
|
|
476
|
-
ex.prim === 'contract') {
|
|
477
|
-
throw new MichelsonValidationError(ex, `${ex.prim}: type can't be used as part of a storage`);
|
|
478
|
-
}
|
|
479
|
-
traverseType(ex, (ex) => assertMichelsonStorableType(ex));
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
return true;
|
|
483
|
-
}
|
|
484
|
-
function assertMichelsonPassableType(ex) {
|
|
485
|
-
/* istanbul ignore else */
|
|
486
|
-
if (assertPrimOrSeq(ex)) {
|
|
487
|
-
if (isPrim(ex)) {
|
|
488
|
-
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) || ex.prim === 'operation') {
|
|
489
|
-
throw new MichelsonValidationError(ex, `${ex.prim}: type can't be used as part of a parameter`);
|
|
490
|
-
}
|
|
491
|
-
traverseType(ex, (ex) => assertMichelsonPassableType(ex));
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return true;
|
|
495
|
-
}
|
|
496
|
-
function assertMichelsonBigMapStorableType(ex) {
|
|
497
|
-
/* istanbul ignore else */
|
|
498
|
-
if (assertPrimOrSeq(ex)) {
|
|
499
|
-
if (isPrim(ex)) {
|
|
500
|
-
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
|
|
501
|
-
ex.prim === 'big_map' ||
|
|
502
|
-
ex.prim === 'operation' ||
|
|
503
|
-
ex.prim === 'sapling_state') {
|
|
504
|
-
throw new MichelsonValidationError(ex, `${ex.prim}: type can't be used inside a big_map`);
|
|
505
|
-
}
|
|
506
|
-
traverseType(ex, (ex) => assertMichelsonBigMapStorableType(ex));
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
const viewRe = new RegExp('^[a-zA-Z0-9_.%@]*$');
|
|
512
|
-
function assertViewNameValid(name) {
|
|
513
|
-
if (name.string.length > maxViewNameLength) {
|
|
514
|
-
throw new MichelsonValidationError(name, `view name too long: ${name.string}`);
|
|
515
|
-
}
|
|
516
|
-
if (!viewRe.test(name.string)) {
|
|
517
|
-
throw new MichelsonValidationError(name, `invalid character(s) in view name: ${name.string}`);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Checks if the node is a valid Michelson type expression.
|
|
522
|
-
* This is a type guard function which either returns true of throws an exception.
|
|
523
|
-
* @param ex An AST node
|
|
524
|
-
*/
|
|
525
|
-
function assertMichelsonType(ex) {
|
|
526
|
-
/* istanbul ignore else */
|
|
527
|
-
if (assertPrimOrSeq(ex)) {
|
|
528
|
-
if (isPrim(ex)) {
|
|
529
|
-
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim)) {
|
|
530
|
-
throw new MichelsonValidationError(ex, 'type expected');
|
|
531
|
-
}
|
|
532
|
-
traverseType(ex, (ex) => assertMichelsonType(ex));
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
return true;
|
|
536
|
-
}
|
|
537
|
-
function traverseType(ex, cb) {
|
|
538
|
-
if (Array.isArray(ex) || ex.prim === 'pair') {
|
|
539
|
-
const args = Array.isArray(ex) ? ex : ex.args;
|
|
540
|
-
if (args === undefined || args.length < 2) {
|
|
541
|
-
throw new MichelsonValidationError(ex, 'at least 2 arguments expected');
|
|
542
|
-
}
|
|
543
|
-
args.forEach((a) => {
|
|
544
|
-
if (assertPrimOrSeq(a)) {
|
|
545
|
-
cb(a);
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
return true;
|
|
549
|
-
}
|
|
550
|
-
switch (ex.prim) {
|
|
551
|
-
case 'option':
|
|
552
|
-
case 'list':
|
|
553
|
-
/* istanbul ignore else */
|
|
554
|
-
if (assertArgs(ex, 1) && assertPrimOrSeq(ex.args[0])) {
|
|
555
|
-
cb(ex.args[0]);
|
|
556
|
-
}
|
|
557
|
-
break;
|
|
558
|
-
case 'contract':
|
|
559
|
-
/* istanbul ignore else */
|
|
560
|
-
if (assertArgs(ex, 1)) {
|
|
561
|
-
assertMichelsonPassableType(ex.args[0]);
|
|
562
|
-
}
|
|
563
|
-
break;
|
|
564
|
-
case 'or':
|
|
565
|
-
/* istanbul ignore else */
|
|
566
|
-
if (assertArgs(ex, 2) && assertPrimOrSeq(ex.args[0]) && assertPrimOrSeq(ex.args[1])) {
|
|
567
|
-
cb(ex.args[0]);
|
|
568
|
-
cb(ex.args[1]);
|
|
569
|
-
}
|
|
570
|
-
break;
|
|
571
|
-
case 'lambda':
|
|
572
|
-
/* istanbul ignore else */
|
|
573
|
-
if (assertArgs(ex, 2)) {
|
|
574
|
-
assertMichelsonType(ex.args[0]);
|
|
575
|
-
assertMichelsonType(ex.args[1]);
|
|
576
|
-
}
|
|
577
|
-
break;
|
|
578
|
-
case 'set':
|
|
579
|
-
/* istanbul ignore else */
|
|
580
|
-
if (assertArgs(ex, 1)) {
|
|
581
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
582
|
-
}
|
|
583
|
-
break;
|
|
584
|
-
case 'map':
|
|
585
|
-
/* istanbul ignore else */
|
|
586
|
-
if (assertArgs(ex, 2) && assertPrimOrSeq(ex.args[0]) && assertPrimOrSeq(ex.args[1])) {
|
|
587
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
588
|
-
cb(ex.args[1]);
|
|
589
|
-
}
|
|
590
|
-
break;
|
|
591
|
-
case 'big_map':
|
|
592
|
-
/* istanbul ignore else */
|
|
593
|
-
if (assertArgs(ex, 2) && assertPrimOrSeq(ex.args[0]) && assertPrimOrSeq(ex.args[1])) {
|
|
594
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
595
|
-
assertMichelsonBigMapStorableType(ex.args[1]);
|
|
596
|
-
cb(ex.args[1]);
|
|
597
|
-
}
|
|
598
|
-
break;
|
|
599
|
-
case 'ticket':
|
|
600
|
-
/* istanbul ignore else */
|
|
601
|
-
if (assertArgs(ex, 1) && assertPrimOrSeq(ex.args[0])) {
|
|
602
|
-
assertMichelsonComparableType(ex.args[0]);
|
|
603
|
-
}
|
|
604
|
-
break;
|
|
605
|
-
case 'sapling_state':
|
|
606
|
-
case 'sapling_transaction':
|
|
607
|
-
if (assertArgs(ex, 1)) {
|
|
608
|
-
assertIntLiteral(ex.args[0]);
|
|
609
|
-
}
|
|
610
|
-
break;
|
|
611
|
-
default:
|
|
612
|
-
assertArgs(ex, 0);
|
|
613
|
-
}
|
|
614
|
-
return true;
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Checks if the node is a valid Michelson data literal such as `(Pair {Elt "0" 0} 0)`.
|
|
618
|
-
* This is a type guard function which either returns true of throws an exception.
|
|
619
|
-
* @param ex An AST node
|
|
620
|
-
*/
|
|
621
|
-
function assertMichelsonData(ex) {
|
|
622
|
-
if ('int' in ex || 'string' in ex || 'bytes' in ex) {
|
|
623
|
-
return true;
|
|
624
|
-
}
|
|
625
|
-
if (Array.isArray(ex)) {
|
|
626
|
-
let mapElts = 0;
|
|
627
|
-
for (const n of ex) {
|
|
628
|
-
if (isPrim(n) && n.prim === 'Elt') {
|
|
629
|
-
/* istanbul ignore else */
|
|
630
|
-
if (assertArgs(n, 2)) {
|
|
631
|
-
assertMichelsonData(n.args[0]);
|
|
632
|
-
assertMichelsonData(n.args[1]);
|
|
633
|
-
}
|
|
634
|
-
mapElts++;
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
assertMichelsonData(n);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
if (mapElts !== 0 && mapElts !== ex.length) {
|
|
641
|
-
throw new MichelsonValidationError(ex, "data entries and map elements can't be intermixed");
|
|
642
|
-
}
|
|
643
|
-
return true;
|
|
644
|
-
}
|
|
645
|
-
if (isPrim(ex)) {
|
|
646
|
-
switch (ex.prim) {
|
|
647
|
-
case 'Unit':
|
|
648
|
-
case 'True':
|
|
649
|
-
case 'False':
|
|
650
|
-
case 'None':
|
|
651
|
-
assertArgs(ex, 0);
|
|
652
|
-
break;
|
|
653
|
-
case 'Pair':
|
|
654
|
-
/* istanbul ignore else */
|
|
655
|
-
if (ex.args === undefined || ex.args.length < 2) {
|
|
656
|
-
throw new MichelsonValidationError(ex, 'at least 2 arguments expected');
|
|
657
|
-
}
|
|
658
|
-
for (const a of ex.args) {
|
|
659
|
-
assertMichelsonData(a);
|
|
660
|
-
}
|
|
661
|
-
break;
|
|
662
|
-
case 'Left':
|
|
663
|
-
case 'Right':
|
|
664
|
-
case 'Some':
|
|
665
|
-
/* istanbul ignore else */
|
|
666
|
-
if (assertArgs(ex, 1)) {
|
|
667
|
-
assertMichelsonData(ex.args[0]);
|
|
668
|
-
}
|
|
669
|
-
break;
|
|
670
|
-
case 'Lambda_rec':
|
|
671
|
-
if (ex.args) {
|
|
672
|
-
assertMichelsonInstruction(ex.args);
|
|
673
|
-
}
|
|
674
|
-
break;
|
|
675
|
-
case 'Ticket':
|
|
676
|
-
if (assertArgs(ex, 4)) {
|
|
677
|
-
assertStringOrBytes(ex.args[0]);
|
|
678
|
-
assertMichelsonType(ex.args[1]);
|
|
679
|
-
assertMichelsonData(ex.args[2]);
|
|
680
|
-
assertIntLiteral(ex.args[3]);
|
|
681
|
-
}
|
|
682
|
-
break;
|
|
683
|
-
default:
|
|
684
|
-
if (Object.prototype.hasOwnProperty.call(exports.instructionIDs, ex.prim)) {
|
|
685
|
-
assertMichelsonInstruction(ex);
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
throw new MichelsonValidationError(ex, 'data entry or instruction expected');
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
else {
|
|
693
|
-
throw new MichelsonValidationError(ex, 'data entry expected');
|
|
694
|
-
}
|
|
695
|
-
return true;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
|
|
699
|
-
* This is a type guard function which either returns true of throws an exception.
|
|
700
|
-
* @param ex An AST node
|
|
701
|
-
*/
|
|
702
|
-
function assertMichelsonContract(ex) {
|
|
703
|
-
/* istanbul ignore else */
|
|
704
|
-
if (assertSeq(ex)) {
|
|
705
|
-
const toplevelSec = {};
|
|
706
|
-
const views = {};
|
|
707
|
-
for (const sec of ex) {
|
|
708
|
-
if (assertPrim(sec)) {
|
|
709
|
-
if (sec.prim !== 'view') {
|
|
710
|
-
if (sec.prim in toplevelSec) {
|
|
711
|
-
throw new MichelsonValidationError(ex, `duplicate contract section: ${sec.prim}`);
|
|
712
|
-
}
|
|
713
|
-
toplevelSec[sec.prim] = true;
|
|
714
|
-
}
|
|
715
|
-
/* istanbul ignore else */
|
|
716
|
-
switch (sec.prim) {
|
|
717
|
-
case 'code':
|
|
718
|
-
if (assertArgs(sec, 1)) {
|
|
719
|
-
/* istanbul ignore else */
|
|
720
|
-
if (assertSeq(sec.args[0])) {
|
|
721
|
-
assertMichelsonInstruction(sec.args[0]);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
break;
|
|
725
|
-
case 'parameter':
|
|
726
|
-
if (assertArgs(sec, 1)) {
|
|
727
|
-
assertMichelsonPassableType(sec.args[0]);
|
|
728
|
-
}
|
|
729
|
-
if (sec.annots) {
|
|
730
|
-
throw new MichelsonValidationError(sec, 'Annotation must be part of the parameter type');
|
|
731
|
-
}
|
|
732
|
-
break;
|
|
733
|
-
case 'storage':
|
|
734
|
-
if (assertArgs(sec, 1)) {
|
|
735
|
-
assertMichelsonStorableType(sec.args[0]);
|
|
736
|
-
}
|
|
737
|
-
break;
|
|
738
|
-
case 'view':
|
|
739
|
-
if (assertArgs(sec, 4)) {
|
|
740
|
-
if (assertStringLiteral(sec.args[0])) {
|
|
741
|
-
const name = sec.args[0];
|
|
742
|
-
if (name.string in views) {
|
|
743
|
-
throw new MichelsonValidationError(ex, `duplicate view name: ${name.string}`);
|
|
744
|
-
}
|
|
745
|
-
views[name.string] = true;
|
|
746
|
-
assertViewNameValid(name);
|
|
747
|
-
}
|
|
748
|
-
assertMichelsonPushableType(sec.args[1]);
|
|
749
|
-
assertMichelsonPushableType(sec.args[2]);
|
|
750
|
-
if (assertSeq(sec.args[3])) {
|
|
751
|
-
assertMichelsonInstruction(sec.args[3]);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
break;
|
|
755
|
-
default:
|
|
756
|
-
throw new MichelsonValidationError(ex, `unexpected contract section: ${sec.prim}`);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
return true;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
|
|
765
|
-
* @param ex An AST node
|
|
766
|
-
*/
|
|
767
|
-
function isMichelsonScript(ex) {
|
|
768
|
-
try {
|
|
769
|
-
assertMichelsonContract(ex);
|
|
770
|
-
return true;
|
|
771
|
-
}
|
|
772
|
-
catch {
|
|
773
|
-
return false;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* Checks if the node is a valid Michelson data literal such as `(Pair {Elt "0" 0} 0)`.
|
|
778
|
-
* @param ex An AST node
|
|
779
|
-
*/
|
|
780
|
-
function isMichelsonData(ex) {
|
|
781
|
-
try {
|
|
782
|
-
assertMichelsonData(ex);
|
|
783
|
-
return true;
|
|
784
|
-
}
|
|
785
|
-
catch {
|
|
786
|
-
return false;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Checks if the node is a valid Michelson code (sequence of instructions).
|
|
791
|
-
* @param ex An AST node
|
|
792
|
-
*/
|
|
793
|
-
function isMichelsonCode(ex) {
|
|
794
|
-
try {
|
|
795
|
-
assertMichelsonInstruction(ex);
|
|
796
|
-
return true;
|
|
797
|
-
}
|
|
798
|
-
catch {
|
|
799
|
-
return false;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Checks if the node is a valid Michelson type expression.
|
|
804
|
-
* @param ex An AST node
|
|
805
|
-
*/
|
|
806
|
-
function isMichelsonType(ex) {
|
|
807
|
-
try {
|
|
808
|
-
assertMichelsonType(ex);
|
|
809
|
-
return true;
|
|
810
|
-
}
|
|
811
|
-
catch {
|
|
812
|
-
return false;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
function isInstruction(p) {
|
|
816
|
-
return Object.prototype.hasOwnProperty.call(exports.instructionIDs, p.prim);
|
|
817
|
-
}
|
|
818
|
-
function assertDataListIfAny(d) {
|
|
819
|
-
if (!Array.isArray(d)) {
|
|
820
|
-
return false;
|
|
821
|
-
}
|
|
822
|
-
for (const v of d) {
|
|
823
|
-
if ('prim' in v) {
|
|
824
|
-
if (isInstruction(v)) {
|
|
825
|
-
throw new utils_1.MichelsonError(d, `Instruction outside of a lambda: ${JSON.stringify(d)}`);
|
|
826
|
-
}
|
|
827
|
-
else if (v.prim === 'Elt') {
|
|
828
|
-
throw new utils_1.MichelsonError(d, `Elt item outside of a map literal: ${JSON.stringify(d)}`);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return true;
|
|
833
|
-
}
|