wowok 2.1.9 → 2.1.12
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/NOTICE +46 -0
- package/dist/cjs/bcs/bcs.d.ts +199 -199
- package/dist/cjs/bcs/bcs.js +273 -318
- package/dist/cjs/bcs/bcs.js.map +1 -0
- package/dist/cjs/bcs/effects.d.ts +109 -109
- package/dist/cjs/bcs/effects.js +205 -230
- package/dist/cjs/bcs/effects.js.map +1 -0
- package/dist/cjs/bcs/index.d.ts +1 -2584
- package/dist/cjs/bcs/index.js +61 -76
- package/dist/cjs/bcs/index.js.map +1 -0
- package/dist/cjs/bcs/pure.js +38 -58
- package/dist/cjs/bcs/pure.js.map +1 -0
- package/dist/cjs/bcs/type-tag-serializer.js +102 -114
- package/dist/cjs/bcs/type-tag-serializer.js.map +1 -0
- package/dist/cjs/bcs/types.js +6 -23
- package/dist/cjs/bcs/types.js.map +1 -0
- package/dist/cjs/client/index.js +17 -33
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/client/network.js +25 -40
- package/dist/cjs/client/network.js.map +1 -0
- package/dist/cjs/cryptography/index.js +29 -45
- package/dist/cjs/cryptography/index.js.map +1 -0
- package/dist/cjs/cryptography/intent.d.ts +1 -1
- package/dist/cjs/cryptography/intent.js +20 -31
- package/dist/cjs/cryptography/intent.js.map +1 -0
- package/dist/cjs/cryptography/keypair.js +102 -116
- package/dist/cjs/cryptography/keypair.js.map +1 -0
- package/dist/cjs/cryptography/mnemonics.js +43 -41
- package/dist/cjs/cryptography/mnemonics.js.map +1 -0
- package/dist/cjs/cryptography/publickey.js +112 -134
- package/dist/cjs/cryptography/publickey.js.map +1 -0
- package/dist/cjs/cryptography/signature-scheme.js +24 -43
- package/dist/cjs/cryptography/signature-scheme.js.map +1 -0
- package/dist/cjs/cryptography/signature.d.ts +2 -24
- package/dist/cjs/cryptography/signature.js +50 -67
- package/dist/cjs/cryptography/signature.js.map +1 -0
- package/dist/cjs/experimental/cache.js +65 -0
- package/dist/cjs/experimental/cache.js.map +1 -0
- package/dist/cjs/experimental/client.js +27 -0
- package/dist/cjs/experimental/client.js.map +1 -0
- package/dist/cjs/experimental/core.js +89 -0
- package/dist/cjs/experimental/core.js.map +1 -0
- package/dist/cjs/experimental/errors.js +32 -0
- package/dist/cjs/experimental/errors.js.map +1 -0
- package/dist/cjs/experimental/index.js +15 -0
- package/dist/cjs/experimental/index.js.map +1 -0
- package/dist/cjs/experimental/persistent-storage.js +343 -0
- package/dist/cjs/experimental/persistent-storage.js.map +1 -0
- package/dist/cjs/experimental/persistent-storage.test.js +200 -0
- package/dist/cjs/experimental/persistent-storage.test.js.map +1 -0
- package/dist/cjs/experimental/transports/utils.js +104 -0
- package/dist/cjs/experimental/transports/utils.js.map +1 -0
- package/dist/cjs/experimental/types.js +6 -0
- package/dist/cjs/experimental/types.js.map +1 -0
- package/dist/cjs/faucet/faucet.js +106 -124
- package/dist/cjs/faucet/faucet.js.map +1 -0
- package/dist/cjs/faucet/index.js +12 -28
- package/dist/cjs/faucet/index.js.map +1 -0
- package/dist/cjs/grpc/client.js +47 -62
- package/dist/cjs/grpc/client.js.map +1 -0
- package/dist/cjs/grpc/core.js +580 -617
- package/dist/cjs/grpc/core.js.map +1 -0
- package/dist/cjs/grpc/index.js +9 -25
- package/dist/cjs/grpc/index.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.js +168 -135
- package/dist/cjs/grpc/proto/google/protobuf/any.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +105 -90
- package/dist/cjs/grpc/proto/google/protobuf/duration.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +50 -28
- package/dist/cjs/grpc/proto/google/protobuf/empty.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +96 -75
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +266 -215
- package/dist/cjs/grpc/proto/google/protobuf/struct.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +150 -131
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +331 -302
- package/dist/cjs/grpc/proto/google/rpc/error_details.js.map +1 -0
- package/dist/cjs/grpc/proto/google/rpc/status.js +50 -50
- package/dist/cjs/grpc/proto/google/rpc/status.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +84 -68
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +45 -50
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +38 -43
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +70 -75
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +79 -81
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +183 -166
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +369 -296
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +80 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +31 -28
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +81 -83
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +80 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +876 -506
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +56 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +103 -83
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +76 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +69 -119
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +392 -350
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +599 -473
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +46 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +242 -224
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +32 -52
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +139 -134
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +109 -111
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +46 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +76 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +46 -59
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +568 -522
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +54 -32
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +27 -47
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +83 -86
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +53 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +645 -529
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +37 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +58 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +749 -730
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1218 -975
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +32 -46
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +186 -167
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
- package/dist/cjs/index.js +96 -91
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/jsonRpc/client.js +654 -743
- package/dist/cjs/jsonRpc/client.js.map +1 -0
- package/dist/cjs/jsonRpc/core.d.ts +7 -7
- package/dist/cjs/jsonRpc/core.js +562 -606
- package/dist/cjs/jsonRpc/core.js.map +1 -0
- package/dist/cjs/jsonRpc/errors.js +38 -56
- package/dist/cjs/jsonRpc/errors.js.map +1 -0
- package/dist/cjs/jsonRpc/http-transport.js +70 -114
- package/dist/cjs/jsonRpc/http-transport.js.map +1 -0
- package/dist/cjs/jsonRpc/index.js +14 -30
- package/dist/cjs/jsonRpc/index.js.map +1 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +286 -290
- package/dist/cjs/jsonRpc/json-rpc-resolver.js.map +1 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +150 -207
- package/dist/cjs/jsonRpc/rpc-websocket-client.js.map +1 -0
- package/dist/cjs/jsonRpc/types/chain.js +4 -15
- package/dist/cjs/jsonRpc/types/chain.js.map +1 -0
- package/dist/cjs/jsonRpc/types/changes.js +4 -15
- package/dist/cjs/jsonRpc/types/changes.js.map +1 -0
- package/dist/cjs/jsonRpc/types/coins.js +4 -15
- package/dist/cjs/jsonRpc/types/coins.js.map +1 -0
- package/dist/cjs/jsonRpc/types/common.js +4 -15
- package/dist/cjs/jsonRpc/types/common.js.map +1 -0
- package/dist/cjs/jsonRpc/types/generated.d.ts +1 -1
- package/dist/cjs/jsonRpc/types/generated.js +4 -15
- package/dist/cjs/jsonRpc/types/generated.js.map +1 -0
- package/dist/cjs/jsonRpc/types/index.js +4 -15
- package/dist/cjs/jsonRpc/types/index.js.map +1 -0
- package/dist/cjs/jsonRpc/types/params.js +4 -15
- package/dist/cjs/jsonRpc/types/params.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +54 -69
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/index.js +10 -26
- package/dist/cjs/keypairs/ed25519/index.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/keypair.js +134 -159
- package/dist/cjs/keypairs/ed25519/keypair.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/publickey.js +70 -84
- package/dist/cjs/keypairs/ed25519/publickey.js.map +1 -0
- package/dist/cjs/keypairs/index.js +21 -19
- package/dist/cjs/keypairs/index.js.map +1 -0
- package/dist/cjs/keypairs/passkey/index.js +11 -27
- package/dist/cjs/keypairs/passkey/index.js.map +1 -0
- package/dist/cjs/keypairs/passkey/keypair.js +245 -256
- package/dist/cjs/keypairs/passkey/keypair.js.map +1 -0
- package/dist/cjs/keypairs/passkey/publickey.js +163 -162
- package/dist/cjs/keypairs/passkey/publickey.js.map +1 -0
- package/dist/cjs/keypairs/passkey/types.js +4 -15
- package/dist/cjs/keypairs/passkey/types.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/index.js +10 -26
- package/dist/cjs/keypairs/secp256k1/index.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/keypair.js +129 -151
- package/dist/cjs/keypairs/secp256k1/keypair.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/publickey.js +71 -89
- package/dist/cjs/keypairs/secp256k1/publickey.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/index.js +10 -26
- package/dist/cjs/keypairs/secp256r1/index.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/keypair.js +127 -148
- package/dist/cjs/keypairs/secp256r1/keypair.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/publickey.js +72 -90
- package/dist/cjs/keypairs/secp256r1/publickey.js.map +1 -0
- package/dist/cjs/multisig/index.js +10 -26
- package/dist/cjs/multisig/index.js.map +1 -0
- package/dist/cjs/multisig/publickey.d.ts +1 -1
- package/dist/cjs/multisig/publickey.js +228 -276
- package/dist/cjs/multisig/publickey.js.map +1 -0
- package/dist/cjs/multisig/signer.js +62 -110
- package/dist/cjs/multisig/signer.js.map +1 -0
- package/dist/cjs/transactions/Arguments.d.ts +4 -4
- package/dist/cjs/transactions/Arguments.js +13 -34
- package/dist/cjs/transactions/Arguments.js.map +1 -0
- package/dist/cjs/transactions/Commands.js +111 -141
- package/dist/cjs/transactions/Commands.js.map +1 -0
- package/dist/cjs/transactions/Inputs.js +53 -82
- package/dist/cjs/transactions/Inputs.js.map +1 -0
- package/dist/cjs/transactions/ObjectCache.d.ts +8 -8
- package/dist/cjs/transactions/ObjectCache.js +204 -241
- package/dist/cjs/transactions/ObjectCache.js.map +1 -0
- package/dist/cjs/transactions/Transaction.d.ts +31 -31
- package/dist/cjs/transactions/Transaction.js +628 -719
- package/dist/cjs/transactions/Transaction.js.map +1 -0
- package/dist/cjs/transactions/TransactionData.d.ts +9 -9
- package/dist/cjs/transactions/TransactionData.js +396 -440
- package/dist/cjs/transactions/TransactionData.js.map +1 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.js +169 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.js.map +1 -0
- package/dist/cjs/transactions/__tests__/bcs.test.js +202 -0
- package/dist/cjs/transactions/__tests__/bcs.test.js.map +1 -0
- package/dist/cjs/transactions/data/internal.js +166 -207
- package/dist/cjs/transactions/data/internal.js.map +1 -0
- package/dist/cjs/transactions/data/v1.js +436 -495
- package/dist/cjs/transactions/data/v1.js.map +1 -0
- package/dist/cjs/transactions/data/v2.d.ts +5 -5
- package/dist/cjs/transactions/data/v2.js +94 -107
- package/dist/cjs/transactions/data/v2.js.map +1 -0
- package/dist/cjs/transactions/executor/caching.js +71 -113
- package/dist/cjs/transactions/executor/caching.js.map +1 -0
- package/dist/cjs/transactions/executor/parallel.js +339 -378
- package/dist/cjs/transactions/executor/parallel.js.map +1 -0
- package/dist/cjs/transactions/executor/queue.js +60 -80
- package/dist/cjs/transactions/executor/queue.js.map +1 -0
- package/dist/cjs/transactions/executor/serial.d.ts +4 -4
- package/dist/cjs/transactions/executor/serial.js +102 -131
- package/dist/cjs/transactions/executor/serial.js.map +1 -0
- package/dist/cjs/transactions/hash.js +17 -28
- package/dist/cjs/transactions/hash.js.map +1 -0
- package/dist/cjs/transactions/index.js +33 -49
- package/dist/cjs/transactions/index.js.map +1 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.js +137 -191
- package/dist/cjs/transactions/intents/CoinWithBalance.js.map +1 -0
- package/dist/cjs/transactions/object.js +88 -111
- package/dist/cjs/transactions/object.js.map +1 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +20 -32
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
- package/dist/cjs/transactions/pure.js +38 -60
- package/dist/cjs/transactions/pure.js.map +1 -0
- package/dist/cjs/transactions/resolve.js +62 -88
- package/dist/cjs/transactions/resolve.js.map +1 -0
- package/dist/cjs/transactions/serializer.js +150 -163
- package/dist/cjs/transactions/serializer.js.map +1 -0
- package/dist/cjs/transactions/utils.d.ts +1 -1
- package/dist/cjs/transactions/utils.js +114 -125
- package/dist/cjs/transactions/utils.js.map +1 -0
- package/dist/cjs/utils/constants.js +29 -56
- package/dist/cjs/utils/constants.js.map +1 -0
- package/dist/cjs/utils/derived-objects.js +14 -30
- package/dist/cjs/utils/derived-objects.js.map +1 -0
- package/dist/cjs/utils/dynamic-fields.js +20 -37
- package/dist/cjs/utils/dynamic-fields.js.map +1 -0
- package/dist/cjs/utils/format.js +14 -30
- package/dist/cjs/utils/format.js.map +1 -0
- package/dist/cjs/utils/index.js +50 -64
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/move-registry.js +37 -35
- package/dist/cjs/utils/move-registry.js.map +1 -0
- package/dist/cjs/utils/sui-types.js +74 -68
- package/dist/cjs/utils/sui-types.js.map +1 -0
- package/dist/cjs/utils/suins.js +30 -46
- package/dist/cjs/utils/suins.js.map +1 -0
- package/dist/cjs/verify/index.js +12 -27
- package/dist/cjs/verify/index.js.map +1 -0
- package/dist/cjs/verify/verify.js +83 -110
- package/dist/cjs/verify/verify.js.map +1 -0
- package/dist/cjs/version.js +8 -25
- package/dist/cjs/version.js.map +1 -0
- package/dist/cjs/w/call/allocation.js +323 -413
- package/dist/cjs/w/call/allocation.js.map +1 -0
- package/dist/cjs/w/call/arb.js +105 -136
- package/dist/cjs/w/call/arb.js.map +1 -0
- package/dist/cjs/w/call/arbitration.js +1206 -1581
- package/dist/cjs/w/call/arbitration.js.map +1 -0
- package/dist/cjs/w/call/base.js +303 -333
- package/dist/cjs/w/call/base.js.map +1 -0
- package/dist/cjs/w/call/contact.js +335 -452
- package/dist/cjs/w/call/contact.js.map +1 -0
- package/dist/cjs/w/call/demand.js +690 -844
- package/dist/cjs/w/call/demand.js.map +1 -0
- package/dist/cjs/w/call/entity.js +167 -201
- package/dist/cjs/w/call/entity.js.map +1 -0
- package/dist/cjs/w/call/guard-ins.d.ts +1 -0
- package/dist/cjs/w/call/guard-ins.js +4376 -4384
- package/dist/cjs/w/call/guard-ins.js.map +1 -0
- package/dist/cjs/w/call/guard.d.ts +10 -0
- package/dist/cjs/w/call/guard.js +1078 -1119
- package/dist/cjs/w/call/guard.js.map +1 -0
- package/dist/cjs/w/call/index.d.ts +1 -1
- package/dist/cjs/w/call/index.js +69 -69
- package/dist/cjs/w/call/index.js.map +1 -0
- package/dist/cjs/w/call/machine.js +1105 -1419
- package/dist/cjs/w/call/machine.js.map +1 -0
- package/dist/cjs/w/call/order.js +314 -454
- package/dist/cjs/w/call/order.js.map +1 -0
- package/dist/cjs/w/call/passport.js +214 -253
- package/dist/cjs/w/call/passport.js.map +1 -0
- package/dist/cjs/w/call/payment.js +187 -224
- package/dist/cjs/w/call/payment.js.map +1 -0
- package/dist/cjs/w/call/permission.js +1183 -1294
- package/dist/cjs/w/call/permission.js.map +1 -0
- package/dist/cjs/w/call/personal.js +132 -170
- package/dist/cjs/w/call/personal.js.map +1 -0
- package/dist/cjs/w/call/progress.js +634 -794
- package/dist/cjs/w/call/progress.js.map +1 -0
- package/dist/cjs/w/call/proof.js +67 -116
- package/dist/cjs/w/call/proof.js.map +1 -0
- package/dist/cjs/w/call/repository.js +1037 -1251
- package/dist/cjs/w/call/repository.js.map +1 -0
- package/dist/cjs/w/call/resource.js +111 -131
- package/dist/cjs/w/call/resource.js.map +1 -0
- package/dist/cjs/w/call/reward.js +675 -853
- package/dist/cjs/w/call/reward.js.map +1 -0
- package/dist/cjs/w/call/service.js +1879 -2385
- package/dist/cjs/w/call/service.js.map +1 -0
- package/dist/cjs/w/call/treasury.js +841 -1138
- package/dist/cjs/w/call/treasury.js.map +1 -0
- package/dist/cjs/w/call/util.js +593 -624
- package/dist/cjs/w/call/util.js.map +1 -0
- package/dist/cjs/w/common.d.ts +1 -1
- package/dist/cjs/w/common.js +548 -518
- package/dist/cjs/w/common.js.map +1 -0
- package/dist/cjs/w/exception.js +574 -584
- package/dist/cjs/w/exception.js.map +1 -0
- package/dist/cjs/w/index.js +26 -23
- package/dist/cjs/w/index.js.map +1 -0
- package/dist/cjs/w/local/account.js +664 -741
- package/dist/cjs/w/local/account.js.map +1 -0
- package/dist/cjs/w/local/cache.js +180 -166
- package/dist/cjs/w/local/cache.js.map +1 -0
- package/dist/cjs/w/local/config.js +51 -80
- package/dist/cjs/w/local/config.js.map +1 -0
- package/dist/cjs/w/local/index.js +225 -290
- package/dist/cjs/w/local/index.js.map +1 -0
- package/dist/cjs/w/local/local.d.ts +2 -2
- package/dist/cjs/w/local/local.js +638 -646
- package/dist/cjs/w/local/local.js.map +1 -0
- package/dist/cjs/w/local/storage.js +210 -164
- package/dist/cjs/w/local/storage.js.map +1 -0
- package/dist/cjs/w/local/token.js +158 -175
- package/dist/cjs/w/local/token.js.map +1 -0
- package/dist/cjs/w/local/util.js +80 -51
- package/dist/cjs/w/local/util.js.map +1 -0
- package/dist/cjs/w/local/wip.js +1078 -802
- package/dist/cjs/w/local/wip.js.map +1 -0
- package/dist/cjs/w/messenger/crypto.js +496 -389
- package/dist/cjs/w/messenger/crypto.js.map +1 -0
- package/dist/cjs/w/messenger/index.js +53 -35
- package/dist/cjs/w/messenger/index.js.map +1 -0
- package/dist/cjs/w/messenger/messenger-api.js +1159 -1035
- package/dist/cjs/w/messenger/messenger-api.js.map +1 -0
- package/dist/cjs/w/messenger/messenger-manager.js +954 -1083
- package/dist/cjs/w/messenger/messenger-manager.js.map +1 -0
- package/dist/cjs/w/messenger/messenger.d.ts +1 -1
- package/dist/cjs/w/messenger/messenger.js +1304 -1450
- package/dist/cjs/w/messenger/messenger.js.map +1 -0
- package/dist/cjs/w/messenger/server.js +390 -512
- package/dist/cjs/w/messenger/server.js.map +1 -0
- package/dist/cjs/w/messenger/session.js +399 -403
- package/dist/cjs/w/messenger/session.js.map +1 -0
- package/dist/cjs/w/messenger/storage.js +881 -777
- package/dist/cjs/w/messenger/storage.js.map +1 -0
- package/dist/cjs/w/messenger/types.d.ts +2 -2
- package/dist/cjs/w/messenger/types.js +83 -103
- package/dist/cjs/w/messenger/types.js.map +1 -0
- package/dist/cjs/w/messenger/utils.js +29 -34
- package/dist/cjs/w/messenger/utils.js.map +1 -0
- package/dist/cjs/w/query/bult-in.js +101 -110
- package/dist/cjs/w/query/bult-in.js.map +1 -0
- package/dist/cjs/w/query/event.js +134 -146
- package/dist/cjs/w/query/event.js.map +1 -0
- package/dist/cjs/w/query/index.js +22 -20
- package/dist/cjs/w/query/index.js.map +1 -0
- package/dist/cjs/w/query/object.js +1576 -1576
- package/dist/cjs/w/query/object.js.map +1 -0
- package/dist/cjs/w/query/received.js +66 -88
- package/dist/cjs/w/query/received.js.map +1 -0
- package/dist/cjs/w/query/util.js +53 -77
- package/dist/cjs/w/query/util.js.map +1 -0
- package/dist/cjs/w/util.js +589 -675
- package/dist/cjs/w/util.js.map +1 -0
- package/dist/esm/bcs/bcs.d.ts +199 -199
- package/dist/esm/bcs/bcs.js +269 -310
- package/dist/esm/bcs/bcs.js.map +1 -0
- package/dist/esm/bcs/effects.d.ts +109 -109
- package/dist/esm/bcs/effects.js +171 -179
- package/dist/esm/bcs/effects.js.map +1 -0
- package/dist/esm/bcs/index.d.ts +1 -2584
- package/dist/esm/bcs/index.js +51 -94
- package/dist/esm/bcs/index.js.map +1 -0
- package/dist/esm/bcs/pure.js +35 -38
- package/dist/esm/bcs/pure.js.map +1 -0
- package/dist/esm/bcs/type-tag-serializer.js +98 -95
- package/dist/esm/bcs/type-tag-serializer.js.map +1 -0
- package/dist/esm/bcs/types.js +5 -5
- package/dist/esm/bcs/types.js.map +1 -0
- package/dist/esm/client/index.js +7 -23
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/client/network.js +23 -22
- package/dist/esm/client/network.js.map +1 -0
- package/dist/esm/cryptography/index.js +9 -46
- package/dist/esm/cryptography/index.js.map +1 -0
- package/dist/esm/cryptography/intent.d.ts +1 -1
- package/dist/esm/cryptography/intent.js +18 -12
- package/dist/esm/cryptography/intent.js.map +1 -0
- package/dist/esm/cryptography/keypair.js +95 -99
- package/dist/esm/cryptography/keypair.js.map +1 -0
- package/dist/esm/cryptography/mnemonics.js +40 -24
- package/dist/esm/cryptography/mnemonics.js.map +1 -0
- package/dist/esm/cryptography/publickey.js +104 -115
- package/dist/esm/cryptography/publickey.js.map +1 -0
- package/dist/esm/cryptography/signature-scheme.js +22 -24
- package/dist/esm/cryptography/signature-scheme.js.map +1 -0
- package/dist/esm/cryptography/signature.d.ts +2 -24
- package/dist/esm/cryptography/signature.js +44 -48
- package/dist/esm/cryptography/signature.js.map +1 -0
- package/dist/esm/experimental/cache.js +61 -0
- package/dist/esm/experimental/cache.js.map +1 -0
- package/dist/esm/experimental/client.js +23 -0
- package/dist/esm/experimental/client.js.map +1 -0
- package/dist/esm/experimental/core.js +85 -0
- package/dist/esm/experimental/core.js.map +1 -0
- package/dist/esm/experimental/errors.js +27 -0
- package/dist/esm/experimental/errors.js.map +1 -0
- package/dist/esm/experimental/index.js +8 -0
- package/dist/esm/experimental/index.js.map +1 -0
- package/dist/esm/experimental/persistent-storage.js +337 -0
- package/dist/esm/experimental/persistent-storage.js.map +1 -0
- package/dist/esm/experimental/persistent-storage.test.js +198 -0
- package/dist/esm/experimental/persistent-storage.test.js.map +1 -0
- package/dist/esm/experimental/transports/utils.js +100 -0
- package/dist/esm/experimental/transports/utils.js.map +1 -0
- package/dist/esm/experimental/types.js +5 -0
- package/dist/esm/experimental/types.js.map +1 -0
- package/dist/esm/faucet/faucet.js +104 -111
- package/dist/esm/faucet/faucet.js.map +1 -0
- package/dist/esm/faucet/index.js +4 -16
- package/dist/esm/faucet/index.js.map +1 -0
- package/dist/esm/grpc/client.js +34 -34
- package/dist/esm/grpc/client.js.map +1 -0
- package/dist/esm/grpc/core.js +570 -601
- package/dist/esm/grpc/core.js.map +1 -0
- package/dist/esm/grpc/index.js +5 -6
- package/dist/esm/grpc/index.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/any.js +161 -111
- package/dist/esm/grpc/proto/google/protobuf/any.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.js +99 -67
- package/dist/esm/grpc/proto/google/protobuf/duration.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.js +46 -7
- package/dist/esm/grpc/proto/google/protobuf/empty.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +90 -52
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.js +258 -190
- package/dist/esm/grpc/proto/google/protobuf/struct.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +144 -108
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.js +313 -267
- package/dist/esm/grpc/proto/google/rpc/error_details.js.map +1 -0
- package/dist/esm/grpc/proto/google/rpc/status.js +45 -28
- package/dist/esm/grpc/proto/google/rpc/status.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +80 -47
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +41 -29
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +34 -22
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +61 -49
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +72 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +173 -139
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +358 -268
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +72 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +29 -9
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +74 -59
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +69 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +861 -474
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +52 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +98 -61
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +71 -56
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +65 -100
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +365 -306
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +585 -442
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +42 -59
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +226 -191
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +28 -33
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +129 -107
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +100 -85
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +42 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +72 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +42 -38
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +544 -481
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +52 -13
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +23 -28
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +74 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +49 -66
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +623 -490
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +33 -32
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +50 -36
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +737 -701
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1177 -917
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +28 -27
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +169 -133
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
- package/dist/esm/index.js +21 -107
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/jsonRpc/client.js +646 -727
- package/dist/esm/jsonRpc/client.js.map +1 -0
- package/dist/esm/jsonRpc/core.d.ts +7 -7
- package/dist/esm/jsonRpc/core.js +550 -581
- package/dist/esm/jsonRpc/core.js.map +1 -0
- package/dist/esm/jsonRpc/errors.js +36 -41
- package/dist/esm/jsonRpc/errors.js.map +1 -0
- package/dist/esm/jsonRpc/http-transport.js +65 -93
- package/dist/esm/jsonRpc/http-transport.js.map +1 -0
- package/dist/esm/jsonRpc/index.js +6 -20
- package/dist/esm/jsonRpc/index.js.map +1 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.js +281 -276
- package/dist/esm/jsonRpc/json-rpc-resolver.js.map +1 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.js +147 -189
- package/dist/esm/jsonRpc/rpc-websocket-client.js.map +1 -0
- package/dist/esm/jsonRpc/types/chain.js +4 -0
- package/dist/esm/jsonRpc/types/chain.js.map +1 -0
- package/dist/esm/jsonRpc/types/changes.js +4 -0
- package/dist/esm/jsonRpc/types/changes.js.map +1 -0
- package/dist/esm/jsonRpc/types/coins.js +4 -0
- package/dist/esm/jsonRpc/types/coins.js.map +1 -0
- package/dist/esm/jsonRpc/types/common.js +4 -0
- package/dist/esm/jsonRpc/types/common.js.map +1 -0
- package/dist/esm/jsonRpc/types/generated.d.ts +1 -1
- package/dist/esm/jsonRpc/types/generated.js +4 -0
- package/dist/esm/jsonRpc/types/generated.js.map +1 -0
- package/dist/esm/jsonRpc/types/index.js +4 -0
- package/dist/esm/jsonRpc/types/index.js.map +1 -0
- package/dist/esm/jsonRpc/types/params.js +4 -0
- package/dist/esm/jsonRpc/types/params.js.map +1 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +49 -48
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
- package/dist/esm/keypairs/ed25519/index.js +5 -10
- package/dist/esm/keypairs/ed25519/index.js.map +1 -0
- package/dist/esm/keypairs/ed25519/keypair.js +128 -146
- package/dist/esm/keypairs/ed25519/keypair.js.map +1 -0
- package/dist/esm/keypairs/ed25519/publickey.js +64 -67
- package/dist/esm/keypairs/ed25519/publickey.js.map +1 -0
- package/dist/esm/keypairs/index.js +3 -0
- package/dist/esm/keypairs/index.js.map +1 -0
- package/dist/esm/keypairs/passkey/index.js +5 -12
- package/dist/esm/keypairs/passkey/index.js.map +1 -0
- package/dist/esm/keypairs/passkey/keypair.js +236 -243
- package/dist/esm/keypairs/passkey/keypair.js.map +1 -0
- package/dist/esm/keypairs/passkey/publickey.js +154 -140
- package/dist/esm/keypairs/passkey/publickey.js.map +1 -0
- package/dist/esm/keypairs/passkey/types.js +4 -0
- package/dist/esm/keypairs/passkey/types.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/index.js +5 -10
- package/dist/esm/keypairs/secp256k1/index.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/keypair.js +120 -134
- package/dist/esm/keypairs/secp256k1/keypair.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/publickey.js +64 -71
- package/dist/esm/keypairs/secp256k1/publickey.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/index.js +5 -10
- package/dist/esm/keypairs/secp256r1/index.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/keypair.js +118 -131
- package/dist/esm/keypairs/secp256r1/keypair.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/publickey.js +63 -66
- package/dist/esm/keypairs/secp256r1/publickey.js.map +1 -0
- package/dist/esm/multisig/index.js +5 -10
- package/dist/esm/multisig/index.js.map +1 -0
- package/dist/esm/multisig/publickey.d.ts +1 -1
- package/dist/esm/multisig/publickey.js +216 -253
- package/dist/esm/multisig/publickey.js.map +1 -0
- package/dist/esm/multisig/signer.js +57 -89
- package/dist/esm/multisig/signer.js.map +1 -0
- package/dist/esm/transactions/Arguments.d.ts +4 -4
- package/dist/esm/transactions/Arguments.js +9 -13
- package/dist/esm/transactions/Arguments.js.map +1 -0
- package/dist/esm/transactions/Commands.js +105 -118
- package/dist/esm/transactions/Commands.js.map +1 -0
- package/dist/esm/transactions/Inputs.js +49 -61
- package/dist/esm/transactions/Inputs.js.map +1 -0
- package/dist/esm/transactions/ObjectCache.d.ts +8 -8
- package/dist/esm/transactions/ObjectCache.js +200 -223
- package/dist/esm/transactions/ObjectCache.js.map +1 -0
- package/dist/esm/transactions/Transaction.d.ts +32 -32
- package/dist/esm/transactions/Transaction.js +611 -696
- package/dist/esm/transactions/Transaction.js.map +1 -0
- package/dist/esm/transactions/TransactionData.d.ts +9 -9
- package/dist/esm/transactions/TransactionData.js +386 -415
- package/dist/esm/transactions/TransactionData.js.map +1 -0
- package/dist/esm/transactions/__tests__/Transaction.test.js +167 -0
- package/dist/esm/transactions/__tests__/Transaction.test.js.map +1 -0
- package/dist/esm/transactions/__tests__/bcs.test.js +200 -0
- package/dist/esm/transactions/__tests__/bcs.test.js.map +1 -0
- package/dist/esm/transactions/data/internal.js +158 -205
- package/dist/esm/transactions/data/internal.js.map +1 -0
- package/dist/esm/transactions/data/v1.js +419 -487
- package/dist/esm/transactions/data/v1.js.map +1 -0
- package/dist/esm/transactions/data/v2.d.ts +5 -5
- package/dist/esm/transactions/data/v2.js +89 -107
- package/dist/esm/transactions/data/v2.js.map +1 -0
- package/dist/esm/transactions/executor/caching.d.ts +2 -2
- package/dist/esm/transactions/executor/caching.js +66 -93
- package/dist/esm/transactions/executor/caching.js.map +1 -0
- package/dist/esm/transactions/executor/parallel.js +329 -352
- package/dist/esm/transactions/executor/parallel.js.map +1 -0
- package/dist/esm/transactions/executor/queue.js +58 -64
- package/dist/esm/transactions/executor/queue.js.map +1 -0
- package/dist/esm/transactions/executor/serial.d.ts +5 -5
- package/dist/esm/transactions/executor/serial.js +96 -110
- package/dist/esm/transactions/executor/serial.js.map +1 -0
- package/dist/esm/transactions/hash.js +15 -9
- package/dist/esm/transactions/hash.js.map +1 -0
- package/dist/esm/transactions/index.js +15 -41
- package/dist/esm/transactions/index.js.map +1 -0
- package/dist/esm/transactions/intents/CoinWithBalance.js +127 -165
- package/dist/esm/transactions/intents/CoinWithBalance.js.map +1 -0
- package/dist/esm/transactions/object.js +86 -92
- package/dist/esm/transactions/object.js.map +1 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +18 -15
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
- package/dist/esm/transactions/pure.js +34 -39
- package/dist/esm/transactions/pure.js.map +1 -0
- package/dist/esm/transactions/resolve.js +58 -69
- package/dist/esm/transactions/resolve.js.map +1 -0
- package/dist/esm/transactions/serializer.js +145 -144
- package/dist/esm/transactions/serializer.js.map +1 -0
- package/dist/esm/transactions/utils.d.ts +1 -1
- package/dist/esm/transactions/utils.js +110 -109
- package/dist/esm/transactions/utils.js.map +1 -0
- package/dist/esm/utils/constants.js +26 -36
- package/dist/esm/utils/constants.js.map +1 -0
- package/dist/esm/utils/derived-objects.js +11 -10
- package/dist/esm/utils/derived-objects.js.map +1 -0
- package/dist/esm/utils/dynamic-fields.js +16 -16
- package/dist/esm/utils/dynamic-fields.js.map +1 -0
- package/dist/esm/utils/format.js +13 -13
- package/dist/esm/utils/format.js.map +1 -0
- package/dist/esm/utils/index.js +15 -76
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/move-registry.js +34 -17
- package/dist/esm/utils/move-registry.js.map +1 -0
- package/dist/esm/utils/sui-types.js +70 -54
- package/dist/esm/utils/sui-types.js.map +1 -0
- package/dist/esm/utils/suins.js +29 -29
- package/dist/esm/utils/suins.js.map +1 -0
- package/dist/esm/verify/index.js +5 -14
- package/dist/esm/verify/index.js.map +1 -0
- package/dist/esm/verify/verify.js +76 -93
- package/dist/esm/verify/verify.js.map +1 -0
- package/dist/esm/version.js +6 -6
- package/dist/esm/version.js.map +1 -0
- package/dist/esm/w/call/allocation.js +307 -402
- package/dist/esm/w/call/allocation.js.map +1 -0
- package/dist/esm/w/call/arb.js +100 -129
- package/dist/esm/w/call/arb.js.map +1 -0
- package/dist/esm/w/call/arbitration.js +1170 -1568
- package/dist/esm/w/call/arbitration.js.map +1 -0
- package/dist/esm/w/call/base.js +288 -315
- package/dist/esm/w/call/base.js.map +1 -0
- package/dist/esm/w/call/contact.js +318 -442
- package/dist/esm/w/call/contact.js.map +1 -0
- package/dist/esm/w/call/demand.js +673 -841
- package/dist/esm/w/call/demand.js.map +1 -0
- package/dist/esm/w/call/entity.js +162 -203
- package/dist/esm/w/call/entity.js.map +1 -0
- package/dist/esm/w/call/guard-ins.d.ts +1 -0
- package/dist/esm/w/call/guard-ins.js +4373 -4366
- package/dist/esm/w/call/guard-ins.js.map +1 -0
- package/dist/esm/w/call/guard.d.ts +10 -0
- package/dist/esm/w/call/guard.js +1061 -1115
- package/dist/esm/w/call/guard.js.map +1 -0
- package/dist/esm/w/call/index.d.ts +1 -1
- package/dist/esm/w/call/index.js +24 -54
- package/dist/esm/w/call/index.js.map +1 -0
- package/dist/esm/w/call/machine.js +1086 -1433
- package/dist/esm/w/call/machine.js.map +1 -0
- package/dist/esm/w/call/order.js +301 -448
- package/dist/esm/w/call/order.js.map +1 -0
- package/dist/esm/w/call/passport.js +204 -240
- package/dist/esm/w/call/passport.js.map +1 -0
- package/dist/esm/w/call/payment.js +177 -215
- package/dist/esm/w/call/payment.js.map +1 -0
- package/dist/esm/w/call/permission.js +1172 -1320
- package/dist/esm/w/call/permission.js.map +1 -0
- package/dist/esm/w/call/personal.js +121 -156
- package/dist/esm/w/call/personal.js.map +1 -0
- package/dist/esm/w/call/progress.js +625 -797
- package/dist/esm/w/call/progress.js.map +1 -0
- package/dist/esm/w/call/proof.js +61 -103
- package/dist/esm/w/call/proof.js.map +1 -0
- package/dist/esm/w/call/repository.js +1017 -1251
- package/dist/esm/w/call/repository.js.map +1 -0
- package/dist/esm/w/call/resource.js +108 -124
- package/dist/esm/w/call/resource.js.map +1 -0
- package/dist/esm/w/call/reward.js +660 -847
- package/dist/esm/w/call/reward.js.map +1 -0
- package/dist/esm/w/call/service.js +1849 -2400
- package/dist/esm/w/call/service.js.map +1 -0
- package/dist/esm/w/call/treasury.js +815 -1125
- package/dist/esm/w/call/treasury.js.map +1 -0
- package/dist/esm/w/call/util.js +553 -576
- package/dist/esm/w/call/util.js.map +1 -0
- package/dist/esm/w/common.d.ts +1 -1
- package/dist/esm/w/common.js +579 -580
- package/dist/esm/w/common.js.map +1 -0
- package/dist/esm/w/exception.js +570 -573
- package/dist/esm/w/exception.js.map +1 -0
- package/dist/esm/w/index.js +4 -0
- package/dist/esm/w/index.js.map +1 -0
- package/dist/esm/w/local/account.js +652 -709
- package/dist/esm/w/local/account.js.map +1 -0
- package/dist/esm/w/local/cache.js +176 -147
- package/dist/esm/w/local/cache.js.map +1 -0
- package/dist/esm/w/local/config.js +46 -60
- package/dist/esm/w/local/config.js.map +1 -0
- package/dist/esm/w/local/index.js +196 -273
- package/dist/esm/w/local/index.js.map +1 -0
- package/dist/esm/w/local/local.d.ts +2 -2
- package/dist/esm/w/local/local.js +631 -626
- package/dist/esm/w/local/local.js.map +1 -0
- package/dist/esm/w/local/storage.js +168 -136
- package/dist/esm/w/local/storage.js.map +1 -0
- package/dist/esm/w/local/token.js +149 -151
- package/dist/esm/w/local/token.js.map +1 -0
- package/dist/esm/w/local/util.js +45 -22
- package/dist/esm/w/local/util.js.map +1 -0
- package/dist/esm/w/local/wip.js +1038 -781
- package/dist/esm/w/local/wip.js.map +1 -0
- package/dist/esm/w/messenger/crypto.js +491 -387
- package/dist/esm/w/messenger/crypto.js.map +1 -0
- package/dist/esm/w/messenger/index.js +27 -24
- package/dist/esm/w/messenger/index.js.map +1 -0
- package/dist/esm/w/messenger/messenger-api.js +1111 -1017
- package/dist/esm/w/messenger/messenger-api.js.map +1 -0
- package/dist/esm/w/messenger/messenger-manager.js +944 -1052
- package/dist/esm/w/messenger/messenger-manager.js.map +1 -0
- package/dist/esm/w/messenger/messenger.d.ts +1 -1
- package/dist/esm/w/messenger/messenger.js +1258 -1421
- package/dist/esm/w/messenger/messenger.js.map +1 -0
- package/dist/esm/w/messenger/server.js +388 -499
- package/dist/esm/w/messenger/server.js.map +1 -0
- package/dist/esm/w/messenger/session.js +394 -399
- package/dist/esm/w/messenger/session.js.map +1 -0
- package/dist/esm/w/messenger/storage.js +840 -751
- package/dist/esm/w/messenger/storage.js.map +1 -0
- package/dist/esm/w/messenger/types.d.ts +2 -2
- package/dist/esm/w/messenger/types.js +80 -85
- package/dist/esm/w/messenger/types.js.map +1 -0
- package/dist/esm/w/messenger/utils.js +28 -16
- package/dist/esm/w/messenger/utils.js.map +1 -0
- package/dist/esm/w/query/bult-in.js +95 -100
- package/dist/esm/w/query/bult-in.js.map +1 -0
- package/dist/esm/w/query/event.js +128 -125
- package/dist/esm/w/query/event.js.map +1 -0
- package/dist/esm/w/query/index.js +3 -0
- package/dist/esm/w/query/index.js.map +1 -0
- package/dist/esm/w/query/object.js +1560 -1574
- package/dist/esm/w/query/object.js.map +1 -0
- package/dist/esm/w/query/received.js +57 -63
- package/dist/esm/w/query/received.js.map +1 -0
- package/dist/esm/w/query/util.js +48 -56
- package/dist/esm/w/query/util.js.map +1 -0
- package/dist/esm/w/util.js +578 -673
- package/dist/esm/w/util.js.map +1 -0
- package/package.json +14 -9
- package/dist/cjs/graphql/client.js +0 -98
- package/dist/cjs/graphql/core.js +0 -506
- package/dist/cjs/graphql/generated/2024.1/tada-env.js +0 -13141
- package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/2024.4/tada-env.js +0 -13287
- package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/latest/tada-env.js +0 -12925
- package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/queries.js +0 -807
- package/dist/cjs/graphql/index.js +0 -25
- package/dist/cjs/graphql/schemas/2024.1/index.js +0 -28
- package/dist/cjs/graphql/schemas/2024.4/index.js +0 -28
- package/dist/cjs/graphql/schemas/latest/index.js +0 -28
- package/dist/cjs/graphql/types.js +0 -16
- package/dist/cjs/package.json +0 -5
- package/dist/cjs/w/local/.eslintrc.js +0 -15
- package/dist/cjs/w/messenger/.eslintrc.js +0 -15
- package/dist/cjs/zklogin/address.js +0 -93
- package/dist/cjs/zklogin/bcs.js +0 -41
- package/dist/cjs/zklogin/index.js +0 -45
- package/dist/cjs/zklogin/jwt-decode.js +0 -88
- package/dist/cjs/zklogin/jwt-utils.js +0 -128
- package/dist/cjs/zklogin/nonce.js +0 -60
- package/dist/cjs/zklogin/poseidon.js +0 -64
- package/dist/cjs/zklogin/publickey.js +0 -281
- package/dist/cjs/zklogin/signature.js +0 -57
- package/dist/cjs/zklogin/utils.js +0 -98
- package/dist/esm/graphql/client.js +0 -79
- package/dist/esm/graphql/core.js +0 -505
- package/dist/esm/graphql/generated/2024.1/tada-env.js +0 -13121
- package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/2024.4/tada-env.js +0 -13267
- package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/latest/tada-env.js +0 -12905
- package/dist/esm/graphql/generated/latest/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/queries.js +0 -788
- package/dist/esm/graphql/index.js +0 -8
- package/dist/esm/graphql/schemas/2024.1/index.js +0 -8
- package/dist/esm/graphql/schemas/2024.4/index.js +0 -8
- package/dist/esm/graphql/schemas/latest/index.js +0 -8
- package/dist/esm/graphql/types.js +0 -0
- package/dist/esm/package.json +0 -5
- package/dist/esm/w/local/.eslintrc.js +0 -23
- package/dist/esm/w/messenger/.eslintrc.js +0 -23
- package/dist/esm/zklogin/address.js +0 -78
- package/dist/esm/zklogin/bcs.js +0 -21
- package/dist/esm/zklogin/index.js +0 -38
- package/dist/esm/zklogin/jwt-decode.js +0 -68
- package/dist/esm/zklogin/jwt-utils.js +0 -108
- package/dist/esm/zklogin/nonce.js +0 -40
- package/dist/esm/zklogin/poseidon.js +0 -61
- package/dist/esm/zklogin/publickey.js +0 -265
- package/dist/esm/zklogin/signature.js +0 -37
- package/dist/esm/zklogin/utils.js +0 -78
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,2468 +1,1962 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
2
|
+
// Copyright (c) Wowok.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.buy = exports.DISCOUNT_TYPE_MINUS = exports.DISCOUNT_TYPE_RATES = exports.DEFAULT_COMPENSATION_LOCK_DURATION = exports.MAX_REQUIRED_INFO_SIZE = exports.MAX_DISCOUNT_TOTAL_COUNT = exports.MAX_DISCOUNT_RECEIVER_ONCE = exports.MAX_DISCOUNT_COUNT_ONCE = exports.MAX_PUBKEY_LENGTH = exports.MAX_CUSTOMER_REQUIRED_INFO_COUNT = exports.MAX_REWARD_COUNT = exports.MAX_ARBITRATION_COUNT = exports.MAX_REPOSITORY_COUNT = exports.MAX_SALE_COUNT = exports.CallService = void 0;
|
|
6
|
+
exports.discount_send = discount_send;
|
|
7
|
+
exports.discount_destroy = discount_destroy;
|
|
8
|
+
exports.newService = newService;
|
|
9
|
+
exports.description_set = description_set;
|
|
10
|
+
exports.um_set = um_set;
|
|
11
|
+
exports.location_set = location_set;
|
|
12
|
+
exports.create = create;
|
|
13
|
+
exports.sales_add = sales_add;
|
|
14
|
+
exports.sales_remove = sales_remove;
|
|
15
|
+
exports.sales_clear = sales_clear;
|
|
16
|
+
exports.sales_set = sales_set;
|
|
17
|
+
exports.price_add = price_add;
|
|
18
|
+
exports.price_reduce = price_reduce;
|
|
19
|
+
exports.stock_add = stock_add;
|
|
20
|
+
exports.stock_reduce = stock_reduce;
|
|
21
|
+
exports.sale_suspension = sale_suspension;
|
|
22
|
+
exports.repository_add = repository_add;
|
|
23
|
+
exports.repository_remove = repository_remove;
|
|
24
|
+
exports.repository_clear = repository_clear;
|
|
25
|
+
exports.buy_guard_set = buy_guard_set;
|
|
26
|
+
exports.machine_set = machine_set;
|
|
27
|
+
exports.publish = publish;
|
|
28
|
+
exports.pause = pause;
|
|
29
|
+
exports.customer_required_set = customer_required_set;
|
|
30
|
+
exports.arbitrations_add = arbitrations_add;
|
|
31
|
+
exports.arbitrations_remove = arbitrations_remove;
|
|
32
|
+
exports.arbitration_clear = arbitration_clear;
|
|
33
|
+
exports.compensation_fund_add = compensation_fund_add;
|
|
34
|
+
exports.compensation_lock_duration_set = compensation_lock_duration_set;
|
|
35
|
+
exports.order_allocators_set = order_allocators_set;
|
|
36
|
+
exports.reward_add = reward_add;
|
|
37
|
+
exports.reward_remove = reward_remove;
|
|
38
|
+
exports.reward_clear = reward_clear;
|
|
39
|
+
exports.compensation_fund_receive = compensation_fund_receive;
|
|
40
|
+
exports.compensation_fund_withdraw = compensation_fund_withdraw;
|
|
41
|
+
exports.discount = discount;
|
|
42
|
+
const common_js_1 = require("../common.js");
|
|
43
|
+
const exception_js_1 = require("../exception.js");
|
|
44
|
+
const object_js_1 = require("../query/object.js");
|
|
45
|
+
const util_js_1 = require("../util.js");
|
|
46
|
+
const allocation_js_1 = require("./allocation.js");
|
|
47
|
+
const base_js_1 = require("./base.js");
|
|
48
|
+
const permission_js_1 = require("./permission.js");
|
|
49
|
+
const index_js_1 = require("../local/index.js");
|
|
50
|
+
const local_js_1 = require("../local/local.js");
|
|
51
|
+
const order_js_1 = require("./order.js");
|
|
52
|
+
const progress_js_1 = require("./progress.js");
|
|
53
|
+
const order_js_2 = require("./order.js");
|
|
54
|
+
const permission_js_2 = require("./permission.js");
|
|
55
|
+
const util_js_2 = require("../query/util.js");
|
|
56
|
+
const received_js_1 = require("../query/received.js");
|
|
57
|
+
class CallService extends base_js_1.CallBase {
|
|
58
|
+
data;
|
|
59
|
+
object_address = undefined;
|
|
60
|
+
permission_address = undefined;
|
|
61
|
+
new_permission_description = undefined;
|
|
62
|
+
parameter_type = undefined;
|
|
63
|
+
constructor(data) {
|
|
64
|
+
super();
|
|
65
|
+
this.data = data;
|
|
66
|
+
}
|
|
67
|
+
async prepare(env) {
|
|
68
|
+
await super.prepare(env);
|
|
69
|
+
if (!this.object_address) {
|
|
70
|
+
this.object_address = await (0, common_js_1.GetObjectExisted)(this.data?.object);
|
|
71
|
+
}
|
|
72
|
+
if (this.object_address) {
|
|
73
|
+
await this.update_content(env, object_js_1.ObjectType.Service, this.object_address);
|
|
74
|
+
if (!this.content)
|
|
75
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallService_Data.data.object:" + this.object_address);
|
|
76
|
+
this.permission_address = this.content.permission;
|
|
77
|
+
this.parameter_type = (0, util_js_1.parseObjectType)(this.content.type_raw, "service::Service");
|
|
78
|
+
if (!this.permission_address) {
|
|
79
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallService_Data.data.object.permission is empty");
|
|
80
|
+
}
|
|
81
|
+
if (!(0, common_js_1.IsValidArgType)(this.parameter_type)) {
|
|
82
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, "CallService_Data.data.object.type_parameter is empty");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const n = (0, common_js_1.GetObject)(this.data.object);
|
|
87
|
+
this.permission_address = await (0, common_js_1.GetObjectExisted)(n?.permission);
|
|
88
|
+
this.new_permission_description = (0, common_js_1.GetObjectDescription)(n?.permission);
|
|
89
|
+
this.parameter_type = n?.type_parameter;
|
|
90
|
+
if (!(0, common_js_1.IsValidArgType)(this.parameter_type)) {
|
|
91
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, "CallService_Data.data.object.type_parameter invalid");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async call(env) {
|
|
96
|
+
await this.prepare(env); // prepare first.
|
|
97
|
+
const guards = [];
|
|
98
|
+
const perms = [];
|
|
99
|
+
const add_guard = (guard) => {
|
|
100
|
+
if (!guards.includes(guard)) {
|
|
101
|
+
guards.push(guard);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const add_perm = (index) => {
|
|
105
|
+
if (this.permission_address && !perms.includes(index)) {
|
|
106
|
+
perms.push(index);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if (this.permission_address && !this.object_address) {
|
|
110
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_NEW);
|
|
111
|
+
}
|
|
112
|
+
if (this.data?.order_new) {
|
|
113
|
+
if (!this.content) {
|
|
114
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `CallService_Data.data.order_new fail because the Service ${JSON.stringify(this.data.object)} content not ready`);
|
|
115
|
+
}
|
|
116
|
+
this.order_allowed();
|
|
117
|
+
if (this.content.buy_guard != null) {
|
|
118
|
+
add_guard(this.content.buy_guard);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (this.permission_address &&
|
|
122
|
+
this.data?.description != null &&
|
|
123
|
+
this.object_address) {
|
|
124
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_DESCRIPTION);
|
|
125
|
+
}
|
|
126
|
+
if (this.permission_address && this.data?.location != null) {
|
|
127
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_LOCATION);
|
|
128
|
+
}
|
|
129
|
+
if (this.permission_address && this.data?.repositories != null) {
|
|
130
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_REPOSITORY);
|
|
131
|
+
}
|
|
132
|
+
if (this.permission_address && this.data?.sales != null) {
|
|
133
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_SALES);
|
|
134
|
+
}
|
|
135
|
+
if (this.permission_address && this.data?.machine !== undefined) {
|
|
136
|
+
this.checkNotPublished("machine");
|
|
137
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_MACHINE);
|
|
138
|
+
}
|
|
139
|
+
if (this.permission_address && this.data?.discount != null) {
|
|
140
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_DISCOUNT);
|
|
141
|
+
}
|
|
142
|
+
if (this.permission_address && this.data?.arbitrations != null) {
|
|
143
|
+
this.checkNotPublished("arbitrations");
|
|
144
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_ARBITRATION);
|
|
145
|
+
}
|
|
146
|
+
if (this.permission_address && this.data?.customer_required != null) {
|
|
147
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_CUSTOMER_INFO_REQUIRED);
|
|
148
|
+
}
|
|
149
|
+
if (this.permission_address && this.data?.pause !== undefined) {
|
|
150
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_PAUSE);
|
|
151
|
+
}
|
|
152
|
+
if (this.permission_address && this.data?.publish) {
|
|
153
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_PUBLISH);
|
|
154
|
+
}
|
|
155
|
+
if (this.permission_address &&
|
|
156
|
+
this.data?.order_allocators !== undefined) {
|
|
157
|
+
this.checkNotPublished("order_allocators");
|
|
158
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_ORDER_ALLOCATOR);
|
|
159
|
+
}
|
|
160
|
+
if (this.permission_address &&
|
|
161
|
+
this.data?.compensation_fund_add != null) {
|
|
162
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_COMPENSATION_FUND_DEPOSIT);
|
|
163
|
+
}
|
|
164
|
+
if (this.permission_address &&
|
|
165
|
+
this.data?.compensation_locked_time_add !== undefined) {
|
|
166
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_COMPENSATION_LOCKED_TIME_ADD);
|
|
167
|
+
}
|
|
168
|
+
if (this.permission_address && this.data?.rewards != null) {
|
|
169
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_REWARD);
|
|
170
|
+
}
|
|
171
|
+
if (this.permission_address &&
|
|
172
|
+
this.data?.compensation_fund_receive != null) {
|
|
173
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_COMPENSATION_FUND_RECEIVE);
|
|
174
|
+
}
|
|
175
|
+
if (this.permission_address && this.data?.owner_receive != null) {
|
|
176
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_OWNER_RECEIVE);
|
|
177
|
+
}
|
|
178
|
+
if (this.permission_address && this.data?.um !== undefined) {
|
|
179
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.SERVICE_UM);
|
|
180
|
+
}
|
|
181
|
+
if (this.permission_address || guards.length > 0) {
|
|
182
|
+
return await this.check_permission_and_call(env, this.permission_address, perms, guards);
|
|
183
|
+
}
|
|
184
|
+
return await this.exec(env);
|
|
185
|
+
}
|
|
186
|
+
async operate(env, tx, passport, submission) {
|
|
187
|
+
let permission = this.permission_address;
|
|
188
|
+
let object = this.object_address;
|
|
189
|
+
if (!this.object_address) {
|
|
190
|
+
if (!permission) {
|
|
191
|
+
permission = (0, permission_js_1.newPermission)(tx, this.new_permission_description ?? "");
|
|
192
|
+
}
|
|
193
|
+
if (permission && this.parameter_type) {
|
|
194
|
+
object = newService(tx, this.parameter_type, permission, this.data?.description ?? "", passport);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (!object || !permission) {
|
|
198
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallService_Data.data.object:" + this.object_address);
|
|
199
|
+
}
|
|
200
|
+
// 最后再给地址命名
|
|
201
|
+
let buyResult;
|
|
202
|
+
if (this.data?.order_new != null && this.content) {
|
|
203
|
+
this.order_allowed();
|
|
204
|
+
const n = this.data?.order_new;
|
|
205
|
+
n.buy.discount = await local_js_1.LocalMark.Instance().get_address(this.data.order_new.buy.discount);
|
|
206
|
+
buyResult = await (0, exports.buy)(env, tx, object, this.parameter_type, this.content.machine, n.buy, passport);
|
|
207
|
+
if (!buyResult) {
|
|
208
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.Fail, "Buy failed, no order created");
|
|
209
|
+
}
|
|
210
|
+
if (n?.agents != null) {
|
|
211
|
+
(0, order_js_1.agent_set)(tx, {
|
|
212
|
+
order: buyResult.order,
|
|
213
|
+
agents: await (0, index_js_1.GetManyAccountOrMark_Address)(n.agents),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
if (n?.order_required_info !== undefined) {
|
|
217
|
+
await (0, order_js_1.order_required_info_update)(tx, buyResult.order, n.order_required_info);
|
|
218
|
+
}
|
|
219
|
+
if (n?.transfer != null) {
|
|
220
|
+
await (0, order_js_1.owner_change)(tx, {
|
|
221
|
+
order: buyResult.order,
|
|
222
|
+
new_owner: n.transfer,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if (n?.namedNewAllocation != null && buyResult?.allocation) {
|
|
226
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Allocation, buyResult?.allocation, (0, common_js_1.GetObject)(n.namedNewAllocation));
|
|
227
|
+
}
|
|
228
|
+
if (buyResult?.progress) {
|
|
229
|
+
if (n?.namedNewProgress != null) {
|
|
230
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Progress, (0, progress_js_1.create)(tx, buyResult?.progress), (0, common_js_1.GetObject)(n.namedNewProgress));
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
(0, progress_js_1.create)(tx, buyResult?.progress);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (buyResult?.order) {
|
|
237
|
+
const addr = (0, order_js_2.create)(tx, buyResult?.order);
|
|
238
|
+
if (n?.namedNewOrder != null) {
|
|
239
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Order, addr, (0, common_js_1.GetObject)(n.namedNewOrder));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (this.data.description != null && !this.object_address) {
|
|
244
|
+
description_set(tx, object, this.parameter_type, permission, this.data.description, passport);
|
|
245
|
+
}
|
|
246
|
+
if (this.data.location != null) {
|
|
247
|
+
location_set(tx, object, this.parameter_type, permission, this.data.location, passport);
|
|
248
|
+
}
|
|
249
|
+
if (this.data.sales != null) {
|
|
250
|
+
switch (this.data.sales.op) {
|
|
251
|
+
case "add": {
|
|
252
|
+
sales_add(tx, object, this.parameter_type, permission, this.data.sales.sales, passport);
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case "set": {
|
|
256
|
+
sales_set(tx, object, this.parameter_type, permission, this.data.sales.sales, passport);
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
case "remove": {
|
|
260
|
+
sales_remove(tx, object, this.parameter_type, permission, this.data.sales.sales_name, passport);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "clear": {
|
|
264
|
+
sales_clear(tx, object, this.parameter_type, permission, passport);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (this.data.repositories != null) {
|
|
270
|
+
switch (this.data.repositories.op) {
|
|
271
|
+
case "add":
|
|
272
|
+
case "set": {
|
|
273
|
+
if (this.data.repositories.objects.length >
|
|
274
|
+
exports.MAX_REPOSITORY_COUNT) {
|
|
275
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallService_Data.data.repositories.objects:" +
|
|
276
|
+
this.data.repositories.objects);
|
|
277
|
+
}
|
|
278
|
+
if (this.data.repositories.op === "set") {
|
|
279
|
+
repository_clear(tx, object, this.parameter_type, permission, passport);
|
|
280
|
+
}
|
|
281
|
+
const r = await local_js_1.LocalMark.Instance().get_many_address_availables(this.data.repositories.objects);
|
|
282
|
+
r.forEach((repo) => {
|
|
283
|
+
repository_add(tx, object, this.parameter_type, permission, repo, passport);
|
|
284
|
+
});
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case "remove": {
|
|
288
|
+
if (this.data.repositories.objects.length >
|
|
289
|
+
exports.MAX_REPOSITORY_COUNT) {
|
|
290
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallService_Data.data.repositories.objects:" +
|
|
291
|
+
this.data.repositories.objects);
|
|
292
|
+
}
|
|
293
|
+
const addrs = await local_js_1.LocalMark.Instance().get_many_address_availables(this.data.repositories.objects);
|
|
294
|
+
repository_remove(tx, object, this.parameter_type, permission, addrs, passport);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case "clear": {
|
|
298
|
+
repository_clear(tx, object, this.parameter_type, permission, passport);
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (this.data.rewards != null) {
|
|
304
|
+
switch (this.data.rewards.op) {
|
|
305
|
+
case "add":
|
|
306
|
+
case "set": {
|
|
307
|
+
if (this.data.rewards.objects.length > exports.MAX_REWARD_COUNT) {
|
|
308
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `rewards count exceeds maximum limit ${exports.MAX_REWARD_COUNT}`);
|
|
309
|
+
}
|
|
310
|
+
if (this.data.rewards.op === "set") {
|
|
311
|
+
reward_clear(tx, object, this.parameter_type, permission, passport);
|
|
312
|
+
}
|
|
313
|
+
// 无需localmark查询
|
|
314
|
+
const rewards = await (0, util_js_2.queryObjectsWithType)(env, this.data.rewards.objects, object_js_1.ObjectType.Reward, "reward::Reward", false);
|
|
315
|
+
rewards.forEach((reward) => {
|
|
316
|
+
reward_add(tx, object, this.parameter_type, permission, reward.object, reward.type, passport);
|
|
317
|
+
});
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
case "remove": {
|
|
321
|
+
if (this.data.rewards.objects.length > exports.MAX_REWARD_COUNT) {
|
|
322
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `rewards count exceeds maximum limit ${exports.MAX_REWARD_COUNT}`);
|
|
323
|
+
}
|
|
324
|
+
const addrs = await local_js_1.LocalMark.Instance().get_many_address_availables(this.data.rewards.objects);
|
|
325
|
+
reward_remove(tx, object, this.parameter_type, permission, addrs, passport);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case "clear": {
|
|
329
|
+
reward_clear(tx, object, this.parameter_type, permission, passport);
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (this.data.arbitrations != null) {
|
|
335
|
+
switch (this.data.arbitrations.op) {
|
|
336
|
+
case "add":
|
|
337
|
+
case "set": {
|
|
338
|
+
if (this.data.arbitrations.objects.length >
|
|
339
|
+
exports.MAX_ARBITRATION_COUNT) {
|
|
340
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `arbitrations count exceeds maximum limit ${exports.MAX_ARBITRATION_COUNT}`);
|
|
341
|
+
}
|
|
342
|
+
if (this.data.arbitrations.op === "set") {
|
|
343
|
+
arbitration_clear(tx, object, this.parameter_type, permission, passport);
|
|
344
|
+
}
|
|
345
|
+
const arbitrations = await (0, util_js_2.queryObjectsWithType)(env, this.data.arbitrations.objects, object_js_1.ObjectType.Arbitration, "arbitration::Arbitration", false);
|
|
346
|
+
arbitrations.forEach((arbitration) => {
|
|
347
|
+
arbitrations_add(tx, object, this.parameter_type, permission, arbitration.object, arbitration.type, passport);
|
|
348
|
+
});
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
case "remove": {
|
|
352
|
+
if (this.data.arbitrations.objects.length >
|
|
353
|
+
exports.MAX_ARBITRATION_COUNT) {
|
|
354
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `arbitrations count exceeds maximum limit ${exports.MAX_ARBITRATION_COUNT}`);
|
|
355
|
+
}
|
|
356
|
+
const addrs = await local_js_1.LocalMark.Instance().get_many_address_availables(this.data.arbitrations.objects);
|
|
357
|
+
arbitrations_remove(tx, object, this.parameter_type, permission, addrs, passport);
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
case "clear": {
|
|
361
|
+
arbitration_clear(tx, object, this.parameter_type, permission, passport);
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (this.data.discount != null) {
|
|
367
|
+
await discount(tx, object, this.parameter_type, permission, this.data.discount, passport);
|
|
368
|
+
}
|
|
369
|
+
if (this.data.discount_destroy != null) {
|
|
370
|
+
const r = await local_js_1.LocalMark.Instance().get_many_address_availables(this.data.discount_destroy);
|
|
371
|
+
discount_destroy(tx, r);
|
|
372
|
+
}
|
|
373
|
+
if (this.data.machine !== undefined) {
|
|
374
|
+
if (this.data.machine) {
|
|
375
|
+
const m = await local_js_1.LocalMark.Instance().get_address(this.data.machine);
|
|
376
|
+
if (m) {
|
|
377
|
+
this.data.machine = m;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, `Machine not found ${this.data.machine}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
machine_set(tx, object, this.parameter_type, permission, this.data.machine, passport);
|
|
384
|
+
}
|
|
385
|
+
if (this.data.customer_required != null) {
|
|
386
|
+
customer_required_set(tx, object, this.parameter_type, permission, this.data.customer_required, passport);
|
|
387
|
+
}
|
|
388
|
+
if (this.data.order_allocators !== undefined) {
|
|
389
|
+
// localMark 查询在allocators中完成
|
|
390
|
+
order_allocators_set(tx, object, this.parameter_type, permission, this.data.order_allocators
|
|
391
|
+
? await (0, allocation_js_1.allocators)(tx, this.data.order_allocators)
|
|
392
|
+
: null, passport);
|
|
393
|
+
}
|
|
394
|
+
if (this.data.compensation_fund_add != null) {
|
|
395
|
+
// getCoinParam中完成地址查询
|
|
396
|
+
compensation_fund_add(env, tx, object, this.parameter_type, permission, this.data.compensation_fund_add, passport);
|
|
397
|
+
}
|
|
398
|
+
if (this.data.compensation_locked_time_add !== undefined) {
|
|
399
|
+
compensation_lock_duration_set(tx, object, this.parameter_type, permission, this.data.compensation_locked_time_add, passport);
|
|
400
|
+
}
|
|
401
|
+
if (this.data.compensation_fund_receive != null &&
|
|
402
|
+
this.object_address) {
|
|
403
|
+
if (this.data.compensation_fund_receive === "recently") {
|
|
404
|
+
const received = await (0, received_js_1.query_received)({
|
|
405
|
+
object: this.object_address,
|
|
406
|
+
network: env.network,
|
|
407
|
+
no_cache: env.no_cache,
|
|
408
|
+
});
|
|
409
|
+
// 检查received的类型,如果是ReceivedNormal[],需要转换为ReceivedBalance
|
|
410
|
+
if (Array.isArray(received)) {
|
|
411
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallAllocation_Data.data.received_coins: received is ReceivedNormal[]");
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
// 如果是ReceivedBalance类型,直接赋值
|
|
415
|
+
this.data.compensation_fund_receive = received;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (typeof this.data.compensation_fund_receive === "object" &&
|
|
419
|
+
"received" in this.data.compensation_fund_receive &&
|
|
420
|
+
this.data.compensation_fund_receive.received?.length > 0) {
|
|
421
|
+
if (this.data.compensation_fund_receive.token_type !==
|
|
422
|
+
this.parameter_type) {
|
|
423
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `token_type ${this.data.compensation_fund_receive.token_type} is not equal to parameter_type ${this.parameter_type}`);
|
|
424
|
+
}
|
|
425
|
+
for (const item of this.data.compensation_fund_receive
|
|
426
|
+
.received) {
|
|
427
|
+
const [received_object, payment_object] = await Promise.all([
|
|
428
|
+
local_js_1.LocalMark.Instance().get_address(item.id),
|
|
429
|
+
local_js_1.LocalMark.Instance().get_address(item.payment),
|
|
430
|
+
]);
|
|
431
|
+
if (!received_object || !payment_object) {
|
|
432
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, `Compensation fund receive object ${item.id} or payment object ${item.payment} not found`);
|
|
433
|
+
}
|
|
434
|
+
compensation_fund_receive(tx, object, this.parameter_type, permission, item.id, item.payment, passport);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (this.data.owner_receive != null && this.object_address) {
|
|
439
|
+
// owner_receive 中完成地址查询
|
|
440
|
+
if (this.data.owner_receive === "recently") {
|
|
441
|
+
this.data.owner_receive = await (0, received_js_1.query_received)({
|
|
442
|
+
object: this.object_address,
|
|
443
|
+
all_type: true,
|
|
444
|
+
network: env.network,
|
|
445
|
+
no_cache: env.no_cache,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
await (0, util_js_1.owner_receive)(tx, object, permission, this.data.owner_receive, this.parameter_type, (name) => `${common_js_1.PackageAddress}::service::${name}`, passport);
|
|
449
|
+
}
|
|
450
|
+
// 处理 um
|
|
451
|
+
if (this.data.um !== undefined) {
|
|
452
|
+
let um_address = null;
|
|
453
|
+
if (this.data.um) {
|
|
454
|
+
um_address =
|
|
455
|
+
(await local_js_1.LocalMark.Instance().get_address(this.data.um)) ||
|
|
456
|
+
null;
|
|
457
|
+
if (!um_address) {
|
|
458
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallService_Data.data.um:" + this.data.um);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
um_set(tx, object, this.parameter_type, permission, um_address, passport);
|
|
462
|
+
}
|
|
463
|
+
if (this.data.pause != null) {
|
|
464
|
+
pause(tx, object, this.parameter_type, permission, this.data.pause, passport);
|
|
465
|
+
}
|
|
466
|
+
if (this.data.publish) {
|
|
467
|
+
publish(tx, object, this.parameter_type, permission, passport);
|
|
468
|
+
}
|
|
469
|
+
if (!this.permission_address) {
|
|
470
|
+
const p = (0, common_js_1.GetObject)(this.data?.object);
|
|
471
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Permission, (0, permission_js_2.create)(tx, permission), (0, common_js_1.GetObject)(p.permission));
|
|
472
|
+
}
|
|
473
|
+
if (!this.object_address) {
|
|
474
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Service, create(tx, object, this.parameter_type), (0, common_js_1.GetObject)(this.data?.object));
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
checkPublished = (op) => {
|
|
478
|
+
if (this.content && !this.content.bPublished) {
|
|
479
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.Fail, `Service object has not been published yet, so the operation (${op}) cannot proceed.`);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
checkNotPublished = (op) => {
|
|
483
|
+
if (this.content && this.content.bPublished) {
|
|
484
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.Fail, `Service object has been published and operation (${op}) cannot proceed.
|
|
485
|
+
If further modifications are needed, you can 'clone' a new Service and then proceed with the operation.`);
|
|
486
|
+
}
|
|
184
487
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
488
|
+
checkNotPaused = (op) => {
|
|
489
|
+
if (this.content && this.content.bPaused) {
|
|
490
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.Fail, `Service object has been paused and operation (${op}) cannot proceed.`);
|
|
491
|
+
}
|
|
189
492
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (this.content.buy_guard != null) {
|
|
202
|
-
add_guard(this.content.buy_guard);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (this.permission_address && this.data?.description != null && this.object_address) {
|
|
206
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_DESCRIPTION);
|
|
207
|
-
}
|
|
208
|
-
if (this.permission_address && this.data?.location != null) {
|
|
209
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_LOCATION);
|
|
210
|
-
}
|
|
211
|
-
if (this.permission_address && this.data?.repositories != null) {
|
|
212
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_REPOSITORY);
|
|
213
|
-
}
|
|
214
|
-
if (this.permission_address && this.data?.sales != null) {
|
|
215
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_SALES);
|
|
216
|
-
}
|
|
217
|
-
if (this.permission_address && this.data?.machine !== void 0) {
|
|
218
|
-
this.checkNotPublished("machine");
|
|
219
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_MACHINE);
|
|
220
|
-
}
|
|
221
|
-
if (this.permission_address && this.data?.discount != null) {
|
|
222
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_DISCOUNT);
|
|
223
|
-
}
|
|
224
|
-
if (this.permission_address && this.data?.arbitrations != null) {
|
|
225
|
-
this.checkNotPublished("arbitrations");
|
|
226
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_ARBITRATION);
|
|
227
|
-
}
|
|
228
|
-
if (this.permission_address && this.data?.customer_required != null) {
|
|
229
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_CUSTOMER_INFO_REQUIRED);
|
|
230
|
-
}
|
|
231
|
-
if (this.permission_address && this.data?.pause !== void 0) {
|
|
232
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_PAUSE);
|
|
233
|
-
}
|
|
234
|
-
if (this.permission_address && this.data?.publish) {
|
|
235
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_PUBLISH);
|
|
236
|
-
}
|
|
237
|
-
if (this.permission_address && this.data?.order_allocators !== void 0) {
|
|
238
|
-
this.checkNotPublished("order_allocators");
|
|
239
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_ORDER_ALLOCATOR);
|
|
240
|
-
}
|
|
241
|
-
if (this.permission_address && this.data?.compensation_fund_add != null) {
|
|
242
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_COMPENSATION_FUND_DEPOSIT);
|
|
243
|
-
}
|
|
244
|
-
if (this.permission_address && this.data?.compensation_locked_time_add !== void 0) {
|
|
245
|
-
add_perm(
|
|
246
|
-
import_permission.BuiltinPermissionIndex.SERVICE_COMPENSATION_LOCKED_TIME_ADD
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
if (this.permission_address && this.data?.rewards != null) {
|
|
250
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_REWARD);
|
|
251
|
-
}
|
|
252
|
-
if (this.permission_address && this.data?.compensation_fund_receive != null) {
|
|
253
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_COMPENSATION_FUND_RECEIVE);
|
|
254
|
-
}
|
|
255
|
-
if (this.permission_address && this.data?.owner_receive != null) {
|
|
256
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_OWNER_RECEIVE);
|
|
257
|
-
}
|
|
258
|
-
if (this.permission_address && this.data?.um !== void 0) {
|
|
259
|
-
add_perm(import_permission.BuiltinPermissionIndex.SERVICE_UM);
|
|
260
|
-
}
|
|
261
|
-
if (this.permission_address || guards.length > 0) {
|
|
262
|
-
return await this.check_permission_and_call(
|
|
263
|
-
env,
|
|
264
|
-
this.permission_address,
|
|
265
|
-
perms,
|
|
266
|
-
guards
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
return await this.exec(env);
|
|
270
|
-
}
|
|
271
|
-
async operate(env, tx, passport, submission) {
|
|
272
|
-
let permission = this.permission_address;
|
|
273
|
-
let object = this.object_address;
|
|
274
|
-
if (!this.object_address) {
|
|
275
|
-
if (!permission) {
|
|
276
|
-
permission = (0, import_permission.newPermission)(
|
|
277
|
-
tx,
|
|
278
|
-
this.new_permission_description ?? ""
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
if (permission && this.parameter_type) {
|
|
282
|
-
object = newService(
|
|
283
|
-
tx,
|
|
284
|
-
this.parameter_type,
|
|
285
|
-
permission,
|
|
286
|
-
this.data?.description ?? "",
|
|
287
|
-
passport
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
if (!object || !permission) {
|
|
292
|
-
(0, import_exception.W_ERROR)(
|
|
293
|
-
import_exception.WErrors.InvalidParam,
|
|
294
|
-
"CallService_Data.data.object:" + this.object_address
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
let buyResult;
|
|
298
|
-
if (this.data?.order_new != null && this.content) {
|
|
299
|
-
this.order_allowed();
|
|
300
|
-
const n = this.data?.order_new;
|
|
301
|
-
n.buy.discount = await import_local2.LocalMark.Instance().get_address(
|
|
302
|
-
this.data.order_new.buy.discount
|
|
303
|
-
);
|
|
304
|
-
buyResult = await buy(
|
|
305
|
-
env,
|
|
306
|
-
tx,
|
|
307
|
-
object,
|
|
308
|
-
this.parameter_type,
|
|
309
|
-
this.content.machine,
|
|
310
|
-
n.buy,
|
|
311
|
-
passport
|
|
312
|
-
);
|
|
313
|
-
if (!buyResult) {
|
|
314
|
-
(0, import_exception.W_ERROR)(import_exception.WErrors.Fail, "Buy failed, no order created");
|
|
315
|
-
}
|
|
316
|
-
if (n?.agents != null) {
|
|
317
|
-
(0, import_order.agent_set)(tx, {
|
|
318
|
-
order: buyResult.order,
|
|
319
|
-
agents: await (0, import_local.GetManyAccountOrMark_Address)(n.agents)
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
if (n?.order_required_info !== void 0) {
|
|
323
|
-
await (0, import_order.order_required_info_update)(
|
|
324
|
-
tx,
|
|
325
|
-
buyResult.order,
|
|
326
|
-
n.order_required_info
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
if (n?.transfer != null) {
|
|
330
|
-
await (0, import_order.owner_change)(tx, {
|
|
331
|
-
order: buyResult.order,
|
|
332
|
-
new_owner: n.transfer
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
if (n?.namedNewAllocation != null && buyResult?.allocation) {
|
|
336
|
-
await this.new_with_mark(
|
|
337
|
-
env,
|
|
338
|
-
tx,
|
|
339
|
-
import_object.ObjectType.Allocation,
|
|
340
|
-
buyResult?.allocation,
|
|
341
|
-
(0, import_common.GetObject)(n.namedNewAllocation)
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
if (buyResult?.progress) {
|
|
345
|
-
if (n?.namedNewProgress != null) {
|
|
346
|
-
await this.new_with_mark(
|
|
347
|
-
env,
|
|
348
|
-
tx,
|
|
349
|
-
import_object.ObjectType.Progress,
|
|
350
|
-
(0, import_progress.create)(tx, buyResult?.progress),
|
|
351
|
-
(0, import_common.GetObject)(n.namedNewProgress)
|
|
352
|
-
);
|
|
353
|
-
} else {
|
|
354
|
-
(0, import_progress.create)(tx, buyResult?.progress);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
if (buyResult?.order) {
|
|
358
|
-
const addr = (0, import_order2.create)(tx, buyResult?.order);
|
|
359
|
-
if (n?.namedNewOrder != null) {
|
|
360
|
-
await this.new_with_mark(
|
|
361
|
-
env,
|
|
362
|
-
tx,
|
|
363
|
-
import_object.ObjectType.Order,
|
|
364
|
-
addr,
|
|
365
|
-
(0, import_common.GetObject)(n.namedNewOrder)
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (this.data.description != null && !this.object_address) {
|
|
371
|
-
description_set(
|
|
372
|
-
tx,
|
|
373
|
-
object,
|
|
374
|
-
this.parameter_type,
|
|
375
|
-
permission,
|
|
376
|
-
this.data.description,
|
|
377
|
-
passport
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
if (this.data.location != null) {
|
|
381
|
-
location_set(
|
|
382
|
-
tx,
|
|
383
|
-
object,
|
|
384
|
-
this.parameter_type,
|
|
385
|
-
permission,
|
|
386
|
-
this.data.location,
|
|
387
|
-
passport
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
if (this.data.sales != null) {
|
|
391
|
-
switch (this.data.sales.op) {
|
|
392
|
-
case "add": {
|
|
393
|
-
sales_add(
|
|
394
|
-
tx,
|
|
395
|
-
object,
|
|
396
|
-
this.parameter_type,
|
|
397
|
-
permission,
|
|
398
|
-
this.data.sales.sales,
|
|
399
|
-
passport
|
|
400
|
-
);
|
|
401
|
-
break;
|
|
402
|
-
}
|
|
403
|
-
case "set": {
|
|
404
|
-
sales_set(
|
|
405
|
-
tx,
|
|
406
|
-
object,
|
|
407
|
-
this.parameter_type,
|
|
408
|
-
permission,
|
|
409
|
-
this.data.sales.sales,
|
|
410
|
-
passport
|
|
411
|
-
);
|
|
412
|
-
break;
|
|
413
|
-
}
|
|
414
|
-
case "remove": {
|
|
415
|
-
sales_remove(
|
|
416
|
-
tx,
|
|
417
|
-
object,
|
|
418
|
-
this.parameter_type,
|
|
419
|
-
permission,
|
|
420
|
-
this.data.sales.sales_name,
|
|
421
|
-
passport
|
|
422
|
-
);
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
case "clear": {
|
|
426
|
-
sales_clear(
|
|
427
|
-
tx,
|
|
428
|
-
object,
|
|
429
|
-
this.parameter_type,
|
|
430
|
-
permission,
|
|
431
|
-
passport
|
|
432
|
-
);
|
|
433
|
-
break;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
if (this.data.repositories != null) {
|
|
438
|
-
switch (this.data.repositories.op) {
|
|
439
|
-
case "add":
|
|
440
|
-
case "set": {
|
|
441
|
-
if (this.data.repositories.objects.length > MAX_REPOSITORY_COUNT) {
|
|
442
|
-
(0, import_exception.W_ERROR)(
|
|
443
|
-
import_exception.WErrors.InvalidParam,
|
|
444
|
-
"CallService_Data.data.repositories.objects:" + this.data.repositories.objects
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
if (this.data.repositories.op === "set") {
|
|
448
|
-
repository_clear(
|
|
449
|
-
tx,
|
|
450
|
-
object,
|
|
451
|
-
this.parameter_type,
|
|
452
|
-
permission,
|
|
453
|
-
passport
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
const r = await import_local2.LocalMark.Instance().get_many_address_availables(
|
|
457
|
-
this.data.repositories.objects
|
|
458
|
-
);
|
|
459
|
-
r.forEach((repo) => {
|
|
460
|
-
repository_add(
|
|
461
|
-
tx,
|
|
462
|
-
object,
|
|
463
|
-
this.parameter_type,
|
|
464
|
-
permission,
|
|
465
|
-
repo,
|
|
466
|
-
passport
|
|
467
|
-
);
|
|
468
|
-
});
|
|
469
|
-
break;
|
|
470
|
-
}
|
|
471
|
-
case "remove": {
|
|
472
|
-
if (this.data.repositories.objects.length > MAX_REPOSITORY_COUNT) {
|
|
473
|
-
(0, import_exception.W_ERROR)(
|
|
474
|
-
import_exception.WErrors.InvalidParam,
|
|
475
|
-
"CallService_Data.data.repositories.objects:" + this.data.repositories.objects
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
const addrs = await import_local2.LocalMark.Instance().get_many_address_availables(
|
|
479
|
-
this.data.repositories.objects
|
|
480
|
-
);
|
|
481
|
-
repository_remove(
|
|
482
|
-
tx,
|
|
483
|
-
object,
|
|
484
|
-
this.parameter_type,
|
|
485
|
-
permission,
|
|
486
|
-
addrs,
|
|
487
|
-
passport
|
|
488
|
-
);
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
case "clear": {
|
|
492
|
-
repository_clear(
|
|
493
|
-
tx,
|
|
494
|
-
object,
|
|
495
|
-
this.parameter_type,
|
|
496
|
-
permission,
|
|
497
|
-
passport
|
|
498
|
-
);
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
if (this.data.rewards != null) {
|
|
504
|
-
switch (this.data.rewards.op) {
|
|
505
|
-
case "add":
|
|
506
|
-
case "set": {
|
|
507
|
-
if (this.data.rewards.objects.length > MAX_REWARD_COUNT) {
|
|
508
|
-
(0, import_exception.W_ERROR)(
|
|
509
|
-
import_exception.WErrors.InvalidParam,
|
|
510
|
-
`rewards count exceeds maximum limit ${MAX_REWARD_COUNT}`
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
if (this.data.rewards.op === "set") {
|
|
514
|
-
reward_clear(
|
|
515
|
-
tx,
|
|
516
|
-
object,
|
|
517
|
-
this.parameter_type,
|
|
518
|
-
permission,
|
|
519
|
-
passport
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
const rewards = await (0, import_util2.queryObjectsWithType)(
|
|
523
|
-
env,
|
|
524
|
-
this.data.rewards.objects,
|
|
525
|
-
import_object.ObjectType.Reward,
|
|
526
|
-
"reward::Reward",
|
|
527
|
-
false
|
|
528
|
-
);
|
|
529
|
-
rewards.forEach((reward) => {
|
|
530
|
-
reward_add(
|
|
531
|
-
tx,
|
|
532
|
-
object,
|
|
533
|
-
this.parameter_type,
|
|
534
|
-
permission,
|
|
535
|
-
reward.object,
|
|
536
|
-
reward.type,
|
|
537
|
-
passport
|
|
538
|
-
);
|
|
539
|
-
});
|
|
540
|
-
break;
|
|
541
|
-
}
|
|
542
|
-
case "remove": {
|
|
543
|
-
if (this.data.rewards.objects.length > MAX_REWARD_COUNT) {
|
|
544
|
-
(0, import_exception.W_ERROR)(
|
|
545
|
-
import_exception.WErrors.InvalidParam,
|
|
546
|
-
`rewards count exceeds maximum limit ${MAX_REWARD_COUNT}`
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
const addrs = await import_local2.LocalMark.Instance().get_many_address_availables(
|
|
550
|
-
this.data.rewards.objects
|
|
551
|
-
);
|
|
552
|
-
reward_remove(
|
|
553
|
-
tx,
|
|
554
|
-
object,
|
|
555
|
-
this.parameter_type,
|
|
556
|
-
permission,
|
|
557
|
-
addrs,
|
|
558
|
-
passport
|
|
559
|
-
);
|
|
560
|
-
break;
|
|
561
|
-
}
|
|
562
|
-
case "clear": {
|
|
563
|
-
reward_clear(
|
|
564
|
-
tx,
|
|
565
|
-
object,
|
|
566
|
-
this.parameter_type,
|
|
567
|
-
permission,
|
|
568
|
-
passport
|
|
569
|
-
);
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (this.data.arbitrations != null) {
|
|
575
|
-
switch (this.data.arbitrations.op) {
|
|
576
|
-
case "add":
|
|
577
|
-
case "set": {
|
|
578
|
-
if (this.data.arbitrations.objects.length > MAX_ARBITRATION_COUNT) {
|
|
579
|
-
(0, import_exception.W_ERROR)(
|
|
580
|
-
import_exception.WErrors.InvalidParam,
|
|
581
|
-
`arbitrations count exceeds maximum limit ${MAX_ARBITRATION_COUNT}`
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
if (this.data.arbitrations.op === "set") {
|
|
585
|
-
arbitration_clear(
|
|
586
|
-
tx,
|
|
587
|
-
object,
|
|
588
|
-
this.parameter_type,
|
|
589
|
-
permission,
|
|
590
|
-
passport
|
|
591
|
-
);
|
|
592
|
-
}
|
|
593
|
-
const arbitrations = await (0, import_util2.queryObjectsWithType)(
|
|
594
|
-
env,
|
|
595
|
-
this.data.arbitrations.objects,
|
|
596
|
-
import_object.ObjectType.Arbitration,
|
|
597
|
-
"arbitration::Arbitration",
|
|
598
|
-
false
|
|
599
|
-
);
|
|
600
|
-
arbitrations.forEach((arbitration) => {
|
|
601
|
-
arbitrations_add(
|
|
602
|
-
tx,
|
|
603
|
-
object,
|
|
604
|
-
this.parameter_type,
|
|
605
|
-
permission,
|
|
606
|
-
arbitration.object,
|
|
607
|
-
arbitration.type,
|
|
608
|
-
passport
|
|
609
|
-
);
|
|
610
|
-
});
|
|
611
|
-
break;
|
|
612
|
-
}
|
|
613
|
-
case "remove": {
|
|
614
|
-
if (this.data.arbitrations.objects.length > MAX_ARBITRATION_COUNT) {
|
|
615
|
-
(0, import_exception.W_ERROR)(
|
|
616
|
-
import_exception.WErrors.InvalidParam,
|
|
617
|
-
`arbitrations count exceeds maximum limit ${MAX_ARBITRATION_COUNT}`
|
|
618
|
-
);
|
|
619
|
-
}
|
|
620
|
-
const addrs = await import_local2.LocalMark.Instance().get_many_address_availables(
|
|
621
|
-
this.data.arbitrations.objects
|
|
622
|
-
);
|
|
623
|
-
arbitrations_remove(
|
|
624
|
-
tx,
|
|
625
|
-
object,
|
|
626
|
-
this.parameter_type,
|
|
627
|
-
permission,
|
|
628
|
-
addrs,
|
|
629
|
-
passport
|
|
630
|
-
);
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
case "clear": {
|
|
634
|
-
arbitration_clear(
|
|
635
|
-
tx,
|
|
636
|
-
object,
|
|
637
|
-
this.parameter_type,
|
|
638
|
-
permission,
|
|
639
|
-
passport
|
|
640
|
-
);
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
if (this.data.discount != null) {
|
|
646
|
-
await discount(
|
|
647
|
-
tx,
|
|
648
|
-
object,
|
|
649
|
-
this.parameter_type,
|
|
650
|
-
permission,
|
|
651
|
-
this.data.discount,
|
|
652
|
-
passport
|
|
653
|
-
);
|
|
654
|
-
}
|
|
655
|
-
if (this.data.discount_destroy != null) {
|
|
656
|
-
const r = await import_local2.LocalMark.Instance().get_many_address_availables(
|
|
657
|
-
this.data.discount_destroy
|
|
658
|
-
);
|
|
659
|
-
discount_destroy(tx, r);
|
|
660
|
-
}
|
|
661
|
-
if (this.data.machine !== void 0) {
|
|
662
|
-
if (this.data.machine) {
|
|
663
|
-
const m = await import_local2.LocalMark.Instance().get_address(
|
|
664
|
-
this.data.machine
|
|
665
|
-
);
|
|
666
|
-
if (m) {
|
|
667
|
-
this.data.machine = m;
|
|
668
|
-
} else {
|
|
669
|
-
(0, import_exception.W_ERROR)(
|
|
670
|
-
import_exception.WErrors.IsValidArgType,
|
|
671
|
-
`Machine not found ${this.data.machine}`
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
machine_set(
|
|
676
|
-
tx,
|
|
677
|
-
object,
|
|
678
|
-
this.parameter_type,
|
|
679
|
-
permission,
|
|
680
|
-
this.data.machine,
|
|
681
|
-
passport
|
|
682
|
-
);
|
|
683
|
-
}
|
|
684
|
-
if (this.data.customer_required != null) {
|
|
685
|
-
customer_required_set(
|
|
686
|
-
tx,
|
|
687
|
-
object,
|
|
688
|
-
this.parameter_type,
|
|
689
|
-
permission,
|
|
690
|
-
this.data.customer_required,
|
|
691
|
-
passport
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
|
-
if (this.data.order_allocators !== void 0) {
|
|
695
|
-
order_allocators_set(
|
|
696
|
-
tx,
|
|
697
|
-
object,
|
|
698
|
-
this.parameter_type,
|
|
699
|
-
permission,
|
|
700
|
-
this.data.order_allocators ? await (0, import_allocation.allocators)(tx, this.data.order_allocators) : null,
|
|
701
|
-
passport
|
|
702
|
-
);
|
|
703
|
-
}
|
|
704
|
-
if (this.data.compensation_fund_add != null) {
|
|
705
|
-
compensation_fund_add(
|
|
706
|
-
env,
|
|
707
|
-
tx,
|
|
708
|
-
object,
|
|
709
|
-
this.parameter_type,
|
|
710
|
-
permission,
|
|
711
|
-
this.data.compensation_fund_add,
|
|
712
|
-
passport
|
|
713
|
-
);
|
|
714
|
-
}
|
|
715
|
-
if (this.data.compensation_locked_time_add !== void 0) {
|
|
716
|
-
compensation_lock_duration_set(
|
|
717
|
-
tx,
|
|
718
|
-
object,
|
|
719
|
-
this.parameter_type,
|
|
720
|
-
permission,
|
|
721
|
-
this.data.compensation_locked_time_add,
|
|
722
|
-
passport
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
if (this.data.compensation_fund_receive != null && this.object_address) {
|
|
726
|
-
if (this.data.compensation_fund_receive === "recently") {
|
|
727
|
-
const received = await (0, import_received.query_received)({
|
|
728
|
-
object: this.object_address,
|
|
729
|
-
network: env.network,
|
|
730
|
-
no_cache: env.no_cache
|
|
731
|
-
});
|
|
732
|
-
if (Array.isArray(received)) {
|
|
733
|
-
(0, import_exception.W_ERROR)(
|
|
734
|
-
import_exception.WErrors.InvalidParam,
|
|
735
|
-
"CallAllocation_Data.data.received_coins: received is ReceivedNormal[]"
|
|
736
|
-
);
|
|
737
|
-
} else {
|
|
738
|
-
this.data.compensation_fund_receive = received;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
if (typeof this.data.compensation_fund_receive === "object" && "received" in this.data.compensation_fund_receive && this.data.compensation_fund_receive.received?.length > 0) {
|
|
742
|
-
if (this.data.compensation_fund_receive.token_type !== this.parameter_type) {
|
|
743
|
-
(0, import_exception.W_ERROR)(
|
|
744
|
-
import_exception.WErrors.InvalidParam,
|
|
745
|
-
`token_type ${this.data.compensation_fund_receive.token_type} is not equal to parameter_type ${this.parameter_type}`
|
|
746
|
-
);
|
|
747
|
-
}
|
|
748
|
-
for (const item of this.data.compensation_fund_receive.received) {
|
|
749
|
-
const [received_object, payment_object] = await Promise.all(
|
|
750
|
-
[
|
|
751
|
-
import_local2.LocalMark.Instance().get_address(item.id),
|
|
752
|
-
import_local2.LocalMark.Instance().get_address(item.payment)
|
|
753
|
-
]
|
|
754
|
-
);
|
|
755
|
-
if (!received_object || !payment_object) {
|
|
756
|
-
(0, import_exception.W_ERROR)(
|
|
757
|
-
import_exception.WErrors.IsValidArgType,
|
|
758
|
-
`Compensation fund receive object ${item.id} or payment object ${item.payment} not found`
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
compensation_fund_receive(
|
|
762
|
-
tx,
|
|
763
|
-
object,
|
|
764
|
-
this.parameter_type,
|
|
765
|
-
permission,
|
|
766
|
-
item.id,
|
|
767
|
-
item.payment,
|
|
768
|
-
passport
|
|
769
|
-
);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
if (this.data.owner_receive != null && this.object_address) {
|
|
774
|
-
if (this.data.owner_receive === "recently") {
|
|
775
|
-
this.data.owner_receive = await (0, import_received.query_received)({
|
|
776
|
-
object: this.object_address,
|
|
777
|
-
all_type: true,
|
|
778
|
-
network: env.network,
|
|
779
|
-
no_cache: env.no_cache
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
await (0, import_util.owner_receive)(
|
|
783
|
-
tx,
|
|
784
|
-
object,
|
|
785
|
-
permission,
|
|
786
|
-
this.data.owner_receive,
|
|
787
|
-
this.parameter_type,
|
|
788
|
-
(name) => `${import_common.PackageAddress}::service::${name}`,
|
|
789
|
-
passport
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
|
-
if (this.data.um !== void 0) {
|
|
793
|
-
let um_address = null;
|
|
794
|
-
if (this.data.um) {
|
|
795
|
-
um_address = await import_local2.LocalMark.Instance().get_address(this.data.um) || null;
|
|
796
|
-
if (!um_address) {
|
|
797
|
-
(0, import_exception.W_ERROR)(
|
|
798
|
-
import_exception.WErrors.InvalidParam,
|
|
799
|
-
"CallService_Data.data.um:" + this.data.um
|
|
800
|
-
);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
um_set(
|
|
804
|
-
tx,
|
|
805
|
-
object,
|
|
806
|
-
this.parameter_type,
|
|
807
|
-
permission,
|
|
808
|
-
um_address,
|
|
809
|
-
passport
|
|
810
|
-
);
|
|
811
|
-
}
|
|
812
|
-
if (this.data.pause != null) {
|
|
813
|
-
pause(
|
|
814
|
-
tx,
|
|
815
|
-
object,
|
|
816
|
-
this.parameter_type,
|
|
817
|
-
permission,
|
|
818
|
-
this.data.pause,
|
|
819
|
-
passport
|
|
820
|
-
);
|
|
821
|
-
}
|
|
822
|
-
if (this.data.publish) {
|
|
823
|
-
publish(tx, object, this.parameter_type, permission, passport);
|
|
824
|
-
}
|
|
825
|
-
if (!this.permission_address) {
|
|
826
|
-
const p = (0, import_common.GetObject)(
|
|
827
|
-
this.data?.object
|
|
828
|
-
);
|
|
829
|
-
await this.new_with_mark(
|
|
830
|
-
env,
|
|
831
|
-
tx,
|
|
832
|
-
import_object.ObjectType.Permission,
|
|
833
|
-
(0, import_permission2.create)(tx, permission),
|
|
834
|
-
(0, import_common.GetObject)(p.permission)
|
|
835
|
-
);
|
|
836
|
-
}
|
|
837
|
-
if (!this.object_address) {
|
|
838
|
-
await this.new_with_mark(
|
|
839
|
-
env,
|
|
840
|
-
tx,
|
|
841
|
-
import_object.ObjectType.Service,
|
|
842
|
-
create(tx, object, this.parameter_type),
|
|
843
|
-
(0, import_common.GetObject)(this.data?.object)
|
|
844
|
-
);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
order_allowed() {
|
|
848
|
-
if (this.content?.bPaused) {
|
|
849
|
-
(0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "Service is paused");
|
|
850
|
-
return false;
|
|
851
|
-
}
|
|
852
|
-
if (this.content?.bPublished !== true) {
|
|
853
|
-
(0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "Service is not published");
|
|
854
|
-
return false;
|
|
855
|
-
}
|
|
856
|
-
return true;
|
|
857
|
-
}
|
|
493
|
+
order_allowed() {
|
|
494
|
+
if (this.content?.bPaused) {
|
|
495
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "Service is paused");
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
if (this.content?.bPublished !== true) {
|
|
499
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "Service is not published");
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
return true;
|
|
503
|
+
}
|
|
858
504
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
505
|
+
exports.CallService = CallService;
|
|
506
|
+
// ================================================
|
|
507
|
+
// 常量定义
|
|
508
|
+
exports.MAX_SALE_COUNT = 50;
|
|
509
|
+
exports.MAX_REPOSITORY_COUNT = 100;
|
|
510
|
+
exports.MAX_ARBITRATION_COUNT = 20;
|
|
511
|
+
exports.MAX_REWARD_COUNT = 20;
|
|
512
|
+
exports.MAX_CUSTOMER_REQUIRED_INFO_COUNT = 10;
|
|
513
|
+
exports.MAX_PUBKEY_LENGTH = 1024;
|
|
514
|
+
exports.MAX_DISCOUNT_COUNT_ONCE = 1000;
|
|
515
|
+
exports.MAX_DISCOUNT_RECEIVER_ONCE = 1000;
|
|
516
|
+
exports.MAX_DISCOUNT_TOTAL_COUNT = 20000;
|
|
517
|
+
exports.MAX_REQUIRED_INFO_SIZE = 20;
|
|
518
|
+
exports.DEFAULT_COMPENSATION_LOCK_DURATION = 2592000000; // 30 days
|
|
519
|
+
exports.DISCOUNT_TYPE_RATES = 0;
|
|
520
|
+
exports.DISCOUNT_TYPE_MINUS = 1;
|
|
872
521
|
const MAX_WIP_LENGTH = 1024;
|
|
873
522
|
const MAX_WIP_HASH_LENGTH = 64;
|
|
874
|
-
function sale(tx,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
return tx.moveCall({
|
|
900
|
-
target: (0, import_common.serviceFn)("sale"),
|
|
901
|
-
arguments: [
|
|
902
|
-
(0, import_common.toTxString)(tx, sale2.name),
|
|
903
|
-
tx.pure.u64(sale2.price),
|
|
904
|
-
tx.pure.u64(sale2.stock),
|
|
905
|
-
tx.pure.bool(sale2.suspension),
|
|
906
|
-
(0, import_common.toTxString)(tx, sale2.wip),
|
|
907
|
-
(0, import_common.toTxString)(tx, sale2.wip_hash)
|
|
908
|
-
]
|
|
909
|
-
});
|
|
523
|
+
function sale(tx, sale) {
|
|
524
|
+
if (typeof sale.name === "string" && !(0, common_js_1.isValidLongName)(sale.name)) {
|
|
525
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Name ${sale.name} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
526
|
+
}
|
|
527
|
+
if (sale.wip.length > MAX_WIP_LENGTH) {
|
|
528
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `WIP ${sale.wip} exceeds maximum length ${MAX_WIP_LENGTH}`);
|
|
529
|
+
}
|
|
530
|
+
if (!(0, common_js_1.isValidHttpUrl)(sale.wip)) {
|
|
531
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidHttpUrl, `WIP ${sale.wip} is not a valid HTTP/HTTPS URL`);
|
|
532
|
+
}
|
|
533
|
+
if (sale.wip_hash.length > MAX_WIP_HASH_LENGTH) {
|
|
534
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `WIP hash ${sale.wip_hash} exceeds maximum length ${MAX_WIP_HASH_LENGTH}`);
|
|
535
|
+
}
|
|
536
|
+
return tx.moveCall({
|
|
537
|
+
target: (0, common_js_1.serviceFn)("sale"),
|
|
538
|
+
arguments: [
|
|
539
|
+
(0, common_js_1.toTxString)(tx, sale.name),
|
|
540
|
+
tx.pure.u64(sale.price),
|
|
541
|
+
tx.pure.u64(sale.stock),
|
|
542
|
+
tx.pure.bool(sale.suspension),
|
|
543
|
+
(0, common_js_1.toTxString)(tx, sale.wip),
|
|
544
|
+
(0, common_js_1.toTxString)(tx, sale.wip_hash),
|
|
545
|
+
],
|
|
546
|
+
});
|
|
910
547
|
}
|
|
911
548
|
function quote_item(tx, item) {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
);
|
|
929
|
-
}
|
|
930
|
-
return tx.moveCall({
|
|
931
|
-
target: (0, import_common.serviceFn)("quote_item"),
|
|
932
|
-
arguments: [
|
|
933
|
-
(0, import_common.toTxString)(tx, item.name),
|
|
934
|
-
tx.pure.u64(item.stock),
|
|
935
|
-
(0, import_common.toTxString)(tx, item.wip_hash)
|
|
936
|
-
]
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
function discount_send(tx, discount2, recipient) {
|
|
940
|
-
if (discount2.length === 0) {
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
|
-
(0, import_util.validObjects)([...discount2, recipient]);
|
|
944
|
-
if (discount2.length > MAX_DISCOUNT_COUNT_ONCE) {
|
|
945
|
-
(0, import_exception.W_ERROR)(
|
|
946
|
-
import_exception.WErrors.InvalidParam,
|
|
947
|
-
`Discount count ${discount2.length} exceeds maximum limit ${MAX_DISCOUNT_COUNT_ONCE}`
|
|
948
|
-
);
|
|
949
|
-
}
|
|
950
|
-
if (discount2.length === 1) {
|
|
951
|
-
tx.moveCall({
|
|
952
|
-
target: (0, import_common.serviceFn)("discount_send_singleton"),
|
|
953
|
-
arguments: [
|
|
954
|
-
(0, import_common.toTxObject)(tx, discount2[0]),
|
|
955
|
-
tx.pure.address(recipient)
|
|
956
|
-
]
|
|
957
|
-
});
|
|
958
|
-
return;
|
|
959
|
-
} else {
|
|
960
|
-
tx.moveCall({
|
|
961
|
-
target: (0, import_common.serviceFn)("discount_send"),
|
|
962
|
-
arguments: [
|
|
963
|
-
tx.makeMoveVec({
|
|
964
|
-
elements: discount2,
|
|
965
|
-
type: `${import_common.PackageAddress}::service::Discount`
|
|
966
|
-
}),
|
|
967
|
-
tx.pure.address(recipient)
|
|
968
|
-
]
|
|
549
|
+
if (!(0, common_js_1.isValidLongName)(item.name)) {
|
|
550
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Quote item name ${item.name} is not valid`);
|
|
551
|
+
}
|
|
552
|
+
if (!(0, common_js_1.isValidU64)(item.stock)) {
|
|
553
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Quote item stock ${item.stock} is not valid`);
|
|
554
|
+
}
|
|
555
|
+
if (item.wip_hash.length > MAX_WIP_HASH_LENGTH) {
|
|
556
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Quote item wip_hash ${item.wip_hash} exceeds maximum length ${MAX_WIP_HASH_LENGTH}`);
|
|
557
|
+
}
|
|
558
|
+
return tx.moveCall({
|
|
559
|
+
target: (0, common_js_1.serviceFn)("quote_item"),
|
|
560
|
+
arguments: [
|
|
561
|
+
(0, common_js_1.toTxString)(tx, item.name),
|
|
562
|
+
tx.pure.u64(item.stock),
|
|
563
|
+
(0, common_js_1.toTxString)(tx, item.wip_hash),
|
|
564
|
+
],
|
|
969
565
|
});
|
|
970
|
-
}
|
|
971
566
|
}
|
|
972
|
-
function
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
567
|
+
function discount_send(tx, discount, recipient) {
|
|
568
|
+
if (discount.length === 0) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
(0, util_js_1.validObjects)([...discount, recipient]);
|
|
572
|
+
if (discount.length > exports.MAX_DISCOUNT_COUNT_ONCE) {
|
|
573
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount count ${discount.length} exceeds maximum limit ${exports.MAX_DISCOUNT_COUNT_ONCE}`);
|
|
574
|
+
}
|
|
575
|
+
if (discount.length === 1) {
|
|
576
|
+
tx.moveCall({
|
|
577
|
+
target: (0, common_js_1.serviceFn)("discount_send_singleton"),
|
|
578
|
+
arguments: [
|
|
579
|
+
(0, common_js_1.toTxObject)(tx, discount[0]),
|
|
580
|
+
tx.pure.address(recipient),
|
|
581
|
+
],
|
|
582
|
+
});
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
tx.moveCall({
|
|
587
|
+
target: (0, common_js_1.serviceFn)("discount_send"),
|
|
588
|
+
arguments: [
|
|
589
|
+
tx.makeMoveVec({
|
|
590
|
+
elements: discount,
|
|
591
|
+
type: `${common_js_1.PackageAddress}::service::Discount`,
|
|
592
|
+
}),
|
|
593
|
+
tx.pure.address(recipient),
|
|
594
|
+
],
|
|
595
|
+
});
|
|
596
|
+
}
|
|
980
597
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
import_exception.WErrors.InvalidParam,
|
|
989
|
-
`Buy service type ${service_type} is not valid`
|
|
990
|
-
);
|
|
991
|
-
}
|
|
992
|
-
if (!(0, import_common.isValidArray)(buy2.items, (item) => {
|
|
993
|
-
if (!(0, import_common.isValidLongName)(item.name)) {
|
|
994
|
-
(0, import_exception.W_ERROR)(
|
|
995
|
-
import_exception.WErrors.InvalidParam,
|
|
996
|
-
`Buy item name ${item.name} is not valid`
|
|
997
|
-
);
|
|
998
|
-
}
|
|
999
|
-
if (!(0, import_common.isValidU64)(item.stock)) {
|
|
1000
|
-
(0, import_exception.W_ERROR)(
|
|
1001
|
-
import_exception.WErrors.IsValidU64,
|
|
1002
|
-
`Buy item stock ${item.stock} is not valid`
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
return true;
|
|
1006
|
-
})) {
|
|
1007
|
-
(0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "Buy items is not valid");
|
|
1008
|
-
}
|
|
1009
|
-
if (typeof buy2.payment_remark === "string" && !(0, import_common.isValidName)(buy2.payment_remark)) {
|
|
1010
|
-
(0, import_exception.W_ERROR)(
|
|
1011
|
-
import_exception.WErrors.InvalidParam,
|
|
1012
|
-
`Buy payment remark ${buy2.payment_remark} is not valid`
|
|
1013
|
-
);
|
|
1014
|
-
}
|
|
1015
|
-
buy2.payment_remark = buy2.payment_remark || "";
|
|
1016
|
-
if (buy2.payment_index != null && !(0, import_common.isValidU64)(buy2.payment_index)) {
|
|
1017
|
-
(0, import_exception.W_ERROR)(
|
|
1018
|
-
import_exception.WErrors.IsValidU64,
|
|
1019
|
-
`Buy payment index ${buy2.payment_index} is not valid`
|
|
1020
|
-
);
|
|
1021
|
-
}
|
|
1022
|
-
const coinParam = await (0, import_base.getCoinParam)(env, tx, buy2.total_pay, service_type);
|
|
1023
|
-
buy2.discount = await import_local2.LocalMark.Instance().get_address(buy2.discount);
|
|
1024
|
-
let quote = void 0;
|
|
1025
|
-
if (buy2.discount) {
|
|
1026
|
-
quote = tx.moveCall({
|
|
1027
|
-
target: (0, import_common.serviceFn)("quote_with_discount"),
|
|
1028
|
-
arguments: [
|
|
1029
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1030
|
-
tx.makeMoveVec({
|
|
1031
|
-
elements: buy2.items.map((item) => quote_item(tx, item)),
|
|
1032
|
-
type: `${import_common.PackageAddress}::service::QuoteItem`
|
|
1033
|
-
}),
|
|
1034
|
-
(0, import_common.toTxObject)(tx, buy2.discount)
|
|
1035
|
-
],
|
|
1036
|
-
typeArguments: [service_type]
|
|
1037
|
-
});
|
|
1038
|
-
} else {
|
|
1039
|
-
quote = tx.moveCall({
|
|
1040
|
-
target: (0, import_common.serviceFn)("quote"),
|
|
1041
|
-
arguments: [
|
|
1042
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1043
|
-
tx.makeMoveVec({
|
|
1044
|
-
elements: buy2.items.map((item) => quote_item(tx, item)),
|
|
1045
|
-
type: `${import_common.PackageAddress}::service::QuoteItem`
|
|
1046
|
-
})
|
|
1047
|
-
],
|
|
1048
|
-
typeArguments: [service_type]
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
let order;
|
|
1052
|
-
if (passport) {
|
|
1053
|
-
order = tx.moveCall({
|
|
1054
|
-
target: (0, import_common.serviceFn)("buy_with_passport"),
|
|
1055
|
-
arguments: [
|
|
1056
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1057
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1058
|
-
quote,
|
|
1059
|
-
tx.object.mutRegistrar(),
|
|
1060
|
-
tx.object.clock()
|
|
1061
|
-
],
|
|
1062
|
-
typeArguments: [service_type]
|
|
1063
|
-
});
|
|
1064
|
-
} else {
|
|
1065
|
-
order = tx.moveCall({
|
|
1066
|
-
target: (0, import_common.serviceFn)("buy"),
|
|
1067
|
-
arguments: [
|
|
1068
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1069
|
-
quote,
|
|
1070
|
-
tx.object.mutRegistrar(),
|
|
1071
|
-
tx.object.clock()
|
|
1072
|
-
],
|
|
1073
|
-
typeArguments: [service_type]
|
|
598
|
+
function discount_destroy(tx, discount) {
|
|
599
|
+
(0, util_js_1.validObjects)([...discount]);
|
|
600
|
+
discount.forEach((item) => {
|
|
601
|
+
tx.moveCall({
|
|
602
|
+
target: (0, common_js_1.serviceFn)("discount_destroy"),
|
|
603
|
+
arguments: [(0, common_js_1.toTxObject)(tx, item)],
|
|
604
|
+
});
|
|
1074
605
|
});
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
(0,
|
|
1097
|
-
(0,
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
606
|
+
}
|
|
607
|
+
const buy = async (env, tx, service, service_type, machine, buy, passport) => {
|
|
608
|
+
if (buy.items.length === 0) {
|
|
609
|
+
return undefined;
|
|
610
|
+
}
|
|
611
|
+
(0, util_js_1.validObjects)([service, buy.discount, machine, passport]);
|
|
612
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
613
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Buy service type ${service_type} is not valid`);
|
|
614
|
+
}
|
|
615
|
+
if (!(0, common_js_1.isValidArray)(buy.items, (item) => {
|
|
616
|
+
if (!(0, common_js_1.isValidLongName)(item.name)) {
|
|
617
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Buy item name ${item.name} is not valid`);
|
|
618
|
+
}
|
|
619
|
+
if (!(0, common_js_1.isValidU64)(item.stock)) {
|
|
620
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Buy item stock ${item.stock} is not valid`);
|
|
621
|
+
}
|
|
622
|
+
return true;
|
|
623
|
+
})) {
|
|
624
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "Buy items is not valid");
|
|
625
|
+
}
|
|
626
|
+
if (typeof buy.payment_remark === "string" &&
|
|
627
|
+
!(0, common_js_1.isValidName)(buy.payment_remark)) {
|
|
628
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Buy payment remark ${buy.payment_remark} is not valid`);
|
|
629
|
+
}
|
|
630
|
+
buy.payment_remark = buy.payment_remark || "";
|
|
631
|
+
if (buy.payment_index != null && !(0, common_js_1.isValidU64)(buy.payment_index)) {
|
|
632
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Buy payment index ${buy.payment_index} is not valid`);
|
|
633
|
+
}
|
|
634
|
+
const coinParam = await (0, base_js_1.getCoinParam)(env, tx, buy.total_pay, service_type);
|
|
635
|
+
buy.discount = await local_js_1.LocalMark.Instance().get_address(buy.discount);
|
|
636
|
+
let quote = undefined;
|
|
637
|
+
if (buy.discount) {
|
|
638
|
+
quote = tx.moveCall({
|
|
639
|
+
target: (0, common_js_1.serviceFn)("quote_with_discount"),
|
|
640
|
+
arguments: [
|
|
641
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
642
|
+
tx.makeMoveVec({
|
|
643
|
+
elements: buy.items.map((item) => quote_item(tx, item)),
|
|
644
|
+
type: `${common_js_1.PackageAddress}::service::QuoteItem`,
|
|
645
|
+
}),
|
|
646
|
+
(0, common_js_1.toTxObject)(tx, buy.discount),
|
|
647
|
+
],
|
|
648
|
+
typeArguments: [service_type],
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
quote = tx.moveCall({
|
|
653
|
+
target: (0, common_js_1.serviceFn)("quote"),
|
|
654
|
+
arguments: [
|
|
655
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
656
|
+
tx.makeMoveVec({
|
|
657
|
+
elements: buy.items.map((item) => quote_item(tx, item)),
|
|
658
|
+
type: `${common_js_1.PackageAddress}::service::QuoteItem`,
|
|
659
|
+
}),
|
|
660
|
+
],
|
|
661
|
+
typeArguments: [service_type],
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
let order;
|
|
665
|
+
if (passport) {
|
|
666
|
+
order = tx.moveCall({
|
|
667
|
+
target: (0, common_js_1.serviceFn)("buy_with_passport"),
|
|
668
|
+
arguments: [
|
|
669
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
670
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
671
|
+
quote,
|
|
672
|
+
tx.object.mutRegistrar(),
|
|
673
|
+
tx.object.clock(),
|
|
674
|
+
],
|
|
675
|
+
typeArguments: [service_type],
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
order = tx.moveCall({
|
|
680
|
+
target: (0, common_js_1.serviceFn)("buy"),
|
|
681
|
+
arguments: [
|
|
682
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
683
|
+
quote,
|
|
684
|
+
tx.object.mutRegistrar(),
|
|
685
|
+
tx.object.clock(),
|
|
686
|
+
],
|
|
687
|
+
typeArguments: [service_type],
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
const result = {
|
|
691
|
+
order: order,
|
|
692
|
+
};
|
|
693
|
+
result.allocation = tx.moveCall({
|
|
694
|
+
target: (0, common_js_1.serviceFn)("order_allocation"),
|
|
695
|
+
arguments: [
|
|
696
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
697
|
+
(0, common_js_1.toTxObject)(tx, order),
|
|
698
|
+
coinParam,
|
|
699
|
+
tx.pure.string(buy.payment_remark ?? ""),
|
|
700
|
+
tx.pure.u64(buy.payment_index || 0),
|
|
701
|
+
tx.object.mutRegistrar(),
|
|
702
|
+
tx.object.clock(),
|
|
703
|
+
],
|
|
704
|
+
typeArguments: [service_type],
|
|
1103
705
|
});
|
|
1104
|
-
|
|
1105
|
-
|
|
706
|
+
if (machine) {
|
|
707
|
+
result.progress = tx.moveCall({
|
|
708
|
+
target: (0, common_js_1.serviceFn)("order_progress"),
|
|
709
|
+
arguments: [
|
|
710
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
711
|
+
(0, common_js_1.toTxObject)(tx, order),
|
|
712
|
+
(0, common_js_1.toTxObject)(tx, machine),
|
|
713
|
+
tx.object.mutRegistrar(),
|
|
714
|
+
tx.object.clock(),
|
|
715
|
+
],
|
|
716
|
+
typeArguments: [service_type],
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
return result;
|
|
1106
720
|
};
|
|
721
|
+
exports.buy = buy;
|
|
722
|
+
// ================================================
|
|
723
|
+
// 构造函数和设置函数
|
|
1107
724
|
function newService(tx, service_type, permission, description, passport) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
tx.
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
tx.object.clock()
|
|
1141
|
-
],
|
|
1142
|
-
typeArguments: [service_type]
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
725
|
+
(0, util_js_1.validObjects)([permission, passport]);
|
|
726
|
+
if (typeof description === "string" && !(0, common_js_1.isValidDescription)(description)) {
|
|
727
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidDescription, `Description exceeds maximum length ${common_js_1.MAX_DESCRIPTION_LENGTH}`);
|
|
728
|
+
}
|
|
729
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
730
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `New service type ${service_type} is not valid`);
|
|
731
|
+
}
|
|
732
|
+
if (passport) {
|
|
733
|
+
return tx.moveCall({
|
|
734
|
+
target: (0, common_js_1.serviceFn)("new_with_passport"),
|
|
735
|
+
arguments: [
|
|
736
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
737
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
738
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
739
|
+
tx.object.mutRegistrar(),
|
|
740
|
+
tx.object.clock(),
|
|
741
|
+
],
|
|
742
|
+
typeArguments: [service_type],
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
return tx.moveCall({
|
|
747
|
+
target: (0, common_js_1.serviceFn)("new"),
|
|
748
|
+
arguments: [
|
|
749
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
750
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
751
|
+
tx.object.mutRegistrar(),
|
|
752
|
+
tx.object.clock(),
|
|
753
|
+
],
|
|
754
|
+
typeArguments: [service_type],
|
|
755
|
+
});
|
|
756
|
+
}
|
|
1145
757
|
}
|
|
1146
758
|
function description_set(tx, service, service_type, permission, description, passport) {
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
(0, import_common.toTxString)(tx, description)
|
|
1178
|
-
],
|
|
1179
|
-
typeArguments: [service_type]
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
759
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
760
|
+
if (typeof description === "string" && !(0, common_js_1.isValidDescription)(description)) {
|
|
761
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidDescription, `Description exceeds maximum length ${common_js_1.MAX_DESCRIPTION_LENGTH}`);
|
|
762
|
+
}
|
|
763
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
764
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Description set service type ${service_type} is not valid`);
|
|
765
|
+
}
|
|
766
|
+
if (passport) {
|
|
767
|
+
tx.moveCall({
|
|
768
|
+
target: (0, common_js_1.serviceFn)("description_set_with_passport"),
|
|
769
|
+
arguments: [
|
|
770
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
771
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
772
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
773
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
774
|
+
],
|
|
775
|
+
typeArguments: [service_type],
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
tx.moveCall({
|
|
780
|
+
target: (0, common_js_1.serviceFn)("description_set"),
|
|
781
|
+
arguments: [
|
|
782
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
783
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
784
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
785
|
+
],
|
|
786
|
+
typeArguments: [service_type],
|
|
787
|
+
});
|
|
788
|
+
}
|
|
1182
789
|
}
|
|
1183
790
|
function um_set(tx, service, service_type, permission, um, passport) {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
import_exception.WErrors.InvalidParam,
|
|
1188
|
-
`Service type ${service_type} is not valid`
|
|
1189
|
-
);
|
|
1190
|
-
}
|
|
1191
|
-
if (um) {
|
|
1192
|
-
if (passport) {
|
|
1193
|
-
tx.moveCall({
|
|
1194
|
-
target: (0, import_common.serviceFn)(`um_set_with_passport`),
|
|
1195
|
-
arguments: [
|
|
1196
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1197
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1198
|
-
passport,
|
|
1199
|
-
(0, import_common.toTxObject)(tx, um),
|
|
1200
|
-
tx.object.mutRegistrar(),
|
|
1201
|
-
tx.object.clock()
|
|
1202
|
-
],
|
|
1203
|
-
typeArguments: [service_type]
|
|
1204
|
-
});
|
|
1205
|
-
} else {
|
|
1206
|
-
tx.moveCall({
|
|
1207
|
-
target: (0, import_common.serviceFn)(`um_set`),
|
|
1208
|
-
arguments: [
|
|
1209
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1210
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1211
|
-
(0, import_common.toTxObject)(tx, um),
|
|
1212
|
-
tx.object.mutRegistrar(),
|
|
1213
|
-
tx.object.clock()
|
|
1214
|
-
],
|
|
1215
|
-
typeArguments: [service_type]
|
|
1216
|
-
});
|
|
791
|
+
(0, util_js_1.validObjects)([service, permission]);
|
|
792
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
793
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Service type ${service_type} is not valid`);
|
|
1217
794
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
795
|
+
if (um) {
|
|
796
|
+
if (passport) {
|
|
797
|
+
tx.moveCall({
|
|
798
|
+
target: (0, common_js_1.serviceFn)(`um_set_with_passport`),
|
|
799
|
+
arguments: [
|
|
800
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
801
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
802
|
+
passport,
|
|
803
|
+
(0, common_js_1.toTxObject)(tx, um),
|
|
804
|
+
tx.object.mutRegistrar(),
|
|
805
|
+
tx.object.clock(),
|
|
806
|
+
],
|
|
807
|
+
typeArguments: [service_type],
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
tx.moveCall({
|
|
812
|
+
target: (0, common_js_1.serviceFn)(`um_set`),
|
|
813
|
+
arguments: [
|
|
814
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
815
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
816
|
+
(0, common_js_1.toTxObject)(tx, um),
|
|
817
|
+
tx.object.mutRegistrar(),
|
|
818
|
+
tx.object.clock(),
|
|
819
|
+
],
|
|
820
|
+
typeArguments: [service_type],
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
if (passport) {
|
|
826
|
+
tx.moveCall({
|
|
827
|
+
target: (0, common_js_1.serviceFn)(`um_none_with_passport`),
|
|
828
|
+
arguments: [
|
|
829
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
830
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
831
|
+
passport,
|
|
832
|
+
tx.object.mutRegistrar(),
|
|
833
|
+
],
|
|
834
|
+
typeArguments: [service_type],
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
tx.moveCall({
|
|
839
|
+
target: (0, common_js_1.serviceFn)(`um_none`),
|
|
840
|
+
arguments: [
|
|
841
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
842
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
843
|
+
tx.object.mutRegistrar(),
|
|
844
|
+
],
|
|
845
|
+
typeArguments: [service_type],
|
|
846
|
+
});
|
|
847
|
+
}
|
|
1240
848
|
}
|
|
1241
|
-
}
|
|
1242
849
|
}
|
|
1243
850
|
function location_set(tx, service, service_type, permission, location, passport) {
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
(0, import_common.toTxString)(tx, location)
|
|
1275
|
-
],
|
|
1276
|
-
typeArguments: [service_type]
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
851
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
852
|
+
if (typeof location === "string" && !(0, common_js_1.isValidLongName)(location)) {
|
|
853
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Location ${location} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
854
|
+
}
|
|
855
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
856
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Location set service type ${service_type} is not valid`);
|
|
857
|
+
}
|
|
858
|
+
if (passport) {
|
|
859
|
+
tx.moveCall({
|
|
860
|
+
target: (0, common_js_1.serviceFn)("location_set_with_passport"),
|
|
861
|
+
arguments: [
|
|
862
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
863
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
864
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
865
|
+
(0, common_js_1.toTxString)(tx, location),
|
|
866
|
+
],
|
|
867
|
+
typeArguments: [service_type],
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
else {
|
|
871
|
+
tx.moveCall({
|
|
872
|
+
target: (0, common_js_1.serviceFn)("location_set"),
|
|
873
|
+
arguments: [
|
|
874
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
875
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
876
|
+
(0, common_js_1.toTxString)(tx, location),
|
|
877
|
+
],
|
|
878
|
+
typeArguments: [service_type],
|
|
879
|
+
});
|
|
880
|
+
}
|
|
1279
881
|
}
|
|
1280
882
|
function create(tx, service, service_type) {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
arguments: [(0, import_common.toTxObject)(tx, service)],
|
|
1291
|
-
typeArguments: [service_type]
|
|
1292
|
-
});
|
|
883
|
+
(0, util_js_1.validObjects)([service]);
|
|
884
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
885
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Create service type ${service_type} is not valid`);
|
|
886
|
+
}
|
|
887
|
+
return tx.moveCall({
|
|
888
|
+
target: (0, common_js_1.serviceFn)("create"),
|
|
889
|
+
arguments: [(0, common_js_1.toTxObject)(tx, service)],
|
|
890
|
+
typeArguments: [service_type],
|
|
891
|
+
});
|
|
1293
892
|
}
|
|
1294
893
|
function sales_add(tx, service, service_type, permission, sales, passport) {
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
})
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
});
|
|
1332
|
-
}
|
|
894
|
+
if (sales.length === 0) {
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
898
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
899
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sales add service type ${service_type} is not valid`);
|
|
900
|
+
}
|
|
901
|
+
if (passport) {
|
|
902
|
+
tx.moveCall({
|
|
903
|
+
target: (0, common_js_1.serviceFn)("sales_add_with_passport"),
|
|
904
|
+
arguments: [
|
|
905
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
906
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
907
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
908
|
+
tx.makeMoveVec({
|
|
909
|
+
elements: sales.map((s) => sale(tx, s)),
|
|
910
|
+
type: `${common_js_1.PackageAddress}::service::Sale`,
|
|
911
|
+
}),
|
|
912
|
+
],
|
|
913
|
+
typeArguments: [service_type],
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
tx.moveCall({
|
|
918
|
+
target: (0, common_js_1.serviceFn)("sales_add"),
|
|
919
|
+
arguments: [
|
|
920
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
921
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
922
|
+
tx.makeMoveVec({
|
|
923
|
+
elements: sales.map((s) => sale(tx, s)),
|
|
924
|
+
type: `${common_js_1.PackageAddress}::service::Sale`,
|
|
925
|
+
}),
|
|
926
|
+
],
|
|
927
|
+
typeArguments: [service_type],
|
|
928
|
+
});
|
|
929
|
+
}
|
|
1333
930
|
}
|
|
1334
931
|
function sales_remove(tx, service, service_type, permission, sales_name, passport) {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
932
|
+
if (sales_name.length === 0) {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
936
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
937
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sales remove service type ${service_type} is not valid`);
|
|
938
|
+
}
|
|
939
|
+
if (passport) {
|
|
940
|
+
tx.moveCall({
|
|
941
|
+
target: (0, common_js_1.serviceFn)("sales_remove_with_passport"),
|
|
942
|
+
arguments: [
|
|
943
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
944
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
945
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
946
|
+
tx.pure.vector("string", sales_name),
|
|
947
|
+
],
|
|
948
|
+
typeArguments: [service_type],
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
tx.moveCall({
|
|
953
|
+
target: (0, common_js_1.serviceFn)("sales_remove"),
|
|
954
|
+
arguments: [
|
|
955
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
956
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
957
|
+
tx.pure.vector("string", sales_name),
|
|
958
|
+
],
|
|
959
|
+
typeArguments: [service_type],
|
|
960
|
+
});
|
|
961
|
+
}
|
|
1367
962
|
}
|
|
1368
963
|
function sales_clear(tx, service, service_type, permission, passport) {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
964
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
965
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
966
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sales clear service type ${service_type} is not valid`);
|
|
967
|
+
}
|
|
968
|
+
if (passport) {
|
|
969
|
+
tx.moveCall({
|
|
970
|
+
target: (0, common_js_1.serviceFn)("sales_clear_with_passport"),
|
|
971
|
+
arguments: [
|
|
972
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
973
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
974
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
975
|
+
],
|
|
976
|
+
typeArguments: [service_type],
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
tx.moveCall({
|
|
981
|
+
target: (0, common_js_1.serviceFn)("sales_clear"),
|
|
982
|
+
arguments: [(0, common_js_1.toTxObject)(tx, service), (0, common_js_1.toTxObject)(tx, permission)],
|
|
983
|
+
typeArguments: [service_type],
|
|
984
|
+
});
|
|
985
|
+
}
|
|
1393
986
|
}
|
|
1394
987
|
function sales_set(tx, service, service_type, permission, sales, passport) {
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
})
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
});
|
|
1432
|
-
}
|
|
988
|
+
if (sales.length === 0) {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
992
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
993
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sales set service type ${service_type} is not valid`);
|
|
994
|
+
}
|
|
995
|
+
if (passport) {
|
|
996
|
+
tx.moveCall({
|
|
997
|
+
target: (0, common_js_1.serviceFn)("sales_set_with_passport"),
|
|
998
|
+
arguments: [
|
|
999
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1000
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1001
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1002
|
+
tx.makeMoveVec({
|
|
1003
|
+
elements: sales.map((s) => sale(tx, s)),
|
|
1004
|
+
type: `${common_js_1.PackageAddress}::service::Sale`,
|
|
1005
|
+
}),
|
|
1006
|
+
],
|
|
1007
|
+
typeArguments: [service_type],
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
else {
|
|
1011
|
+
tx.moveCall({
|
|
1012
|
+
target: (0, common_js_1.serviceFn)("sales_set"),
|
|
1013
|
+
arguments: [
|
|
1014
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1015
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1016
|
+
tx.makeMoveVec({
|
|
1017
|
+
elements: sales.map((s) => sale(tx, s)),
|
|
1018
|
+
type: `${common_js_1.PackageAddress}::service::Sale`,
|
|
1019
|
+
}),
|
|
1020
|
+
],
|
|
1021
|
+
typeArguments: [service_type],
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1433
1024
|
}
|
|
1434
|
-
function price_add(tx, service, service_type, permission, sale_name,
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
tx.
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
tx.pure.u64(price_add2)
|
|
1471
|
-
],
|
|
1472
|
-
typeArguments: [service_type]
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1025
|
+
function price_add(tx, service, service_type, permission, sale_name, price_add, passport) {
|
|
1026
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1027
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1028
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Price add service type ${service_type} is not valid`);
|
|
1029
|
+
}
|
|
1030
|
+
if (typeof sale_name === "string" && !(0, common_js_1.isValidLongName)(sale_name)) {
|
|
1031
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sale name ${sale_name} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
1032
|
+
}
|
|
1033
|
+
if (!(0, common_js_1.isValidU64)(price_add)) {
|
|
1034
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Price add ${price_add} is not valid`);
|
|
1035
|
+
}
|
|
1036
|
+
if (passport) {
|
|
1037
|
+
tx.moveCall({
|
|
1038
|
+
target: (0, common_js_1.serviceFn)("price_add_with_passport"),
|
|
1039
|
+
arguments: [
|
|
1040
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1041
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1042
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1043
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1044
|
+
tx.pure.u64(price_add),
|
|
1045
|
+
],
|
|
1046
|
+
typeArguments: [service_type],
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
tx.moveCall({
|
|
1051
|
+
target: (0, common_js_1.serviceFn)("price_add"),
|
|
1052
|
+
arguments: [
|
|
1053
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1054
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1055
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1056
|
+
tx.pure.u64(price_add),
|
|
1057
|
+
],
|
|
1058
|
+
typeArguments: [service_type],
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1475
1061
|
}
|
|
1476
|
-
function price_reduce(tx, service, service_type, permission, sale_name,
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1513
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1514
|
-
(0, import_common.toTxString)(tx, sale_name),
|
|
1515
|
-
tx.pure.u64(price_reduce2)
|
|
1516
|
-
],
|
|
1517
|
-
typeArguments: [service_type]
|
|
1518
|
-
});
|
|
1519
|
-
}
|
|
1062
|
+
function price_reduce(tx, service, service_type, permission, sale_name, price_reduce, passport) {
|
|
1063
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1064
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1065
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Price reduce service type ${service_type} is not valid`);
|
|
1066
|
+
}
|
|
1067
|
+
if (typeof sale_name === "string" && !(0, common_js_1.isValidLongName)(sale_name)) {
|
|
1068
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sale name ${sale_name} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
1069
|
+
}
|
|
1070
|
+
if (!(0, common_js_1.isValidU64)(price_reduce)) {
|
|
1071
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Price reduce ${price_reduce} is not valid`);
|
|
1072
|
+
}
|
|
1073
|
+
if (passport) {
|
|
1074
|
+
tx.moveCall({
|
|
1075
|
+
target: (0, common_js_1.serviceFn)("price_reduce_with_passport"),
|
|
1076
|
+
arguments: [
|
|
1077
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1078
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1079
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1080
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1081
|
+
tx.pure.u64(price_reduce),
|
|
1082
|
+
],
|
|
1083
|
+
typeArguments: [service_type],
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
tx.moveCall({
|
|
1088
|
+
target: (0, common_js_1.serviceFn)("price_reduce"),
|
|
1089
|
+
arguments: [
|
|
1090
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1091
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1092
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1093
|
+
tx.pure.u64(price_reduce),
|
|
1094
|
+
],
|
|
1095
|
+
typeArguments: [service_type],
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1520
1098
|
}
|
|
1521
|
-
function stock_add(tx, service, service_type, permission, sale_name,
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
tx.
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
tx.pure.u64(stock_add2)
|
|
1558
|
-
],
|
|
1559
|
-
typeArguments: [service_type]
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1099
|
+
function stock_add(tx, service, service_type, permission, sale_name, stock_add, passport) {
|
|
1100
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1101
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1102
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Stock add service type ${service_type} is not valid`);
|
|
1103
|
+
}
|
|
1104
|
+
if (typeof sale_name === "string" && !(0, common_js_1.isValidLongName)(sale_name)) {
|
|
1105
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sale name ${sale_name} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
1106
|
+
}
|
|
1107
|
+
if (!(0, common_js_1.isValidU64)(stock_add)) {
|
|
1108
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Stock add ${stock_add} is not valid`);
|
|
1109
|
+
}
|
|
1110
|
+
if (passport) {
|
|
1111
|
+
tx.moveCall({
|
|
1112
|
+
target: (0, common_js_1.serviceFn)("stock_add_with_passport"),
|
|
1113
|
+
arguments: [
|
|
1114
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1115
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1116
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1117
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1118
|
+
tx.pure.u64(stock_add),
|
|
1119
|
+
],
|
|
1120
|
+
typeArguments: [service_type],
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
else {
|
|
1124
|
+
tx.moveCall({
|
|
1125
|
+
target: (0, common_js_1.serviceFn)("stock_add"),
|
|
1126
|
+
arguments: [
|
|
1127
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1128
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1129
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1130
|
+
tx.pure.u64(stock_add),
|
|
1131
|
+
],
|
|
1132
|
+
typeArguments: [service_type],
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1562
1135
|
}
|
|
1563
|
-
function stock_reduce(tx, service, service_type, permission, sale_name,
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1600
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1601
|
-
(0, import_common.toTxString)(tx, sale_name),
|
|
1602
|
-
tx.pure.u64(stock_reduce2)
|
|
1603
|
-
],
|
|
1604
|
-
typeArguments: [service_type]
|
|
1605
|
-
});
|
|
1606
|
-
}
|
|
1136
|
+
function stock_reduce(tx, service, service_type, permission, sale_name, stock_reduce, passport) {
|
|
1137
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1138
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1139
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Stock reduce service type ${service_type} is not valid`);
|
|
1140
|
+
}
|
|
1141
|
+
if (typeof sale_name === "string" && !(0, common_js_1.isValidLongName)(sale_name)) {
|
|
1142
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sale name ${sale_name} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
1143
|
+
}
|
|
1144
|
+
if (!(0, common_js_1.isValidU64)(stock_reduce)) {
|
|
1145
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Stock reduce ${stock_reduce} is not valid`);
|
|
1146
|
+
}
|
|
1147
|
+
if (passport) {
|
|
1148
|
+
tx.moveCall({
|
|
1149
|
+
target: (0, common_js_1.serviceFn)("stock_reduce_with_passport"),
|
|
1150
|
+
arguments: [
|
|
1151
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1152
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1153
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1154
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1155
|
+
tx.pure.u64(stock_reduce),
|
|
1156
|
+
],
|
|
1157
|
+
typeArguments: [service_type],
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
tx.moveCall({
|
|
1162
|
+
target: (0, common_js_1.serviceFn)("stock_reduce"),
|
|
1163
|
+
arguments: [
|
|
1164
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1165
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1166
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1167
|
+
tx.pure.u64(stock_reduce),
|
|
1168
|
+
],
|
|
1169
|
+
typeArguments: [service_type],
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1607
1172
|
}
|
|
1608
1173
|
function sale_suspension(tx, service, service_type, permission, sale_name, suspension, passport) {
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
tx.
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
tx.pure.bool(suspension)
|
|
1642
|
-
],
|
|
1643
|
-
typeArguments: [service_type]
|
|
1644
|
-
});
|
|
1645
|
-
}
|
|
1174
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1175
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1176
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sale suspension service type ${service_type} is not valid`);
|
|
1177
|
+
}
|
|
1178
|
+
if (typeof sale_name === "string" && !(0, common_js_1.isValidLongName)(sale_name)) {
|
|
1179
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Sale name ${sale_name} exceeds maximum length ${common_js_1.MAX_LONG_NAME_LENGTH}`);
|
|
1180
|
+
}
|
|
1181
|
+
if (passport) {
|
|
1182
|
+
tx.moveCall({
|
|
1183
|
+
target: (0, common_js_1.serviceFn)("sale_suspension_with_passport"),
|
|
1184
|
+
arguments: [
|
|
1185
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1186
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1187
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1188
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1189
|
+
tx.pure.bool(suspension),
|
|
1190
|
+
],
|
|
1191
|
+
typeArguments: [service_type],
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
tx.moveCall({
|
|
1196
|
+
target: (0, common_js_1.serviceFn)("sale_suspension"),
|
|
1197
|
+
arguments: [
|
|
1198
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1199
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1200
|
+
(0, common_js_1.toTxString)(tx, sale_name),
|
|
1201
|
+
tx.pure.bool(suspension),
|
|
1202
|
+
],
|
|
1203
|
+
typeArguments: [service_type],
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1646
1206
|
}
|
|
1647
1207
|
function repository_add(tx, service, service_type, permission, repository, passport) {
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
});
|
|
1680
|
-
}
|
|
1208
|
+
(0, util_js_1.validObjects)([service, permission, repository, passport]);
|
|
1209
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1210
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Repository add service type ${service_type} is not valid`);
|
|
1211
|
+
}
|
|
1212
|
+
if (passport) {
|
|
1213
|
+
tx.moveCall({
|
|
1214
|
+
target: (0, common_js_1.serviceFn)("repository_add_with_passport"),
|
|
1215
|
+
arguments: [
|
|
1216
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1217
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1218
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1219
|
+
(0, common_js_1.toTxObject)(tx, repository),
|
|
1220
|
+
tx.object.mutRegistrar(),
|
|
1221
|
+
tx.object.clock(),
|
|
1222
|
+
],
|
|
1223
|
+
typeArguments: [service_type],
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
tx.moveCall({
|
|
1228
|
+
target: (0, common_js_1.serviceFn)("repository_add"),
|
|
1229
|
+
arguments: [
|
|
1230
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1231
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1232
|
+
(0, common_js_1.toTxObject)(tx, repository),
|
|
1233
|
+
tx.object.mutRegistrar(),
|
|
1234
|
+
tx.object.clock(),
|
|
1235
|
+
],
|
|
1236
|
+
typeArguments: [service_type],
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1681
1239
|
}
|
|
1682
1240
|
function repository_remove(tx, service, service_type, permission, repositories, passport) {
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
});
|
|
1716
|
-
}
|
|
1241
|
+
if (repositories.length === 0) {
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
(0, util_js_1.validObjects)([service, permission, passport, ...repositories]);
|
|
1245
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1246
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Repository remove service type ${service_type} is not valid`);
|
|
1247
|
+
}
|
|
1248
|
+
if (passport) {
|
|
1249
|
+
tx.moveCall({
|
|
1250
|
+
target: (0, common_js_1.serviceFn)("repository_remove_with_passport"),
|
|
1251
|
+
arguments: [
|
|
1252
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1253
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1254
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1255
|
+
tx.pure.vector("address", repositories),
|
|
1256
|
+
tx.object.mutRegistrar(),
|
|
1257
|
+
],
|
|
1258
|
+
typeArguments: [service_type],
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
tx.moveCall({
|
|
1263
|
+
target: (0, common_js_1.serviceFn)("repository_remove"),
|
|
1264
|
+
arguments: [
|
|
1265
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1266
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1267
|
+
tx.pure.vector("address", repositories),
|
|
1268
|
+
tx.object.mutRegistrar(),
|
|
1269
|
+
],
|
|
1270
|
+
typeArguments: [service_type],
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1717
1273
|
}
|
|
1718
1274
|
function repository_clear(tx, service, service_type, permission, passport) {
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
});
|
|
1747
|
-
}
|
|
1275
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1276
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1277
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Repository clear service type ${service_type} is not valid`);
|
|
1278
|
+
}
|
|
1279
|
+
if (passport) {
|
|
1280
|
+
tx.moveCall({
|
|
1281
|
+
target: (0, common_js_1.serviceFn)("repository_clear_with_passport"),
|
|
1282
|
+
arguments: [
|
|
1283
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1284
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1285
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1286
|
+
tx.object.mutRegistrar(),
|
|
1287
|
+
],
|
|
1288
|
+
typeArguments: [service_type],
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
else {
|
|
1292
|
+
tx.moveCall({
|
|
1293
|
+
target: (0, common_js_1.serviceFn)("repository_clear"),
|
|
1294
|
+
arguments: [
|
|
1295
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1296
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1297
|
+
tx.object.mutRegistrar(),
|
|
1298
|
+
],
|
|
1299
|
+
typeArguments: [service_type],
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1748
1302
|
}
|
|
1749
1303
|
function buy_guard_set(tx, service, service_type, permission, guard, passport) {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
import_exception.WErrors.InvalidParam,
|
|
1754
|
-
`Buy guard set service type ${service_type} is not valid`
|
|
1755
|
-
);
|
|
1756
|
-
}
|
|
1757
|
-
if (passport) {
|
|
1758
|
-
if (guard) {
|
|
1759
|
-
tx.moveCall({
|
|
1760
|
-
target: (0, import_common.serviceFn)("buy_guard_set_with_passport"),
|
|
1761
|
-
arguments: [
|
|
1762
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1763
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1764
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1765
|
-
(0, import_common.toTxObject)(tx, guard),
|
|
1766
|
-
tx.object.mutRegistrar(),
|
|
1767
|
-
tx.object.clock()
|
|
1768
|
-
],
|
|
1769
|
-
typeArguments: [service_type]
|
|
1770
|
-
});
|
|
1771
|
-
} else {
|
|
1772
|
-
tx.moveCall({
|
|
1773
|
-
target: (0, import_common.serviceFn)("buy_guard_none_with_passport"),
|
|
1774
|
-
arguments: [
|
|
1775
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1776
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1777
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1778
|
-
tx.object.mutRegistrar()
|
|
1779
|
-
],
|
|
1780
|
-
typeArguments: [service_type]
|
|
1781
|
-
});
|
|
1304
|
+
(0, util_js_1.validObjects)([service, permission, guard, passport]);
|
|
1305
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1306
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Buy guard set service type ${service_type} is not valid`);
|
|
1782
1307
|
}
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1308
|
+
if (passport) {
|
|
1309
|
+
if (guard) {
|
|
1310
|
+
tx.moveCall({
|
|
1311
|
+
target: (0, common_js_1.serviceFn)("buy_guard_set_with_passport"),
|
|
1312
|
+
arguments: [
|
|
1313
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1314
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1315
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1316
|
+
(0, common_js_1.toTxObject)(tx, guard),
|
|
1317
|
+
tx.object.mutRegistrar(),
|
|
1318
|
+
tx.object.clock(),
|
|
1319
|
+
],
|
|
1320
|
+
typeArguments: [service_type],
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
tx.moveCall({
|
|
1325
|
+
target: (0, common_js_1.serviceFn)("buy_guard_none_with_passport"),
|
|
1326
|
+
arguments: [
|
|
1327
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1328
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1329
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1330
|
+
tx.object.mutRegistrar(),
|
|
1331
|
+
],
|
|
1332
|
+
typeArguments: [service_type],
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
else {
|
|
1337
|
+
if (guard) {
|
|
1338
|
+
tx.moveCall({
|
|
1339
|
+
target: (0, common_js_1.serviceFn)("buy_guard_set"),
|
|
1340
|
+
arguments: [
|
|
1341
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1342
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1343
|
+
(0, common_js_1.toTxObject)(tx, guard),
|
|
1344
|
+
tx.object.mutRegistrar(),
|
|
1345
|
+
tx.object.clock(),
|
|
1346
|
+
],
|
|
1347
|
+
typeArguments: [service_type],
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
tx.moveCall({
|
|
1352
|
+
target: (0, common_js_1.serviceFn)("buy_guard_none"),
|
|
1353
|
+
arguments: [
|
|
1354
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1355
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1356
|
+
tx.object.mutRegistrar(),
|
|
1357
|
+
],
|
|
1358
|
+
typeArguments: [service_type],
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1806
1361
|
}
|
|
1807
|
-
}
|
|
1808
1362
|
}
|
|
1809
1363
|
function machine_set(tx, service, service_type, permission, machine, passport) {
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
import_exception.WErrors.InvalidParam,
|
|
1814
|
-
`Machine set service type ${service_type} is not valid`
|
|
1815
|
-
);
|
|
1816
|
-
}
|
|
1817
|
-
if (passport) {
|
|
1818
|
-
if (machine) {
|
|
1819
|
-
tx.moveCall({
|
|
1820
|
-
target: (0, import_common.serviceFn)("machine_set_with_passport"),
|
|
1821
|
-
arguments: [
|
|
1822
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1823
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1824
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1825
|
-
(0, import_common.toTxObject)(tx, machine),
|
|
1826
|
-
tx.object.mutRegistrar(),
|
|
1827
|
-
tx.object.clock()
|
|
1828
|
-
],
|
|
1829
|
-
typeArguments: [service_type]
|
|
1830
|
-
});
|
|
1831
|
-
} else {
|
|
1832
|
-
tx.moveCall({
|
|
1833
|
-
target: (0, import_common.serviceFn)("machine_none_with_passport"),
|
|
1834
|
-
arguments: [
|
|
1835
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1836
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1837
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1838
|
-
tx.object.mutRegistrar()
|
|
1839
|
-
],
|
|
1840
|
-
typeArguments: [service_type]
|
|
1841
|
-
});
|
|
1364
|
+
(0, util_js_1.validObjects)([service, permission, machine, passport]);
|
|
1365
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1366
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Machine set service type ${service_type} is not valid`);
|
|
1842
1367
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1368
|
+
if (passport) {
|
|
1369
|
+
if (machine) {
|
|
1370
|
+
tx.moveCall({
|
|
1371
|
+
target: (0, common_js_1.serviceFn)("machine_set_with_passport"),
|
|
1372
|
+
arguments: [
|
|
1373
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1374
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1375
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1376
|
+
(0, common_js_1.toTxObject)(tx, machine),
|
|
1377
|
+
tx.object.mutRegistrar(),
|
|
1378
|
+
tx.object.clock(),
|
|
1379
|
+
],
|
|
1380
|
+
typeArguments: [service_type],
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
else {
|
|
1384
|
+
tx.moveCall({
|
|
1385
|
+
target: (0, common_js_1.serviceFn)("machine_none_with_passport"),
|
|
1386
|
+
arguments: [
|
|
1387
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1388
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1389
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1390
|
+
tx.object.mutRegistrar(),
|
|
1391
|
+
],
|
|
1392
|
+
typeArguments: [service_type],
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
else {
|
|
1397
|
+
if (machine) {
|
|
1398
|
+
tx.moveCall({
|
|
1399
|
+
target: (0, common_js_1.serviceFn)("machine_set"),
|
|
1400
|
+
arguments: [
|
|
1401
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1402
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1403
|
+
(0, common_js_1.toTxObject)(tx, machine),
|
|
1404
|
+
tx.object.mutRegistrar(),
|
|
1405
|
+
tx.object.clock(),
|
|
1406
|
+
],
|
|
1407
|
+
typeArguments: [service_type],
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
else {
|
|
1411
|
+
tx.moveCall({
|
|
1412
|
+
target: (0, common_js_1.serviceFn)("machine_set_none"),
|
|
1413
|
+
arguments: [
|
|
1414
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1415
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1416
|
+
tx.object.mutRegistrar(),
|
|
1417
|
+
],
|
|
1418
|
+
typeArguments: [service_type],
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1866
1421
|
}
|
|
1867
|
-
}
|
|
1868
1422
|
}
|
|
1869
1423
|
function publish(tx, service, service_type, permission, passport) {
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
});
|
|
1893
|
-
}
|
|
1424
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1425
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1426
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Publish service type ${service_type} is not valid`);
|
|
1427
|
+
}
|
|
1428
|
+
if (passport) {
|
|
1429
|
+
tx.moveCall({
|
|
1430
|
+
target: (0, common_js_1.serviceFn)("publish_with_passport"),
|
|
1431
|
+
arguments: [
|
|
1432
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1433
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1434
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1435
|
+
],
|
|
1436
|
+
typeArguments: [service_type],
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
else {
|
|
1440
|
+
tx.moveCall({
|
|
1441
|
+
target: (0, common_js_1.serviceFn)("publish"),
|
|
1442
|
+
arguments: [(0, common_js_1.toTxObject)(tx, service), (0, common_js_1.toTxObject)(tx, permission)],
|
|
1443
|
+
typeArguments: [service_type],
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1894
1446
|
}
|
|
1895
1447
|
function pause(tx, service, service_type, permission, bPaused, passport) {
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
});
|
|
1926
|
-
}
|
|
1448
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1449
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1450
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Pause service type ${service_type} is not valid`);
|
|
1451
|
+
}
|
|
1452
|
+
if (passport) {
|
|
1453
|
+
tx.moveCall({
|
|
1454
|
+
target: (0, common_js_1.serviceFn)("pause_with_passport"),
|
|
1455
|
+
arguments: [
|
|
1456
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1457
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1458
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1459
|
+
tx.pure.bool(bPaused),
|
|
1460
|
+
tx.object.clock(),
|
|
1461
|
+
],
|
|
1462
|
+
typeArguments: [service_type],
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
else {
|
|
1466
|
+
tx.moveCall({
|
|
1467
|
+
target: (0, common_js_1.serviceFn)("pause"),
|
|
1468
|
+
arguments: [
|
|
1469
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1470
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1471
|
+
tx.pure.bool(bPaused),
|
|
1472
|
+
tx.object.clock(),
|
|
1473
|
+
],
|
|
1474
|
+
typeArguments: [service_type],
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1927
1477
|
}
|
|
1928
1478
|
function customer_required_set(tx, service, service_type, permission, required_info, passport) {
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
)
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
);
|
|
1941
|
-
}
|
|
1942
|
-
required_info.forEach((item) => {
|
|
1943
|
-
if (!(0, import_common.isValidName)(item)) {
|
|
1944
|
-
(0, import_exception.W_ERROR)(
|
|
1945
|
-
import_exception.WErrors.InvalidParam,
|
|
1946
|
-
`Customer required info ${item} is exceed maximum length ${import_common.MAX_NAME_LENGTH} or start with "0x"`
|
|
1947
|
-
);
|
|
1948
|
-
}
|
|
1949
|
-
});
|
|
1950
|
-
if (passport) {
|
|
1951
|
-
tx.moveCall({
|
|
1952
|
-
target: (0, import_common.serviceFn)("custom_required_info_set_with_passport"),
|
|
1953
|
-
arguments: [
|
|
1954
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1955
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1956
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1957
|
-
tx.pure.vector("string", required_info)
|
|
1958
|
-
],
|
|
1959
|
-
typeArguments: [service_type]
|
|
1960
|
-
});
|
|
1961
|
-
} else {
|
|
1962
|
-
tx.moveCall({
|
|
1963
|
-
target: (0, import_common.serviceFn)("custom_required_info_set"),
|
|
1964
|
-
arguments: [
|
|
1965
|
-
(0, import_common.toTxObject)(tx, service),
|
|
1966
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1967
|
-
tx.pure.vector("string", required_info)
|
|
1968
|
-
],
|
|
1969
|
-
typeArguments: [service_type]
|
|
1479
|
+
if (required_info.length > exports.MAX_REQUIRED_INFO_SIZE) {
|
|
1480
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Customer required set size ${required_info.length} is exceed maximum size ${exports.MAX_REQUIRED_INFO_SIZE}`);
|
|
1481
|
+
}
|
|
1482
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1483
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1484
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Customer required set service type ${service_type} is not valid`);
|
|
1485
|
+
}
|
|
1486
|
+
required_info.forEach((item) => {
|
|
1487
|
+
if (!(0, common_js_1.isValidName)(item)) {
|
|
1488
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Customer required info ${item} is exceed maximum length ${common_js_1.MAX_NAME_LENGTH} or start with "0x"`);
|
|
1489
|
+
}
|
|
1970
1490
|
});
|
|
1971
|
-
|
|
1491
|
+
if (passport) {
|
|
1492
|
+
tx.moveCall({
|
|
1493
|
+
target: (0, common_js_1.serviceFn)("custom_required_info_set_with_passport"),
|
|
1494
|
+
arguments: [
|
|
1495
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1496
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1497
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1498
|
+
tx.pure.vector("string", required_info),
|
|
1499
|
+
],
|
|
1500
|
+
typeArguments: [service_type],
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
else {
|
|
1504
|
+
tx.moveCall({
|
|
1505
|
+
target: (0, common_js_1.serviceFn)("custom_required_info_set"),
|
|
1506
|
+
arguments: [
|
|
1507
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1508
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1509
|
+
tx.pure.vector("string", required_info),
|
|
1510
|
+
],
|
|
1511
|
+
typeArguments: [service_type],
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1972
1514
|
}
|
|
1973
1515
|
function arbitrations_add(tx, service, service_type, permission, arbitration, arbitration_type, passport) {
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
tx.
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
tx.object.clock()
|
|
2009
|
-
],
|
|
2010
|
-
typeArguments: [service_type, arbitration_type]
|
|
2011
|
-
});
|
|
2012
|
-
}
|
|
1516
|
+
(0, util_js_1.validObjects)([service, permission, arbitration, passport]);
|
|
1517
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1518
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Arbitrations add service type ${service_type} is not valid`);
|
|
1519
|
+
}
|
|
1520
|
+
if (!(0, common_js_1.IsValidArgType)(arbitration_type)) {
|
|
1521
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Arbitrations add arbitration type ${arbitration_type} is not valid`);
|
|
1522
|
+
}
|
|
1523
|
+
if (passport) {
|
|
1524
|
+
tx.moveCall({
|
|
1525
|
+
target: (0, common_js_1.serviceFn)("arbitration_add_with_passport"),
|
|
1526
|
+
arguments: [
|
|
1527
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1528
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1529
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1530
|
+
(0, common_js_1.toTxObject)(tx, arbitration),
|
|
1531
|
+
tx.object.mutRegistrar(),
|
|
1532
|
+
tx.object.clock(),
|
|
1533
|
+
],
|
|
1534
|
+
typeArguments: [service_type],
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
else {
|
|
1538
|
+
tx.moveCall({
|
|
1539
|
+
target: (0, common_js_1.serviceFn)("arbitrations_add"),
|
|
1540
|
+
arguments: [
|
|
1541
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1542
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1543
|
+
(0, common_js_1.toTxObject)(tx, arbitration),
|
|
1544
|
+
tx.object.mutRegistrar(),
|
|
1545
|
+
tx.object.clock(),
|
|
1546
|
+
],
|
|
1547
|
+
typeArguments: [service_type, arbitration_type],
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
2013
1550
|
}
|
|
2014
1551
|
function arbitrations_remove(tx, service, service_type, permission, arbitrations, passport) {
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
1552
|
+
if (arbitrations.length === 0) {
|
|
1553
|
+
return;
|
|
1554
|
+
}
|
|
1555
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1556
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1557
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Arbitrations remove service type ${service_type} is not valid`);
|
|
1558
|
+
}
|
|
1559
|
+
if (passport) {
|
|
1560
|
+
tx.moveCall({
|
|
1561
|
+
target: (0, common_js_1.serviceFn)("arbitration_remove_with_passport"),
|
|
1562
|
+
arguments: [
|
|
1563
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1564
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1565
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1566
|
+
tx.pure.vector("address", arbitrations),
|
|
1567
|
+
tx.object.mutRegistrar(),
|
|
1568
|
+
],
|
|
1569
|
+
typeArguments: [service_type],
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
else {
|
|
1573
|
+
tx.moveCall({
|
|
1574
|
+
target: (0, common_js_1.serviceFn)("arbitration_remove"),
|
|
1575
|
+
arguments: [
|
|
1576
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1577
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1578
|
+
tx.pure.vector("address", arbitrations),
|
|
1579
|
+
tx.object.mutRegistrar(),
|
|
1580
|
+
],
|
|
1581
|
+
typeArguments: [service_type],
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
2049
1584
|
}
|
|
2050
1585
|
function arbitration_clear(tx, service, service_type, permission, passport) {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
});
|
|
2079
|
-
}
|
|
1586
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1587
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1588
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Arbitrations clear service type ${service_type} is not valid`);
|
|
1589
|
+
}
|
|
1590
|
+
if (passport) {
|
|
1591
|
+
tx.moveCall({
|
|
1592
|
+
target: (0, common_js_1.serviceFn)("arbitration_clear_with_passport"),
|
|
1593
|
+
arguments: [
|
|
1594
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1595
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1596
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1597
|
+
tx.object.mutRegistrar(),
|
|
1598
|
+
],
|
|
1599
|
+
typeArguments: [service_type],
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
else {
|
|
1603
|
+
tx.moveCall({
|
|
1604
|
+
target: (0, common_js_1.serviceFn)("arbitration_clear"),
|
|
1605
|
+
arguments: [
|
|
1606
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1607
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1608
|
+
tx.object.mutRegistrar(),
|
|
1609
|
+
],
|
|
1610
|
+
typeArguments: [service_type],
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
2080
1613
|
}
|
|
2081
1614
|
async function compensation_fund_add(env, tx, service, service_type, permission, coin, passport) {
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
)
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
});
|
|
2111
|
-
}
|
|
1615
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1616
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1617
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Compensation fund add service type ${service_type} is not valid`);
|
|
1618
|
+
}
|
|
1619
|
+
const coinParam = await (0, base_js_1.getCoinParam)(env, tx, coin, service_type);
|
|
1620
|
+
if (passport) {
|
|
1621
|
+
tx.moveCall({
|
|
1622
|
+
target: (0, common_js_1.serviceFn)("compensation_fund_add_with_passport"),
|
|
1623
|
+
arguments: [
|
|
1624
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1625
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1626
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1627
|
+
coinParam,
|
|
1628
|
+
],
|
|
1629
|
+
typeArguments: [service_type],
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
else {
|
|
1633
|
+
tx.moveCall({
|
|
1634
|
+
target: (0, common_js_1.serviceFn)("compensation_fund_add"),
|
|
1635
|
+
arguments: [
|
|
1636
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1637
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1638
|
+
coinParam,
|
|
1639
|
+
],
|
|
1640
|
+
typeArguments: [service_type],
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
2112
1643
|
}
|
|
2113
1644
|
function compensation_lock_duration_set(tx, service, service_type, permission, duration_ms, passport) {
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
});
|
|
2145
|
-
}
|
|
1645
|
+
if (!(0, common_js_1.isValidU64)(duration_ms) || duration_ms === 0) {
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1649
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1650
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Compensation lock duration set service type ${service_type} is not valid`);
|
|
1651
|
+
}
|
|
1652
|
+
if (passport) {
|
|
1653
|
+
tx.moveCall({
|
|
1654
|
+
target: (0, common_js_1.serviceFn)("compensation_lock_duration_add_with_passport"),
|
|
1655
|
+
arguments: [
|
|
1656
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1657
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1658
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1659
|
+
tx.pure.u64(duration_ms),
|
|
1660
|
+
],
|
|
1661
|
+
typeArguments: [service_type],
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
else {
|
|
1665
|
+
tx.moveCall({
|
|
1666
|
+
target: (0, common_js_1.serviceFn)("compensation_lock_duration_add"),
|
|
1667
|
+
arguments: [
|
|
1668
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1669
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1670
|
+
tx.pure.u64(duration_ms),
|
|
1671
|
+
],
|
|
1672
|
+
typeArguments: [service_type],
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
2146
1675
|
}
|
|
2147
|
-
function order_allocators_set(tx, service, service_type, permission,
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
})
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
});
|
|
2182
|
-
}
|
|
1676
|
+
function order_allocators_set(tx, service, service_type, permission, allocators, passport) {
|
|
1677
|
+
(0, util_js_1.validObjects)([service, permission, allocators, passport]);
|
|
1678
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1679
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Order allocators set service type ${service_type} is not valid`);
|
|
1680
|
+
}
|
|
1681
|
+
if (passport) {
|
|
1682
|
+
tx.moveCall({
|
|
1683
|
+
target: (0, common_js_1.serviceFn)("order_allocators_set_with_passport"),
|
|
1684
|
+
arguments: [
|
|
1685
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1686
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1687
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1688
|
+
tx.object.option({
|
|
1689
|
+
type: `${common_js_1.PackageAddress}::allocation::Allocators`,
|
|
1690
|
+
value: allocators ?? null,
|
|
1691
|
+
}),
|
|
1692
|
+
],
|
|
1693
|
+
typeArguments: [service_type],
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
else {
|
|
1697
|
+
tx.moveCall({
|
|
1698
|
+
target: (0, common_js_1.serviceFn)("order_allocators_set"),
|
|
1699
|
+
arguments: [
|
|
1700
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1701
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1702
|
+
tx.object.option({
|
|
1703
|
+
type: `${common_js_1.PackageAddress}::allocation::Allocators`,
|
|
1704
|
+
value: allocators ?? null,
|
|
1705
|
+
}),
|
|
1706
|
+
],
|
|
1707
|
+
typeArguments: [service_type],
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
2183
1710
|
}
|
|
2184
1711
|
function reward_add(tx, service, service_type, permission, reward, reward_type, passport) {
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
tx.
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
tx.object.clock()
|
|
2220
|
-
],
|
|
2221
|
-
typeArguments: [service_type, reward_type]
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
1712
|
+
(0, util_js_1.validObjects)([service, permission, reward, passport]);
|
|
1713
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1714
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Rewards add service type ${service_type} is not valid`);
|
|
1715
|
+
}
|
|
1716
|
+
if (!(0, common_js_1.IsValidArgType)(reward_type)) {
|
|
1717
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Rewards add reward type ${reward_type} is not valid`);
|
|
1718
|
+
}
|
|
1719
|
+
if (passport) {
|
|
1720
|
+
tx.moveCall({
|
|
1721
|
+
target: (0, common_js_1.serviceFn)("reward_add_with_passport"),
|
|
1722
|
+
arguments: [
|
|
1723
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1724
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1725
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1726
|
+
(0, common_js_1.toTxObject)(tx, reward),
|
|
1727
|
+
tx.object.mutRegistrar(),
|
|
1728
|
+
tx.object.clock(),
|
|
1729
|
+
],
|
|
1730
|
+
typeArguments: [service_type, reward_type],
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
else {
|
|
1734
|
+
tx.moveCall({
|
|
1735
|
+
target: (0, common_js_1.serviceFn)("reward_add"),
|
|
1736
|
+
arguments: [
|
|
1737
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1738
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1739
|
+
(0, common_js_1.toTxObject)(tx, reward),
|
|
1740
|
+
tx.object.mutRegistrar(),
|
|
1741
|
+
tx.object.clock(),
|
|
1742
|
+
],
|
|
1743
|
+
typeArguments: [service_type, reward_type],
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
2224
1746
|
}
|
|
2225
1747
|
function reward_remove(tx, service, service_type, permission, rewards, passport) {
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
});
|
|
2259
|
-
}
|
|
1748
|
+
if (rewards.length === 0) {
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1752
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1753
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Rewards remove service type ${service_type} is not valid`);
|
|
1754
|
+
}
|
|
1755
|
+
if (passport) {
|
|
1756
|
+
tx.moveCall({
|
|
1757
|
+
target: (0, common_js_1.serviceFn)("reward_remove_with_passport"),
|
|
1758
|
+
arguments: [
|
|
1759
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1760
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1761
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1762
|
+
tx.pure.vector("address", rewards),
|
|
1763
|
+
tx.object.mutRegistrar(),
|
|
1764
|
+
],
|
|
1765
|
+
typeArguments: [service_type],
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
else {
|
|
1769
|
+
tx.moveCall({
|
|
1770
|
+
target: (0, common_js_1.serviceFn)("reward_remove"),
|
|
1771
|
+
arguments: [
|
|
1772
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1773
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1774
|
+
tx.pure.vector("address", rewards),
|
|
1775
|
+
tx.object.mutRegistrar(),
|
|
1776
|
+
],
|
|
1777
|
+
typeArguments: [service_type],
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
2260
1780
|
}
|
|
2261
1781
|
function reward_clear(tx, service, service_type, permission, passport) {
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
1782
|
+
(0, util_js_1.validObjects)([service, permission, passport]);
|
|
1783
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1784
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Rewards clear service type ${service_type} is not valid`);
|
|
1785
|
+
}
|
|
1786
|
+
if (passport) {
|
|
1787
|
+
tx.moveCall({
|
|
1788
|
+
target: (0, common_js_1.serviceFn)("reward_clear_with_passport"),
|
|
1789
|
+
arguments: [
|
|
1790
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1791
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1792
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1793
|
+
tx.object.mutRegistrar(),
|
|
1794
|
+
],
|
|
1795
|
+
typeArguments: [service_type],
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
else {
|
|
1799
|
+
tx.moveCall({
|
|
1800
|
+
target: (0, common_js_1.serviceFn)("reward_clear"),
|
|
1801
|
+
arguments: [
|
|
1802
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1803
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1804
|
+
tx.object.mutRegistrar(),
|
|
1805
|
+
],
|
|
1806
|
+
typeArguments: [service_type],
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
2291
1809
|
}
|
|
2292
1810
|
function compensation_fund_receive(tx, service, service_type, permission, received_object, payment, passport) {
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
)
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
(0, import_common.toTxObject)(tx, payment)
|
|
2326
|
-
],
|
|
2327
|
-
typeArguments: [service_type]
|
|
2328
|
-
});
|
|
2329
|
-
}
|
|
1811
|
+
if (!payment) {
|
|
1812
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Compensation fund receive payment is required`);
|
|
1813
|
+
}
|
|
1814
|
+
(0, util_js_1.validObjects)([service, permission, received_object, payment, passport]);
|
|
1815
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1816
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Compensation fund receive service type ${service_type} is not valid`);
|
|
1817
|
+
}
|
|
1818
|
+
if (passport) {
|
|
1819
|
+
tx.moveCall({
|
|
1820
|
+
target: (0, common_js_1.serviceFn)("compensation_fund_receive_with_passport"),
|
|
1821
|
+
arguments: [
|
|
1822
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1823
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1824
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1825
|
+
(0, common_js_1.toTxObject)(tx, received_object),
|
|
1826
|
+
(0, common_js_1.toTxObject)(tx, payment),
|
|
1827
|
+
],
|
|
1828
|
+
typeArguments: [service_type],
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
else {
|
|
1832
|
+
tx.moveCall({
|
|
1833
|
+
target: (0, common_js_1.serviceFn)("compensation_fund_receive"),
|
|
1834
|
+
arguments: [
|
|
1835
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1836
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1837
|
+
(0, common_js_1.toTxObject)(tx, received_object),
|
|
1838
|
+
(0, common_js_1.toTxObject)(tx, payment),
|
|
1839
|
+
],
|
|
1840
|
+
typeArguments: [service_type],
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
2330
1843
|
}
|
|
2331
1844
|
function compensation_fund_withdraw(tx, service, service_type, payment_info, receipt, permission, passport) {
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
});
|
|
2366
|
-
}
|
|
1845
|
+
(0, util_js_1.validObjects)([service, permission, receipt, payment_info, passport]);
|
|
1846
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1847
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Compensation fund withdraw service type ${service_type} is not valid`);
|
|
1848
|
+
}
|
|
1849
|
+
if (passport) {
|
|
1850
|
+
tx.moveCall({
|
|
1851
|
+
target: (0, common_js_1.serviceFn)("compensation_fund_withdraw_with_passport"),
|
|
1852
|
+
arguments: [
|
|
1853
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1854
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1855
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1856
|
+
tx.pure.address(receipt),
|
|
1857
|
+
(0, common_js_1.toTxObject)(tx, payment_info),
|
|
1858
|
+
tx.object.mutRegistrar(),
|
|
1859
|
+
tx.object.clock(),
|
|
1860
|
+
],
|
|
1861
|
+
typeArguments: [service_type],
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
else {
|
|
1865
|
+
tx.moveCall({
|
|
1866
|
+
target: (0, common_js_1.serviceFn)("compensation_fund_withdraw"),
|
|
1867
|
+
arguments: [
|
|
1868
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1869
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1870
|
+
tx.pure.address(receipt),
|
|
1871
|
+
(0, common_js_1.toTxObject)(tx, payment_info),
|
|
1872
|
+
tx.object.mutRegistrar(),
|
|
1873
|
+
tx.object.clock(),
|
|
1874
|
+
],
|
|
1875
|
+
typeArguments: [service_type],
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
2367
1878
|
}
|
|
2368
|
-
async function discount(tx, service, service_type, permission,
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
(
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
)
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
)
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
target: (0, import_common.serviceFn)("discount"),
|
|
2451
|
-
arguments: [
|
|
2452
|
-
(0, import_common.toTxObject)(tx, service),
|
|
2453
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
2454
|
-
tx.pure.string(discount2.name),
|
|
2455
|
-
tx.pure.u8(discount2.discount_type),
|
|
2456
|
-
tx.pure.u64(discount2.discount_value),
|
|
2457
|
-
tx.pure.option("u64", discount2.benchmark ?? null),
|
|
2458
|
-
tx.pure.bool(discount2.transferable),
|
|
2459
|
-
tx.pure.option("u64", discount2.time_ms_start ?? null),
|
|
2460
|
-
tx.pure.u64(discount2.time_ms_end),
|
|
2461
|
-
tx.pure.u16(discount2.count),
|
|
2462
|
-
tx.pure.vector("address", recipient),
|
|
2463
|
-
tx.object.clock()
|
|
2464
|
-
],
|
|
2465
|
-
typeArguments: [service_type]
|
|
2466
|
-
});
|
|
2467
|
-
}
|
|
1879
|
+
async function discount(tx, service, service_type, permission, discount, passport) {
|
|
1880
|
+
let recipient = [];
|
|
1881
|
+
if (Array.isArray(discount.recipient)) {
|
|
1882
|
+
// 如果 recipient 是 string[] 类型,直接使用
|
|
1883
|
+
recipient = discount.recipient;
|
|
1884
|
+
}
|
|
1885
|
+
else {
|
|
1886
|
+
// 如果 recipient 是 ManyAccountOrMark_Address 类型,调用 GetManyAccountOrMark_Address
|
|
1887
|
+
recipient = await (0, index_js_1.GetManyAccountOrMark_Address)(discount.recipient);
|
|
1888
|
+
}
|
|
1889
|
+
if (recipient.length === 0 || discount.count === 0) {
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
if (recipient.length > exports.MAX_DISCOUNT_RECEIVER_ONCE) {
|
|
1893
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount recipient length ${recipient.length} is exceed max ${exports.MAX_DISCOUNT_RECEIVER_ONCE}`);
|
|
1894
|
+
}
|
|
1895
|
+
if (!(0, common_js_1.isValidName)(discount.name)) {
|
|
1896
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount name ${discount.name} is not valid`);
|
|
1897
|
+
}
|
|
1898
|
+
if (!(0, common_js_1.isValidU16)(discount.count) ||
|
|
1899
|
+
discount.count > exports.MAX_DISCOUNT_COUNT_ONCE) {
|
|
1900
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount count ${discount.count} is exceed max ${exports.MAX_DISCOUNT_COUNT_ONCE}`);
|
|
1901
|
+
}
|
|
1902
|
+
if (recipient.length * discount.count > exports.MAX_DISCOUNT_TOTAL_COUNT) {
|
|
1903
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount total count ${recipient.length * discount.count} is exceed max ${exports.MAX_DISCOUNT_TOTAL_COUNT}`);
|
|
1904
|
+
}
|
|
1905
|
+
if (discount.benchmark != null && !(0, common_js_1.isValidU64)(discount.benchmark)) {
|
|
1906
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount benchmark ${discount.benchmark} is not valid`);
|
|
1907
|
+
}
|
|
1908
|
+
const start = discount.time_ms_start ?? Date.now();
|
|
1909
|
+
if (discount.time_ms_end < start) {
|
|
1910
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount time_ms_end ${discount.time_ms_end} is not valid`);
|
|
1911
|
+
}
|
|
1912
|
+
if (discount.discount_value != null &&
|
|
1913
|
+
!(0, common_js_1.isValidU64)(discount.discount_value)) {
|
|
1914
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount discount_value ${discount.discount_value} is not valid`);
|
|
1915
|
+
}
|
|
1916
|
+
(0, util_js_1.validObjects)([service, permission, passport, ...recipient]);
|
|
1917
|
+
if (!(0, common_js_1.IsValidArgType)(service_type)) {
|
|
1918
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Discount service type ${service_type} is not valid`);
|
|
1919
|
+
}
|
|
1920
|
+
if (passport) {
|
|
1921
|
+
tx.moveCall({
|
|
1922
|
+
target: (0, common_js_1.serviceFn)("discount_with_passport"),
|
|
1923
|
+
arguments: [
|
|
1924
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1925
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1926
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
1927
|
+
tx.pure.string(discount.name),
|
|
1928
|
+
tx.pure.u8(discount.discount_type),
|
|
1929
|
+
tx.pure.u64(discount.discount_value),
|
|
1930
|
+
tx.pure.option("u64", discount.benchmark ?? null),
|
|
1931
|
+
tx.pure.bool(discount.transferable),
|
|
1932
|
+
tx.pure.option("u64", discount.time_ms_start ?? null),
|
|
1933
|
+
tx.pure.u64(discount.time_ms_end),
|
|
1934
|
+
tx.pure.u16(discount.count),
|
|
1935
|
+
tx.pure.vector("address", recipient),
|
|
1936
|
+
tx.object.clock(),
|
|
1937
|
+
],
|
|
1938
|
+
typeArguments: [service_type],
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
else {
|
|
1942
|
+
tx.moveCall({
|
|
1943
|
+
target: (0, common_js_1.serviceFn)("discount"),
|
|
1944
|
+
arguments: [
|
|
1945
|
+
(0, common_js_1.toTxObject)(tx, service),
|
|
1946
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
1947
|
+
tx.pure.string(discount.name),
|
|
1948
|
+
tx.pure.u8(discount.discount_type),
|
|
1949
|
+
tx.pure.u64(discount.discount_value),
|
|
1950
|
+
tx.pure.option("u64", discount.benchmark ?? null),
|
|
1951
|
+
tx.pure.bool(discount.transferable),
|
|
1952
|
+
tx.pure.option("u64", discount.time_ms_start ?? null),
|
|
1953
|
+
tx.pure.u64(discount.time_ms_end),
|
|
1954
|
+
tx.pure.u16(discount.count),
|
|
1955
|
+
tx.pure.vector("address", recipient),
|
|
1956
|
+
tx.object.clock(),
|
|
1957
|
+
],
|
|
1958
|
+
typeArguments: [service_type],
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
2468
1961
|
}
|
|
1962
|
+
//# sourceMappingURL=service.js.map
|