@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,1049 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
var _PrepareProvider_counters;
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.PrepareProvider = void 0;
|
|
19
|
-
const rpc_1 = require("@taquito/rpc");
|
|
20
|
-
const types_1 = require("../operations/types");
|
|
21
|
-
const constants_1 = require("../constants");
|
|
22
|
-
const errors_1 = require("../errors");
|
|
23
|
-
const core_1 = require("@taquito/core");
|
|
24
|
-
const contract_1 = require("../contract");
|
|
25
|
-
const provider_1 = require("../provider");
|
|
26
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
27
|
-
const utils_1 = require("@taquito/utils");
|
|
28
|
-
const mergeLimits = (userDefinedLimit, defaultLimits) => {
|
|
29
|
-
return {
|
|
30
|
-
fee: userDefinedLimit.fee ?? defaultLimits.fee,
|
|
31
|
-
gasLimit: userDefinedLimit.gasLimit ?? defaultLimits.gasLimit,
|
|
32
|
-
storageLimit: userDefinedLimit.storageLimit ?? defaultLimits.storageLimit,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* PrepareProvider is a utility class to output the prepared format of an operation
|
|
37
|
-
*/
|
|
38
|
-
class PrepareProvider extends provider_1.Provider {
|
|
39
|
-
constructor(context) {
|
|
40
|
-
super(context);
|
|
41
|
-
this.context = context;
|
|
42
|
-
_PrepareProvider_counters.set(this, void 0);
|
|
43
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
44
|
-
}
|
|
45
|
-
async getBlockHash(block) {
|
|
46
|
-
return this.context.readProvider.getBlockHash(block ?? 'head~2');
|
|
47
|
-
}
|
|
48
|
-
async getProtocolHash() {
|
|
49
|
-
return this.context.readProvider.getNextProtocol('head');
|
|
50
|
-
}
|
|
51
|
-
async getHeadCounter(pkh) {
|
|
52
|
-
return this.context.readProvider.getCounter(pkh, 'head') ?? '0';
|
|
53
|
-
}
|
|
54
|
-
adjustGasForManagerOperations(gasLimitBlock, gaslimitOp, opsNeedingGasLimitPatch, explicitGasLimitTotal = new bignumber_js_1.default(0)) {
|
|
55
|
-
if (opsNeedingGasLimitPatch <= 0) {
|
|
56
|
-
return gaslimitOp;
|
|
57
|
-
}
|
|
58
|
-
const remainingBlockGas = gasLimitBlock.minus(explicitGasLimitTotal);
|
|
59
|
-
if (remainingBlockGas.lte(0)) {
|
|
60
|
-
return new bignumber_js_1.default(0);
|
|
61
|
-
}
|
|
62
|
-
return bignumber_js_1.default.min(gaslimitOp, remainingBlockGas.div(opsNeedingGasLimitPatch).integerValue(bignumber_js_1.default.ROUND_DOWN));
|
|
63
|
-
}
|
|
64
|
-
getOperationLimits(constants, options = {}) {
|
|
65
|
-
const { hard_gas_limit_per_operation, hard_gas_limit_per_block, hard_storage_limit_per_operation, } = constants;
|
|
66
|
-
return {
|
|
67
|
-
fee: 0,
|
|
68
|
-
gasLimit: this.adjustGasForManagerOperations(hard_gas_limit_per_block, hard_gas_limit_per_operation, options.opsNeedingGasLimitPatch ?? 0, options.explicitGasLimitTotal).toNumber(),
|
|
69
|
-
storageLimit: hard_storage_limit_per_operation.toNumber(),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
async getOperationLimitsForManagerOperation(constants, publicKeyHash, kind, gasLimit) {
|
|
73
|
-
const revealNeeded = await this.isRevealOpNeeded([{ kind }], publicKeyHash);
|
|
74
|
-
return this.getOperationLimits(constants, {
|
|
75
|
-
opsNeedingGasLimitPatch: typeof gasLimit === 'undefined' ? 1 : 0,
|
|
76
|
-
explicitGasLimitTotal: revealNeeded
|
|
77
|
-
? new bignumber_js_1.default((0, constants_1.getRevealGasLimit)(publicKeyHash))
|
|
78
|
-
: undefined,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
getFee(op, pkh, headCounter) {
|
|
82
|
-
if (!__classPrivateFieldGet(this, _PrepareProvider_counters, "f")[pkh] || __classPrivateFieldGet(this, _PrepareProvider_counters, "f")[pkh] < headCounter) {
|
|
83
|
-
__classPrivateFieldGet(this, _PrepareProvider_counters, "f")[pkh] = headCounter;
|
|
84
|
-
}
|
|
85
|
-
const opCounter = ++__classPrivateFieldGet(this, _PrepareProvider_counters, "f")[pkh];
|
|
86
|
-
return {
|
|
87
|
-
counter: `${opCounter}`,
|
|
88
|
-
fee: typeof op.fee === 'undefined' ? '0' : `${op.fee}`,
|
|
89
|
-
gas_limit: typeof op.gas_limit === 'undefined' ? '0' : `${op.gas_limit}`,
|
|
90
|
-
storage_limit: typeof op.storage_limit === 'undefined' ? '0' : `${op.storage_limit}`,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
getSource(op, pkh, source) {
|
|
94
|
-
return { source: typeof op.source === 'undefined' ? source || pkh : op.source };
|
|
95
|
-
}
|
|
96
|
-
async addRevealOperationIfNeeded(operation, publicKeyHash) {
|
|
97
|
-
if ((0, types_1.isOpRequireReveal)(operation)) {
|
|
98
|
-
const ops = [operation];
|
|
99
|
-
const { publicKey, pkh } = await this.getKeys();
|
|
100
|
-
if (await this.isAccountRevealRequired(publicKeyHash)) {
|
|
101
|
-
if (!publicKey) {
|
|
102
|
-
throw new core_1.PublicKeyNotFoundError(pkh);
|
|
103
|
-
}
|
|
104
|
-
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(pkh, utils_1.publicKeyHashPrefixes);
|
|
105
|
-
ops.unshift(await (0, contract_1.createRevealOperation)({
|
|
106
|
-
fee: (0, constants_1.getRevealFee)(pkh),
|
|
107
|
-
storageLimit: constants_1.REVEAL_STORAGE_LIMIT,
|
|
108
|
-
gasLimit: (0, constants_1.getRevealGasLimit)(pkh),
|
|
109
|
-
proof: pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash
|
|
110
|
-
? (await this.signer.provePossession()).prefixSig
|
|
111
|
-
: undefined,
|
|
112
|
-
}, publicKeyHash, publicKey));
|
|
113
|
-
return ops;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return operation;
|
|
117
|
-
}
|
|
118
|
-
async getKeys() {
|
|
119
|
-
const isSignerConfigured = this.context.isAnySignerConfigured();
|
|
120
|
-
return {
|
|
121
|
-
pkh: isSignerConfigured ? await this.signer.publicKeyHash() : await this.context.wallet.pkh(),
|
|
122
|
-
publicKey: isSignerConfigured
|
|
123
|
-
? await this.signer.publicKey()
|
|
124
|
-
: await this.context.wallet.pk(),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
convertIntoArray(op) {
|
|
128
|
-
if (Array.isArray(op)) {
|
|
129
|
-
return [...op];
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
return [op];
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
getSingleManagerOperationSimulation(ops, gasLimit) {
|
|
136
|
-
if (typeof gasLimit !== 'undefined' || ops.length === 0) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
gasLimitPatchableIndexes: [ops.length - 1],
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
withSimulationMetadata(preparedOperation, simulation) {
|
|
144
|
-
if (!simulation) {
|
|
145
|
-
return preparedOperation;
|
|
146
|
-
}
|
|
147
|
-
// Keep retry bookkeeping available to estimation without changing the
|
|
148
|
-
// enumerable shape of single-op prepared results.
|
|
149
|
-
Object.defineProperty(preparedOperation, 'simulation', {
|
|
150
|
-
value: simulation,
|
|
151
|
-
configurable: true,
|
|
152
|
-
enumerable: false,
|
|
153
|
-
writable: true,
|
|
154
|
-
});
|
|
155
|
-
return preparedOperation;
|
|
156
|
-
}
|
|
157
|
-
constructOpContents(ops, headCounter, pkh, source, currentVotingPeriod) {
|
|
158
|
-
return ops.map((op) => {
|
|
159
|
-
switch (op.kind) {
|
|
160
|
-
case rpc_1.OpKind.ACTIVATION:
|
|
161
|
-
case rpc_1.OpKind.DRAIN_DELEGATE:
|
|
162
|
-
return {
|
|
163
|
-
...op,
|
|
164
|
-
};
|
|
165
|
-
case rpc_1.OpKind.ORIGINATION:
|
|
166
|
-
return {
|
|
167
|
-
...op,
|
|
168
|
-
balance: typeof op.balance !== 'undefined' ? `${op.balance}` : '0',
|
|
169
|
-
...this.getSource(op, pkh, source),
|
|
170
|
-
...this.getFee(op, pkh, headCounter),
|
|
171
|
-
};
|
|
172
|
-
case rpc_1.OpKind.TRANSACTION: {
|
|
173
|
-
const cops = {
|
|
174
|
-
...op,
|
|
175
|
-
amount: typeof op.amount !== 'undefined' ? `${op.amount}` : '0',
|
|
176
|
-
...this.getSource(op, pkh, source),
|
|
177
|
-
...this.getFee(op, pkh, headCounter),
|
|
178
|
-
};
|
|
179
|
-
if (cops.source.toLowerCase().startsWith('kt1')) {
|
|
180
|
-
throw new core_1.DeprecationError(`KT1 addresses are not supported as source since ${constants_1.Protocols.PsBabyM1}`);
|
|
181
|
-
}
|
|
182
|
-
return cops;
|
|
183
|
-
}
|
|
184
|
-
case rpc_1.OpKind.REVEAL:
|
|
185
|
-
case rpc_1.OpKind.DELEGATION:
|
|
186
|
-
case rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT:
|
|
187
|
-
case rpc_1.OpKind.UPDATE_CONSENSUS_KEY:
|
|
188
|
-
case rpc_1.OpKind.UPDATE_COMPANION_KEY:
|
|
189
|
-
case rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES:
|
|
190
|
-
case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE:
|
|
191
|
-
case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:
|
|
192
|
-
return {
|
|
193
|
-
...op,
|
|
194
|
-
...this.getSource(op, pkh, source),
|
|
195
|
-
...this.getFee(op, pkh, headCounter),
|
|
196
|
-
};
|
|
197
|
-
case rpc_1.OpKind.TRANSFER_TICKET:
|
|
198
|
-
return {
|
|
199
|
-
...op,
|
|
200
|
-
ticket_amount: `${op.ticket_amount}`,
|
|
201
|
-
...this.getSource(op, pkh, source),
|
|
202
|
-
...this.getFee(op, pkh, headCounter),
|
|
203
|
-
};
|
|
204
|
-
case rpc_1.OpKind.INCREASE_PAID_STORAGE:
|
|
205
|
-
return {
|
|
206
|
-
...op,
|
|
207
|
-
amount: `${op.amount}`,
|
|
208
|
-
...this.getSource(op, pkh, source),
|
|
209
|
-
...this.getFee(op, pkh, headCounter),
|
|
210
|
-
};
|
|
211
|
-
case rpc_1.OpKind.BALLOT:
|
|
212
|
-
if (currentVotingPeriod === undefined) {
|
|
213
|
-
throw new errors_1.RPCResponseError(`Failed to get the current voting period index`);
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
...op,
|
|
217
|
-
period: currentVotingPeriod?.voting_period.index,
|
|
218
|
-
...this.getSource(op, pkh, source),
|
|
219
|
-
};
|
|
220
|
-
case rpc_1.OpKind.PROPOSALS:
|
|
221
|
-
if (currentVotingPeriod === undefined) {
|
|
222
|
-
throw new errors_1.RPCResponseError(`Failed to get the current voting period index`);
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
...op,
|
|
226
|
-
period: currentVotingPeriod?.voting_period.index,
|
|
227
|
-
...this.getSource(op, pkh, source),
|
|
228
|
-
};
|
|
229
|
-
default:
|
|
230
|
-
throw new core_1.InvalidOperationKindError(op.kind);
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
*
|
|
236
|
-
* Method to prepare an activation operation
|
|
237
|
-
* @returns a PreparedOperation object
|
|
238
|
-
*/
|
|
239
|
-
async activate({ pkh, secret }) {
|
|
240
|
-
const op = await (0, contract_1.createActivationOperation)({
|
|
241
|
-
pkh,
|
|
242
|
-
secret,
|
|
243
|
-
});
|
|
244
|
-
const ops = this.convertIntoArray(op);
|
|
245
|
-
const hash = await this.getBlockHash();
|
|
246
|
-
const protocol = await this.getProtocolHash();
|
|
247
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
248
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
249
|
-
const contents = this.constructOpContents(ops, headCounter, pkh);
|
|
250
|
-
const preparedOperation = {
|
|
251
|
-
opOb: {
|
|
252
|
-
branch: hash,
|
|
253
|
-
contents,
|
|
254
|
-
protocol,
|
|
255
|
-
},
|
|
256
|
-
counter: headCounter,
|
|
257
|
-
};
|
|
258
|
-
return preparedOperation;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
*
|
|
262
|
-
* Method to prepare a reveal operation
|
|
263
|
-
* @returns a PreparedOperation object
|
|
264
|
-
*/
|
|
265
|
-
async reveal({ fee, gasLimit, storageLimit, proof }) {
|
|
266
|
-
const { pkh, publicKey } = await this.getKeys();
|
|
267
|
-
if (!publicKey) {
|
|
268
|
-
throw new core_1.PublicKeyNotFoundError(pkh);
|
|
269
|
-
}
|
|
270
|
-
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(pkh, utils_1.publicKeyHashPrefixes);
|
|
271
|
-
if (pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash) {
|
|
272
|
-
if (proof) {
|
|
273
|
-
(0, utils_1.b58DecodeAndCheckPrefix)(proof, [utils_1.PrefixV2.BLS12_381Signature]); // validate proof to be a bls signature
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
const { prefixSig } = await this.signer.provePossession();
|
|
277
|
-
proof = prefixSig;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
if (proof) {
|
|
282
|
-
throw new core_1.ProhibitedActionError('Proof field is only allowed to reveal a bls account ');
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
286
|
-
const DEFAULT_PARAMS = await this.getOperationLimits(protocolConstants);
|
|
287
|
-
const mergedEstimates = mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS);
|
|
288
|
-
const op = await (0, contract_1.createRevealOperation)({
|
|
289
|
-
fee: mergedEstimates.fee,
|
|
290
|
-
gasLimit: mergedEstimates.gasLimit,
|
|
291
|
-
storageLimit: mergedEstimates.storageLimit,
|
|
292
|
-
proof,
|
|
293
|
-
}, pkh, publicKey);
|
|
294
|
-
const ops = this.convertIntoArray(op);
|
|
295
|
-
const hash = await this.getBlockHash();
|
|
296
|
-
const protocol = await this.getProtocolHash();
|
|
297
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
298
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
299
|
-
const contents = this.constructOpContents(ops, headCounter, pkh);
|
|
300
|
-
const preparedOperation = {
|
|
301
|
-
opOb: {
|
|
302
|
-
branch: hash,
|
|
303
|
-
contents,
|
|
304
|
-
protocol,
|
|
305
|
-
},
|
|
306
|
-
counter: headCounter,
|
|
307
|
-
};
|
|
308
|
-
return preparedOperation;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
*
|
|
312
|
-
* Method to prepare an origination operation
|
|
313
|
-
* @param source string or undefined source pkh
|
|
314
|
-
* @returns a PreparedOperation object
|
|
315
|
-
*/
|
|
316
|
-
async originate({ fee, storageLimit, gasLimit, ...rest }, source) {
|
|
317
|
-
const { pkh } = await this.getKeys();
|
|
318
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
319
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.ORIGINATION, gasLimit);
|
|
320
|
-
const op = await (0, contract_1.createOriginationOperation)(await this.context.parser.prepareCodeOrigination({
|
|
321
|
-
...rest,
|
|
322
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
323
|
-
}));
|
|
324
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
325
|
-
const ops = this.convertIntoArray(operation);
|
|
326
|
-
const hash = await this.getBlockHash();
|
|
327
|
-
const protocol = await this.getProtocolHash();
|
|
328
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
329
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
330
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
331
|
-
const preparedOperation = {
|
|
332
|
-
opOb: {
|
|
333
|
-
branch: hash,
|
|
334
|
-
contents,
|
|
335
|
-
protocol,
|
|
336
|
-
},
|
|
337
|
-
counter: headCounter,
|
|
338
|
-
};
|
|
339
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
*
|
|
343
|
-
* Method to prepare a transaction operation
|
|
344
|
-
* @returns a PreparedOperation object
|
|
345
|
-
*/
|
|
346
|
-
async transaction({ fee, storageLimit, gasLimit, ...rest }) {
|
|
347
|
-
const { pkh } = await this.getKeys();
|
|
348
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
349
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.TRANSACTION, gasLimit);
|
|
350
|
-
const op = await (0, contract_1.createTransferOperation)({
|
|
351
|
-
...rest,
|
|
352
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
353
|
-
});
|
|
354
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
355
|
-
const ops = this.convertIntoArray(operation);
|
|
356
|
-
const hash = await this.getBlockHash();
|
|
357
|
-
const protocol = await this.getProtocolHash();
|
|
358
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
359
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
360
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
361
|
-
const preparedOperation = {
|
|
362
|
-
opOb: {
|
|
363
|
-
branch: hash,
|
|
364
|
-
contents,
|
|
365
|
-
protocol,
|
|
366
|
-
},
|
|
367
|
-
counter: headCounter,
|
|
368
|
-
};
|
|
369
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
*
|
|
373
|
-
* Method to prepare a stake pseudo-operation
|
|
374
|
-
* @returns a PreparedOperation object
|
|
375
|
-
*/
|
|
376
|
-
async stake({ fee, storageLimit, gasLimit, ...rest }) {
|
|
377
|
-
const { pkh } = await this.getKeys();
|
|
378
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
379
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.TRANSACTION, gasLimit);
|
|
380
|
-
const op = await (0, contract_1.createTransferOperation)({
|
|
381
|
-
...rest,
|
|
382
|
-
to: pkh,
|
|
383
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
384
|
-
parameter: {
|
|
385
|
-
entrypoint: 'stake',
|
|
386
|
-
value: {
|
|
387
|
-
prim: 'Unit',
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
});
|
|
391
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
392
|
-
const ops = this.convertIntoArray(operation);
|
|
393
|
-
const hash = await this.getBlockHash();
|
|
394
|
-
const protocol = await this.getProtocolHash();
|
|
395
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
396
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
397
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
398
|
-
const preparedOperation = {
|
|
399
|
-
opOb: {
|
|
400
|
-
branch: hash,
|
|
401
|
-
contents,
|
|
402
|
-
protocol,
|
|
403
|
-
},
|
|
404
|
-
counter: headCounter,
|
|
405
|
-
};
|
|
406
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
*
|
|
410
|
-
* Method to prepare a unstake pseudo-operation
|
|
411
|
-
* @returns a PreparedOperation object
|
|
412
|
-
*/
|
|
413
|
-
async unstake({ fee, storageLimit, gasLimit, ...rest }) {
|
|
414
|
-
const { pkh } = await this.getKeys();
|
|
415
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
416
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.TRANSACTION, gasLimit);
|
|
417
|
-
const op = await (0, contract_1.createTransferOperation)({
|
|
418
|
-
...rest,
|
|
419
|
-
to: pkh,
|
|
420
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
421
|
-
parameter: {
|
|
422
|
-
entrypoint: 'unstake',
|
|
423
|
-
value: { prim: 'Unit' },
|
|
424
|
-
},
|
|
425
|
-
});
|
|
426
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
427
|
-
const ops = this.convertIntoArray(operation);
|
|
428
|
-
const hash = await this.getBlockHash();
|
|
429
|
-
const protocol = await this.getProtocolHash();
|
|
430
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
431
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
432
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
433
|
-
const preparedOperation = {
|
|
434
|
-
opOb: {
|
|
435
|
-
branch: hash,
|
|
436
|
-
contents,
|
|
437
|
-
protocol,
|
|
438
|
-
},
|
|
439
|
-
counter: headCounter,
|
|
440
|
-
};
|
|
441
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
*
|
|
445
|
-
* Method to prepare a finalize_unstake pseudo-operation
|
|
446
|
-
* @returns a PreparedOperation object
|
|
447
|
-
*/
|
|
448
|
-
async finalizeUnstake({ fee, storageLimit, gasLimit, to, ...rest }) {
|
|
449
|
-
const { pkh } = await this.getKeys();
|
|
450
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
451
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.TRANSACTION, gasLimit);
|
|
452
|
-
const op = await (0, contract_1.createTransferOperation)({
|
|
453
|
-
...rest,
|
|
454
|
-
to: to ? to : pkh,
|
|
455
|
-
amount: 0,
|
|
456
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
457
|
-
parameter: {
|
|
458
|
-
entrypoint: 'finalize_unstake',
|
|
459
|
-
value: { prim: 'Unit' },
|
|
460
|
-
},
|
|
461
|
-
});
|
|
462
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
463
|
-
const ops = this.convertIntoArray(operation);
|
|
464
|
-
const hash = await this.getBlockHash();
|
|
465
|
-
const protocol = await this.getProtocolHash();
|
|
466
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
467
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
468
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
469
|
-
const preparedOperation = {
|
|
470
|
-
opOb: {
|
|
471
|
-
branch: hash,
|
|
472
|
-
contents,
|
|
473
|
-
protocol,
|
|
474
|
-
},
|
|
475
|
-
counter: headCounter,
|
|
476
|
-
};
|
|
477
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
*
|
|
481
|
-
* Method to prepare a delegation operation
|
|
482
|
-
* @returns a PreparedOperation object
|
|
483
|
-
*/
|
|
484
|
-
async delegation({ fee, storageLimit, gasLimit, ...rest }) {
|
|
485
|
-
const { pkh } = await this.getKeys();
|
|
486
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
487
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.DELEGATION, gasLimit);
|
|
488
|
-
const op = await (0, contract_1.createSetDelegateOperation)({
|
|
489
|
-
...rest,
|
|
490
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
491
|
-
});
|
|
492
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
493
|
-
const ops = this.convertIntoArray(operation);
|
|
494
|
-
const hash = await this.getBlockHash();
|
|
495
|
-
const protocol = await this.getProtocolHash();
|
|
496
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
497
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
498
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
499
|
-
const preparedOperation = {
|
|
500
|
-
opOb: {
|
|
501
|
-
branch: hash,
|
|
502
|
-
contents,
|
|
503
|
-
protocol,
|
|
504
|
-
},
|
|
505
|
-
counter: headCounter,
|
|
506
|
-
};
|
|
507
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
*
|
|
511
|
-
* Method to prepare a register delegate operation
|
|
512
|
-
* @param source string or undefined source pkh
|
|
513
|
-
* @returns a PreparedOperation object
|
|
514
|
-
*/
|
|
515
|
-
async registerDelegate({ fee, storageLimit, gasLimit }, source) {
|
|
516
|
-
const { pkh } = await this.getKeys();
|
|
517
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
518
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.DELEGATION, gasLimit);
|
|
519
|
-
const mergedEstimates = mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS);
|
|
520
|
-
const op = await (0, contract_1.createRegisterDelegateOperation)({
|
|
521
|
-
fee: mergedEstimates.fee,
|
|
522
|
-
storageLimit: mergedEstimates.storageLimit,
|
|
523
|
-
gasLimit: mergedEstimates.gasLimit,
|
|
524
|
-
}, pkh);
|
|
525
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
526
|
-
const ops = this.convertIntoArray(operation);
|
|
527
|
-
const hash = await this.getBlockHash();
|
|
528
|
-
const protocol = await this.getProtocolHash();
|
|
529
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
530
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
531
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
532
|
-
const preparedOperation = {
|
|
533
|
-
opOb: {
|
|
534
|
-
branch: hash,
|
|
535
|
-
contents,
|
|
536
|
-
protocol,
|
|
537
|
-
},
|
|
538
|
-
counter: headCounter,
|
|
539
|
-
};
|
|
540
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
*
|
|
544
|
-
* Method to prepare a register_global_constant operation
|
|
545
|
-
* @returns a PreparedOperation object
|
|
546
|
-
*/
|
|
547
|
-
async registerGlobalConstant({ fee, storageLimit, gasLimit, ...rest }) {
|
|
548
|
-
const { pkh } = await this.getKeys();
|
|
549
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
550
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT, gasLimit);
|
|
551
|
-
const op = await (0, contract_1.createRegisterGlobalConstantOperation)({
|
|
552
|
-
...rest,
|
|
553
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
554
|
-
});
|
|
555
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
556
|
-
const ops = this.convertIntoArray(operation);
|
|
557
|
-
const hash = await this.getBlockHash();
|
|
558
|
-
const protocol = await this.getProtocolHash();
|
|
559
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
560
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
561
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
562
|
-
const preparedOperation = {
|
|
563
|
-
opOb: {
|
|
564
|
-
branch: hash,
|
|
565
|
-
contents,
|
|
566
|
-
protocol,
|
|
567
|
-
},
|
|
568
|
-
counter: headCounter,
|
|
569
|
-
};
|
|
570
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
*
|
|
574
|
-
* Method to prepare an update_consensus_key operation
|
|
575
|
-
* @param source string or undefined source pkh
|
|
576
|
-
* @returns a PreparedOperation object
|
|
577
|
-
*/
|
|
578
|
-
async updateConsensusKey({ fee, storageLimit, gasLimit, ...rest }, source) {
|
|
579
|
-
const { pkh } = await this.getKeys();
|
|
580
|
-
const [, pkPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(rest.pk, utils_1.publicKeyPrefixes);
|
|
581
|
-
if (pkPrefix === utils_1.PrefixV2.BLS12_381PublicKey) {
|
|
582
|
-
if (!rest.proof) {
|
|
583
|
-
throw new core_1.InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
if (rest.proof) {
|
|
588
|
-
throw new core_1.ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
592
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.UPDATE_CONSENSUS_KEY, gasLimit);
|
|
593
|
-
const op = await (0, contract_1.createUpdateConsensusKeyOperation)({
|
|
594
|
-
...rest,
|
|
595
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
596
|
-
});
|
|
597
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
598
|
-
const ops = this.convertIntoArray(operation);
|
|
599
|
-
const hash = await this.getBlockHash();
|
|
600
|
-
const protocol = await this.getProtocolHash();
|
|
601
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
602
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
603
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
604
|
-
const preparedOperation = {
|
|
605
|
-
opOb: {
|
|
606
|
-
branch: hash,
|
|
607
|
-
contents,
|
|
608
|
-
protocol,
|
|
609
|
-
},
|
|
610
|
-
counter: headCounter,
|
|
611
|
-
};
|
|
612
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
*
|
|
616
|
-
* Method to prepare an update_companion_key operation
|
|
617
|
-
* @param source string or undefined source pkh
|
|
618
|
-
* @returns a PreparedOperation object
|
|
619
|
-
*/
|
|
620
|
-
async updateCompanionKey({ fee, storageLimit, gasLimit, ...rest }, source) {
|
|
621
|
-
const { pkh } = await this.getKeys();
|
|
622
|
-
const [, pkPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(rest.pk, utils_1.publicKeyPrefixes);
|
|
623
|
-
if (pkPrefix !== utils_1.PrefixV2.BLS12_381PublicKey) {
|
|
624
|
-
throw new core_1.ProhibitedActionError('companion key must be a bls account');
|
|
625
|
-
}
|
|
626
|
-
if (!rest.proof) {
|
|
627
|
-
throw new core_1.InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
628
|
-
}
|
|
629
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
630
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.UPDATE_COMPANION_KEY, gasLimit);
|
|
631
|
-
const op = await (0, contract_1.createUpdateCompanionKeyOperation)({
|
|
632
|
-
...rest,
|
|
633
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
634
|
-
});
|
|
635
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
636
|
-
const ops = this.convertIntoArray(operation);
|
|
637
|
-
const hash = await this.getBlockHash();
|
|
638
|
-
const protocol = await this.getProtocolHash();
|
|
639
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
640
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
641
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
642
|
-
const preparedOperation = {
|
|
643
|
-
opOb: {
|
|
644
|
-
branch: hash,
|
|
645
|
-
contents,
|
|
646
|
-
protocol,
|
|
647
|
-
},
|
|
648
|
-
counter: headCounter,
|
|
649
|
-
};
|
|
650
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
*
|
|
654
|
-
* Method to prepare an increase_paid_storage operation
|
|
655
|
-
* @returns a PreparedOperation object
|
|
656
|
-
*/
|
|
657
|
-
async increasePaidStorage({ fee, storageLimit, gasLimit, ...rest }) {
|
|
658
|
-
const { pkh } = await this.getKeys();
|
|
659
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
660
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.INCREASE_PAID_STORAGE, gasLimit);
|
|
661
|
-
const op = await (0, contract_1.createIncreasePaidStorageOperation)({
|
|
662
|
-
...rest,
|
|
663
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
664
|
-
});
|
|
665
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
666
|
-
const ops = this.convertIntoArray(operation);
|
|
667
|
-
const hash = await this.getBlockHash();
|
|
668
|
-
const protocol = await this.getProtocolHash();
|
|
669
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
670
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
671
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
672
|
-
const preparedOperation = {
|
|
673
|
-
opOb: {
|
|
674
|
-
branch: hash,
|
|
675
|
-
contents,
|
|
676
|
-
protocol,
|
|
677
|
-
},
|
|
678
|
-
counter: headCounter,
|
|
679
|
-
};
|
|
680
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
*
|
|
684
|
-
* Method to prepare a ballot operation
|
|
685
|
-
* @param params ballot operation parameters
|
|
686
|
-
* @returns a PreparedOperation object
|
|
687
|
-
*/
|
|
688
|
-
async ballot(params) {
|
|
689
|
-
const { pkh } = await this.getKeys();
|
|
690
|
-
const op = await (0, contract_1.createBallotOperation)({
|
|
691
|
-
...params,
|
|
692
|
-
});
|
|
693
|
-
const ops = this.convertIntoArray(op);
|
|
694
|
-
const hash = await this.getBlockHash();
|
|
695
|
-
const protocol = await this.getProtocolHash();
|
|
696
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
697
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
698
|
-
let currentVotingPeriod;
|
|
699
|
-
try {
|
|
700
|
-
currentVotingPeriod = await this.rpc.getCurrentPeriod();
|
|
701
|
-
}
|
|
702
|
-
catch (e) {
|
|
703
|
-
throw new errors_1.RPCResponseError('Failed to get the current voting period index');
|
|
704
|
-
}
|
|
705
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, params.source, currentVotingPeriod);
|
|
706
|
-
const preparedOperation = {
|
|
707
|
-
opOb: {
|
|
708
|
-
branch: hash,
|
|
709
|
-
contents,
|
|
710
|
-
protocol,
|
|
711
|
-
},
|
|
712
|
-
counter: headCounter,
|
|
713
|
-
};
|
|
714
|
-
return preparedOperation;
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
*
|
|
718
|
-
* Method to prepare a proposals operation
|
|
719
|
-
* @param params proposals operation parameters
|
|
720
|
-
* @returns a PreparedOperation object
|
|
721
|
-
*/
|
|
722
|
-
async proposals(params) {
|
|
723
|
-
const { pkh } = await this.getKeys();
|
|
724
|
-
const op = await (0, contract_1.createProposalsOperation)({
|
|
725
|
-
...params,
|
|
726
|
-
});
|
|
727
|
-
const ops = this.convertIntoArray(op);
|
|
728
|
-
const hash = await this.getBlockHash();
|
|
729
|
-
const protocol = await this.getProtocolHash();
|
|
730
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
731
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
732
|
-
let currentVotingPeriod;
|
|
733
|
-
try {
|
|
734
|
-
currentVotingPeriod = await this.rpc.getCurrentPeriod();
|
|
735
|
-
}
|
|
736
|
-
catch (e) {
|
|
737
|
-
throw new errors_1.RPCResponseError('Failed to get the current voting period index');
|
|
738
|
-
}
|
|
739
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, params.source, currentVotingPeriod);
|
|
740
|
-
const preparedOperation = {
|
|
741
|
-
opOb: {
|
|
742
|
-
branch: hash,
|
|
743
|
-
contents,
|
|
744
|
-
protocol,
|
|
745
|
-
},
|
|
746
|
-
counter: headCounter,
|
|
747
|
-
};
|
|
748
|
-
return preparedOperation;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
*
|
|
752
|
-
* Method to prepare a drain_delegate operation
|
|
753
|
-
* @param params drainDelegate operation parameters
|
|
754
|
-
* @returns a PreparedOperation object
|
|
755
|
-
*/
|
|
756
|
-
async drainDelegate(params, source) {
|
|
757
|
-
const { pkh } = await this.getKeys();
|
|
758
|
-
const op = await (0, contract_1.createDrainDelegateOperation)({
|
|
759
|
-
...params,
|
|
760
|
-
});
|
|
761
|
-
const ops = this.convertIntoArray(op);
|
|
762
|
-
const hash = await this.getBlockHash();
|
|
763
|
-
const protocol = await this.getProtocolHash();
|
|
764
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
765
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
766
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
767
|
-
const preparedOperation = {
|
|
768
|
-
opOb: {
|
|
769
|
-
branch: hash,
|
|
770
|
-
contents,
|
|
771
|
-
protocol,
|
|
772
|
-
},
|
|
773
|
-
counter: headCounter,
|
|
774
|
-
};
|
|
775
|
-
return preparedOperation;
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
*
|
|
779
|
-
* Method to prepare a transfer_ticket operation
|
|
780
|
-
* @returns a PreparedOperation object
|
|
781
|
-
*/
|
|
782
|
-
async transferTicket({ fee, storageLimit, gasLimit, ...rest }) {
|
|
783
|
-
const { pkh } = await this.getKeys();
|
|
784
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
785
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.TRANSFER_TICKET, gasLimit);
|
|
786
|
-
const op = await (0, contract_1.createTransferTicketOperation)({
|
|
787
|
-
...rest,
|
|
788
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
789
|
-
});
|
|
790
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
791
|
-
const ops = this.convertIntoArray(operation);
|
|
792
|
-
const hash = await this.getBlockHash();
|
|
793
|
-
const protocol = await this.getProtocolHash();
|
|
794
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
795
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
796
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
797
|
-
const preparedOperation = {
|
|
798
|
-
opOb: {
|
|
799
|
-
branch: hash,
|
|
800
|
-
contents,
|
|
801
|
-
protocol,
|
|
802
|
-
},
|
|
803
|
-
counter: headCounter,
|
|
804
|
-
};
|
|
805
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
*
|
|
809
|
-
* Method to prepare a smart_rollup_add_messages operation
|
|
810
|
-
* @returns a PreparedOperation object
|
|
811
|
-
*/
|
|
812
|
-
async smartRollupAddMessages({ fee, storageLimit, gasLimit, ...rest }) {
|
|
813
|
-
const { pkh } = await this.getKeys();
|
|
814
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
815
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES, gasLimit);
|
|
816
|
-
const op = await (0, contract_1.createSmartRollupAddMessagesOperation)({
|
|
817
|
-
...rest,
|
|
818
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
819
|
-
});
|
|
820
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
821
|
-
const ops = this.convertIntoArray(operation);
|
|
822
|
-
const hash = await this.getBlockHash();
|
|
823
|
-
const protocol = await this.getProtocolHash();
|
|
824
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
825
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
826
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
827
|
-
const preparedOperation = {
|
|
828
|
-
opOb: {
|
|
829
|
-
branch: hash,
|
|
830
|
-
contents,
|
|
831
|
-
protocol,
|
|
832
|
-
},
|
|
833
|
-
counter: headCounter,
|
|
834
|
-
};
|
|
835
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
*
|
|
839
|
-
* Method to prepare a smart_rollup_originate operation
|
|
840
|
-
* @returns a PreparedOperation object
|
|
841
|
-
*/
|
|
842
|
-
async smartRollupOriginate({ fee, storageLimit, gasLimit, ...rest }) {
|
|
843
|
-
const { pkh } = await this.getKeys();
|
|
844
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
845
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.SMART_ROLLUP_ORIGINATE, gasLimit);
|
|
846
|
-
const op = await (0, contract_1.createSmartRollupOriginateOperation)({
|
|
847
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
848
|
-
...rest,
|
|
849
|
-
});
|
|
850
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
851
|
-
const ops = this.convertIntoArray(operation);
|
|
852
|
-
const hash = await this.getBlockHash();
|
|
853
|
-
const protocol = await this.getProtocolHash();
|
|
854
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
855
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
856
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
857
|
-
const preparedOperation = {
|
|
858
|
-
opOb: {
|
|
859
|
-
branch: hash,
|
|
860
|
-
contents,
|
|
861
|
-
protocol,
|
|
862
|
-
},
|
|
863
|
-
counter: headCounter,
|
|
864
|
-
};
|
|
865
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
866
|
-
}
|
|
867
|
-
/**
|
|
868
|
-
*
|
|
869
|
-
* Method to prepare a smart_rollup_execute_outbox_message operation
|
|
870
|
-
* @returns a PreparedOperation object
|
|
871
|
-
*/
|
|
872
|
-
async smartRollupExecuteOutboxMessage({ fee, storageLimit, gasLimit, ...rest }) {
|
|
873
|
-
const { pkh } = await this.getKeys();
|
|
874
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
875
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE, gasLimit);
|
|
876
|
-
const op = await (0, contract_1.createSmartRollupExecuteOutboxMessageOperation)({
|
|
877
|
-
...rest,
|
|
878
|
-
...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),
|
|
879
|
-
});
|
|
880
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
881
|
-
const ops = this.convertIntoArray(operation);
|
|
882
|
-
const hash = await this.getBlockHash();
|
|
883
|
-
const protocol = await this.getProtocolHash();
|
|
884
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
885
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
886
|
-
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
|
|
887
|
-
const preparedOperation = {
|
|
888
|
-
opOb: {
|
|
889
|
-
branch: hash,
|
|
890
|
-
contents,
|
|
891
|
-
protocol,
|
|
892
|
-
},
|
|
893
|
-
counter: headCounter,
|
|
894
|
-
};
|
|
895
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, gasLimit));
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
*
|
|
899
|
-
* Method to prepare a batch operation
|
|
900
|
-
* @param batchParams batch operation parameters
|
|
901
|
-
* @returns a PreparedOperation object
|
|
902
|
-
*/
|
|
903
|
-
async batch(batchParams, estimates) {
|
|
904
|
-
const { pkh, publicKey } = await this.getKeys();
|
|
905
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
906
|
-
const revealNeeded = await this.isRevealOpNeeded(batchParams, pkh);
|
|
907
|
-
const explicitGasLimitTotal = batchParams.reduce((acc, op) => (0, types_1.isOpWithFee)(op) && typeof op.gasLimit !== 'undefined' ? acc.plus(op.gasLimit) : acc, revealNeeded ? new bignumber_js_1.default((0, constants_1.getRevealGasLimit)(pkh)) : new bignumber_js_1.default(0));
|
|
908
|
-
const DEFAULT_PARAMS = this.getOperationLimits(protocolConstants, {
|
|
909
|
-
opsNeedingGasLimitPatch: batchParams.filter((op) => (0, types_1.isOpWithFee)(op) && typeof op.gasLimit === 'undefined').length,
|
|
910
|
-
explicitGasLimitTotal,
|
|
911
|
-
});
|
|
912
|
-
const ops = [];
|
|
913
|
-
const gasLimitPatchableFlags = [];
|
|
914
|
-
if (!estimates) {
|
|
915
|
-
for (const op of batchParams) {
|
|
916
|
-
if ((0, types_1.isOpWithFee)(op)) {
|
|
917
|
-
const limits = mergeLimits(op, DEFAULT_PARAMS);
|
|
918
|
-
ops.push(await this.getRPCOp({ ...op, ...limits }));
|
|
919
|
-
gasLimitPatchableFlags.push(typeof op.gasLimit === 'undefined');
|
|
920
|
-
}
|
|
921
|
-
else {
|
|
922
|
-
ops.push({ ...op });
|
|
923
|
-
gasLimitPatchableFlags.push(false);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
for (const op of batchParams) {
|
|
929
|
-
if ((0, types_1.isOpWithFee)(op)) {
|
|
930
|
-
const e = estimates.shift();
|
|
931
|
-
const limits = mergeLimits(op, {
|
|
932
|
-
fee: e.suggestedFeeMutez,
|
|
933
|
-
storageLimit: e.storageLimit,
|
|
934
|
-
gasLimit: e.gasLimit,
|
|
935
|
-
});
|
|
936
|
-
ops.push(await this.getRPCOp({ ...op, ...limits }));
|
|
937
|
-
gasLimitPatchableFlags.push(false);
|
|
938
|
-
}
|
|
939
|
-
else {
|
|
940
|
-
ops.push({ ...op });
|
|
941
|
-
gasLimitPatchableFlags.push(false);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
if (revealNeeded) {
|
|
946
|
-
if (!publicKey) {
|
|
947
|
-
throw new core_1.PublicKeyNotFoundError(pkh);
|
|
948
|
-
}
|
|
949
|
-
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(pkh, utils_1.publicKeyHashPrefixes);
|
|
950
|
-
ops.unshift(await (0, contract_1.createRevealOperation)({
|
|
951
|
-
fee: (0, constants_1.getRevealFee)(pkh),
|
|
952
|
-
storageLimit: constants_1.REVEAL_STORAGE_LIMIT,
|
|
953
|
-
gasLimit: (0, constants_1.getRevealGasLimit)(pkh),
|
|
954
|
-
proof: pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash
|
|
955
|
-
? (await this.signer.provePossession()).prefixSig
|
|
956
|
-
: undefined,
|
|
957
|
-
}, pkh, publicKey));
|
|
958
|
-
gasLimitPatchableFlags.unshift(false);
|
|
959
|
-
}
|
|
960
|
-
const hash = await this.getBlockHash();
|
|
961
|
-
const protocol = await this.getProtocolHash();
|
|
962
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
963
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
964
|
-
const contents = this.constructOpContents(ops, headCounter, pkh);
|
|
965
|
-
const gasLimitPatchableIndexes = gasLimitPatchableFlags.flatMap((isPatchable, index) => isPatchable ? [index] : []);
|
|
966
|
-
return {
|
|
967
|
-
opOb: {
|
|
968
|
-
branch: hash,
|
|
969
|
-
contents,
|
|
970
|
-
protocol,
|
|
971
|
-
},
|
|
972
|
-
counter: headCounter,
|
|
973
|
-
simulation: gasLimitPatchableIndexes.length > 0
|
|
974
|
-
? {
|
|
975
|
-
gasLimitPatchableIndexes,
|
|
976
|
-
}
|
|
977
|
-
: undefined,
|
|
978
|
-
};
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
*
|
|
982
|
-
* Method to prepare a contract call operation
|
|
983
|
-
* @param contractMethod ContractMethodObject retrieved from smart contract
|
|
984
|
-
* @returns a PreparedOperation object
|
|
985
|
-
*/
|
|
986
|
-
async contractCall(contractMethod) {
|
|
987
|
-
const hash = await this.getBlockHash();
|
|
988
|
-
const protocol = await this.getProtocolHash();
|
|
989
|
-
const { pkh } = await this.getKeys();
|
|
990
|
-
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
991
|
-
const headCounter = parseInt(await this.getHeadCounter(pkh), 10);
|
|
992
|
-
const params = contractMethod.toTransferParams();
|
|
993
|
-
const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
|
|
994
|
-
const DEFAULT_PARAMS = await this.getOperationLimitsForManagerOperation(protocolConstants, pkh, rpc_1.OpKind.TRANSACTION, params.gasLimit);
|
|
995
|
-
const estimateLimits = mergeLimits({
|
|
996
|
-
fee: params.fee,
|
|
997
|
-
storageLimit: params.storageLimit,
|
|
998
|
-
gasLimit: params.gasLimit,
|
|
999
|
-
}, DEFAULT_PARAMS);
|
|
1000
|
-
const op = {
|
|
1001
|
-
kind: rpc_1.OpKind.TRANSACTION,
|
|
1002
|
-
fee: params.fee ?? estimateLimits.fee,
|
|
1003
|
-
gas_limit: params.gasLimit ?? estimateLimits.gasLimit,
|
|
1004
|
-
storage_limit: params.storageLimit ?? estimateLimits.storageLimit,
|
|
1005
|
-
amount: String(params.amount),
|
|
1006
|
-
destination: params.to,
|
|
1007
|
-
parameters: params.parameter,
|
|
1008
|
-
};
|
|
1009
|
-
const operation = await this.addRevealOperationIfNeeded(op, pkh);
|
|
1010
|
-
const ops = this.convertIntoArray(operation);
|
|
1011
|
-
const contents = this.constructOpContents(ops, headCounter, pkh);
|
|
1012
|
-
const preparedOperation = {
|
|
1013
|
-
opOb: {
|
|
1014
|
-
branch: hash,
|
|
1015
|
-
contents,
|
|
1016
|
-
protocol,
|
|
1017
|
-
},
|
|
1018
|
-
counter: headCounter,
|
|
1019
|
-
};
|
|
1020
|
-
return this.withSimulationMetadata(preparedOperation, this.getSingleManagerOperationSimulation(ops, params.gasLimit));
|
|
1021
|
-
}
|
|
1022
|
-
/**
|
|
1023
|
-
*
|
|
1024
|
-
* Method to convert a PreparedOperation to the params needed for the preapplyOperation method
|
|
1025
|
-
* @param prepared a Prepared Operation
|
|
1026
|
-
* @returns a PreapplyParams object
|
|
1027
|
-
*/
|
|
1028
|
-
async toPreapply(prepared) {
|
|
1029
|
-
const { opOb: { contents, branch, protocol }, } = prepared;
|
|
1030
|
-
const forgeParams = this.toForge(prepared);
|
|
1031
|
-
const forged = await this.context.forger.forge(forgeParams);
|
|
1032
|
-
const sig = await this.context.signer.sign(forged, new Uint8Array([3]));
|
|
1033
|
-
return [{ contents, branch, protocol, signature: sig.prefixSig }];
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
*
|
|
1037
|
-
* Method to convert a PreparedOperation to the params needed for forging
|
|
1038
|
-
* @param param a Prepared Operation
|
|
1039
|
-
* @returns a ForgeParams object
|
|
1040
|
-
*/
|
|
1041
|
-
toForge({ opOb: { contents, branch } }) {
|
|
1042
|
-
return {
|
|
1043
|
-
branch,
|
|
1044
|
-
contents,
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
exports.PrepareProvider = PrepareProvider;
|
|
1049
|
-
_PrepareProvider_counters = new WeakMap();
|