wowok 2.1.13 → 2.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bcs/bcs.js +160 -164
- package/dist/cjs/bcs/bcs.js.map +1 -1
- package/dist/cjs/bcs/effects.js +109 -112
- package/dist/cjs/bcs/effects.js.map +1 -1
- package/dist/cjs/bcs/index.js +49 -58
- package/dist/cjs/bcs/index.js.map +1 -1
- package/dist/cjs/bcs/pure.js +14 -17
- package/dist/cjs/bcs/pure.js.map +1 -1
- package/dist/cjs/bcs/type-tag-serializer.js +6 -11
- package/dist/cjs/bcs/type-tag-serializer.js.map +1 -1
- package/dist/cjs/bcs/types.js +1 -4
- package/dist/cjs/bcs/types.js.map +1 -1
- package/dist/cjs/client/index.js +4 -15
- package/dist/cjs/client/index.js.map +1 -1
- package/dist/cjs/client/network.js +3 -7
- package/dist/cjs/client/network.js.map +1 -1
- package/dist/cjs/cryptography/index.js +6 -27
- package/dist/cjs/cryptography/index.js.map +1 -1
- package/dist/cjs/cryptography/intent.js +4 -7
- package/dist/cjs/cryptography/intent.js.map +1 -1
- package/dist/cjs/cryptography/keypair.js +26 -33
- package/dist/cjs/cryptography/keypair.js.map +1 -1
- package/dist/cjs/cryptography/mnemonics.js +8 -14
- package/dist/cjs/cryptography/mnemonics.js.map +1 -1
- package/dist/cjs/cryptography/publickey.js +19 -25
- package/dist/cjs/cryptography/publickey.js.map +1 -1
- package/dist/cjs/cryptography/signature-scheme.js +3 -6
- package/dist/cjs/cryptography/signature-scheme.js.map +1 -1
- package/dist/cjs/cryptography/signature.js +14 -18
- package/dist/cjs/cryptography/signature.js.map +1 -1
- package/dist/cjs/experimental/cache.js +1 -5
- package/dist/cjs/experimental/cache.js.map +1 -1
- package/dist/cjs/experimental/client.js +3 -7
- package/dist/cjs/experimental/client.js.map +1 -1
- package/dist/cjs/experimental/core.js +11 -15
- package/dist/cjs/experimental/core.js.map +1 -1
- package/dist/cjs/experimental/errors.js +2 -7
- package/dist/cjs/experimental/errors.js.map +1 -1
- package/dist/cjs/experimental/index.js +5 -12
- package/dist/cjs/experimental/index.js.map +1 -1
- package/dist/cjs/experimental/persistent-storage.js +30 -36
- package/dist/cjs/experimental/persistent-storage.js.map +1 -1
- package/dist/cjs/experimental/persistent-storage.test.js +18 -20
- package/dist/cjs/experimental/persistent-storage.test.js.map +1 -1
- package/dist/cjs/experimental/transports/utils.js +6 -10
- package/dist/cjs/experimental/transports/utils.js.map +1 -1
- package/dist/cjs/experimental/types.js +1 -2
- package/dist/cjs/experimental/types.js.map +1 -1
- package/dist/cjs/faucet/faucet.js +6 -15
- package/dist/cjs/faucet/faucet.js.map +1 -1
- package/dist/cjs/faucet/index.js +1 -10
- package/dist/cjs/faucet/index.js.map +1 -1
- package/dist/cjs/grpc/client.js +20 -24
- package/dist/cjs/grpc/client.js.map +1 -1
- package/dist/cjs/grpc/core.js +65 -70
- package/dist/cjs/grpc/core.js.map +1 -1
- package/dist/cjs/grpc/index.js +2 -7
- package/dist/cjs/grpc/index.js.map +1 -1
- package/dist/cjs/grpc/proto/google/protobuf/any.js +10 -13
- package/dist/cjs/grpc/proto/google/protobuf/any.js.map +1 -1
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +8 -11
- package/dist/cjs/grpc/proto/google/protobuf/duration.js.map +1 -1
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +3 -6
- package/dist/cjs/grpc/proto/google/protobuf/empty.js.map +1 -1
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +7 -10
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js.map +1 -1
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +25 -28
- package/dist/cjs/grpc/proto/google/protobuf/struct.js.map +1 -1
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +11 -14
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +36 -39
- package/dist/cjs/grpc/proto/google/rpc/error_details.js.map +1 -1
- package/dist/cjs/grpc/proto/google/rpc/status.js +5 -8
- package/dist/cjs/grpc/proto/google/rpc/status.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +5 -8
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +3 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +3 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +13 -16
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +10 -13
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +20 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +29 -32
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +12 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +2 -5
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +11 -14
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +17 -20
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +45 -48
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +3 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +7 -10
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +5 -8
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +13 -17
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +73 -76
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +48 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +10 -14
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +36 -39
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +8 -12
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +21 -24
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +15 -18
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +3 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +5 -8
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +3 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +67 -70
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +2 -5
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +7 -11
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +15 -18
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +11 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +67 -70
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +7 -11
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +13 -16
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +38 -41
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +124 -127
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +8 -12
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +41 -44
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -1
- package/dist/cjs/index.js +22 -87
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jsonRpc/client.js +29 -34
- package/dist/cjs/jsonRpc/client.js.map +1 -1
- package/dist/cjs/jsonRpc/core.js +29 -33
- package/dist/cjs/jsonRpc/core.js.map +1 -1
- package/dist/cjs/jsonRpc/errors.js +3 -9
- package/dist/cjs/jsonRpc/errors.js.map +1 -1
- package/dist/cjs/jsonRpc/http-transport.js +9 -13
- package/dist/cjs/jsonRpc/http-transport.js.map +1 -1
- package/dist/cjs/jsonRpc/index.js +3 -12
- package/dist/cjs/jsonRpc/index.js.map +1 -1
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +19 -22
- package/dist/cjs/jsonRpc/json-rpc-resolver.js.map +1 -1
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +5 -9
- package/dist/cjs/jsonRpc/rpc-websocket-client.js.map +1 -1
- package/dist/cjs/jsonRpc/types/chain.js +1 -2
- package/dist/cjs/jsonRpc/types/chain.js.map +1 -1
- package/dist/cjs/jsonRpc/types/changes.js +1 -2
- package/dist/cjs/jsonRpc/types/changes.js.map +1 -1
- package/dist/cjs/jsonRpc/types/coins.js +1 -2
- package/dist/cjs/jsonRpc/types/coins.js.map +1 -1
- package/dist/cjs/jsonRpc/types/common.js +1 -2
- package/dist/cjs/jsonRpc/types/common.js.map +1 -1
- package/dist/cjs/jsonRpc/types/generated.js +1 -2
- package/dist/cjs/jsonRpc/types/generated.js.map +1 -1
- package/dist/cjs/jsonRpc/types/index.js +1 -2
- package/dist/cjs/jsonRpc/types/index.js.map +1 -1
- package/dist/cjs/jsonRpc/types/params.js +1 -2
- package/dist/cjs/jsonRpc/types/params.js.map +1 -1
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +7 -11
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +1 -1
- package/dist/cjs/keypairs/ed25519/index.js +2 -8
- package/dist/cjs/keypairs/ed25519/index.js.map +1 -1
- package/dist/cjs/keypairs/ed25519/keypair.js +26 -30
- package/dist/cjs/keypairs/ed25519/keypair.js.map +1 -1
- package/dist/cjs/keypairs/ed25519/publickey.js +10 -14
- package/dist/cjs/keypairs/ed25519/publickey.js.map +1 -1
- package/dist/cjs/keypairs/index.js +4 -20
- package/dist/cjs/keypairs/index.js.map +1 -1
- package/dist/cjs/keypairs/passkey/index.js +2 -9
- package/dist/cjs/keypairs/passkey/index.js.map +1 -1
- package/dist/cjs/keypairs/passkey/keypair.js +29 -35
- package/dist/cjs/keypairs/passkey/keypair.js.map +1 -1
- package/dist/cjs/keypairs/passkey/publickey.js +35 -41
- package/dist/cjs/keypairs/passkey/publickey.js.map +1 -1
- package/dist/cjs/keypairs/passkey/types.js +1 -2
- package/dist/cjs/keypairs/passkey/types.js.map +1 -1
- package/dist/cjs/keypairs/secp256k1/index.js +2 -8
- package/dist/cjs/keypairs/secp256k1/index.js.map +1 -1
- package/dist/cjs/keypairs/secp256k1/keypair.js +25 -29
- package/dist/cjs/keypairs/secp256k1/keypair.js.map +1 -1
- package/dist/cjs/keypairs/secp256k1/publickey.js +11 -15
- package/dist/cjs/keypairs/secp256k1/publickey.js.map +1 -1
- package/dist/cjs/keypairs/secp256r1/index.js +2 -8
- package/dist/cjs/keypairs/secp256r1/index.js.map +1 -1
- package/dist/cjs/keypairs/secp256r1/keypair.js +25 -29
- package/dist/cjs/keypairs/secp256r1/keypair.js.map +1 -1
- package/dist/cjs/keypairs/secp256r1/publickey.js +12 -16
- package/dist/cjs/keypairs/secp256r1/publickey.js.map +1 -1
- package/dist/cjs/multisig/index.js +2 -8
- package/dist/cjs/multisig/index.js.map +1 -1
- package/dist/cjs/multisig/publickey.js +40 -45
- package/dist/cjs/multisig/publickey.js.map +1 -1
- package/dist/cjs/multisig/signer.js +5 -9
- package/dist/cjs/multisig/signer.js.map +1 -1
- package/dist/cjs/transactions/Arguments.js +5 -8
- package/dist/cjs/transactions/Arguments.js.map +1 -1
- package/dist/cjs/transactions/Commands.js +21 -24
- package/dist/cjs/transactions/Commands.js.map +1 -1
- package/dist/cjs/transactions/Inputs.js +7 -10
- package/dist/cjs/transactions/Inputs.js.map +1 -1
- package/dist/cjs/transactions/ObjectCache.js +7 -13
- package/dist/cjs/transactions/ObjectCache.js.map +1 -1
- package/dist/cjs/transactions/Transaction.js +54 -59
- package/dist/cjs/transactions/Transaction.js.map +1 -1
- package/dist/cjs/transactions/TransactionData.js +27 -31
- package/dist/cjs/transactions/TransactionData.js.map +1 -1
- package/dist/cjs/transactions/__tests__/Transaction.test.js +71 -73
- package/dist/cjs/transactions/__tests__/Transaction.test.js.map +1 -1
- package/dist/cjs/transactions/__tests__/bcs.test.js +26 -28
- package/dist/cjs/transactions/__tests__/bcs.test.js.map +1 -1
- package/dist/cjs/transactions/data/internal.js +122 -126
- package/dist/cjs/transactions/data/internal.js.map +1 -1
- package/dist/cjs/transactions/data/v1.js +114 -119
- package/dist/cjs/transactions/data/v1.js.map +1 -1
- package/dist/cjs/transactions/data/v2.js +63 -66
- package/dist/cjs/transactions/data/v2.js.map +1 -1
- package/dist/cjs/transactions/executor/caching.js +7 -11
- package/dist/cjs/transactions/executor/caching.js.map +1 -1
- package/dist/cjs/transactions/executor/parallel.js +20 -24
- package/dist/cjs/transactions/executor/parallel.js.map +1 -1
- package/dist/cjs/transactions/executor/queue.js +2 -7
- package/dist/cjs/transactions/executor/queue.js.map +1 -1
- package/dist/cjs/transactions/executor/serial.js +11 -16
- package/dist/cjs/transactions/executor/serial.js.map +1 -1
- package/dist/cjs/transactions/hash.js +3 -6
- package/dist/cjs/transactions/hash.js.map +1 -1
- package/dist/cjs/transactions/index.js +12 -31
- package/dist/cjs/transactions/index.js.map +1 -1
- package/dist/cjs/transactions/intents/CoinWithBalance.js +21 -25
- package/dist/cjs/transactions/intents/CoinWithBalance.js.map +1 -1
- package/dist/cjs/transactions/object.js +4 -7
- package/dist/cjs/transactions/object.js.map +1 -1
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +2 -7
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js.map +1 -1
- package/dist/cjs/transactions/pure.js +19 -22
- package/dist/cjs/transactions/pure.js.map +1 -1
- package/dist/cjs/transactions/resolve.js +10 -15
- package/dist/cjs/transactions/resolve.js.map +1 -1
- package/dist/cjs/transactions/serializer.js +34 -40
- package/dist/cjs/transactions/serializer.js.map +1 -1
- package/dist/cjs/transactions/utils.js +15 -23
- package/dist/cjs/transactions/utils.js.map +1 -1
- package/dist/cjs/utils/constants.js +18 -21
- package/dist/cjs/utils/constants.js.map +1 -1
- package/dist/cjs/utils/derived-objects.js +5 -8
- package/dist/cjs/utils/derived-objects.js.map +1 -1
- package/dist/cjs/utils/dynamic-fields.js +9 -12
- package/dist/cjs/utils/dynamic-fields.js.map +1 -1
- package/dist/cjs/utils/format.js +2 -6
- package/dist/cjs/utils/format.js.map +1 -1
- package/dist/cjs/utils/index.js +10 -46
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/move-registry.js +5 -10
- package/dist/cjs/utils/move-registry.js.map +1 -1
- package/dist/cjs/utils/sui-types.js +15 -25
- package/dist/cjs/utils/sui-types.js.map +1 -1
- package/dist/cjs/utils/suins.js +2 -6
- package/dist/cjs/utils/suins.js.map +1 -1
- package/dist/cjs/verify/index.js +1 -9
- package/dist/cjs/verify/index.js.map +1 -1
- package/dist/cjs/verify/verify.js +21 -28
- package/dist/cjs/verify/verify.js.map +1 -1
- package/dist/cjs/version.js +2 -5
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/w/call/allocation.js +88 -99
- package/dist/cjs/w/call/allocation.js.map +1 -1
- package/dist/cjs/w/call/arb.js +49 -58
- package/dist/cjs/w/call/arb.js.map +1 -1
- package/dist/cjs/w/call/arbitration.js +380 -406
- package/dist/cjs/w/call/arbitration.js.map +1 -1
- package/dist/cjs/w/call/base.js +63 -73
- package/dist/cjs/w/call/base.js.map +1 -1
- package/dist/cjs/w/call/contact.js +111 -123
- package/dist/cjs/w/call/contact.js.map +1 -1
- package/dist/cjs/w/call/demand.js +221 -238
- package/dist/cjs/w/call/demand.js.map +1 -1
- package/dist/cjs/w/call/entity.js +58 -75
- package/dist/cjs/w/call/entity.js.map +1 -1
- package/dist/cjs/w/call/guard-ins.js +1191 -1196
- package/dist/cjs/w/call/guard-ins.js.map +1 -1
- package/dist/cjs/w/call/guard.js +265 -286
- package/dist/cjs/w/call/guard.js.map +1 -1
- package/dist/cjs/w/call/index.js +22 -66
- package/dist/cjs/w/call/index.js.map +1 -1
- package/dist/cjs/w/call/machine.js +351 -378
- package/dist/cjs/w/call/machine.js.map +1 -1
- package/dist/cjs/w/call/order.js +102 -113
- package/dist/cjs/w/call/order.js.map +1 -1
- package/dist/cjs/w/call/passport.js +53 -65
- package/dist/cjs/w/call/passport.js.map +1 -1
- package/dist/cjs/w/call/payment.js +41 -50
- package/dist/cjs/w/call/payment.js.map +1 -1
- package/dist/cjs/w/call/permission.js +233 -263
- package/dist/cjs/w/call/permission.js.map +1 -1
- package/dist/cjs/w/call/personal.js +38 -42
- package/dist/cjs/w/call/personal.js.map +1 -1
- package/dist/cjs/w/call/progress.js +222 -240
- package/dist/cjs/w/call/progress.js.map +1 -1
- package/dist/cjs/w/call/proof.js +23 -30
- package/dist/cjs/w/call/proof.js.map +1 -1
- package/dist/cjs/w/call/repository.js +283 -302
- package/dist/cjs/w/call/repository.js.map +1 -1
- package/dist/cjs/w/call/resource.js +27 -37
- package/dist/cjs/w/call/resource.js.map +1 -1
- package/dist/cjs/w/call/reward.js +227 -241
- package/dist/cjs/w/call/reward.js.map +1 -1
- package/dist/cjs/w/call/service.js +653 -694
- package/dist/cjs/w/call/service.js.map +1 -1
- package/dist/cjs/w/call/treasury.js +270 -289
- package/dist/cjs/w/call/treasury.js.map +1 -1
- package/dist/cjs/w/call/util.js +201 -208
- package/dist/cjs/w/call/util.js.map +1 -1
- package/dist/cjs/w/common.js +117 -168
- package/dist/cjs/w/common.js.map +1 -1
- package/dist/cjs/w/exception.js +18 -30
- package/dist/cjs/w/exception.js.map +1 -1
- package/dist/cjs/w/index.js +8 -24
- package/dist/cjs/w/index.js.map +1 -1
- package/dist/cjs/w/local/account.js +73 -77
- package/dist/cjs/w/local/account.js.map +1 -1
- package/dist/cjs/w/local/cache.js +5 -9
- package/dist/cjs/w/local/cache.js.map +1 -1
- package/dist/cjs/w/local/config.js +10 -14
- package/dist/cjs/w/local/config.js.map +1 -1
- package/dist/cjs/w/local/index.js +65 -98
- package/dist/cjs/w/local/index.js.map +1 -1
- package/dist/cjs/w/local/local.js +59 -65
- package/dist/cjs/w/local/local.js.map +1 -1
- package/dist/cjs/w/local/storage.js +13 -56
- package/dist/cjs/w/local/storage.js.map +1 -1
- package/dist/cjs/w/local/token.js +20 -24
- package/dist/cjs/w/local/token.js.map +1 -1
- package/dist/cjs/w/local/util.js +3 -39
- package/dist/cjs/w/local/util.js.map +1 -1
- package/dist/cjs/w/local/wip.js +22 -70
- package/dist/cjs/w/local/wip.js.map +1 -1
- package/dist/cjs/w/messenger/crypto.js +34 -57
- package/dist/cjs/w/messenger/crypto.js.map +1 -1
- package/dist/cjs/w/messenger/index.js +4 -31
- package/dist/cjs/w/messenger/index.js.map +1 -1
- package/dist/cjs/w/messenger/messenger-api.d.ts +1 -3
- package/dist/cjs/w/messenger/messenger-api.js +128 -178
- package/dist/cjs/w/messenger/messenger-api.js.map +1 -1
- package/dist/cjs/w/messenger/messenger-manager.d.ts +3 -5
- package/dist/cjs/w/messenger/messenger-manager.js +65 -69
- package/dist/cjs/w/messenger/messenger-manager.js.map +1 -1
- package/dist/cjs/w/messenger/messenger.js +100 -137
- package/dist/cjs/w/messenger/messenger.js.map +1 -1
- package/dist/cjs/w/messenger/server.js +40 -44
- package/dist/cjs/w/messenger/server.js.map +1 -1
- package/dist/cjs/w/messenger/session.js +52 -56
- package/dist/cjs/w/messenger/session.js.map +1 -1
- package/dist/cjs/w/messenger/storage.js +13 -57
- package/dist/cjs/w/messenger/storage.js.map +1 -1
- package/dist/cjs/w/messenger/types.d.ts +3 -1
- package/dist/cjs/w/messenger/types.js +23 -27
- package/dist/cjs/w/messenger/types.js.map +1 -1
- package/dist/cjs/w/messenger/utils.js +1 -4
- package/dist/cjs/w/messenger/utils.js.map +1 -1
- package/dist/cjs/w/query/bult-in.js +22 -27
- package/dist/cjs/w/query/bult-in.js.map +1 -1
- package/dist/cjs/w/query/event.js +13 -18
- package/dist/cjs/w/query/event.js.map +1 -1
- package/dist/cjs/w/query/index.js +5 -21
- package/dist/cjs/w/query/index.js.map +1 -1
- package/dist/cjs/w/query/object.js +229 -266
- package/dist/cjs/w/query/object.js.map +1 -1
- package/dist/cjs/w/query/received.js +17 -21
- package/dist/cjs/w/query/received.js.map +1 -1
- package/dist/cjs/w/query/util.js +13 -17
- package/dist/cjs/w/query/util.js.map +1 -1
- package/dist/cjs/w/util.js +211 -225
- package/dist/cjs/w/util.js.map +1 -1
- package/dist/esm/experimental/persistent-storage.test.js +1 -1
- package/dist/esm/experimental/persistent-storage.test.js.map +1 -1
- package/dist/esm/w/messenger/messenger-api.d.ts +1 -3
- package/dist/esm/w/messenger/messenger-api.js +7 -8
- package/dist/esm/w/messenger/messenger-api.js.map +1 -1
- package/dist/esm/w/messenger/messenger-manager.d.ts +3 -5
- package/dist/esm/w/messenger/messenger-manager.js +16 -16
- package/dist/esm/w/messenger/messenger-manager.js.map +1 -1
- package/dist/esm/w/messenger/types.d.ts +3 -1
- package/dist/esm/w/messenger/types.js.map +1 -1
- package/package.json +7 -4
- package/scripts/download-prebuilds.js +213 -195
- package/scripts/install-better-sqlite3.js +8 -8
|
@@ -1,43 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright (c) Wowok.
|
|
3
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.node_exchange_name = node_exchange_name;
|
|
18
|
-
exports.node_clear = node_clear;
|
|
19
|
-
exports.publish = publish;
|
|
20
|
-
exports.pause = pause;
|
|
21
|
-
exports.consensus_repositories_add = consensus_repositories_add;
|
|
22
|
-
exports.consensus_repositories_remove = consensus_repositories_remove;
|
|
23
|
-
exports.consensus_repositories_clear = consensus_repositories_clear;
|
|
24
|
-
exports.forwards_add = forwards_add;
|
|
25
|
-
exports.forwards_remove = forwards_remove;
|
|
26
|
-
exports.prev_nodes_remove = prev_nodes_remove;
|
|
27
|
-
exports.prev_nodes_remove_with_passport = prev_nodes_remove_with_passport;
|
|
28
|
-
const common_js_1 = require("../common.js");
|
|
29
|
-
const exception_js_1 = require("../exception.js");
|
|
30
|
-
const object_js_1 = require("../query/object.js");
|
|
31
|
-
const fs_1 = require("fs");
|
|
32
|
-
const base_js_1 = require("./base.js");
|
|
33
|
-
const permission_js_1 = require("./permission.js");
|
|
34
|
-
const permission_js_2 = require("./permission.js");
|
|
35
|
-
const util_js_1 = require("../util.js");
|
|
36
|
-
const local_js_1 = require("../local/local.js");
|
|
37
|
-
const index_js_1 = require("../local/index.js");
|
|
38
|
-
const progress_js_1 = require("./progress.js");
|
|
39
|
-
const received_js_1 = require("../query/received.js");
|
|
40
|
-
class CallMachine extends base_js_1.CallBase {
|
|
3
|
+
import { toTxObject, toTxString, isValidName, isValidDescription, PackageAddress, MAX_NAME_LENGTH, isValidU16, isValidArray, isValidU8, isValidU32, GetObjectExisted, GetObject, GetObjectDescription, machineFn, } from "../common.js";
|
|
4
|
+
import { W_ERROR, WErrors } from "../exception.js";
|
|
5
|
+
import { ObjectType, query_table, query_objects } from "../query/object.js";
|
|
6
|
+
import { writeFileSync } from "fs";
|
|
7
|
+
import { CallBase } from "./base.js";
|
|
8
|
+
import { BuiltinPermissionIndex, newPermission } from "./permission.js";
|
|
9
|
+
import { create as permission_create } from "./permission.js";
|
|
10
|
+
import { owner_receive, validObjects } from "../util.js";
|
|
11
|
+
import { LocalMark } from "../local/local.js";
|
|
12
|
+
import { GetManyAccountOrMark_Address } from "../local/index.js";
|
|
13
|
+
import { context_repository_add, context_repository_clear, context_repository_remove, MAX_CONTEXT_REPOSITORY_COUNT, namedOperator_add, namedOperator_remove, namedOperator_set, newProgress, create as createProgress, } from "./progress.js";
|
|
14
|
+
import { query_received } from "../query/received.js";
|
|
15
|
+
export class CallMachine extends CallBase {
|
|
41
16
|
data;
|
|
42
17
|
object_address = undefined;
|
|
43
18
|
permission_address = undefined;
|
|
@@ -49,21 +24,21 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
49
24
|
async prepare(env) {
|
|
50
25
|
await super.prepare(env);
|
|
51
26
|
if (!this.object_address) {
|
|
52
|
-
this.object_address = await
|
|
27
|
+
this.object_address = await GetObjectExisted(this.data?.object);
|
|
53
28
|
}
|
|
54
29
|
if (this.object_address) {
|
|
55
|
-
await this.update_content(env,
|
|
30
|
+
await this.update_content(env, ObjectType.Machine, this.object_address);
|
|
56
31
|
if (!this.content)
|
|
57
|
-
|
|
32
|
+
W_ERROR(WErrors.InvalidParam, "CallMachine_Data.data.object:" + this.object_address);
|
|
58
33
|
this.permission_address = this.content.permission;
|
|
59
34
|
if (!this.permission_address) {
|
|
60
|
-
|
|
35
|
+
W_ERROR(WErrors.InvalidParam, "CallMachine_Data.data.object.permission is empty");
|
|
61
36
|
}
|
|
62
37
|
}
|
|
63
38
|
else {
|
|
64
|
-
const n =
|
|
65
|
-
this.permission_address = await
|
|
66
|
-
this.new_permission_description =
|
|
39
|
+
const n = GetObject(this.data.object);
|
|
40
|
+
this.permission_address = await GetObjectExisted(n?.permission);
|
|
41
|
+
this.new_permission_description = GetObjectDescription(n?.permission);
|
|
67
42
|
}
|
|
68
43
|
}
|
|
69
44
|
async call(env) {
|
|
@@ -77,42 +52,42 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
77
52
|
};
|
|
78
53
|
const content = this.content;
|
|
79
54
|
if (this.permission_address && !this.object_address) {
|
|
80
|
-
add_perm(
|
|
55
|
+
add_perm(BuiltinPermissionIndex.MACHINE_NEW);
|
|
81
56
|
}
|
|
82
57
|
if (this.data?.progress_new != null) {
|
|
83
58
|
if (!content) {
|
|
84
|
-
|
|
59
|
+
W_ERROR(WErrors.InvalidParam, `CallMachine_Data.data.progress_new fail because the Machine ${JSON.stringify(this.data.object)} content not ready`);
|
|
85
60
|
}
|
|
86
|
-
add_perm(
|
|
61
|
+
add_perm(BuiltinPermissionIndex.PROGRESS_NEW);
|
|
87
62
|
if (this.data.progress_new.repository != null) {
|
|
88
|
-
add_perm(
|
|
63
|
+
add_perm(BuiltinPermissionIndex.PROGRESS_CONTEXT_REPOSITORY);
|
|
89
64
|
}
|
|
90
65
|
if (this.data.progress_new.progress_namedOperator != null) {
|
|
91
|
-
add_perm(
|
|
66
|
+
add_perm(BuiltinPermissionIndex.PROGRESS_NAMED_OPERATOR);
|
|
92
67
|
}
|
|
93
68
|
}
|
|
94
69
|
if (this.permission_address &&
|
|
95
70
|
this.data?.description != null &&
|
|
96
71
|
this.object_address) {
|
|
97
|
-
add_perm(
|
|
72
|
+
add_perm(BuiltinPermissionIndex.MACHINE_DESCRIPTION);
|
|
98
73
|
}
|
|
99
74
|
if (this.permission_address && this.data.repository) {
|
|
100
|
-
add_perm(
|
|
75
|
+
add_perm(BuiltinPermissionIndex.MACHINE_CONSENSUS_REPOSITORIES);
|
|
101
76
|
}
|
|
102
77
|
if (this.permission_address && this.data.node) {
|
|
103
|
-
add_perm(
|
|
78
|
+
add_perm(BuiltinPermissionIndex.MACHINE_NODE);
|
|
104
79
|
}
|
|
105
80
|
if (this.permission_address && this.data?.pause !== undefined) {
|
|
106
|
-
add_perm(
|
|
81
|
+
add_perm(BuiltinPermissionIndex.MACHINE_PAUSE);
|
|
107
82
|
}
|
|
108
83
|
if (this.permission_address && this.data?.publish !== undefined) {
|
|
109
|
-
add_perm(
|
|
84
|
+
add_perm(BuiltinPermissionIndex.MACHINE_PUBLISH);
|
|
110
85
|
}
|
|
111
86
|
if (this.permission_address && this.data?.owner_receive) {
|
|
112
|
-
add_perm(
|
|
87
|
+
add_perm(BuiltinPermissionIndex.MACHINE_OWNER_RECEIVE);
|
|
113
88
|
}
|
|
114
89
|
if (this.permission_address && this.data.um !== undefined) {
|
|
115
|
-
add_perm(
|
|
90
|
+
add_perm(BuiltinPermissionIndex.MACHINE_UM);
|
|
116
91
|
}
|
|
117
92
|
if (this.permission_address || guards.length > 0) {
|
|
118
93
|
return await this.check_permission_and_call(env, this.permission_address, perms, guards);
|
|
@@ -125,83 +100,83 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
125
100
|
const content = this.content;
|
|
126
101
|
if (!this.object_address) {
|
|
127
102
|
if (!permission) {
|
|
128
|
-
permission =
|
|
103
|
+
permission = newPermission(tx, this.new_permission_description ?? "");
|
|
129
104
|
}
|
|
130
105
|
if (permission) {
|
|
131
|
-
object = newMachine(tx,
|
|
106
|
+
object = newMachine(tx, toTxObject(tx, permission), this.data?.description ?? "", passport);
|
|
132
107
|
}
|
|
133
108
|
}
|
|
134
109
|
if (!object || !permission) {
|
|
135
|
-
|
|
110
|
+
W_ERROR(WErrors.InvalidParam, "CallMachine_Data.data.object:" + this.object_address);
|
|
136
111
|
}
|
|
137
112
|
if (this.data.progress_new != null) {
|
|
138
113
|
if (!content) {
|
|
139
|
-
|
|
114
|
+
W_ERROR(WErrors.InvalidParam, `CallMachine_Data.data.progress_new fail because the Machine ${JSON.stringify(this.data.object)} content not ready`);
|
|
140
115
|
}
|
|
141
116
|
if (this.data.progress_new.task != null) {
|
|
142
|
-
const t = await
|
|
117
|
+
const t = await GetObjectExisted(this.data.progress_new.task);
|
|
143
118
|
if (t) {
|
|
144
119
|
this.data.progress_new.task = t;
|
|
145
120
|
}
|
|
146
121
|
else {
|
|
147
|
-
|
|
122
|
+
W_ERROR(WErrors.InvalidParam, `CallMachine_Data.data.progress_new.task: ${this.data.progress_new.task} not found`);
|
|
148
123
|
}
|
|
149
124
|
}
|
|
150
|
-
const progress =
|
|
125
|
+
const progress = newProgress(tx, object, permission, this.data.progress_new.task ?? null, passport);
|
|
151
126
|
if (this.data.progress_new.repository != null) {
|
|
152
127
|
switch (this.data.progress_new.repository.op) {
|
|
153
128
|
case "add":
|
|
154
129
|
case "set": {
|
|
155
130
|
if (this.data.progress_new.repository.objects.length >
|
|
156
|
-
|
|
157
|
-
|
|
131
|
+
MAX_CONTEXT_REPOSITORY_COUNT) {
|
|
132
|
+
W_ERROR(WErrors.InvalidParam, `CallProgress_Data.data.progress_new.repository.objects exceeds max count:${this.data.progress_new.repository.objects}`);
|
|
158
133
|
}
|
|
159
134
|
if (this.data.progress_new.repository.op === "set") {
|
|
160
|
-
|
|
135
|
+
context_repository_clear(tx, progress, object, permission);
|
|
161
136
|
}
|
|
162
|
-
const r = await
|
|
137
|
+
const r = await LocalMark.Instance().get_many_address_availables(this.data.progress_new.repository.objects);
|
|
163
138
|
r.forEach((repo) => {
|
|
164
|
-
|
|
139
|
+
context_repository_add(tx, progress, object, permission, repo, passport);
|
|
165
140
|
});
|
|
166
141
|
break;
|
|
167
142
|
}
|
|
168
143
|
case "remove": {
|
|
169
144
|
if (this.data.progress_new.repository.objects.length >
|
|
170
|
-
|
|
171
|
-
|
|
145
|
+
MAX_CONTEXT_REPOSITORY_COUNT) {
|
|
146
|
+
W_ERROR(WErrors.InvalidParam, `CallProgress_Data.data.progress_new.repository.objects exceeds max count:${this.data.progress_new.repository.objects}`);
|
|
172
147
|
}
|
|
173
|
-
const addrs = await
|
|
174
|
-
|
|
148
|
+
const addrs = await LocalMark.Instance().get_many_address_availables(this.data.progress_new.repository.objects);
|
|
149
|
+
context_repository_remove(tx, progress, object, permission, addrs, passport);
|
|
175
150
|
break;
|
|
176
151
|
}
|
|
177
152
|
case "clear":
|
|
178
|
-
|
|
153
|
+
context_repository_clear(tx, progress, object, permission, passport);
|
|
179
154
|
break;
|
|
180
155
|
}
|
|
181
156
|
}
|
|
182
157
|
if (this.data.progress_new.progress_namedOperator != null) {
|
|
183
158
|
switch (this.data.progress_new.progress_namedOperator.op) {
|
|
184
159
|
case "add": {
|
|
185
|
-
const r = await
|
|
160
|
+
const r = await GetManyAccountOrMark_Address(this.data.progress_new.progress_namedOperator
|
|
186
161
|
.operators);
|
|
187
|
-
|
|
162
|
+
namedOperator_add(tx, progress, object, permission, this.data.progress_new.progress_namedOperator.name, r, passport);
|
|
188
163
|
break;
|
|
189
164
|
}
|
|
190
165
|
case "set": {
|
|
191
|
-
const r = await
|
|
166
|
+
const r = await GetManyAccountOrMark_Address(this.data.progress_new.progress_namedOperator
|
|
192
167
|
.operators);
|
|
193
|
-
|
|
168
|
+
namedOperator_set(tx, progress, object, permission, this.data.progress_new.progress_namedOperator.name, r, passport);
|
|
194
169
|
break;
|
|
195
170
|
}
|
|
196
171
|
case "remove": {
|
|
197
|
-
const r = await
|
|
172
|
+
const r = await GetManyAccountOrMark_Address(this.data.progress_new.progress_namedOperator
|
|
198
173
|
.operators);
|
|
199
|
-
|
|
174
|
+
namedOperator_remove(tx, progress, object, permission, this.data.progress_new.progress_namedOperator.name, r, passport);
|
|
200
175
|
break;
|
|
201
176
|
}
|
|
202
177
|
}
|
|
203
178
|
}
|
|
204
|
-
await this.new_with_mark(env, tx,
|
|
179
|
+
await this.new_with_mark(env, tx, ObjectType.Progress, createProgress(tx, progress), GetObject(this.data.progress_new.namedNew));
|
|
205
180
|
}
|
|
206
181
|
if (this.data?.description != null && this.object_address) {
|
|
207
182
|
description_set(tx, object, permission, this.data.description, passport);
|
|
@@ -211,14 +186,14 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
211
186
|
case "add":
|
|
212
187
|
case "set": {
|
|
213
188
|
if (this.data.repository.objects.length >
|
|
214
|
-
|
|
189
|
+
MAX_CONSENSUS_REPOSITORIES_COUNT -
|
|
215
190
|
(content?.consensus_repositories?.length ?? 0)) {
|
|
216
|
-
|
|
191
|
+
W_ERROR(WErrors.InvalidParam, `CallService_Data.data.repository.objects exceeds max count:${this.data.repository.objects}`);
|
|
217
192
|
}
|
|
218
193
|
if (this.data.repository.op === "set") {
|
|
219
194
|
consensus_repositories_clear(tx, object, permission, passport);
|
|
220
195
|
}
|
|
221
|
-
const r = await
|
|
196
|
+
const r = await LocalMark.Instance().get_many_address_availables(this.data.repository.objects);
|
|
222
197
|
r.forEach((repo) => {
|
|
223
198
|
consensus_repositories_add(tx, object, permission, repo, passport);
|
|
224
199
|
});
|
|
@@ -227,9 +202,9 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
227
202
|
case "remove": {
|
|
228
203
|
if (this.data.repository.objects.length >
|
|
229
204
|
(content?.consensus_repositories?.length ?? 0)) {
|
|
230
|
-
|
|
205
|
+
W_ERROR(WErrors.InvalidParam, `CallService_Data.data.repository.objects exceeds max count:${this.data.repository.objects}`);
|
|
231
206
|
}
|
|
232
|
-
const addrs = await
|
|
207
|
+
const addrs = await LocalMark.Instance().get_many_address_availables(this.data.repository.objects);
|
|
233
208
|
consensus_repositories_remove(tx, object, permission, addrs, passport);
|
|
234
209
|
break;
|
|
235
210
|
}
|
|
@@ -242,8 +217,8 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
242
217
|
switch (this.data.node.op) {
|
|
243
218
|
case "add":
|
|
244
219
|
case "set": {
|
|
245
|
-
if (this.data.node.nodes.length >
|
|
246
|
-
|
|
220
|
+
if (this.data.node.nodes.length > MAX_NODE_COUNT) {
|
|
221
|
+
W_ERROR(WErrors.InvalidParam, `CallMachine_Data.data.node.nodes exceeds max count:${this.data.node.nodes}`);
|
|
247
222
|
}
|
|
248
223
|
if (this.data.node.op === "set") {
|
|
249
224
|
node_clear(tx, object, permission, passport);
|
|
@@ -254,7 +229,7 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
254
229
|
}
|
|
255
230
|
case "remove": {
|
|
256
231
|
if (this.data.node.nodes.length > (content?.node_count ?? 0)) {
|
|
257
|
-
|
|
232
|
+
W_ERROR(WErrors.InvalidParam, `CallMachine_Data.data.node.nodes exceeds max count:${this.data.node.nodes}`);
|
|
258
233
|
}
|
|
259
234
|
node_remove(tx, object, permission, this.data.node.nodes, passport);
|
|
260
235
|
break;
|
|
@@ -298,96 +273,95 @@ class CallMachine extends base_js_1.CallBase {
|
|
|
298
273
|
if (this.data.owner_receive != null && this.object_address) {
|
|
299
274
|
// owner_receive 中完成地址查询
|
|
300
275
|
if (this.data.owner_receive === "recently") {
|
|
301
|
-
this.data.owner_receive = await
|
|
276
|
+
this.data.owner_receive = await query_received({
|
|
302
277
|
object: this.object_address,
|
|
303
278
|
all_type: true,
|
|
304
279
|
no_cache: env.no_cache,
|
|
305
280
|
network: env.network,
|
|
306
281
|
});
|
|
307
282
|
}
|
|
308
|
-
await
|
|
283
|
+
await owner_receive(tx, object, permission, this.data.owner_receive, undefined, (name) => `${PackageAddress}::machine::${name}`, passport);
|
|
309
284
|
}
|
|
310
285
|
// 处理 um
|
|
311
286
|
if (this.data.um !== undefined) {
|
|
312
287
|
let um_address = null;
|
|
313
288
|
if (this.data.um) {
|
|
314
289
|
um_address =
|
|
315
|
-
(await
|
|
290
|
+
(await LocalMark.Instance().get_address(this.data.um)) ||
|
|
316
291
|
null;
|
|
317
292
|
if (!um_address) {
|
|
318
|
-
|
|
293
|
+
W_ERROR(WErrors.InvalidParam, "CallMachine_Data.data.um:" + this.data.um);
|
|
319
294
|
}
|
|
320
295
|
}
|
|
321
296
|
um_set(tx, object, permission, um_address, passport);
|
|
322
297
|
}
|
|
323
298
|
if (!this.permission_address) {
|
|
324
|
-
const p =
|
|
325
|
-
await this.new_with_mark(env, tx,
|
|
299
|
+
const p = GetObject(this.data?.object);
|
|
300
|
+
await this.new_with_mark(env, tx, ObjectType.Permission, permission_create(tx, permission), GetObject(p.permission));
|
|
326
301
|
}
|
|
327
302
|
if (!this.object_address) {
|
|
328
|
-
await this.new_with_mark(env, tx,
|
|
303
|
+
await this.new_with_mark(env, tx, ObjectType.Machine, create(tx, object), GetObject(this.data?.object));
|
|
329
304
|
}
|
|
330
305
|
}
|
|
331
306
|
}
|
|
332
|
-
exports.CallMachine = CallMachine;
|
|
333
307
|
// ================================================
|
|
334
308
|
// 常量定义
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
function init_node_name() {
|
|
309
|
+
export const MAX_CONSENSUS_REPOSITORIES_COUNT = 200;
|
|
310
|
+
export const MAX_FORWARD_ORDER_COUNT = 20;
|
|
311
|
+
export const MAX_NODE_PAIR_COUNT = 40;
|
|
312
|
+
export const MAX_NODE_COUNT = 200;
|
|
313
|
+
export const THRESHOLD_DEFAULT = 0;
|
|
314
|
+
export function init_node_name() {
|
|
341
315
|
return "";
|
|
342
316
|
}
|
|
343
|
-
async function forward(tx, param) {
|
|
344
|
-
if (typeof param.name === "string" && !
|
|
345
|
-
|
|
317
|
+
export async function forward(tx, param) {
|
|
318
|
+
if (typeof param.name === "string" && !isValidName(param.name)) {
|
|
319
|
+
W_ERROR(WErrors.IsValidName, `Forward name ${param.name} exceeds maximum length ${MAX_NAME_LENGTH}`);
|
|
346
320
|
}
|
|
347
321
|
if (typeof param.namedOperator === "string" &&
|
|
348
|
-
!
|
|
349
|
-
|
|
322
|
+
!isValidName(param.namedOperator)) {
|
|
323
|
+
W_ERROR(WErrors.IsValidName, `Named operator ${param.namedOperator} exceeds maximum length ${MAX_NAME_LENGTH}`);
|
|
350
324
|
}
|
|
351
325
|
if (param.permissionIndex !== undefined &&
|
|
352
|
-
!
|
|
353
|
-
|
|
326
|
+
!isValidU16(param.permissionIndex)) {
|
|
327
|
+
W_ERROR(WErrors.IsValidArgType, `Permission index must be between 0 and 65535`);
|
|
354
328
|
}
|
|
355
|
-
if (!
|
|
356
|
-
|
|
329
|
+
if (!isValidU16(param.weight)) {
|
|
330
|
+
W_ERROR(WErrors.InvalidParam, `Weight ${param.weight} must be between 0 and 65535`);
|
|
357
331
|
}
|
|
358
332
|
if ((param.namedOperator === null || param.namedOperator === undefined) &&
|
|
359
333
|
(param.permissionIndex === null || param.permissionIndex === undefined)) {
|
|
360
|
-
|
|
334
|
+
W_ERROR(WErrors.InvalidParam, `One of the "namedOperator" or "permissionIndex" must be provided`);
|
|
361
335
|
}
|
|
362
336
|
if (param.guard && param.guard.guard != null) {
|
|
363
|
-
const guard = await
|
|
337
|
+
const guard = await LocalMark.Instance().get_address(param.guard.guard);
|
|
364
338
|
if (guard) {
|
|
365
339
|
param.guard.guard = guard;
|
|
366
340
|
}
|
|
367
341
|
else {
|
|
368
|
-
|
|
342
|
+
W_ERROR(WErrors.IsValidName, `Guard object ${param.guard.guard} is not a valid wow address`);
|
|
369
343
|
}
|
|
370
344
|
if (param.guard.retained_submission != null &&
|
|
371
|
-
!
|
|
372
|
-
|
|
345
|
+
!isValidArray(param.guard.retained_submission, isValidU8)) {
|
|
346
|
+
W_ERROR(WErrors.InvalidParam, `Retained submission ${param.guard.retained_submission} must be between 0 and 255`);
|
|
373
347
|
}
|
|
374
348
|
return tx.moveCall({
|
|
375
|
-
target:
|
|
349
|
+
target: machineFn("forward_with_guard"),
|
|
376
350
|
arguments: [
|
|
377
|
-
|
|
351
|
+
toTxString(tx, param.name),
|
|
378
352
|
tx.pure.option("string", param.namedOperator ?? null),
|
|
379
353
|
tx.pure.option("u16", param.permissionIndex ?? null),
|
|
380
354
|
tx.pure.u16(param.weight),
|
|
381
|
-
|
|
355
|
+
toTxObject(tx, param.guard.guard),
|
|
382
356
|
tx.pure.vector("u8", param.guard.retained_submission ?? []),
|
|
383
357
|
],
|
|
384
358
|
});
|
|
385
359
|
}
|
|
386
360
|
else {
|
|
387
361
|
return tx.moveCall({
|
|
388
|
-
target:
|
|
362
|
+
target: machineFn("forward"),
|
|
389
363
|
arguments: [
|
|
390
|
-
|
|
364
|
+
toTxString(tx, param.name),
|
|
391
365
|
tx.pure.option("string", param.namedOperator ?? null),
|
|
392
366
|
tx.pure.option("u16", param.permissionIndex ?? null),
|
|
393
367
|
tx.pure.u16(param.weight),
|
|
@@ -395,27 +369,27 @@ async function forward(tx, param) {
|
|
|
395
369
|
});
|
|
396
370
|
}
|
|
397
371
|
}
|
|
398
|
-
async function nodepair(tx, prev_node, param) {
|
|
372
|
+
export async function nodepair(tx, prev_node, param) {
|
|
399
373
|
if (typeof prev_node === "string" &&
|
|
400
374
|
prev_node.length > 0 &&
|
|
401
|
-
!
|
|
402
|
-
|
|
375
|
+
!isValidName(prev_node)) {
|
|
376
|
+
W_ERROR(WErrors.IsValidName, `Previous node name ${prev_node} exceeds maximum length ${MAX_NAME_LENGTH}`);
|
|
403
377
|
}
|
|
404
|
-
if (typeof param.threshold === "number" && !
|
|
405
|
-
|
|
378
|
+
if (typeof param.threshold === "number" && !isValidU32(param.threshold)) {
|
|
379
|
+
W_ERROR(WErrors.InvalidParam, `Threshold ${param.threshold} must be between 0 and 4294967295`);
|
|
406
380
|
}
|
|
407
|
-
if (param.forwards.length >
|
|
408
|
-
|
|
381
|
+
if (param.forwards.length > MAX_FORWARD_ORDER_COUNT) {
|
|
382
|
+
W_ERROR(WErrors.InvalidParam, `Forward order count ${param.forwards.length} exceeds maximum count ${MAX_FORWARD_ORDER_COUNT}`);
|
|
409
383
|
}
|
|
410
384
|
if (param.forwards.length > 1) {
|
|
411
385
|
const forwards = await Promise.all(param.forwards.map((f) => forward(tx, f)));
|
|
412
386
|
return tx.moveCall({
|
|
413
|
-
target:
|
|
387
|
+
target: machineFn("nodepair3"),
|
|
414
388
|
arguments: [
|
|
415
|
-
|
|
389
|
+
toTxString(tx, prev_node),
|
|
416
390
|
tx.pure.option("u32", param.threshold ?? null),
|
|
417
391
|
tx.makeMoveVec({
|
|
418
|
-
type: `${
|
|
392
|
+
type: `${PackageAddress}::machine::Forward`,
|
|
419
393
|
elements: forwards,
|
|
420
394
|
}),
|
|
421
395
|
],
|
|
@@ -423,9 +397,9 @@ async function nodepair(tx, prev_node, param) {
|
|
|
423
397
|
}
|
|
424
398
|
else if (param.forwards.length === 1) {
|
|
425
399
|
return tx.moveCall({
|
|
426
|
-
target:
|
|
400
|
+
target: machineFn("nodepair"),
|
|
427
401
|
arguments: [
|
|
428
|
-
|
|
402
|
+
toTxString(tx, prev_node),
|
|
429
403
|
tx.pure.option("u32", param.threshold ?? null),
|
|
430
404
|
await forward(tx, param.forwards[0]),
|
|
431
405
|
],
|
|
@@ -433,32 +407,32 @@ async function nodepair(tx, prev_node, param) {
|
|
|
433
407
|
}
|
|
434
408
|
else {
|
|
435
409
|
return tx.moveCall({
|
|
436
|
-
target:
|
|
410
|
+
target: machineFn("nodepair2"),
|
|
437
411
|
arguments: [
|
|
438
|
-
|
|
412
|
+
toTxString(tx, prev_node),
|
|
439
413
|
tx.pure.option("u32", param.threshold ?? null),
|
|
440
414
|
],
|
|
441
415
|
});
|
|
442
416
|
}
|
|
443
417
|
}
|
|
444
|
-
async function node(tx, param) {
|
|
445
|
-
if (typeof param.name === "string" && !
|
|
446
|
-
|
|
418
|
+
export async function node(tx, param) {
|
|
419
|
+
if (typeof param.name === "string" && !isValidName(param.name)) {
|
|
420
|
+
W_ERROR(WErrors.IsValidName, `Node name ${param.name} exceeds maximum length ${MAX_NAME_LENGTH}`);
|
|
447
421
|
}
|
|
448
422
|
if (param.name === init_node_name()) {
|
|
449
|
-
|
|
423
|
+
W_ERROR(WErrors.InvalidParam, `Node name ${param.name} is reserved`);
|
|
450
424
|
}
|
|
451
|
-
if (param.pairs.length >
|
|
452
|
-
|
|
425
|
+
if (param.pairs.length > MAX_NODE_PAIR_COUNT) {
|
|
426
|
+
W_ERROR(WErrors.InvalidParam, `Node pair count ${param.pairs.length} exceeds maximum count ${MAX_NODE_PAIR_COUNT}`);
|
|
453
427
|
}
|
|
454
428
|
if (param.pairs.length > 1) {
|
|
455
429
|
const pairs = await Promise.all(param.pairs.map((p) => nodepair(tx, p.prev_node, p)));
|
|
456
430
|
return tx.moveCall({
|
|
457
|
-
target:
|
|
431
|
+
target: machineFn("node3"),
|
|
458
432
|
arguments: [
|
|
459
|
-
|
|
433
|
+
toTxString(tx, param.name),
|
|
460
434
|
tx.makeMoveVec({
|
|
461
|
-
type: `${
|
|
435
|
+
type: `${PackageAddress}::machine::NodePair`,
|
|
462
436
|
elements: pairs,
|
|
463
437
|
}),
|
|
464
438
|
],
|
|
@@ -466,40 +440,40 @@ async function node(tx, param) {
|
|
|
466
440
|
}
|
|
467
441
|
else if (param.pairs.length === 1) {
|
|
468
442
|
return tx.moveCall({
|
|
469
|
-
target:
|
|
443
|
+
target: machineFn("node"),
|
|
470
444
|
arguments: [
|
|
471
|
-
|
|
445
|
+
toTxString(tx, param.name),
|
|
472
446
|
await nodepair(tx, param.pairs[0].prev_node, param.pairs[0]),
|
|
473
447
|
],
|
|
474
448
|
});
|
|
475
449
|
}
|
|
476
450
|
else {
|
|
477
451
|
return tx.moveCall({
|
|
478
|
-
target:
|
|
479
|
-
arguments: [
|
|
452
|
+
target: machineFn("node2"),
|
|
453
|
+
arguments: [toTxString(tx, param.name)],
|
|
480
454
|
});
|
|
481
455
|
}
|
|
482
456
|
}
|
|
483
|
-
function create(tx, machine) {
|
|
457
|
+
export function create(tx, machine) {
|
|
484
458
|
return tx.moveCall({
|
|
485
|
-
target:
|
|
486
|
-
arguments: [
|
|
459
|
+
target: machineFn("create"),
|
|
460
|
+
arguments: [toTxObject(tx, machine)],
|
|
487
461
|
});
|
|
488
462
|
}
|
|
489
463
|
// ================================================
|
|
490
464
|
// 构造函数和设置函数
|
|
491
|
-
function newMachine(tx, permission, description, passport) {
|
|
492
|
-
|
|
493
|
-
if (typeof description === "string" && !
|
|
494
|
-
|
|
465
|
+
export function newMachine(tx, permission, description, passport) {
|
|
466
|
+
validObjects([permission]);
|
|
467
|
+
if (typeof description === "string" && !isValidDescription(description)) {
|
|
468
|
+
W_ERROR(WErrors.IsValidDescription, `Description exceeds maximum length`);
|
|
495
469
|
}
|
|
496
470
|
if (passport) {
|
|
497
471
|
return tx.moveCall({
|
|
498
|
-
target:
|
|
472
|
+
target: machineFn("new_with_passport"),
|
|
499
473
|
arguments: [
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
474
|
+
toTxObject(tx, permission),
|
|
475
|
+
toTxObject(tx, passport),
|
|
476
|
+
toTxString(tx, description),
|
|
503
477
|
tx.object.mutRegistrar(),
|
|
504
478
|
tx.object.clock(),
|
|
505
479
|
],
|
|
@@ -507,58 +481,58 @@ function newMachine(tx, permission, description, passport) {
|
|
|
507
481
|
}
|
|
508
482
|
else {
|
|
509
483
|
return tx.moveCall({
|
|
510
|
-
target:
|
|
484
|
+
target: machineFn("new"),
|
|
511
485
|
arguments: [
|
|
512
|
-
|
|
513
|
-
|
|
486
|
+
toTxObject(tx, permission),
|
|
487
|
+
toTxString(tx, description),
|
|
514
488
|
tx.object.mutRegistrar(),
|
|
515
489
|
tx.object.clock(),
|
|
516
490
|
],
|
|
517
491
|
});
|
|
518
492
|
}
|
|
519
493
|
}
|
|
520
|
-
function description_set(tx, machine, permission, description, passport) {
|
|
521
|
-
|
|
522
|
-
if (typeof description === "string" && !
|
|
523
|
-
|
|
494
|
+
export function description_set(tx, machine, permission, description, passport) {
|
|
495
|
+
validObjects([machine, permission]);
|
|
496
|
+
if (typeof description === "string" && !isValidDescription(description)) {
|
|
497
|
+
W_ERROR(WErrors.IsValidDescription, `Description exceeds maximum length`);
|
|
524
498
|
}
|
|
525
499
|
if (passport) {
|
|
526
500
|
tx.moveCall({
|
|
527
|
-
target:
|
|
501
|
+
target: machineFn("description_set_with_passport"),
|
|
528
502
|
arguments: [
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
503
|
+
toTxObject(tx, machine),
|
|
504
|
+
toTxObject(tx, permission),
|
|
505
|
+
toTxObject(tx, passport),
|
|
506
|
+
toTxString(tx, description),
|
|
533
507
|
],
|
|
534
508
|
});
|
|
535
509
|
}
|
|
536
510
|
else {
|
|
537
511
|
tx.moveCall({
|
|
538
|
-
target:
|
|
512
|
+
target: machineFn("description_set"),
|
|
539
513
|
arguments: [
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
514
|
+
toTxObject(tx, machine),
|
|
515
|
+
toTxObject(tx, permission),
|
|
516
|
+
toTxString(tx, description),
|
|
543
517
|
],
|
|
544
518
|
});
|
|
545
519
|
}
|
|
546
520
|
}
|
|
547
|
-
function node_add(tx, machine, permission, node, bCompleteReplace, passport) {
|
|
521
|
+
export function node_add(tx, machine, permission, node, bCompleteReplace, passport) {
|
|
548
522
|
if (node.length === 0) {
|
|
549
523
|
return;
|
|
550
524
|
}
|
|
551
|
-
|
|
525
|
+
validObjects([machine, permission]);
|
|
552
526
|
if (passport) {
|
|
553
527
|
if (node.length > 1) {
|
|
554
528
|
tx.moveCall({
|
|
555
|
-
target:
|
|
529
|
+
target: machineFn("node_add2_with_passport"),
|
|
556
530
|
arguments: [
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
531
|
+
toTxObject(tx, machine),
|
|
532
|
+
toTxObject(tx, permission),
|
|
533
|
+
toTxObject(tx, passport),
|
|
560
534
|
tx.makeMoveVec({
|
|
561
|
-
type: `${
|
|
535
|
+
type: `${PackageAddress}::machine::Node`,
|
|
562
536
|
elements: node,
|
|
563
537
|
}),
|
|
564
538
|
tx.pure.bool(bCompleteReplace),
|
|
@@ -567,11 +541,11 @@ function node_add(tx, machine, permission, node, bCompleteReplace, passport) {
|
|
|
567
541
|
}
|
|
568
542
|
else {
|
|
569
543
|
tx.moveCall({
|
|
570
|
-
target:
|
|
544
|
+
target: machineFn("node_add_with_passport"),
|
|
571
545
|
arguments: [
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
546
|
+
toTxObject(tx, machine),
|
|
547
|
+
toTxObject(tx, permission),
|
|
548
|
+
toTxObject(tx, passport),
|
|
575
549
|
node[0],
|
|
576
550
|
tx.pure.bool(bCompleteReplace),
|
|
577
551
|
],
|
|
@@ -581,12 +555,12 @@ function node_add(tx, machine, permission, node, bCompleteReplace, passport) {
|
|
|
581
555
|
else {
|
|
582
556
|
if (node.length > 1) {
|
|
583
557
|
tx.moveCall({
|
|
584
|
-
target:
|
|
558
|
+
target: machineFn("node_add2"),
|
|
585
559
|
arguments: [
|
|
586
|
-
|
|
587
|
-
|
|
560
|
+
toTxObject(tx, machine),
|
|
561
|
+
toTxObject(tx, permission),
|
|
588
562
|
tx.makeMoveVec({
|
|
589
|
-
type: `${
|
|
563
|
+
type: `${PackageAddress}::machine::Node`,
|
|
590
564
|
elements: node,
|
|
591
565
|
}),
|
|
592
566
|
tx.pure.bool(bCompleteReplace),
|
|
@@ -595,10 +569,10 @@ function node_add(tx, machine, permission, node, bCompleteReplace, passport) {
|
|
|
595
569
|
}
|
|
596
570
|
else {
|
|
597
571
|
tx.moveCall({
|
|
598
|
-
target:
|
|
572
|
+
target: machineFn("node_add"),
|
|
599
573
|
arguments: [
|
|
600
|
-
|
|
601
|
-
|
|
574
|
+
toTxObject(tx, machine),
|
|
575
|
+
toTxObject(tx, permission),
|
|
602
576
|
node[0],
|
|
603
577
|
tx.pure.bool(bCompleteReplace),
|
|
604
578
|
],
|
|
@@ -606,17 +580,17 @@ function node_add(tx, machine, permission, node, bCompleteReplace, passport) {
|
|
|
606
580
|
}
|
|
607
581
|
}
|
|
608
582
|
}
|
|
609
|
-
function um_set(tx, machine, permission, um, passport) {
|
|
610
|
-
|
|
583
|
+
export function um_set(tx, machine, permission, um, passport) {
|
|
584
|
+
validObjects([machine, permission]);
|
|
611
585
|
if (um) {
|
|
612
586
|
if (passport) {
|
|
613
587
|
tx.moveCall({
|
|
614
|
-
target:
|
|
588
|
+
target: machineFn(`um_set_with_passport`),
|
|
615
589
|
arguments: [
|
|
616
|
-
|
|
617
|
-
|
|
590
|
+
toTxObject(tx, machine),
|
|
591
|
+
toTxObject(tx, permission),
|
|
618
592
|
passport,
|
|
619
|
-
|
|
593
|
+
toTxObject(tx, um),
|
|
620
594
|
tx.object.mutRegistrar(),
|
|
621
595
|
tx.object.clock(),
|
|
622
596
|
],
|
|
@@ -624,11 +598,11 @@ function um_set(tx, machine, permission, um, passport) {
|
|
|
624
598
|
}
|
|
625
599
|
else {
|
|
626
600
|
tx.moveCall({
|
|
627
|
-
target:
|
|
601
|
+
target: machineFn(`um_set`),
|
|
628
602
|
arguments: [
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
603
|
+
toTxObject(tx, machine),
|
|
604
|
+
toTxObject(tx, permission),
|
|
605
|
+
toTxObject(tx, um),
|
|
632
606
|
tx.object.mutRegistrar(),
|
|
633
607
|
tx.object.clock(),
|
|
634
608
|
],
|
|
@@ -638,10 +612,10 @@ function um_set(tx, machine, permission, um, passport) {
|
|
|
638
612
|
else {
|
|
639
613
|
if (passport) {
|
|
640
614
|
tx.moveCall({
|
|
641
|
-
target:
|
|
615
|
+
target: machineFn(`um_none_with_passport`),
|
|
642
616
|
arguments: [
|
|
643
|
-
|
|
644
|
-
|
|
617
|
+
toTxObject(tx, machine),
|
|
618
|
+
toTxObject(tx, permission),
|
|
645
619
|
passport,
|
|
646
620
|
tx.object.mutRegistrar(),
|
|
647
621
|
],
|
|
@@ -649,40 +623,40 @@ function um_set(tx, machine, permission, um, passport) {
|
|
|
649
623
|
}
|
|
650
624
|
else {
|
|
651
625
|
tx.moveCall({
|
|
652
|
-
target:
|
|
626
|
+
target: machineFn(`um_none`),
|
|
653
627
|
arguments: [
|
|
654
|
-
|
|
655
|
-
|
|
628
|
+
toTxObject(tx, machine),
|
|
629
|
+
toTxObject(tx, permission),
|
|
656
630
|
tx.object.mutRegistrar(),
|
|
657
631
|
],
|
|
658
632
|
});
|
|
659
633
|
}
|
|
660
634
|
}
|
|
661
635
|
}
|
|
662
|
-
function node_remove(tx, machine, permission, node, passport) {
|
|
636
|
+
export function node_remove(tx, machine, permission, node, passport) {
|
|
663
637
|
if (node.length === 0) {
|
|
664
638
|
return;
|
|
665
639
|
}
|
|
666
|
-
|
|
640
|
+
validObjects([machine, permission]);
|
|
667
641
|
if (passport) {
|
|
668
642
|
if (node.length > 1) {
|
|
669
643
|
tx.moveCall({
|
|
670
|
-
target:
|
|
644
|
+
target: machineFn("node_remove_with_passport"),
|
|
671
645
|
arguments: [
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
646
|
+
toTxObject(tx, machine),
|
|
647
|
+
toTxObject(tx, permission),
|
|
648
|
+
toTxObject(tx, passport),
|
|
675
649
|
tx.pure.vector("string", node),
|
|
676
650
|
],
|
|
677
651
|
});
|
|
678
652
|
}
|
|
679
653
|
else {
|
|
680
654
|
tx.moveCall({
|
|
681
|
-
target:
|
|
655
|
+
target: machineFn("node_remove_with_passport"),
|
|
682
656
|
arguments: [
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
657
|
+
toTxObject(tx, machine),
|
|
658
|
+
toTxObject(tx, permission),
|
|
659
|
+
toTxObject(tx, passport),
|
|
686
660
|
tx.pure.string(node[0]),
|
|
687
661
|
],
|
|
688
662
|
});
|
|
@@ -691,44 +665,44 @@ function node_remove(tx, machine, permission, node, passport) {
|
|
|
691
665
|
else {
|
|
692
666
|
if (node.length > 1) {
|
|
693
667
|
tx.moveCall({
|
|
694
|
-
target:
|
|
668
|
+
target: machineFn("node_remove"),
|
|
695
669
|
arguments: [
|
|
696
|
-
|
|
697
|
-
|
|
670
|
+
toTxObject(tx, machine),
|
|
671
|
+
toTxObject(tx, permission),
|
|
698
672
|
tx.pure.vector("string", node),
|
|
699
673
|
],
|
|
700
674
|
});
|
|
701
675
|
}
|
|
702
676
|
else {
|
|
703
677
|
tx.moveCall({
|
|
704
|
-
target:
|
|
678
|
+
target: machineFn("node_remove"),
|
|
705
679
|
arguments: [
|
|
706
|
-
|
|
707
|
-
|
|
680
|
+
toTxObject(tx, machine),
|
|
681
|
+
toTxObject(tx, permission),
|
|
708
682
|
tx.pure.string(node[0]),
|
|
709
683
|
],
|
|
710
684
|
});
|
|
711
685
|
}
|
|
712
686
|
}
|
|
713
687
|
}
|
|
714
|
-
function node_rename(tx, machine, permission, node_name, node_new_name, passport) {
|
|
688
|
+
export function node_rename(tx, machine, permission, node_name, node_new_name, passport) {
|
|
715
689
|
if (!node_name || !node_new_name) {
|
|
716
|
-
|
|
690
|
+
W_ERROR(WErrors.InvalidParam, `Node name ${node_name} or new node name ${node_new_name} is empty`);
|
|
717
691
|
}
|
|
718
|
-
|
|
719
|
-
if (!
|
|
720
|
-
|
|
692
|
+
validObjects([machine, permission]);
|
|
693
|
+
if (!isValidName(node_name)) {
|
|
694
|
+
W_ERROR(WErrors.InvalidParam, `Node name ${node_name} is invalid`);
|
|
721
695
|
}
|
|
722
|
-
if (!
|
|
723
|
-
|
|
696
|
+
if (!isValidName(node_new_name)) {
|
|
697
|
+
W_ERROR(WErrors.InvalidParam, `New node name ${node_new_name} is invalid`);
|
|
724
698
|
}
|
|
725
699
|
if (passport) {
|
|
726
700
|
tx.moveCall({
|
|
727
|
-
target:
|
|
701
|
+
target: machineFn("node_rename_with_passport"),
|
|
728
702
|
arguments: [
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
703
|
+
toTxObject(tx, machine),
|
|
704
|
+
toTxObject(tx, permission),
|
|
705
|
+
toTxObject(tx, passport),
|
|
732
706
|
tx.pure.string(node_name),
|
|
733
707
|
tx.pure.string(node_new_name),
|
|
734
708
|
],
|
|
@@ -736,37 +710,37 @@ function node_rename(tx, machine, permission, node_name, node_new_name, passport
|
|
|
736
710
|
}
|
|
737
711
|
else {
|
|
738
712
|
tx.moveCall({
|
|
739
|
-
target:
|
|
713
|
+
target: machineFn("node_rename"),
|
|
740
714
|
arguments: [
|
|
741
|
-
|
|
742
|
-
|
|
715
|
+
toTxObject(tx, machine),
|
|
716
|
+
toTxObject(tx, permission),
|
|
743
717
|
tx.pure.string(node_name),
|
|
744
718
|
tx.pure.string(node_new_name),
|
|
745
719
|
],
|
|
746
720
|
});
|
|
747
721
|
}
|
|
748
722
|
}
|
|
749
|
-
function node_exchange_name(tx, machine, permission, node_one, node_other, passport) {
|
|
750
|
-
|
|
723
|
+
export function node_exchange_name(tx, machine, permission, node_one, node_other, passport) {
|
|
724
|
+
validObjects([machine, permission]);
|
|
751
725
|
if (!node_one || !node_other) {
|
|
752
|
-
|
|
726
|
+
W_ERROR(WErrors.InvalidParam, `Node one ${node_one} or node other ${node_other} is empty`);
|
|
753
727
|
}
|
|
754
|
-
if (!
|
|
755
|
-
|
|
728
|
+
if (!isValidName(node_one)) {
|
|
729
|
+
W_ERROR(WErrors.InvalidParam, `Node one ${node_one} is invalid`);
|
|
756
730
|
}
|
|
757
|
-
if (!
|
|
758
|
-
|
|
731
|
+
if (!isValidName(node_other)) {
|
|
732
|
+
W_ERROR(WErrors.InvalidParam, `Node other ${node_other} is invalid`);
|
|
759
733
|
}
|
|
760
734
|
if (node_one === node_other) {
|
|
761
|
-
|
|
735
|
+
W_ERROR(WErrors.InvalidParam, `Node one ${node_one} and node other ${node_other} are same`);
|
|
762
736
|
}
|
|
763
737
|
if (passport) {
|
|
764
738
|
tx.moveCall({
|
|
765
|
-
target:
|
|
739
|
+
target: machineFn("node_exchange_name_with_passport"),
|
|
766
740
|
arguments: [
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
741
|
+
toTxObject(tx, machine),
|
|
742
|
+
toTxObject(tx, permission),
|
|
743
|
+
toTxObject(tx, passport),
|
|
770
744
|
tx.pure.string(node_one),
|
|
771
745
|
tx.pure.string(node_other),
|
|
772
746
|
],
|
|
@@ -774,88 +748,88 @@ function node_exchange_name(tx, machine, permission, node_one, node_other, passp
|
|
|
774
748
|
}
|
|
775
749
|
else {
|
|
776
750
|
tx.moveCall({
|
|
777
|
-
target:
|
|
751
|
+
target: machineFn("node_exchange_name"),
|
|
778
752
|
arguments: [
|
|
779
|
-
|
|
780
|
-
|
|
753
|
+
toTxObject(tx, machine),
|
|
754
|
+
toTxObject(tx, permission),
|
|
781
755
|
tx.pure.string(node_one),
|
|
782
756
|
tx.pure.string(node_other),
|
|
783
757
|
],
|
|
784
758
|
});
|
|
785
759
|
}
|
|
786
760
|
}
|
|
787
|
-
function node_clear(tx, machine, permission, passport) {
|
|
788
|
-
|
|
761
|
+
export function node_clear(tx, machine, permission, passport) {
|
|
762
|
+
validObjects([machine, permission]);
|
|
789
763
|
if (passport) {
|
|
790
764
|
tx.moveCall({
|
|
791
|
-
target:
|
|
765
|
+
target: machineFn("node_clear_with_passport"),
|
|
792
766
|
arguments: [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
767
|
+
toTxObject(tx, machine),
|
|
768
|
+
toTxObject(tx, permission),
|
|
769
|
+
toTxObject(tx, passport),
|
|
796
770
|
],
|
|
797
771
|
});
|
|
798
772
|
}
|
|
799
773
|
else {
|
|
800
774
|
tx.moveCall({
|
|
801
|
-
target:
|
|
802
|
-
arguments: [
|
|
775
|
+
target: machineFn("node_clear"),
|
|
776
|
+
arguments: [toTxObject(tx, machine), toTxObject(tx, permission)],
|
|
803
777
|
});
|
|
804
778
|
}
|
|
805
779
|
}
|
|
806
|
-
function publish(tx, machine, permission, passport) {
|
|
807
|
-
|
|
780
|
+
export function publish(tx, machine, permission, passport) {
|
|
781
|
+
validObjects([machine, permission]);
|
|
808
782
|
if (passport) {
|
|
809
783
|
tx.moveCall({
|
|
810
|
-
target:
|
|
784
|
+
target: machineFn("publish_with_passport"),
|
|
811
785
|
arguments: [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
786
|
+
toTxObject(tx, machine),
|
|
787
|
+
toTxObject(tx, permission),
|
|
788
|
+
toTxObject(tx, passport),
|
|
815
789
|
],
|
|
816
790
|
});
|
|
817
791
|
}
|
|
818
792
|
else {
|
|
819
793
|
tx.moveCall({
|
|
820
|
-
target:
|
|
821
|
-
arguments: [
|
|
794
|
+
target: machineFn("publish"),
|
|
795
|
+
arguments: [toTxObject(tx, machine), toTxObject(tx, permission)],
|
|
822
796
|
});
|
|
823
797
|
}
|
|
824
798
|
}
|
|
825
|
-
function pause(tx, machine, permission, bPaused, passport) {
|
|
826
|
-
|
|
799
|
+
export function pause(tx, machine, permission, bPaused, passport) {
|
|
800
|
+
validObjects([machine, permission]);
|
|
827
801
|
if (passport) {
|
|
828
802
|
tx.moveCall({
|
|
829
|
-
target:
|
|
803
|
+
target: machineFn("pause_with_passport"),
|
|
830
804
|
arguments: [
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
805
|
+
toTxObject(tx, machine),
|
|
806
|
+
toTxObject(tx, permission),
|
|
807
|
+
toTxObject(tx, passport),
|
|
834
808
|
tx.pure.bool(bPaused),
|
|
835
809
|
],
|
|
836
810
|
});
|
|
837
811
|
}
|
|
838
812
|
else {
|
|
839
813
|
tx.moveCall({
|
|
840
|
-
target:
|
|
814
|
+
target: machineFn("pause"),
|
|
841
815
|
arguments: [
|
|
842
|
-
|
|
843
|
-
|
|
816
|
+
toTxObject(tx, machine),
|
|
817
|
+
toTxObject(tx, permission),
|
|
844
818
|
tx.pure.bool(bPaused),
|
|
845
819
|
],
|
|
846
820
|
});
|
|
847
821
|
}
|
|
848
822
|
}
|
|
849
|
-
function consensus_repositories_add(tx, machine, permission, repository, passport) {
|
|
850
|
-
|
|
823
|
+
export function consensus_repositories_add(tx, machine, permission, repository, passport) {
|
|
824
|
+
validObjects([machine, permission, repository]);
|
|
851
825
|
if (passport) {
|
|
852
826
|
tx.moveCall({
|
|
853
|
-
target:
|
|
827
|
+
target: machineFn("consensus_repositories_add_with_passport"),
|
|
854
828
|
arguments: [
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
829
|
+
toTxObject(tx, machine),
|
|
830
|
+
toTxObject(tx, permission),
|
|
831
|
+
toTxObject(tx, passport),
|
|
832
|
+
toTxObject(tx, repository),
|
|
859
833
|
tx.object.mutRegistrar(),
|
|
860
834
|
tx.object.clock(),
|
|
861
835
|
],
|
|
@@ -863,29 +837,29 @@ function consensus_repositories_add(tx, machine, permission, repository, passpor
|
|
|
863
837
|
}
|
|
864
838
|
else {
|
|
865
839
|
tx.moveCall({
|
|
866
|
-
target:
|
|
840
|
+
target: machineFn("consensus_repositories_add"),
|
|
867
841
|
arguments: [
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
842
|
+
toTxObject(tx, machine),
|
|
843
|
+
toTxObject(tx, permission),
|
|
844
|
+
toTxObject(tx, repository),
|
|
871
845
|
tx.object.mutRegistrar(),
|
|
872
846
|
tx.object.clock(),
|
|
873
847
|
],
|
|
874
848
|
});
|
|
875
849
|
}
|
|
876
850
|
}
|
|
877
|
-
function consensus_repositories_remove(tx, machine, permission, repositories, passport) {
|
|
851
|
+
export function consensus_repositories_remove(tx, machine, permission, repositories, passport) {
|
|
878
852
|
if (!repositories || repositories.length === 0) {
|
|
879
853
|
return;
|
|
880
854
|
}
|
|
881
|
-
|
|
855
|
+
validObjects([machine, permission, ...repositories]);
|
|
882
856
|
if (passport) {
|
|
883
857
|
tx.moveCall({
|
|
884
|
-
target:
|
|
858
|
+
target: machineFn("consensus_repositories_remove_with_passport"),
|
|
885
859
|
arguments: [
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
860
|
+
toTxObject(tx, machine),
|
|
861
|
+
toTxObject(tx, permission),
|
|
862
|
+
toTxObject(tx, passport),
|
|
889
863
|
tx.pure.vector("string", repositories),
|
|
890
864
|
tx.object.mutRegistrar(),
|
|
891
865
|
],
|
|
@@ -893,65 +867,65 @@ function consensus_repositories_remove(tx, machine, permission, repositories, pa
|
|
|
893
867
|
}
|
|
894
868
|
else {
|
|
895
869
|
tx.moveCall({
|
|
896
|
-
target:
|
|
870
|
+
target: machineFn("consensus_repositories_remove"),
|
|
897
871
|
arguments: [
|
|
898
|
-
|
|
899
|
-
|
|
872
|
+
toTxObject(tx, machine),
|
|
873
|
+
toTxObject(tx, permission),
|
|
900
874
|
tx.pure.vector("string", repositories),
|
|
901
875
|
tx.object.mutRegistrar(),
|
|
902
876
|
],
|
|
903
877
|
});
|
|
904
878
|
}
|
|
905
879
|
}
|
|
906
|
-
function consensus_repositories_clear(tx, machine, permission, passport) {
|
|
907
|
-
|
|
880
|
+
export function consensus_repositories_clear(tx, machine, permission, passport) {
|
|
881
|
+
validObjects([machine, permission]);
|
|
908
882
|
if (passport) {
|
|
909
883
|
tx.moveCall({
|
|
910
|
-
target:
|
|
884
|
+
target: machineFn("consensus_repositories_clear_with_passport"),
|
|
911
885
|
arguments: [
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
886
|
+
toTxObject(tx, machine),
|
|
887
|
+
toTxObject(tx, permission),
|
|
888
|
+
toTxObject(tx, passport),
|
|
915
889
|
tx.object.mutRegistrar(),
|
|
916
890
|
],
|
|
917
891
|
});
|
|
918
892
|
}
|
|
919
893
|
else {
|
|
920
894
|
tx.moveCall({
|
|
921
|
-
target:
|
|
895
|
+
target: machineFn("consensus_repositories_clear"),
|
|
922
896
|
arguments: [
|
|
923
|
-
|
|
924
|
-
|
|
897
|
+
toTxObject(tx, machine),
|
|
898
|
+
toTxObject(tx, permission),
|
|
925
899
|
tx.object.mutRegistrar(),
|
|
926
900
|
],
|
|
927
901
|
});
|
|
928
902
|
}
|
|
929
903
|
}
|
|
930
|
-
async function forwards_add(tx, machine, permission, node_name, next_node_name, forwards, threshold, passport) {
|
|
904
|
+
export async function forwards_add(tx, machine, permission, node_name, next_node_name, forwards, threshold, passport) {
|
|
931
905
|
if (!forwards || forwards.length === 0) {
|
|
932
906
|
return;
|
|
933
907
|
}
|
|
934
|
-
|
|
935
|
-
if (threshold !== null && !
|
|
936
|
-
|
|
908
|
+
validObjects([machine, permission]);
|
|
909
|
+
if (threshold !== null && !isValidU32(threshold)) {
|
|
910
|
+
W_ERROR(WErrors.InvalidParam, `threshold ${threshold} must be u32`);
|
|
937
911
|
}
|
|
938
|
-
if (!
|
|
939
|
-
|
|
912
|
+
if (!isValidName(node_name)) {
|
|
913
|
+
W_ERROR(WErrors.InvalidParam, `node_name ${node_name} is excceed max length ${MAX_NAME_LENGTH}`);
|
|
940
914
|
}
|
|
941
|
-
if (!
|
|
942
|
-
|
|
915
|
+
if (!isValidName(next_node_name)) {
|
|
916
|
+
W_ERROR(WErrors.InvalidParam, `next_node_name ${next_node_name} is excceed max length ${MAX_NAME_LENGTH}`);
|
|
943
917
|
}
|
|
944
918
|
if (passport) {
|
|
945
919
|
tx.moveCall({
|
|
946
|
-
target:
|
|
920
|
+
target: machineFn("forwards_add_with_passport"),
|
|
947
921
|
arguments: [
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
922
|
+
toTxObject(tx, machine),
|
|
923
|
+
toTxObject(tx, permission),
|
|
924
|
+
toTxObject(tx, passport),
|
|
925
|
+
toTxString(tx, node_name),
|
|
926
|
+
toTxString(tx, next_node_name),
|
|
953
927
|
tx.makeMoveVec({
|
|
954
|
-
type: `${
|
|
928
|
+
type: `${PackageAddress}::machine::Forward`,
|
|
955
929
|
elements: forwards,
|
|
956
930
|
}),
|
|
957
931
|
tx.pure.option("u32", threshold ?? null),
|
|
@@ -960,14 +934,14 @@ async function forwards_add(tx, machine, permission, node_name, next_node_name,
|
|
|
960
934
|
}
|
|
961
935
|
else {
|
|
962
936
|
tx.moveCall({
|
|
963
|
-
target:
|
|
937
|
+
target: machineFn("forwards_add"),
|
|
964
938
|
arguments: [
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
939
|
+
toTxObject(tx, machine),
|
|
940
|
+
toTxObject(tx, permission),
|
|
941
|
+
toTxString(tx, node_name),
|
|
942
|
+
toTxString(tx, next_node_name),
|
|
969
943
|
tx.makeMoveVec({
|
|
970
|
-
type: `${
|
|
944
|
+
type: `${PackageAddress}::machine::Forward`,
|
|
971
945
|
elements: forwards,
|
|
972
946
|
}),
|
|
973
947
|
tx.pure.option("u32", threshold ?? null),
|
|
@@ -975,29 +949,29 @@ async function forwards_add(tx, machine, permission, node_name, next_node_name,
|
|
|
975
949
|
});
|
|
976
950
|
}
|
|
977
951
|
}
|
|
978
|
-
function forwards_remove(tx, machine, permission, node_name, next_node_name, forwards, threshold, passport) {
|
|
952
|
+
export function forwards_remove(tx, machine, permission, node_name, next_node_name, forwards, threshold, passport) {
|
|
979
953
|
if (!forwards || forwards.length === 0) {
|
|
980
954
|
return;
|
|
981
955
|
}
|
|
982
|
-
|
|
983
|
-
if (!
|
|
984
|
-
|
|
956
|
+
validObjects([machine, permission, ...forwards]);
|
|
957
|
+
if (!isValidName(node_name)) {
|
|
958
|
+
W_ERROR(WErrors.InvalidParam, `node_name ${node_name} is excceed max length ${MAX_NAME_LENGTH}`);
|
|
985
959
|
}
|
|
986
|
-
if (!
|
|
987
|
-
|
|
960
|
+
if (!isValidName(next_node_name)) {
|
|
961
|
+
W_ERROR(WErrors.InvalidParam, `next_node_name ${next_node_name} is excceed max length ${MAX_NAME_LENGTH}`);
|
|
988
962
|
}
|
|
989
|
-
if (threshold !== null && !
|
|
990
|
-
|
|
963
|
+
if (threshold !== null && !isValidU32(threshold)) {
|
|
964
|
+
W_ERROR(WErrors.InvalidParam, `threshold ${threshold} must be u32`);
|
|
991
965
|
}
|
|
992
966
|
if (passport) {
|
|
993
967
|
tx.moveCall({
|
|
994
|
-
target:
|
|
968
|
+
target: machineFn("forwards_remove_with_passport"),
|
|
995
969
|
arguments: [
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
970
|
+
toTxObject(tx, machine),
|
|
971
|
+
toTxObject(tx, permission),
|
|
972
|
+
toTxObject(tx, passport),
|
|
973
|
+
toTxString(tx, node_name),
|
|
974
|
+
toTxString(tx, next_node_name),
|
|
1001
975
|
tx.pure.vector("string", forwards),
|
|
1002
976
|
tx.pure.option("u32", threshold ?? null),
|
|
1003
977
|
],
|
|
@@ -1005,63 +979,63 @@ function forwards_remove(tx, machine, permission, node_name, next_node_name, for
|
|
|
1005
979
|
}
|
|
1006
980
|
else {
|
|
1007
981
|
tx.moveCall({
|
|
1008
|
-
target:
|
|
982
|
+
target: machineFn("forwards_remove"),
|
|
1009
983
|
arguments: [
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
984
|
+
toTxObject(tx, machine),
|
|
985
|
+
toTxObject(tx, permission),
|
|
986
|
+
toTxString(tx, node_name),
|
|
987
|
+
toTxString(tx, next_node_name),
|
|
1014
988
|
tx.pure.vector("string", forwards),
|
|
1015
989
|
tx.pure.option("u32", threshold ?? null),
|
|
1016
990
|
],
|
|
1017
991
|
});
|
|
1018
992
|
}
|
|
1019
993
|
}
|
|
1020
|
-
function prev_nodes_remove(tx, machine, permission, node_name, prev_node_names, passport) {
|
|
994
|
+
export function prev_nodes_remove(tx, machine, permission, node_name, prev_node_names, passport) {
|
|
1021
995
|
if (prev_node_names.length === 0) {
|
|
1022
996
|
return;
|
|
1023
997
|
}
|
|
1024
|
-
|
|
1025
|
-
if (!
|
|
1026
|
-
|
|
998
|
+
validObjects([machine, permission]);
|
|
999
|
+
if (!isValidName(node_name)) {
|
|
1000
|
+
W_ERROR(WErrors.InvalidParam, `node_name ${node_name} is excceed max length ${MAX_NAME_LENGTH}`);
|
|
1027
1001
|
}
|
|
1028
1002
|
for (const prev_node_name of prev_node_names) {
|
|
1029
|
-
if (!
|
|
1030
|
-
|
|
1003
|
+
if (!isValidName(prev_node_name)) {
|
|
1004
|
+
W_ERROR(WErrors.InvalidParam, `prev_node_name ${prev_node_name} is excceed max length ${MAX_NAME_LENGTH}`);
|
|
1031
1005
|
}
|
|
1032
1006
|
}
|
|
1033
1007
|
if (passport) {
|
|
1034
1008
|
tx.moveCall({
|
|
1035
|
-
target:
|
|
1009
|
+
target: machineFn("prev_nodes_remove_with_passport"),
|
|
1036
1010
|
arguments: [
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1011
|
+
toTxObject(tx, machine),
|
|
1012
|
+
toTxObject(tx, permission),
|
|
1013
|
+
toTxObject(tx, passport),
|
|
1014
|
+
toTxString(tx, node_name),
|
|
1041
1015
|
tx.pure.vector("string", prev_node_names),
|
|
1042
1016
|
],
|
|
1043
1017
|
});
|
|
1044
1018
|
}
|
|
1045
1019
|
else {
|
|
1046
1020
|
tx.moveCall({
|
|
1047
|
-
target:
|
|
1021
|
+
target: machineFn("prev_nodes_remove"),
|
|
1048
1022
|
arguments: [
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1023
|
+
toTxObject(tx, machine),
|
|
1024
|
+
toTxObject(tx, permission),
|
|
1025
|
+
toTxString(tx, node_name),
|
|
1052
1026
|
tx.pure.vector("string", prev_node_names),
|
|
1053
1027
|
],
|
|
1054
1028
|
});
|
|
1055
1029
|
}
|
|
1056
1030
|
}
|
|
1057
|
-
const machineNode2file = async (machine, file_path, format = "json", network) => {
|
|
1031
|
+
export const machineNode2file = async (machine, file_path, format = "json", network) => {
|
|
1058
1032
|
// Get machine address
|
|
1059
|
-
const machineAddr = await
|
|
1033
|
+
const machineAddr = await LocalMark.Instance().get_address(machine);
|
|
1060
1034
|
if (!machineAddr) {
|
|
1061
1035
|
throw new Error(`Machine object ${machine} not found`);
|
|
1062
1036
|
}
|
|
1063
1037
|
// Query Machine object using query_objects to verify it exists and get basic info
|
|
1064
|
-
const machineQueryResult = await
|
|
1038
|
+
const machineQueryResult = await query_objects({
|
|
1065
1039
|
objects: [machineAddr],
|
|
1066
1040
|
network: network,
|
|
1067
1041
|
});
|
|
@@ -1078,14 +1052,14 @@ const machineNode2file = async (machine, file_path, format = "json", network) =>
|
|
|
1078
1052
|
parent: machineAddr,
|
|
1079
1053
|
network: network,
|
|
1080
1054
|
};
|
|
1081
|
-
const tableResult = await
|
|
1055
|
+
const tableResult = await query_table(tableQuery);
|
|
1082
1056
|
if (!tableResult?.items || tableResult.items.length === 0) {
|
|
1083
1057
|
throw new Error(`No nodes found in machine ${machine}`);
|
|
1084
1058
|
}
|
|
1085
1059
|
// Get all node object IDs from table result
|
|
1086
1060
|
const nodeObjectIds = tableResult.items.map((item) => item.object);
|
|
1087
1061
|
// Fetch all node details using query_objects
|
|
1088
|
-
const nodeQueryResult = await
|
|
1062
|
+
const nodeQueryResult = await query_objects({
|
|
1089
1063
|
objects: nodeObjectIds,
|
|
1090
1064
|
network: network,
|
|
1091
1065
|
});
|
|
@@ -1116,9 +1090,8 @@ const machineNode2file = async (machine, file_path, format = "json", network) =>
|
|
|
1116
1090
|
content = generateMachineNodeMarkdown(nodes, machine, machineAddr, machineId);
|
|
1117
1091
|
}
|
|
1118
1092
|
// Write to file
|
|
1119
|
-
|
|
1093
|
+
writeFileSync(file_path, content, "utf-8");
|
|
1120
1094
|
};
|
|
1121
|
-
exports.machineNode2file = machineNode2file;
|
|
1122
1095
|
function generateMachineNodeMarkdown(nodes, machineName, machineAddr, machineId) {
|
|
1123
1096
|
let md = `# Machine Node Definition\n\n`;
|
|
1124
1097
|
md += `**Machine:** ${machineName}\n\n`;
|
|
@@ -1156,15 +1129,15 @@ function generateMachineNodeMarkdown(nodes, machineName, machineAddr, machineId)
|
|
|
1156
1129
|
md += `\n\`\`\`\n`;
|
|
1157
1130
|
return md;
|
|
1158
1131
|
}
|
|
1159
|
-
function prev_nodes_remove_with_passport(tx, machine, permission, passport, node_name, prev_node_names) {
|
|
1160
|
-
|
|
1132
|
+
export function prev_nodes_remove_with_passport(tx, machine, permission, passport, node_name, prev_node_names) {
|
|
1133
|
+
validObjects([machine, permission, passport]);
|
|
1161
1134
|
tx.moveCall({
|
|
1162
|
-
target:
|
|
1135
|
+
target: machineFn("prev_nodes_remove_with_passport"),
|
|
1163
1136
|
arguments: [
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1137
|
+
toTxObject(tx, machine),
|
|
1138
|
+
toTxObject(tx, permission),
|
|
1139
|
+
toTxObject(tx, passport),
|
|
1140
|
+
toTxString(tx, node_name),
|
|
1168
1141
|
tx.pure.vector("string", prev_node_names),
|
|
1169
1142
|
],
|
|
1170
1143
|
});
|