wowok 1.8.2 → 2.1.9
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/README.md +4 -33
- package/dist/cjs/bcs/bcs.d.ts +1973 -0
- package/dist/cjs/bcs/bcs.js +327 -0
- package/dist/cjs/bcs/effects.d.ts +579 -0
- package/dist/cjs/bcs/effects.js +231 -0
- package/dist/cjs/bcs/index.d.ts +2589 -0
- package/dist/cjs/bcs/index.js +79 -0
- package/dist/cjs/bcs/pure.d.ts +22 -0
- package/dist/cjs/bcs/pure.js +62 -0
- package/dist/cjs/bcs/type-tag-serializer.d.ts +7 -0
- package/dist/cjs/bcs/type-tag-serializer.js +124 -0
- package/dist/cjs/bcs/types.d.ts +114 -0
- package/dist/cjs/bcs/types.js +26 -0
- package/dist/cjs/client/index.d.ts +5 -0
- package/dist/cjs/client/index.js +34 -0
- package/dist/cjs/client/network.d.ts +5 -0
- package/dist/cjs/client/network.js +43 -0
- package/dist/cjs/cryptography/index.d.ts +7 -0
- package/dist/cjs/cryptography/index.js +46 -0
- package/dist/cjs/cryptography/intent.d.ts +6 -0
- package/dist/cjs/cryptography/intent.js +34 -0
- package/dist/cjs/cryptography/keypair.d.ts +73 -0
- package/dist/cjs/cryptography/keypair.js +125 -0
- package/dist/cjs/cryptography/mnemonics.d.ts +27 -0
- package/dist/cjs/cryptography/mnemonics.js +50 -0
- package/dist/cjs/cryptography/publickey.d.ts +67 -0
- package/dist/cjs/cryptography/publickey.js +142 -0
- package/dist/cjs/cryptography/signature-scheme.d.ts +24 -0
- package/dist/cjs/cryptography/signature-scheme.js +47 -0
- package/dist/cjs/cryptography/signature.d.ts +62 -0
- package/dist/cjs/cryptography/signature.js +71 -0
- package/dist/cjs/experimental/cache.d.ts +12 -0
- package/dist/cjs/experimental/client.d.ts +12 -0
- package/dist/cjs/experimental/core.d.ts +33 -0
- package/dist/cjs/experimental/errors.d.ts +8 -0
- package/dist/cjs/experimental/index.d.ts +7 -0
- package/dist/cjs/experimental/persistent-storage.d.ts +134 -0
- package/dist/cjs/experimental/persistent-storage.test.d.ts +5 -0
- package/dist/cjs/experimental/transports/utils.d.ts +3 -0
- package/dist/cjs/experimental/types.d.ts +367 -0
- package/dist/cjs/faucet/faucet.d.ts +66 -0
- package/dist/cjs/faucet/faucet.js +138 -0
- package/dist/cjs/faucet/index.d.ts +1 -0
- package/dist/cjs/faucet/index.js +29 -0
- package/dist/cjs/graphql/client.js +98 -0
- package/dist/cjs/graphql/core.js +506 -0
- package/dist/cjs/graphql/generated/2024.1/tada-env.js +13141 -0
- package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +11 -0
- package/dist/cjs/graphql/generated/2024.4/tada-env.js +13287 -0
- package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +11 -0
- package/dist/cjs/graphql/generated/latest/tada-env.js +12925 -0
- package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +11 -0
- package/dist/cjs/graphql/generated/queries.js +807 -0
- package/dist/cjs/graphql/index.js +25 -0
- package/dist/cjs/graphql/schemas/2024.1/index.js +28 -0
- package/dist/cjs/graphql/schemas/2024.4/index.js +28 -0
- package/dist/cjs/graphql/schemas/latest/index.js +28 -0
- package/dist/cjs/graphql/types.js +16 -0
- package/dist/cjs/grpc/client.d.ts +32 -0
- package/dist/cjs/grpc/client.js +64 -0
- package/dist/cjs/grpc/core.d.ts +28 -0
- package/dist/cjs/grpc/core.js +645 -0
- package/dist/cjs/grpc/index.d.ts +4 -0
- package/dist/cjs/grpc/index.js +26 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.d.ts +173 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.js +138 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.d.ts +104 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +94 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.d.ts +25 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +30 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +77 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.d.ts +169 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +224 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +134 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.d.ts +525 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +317 -0
- package/dist/cjs/grpc/proto/google/rpc/status.d.ts +46 -0
- package/dist/cjs/grpc/proto/google/rpc/status.js +52 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +70 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +52 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +45 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +77 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +84 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +170 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +300 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +87 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +29 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +86 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +87 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +519 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +63 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +85 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +81 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +122 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +368 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +485 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +81 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +241 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +55 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +141 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +114 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +53 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +63 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +61 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +541 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +33 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +50 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +90 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +88 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +546 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +54 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +65 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +740 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1005 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +49 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +177 -0
- package/dist/cjs/index.d.ts +25 -0
- package/dist/cjs/index.js +93 -0
- package/dist/cjs/jsonRpc/client.d.ts +261 -0
- package/dist/cjs/jsonRpc/client.js +747 -0
- package/dist/cjs/jsonRpc/core.d.ts +87 -0
- package/dist/cjs/jsonRpc/core.js +638 -0
- package/dist/cjs/jsonRpc/errors.d.ts +12 -0
- package/dist/cjs/jsonRpc/errors.js +65 -0
- package/dist/cjs/jsonRpc/http-transport.d.ts +42 -0
- package/dist/cjs/jsonRpc/http-transport.js +121 -0
- package/dist/cjs/jsonRpc/index.d.ts +4 -0
- package/dist/cjs/jsonRpc/index.js +31 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.d.ts +4 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +321 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.d.ts +43 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +220 -0
- package/dist/cjs/jsonRpc/types/chain.d.ts +99 -0
- package/dist/cjs/jsonRpc/types/chain.js +16 -0
- package/dist/cjs/jsonRpc/types/changes.d.ts +19 -0
- package/dist/cjs/jsonRpc/types/changes.js +16 -0
- package/dist/cjs/jsonRpc/types/coins.d.ts +6 -0
- package/dist/cjs/jsonRpc/types/coins.js +16 -0
- package/dist/cjs/jsonRpc/types/common.d.ts +2 -0
- package/dist/cjs/jsonRpc/types/common.js +16 -0
- package/dist/cjs/jsonRpc/types/generated.d.ts +1492 -0
- package/dist/cjs/jsonRpc/types/generated.js +16 -0
- package/dist/cjs/jsonRpc/types/index.d.ts +6 -0
- package/dist/cjs/jsonRpc/types/index.js +16 -0
- package/dist/cjs/jsonRpc/types/params.d.ts +656 -0
- package/dist/cjs/jsonRpc/types/params.js +16 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +82 -0
- package/dist/cjs/keypairs/ed25519/index.d.ts +2 -0
- package/dist/cjs/keypairs/ed25519/index.js +27 -0
- package/dist/cjs/keypairs/ed25519/keypair.d.ts +74 -0
- package/dist/cjs/keypairs/ed25519/keypair.js +169 -0
- package/dist/cjs/keypairs/ed25519/publickey.d.ts +30 -0
- package/dist/cjs/keypairs/ed25519/publickey.js +90 -0
- package/dist/cjs/keypairs/index.d.ts +4 -0
- package/dist/cjs/keypairs/index.js +21 -0
- package/dist/cjs/keypairs/passkey/index.d.ts +3 -0
- package/dist/cjs/keypairs/passkey/index.js +28 -0
- package/dist/cjs/keypairs/passkey/keypair.d.ts +113 -0
- package/dist/cjs/keypairs/passkey/keypair.js +268 -0
- package/dist/cjs/keypairs/passkey/publickey.d.ts +72 -0
- package/dist/cjs/keypairs/passkey/publickey.js +175 -0
- package/dist/cjs/keypairs/passkey/types.d.ts +12 -0
- package/dist/cjs/keypairs/passkey/types.js +16 -0
- package/dist/cjs/keypairs/secp256k1/index.d.ts +2 -0
- package/dist/cjs/keypairs/secp256k1/index.js +27 -0
- package/dist/cjs/keypairs/secp256k1/keypair.d.ts +73 -0
- package/dist/cjs/keypairs/secp256k1/keypair.js +159 -0
- package/dist/cjs/keypairs/secp256k1/publickey.d.ts +30 -0
- package/dist/cjs/keypairs/secp256k1/publickey.js +95 -0
- package/dist/cjs/keypairs/secp256r1/index.d.ts +2 -0
- package/dist/cjs/keypairs/secp256r1/index.js +27 -0
- package/dist/cjs/keypairs/secp256r1/keypair.d.ts +73 -0
- package/dist/cjs/keypairs/secp256r1/keypair.js +155 -0
- package/dist/cjs/keypairs/secp256r1/publickey.d.ts +30 -0
- package/dist/cjs/keypairs/secp256r1/publickey.js +96 -0
- package/dist/cjs/multisig/index.d.ts +2 -0
- package/dist/cjs/multisig/index.js +27 -0
- package/dist/cjs/multisig/publickey.d.ts +79 -0
- package/dist/cjs/multisig/publickey.js +296 -0
- package/dist/cjs/multisig/signer.d.ts +20 -0
- package/dist/cjs/multisig/signer.js +114 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/transactions/Arguments.d.ts +57 -0
- package/dist/cjs/transactions/Arguments.js +36 -0
- package/dist/cjs/transactions/Commands.d.ts +57 -0
- package/dist/cjs/transactions/Commands.js +143 -0
- package/dist/cjs/transactions/Inputs.d.ts +22 -0
- package/dist/cjs/transactions/Inputs.js +87 -0
- package/dist/cjs/transactions/ObjectCache.d.ts +83 -0
- package/dist/cjs/transactions/ObjectCache.js +251 -0
- package/dist/cjs/transactions/Transaction.d.ts +710 -0
- package/dist/cjs/transactions/Transaction.js +742 -0
- package/dist/cjs/transactions/TransactionData.d.ts +73 -0
- package/dist/cjs/transactions/TransactionData.js +472 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.d.ts +1 -0
- package/dist/cjs/transactions/__tests__/bcs.test.d.ts +1 -0
- package/dist/cjs/transactions/data/internal.d.ts +1010 -0
- package/dist/cjs/transactions/data/internal.js +230 -0
- package/dist/cjs/transactions/data/v1.d.ts +312 -0
- package/dist/cjs/transactions/data/v1.js +538 -0
- package/dist/cjs/transactions/data/v2.d.ts +153 -0
- package/dist/cjs/transactions/data/v2.js +124 -0
- package/dist/cjs/transactions/executor/caching.d.ts +31 -0
- package/dist/cjs/transactions/executor/caching.js +118 -0
- package/dist/cjs/transactions/executor/parallel.d.ts +37 -0
- package/dist/cjs/transactions/executor/parallel.js +395 -0
- package/dist/cjs/transactions/executor/queue.d.ts +11 -0
- package/dist/cjs/transactions/executor/queue.js +87 -0
- package/dist/cjs/transactions/executor/serial.d.ts +31 -0
- package/dist/cjs/transactions/executor/serial.js +136 -0
- package/dist/cjs/transactions/hash.d.ts +7 -0
- package/dist/cjs/transactions/hash.js +31 -0
- package/dist/cjs/transactions/index.d.ts +21 -0
- package/dist/cjs/transactions/index.js +50 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.d.ts +9 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.js +206 -0
- package/dist/cjs/transactions/object.d.ts +24 -0
- package/dist/cjs/transactions/object.js +116 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +37 -0
- package/dist/cjs/transactions/pure.d.ts +20 -0
- package/dist/cjs/transactions/pure.js +64 -0
- package/dist/cjs/transactions/resolve.d.ts +13 -0
- package/dist/cjs/transactions/resolve.js +103 -0
- package/dist/cjs/transactions/serializer.d.ts +7 -0
- package/dist/cjs/transactions/serializer.js +189 -0
- package/dist/cjs/transactions/utils.d.ts +10 -0
- package/dist/cjs/transactions/utils.js +143 -0
- package/dist/cjs/utils/constants.d.ts +17 -0
- package/dist/cjs/utils/constants.js +57 -0
- package/dist/cjs/utils/derived-objects.d.ts +5 -0
- package/dist/cjs/utils/derived-objects.js +33 -0
- package/dist/cjs/utils/dynamic-fields.d.ts +2 -0
- package/dist/cjs/utils/dynamic-fields.js +40 -0
- package/dist/cjs/utils/format.d.ts +2 -0
- package/dist/cjs/utils/format.js +35 -0
- package/dist/cjs/utils/index.d.ts +8 -0
- package/dist/cjs/utils/index.js +65 -0
- package/dist/cjs/utils/move-registry.d.ts +6 -0
- package/dist/cjs/utils/move-registry.js +44 -0
- package/dist/cjs/utils/sui-types.d.ts +26 -0
- package/dist/cjs/utils/sui-types.js +90 -0
- package/dist/cjs/utils/suins.d.ts +2 -0
- package/dist/cjs/utils/suins.js +56 -0
- package/dist/cjs/verify/index.d.ts +1 -0
- package/dist/cjs/verify/index.js +28 -0
- package/dist/cjs/verify/verify.d.ts +16 -0
- package/dist/cjs/verify/verify.js +125 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +26 -0
- package/dist/cjs/w/call/allocation.d.ts +35 -0
- package/dist/cjs/w/call/allocation.js +439 -0
- package/dist/cjs/w/call/arb.d.ts +17 -0
- package/dist/cjs/w/call/arb.js +149 -0
- package/dist/cjs/w/call/arbitration.d.ts +106 -0
- package/dist/cjs/w/call/arbitration.js +1623 -0
- package/dist/cjs/w/call/base.d.ts +42 -0
- package/dist/cjs/w/call/base.js +363 -0
- package/dist/cjs/w/call/contact.d.ts +45 -0
- package/dist/cjs/w/call/contact.js +479 -0
- package/dist/cjs/w/call/demand.d.ts +79 -0
- package/dist/cjs/w/call/demand.js +872 -0
- package/dist/cjs/w/call/entity.d.ts +33 -0
- package/dist/cjs/w/call/entity.js +230 -0
- package/dist/cjs/w/call/guard-ins.d.ts +31 -0
- package/dist/cjs/w/call/guard-ins.js +4391 -0
- package/dist/cjs/w/call/guard.d.ts +254 -0
- package/dist/cjs/w/call/guard.js +1210 -0
- package/dist/cjs/w/call/index.d.ts +37 -0
- package/dist/cjs/w/call/index.js +71 -0
- package/dist/cjs/w/call/machine.d.ts +124 -0
- package/dist/cjs/w/call/machine.js +1486 -0
- package/dist/cjs/w/call/order.d.ts +73 -0
- package/dist/cjs/w/call/order.js +485 -0
- package/dist/cjs/w/call/passport.d.ts +24 -0
- package/dist/cjs/w/call/passport.js +281 -0
- package/dist/cjs/w/call/payment.d.ts +27 -0
- package/dist/cjs/w/call/payment.js +241 -0
- package/dist/cjs/w/call/permission.d.ts +222 -0
- package/dist/cjs/w/call/permission.js +1368 -0
- package/dist/cjs/w/call/personal.d.ts +51 -0
- package/dist/cjs/w/call/personal.js +184 -0
- package/dist/cjs/w/call/progress.d.ts +94 -0
- package/dist/cjs/w/call/progress.js +833 -0
- package/dist/cjs/w/call/proof.d.ts +27 -0
- package/dist/cjs/w/call/proof.js +124 -0
- package/dist/cjs/w/call/repository.d.ts +97 -0
- package/dist/cjs/w/call/repository.js +1324 -0
- package/dist/cjs/w/call/resource.d.ts +27 -0
- package/dist/cjs/w/call/resource.js +149 -0
- package/dist/cjs/w/call/reward.d.ts +52 -0
- package/dist/cjs/w/call/reward.js +879 -0
- package/dist/cjs/w/call/service.d.ts +184 -0
- package/dist/cjs/w/call/service.js +2468 -0
- package/dist/cjs/w/call/treasury.d.ts +77 -0
- package/dist/cjs/w/call/treasury.js +1192 -0
- package/dist/cjs/w/call/util.d.ts +12 -0
- package/dist/cjs/w/call/util.js +661 -0
- package/dist/cjs/w/common.d.ts +359 -0
- package/dist/cjs/w/common.js +625 -0
- package/dist/cjs/w/exception.d.ts +82 -0
- package/dist/cjs/w/exception.js +604 -0
- package/dist/cjs/w/index.d.ts +8 -0
- package/dist/cjs/w/index.js +25 -0
- package/dist/cjs/w/local/.eslintrc.js +15 -0
- package/dist/cjs/w/local/account.d.ts +134 -0
- package/dist/cjs/w/local/account.js +770 -0
- package/dist/cjs/w/local/cache.d.ts +35 -0
- package/dist/cjs/w/local/cache.js +181 -0
- package/dist/cjs/w/local/config.d.ts +15 -0
- package/dist/cjs/w/local/config.js +83 -0
- package/dist/cjs/w/local/index.d.ts +193 -0
- package/dist/cjs/w/local/index.js +322 -0
- package/dist/cjs/w/local/local.d.ts +93 -0
- package/dist/cjs/w/local/local.js +673 -0
- package/dist/cjs/w/local/storage.d.ts +61 -0
- package/dist/cjs/w/local/storage.js +219 -0
- package/dist/cjs/w/local/token.d.ts +22 -0
- package/dist/cjs/w/local/token.js +182 -0
- package/dist/cjs/w/local/util.d.ts +5 -0
- package/dist/cjs/w/local/util.js +57 -0
- package/dist/cjs/w/local/wip.d.ts +218 -0
- package/dist/cjs/w/local/wip.js +911 -0
- package/dist/cjs/w/messenger/.eslintrc.js +15 -0
- package/dist/cjs/w/messenger/crypto.d.ts +269 -0
- package/dist/cjs/w/messenger/crypto.js +448 -0
- package/dist/cjs/w/messenger/index.d.ts +23 -0
- package/dist/cjs/w/messenger/index.js +37 -0
- package/dist/cjs/w/messenger/messenger-api.d.ts +225 -0
- package/dist/cjs/w/messenger/messenger-api.js +1247 -0
- package/dist/cjs/w/messenger/messenger-manager.d.ts +80 -0
- package/dist/cjs/w/messenger/messenger-manager.js +1143 -0
- package/dist/cjs/w/messenger/messenger.d.ts +231 -0
- package/dist/cjs/w/messenger/messenger.js +1512 -0
- package/dist/cjs/w/messenger/server.d.ts +134 -0
- package/dist/cjs/w/messenger/server.js +535 -0
- package/dist/cjs/w/messenger/session.d.ts +78 -0
- package/dist/cjs/w/messenger/session.js +418 -0
- package/dist/cjs/w/messenger/storage.d.ts +192 -0
- package/dist/cjs/w/messenger/storage.js +964 -0
- package/dist/cjs/w/messenger/types.d.ts +705 -0
- package/dist/cjs/w/messenger/types.js +107 -0
- package/dist/cjs/w/messenger/utils.d.ts +15 -0
- package/dist/cjs/w/messenger/utils.js +37 -0
- package/dist/cjs/w/query/bult-in.d.ts +73 -0
- package/dist/cjs/w/query/bult-in.js +121 -0
- package/dist/cjs/w/query/event.d.ts +82 -0
- package/dist/cjs/w/query/event.js +157 -0
- package/dist/cjs/w/query/index.d.ts +5 -0
- package/dist/cjs/w/query/index.js +22 -0
- package/dist/cjs/w/query/object.d.ts +658 -0
- package/dist/cjs/w/query/object.js +1671 -0
- package/dist/cjs/w/query/received.d.ts +34 -0
- package/dist/cjs/w/query/received.js +93 -0
- package/dist/cjs/w/query/util.d.ts +5 -0
- package/dist/cjs/w/query/util.js +82 -0
- package/dist/cjs/w/util.d.ts +19 -0
- package/dist/cjs/w/util.js +715 -0
- package/dist/cjs/zklogin/address.js +93 -0
- package/dist/cjs/zklogin/bcs.js +41 -0
- package/dist/cjs/zklogin/index.js +45 -0
- package/dist/cjs/zklogin/jwt-decode.js +88 -0
- package/dist/cjs/zklogin/jwt-utils.js +128 -0
- package/dist/cjs/zklogin/nonce.js +60 -0
- package/dist/cjs/zklogin/poseidon.js +64 -0
- package/dist/cjs/zklogin/publickey.js +281 -0
- package/dist/cjs/zklogin/signature.js +57 -0
- package/dist/cjs/zklogin/utils.js +98 -0
- package/dist/esm/bcs/bcs.d.ts +1973 -0
- package/dist/esm/bcs/bcs.js +319 -0
- package/dist/esm/bcs/effects.d.ts +579 -0
- package/dist/esm/bcs/effects.js +211 -0
- package/dist/esm/bcs/index.d.ts +2589 -0
- package/dist/esm/bcs/index.js +98 -0
- package/dist/esm/bcs/pure.d.ts +22 -0
- package/dist/esm/bcs/pure.js +42 -0
- package/dist/esm/bcs/type-tag-serializer.d.ts +7 -0
- package/dist/esm/bcs/type-tag-serializer.js +104 -0
- package/dist/esm/bcs/types.d.ts +114 -0
- package/dist/esm/bcs/types.js +6 -0
- package/dist/esm/client/index.d.ts +5 -0
- package/dist/esm/client/index.js +23 -0
- package/dist/esm/client/network.d.ts +5 -0
- package/dist/esm/client/network.js +23 -0
- package/dist/esm/cryptography/index.d.ts +7 -0
- package/dist/esm/cryptography/index.js +46 -0
- package/dist/esm/cryptography/intent.d.ts +6 -0
- package/dist/esm/cryptography/intent.js +14 -0
- package/dist/esm/cryptography/keypair.d.ts +73 -0
- package/dist/esm/cryptography/keypair.js +108 -0
- package/dist/esm/cryptography/mnemonics.d.ts +27 -0
- package/dist/esm/cryptography/mnemonics.js +30 -0
- package/dist/esm/cryptography/publickey.d.ts +67 -0
- package/dist/esm/cryptography/publickey.js +125 -0
- package/dist/esm/cryptography/signature-scheme.d.ts +24 -0
- package/dist/esm/cryptography/signature-scheme.js +27 -0
- package/dist/esm/cryptography/signature.d.ts +62 -0
- package/dist/esm/cryptography/signature.js +54 -0
- package/dist/esm/experimental/cache.d.ts +12 -0
- package/dist/esm/experimental/client.d.ts +12 -0
- package/dist/esm/experimental/core.d.ts +33 -0
- package/dist/esm/experimental/errors.d.ts +8 -0
- package/dist/esm/experimental/index.d.ts +7 -0
- package/dist/esm/experimental/persistent-storage.d.ts +134 -0
- package/dist/esm/experimental/persistent-storage.test.d.ts +5 -0
- package/dist/esm/experimental/transports/utils.d.ts +3 -0
- package/dist/esm/experimental/types.d.ts +367 -0
- package/dist/esm/faucet/faucet.d.ts +66 -0
- package/dist/esm/faucet/faucet.js +118 -0
- package/dist/esm/faucet/index.d.ts +1 -0
- package/dist/esm/faucet/index.js +16 -0
- package/dist/esm/graphql/client.js +79 -0
- package/dist/esm/graphql/core.js +505 -0
- package/dist/esm/graphql/generated/2024.1/tada-env.js +13121 -0
- package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +16 -0
- package/dist/esm/graphql/generated/2024.4/tada-env.js +13267 -0
- package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +16 -0
- package/dist/esm/graphql/generated/latest/tada-env.js +12905 -0
- package/dist/esm/graphql/generated/latest/tsconfig.tada.js +16 -0
- package/dist/esm/graphql/generated/queries.js +788 -0
- package/dist/esm/graphql/index.js +8 -0
- package/dist/esm/graphql/schemas/2024.1/index.js +8 -0
- package/dist/esm/graphql/schemas/2024.4/index.js +8 -0
- package/dist/esm/graphql/schemas/latest/index.js +8 -0
- package/dist/esm/graphql/types.js +0 -0
- package/dist/esm/grpc/client.d.ts +32 -0
- package/dist/esm/grpc/client.js +45 -0
- package/dist/esm/grpc/core.d.ts +28 -0
- package/dist/esm/grpc/core.js +634 -0
- package/dist/esm/grpc/index.d.ts +4 -0
- package/dist/esm/grpc/index.js +6 -0
- package/dist/esm/grpc/proto/google/protobuf/any.d.ts +173 -0
- package/dist/esm/grpc/proto/google/protobuf/any.js +118 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.d.ts +104 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.js +74 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.d.ts +25 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.js +10 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +57 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.d.ts +169 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.js +204 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +114 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.d.ts +525 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.js +297 -0
- package/dist/esm/grpc/proto/google/rpc/status.d.ts +46 -0
- package/dist/esm/grpc/proto/google/rpc/status.js +32 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +50 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +32 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +25 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +57 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +64 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +150 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +280 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +67 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +9 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +66 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +67 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +499 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +43 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +65 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +61 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +103 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +348 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +465 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +62 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +221 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +36 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +121 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +94 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +33 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +43 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +521 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +13 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +31 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +70 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +69 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +526 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +35 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +45 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +720 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +985 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +30 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +157 -0
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.js +119 -0
- package/dist/esm/jsonRpc/client.d.ts +261 -0
- package/dist/esm/jsonRpc/client.js +734 -0
- package/dist/esm/jsonRpc/core.d.ts +87 -0
- package/dist/esm/jsonRpc/core.js +621 -0
- package/dist/esm/jsonRpc/errors.d.ts +12 -0
- package/dist/esm/jsonRpc/errors.js +46 -0
- package/dist/esm/jsonRpc/http-transport.d.ts +42 -0
- package/dist/esm/jsonRpc/http-transport.js +101 -0
- package/dist/esm/jsonRpc/index.d.ts +4 -0
- package/dist/esm/jsonRpc/index.js +20 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.d.ts +4 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.js +309 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.d.ts +43 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.js +201 -0
- package/dist/esm/jsonRpc/types/chain.d.ts +99 -0
- package/dist/esm/jsonRpc/types/chain.js +0 -0
- package/dist/esm/jsonRpc/types/changes.d.ts +19 -0
- package/dist/esm/jsonRpc/types/changes.js +0 -0
- package/dist/esm/jsonRpc/types/coins.d.ts +6 -0
- package/dist/esm/jsonRpc/types/coins.js +0 -0
- package/dist/esm/jsonRpc/types/common.d.ts +2 -0
- package/dist/esm/jsonRpc/types/common.js +0 -0
- package/dist/esm/jsonRpc/types/generated.d.ts +1492 -0
- package/dist/esm/jsonRpc/types/generated.js +0 -0
- package/dist/esm/jsonRpc/types/index.d.ts +6 -0
- package/dist/esm/jsonRpc/types/index.js +0 -0
- package/dist/esm/jsonRpc/types/params.d.ts +656 -0
- package/dist/esm/jsonRpc/types/params.js +0 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +62 -0
- package/dist/esm/keypairs/ed25519/index.d.ts +2 -0
- package/dist/esm/keypairs/ed25519/index.js +10 -0
- package/dist/esm/keypairs/ed25519/keypair.d.ts +74 -0
- package/dist/esm/keypairs/ed25519/keypair.js +158 -0
- package/dist/esm/keypairs/ed25519/publickey.d.ts +30 -0
- package/dist/esm/keypairs/ed25519/publickey.js +75 -0
- package/dist/esm/keypairs/index.d.ts +4 -0
- package/dist/esm/keypairs/index.js +4 -0
- package/dist/esm/keypairs/passkey/index.d.ts +3 -0
- package/dist/esm/keypairs/passkey/index.js +12 -0
- package/dist/esm/keypairs/passkey/keypair.d.ts +113 -0
- package/dist/esm/keypairs/passkey/keypair.js +258 -0
- package/dist/esm/keypairs/passkey/publickey.d.ts +72 -0
- package/dist/esm/keypairs/passkey/publickey.js +156 -0
- package/dist/esm/keypairs/passkey/types.d.ts +12 -0
- package/dist/esm/keypairs/passkey/types.js +0 -0
- package/dist/esm/keypairs/secp256k1/index.d.ts +2 -0
- package/dist/esm/keypairs/secp256k1/index.js +10 -0
- package/dist/esm/keypairs/secp256k1/keypair.d.ts +73 -0
- package/dist/esm/keypairs/secp256k1/keypair.js +147 -0
- package/dist/esm/keypairs/secp256k1/publickey.d.ts +30 -0
- package/dist/esm/keypairs/secp256k1/publickey.js +80 -0
- package/dist/esm/keypairs/secp256r1/index.d.ts +2 -0
- package/dist/esm/keypairs/secp256r1/index.js +10 -0
- package/dist/esm/keypairs/secp256r1/keypair.d.ts +73 -0
- package/dist/esm/keypairs/secp256r1/keypair.js +143 -0
- package/dist/esm/keypairs/secp256r1/publickey.d.ts +30 -0
- package/dist/esm/keypairs/secp256r1/publickey.js +77 -0
- package/dist/esm/multisig/index.d.ts +2 -0
- package/dist/esm/multisig/index.js +10 -0
- package/dist/esm/multisig/publickey.d.ts +79 -0
- package/dist/esm/multisig/publickey.js +280 -0
- package/dist/esm/multisig/signer.d.ts +20 -0
- package/dist/esm/multisig/signer.js +94 -0
- package/dist/esm/package.json +5 -0
- package/dist/esm/transactions/Arguments.d.ts +57 -0
- package/dist/esm/transactions/Arguments.js +16 -0
- package/dist/esm/transactions/Commands.d.ts +57 -0
- package/dist/esm/transactions/Commands.js +123 -0
- package/dist/esm/transactions/Inputs.d.ts +22 -0
- package/dist/esm/transactions/Inputs.js +67 -0
- package/dist/esm/transactions/ObjectCache.d.ts +83 -0
- package/dist/esm/transactions/ObjectCache.js +231 -0
- package/dist/esm/transactions/Transaction.d.ts +710 -0
- package/dist/esm/transactions/Transaction.js +731 -0
- package/dist/esm/transactions/TransactionData.d.ts +73 -0
- package/dist/esm/transactions/TransactionData.js +453 -0
- package/dist/esm/transactions/__tests__/Transaction.test.d.ts +1 -0
- package/dist/esm/transactions/__tests__/bcs.test.d.ts +1 -0
- package/dist/esm/transactions/data/internal.d.ts +1010 -0
- package/dist/esm/transactions/data/internal.js +232 -0
- package/dist/esm/transactions/data/v1.d.ts +312 -0
- package/dist/esm/transactions/data/v1.js +542 -0
- package/dist/esm/transactions/data/v2.d.ts +153 -0
- package/dist/esm/transactions/data/v2.js +126 -0
- package/dist/esm/transactions/executor/caching.d.ts +31 -0
- package/dist/esm/transactions/executor/caching.js +99 -0
- package/dist/esm/transactions/executor/parallel.d.ts +37 -0
- package/dist/esm/transactions/executor/parallel.js +375 -0
- package/dist/esm/transactions/executor/queue.d.ts +11 -0
- package/dist/esm/transactions/executor/queue.js +68 -0
- package/dist/esm/transactions/executor/serial.d.ts +31 -0
- package/dist/esm/transactions/executor/serial.js +116 -0
- package/dist/esm/transactions/hash.d.ts +7 -0
- package/dist/esm/transactions/hash.js +11 -0
- package/dist/esm/transactions/index.d.ts +21 -0
- package/dist/esm/transactions/index.js +41 -0
- package/dist/esm/transactions/intents/CoinWithBalance.d.ts +9 -0
- package/dist/esm/transactions/intents/CoinWithBalance.js +186 -0
- package/dist/esm/transactions/object.d.ts +24 -0
- package/dist/esm/transactions/object.js +96 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +17 -0
- package/dist/esm/transactions/pure.d.ts +20 -0
- package/dist/esm/transactions/pure.js +44 -0
- package/dist/esm/transactions/resolve.d.ts +13 -0
- package/dist/esm/transactions/resolve.js +83 -0
- package/dist/esm/transactions/serializer.d.ts +7 -0
- package/dist/esm/transactions/serializer.js +169 -0
- package/dist/esm/transactions/utils.d.ts +10 -0
- package/dist/esm/transactions/utils.js +123 -0
- package/dist/esm/utils/constants.d.ts +17 -0
- package/dist/esm/utils/constants.js +37 -0
- package/dist/esm/utils/derived-objects.d.ts +5 -0
- package/dist/esm/utils/derived-objects.js +13 -0
- package/dist/esm/utils/dynamic-fields.d.ts +2 -0
- package/dist/esm/utils/dynamic-fields.js +20 -0
- package/dist/esm/utils/format.d.ts +2 -0
- package/dist/esm/utils/format.js +15 -0
- package/dist/esm/utils/index.d.ts +8 -0
- package/dist/esm/utils/index.js +76 -0
- package/dist/esm/utils/move-registry.d.ts +6 -0
- package/dist/esm/utils/move-registry.js +24 -0
- package/dist/esm/utils/sui-types.d.ts +26 -0
- package/dist/esm/utils/sui-types.js +70 -0
- package/dist/esm/utils/suins.d.ts +2 -0
- package/dist/esm/utils/suins.js +36 -0
- package/dist/esm/verify/index.d.ts +1 -0
- package/dist/esm/verify/index.js +14 -0
- package/dist/esm/verify/verify.d.ts +16 -0
- package/dist/esm/verify/verify.js +108 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +6 -0
- package/dist/esm/w/call/allocation.d.ts +35 -0
- package/dist/esm/w/call/allocation.js +433 -0
- package/dist/esm/w/call/arb.d.ts +17 -0
- package/dist/esm/w/call/arb.js +138 -0
- package/dist/esm/w/call/arbitration.d.ts +106 -0
- package/dist/esm/w/call/arbitration.js +1620 -0
- package/dist/esm/w/call/base.d.ts +42 -0
- package/dist/esm/w/call/base.js +350 -0
- package/dist/esm/w/call/contact.d.ts +45 -0
- package/dist/esm/w/call/contact.js +474 -0
- package/dist/esm/w/call/demand.d.ts +79 -0
- package/dist/esm/w/call/demand.js +869 -0
- package/dist/esm/w/call/entity.d.ts +33 -0
- package/dist/esm/w/call/entity.js +220 -0
- package/dist/esm/w/call/guard-ins.d.ts +31 -0
- package/dist/esm/w/call/guard-ins.js +4371 -0
- package/dist/esm/w/call/guard.d.ts +254 -0
- package/dist/esm/w/call/guard.js +1202 -0
- package/dist/esm/w/call/index.d.ts +37 -0
- package/dist/esm/w/call/index.js +57 -0
- package/dist/esm/w/call/machine.d.ts +124 -0
- package/dist/esm/w/call/machine.js +1492 -0
- package/dist/esm/w/call/order.d.ts +73 -0
- package/dist/esm/w/call/order.js +481 -0
- package/dist/esm/w/call/passport.d.ts +24 -0
- package/dist/esm/w/call/passport.js +266 -0
- package/dist/esm/w/call/payment.d.ts +27 -0
- package/dist/esm/w/call/payment.js +233 -0
- package/dist/esm/w/call/permission.d.ts +222 -0
- package/dist/esm/w/call/permission.js +1375 -0
- package/dist/esm/w/call/personal.d.ts +51 -0
- package/dist/esm/w/call/personal.js +177 -0
- package/dist/esm/w/call/progress.d.ts +94 -0
- package/dist/esm/w/call/progress.js +827 -0
- package/dist/esm/w/call/proof.d.ts +27 -0
- package/dist/esm/w/call/proof.js +110 -0
- package/dist/esm/w/call/repository.d.ts +97 -0
- package/dist/esm/w/call/repository.js +1325 -0
- package/dist/esm/w/call/resource.d.ts +27 -0
- package/dist/esm/w/call/resource.js +135 -0
- package/dist/esm/w/call/reward.d.ts +52 -0
- package/dist/esm/w/call/reward.js +874 -0
- package/dist/esm/w/call/service.d.ts +184 -0
- package/dist/esm/w/call/service.js +2472 -0
- package/dist/esm/w/call/treasury.d.ts +77 -0
- package/dist/esm/w/call/treasury.js +1186 -0
- package/dist/esm/w/call/util.d.ts +12 -0
- package/dist/esm/w/call/util.js +646 -0
- package/dist/esm/w/common.d.ts +359 -0
- package/dist/esm/w/common.js +605 -0
- package/dist/esm/w/exception.d.ts +82 -0
- package/dist/esm/w/exception.js +585 -0
- package/dist/esm/w/index.d.ts +8 -0
- package/dist/esm/w/index.js +8 -0
- package/dist/esm/w/local/.eslintrc.js +23 -0
- package/dist/esm/w/local/account.d.ts +134 -0
- package/dist/esm/w/local/account.js +746 -0
- package/dist/esm/w/local/cache.d.ts +35 -0
- package/dist/esm/w/local/cache.js +162 -0
- package/dist/esm/w/local/config.d.ts +15 -0
- package/dist/esm/w/local/config.js +64 -0
- package/dist/esm/w/local/index.d.ts +193 -0
- package/dist/esm/w/local/index.js +301 -0
- package/dist/esm/w/local/local.d.ts +93 -0
- package/dist/esm/w/local/local.js +654 -0
- package/dist/esm/w/local/storage.d.ts +61 -0
- package/dist/esm/w/local/storage.js +190 -0
- package/dist/esm/w/local/token.d.ts +22 -0
- package/dist/esm/w/local/token.js +163 -0
- package/dist/esm/w/local/util.d.ts +5 -0
- package/dist/esm/w/local/util.js +27 -0
- package/dist/esm/w/local/wip.d.ts +218 -0
- package/dist/esm/w/local/wip.js +882 -0
- package/dist/esm/w/messenger/.eslintrc.js +23 -0
- package/dist/esm/w/messenger/crypto.d.ts +269 -0
- package/dist/esm/w/messenger/crypto.js +428 -0
- package/dist/esm/w/messenger/index.d.ts +23 -0
- package/dist/esm/w/messenger/index.js +25 -0
- package/dist/esm/w/messenger/messenger-api.d.ts +225 -0
- package/dist/esm/w/messenger/messenger-api.js +1228 -0
- package/dist/esm/w/messenger/messenger-manager.d.ts +80 -0
- package/dist/esm/w/messenger/messenger-manager.js +1118 -0
- package/dist/esm/w/messenger/messenger.d.ts +231 -0
- package/dist/esm/w/messenger/messenger.js +1492 -0
- package/dist/esm/w/messenger/server.d.ts +134 -0
- package/dist/esm/w/messenger/server.js +520 -0
- package/dist/esm/w/messenger/session.d.ts +78 -0
- package/dist/esm/w/messenger/session.js +415 -0
- package/dist/esm/w/messenger/storage.d.ts +192 -0
- package/dist/esm/w/messenger/storage.js +935 -0
- package/dist/esm/w/messenger/types.d.ts +705 -0
- package/dist/esm/w/messenger/types.js +88 -0
- package/dist/esm/w/messenger/utils.d.ts +15 -0
- package/dist/esm/w/messenger/utils.js +17 -0
- package/dist/esm/w/query/bult-in.d.ts +73 -0
- package/dist/esm/w/query/bult-in.js +112 -0
- package/dist/esm/w/query/event.d.ts +82 -0
- package/dist/esm/w/query/event.js +137 -0
- package/dist/esm/w/query/index.d.ts +5 -0
- package/dist/esm/w/query/index.js +5 -0
- package/dist/esm/w/query/object.d.ts +658 -0
- package/dist/esm/w/query/object.js +1648 -0
- package/dist/esm/w/query/received.d.ts +34 -0
- package/dist/esm/w/query/received.js +73 -0
- package/dist/esm/w/query/util.d.ts +5 -0
- package/dist/esm/w/query/util.js +62 -0
- package/dist/esm/w/util.d.ts +19 -0
- package/dist/esm/w/util.js +710 -0
- package/dist/esm/zklogin/address.js +78 -0
- package/dist/esm/zklogin/bcs.js +21 -0
- package/dist/esm/zklogin/index.js +38 -0
- package/dist/esm/zklogin/jwt-decode.js +68 -0
- package/dist/esm/zklogin/jwt-utils.js +108 -0
- package/dist/esm/zklogin/nonce.js +40 -0
- package/dist/esm/zklogin/poseidon.js +61 -0
- package/dist/esm/zklogin/publickey.js +265 -0
- package/dist/esm/zklogin/signature.js +37 -0
- package/dist/esm/zklogin/utils.js +78 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +295 -61
- package/dist/arbitration.d.ts +0 -65
- package/dist/arbitration.d.ts.map +0 -1
- package/dist/arbitration.js +0 -517
- package/dist/arbitration.js.map +0 -1
- package/dist/demand.d.ts +0 -27
- package/dist/demand.d.ts.map +0 -1
- package/dist/demand.js +0 -266
- package/dist/demand.js.map +0 -1
- package/dist/entity.d.ts +0 -46
- package/dist/entity.d.ts.map +0 -1
- package/dist/entity.js +0 -146
- package/dist/entity.js.map +0 -1
- package/dist/exception.d.ts +0 -37
- package/dist/exception.d.ts.map +0 -1
- package/dist/exception.js +0 -41
- package/dist/exception.js.map +0 -1
- package/dist/guard.d.ts +0 -110
- package/dist/guard.d.ts.map +0 -1
- package/dist/guard.js +0 -936
- package/dist/guard.js.map +0 -1
- package/dist/index.d.ts +0 -40
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/machine.d.ts +0 -68
- package/dist/machine.d.ts.map +0 -1
- package/dist/machine.js +0 -520
- package/dist/machine.js.map +0 -1
- package/dist/passport.d.ts +0 -129
- package/dist/passport.d.ts.map +0 -1
- package/dist/passport.js +0 -1233
- package/dist/passport.js.map +0 -1
- package/dist/payment.d.ts +0 -28
- package/dist/payment.d.ts.map +0 -1
- package/dist/payment.js +0 -60
- package/dist/payment.js.map +0 -1
- package/dist/permission.d.ts +0 -155
- package/dist/permission.d.ts.map +0 -1
- package/dist/permission.js +0 -462
- package/dist/permission.js.map +0 -1
- package/dist/progress.d.ts +0 -66
- package/dist/progress.d.ts.map +0 -1
- package/dist/progress.js +0 -311
- package/dist/progress.js.map +0 -1
- package/dist/protocol.d.ts +0 -247
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -726
- package/dist/protocol.js.map +0 -1
- package/dist/repository.d.ts +0 -94
- package/dist/repository.d.ts.map +0 -1
- package/dist/repository.js +0 -783
- package/dist/repository.js.map +0 -1
- package/dist/resource.d.ts +0 -36
- package/dist/resource.d.ts.map +0 -1
- package/dist/resource.js +0 -129
- package/dist/resource.js.map +0 -1
- package/dist/service.d.ts +0 -144
- package/dist/service.d.ts.map +0 -1
- package/dist/service.js +0 -1303
- package/dist/service.js.map +0 -1
- package/dist/treasury.d.ts +0 -55
- package/dist/treasury.d.ts.map +0 -1
- package/dist/treasury.js +0 -393
- package/dist/treasury.js.map +0 -1
- package/dist/utils.d.ts +0 -94
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -582
- package/dist/utils.js.map +0 -1
- package/dist/wowok.d.ts +0 -15
- package/dist/wowok.d.ts.map +0 -1
- package/dist/wowok.js +0 -66
- package/dist/wowok.js.map +0 -1
|
@@ -0,0 +1,1492 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import {
|
|
5
|
+
toTxObject,
|
|
6
|
+
toTxString,
|
|
7
|
+
isValidName,
|
|
8
|
+
isValidDescription,
|
|
9
|
+
PackageAddress,
|
|
10
|
+
MAX_NAME_LENGTH,
|
|
11
|
+
isValidU16,
|
|
12
|
+
isValidArray,
|
|
13
|
+
isValidU8,
|
|
14
|
+
isValidU32,
|
|
15
|
+
GetObjectExisted,
|
|
16
|
+
GetObject,
|
|
17
|
+
GetObjectDescription,
|
|
18
|
+
machineFn
|
|
19
|
+
} from "../common.js";
|
|
20
|
+
import { W_ERROR, WErrors } from "../exception.js";
|
|
21
|
+
import { ObjectType, query_table, query_objects } from "../query/object.js";
|
|
22
|
+
import { writeFileSync } from "fs";
|
|
23
|
+
import { CallBase } from "./base.js";
|
|
24
|
+
import { BuiltinPermissionIndex, newPermission } from "./permission.js";
|
|
25
|
+
import { create as permission_create } from "./permission.js";
|
|
26
|
+
import { owner_receive, validObjects } from "../util.js";
|
|
27
|
+
import { LocalMark } from "../local/local.js";
|
|
28
|
+
import { GetManyAccountOrMark_Address } from "../local/index.js";
|
|
29
|
+
import {
|
|
30
|
+
context_repository_add,
|
|
31
|
+
context_repository_clear,
|
|
32
|
+
context_repository_remove,
|
|
33
|
+
MAX_CONTEXT_REPOSITORY_COUNT,
|
|
34
|
+
namedOperator_add,
|
|
35
|
+
namedOperator_remove,
|
|
36
|
+
namedOperator_set,
|
|
37
|
+
newProgress,
|
|
38
|
+
create as createProgress
|
|
39
|
+
} from "./progress.js";
|
|
40
|
+
import { query_received } from "../query/received.js";
|
|
41
|
+
class CallMachine extends CallBase {
|
|
42
|
+
constructor(data) {
|
|
43
|
+
super();
|
|
44
|
+
__publicField(this, "data");
|
|
45
|
+
__publicField(this, "object_address");
|
|
46
|
+
__publicField(this, "permission_address");
|
|
47
|
+
__publicField(this, "new_permission_description");
|
|
48
|
+
this.data = data;
|
|
49
|
+
}
|
|
50
|
+
async prepare(env) {
|
|
51
|
+
await super.prepare(env);
|
|
52
|
+
if (!this.object_address) {
|
|
53
|
+
this.object_address = await GetObjectExisted(this.data?.object);
|
|
54
|
+
}
|
|
55
|
+
if (this.object_address) {
|
|
56
|
+
await this.update_content(
|
|
57
|
+
env,
|
|
58
|
+
ObjectType.Machine,
|
|
59
|
+
this.object_address
|
|
60
|
+
);
|
|
61
|
+
if (!this.content)
|
|
62
|
+
W_ERROR(
|
|
63
|
+
WErrors.InvalidParam,
|
|
64
|
+
"CallMachine_Data.data.object:" + this.object_address
|
|
65
|
+
);
|
|
66
|
+
this.permission_address = this.content.permission;
|
|
67
|
+
if (!this.permission_address) {
|
|
68
|
+
W_ERROR(
|
|
69
|
+
WErrors.InvalidParam,
|
|
70
|
+
"CallMachine_Data.data.object.permission is empty"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
const n = GetObject(this.data.object);
|
|
75
|
+
this.permission_address = await GetObjectExisted(n?.permission);
|
|
76
|
+
this.new_permission_description = GetObjectDescription(
|
|
77
|
+
n?.permission
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async call(env) {
|
|
82
|
+
await this.prepare(env);
|
|
83
|
+
const perms = [];
|
|
84
|
+
const guards = [];
|
|
85
|
+
const add_perm = (index) => {
|
|
86
|
+
if (this.permission_address && !perms.includes(index)) {
|
|
87
|
+
perms.push(index);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const content = this.content;
|
|
91
|
+
if (this.permission_address && !this.object_address) {
|
|
92
|
+
add_perm(BuiltinPermissionIndex.MACHINE_NEW);
|
|
93
|
+
}
|
|
94
|
+
if (this.data?.progress_new != null) {
|
|
95
|
+
if (!content) {
|
|
96
|
+
W_ERROR(
|
|
97
|
+
WErrors.InvalidParam,
|
|
98
|
+
`CallMachine_Data.data.progress_new fail because the Machine ${JSON.stringify(this.data.object)} content not ready`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
add_perm(BuiltinPermissionIndex.PROGRESS_NEW);
|
|
102
|
+
if (this.data.progress_new.repository != null) {
|
|
103
|
+
add_perm(BuiltinPermissionIndex.PROGRESS_CONTEXT_REPOSITORY);
|
|
104
|
+
}
|
|
105
|
+
if (this.data.progress_new.progress_namedOperator != null) {
|
|
106
|
+
add_perm(BuiltinPermissionIndex.PROGRESS_NAMED_OPERATOR);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (this.permission_address && this.data?.description != null && this.object_address) {
|
|
110
|
+
add_perm(BuiltinPermissionIndex.MACHINE_DESCRIPTION);
|
|
111
|
+
}
|
|
112
|
+
if (this.permission_address && this.data.repository) {
|
|
113
|
+
add_perm(BuiltinPermissionIndex.MACHINE_CONSENSUS_REPOSITORIES);
|
|
114
|
+
}
|
|
115
|
+
if (this.permission_address && this.data.node) {
|
|
116
|
+
add_perm(BuiltinPermissionIndex.MACHINE_NODE);
|
|
117
|
+
}
|
|
118
|
+
if (this.permission_address && this.data?.pause !== void 0) {
|
|
119
|
+
add_perm(BuiltinPermissionIndex.MACHINE_PAUSE);
|
|
120
|
+
}
|
|
121
|
+
if (this.permission_address && this.data?.publish !== void 0) {
|
|
122
|
+
add_perm(BuiltinPermissionIndex.MACHINE_PUBLISH);
|
|
123
|
+
}
|
|
124
|
+
if (this.permission_address && this.data?.owner_receive) {
|
|
125
|
+
add_perm(BuiltinPermissionIndex.MACHINE_OWNER_RECEIVE);
|
|
126
|
+
}
|
|
127
|
+
if (this.permission_address && this.data.um !== void 0) {
|
|
128
|
+
add_perm(BuiltinPermissionIndex.MACHINE_UM);
|
|
129
|
+
}
|
|
130
|
+
if (this.permission_address || guards.length > 0) {
|
|
131
|
+
return await this.check_permission_and_call(
|
|
132
|
+
env,
|
|
133
|
+
this.permission_address,
|
|
134
|
+
perms,
|
|
135
|
+
guards
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
return await this.exec(env);
|
|
139
|
+
}
|
|
140
|
+
async operate(env, tx, passport, submission) {
|
|
141
|
+
let permission = this.permission_address;
|
|
142
|
+
let object = this.object_address;
|
|
143
|
+
const content = this.content;
|
|
144
|
+
if (!this.object_address) {
|
|
145
|
+
if (!permission) {
|
|
146
|
+
permission = newPermission(
|
|
147
|
+
tx,
|
|
148
|
+
this.new_permission_description ?? ""
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
if (permission) {
|
|
152
|
+
object = newMachine(
|
|
153
|
+
tx,
|
|
154
|
+
toTxObject(tx, permission),
|
|
155
|
+
this.data?.description ?? "",
|
|
156
|
+
passport
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (!object || !permission) {
|
|
161
|
+
W_ERROR(
|
|
162
|
+
WErrors.InvalidParam,
|
|
163
|
+
"CallMachine_Data.data.object:" + this.object_address
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if (this.data.progress_new != null) {
|
|
167
|
+
if (!content) {
|
|
168
|
+
W_ERROR(
|
|
169
|
+
WErrors.InvalidParam,
|
|
170
|
+
`CallMachine_Data.data.progress_new fail because the Machine ${JSON.stringify(this.data.object)} content not ready`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
if (this.data.progress_new.task != null) {
|
|
174
|
+
const t = await GetObjectExisted(this.data.progress_new.task);
|
|
175
|
+
if (t) {
|
|
176
|
+
this.data.progress_new.task = t;
|
|
177
|
+
} else {
|
|
178
|
+
W_ERROR(
|
|
179
|
+
WErrors.InvalidParam,
|
|
180
|
+
`CallMachine_Data.data.progress_new.task: ${this.data.progress_new.task} not found`
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const progress = newProgress(
|
|
185
|
+
tx,
|
|
186
|
+
object,
|
|
187
|
+
permission,
|
|
188
|
+
this.data.progress_new.task ?? null,
|
|
189
|
+
passport
|
|
190
|
+
);
|
|
191
|
+
if (this.data.progress_new.repository != null) {
|
|
192
|
+
switch (this.data.progress_new.repository.op) {
|
|
193
|
+
case "add":
|
|
194
|
+
case "set": {
|
|
195
|
+
if (this.data.progress_new.repository.objects.length > MAX_CONTEXT_REPOSITORY_COUNT) {
|
|
196
|
+
W_ERROR(
|
|
197
|
+
WErrors.InvalidParam,
|
|
198
|
+
`CallProgress_Data.data.progress_new.repository.objects exceeds max count:${this.data.progress_new.repository.objects}`
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
if (this.data.progress_new.repository.op === "set") {
|
|
202
|
+
context_repository_clear(
|
|
203
|
+
tx,
|
|
204
|
+
progress,
|
|
205
|
+
object,
|
|
206
|
+
permission
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
const r = await LocalMark.Instance().get_many_address_availables(
|
|
210
|
+
this.data.progress_new.repository.objects
|
|
211
|
+
);
|
|
212
|
+
r.forEach((repo) => {
|
|
213
|
+
context_repository_add(
|
|
214
|
+
tx,
|
|
215
|
+
progress,
|
|
216
|
+
object,
|
|
217
|
+
permission,
|
|
218
|
+
repo,
|
|
219
|
+
passport
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
case "remove": {
|
|
225
|
+
if (this.data.progress_new.repository.objects.length > MAX_CONTEXT_REPOSITORY_COUNT) {
|
|
226
|
+
W_ERROR(
|
|
227
|
+
WErrors.InvalidParam,
|
|
228
|
+
`CallProgress_Data.data.progress_new.repository.objects exceeds max count:${this.data.progress_new.repository.objects}`
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
const addrs = await LocalMark.Instance().get_many_address_availables(
|
|
232
|
+
this.data.progress_new.repository.objects
|
|
233
|
+
);
|
|
234
|
+
context_repository_remove(
|
|
235
|
+
tx,
|
|
236
|
+
progress,
|
|
237
|
+
object,
|
|
238
|
+
permission,
|
|
239
|
+
addrs,
|
|
240
|
+
passport
|
|
241
|
+
);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
case "clear":
|
|
245
|
+
context_repository_clear(
|
|
246
|
+
tx,
|
|
247
|
+
progress,
|
|
248
|
+
object,
|
|
249
|
+
permission,
|
|
250
|
+
passport
|
|
251
|
+
);
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (this.data.progress_new.progress_namedOperator != null) {
|
|
256
|
+
switch (this.data.progress_new.progress_namedOperator.op) {
|
|
257
|
+
case "add": {
|
|
258
|
+
const r = await GetManyAccountOrMark_Address(
|
|
259
|
+
this.data.progress_new.progress_namedOperator.operators
|
|
260
|
+
);
|
|
261
|
+
namedOperator_add(
|
|
262
|
+
tx,
|
|
263
|
+
progress,
|
|
264
|
+
object,
|
|
265
|
+
permission,
|
|
266
|
+
this.data.progress_new.progress_namedOperator.name,
|
|
267
|
+
r,
|
|
268
|
+
passport
|
|
269
|
+
);
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
case "set": {
|
|
273
|
+
const r = await GetManyAccountOrMark_Address(
|
|
274
|
+
this.data.progress_new.progress_namedOperator.operators
|
|
275
|
+
);
|
|
276
|
+
namedOperator_set(
|
|
277
|
+
tx,
|
|
278
|
+
progress,
|
|
279
|
+
object,
|
|
280
|
+
permission,
|
|
281
|
+
this.data.progress_new.progress_namedOperator.name,
|
|
282
|
+
r,
|
|
283
|
+
passport
|
|
284
|
+
);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case "remove": {
|
|
288
|
+
const r = await GetManyAccountOrMark_Address(
|
|
289
|
+
this.data.progress_new.progress_namedOperator.operators
|
|
290
|
+
);
|
|
291
|
+
namedOperator_remove(
|
|
292
|
+
tx,
|
|
293
|
+
progress,
|
|
294
|
+
object,
|
|
295
|
+
permission,
|
|
296
|
+
this.data.progress_new.progress_namedOperator.name,
|
|
297
|
+
r,
|
|
298
|
+
passport
|
|
299
|
+
);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
await this.new_with_mark(
|
|
305
|
+
env,
|
|
306
|
+
tx,
|
|
307
|
+
ObjectType.Progress,
|
|
308
|
+
createProgress(tx, progress),
|
|
309
|
+
GetObject(this.data.progress_new.namedNew)
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
if (this.data?.description != null && this.object_address) {
|
|
313
|
+
description_set(
|
|
314
|
+
tx,
|
|
315
|
+
object,
|
|
316
|
+
permission,
|
|
317
|
+
this.data.description,
|
|
318
|
+
passport
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
if (this.data.repository) {
|
|
322
|
+
switch (this.data.repository.op) {
|
|
323
|
+
case "add":
|
|
324
|
+
case "set": {
|
|
325
|
+
if (this.data.repository.objects.length > MAX_CONSENSUS_REPOSITORIES_COUNT - (content?.consensus_repositories?.length ?? 0)) {
|
|
326
|
+
W_ERROR(
|
|
327
|
+
WErrors.InvalidParam,
|
|
328
|
+
`CallService_Data.data.repository.objects exceeds max count:${this.data.repository.objects}`
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
if (this.data.repository.op === "set") {
|
|
332
|
+
consensus_repositories_clear(
|
|
333
|
+
tx,
|
|
334
|
+
object,
|
|
335
|
+
permission,
|
|
336
|
+
passport
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
const r = await LocalMark.Instance().get_many_address_availables(
|
|
340
|
+
this.data.repository.objects
|
|
341
|
+
);
|
|
342
|
+
r.forEach((repo) => {
|
|
343
|
+
consensus_repositories_add(
|
|
344
|
+
tx,
|
|
345
|
+
object,
|
|
346
|
+
permission,
|
|
347
|
+
repo,
|
|
348
|
+
passport
|
|
349
|
+
);
|
|
350
|
+
});
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
case "remove": {
|
|
354
|
+
if (this.data.repository.objects.length > (content?.consensus_repositories?.length ?? 0)) {
|
|
355
|
+
W_ERROR(
|
|
356
|
+
WErrors.InvalidParam,
|
|
357
|
+
`CallService_Data.data.repository.objects exceeds max count:${this.data.repository.objects}`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
const addrs = await LocalMark.Instance().get_many_address_availables(
|
|
361
|
+
this.data.repository.objects
|
|
362
|
+
);
|
|
363
|
+
consensus_repositories_remove(
|
|
364
|
+
tx,
|
|
365
|
+
object,
|
|
366
|
+
permission,
|
|
367
|
+
addrs,
|
|
368
|
+
passport
|
|
369
|
+
);
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
case "clear":
|
|
373
|
+
consensus_repositories_clear(
|
|
374
|
+
tx,
|
|
375
|
+
object,
|
|
376
|
+
permission,
|
|
377
|
+
passport
|
|
378
|
+
);
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (this.data.node) {
|
|
383
|
+
switch (this.data.node.op) {
|
|
384
|
+
case "add":
|
|
385
|
+
case "set": {
|
|
386
|
+
if (this.data.node.nodes.length > MAX_NODE_COUNT) {
|
|
387
|
+
W_ERROR(
|
|
388
|
+
WErrors.InvalidParam,
|
|
389
|
+
`CallMachine_Data.data.node.nodes exceeds max count:${this.data.node.nodes}`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
if (this.data.node.op === "set") {
|
|
393
|
+
node_clear(tx, object, permission, passport);
|
|
394
|
+
}
|
|
395
|
+
const nodes = await Promise.all(
|
|
396
|
+
this.data.node.nodes.map(
|
|
397
|
+
async (n) => await node(tx, n)
|
|
398
|
+
)
|
|
399
|
+
);
|
|
400
|
+
node_add(
|
|
401
|
+
tx,
|
|
402
|
+
object,
|
|
403
|
+
permission,
|
|
404
|
+
nodes,
|
|
405
|
+
this.data.node.bReplace ?? false,
|
|
406
|
+
passport
|
|
407
|
+
);
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
case "remove": {
|
|
411
|
+
if (this.data.node.nodes.length > (content?.node_count ?? 0)) {
|
|
412
|
+
W_ERROR(
|
|
413
|
+
WErrors.InvalidParam,
|
|
414
|
+
`CallMachine_Data.data.node.nodes exceeds max count:${this.data.node.nodes}`
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
node_remove(
|
|
418
|
+
tx,
|
|
419
|
+
object,
|
|
420
|
+
permission,
|
|
421
|
+
this.data.node.nodes,
|
|
422
|
+
passport
|
|
423
|
+
);
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
case "clear":
|
|
427
|
+
node_clear(tx, object, permission, passport);
|
|
428
|
+
break;
|
|
429
|
+
case "exchange":
|
|
430
|
+
node_exchange_name(
|
|
431
|
+
tx,
|
|
432
|
+
object,
|
|
433
|
+
permission,
|
|
434
|
+
this.data.node.node_one,
|
|
435
|
+
this.data.node.node_other,
|
|
436
|
+
passport
|
|
437
|
+
);
|
|
438
|
+
break;
|
|
439
|
+
case "rename":
|
|
440
|
+
node_rename(
|
|
441
|
+
tx,
|
|
442
|
+
object,
|
|
443
|
+
permission,
|
|
444
|
+
this.data.node.node_name_old,
|
|
445
|
+
this.data.node.node_name_new,
|
|
446
|
+
passport
|
|
447
|
+
);
|
|
448
|
+
break;
|
|
449
|
+
case "add forward": {
|
|
450
|
+
for (const item of this.data.node.data) {
|
|
451
|
+
const f = await Promise.all(
|
|
452
|
+
item.forward.map(async (f2) => await forward(tx, f2))
|
|
453
|
+
);
|
|
454
|
+
await forwards_add(
|
|
455
|
+
tx,
|
|
456
|
+
object,
|
|
457
|
+
permission,
|
|
458
|
+
item.prior_node_name,
|
|
459
|
+
item.node_name,
|
|
460
|
+
f,
|
|
461
|
+
item.threshold ?? null
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
case "remove forward": {
|
|
467
|
+
for (const item of this.data.node.data) {
|
|
468
|
+
forwards_remove(
|
|
469
|
+
tx,
|
|
470
|
+
object,
|
|
471
|
+
permission,
|
|
472
|
+
item.prior_node_name,
|
|
473
|
+
item.node_name,
|
|
474
|
+
item.forward_name,
|
|
475
|
+
null
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
case "remove prior node": {
|
|
481
|
+
for (const item of this.data.node.pairs) {
|
|
482
|
+
prev_nodes_remove(
|
|
483
|
+
tx,
|
|
484
|
+
object,
|
|
485
|
+
permission,
|
|
486
|
+
item.node_name,
|
|
487
|
+
item.prior_node_name
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
if (this.data.pause != null) {
|
|
495
|
+
pause(
|
|
496
|
+
tx,
|
|
497
|
+
object,
|
|
498
|
+
permission,
|
|
499
|
+
this.data.pause ? true : false,
|
|
500
|
+
passport
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
if (this.data.publish != null) {
|
|
504
|
+
publish(tx, object, permission, passport);
|
|
505
|
+
}
|
|
506
|
+
if (this.data.owner_receive != null && this.object_address) {
|
|
507
|
+
if (this.data.owner_receive === "recently") {
|
|
508
|
+
this.data.owner_receive = await query_received({
|
|
509
|
+
object: this.object_address,
|
|
510
|
+
all_type: true,
|
|
511
|
+
no_cache: env.no_cache,
|
|
512
|
+
network: env.network
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
await owner_receive(
|
|
516
|
+
tx,
|
|
517
|
+
object,
|
|
518
|
+
permission,
|
|
519
|
+
this.data.owner_receive,
|
|
520
|
+
void 0,
|
|
521
|
+
(name) => `${PackageAddress}::machine::${name}`,
|
|
522
|
+
passport
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
if (this.data.um !== void 0) {
|
|
526
|
+
let um_address = null;
|
|
527
|
+
if (this.data.um) {
|
|
528
|
+
um_address = await LocalMark.Instance().get_address(this.data.um) || null;
|
|
529
|
+
if (!um_address) {
|
|
530
|
+
W_ERROR(
|
|
531
|
+
WErrors.InvalidParam,
|
|
532
|
+
"CallMachine_Data.data.um:" + this.data.um
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
um_set(tx, object, permission, um_address, passport);
|
|
537
|
+
}
|
|
538
|
+
if (!this.permission_address) {
|
|
539
|
+
const p = GetObject(this.data?.object);
|
|
540
|
+
await this.new_with_mark(
|
|
541
|
+
env,
|
|
542
|
+
tx,
|
|
543
|
+
ObjectType.Permission,
|
|
544
|
+
permission_create(tx, permission),
|
|
545
|
+
GetObject(p.permission)
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
if (!this.object_address) {
|
|
549
|
+
await this.new_with_mark(
|
|
550
|
+
env,
|
|
551
|
+
tx,
|
|
552
|
+
ObjectType.Machine,
|
|
553
|
+
create(tx, object),
|
|
554
|
+
GetObject(this.data?.object)
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const MAX_CONSENSUS_REPOSITORIES_COUNT = 200;
|
|
560
|
+
const MAX_FORWARD_ORDER_COUNT = 20;
|
|
561
|
+
const MAX_NODE_PAIR_COUNT = 40;
|
|
562
|
+
const MAX_NODE_COUNT = 200;
|
|
563
|
+
const THRESHOLD_DEFAULT = 0;
|
|
564
|
+
function init_node_name() {
|
|
565
|
+
return "";
|
|
566
|
+
}
|
|
567
|
+
async function forward(tx, param) {
|
|
568
|
+
if (typeof param.name === "string" && !isValidName(param.name)) {
|
|
569
|
+
W_ERROR(
|
|
570
|
+
WErrors.IsValidName,
|
|
571
|
+
`Forward name ${param.name} exceeds maximum length ${MAX_NAME_LENGTH}`
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
if (typeof param.namedOperator === "string" && !isValidName(param.namedOperator)) {
|
|
575
|
+
W_ERROR(
|
|
576
|
+
WErrors.IsValidName,
|
|
577
|
+
`Named operator ${param.namedOperator} exceeds maximum length ${MAX_NAME_LENGTH}`
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
if (param.permissionIndex !== void 0 && !isValidU16(param.permissionIndex)) {
|
|
581
|
+
W_ERROR(
|
|
582
|
+
WErrors.IsValidArgType,
|
|
583
|
+
`Permission index must be between 0 and 65535`
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
if (!isValidU16(param.weight)) {
|
|
587
|
+
W_ERROR(
|
|
588
|
+
WErrors.InvalidParam,
|
|
589
|
+
`Weight ${param.weight} must be between 0 and 65535`
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
if ((param.namedOperator === null || param.namedOperator === void 0) && (param.permissionIndex === null || param.permissionIndex === void 0)) {
|
|
593
|
+
W_ERROR(
|
|
594
|
+
WErrors.InvalidParam,
|
|
595
|
+
`One of the "namedOperator" or "permissionIndex" must be provided`
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
if (param.guard && param.guard.guard != null) {
|
|
599
|
+
const guard = await LocalMark.Instance().get_address(param.guard.guard);
|
|
600
|
+
if (guard) {
|
|
601
|
+
param.guard.guard = guard;
|
|
602
|
+
} else {
|
|
603
|
+
W_ERROR(
|
|
604
|
+
WErrors.IsValidName,
|
|
605
|
+
`Guard object ${param.guard.guard} is not a valid wow address`
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
if (param.guard.retained_submission != null && !isValidArray(param.guard.retained_submission, isValidU8)) {
|
|
609
|
+
W_ERROR(
|
|
610
|
+
WErrors.InvalidParam,
|
|
611
|
+
`Retained submission ${param.guard.retained_submission} must be between 0 and 255`
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
return tx.moveCall({
|
|
615
|
+
target: machineFn("forward_with_guard"),
|
|
616
|
+
arguments: [
|
|
617
|
+
toTxString(tx, param.name),
|
|
618
|
+
tx.pure.option("string", param.namedOperator ?? null),
|
|
619
|
+
tx.pure.option("u16", param.permissionIndex ?? null),
|
|
620
|
+
tx.pure.u16(param.weight),
|
|
621
|
+
toTxObject(tx, param.guard.guard),
|
|
622
|
+
tx.pure.vector("u8", param.guard.retained_submission ?? [])
|
|
623
|
+
]
|
|
624
|
+
});
|
|
625
|
+
} else {
|
|
626
|
+
return tx.moveCall({
|
|
627
|
+
target: machineFn("forward"),
|
|
628
|
+
arguments: [
|
|
629
|
+
toTxString(tx, param.name),
|
|
630
|
+
tx.pure.option("string", param.namedOperator ?? null),
|
|
631
|
+
tx.pure.option("u16", param.permissionIndex ?? null),
|
|
632
|
+
tx.pure.u16(param.weight)
|
|
633
|
+
]
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
async function nodepair(tx, prev_node, param) {
|
|
638
|
+
if (typeof prev_node === "string" && prev_node.length > 0 && !isValidName(prev_node)) {
|
|
639
|
+
W_ERROR(
|
|
640
|
+
WErrors.IsValidName,
|
|
641
|
+
`Previous node name ${prev_node} exceeds maximum length ${MAX_NAME_LENGTH}`
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
if (typeof param.threshold === "number" && !isValidU32(param.threshold)) {
|
|
645
|
+
W_ERROR(
|
|
646
|
+
WErrors.InvalidParam,
|
|
647
|
+
`Threshold ${param.threshold} must be between 0 and 4294967295`
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
if (param.forwards.length > MAX_FORWARD_ORDER_COUNT) {
|
|
651
|
+
W_ERROR(
|
|
652
|
+
WErrors.InvalidParam,
|
|
653
|
+
`Forward order count ${param.forwards.length} exceeds maximum count ${MAX_FORWARD_ORDER_COUNT}`
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
if (param.forwards.length > 1) {
|
|
657
|
+
const forwards = await Promise.all(
|
|
658
|
+
param.forwards.map((f) => forward(tx, f))
|
|
659
|
+
);
|
|
660
|
+
return tx.moveCall({
|
|
661
|
+
target: machineFn("nodepair3"),
|
|
662
|
+
arguments: [
|
|
663
|
+
toTxString(tx, prev_node),
|
|
664
|
+
tx.pure.option("u32", param.threshold ?? null),
|
|
665
|
+
tx.makeMoveVec({
|
|
666
|
+
type: `${PackageAddress}::machine::Forward`,
|
|
667
|
+
elements: forwards
|
|
668
|
+
})
|
|
669
|
+
]
|
|
670
|
+
});
|
|
671
|
+
} else if (param.forwards.length === 1) {
|
|
672
|
+
return tx.moveCall({
|
|
673
|
+
target: machineFn("nodepair"),
|
|
674
|
+
arguments: [
|
|
675
|
+
toTxString(tx, prev_node),
|
|
676
|
+
tx.pure.option("u32", param.threshold ?? null),
|
|
677
|
+
await forward(tx, param.forwards[0])
|
|
678
|
+
]
|
|
679
|
+
});
|
|
680
|
+
} else {
|
|
681
|
+
return tx.moveCall({
|
|
682
|
+
target: machineFn("nodepair2"),
|
|
683
|
+
arguments: [
|
|
684
|
+
toTxString(tx, prev_node),
|
|
685
|
+
tx.pure.option("u32", param.threshold ?? null)
|
|
686
|
+
]
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
async function node(tx, param) {
|
|
691
|
+
if (typeof param.name === "string" && !isValidName(param.name)) {
|
|
692
|
+
W_ERROR(
|
|
693
|
+
WErrors.IsValidName,
|
|
694
|
+
`Node name ${param.name} exceeds maximum length ${MAX_NAME_LENGTH}`
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
if (param.name === init_node_name()) {
|
|
698
|
+
W_ERROR(WErrors.InvalidParam, `Node name ${param.name} is reserved`);
|
|
699
|
+
}
|
|
700
|
+
if (param.pairs.length > MAX_NODE_PAIR_COUNT) {
|
|
701
|
+
W_ERROR(
|
|
702
|
+
WErrors.InvalidParam,
|
|
703
|
+
`Node pair count ${param.pairs.length} exceeds maximum count ${MAX_NODE_PAIR_COUNT}`
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
if (param.pairs.length > 1) {
|
|
707
|
+
const pairs = await Promise.all(
|
|
708
|
+
param.pairs.map((p) => nodepair(tx, p.prev_node, p))
|
|
709
|
+
);
|
|
710
|
+
return tx.moveCall({
|
|
711
|
+
target: machineFn("node3"),
|
|
712
|
+
arguments: [
|
|
713
|
+
toTxString(tx, param.name),
|
|
714
|
+
tx.makeMoveVec({
|
|
715
|
+
type: `${PackageAddress}::machine::NodePair`,
|
|
716
|
+
elements: pairs
|
|
717
|
+
})
|
|
718
|
+
]
|
|
719
|
+
});
|
|
720
|
+
} else if (param.pairs.length === 1) {
|
|
721
|
+
return tx.moveCall({
|
|
722
|
+
target: machineFn("node"),
|
|
723
|
+
arguments: [
|
|
724
|
+
toTxString(tx, param.name),
|
|
725
|
+
await nodepair(tx, param.pairs[0].prev_node, param.pairs[0])
|
|
726
|
+
]
|
|
727
|
+
});
|
|
728
|
+
} else {
|
|
729
|
+
return tx.moveCall({
|
|
730
|
+
target: machineFn("node2"),
|
|
731
|
+
arguments: [toTxString(tx, param.name)]
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function create(tx, machine) {
|
|
736
|
+
return tx.moveCall({
|
|
737
|
+
target: machineFn("create"),
|
|
738
|
+
arguments: [toTxObject(tx, machine)]
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
function newMachine(tx, permission, description, passport) {
|
|
742
|
+
validObjects([permission]);
|
|
743
|
+
if (typeof description === "string" && !isValidDescription(description)) {
|
|
744
|
+
W_ERROR(
|
|
745
|
+
WErrors.IsValidDescription,
|
|
746
|
+
`Description exceeds maximum length`
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
if (passport) {
|
|
750
|
+
return tx.moveCall({
|
|
751
|
+
target: machineFn("new_with_passport"),
|
|
752
|
+
arguments: [
|
|
753
|
+
toTxObject(tx, permission),
|
|
754
|
+
toTxObject(tx, passport),
|
|
755
|
+
toTxString(tx, description),
|
|
756
|
+
tx.object.mutRegistrar(),
|
|
757
|
+
tx.object.clock()
|
|
758
|
+
]
|
|
759
|
+
});
|
|
760
|
+
} else {
|
|
761
|
+
return tx.moveCall({
|
|
762
|
+
target: machineFn("new"),
|
|
763
|
+
arguments: [
|
|
764
|
+
toTxObject(tx, permission),
|
|
765
|
+
toTxString(tx, description),
|
|
766
|
+
tx.object.mutRegistrar(),
|
|
767
|
+
tx.object.clock()
|
|
768
|
+
]
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function description_set(tx, machine, permission, description, passport) {
|
|
773
|
+
validObjects([machine, permission]);
|
|
774
|
+
if (typeof description === "string" && !isValidDescription(description)) {
|
|
775
|
+
W_ERROR(
|
|
776
|
+
WErrors.IsValidDescription,
|
|
777
|
+
`Description exceeds maximum length`
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
if (passport) {
|
|
781
|
+
tx.moveCall({
|
|
782
|
+
target: machineFn("description_set_with_passport"),
|
|
783
|
+
arguments: [
|
|
784
|
+
toTxObject(tx, machine),
|
|
785
|
+
toTxObject(tx, permission),
|
|
786
|
+
toTxObject(tx, passport),
|
|
787
|
+
toTxString(tx, description)
|
|
788
|
+
]
|
|
789
|
+
});
|
|
790
|
+
} else {
|
|
791
|
+
tx.moveCall({
|
|
792
|
+
target: machineFn("description_set"),
|
|
793
|
+
arguments: [
|
|
794
|
+
toTxObject(tx, machine),
|
|
795
|
+
toTxObject(tx, permission),
|
|
796
|
+
toTxString(tx, description)
|
|
797
|
+
]
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function node_add(tx, machine, permission, node2, bCompleteReplace, passport) {
|
|
802
|
+
if (node2.length === 0) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
validObjects([machine, permission]);
|
|
806
|
+
if (passport) {
|
|
807
|
+
if (node2.length > 1) {
|
|
808
|
+
tx.moveCall({
|
|
809
|
+
target: machineFn("node_add2_with_passport"),
|
|
810
|
+
arguments: [
|
|
811
|
+
toTxObject(tx, machine),
|
|
812
|
+
toTxObject(tx, permission),
|
|
813
|
+
toTxObject(tx, passport),
|
|
814
|
+
tx.makeMoveVec({
|
|
815
|
+
type: `${PackageAddress}::machine::Node`,
|
|
816
|
+
elements: node2
|
|
817
|
+
}),
|
|
818
|
+
tx.pure.bool(bCompleteReplace)
|
|
819
|
+
]
|
|
820
|
+
});
|
|
821
|
+
} else {
|
|
822
|
+
tx.moveCall({
|
|
823
|
+
target: machineFn("node_add_with_passport"),
|
|
824
|
+
arguments: [
|
|
825
|
+
toTxObject(tx, machine),
|
|
826
|
+
toTxObject(tx, permission),
|
|
827
|
+
toTxObject(tx, passport),
|
|
828
|
+
node2[0],
|
|
829
|
+
tx.pure.bool(bCompleteReplace)
|
|
830
|
+
]
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
} else {
|
|
834
|
+
if (node2.length > 1) {
|
|
835
|
+
tx.moveCall({
|
|
836
|
+
target: machineFn("node_add2"),
|
|
837
|
+
arguments: [
|
|
838
|
+
toTxObject(tx, machine),
|
|
839
|
+
toTxObject(tx, permission),
|
|
840
|
+
tx.makeMoveVec({
|
|
841
|
+
type: `${PackageAddress}::machine::Node`,
|
|
842
|
+
elements: node2
|
|
843
|
+
}),
|
|
844
|
+
tx.pure.bool(bCompleteReplace)
|
|
845
|
+
]
|
|
846
|
+
});
|
|
847
|
+
} else {
|
|
848
|
+
tx.moveCall({
|
|
849
|
+
target: machineFn("node_add"),
|
|
850
|
+
arguments: [
|
|
851
|
+
toTxObject(tx, machine),
|
|
852
|
+
toTxObject(tx, permission),
|
|
853
|
+
node2[0],
|
|
854
|
+
tx.pure.bool(bCompleteReplace)
|
|
855
|
+
]
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
function um_set(tx, machine, permission, um, passport) {
|
|
861
|
+
validObjects([machine, permission]);
|
|
862
|
+
if (um) {
|
|
863
|
+
if (passport) {
|
|
864
|
+
tx.moveCall({
|
|
865
|
+
target: machineFn(`um_set_with_passport`),
|
|
866
|
+
arguments: [
|
|
867
|
+
toTxObject(tx, machine),
|
|
868
|
+
toTxObject(tx, permission),
|
|
869
|
+
passport,
|
|
870
|
+
toTxObject(tx, um),
|
|
871
|
+
tx.object.mutRegistrar(),
|
|
872
|
+
tx.object.clock()
|
|
873
|
+
]
|
|
874
|
+
});
|
|
875
|
+
} else {
|
|
876
|
+
tx.moveCall({
|
|
877
|
+
target: machineFn(`um_set`),
|
|
878
|
+
arguments: [
|
|
879
|
+
toTxObject(tx, machine),
|
|
880
|
+
toTxObject(tx, permission),
|
|
881
|
+
toTxObject(tx, um),
|
|
882
|
+
tx.object.mutRegistrar(),
|
|
883
|
+
tx.object.clock()
|
|
884
|
+
]
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
} else {
|
|
888
|
+
if (passport) {
|
|
889
|
+
tx.moveCall({
|
|
890
|
+
target: machineFn(`um_none_with_passport`),
|
|
891
|
+
arguments: [
|
|
892
|
+
toTxObject(tx, machine),
|
|
893
|
+
toTxObject(tx, permission),
|
|
894
|
+
passport,
|
|
895
|
+
tx.object.mutRegistrar()
|
|
896
|
+
]
|
|
897
|
+
});
|
|
898
|
+
} else {
|
|
899
|
+
tx.moveCall({
|
|
900
|
+
target: machineFn(`um_none`),
|
|
901
|
+
arguments: [
|
|
902
|
+
toTxObject(tx, machine),
|
|
903
|
+
toTxObject(tx, permission),
|
|
904
|
+
tx.object.mutRegistrar()
|
|
905
|
+
]
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
function node_remove(tx, machine, permission, node2, passport) {
|
|
911
|
+
if (node2.length === 0) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
validObjects([machine, permission]);
|
|
915
|
+
if (passport) {
|
|
916
|
+
if (node2.length > 1) {
|
|
917
|
+
tx.moveCall({
|
|
918
|
+
target: machineFn("node_remove_with_passport"),
|
|
919
|
+
arguments: [
|
|
920
|
+
toTxObject(tx, machine),
|
|
921
|
+
toTxObject(tx, permission),
|
|
922
|
+
toTxObject(tx, passport),
|
|
923
|
+
tx.pure.vector("string", node2)
|
|
924
|
+
]
|
|
925
|
+
});
|
|
926
|
+
} else {
|
|
927
|
+
tx.moveCall({
|
|
928
|
+
target: machineFn("node_remove_with_passport"),
|
|
929
|
+
arguments: [
|
|
930
|
+
toTxObject(tx, machine),
|
|
931
|
+
toTxObject(tx, permission),
|
|
932
|
+
toTxObject(tx, passport),
|
|
933
|
+
tx.pure.string(node2[0])
|
|
934
|
+
]
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
} else {
|
|
938
|
+
if (node2.length > 1) {
|
|
939
|
+
tx.moveCall({
|
|
940
|
+
target: machineFn("node_remove"),
|
|
941
|
+
arguments: [
|
|
942
|
+
toTxObject(tx, machine),
|
|
943
|
+
toTxObject(tx, permission),
|
|
944
|
+
tx.pure.vector("string", node2)
|
|
945
|
+
]
|
|
946
|
+
});
|
|
947
|
+
} else {
|
|
948
|
+
tx.moveCall({
|
|
949
|
+
target: machineFn("node_remove"),
|
|
950
|
+
arguments: [
|
|
951
|
+
toTxObject(tx, machine),
|
|
952
|
+
toTxObject(tx, permission),
|
|
953
|
+
tx.pure.string(node2[0])
|
|
954
|
+
]
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function node_rename(tx, machine, permission, node_name, node_new_name, passport) {
|
|
960
|
+
if (!node_name || !node_new_name) {
|
|
961
|
+
W_ERROR(
|
|
962
|
+
WErrors.InvalidParam,
|
|
963
|
+
`Node name ${node_name} or new node name ${node_new_name} is empty`
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
validObjects([machine, permission]);
|
|
967
|
+
if (!isValidName(node_name)) {
|
|
968
|
+
W_ERROR(WErrors.InvalidParam, `Node name ${node_name} is invalid`);
|
|
969
|
+
}
|
|
970
|
+
if (!isValidName(node_new_name)) {
|
|
971
|
+
W_ERROR(
|
|
972
|
+
WErrors.InvalidParam,
|
|
973
|
+
`New node name ${node_new_name} is invalid`
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
if (passport) {
|
|
977
|
+
tx.moveCall({
|
|
978
|
+
target: machineFn("node_rename_with_passport"),
|
|
979
|
+
arguments: [
|
|
980
|
+
toTxObject(tx, machine),
|
|
981
|
+
toTxObject(tx, permission),
|
|
982
|
+
toTxObject(tx, passport),
|
|
983
|
+
tx.pure.string(node_name),
|
|
984
|
+
tx.pure.string(node_new_name)
|
|
985
|
+
]
|
|
986
|
+
});
|
|
987
|
+
} else {
|
|
988
|
+
tx.moveCall({
|
|
989
|
+
target: machineFn("node_rename"),
|
|
990
|
+
arguments: [
|
|
991
|
+
toTxObject(tx, machine),
|
|
992
|
+
toTxObject(tx, permission),
|
|
993
|
+
tx.pure.string(node_name),
|
|
994
|
+
tx.pure.string(node_new_name)
|
|
995
|
+
]
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
function node_exchange_name(tx, machine, permission, node_one, node_other, passport) {
|
|
1000
|
+
validObjects([machine, permission]);
|
|
1001
|
+
if (!node_one || !node_other) {
|
|
1002
|
+
W_ERROR(
|
|
1003
|
+
WErrors.InvalidParam,
|
|
1004
|
+
`Node one ${node_one} or node other ${node_other} is empty`
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
if (!isValidName(node_one)) {
|
|
1008
|
+
W_ERROR(WErrors.InvalidParam, `Node one ${node_one} is invalid`);
|
|
1009
|
+
}
|
|
1010
|
+
if (!isValidName(node_other)) {
|
|
1011
|
+
W_ERROR(WErrors.InvalidParam, `Node other ${node_other} is invalid`);
|
|
1012
|
+
}
|
|
1013
|
+
if (node_one === node_other) {
|
|
1014
|
+
W_ERROR(
|
|
1015
|
+
WErrors.InvalidParam,
|
|
1016
|
+
`Node one ${node_one} and node other ${node_other} are same`
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
if (passport) {
|
|
1020
|
+
tx.moveCall({
|
|
1021
|
+
target: machineFn("node_exchange_name_with_passport"),
|
|
1022
|
+
arguments: [
|
|
1023
|
+
toTxObject(tx, machine),
|
|
1024
|
+
toTxObject(tx, permission),
|
|
1025
|
+
toTxObject(tx, passport),
|
|
1026
|
+
tx.pure.string(node_one),
|
|
1027
|
+
tx.pure.string(node_other)
|
|
1028
|
+
]
|
|
1029
|
+
});
|
|
1030
|
+
} else {
|
|
1031
|
+
tx.moveCall({
|
|
1032
|
+
target: machineFn("node_exchange_name"),
|
|
1033
|
+
arguments: [
|
|
1034
|
+
toTxObject(tx, machine),
|
|
1035
|
+
toTxObject(tx, permission),
|
|
1036
|
+
tx.pure.string(node_one),
|
|
1037
|
+
tx.pure.string(node_other)
|
|
1038
|
+
]
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
function node_clear(tx, machine, permission, passport) {
|
|
1043
|
+
validObjects([machine, permission]);
|
|
1044
|
+
if (passport) {
|
|
1045
|
+
tx.moveCall({
|
|
1046
|
+
target: machineFn("node_clear_with_passport"),
|
|
1047
|
+
arguments: [
|
|
1048
|
+
toTxObject(tx, machine),
|
|
1049
|
+
toTxObject(tx, permission),
|
|
1050
|
+
toTxObject(tx, passport)
|
|
1051
|
+
]
|
|
1052
|
+
});
|
|
1053
|
+
} else {
|
|
1054
|
+
tx.moveCall({
|
|
1055
|
+
target: machineFn("node_clear"),
|
|
1056
|
+
arguments: [toTxObject(tx, machine), toTxObject(tx, permission)]
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function publish(tx, machine, permission, passport) {
|
|
1061
|
+
validObjects([machine, permission]);
|
|
1062
|
+
if (passport) {
|
|
1063
|
+
tx.moveCall({
|
|
1064
|
+
target: machineFn("publish_with_passport"),
|
|
1065
|
+
arguments: [
|
|
1066
|
+
toTxObject(tx, machine),
|
|
1067
|
+
toTxObject(tx, permission),
|
|
1068
|
+
toTxObject(tx, passport)
|
|
1069
|
+
]
|
|
1070
|
+
});
|
|
1071
|
+
} else {
|
|
1072
|
+
tx.moveCall({
|
|
1073
|
+
target: machineFn("publish"),
|
|
1074
|
+
arguments: [toTxObject(tx, machine), toTxObject(tx, permission)]
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function pause(tx, machine, permission, bPaused, passport) {
|
|
1079
|
+
validObjects([machine, permission]);
|
|
1080
|
+
if (passport) {
|
|
1081
|
+
tx.moveCall({
|
|
1082
|
+
target: machineFn("pause_with_passport"),
|
|
1083
|
+
arguments: [
|
|
1084
|
+
toTxObject(tx, machine),
|
|
1085
|
+
toTxObject(tx, permission),
|
|
1086
|
+
toTxObject(tx, passport),
|
|
1087
|
+
tx.pure.bool(bPaused)
|
|
1088
|
+
]
|
|
1089
|
+
});
|
|
1090
|
+
} else {
|
|
1091
|
+
tx.moveCall({
|
|
1092
|
+
target: machineFn("pause"),
|
|
1093
|
+
arguments: [
|
|
1094
|
+
toTxObject(tx, machine),
|
|
1095
|
+
toTxObject(tx, permission),
|
|
1096
|
+
tx.pure.bool(bPaused)
|
|
1097
|
+
]
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
function consensus_repositories_add(tx, machine, permission, repository, passport) {
|
|
1102
|
+
validObjects([machine, permission, repository]);
|
|
1103
|
+
if (passport) {
|
|
1104
|
+
tx.moveCall({
|
|
1105
|
+
target: machineFn("consensus_repositories_add_with_passport"),
|
|
1106
|
+
arguments: [
|
|
1107
|
+
toTxObject(tx, machine),
|
|
1108
|
+
toTxObject(tx, permission),
|
|
1109
|
+
toTxObject(tx, passport),
|
|
1110
|
+
toTxObject(tx, repository),
|
|
1111
|
+
tx.object.mutRegistrar(),
|
|
1112
|
+
tx.object.clock()
|
|
1113
|
+
]
|
|
1114
|
+
});
|
|
1115
|
+
} else {
|
|
1116
|
+
tx.moveCall({
|
|
1117
|
+
target: machineFn("consensus_repositories_add"),
|
|
1118
|
+
arguments: [
|
|
1119
|
+
toTxObject(tx, machine),
|
|
1120
|
+
toTxObject(tx, permission),
|
|
1121
|
+
toTxObject(tx, repository),
|
|
1122
|
+
tx.object.mutRegistrar(),
|
|
1123
|
+
tx.object.clock()
|
|
1124
|
+
]
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
function consensus_repositories_remove(tx, machine, permission, repositories, passport) {
|
|
1129
|
+
if (!repositories || repositories.length === 0) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
validObjects([machine, permission, ...repositories]);
|
|
1133
|
+
if (passport) {
|
|
1134
|
+
tx.moveCall({
|
|
1135
|
+
target: machineFn("consensus_repositories_remove_with_passport"),
|
|
1136
|
+
arguments: [
|
|
1137
|
+
toTxObject(tx, machine),
|
|
1138
|
+
toTxObject(tx, permission),
|
|
1139
|
+
toTxObject(tx, passport),
|
|
1140
|
+
tx.pure.vector("string", repositories),
|
|
1141
|
+
tx.object.mutRegistrar()
|
|
1142
|
+
]
|
|
1143
|
+
});
|
|
1144
|
+
} else {
|
|
1145
|
+
tx.moveCall({
|
|
1146
|
+
target: machineFn("consensus_repositories_remove"),
|
|
1147
|
+
arguments: [
|
|
1148
|
+
toTxObject(tx, machine),
|
|
1149
|
+
toTxObject(tx, permission),
|
|
1150
|
+
tx.pure.vector("string", repositories),
|
|
1151
|
+
tx.object.mutRegistrar()
|
|
1152
|
+
]
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
function consensus_repositories_clear(tx, machine, permission, passport) {
|
|
1157
|
+
validObjects([machine, permission]);
|
|
1158
|
+
if (passport) {
|
|
1159
|
+
tx.moveCall({
|
|
1160
|
+
target: machineFn("consensus_repositories_clear_with_passport"),
|
|
1161
|
+
arguments: [
|
|
1162
|
+
toTxObject(tx, machine),
|
|
1163
|
+
toTxObject(tx, permission),
|
|
1164
|
+
toTxObject(tx, passport),
|
|
1165
|
+
tx.object.mutRegistrar()
|
|
1166
|
+
]
|
|
1167
|
+
});
|
|
1168
|
+
} else {
|
|
1169
|
+
tx.moveCall({
|
|
1170
|
+
target: machineFn("consensus_repositories_clear"),
|
|
1171
|
+
arguments: [
|
|
1172
|
+
toTxObject(tx, machine),
|
|
1173
|
+
toTxObject(tx, permission),
|
|
1174
|
+
tx.object.mutRegistrar()
|
|
1175
|
+
]
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
async function forwards_add(tx, machine, permission, node_name, next_node_name, forwards, threshold, passport) {
|
|
1180
|
+
if (!forwards || forwards.length === 0) {
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
validObjects([machine, permission]);
|
|
1184
|
+
if (threshold !== null && !isValidU32(threshold)) {
|
|
1185
|
+
W_ERROR(WErrors.InvalidParam, `threshold ${threshold} must be u32`);
|
|
1186
|
+
}
|
|
1187
|
+
if (!isValidName(node_name)) {
|
|
1188
|
+
W_ERROR(
|
|
1189
|
+
WErrors.InvalidParam,
|
|
1190
|
+
`node_name ${node_name} is excceed max length ${MAX_NAME_LENGTH}`
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
if (!isValidName(next_node_name)) {
|
|
1194
|
+
W_ERROR(
|
|
1195
|
+
WErrors.InvalidParam,
|
|
1196
|
+
`next_node_name ${next_node_name} is excceed max length ${MAX_NAME_LENGTH}`
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
if (passport) {
|
|
1200
|
+
tx.moveCall({
|
|
1201
|
+
target: machineFn("forwards_add_with_passport"),
|
|
1202
|
+
arguments: [
|
|
1203
|
+
toTxObject(tx, machine),
|
|
1204
|
+
toTxObject(tx, permission),
|
|
1205
|
+
toTxObject(tx, passport),
|
|
1206
|
+
toTxString(tx, node_name),
|
|
1207
|
+
toTxString(tx, next_node_name),
|
|
1208
|
+
tx.makeMoveVec({
|
|
1209
|
+
type: `${PackageAddress}::machine::Forward`,
|
|
1210
|
+
elements: forwards
|
|
1211
|
+
}),
|
|
1212
|
+
tx.pure.option("u32", threshold ?? null)
|
|
1213
|
+
]
|
|
1214
|
+
});
|
|
1215
|
+
} else {
|
|
1216
|
+
tx.moveCall({
|
|
1217
|
+
target: machineFn("forwards_add"),
|
|
1218
|
+
arguments: [
|
|
1219
|
+
toTxObject(tx, machine),
|
|
1220
|
+
toTxObject(tx, permission),
|
|
1221
|
+
toTxString(tx, node_name),
|
|
1222
|
+
toTxString(tx, next_node_name),
|
|
1223
|
+
tx.makeMoveVec({
|
|
1224
|
+
type: `${PackageAddress}::machine::Forward`,
|
|
1225
|
+
elements: forwards
|
|
1226
|
+
}),
|
|
1227
|
+
tx.pure.option("u32", threshold ?? null)
|
|
1228
|
+
]
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
function forwards_remove(tx, machine, permission, node_name, next_node_name, forwards, threshold, passport) {
|
|
1233
|
+
if (!forwards || forwards.length === 0) {
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
validObjects([machine, permission, ...forwards]);
|
|
1237
|
+
if (!isValidName(node_name)) {
|
|
1238
|
+
W_ERROR(
|
|
1239
|
+
WErrors.InvalidParam,
|
|
1240
|
+
`node_name ${node_name} is excceed max length ${MAX_NAME_LENGTH}`
|
|
1241
|
+
);
|
|
1242
|
+
}
|
|
1243
|
+
if (!isValidName(next_node_name)) {
|
|
1244
|
+
W_ERROR(
|
|
1245
|
+
WErrors.InvalidParam,
|
|
1246
|
+
`next_node_name ${next_node_name} is excceed max length ${MAX_NAME_LENGTH}`
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
if (threshold !== null && !isValidU32(threshold)) {
|
|
1250
|
+
W_ERROR(WErrors.InvalidParam, `threshold ${threshold} must be u32`);
|
|
1251
|
+
}
|
|
1252
|
+
if (passport) {
|
|
1253
|
+
tx.moveCall({
|
|
1254
|
+
target: machineFn("forwards_remove_with_passport"),
|
|
1255
|
+
arguments: [
|
|
1256
|
+
toTxObject(tx, machine),
|
|
1257
|
+
toTxObject(tx, permission),
|
|
1258
|
+
toTxObject(tx, passport),
|
|
1259
|
+
toTxString(tx, node_name),
|
|
1260
|
+
toTxString(tx, next_node_name),
|
|
1261
|
+
tx.pure.vector("string", forwards),
|
|
1262
|
+
tx.pure.option("u32", threshold ?? null)
|
|
1263
|
+
]
|
|
1264
|
+
});
|
|
1265
|
+
} else {
|
|
1266
|
+
tx.moveCall({
|
|
1267
|
+
target: machineFn("forwards_remove"),
|
|
1268
|
+
arguments: [
|
|
1269
|
+
toTxObject(tx, machine),
|
|
1270
|
+
toTxObject(tx, permission),
|
|
1271
|
+
toTxString(tx, node_name),
|
|
1272
|
+
toTxString(tx, next_node_name),
|
|
1273
|
+
tx.pure.vector("string", forwards),
|
|
1274
|
+
tx.pure.option("u32", threshold ?? null)
|
|
1275
|
+
]
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
function prev_nodes_remove(tx, machine, permission, node_name, prev_node_names, passport) {
|
|
1280
|
+
if (prev_node_names.length === 0) {
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
validObjects([machine, permission]);
|
|
1284
|
+
if (!isValidName(node_name)) {
|
|
1285
|
+
W_ERROR(
|
|
1286
|
+
WErrors.InvalidParam,
|
|
1287
|
+
`node_name ${node_name} is excceed max length ${MAX_NAME_LENGTH}`
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
for (const prev_node_name of prev_node_names) {
|
|
1291
|
+
if (!isValidName(prev_node_name)) {
|
|
1292
|
+
W_ERROR(
|
|
1293
|
+
WErrors.InvalidParam,
|
|
1294
|
+
`prev_node_name ${prev_node_name} is excceed max length ${MAX_NAME_LENGTH}`
|
|
1295
|
+
);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
if (passport) {
|
|
1299
|
+
tx.moveCall({
|
|
1300
|
+
target: machineFn("prev_nodes_remove_with_passport"),
|
|
1301
|
+
arguments: [
|
|
1302
|
+
toTxObject(tx, machine),
|
|
1303
|
+
toTxObject(tx, permission),
|
|
1304
|
+
toTxObject(tx, passport),
|
|
1305
|
+
toTxString(tx, node_name),
|
|
1306
|
+
tx.pure.vector("string", prev_node_names)
|
|
1307
|
+
]
|
|
1308
|
+
});
|
|
1309
|
+
} else {
|
|
1310
|
+
tx.moveCall({
|
|
1311
|
+
target: machineFn("prev_nodes_remove"),
|
|
1312
|
+
arguments: [
|
|
1313
|
+
toTxObject(tx, machine),
|
|
1314
|
+
toTxObject(tx, permission),
|
|
1315
|
+
toTxString(tx, node_name),
|
|
1316
|
+
tx.pure.vector("string", prev_node_names)
|
|
1317
|
+
]
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
const machineNode2file = async (machine, file_path, format = "json", network) => {
|
|
1322
|
+
const machineAddr = await LocalMark.Instance().get_address(machine);
|
|
1323
|
+
if (!machineAddr) {
|
|
1324
|
+
throw new Error(`Machine object ${machine} not found`);
|
|
1325
|
+
}
|
|
1326
|
+
const machineQueryResult = await query_objects({
|
|
1327
|
+
objects: [machineAddr],
|
|
1328
|
+
network
|
|
1329
|
+
});
|
|
1330
|
+
if (!machineQueryResult?.objects || machineQueryResult.objects.length === 0) {
|
|
1331
|
+
throw new Error(
|
|
1332
|
+
`Machine object ${machine} (${machineAddr}) not found on chain`
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
const machineObj = machineQueryResult.objects[0];
|
|
1336
|
+
if (machineObj.type !== "Machine") {
|
|
1337
|
+
throw new Error(
|
|
1338
|
+
`Object ${machine} is not a Machine, found type: ${machineObj.type}`
|
|
1339
|
+
);
|
|
1340
|
+
}
|
|
1341
|
+
const tableQuery = {
|
|
1342
|
+
parent: machineAddr,
|
|
1343
|
+
network
|
|
1344
|
+
};
|
|
1345
|
+
const tableResult = await query_table(tableQuery);
|
|
1346
|
+
if (!tableResult?.items || tableResult.items.length === 0) {
|
|
1347
|
+
throw new Error(`No nodes found in machine ${machine}`);
|
|
1348
|
+
}
|
|
1349
|
+
const nodeObjectIds = tableResult.items.map((item) => item.object);
|
|
1350
|
+
const nodeQueryResult = await query_objects({
|
|
1351
|
+
objects: nodeObjectIds,
|
|
1352
|
+
network
|
|
1353
|
+
});
|
|
1354
|
+
if (!nodeQueryResult?.objects || nodeQueryResult.objects.length === 0) {
|
|
1355
|
+
throw new Error(`Failed to fetch any nodes from machine ${machine}`);
|
|
1356
|
+
}
|
|
1357
|
+
const nodes = nodeQueryResult.objects.filter((obj) => obj.type === "TableItem_MachineNode").map((obj) => {
|
|
1358
|
+
const nodeObj = obj;
|
|
1359
|
+
return {
|
|
1360
|
+
name: nodeObj.name,
|
|
1361
|
+
pairs: nodeObj.value
|
|
1362
|
+
};
|
|
1363
|
+
});
|
|
1364
|
+
if (nodes.length === 0) {
|
|
1365
|
+
throw new Error(`Failed to fetch any nodes from machine ${machine}`);
|
|
1366
|
+
}
|
|
1367
|
+
let content;
|
|
1368
|
+
if (format === "json") {
|
|
1369
|
+
content = JSON.stringify(nodes, null, 2);
|
|
1370
|
+
} else {
|
|
1371
|
+
const machineId = machineObj.object;
|
|
1372
|
+
content = generateMachineNodeMarkdown(
|
|
1373
|
+
nodes,
|
|
1374
|
+
machine,
|
|
1375
|
+
machineAddr,
|
|
1376
|
+
machineId
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
writeFileSync(file_path, content, "utf-8");
|
|
1380
|
+
};
|
|
1381
|
+
function generateMachineNodeMarkdown(nodes, machineName, machineAddr, machineId) {
|
|
1382
|
+
let md = `# Machine Node Definition
|
|
1383
|
+
|
|
1384
|
+
`;
|
|
1385
|
+
md += `**Machine:** ${machineName}
|
|
1386
|
+
|
|
1387
|
+
`;
|
|
1388
|
+
md += `**Address:** ${machineAddr}
|
|
1389
|
+
|
|
1390
|
+
`;
|
|
1391
|
+
if (machineId) {
|
|
1392
|
+
md += `**ID:** ${machineId}
|
|
1393
|
+
|
|
1394
|
+
`;
|
|
1395
|
+
}
|
|
1396
|
+
md += `**Total Nodes:** ${nodes.length}
|
|
1397
|
+
|
|
1398
|
+
`;
|
|
1399
|
+
md += `---
|
|
1400
|
+
|
|
1401
|
+
`;
|
|
1402
|
+
for (const node2 of nodes) {
|
|
1403
|
+
md += `## Node: ${node2.name}
|
|
1404
|
+
|
|
1405
|
+
`;
|
|
1406
|
+
for (const pair of node2.pairs) {
|
|
1407
|
+
md += `### Pair: ${pair.prev_node}
|
|
1408
|
+
|
|
1409
|
+
`;
|
|
1410
|
+
md += `- **prev_node**: ${pair.prev_node}
|
|
1411
|
+
`;
|
|
1412
|
+
md += `- **threshold**: ${pair.threshold}
|
|
1413
|
+
|
|
1414
|
+
`;
|
|
1415
|
+
if (pair.forwards && pair.forwards.length > 0) {
|
|
1416
|
+
md += `#### Forwards
|
|
1417
|
+
|
|
1418
|
+
`;
|
|
1419
|
+
md += `| name | weight | namedOperator | permissionIndex | guard |
|
|
1420
|
+
`;
|
|
1421
|
+
md += `|------|--------|---------------|-----------------|-------|
|
|
1422
|
+
`;
|
|
1423
|
+
for (const forward2 of pair.forwards) {
|
|
1424
|
+
const namedOp = forward2.namedOperator || "";
|
|
1425
|
+
const permIdx = forward2.permissionIndex?.toString() || "";
|
|
1426
|
+
const guard = forward2.guard?.guard || "";
|
|
1427
|
+
md += `| ${forward2.name} | ${forward2.weight} | ${namedOp} | ${permIdx} | ${guard} |
|
|
1428
|
+
`;
|
|
1429
|
+
}
|
|
1430
|
+
md += `
|
|
1431
|
+
`;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
md += `---
|
|
1435
|
+
|
|
1436
|
+
`;
|
|
1437
|
+
}
|
|
1438
|
+
md += `## JSON Definition
|
|
1439
|
+
|
|
1440
|
+
`;
|
|
1441
|
+
md += `\`\`\`json
|
|
1442
|
+
`;
|
|
1443
|
+
md += JSON.stringify(nodes, null, 2);
|
|
1444
|
+
md += `
|
|
1445
|
+
\`\`\`
|
|
1446
|
+
`;
|
|
1447
|
+
return md;
|
|
1448
|
+
}
|
|
1449
|
+
function prev_nodes_remove_with_passport(tx, machine, permission, passport, node_name, prev_node_names) {
|
|
1450
|
+
validObjects([machine, permission, passport]);
|
|
1451
|
+
tx.moveCall({
|
|
1452
|
+
target: machineFn("prev_nodes_remove_with_passport"),
|
|
1453
|
+
arguments: [
|
|
1454
|
+
toTxObject(tx, machine),
|
|
1455
|
+
toTxObject(tx, permission),
|
|
1456
|
+
toTxObject(tx, passport),
|
|
1457
|
+
toTxString(tx, node_name),
|
|
1458
|
+
tx.pure.vector("string", prev_node_names)
|
|
1459
|
+
]
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
export {
|
|
1463
|
+
CallMachine,
|
|
1464
|
+
MAX_CONSENSUS_REPOSITORIES_COUNT,
|
|
1465
|
+
MAX_FORWARD_ORDER_COUNT,
|
|
1466
|
+
MAX_NODE_COUNT,
|
|
1467
|
+
MAX_NODE_PAIR_COUNT,
|
|
1468
|
+
THRESHOLD_DEFAULT,
|
|
1469
|
+
consensus_repositories_add,
|
|
1470
|
+
consensus_repositories_clear,
|
|
1471
|
+
consensus_repositories_remove,
|
|
1472
|
+
create,
|
|
1473
|
+
description_set,
|
|
1474
|
+
forward,
|
|
1475
|
+
forwards_add,
|
|
1476
|
+
forwards_remove,
|
|
1477
|
+
init_node_name,
|
|
1478
|
+
machineNode2file,
|
|
1479
|
+
newMachine,
|
|
1480
|
+
node,
|
|
1481
|
+
node_add,
|
|
1482
|
+
node_clear,
|
|
1483
|
+
node_exchange_name,
|
|
1484
|
+
node_remove,
|
|
1485
|
+
node_rename,
|
|
1486
|
+
nodepair,
|
|
1487
|
+
pause,
|
|
1488
|
+
prev_nodes_remove,
|
|
1489
|
+
prev_nodes_remove_with_passport,
|
|
1490
|
+
publish,
|
|
1491
|
+
um_set
|
|
1492
|
+
};
|