wowok 2.1.40 → 2.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bcs/bcs.js +1 -253
- package/dist/cjs/bcs/effects.js +1 -199
- package/dist/cjs/bcs/index.js +1 -51
- package/dist/cjs/bcs/pure.js +1 -36
- package/dist/cjs/bcs/type-tag-serializer.js +1 -104
- package/dist/cjs/bcs/types.js +1 -3
- package/dist/cjs/client/index.js +1 -4
- package/dist/cjs/client/network.js +1 -15
- package/dist/cjs/cryptography/index.js +1 -6
- package/dist/cjs/cryptography/intent.js +1 -14
- package/dist/cjs/cryptography/keypair.js +1 -74
- package/dist/cjs/cryptography/mnemonics.js +1 -20
- package/dist/cjs/cryptography/publickey.js +1 -80
- package/dist/cjs/cryptography/signature-scheme.js +1 -22
- package/dist/cjs/cryptography/signature.js +1 -41
- package/dist/cjs/experimental/cache.js +1 -58
- package/dist/cjs/experimental/client.js +1 -19
- package/dist/cjs/experimental/core.js +1 -80
- package/dist/cjs/experimental/errors.js +1 -24
- package/dist/cjs/experimental/index.js +1 -5
- package/dist/cjs/experimental/persistent-storage.js +1 -220
- package/dist/cjs/experimental/persistent-storage.test.js +1 -144
- package/dist/cjs/experimental/transports/utils.js +1 -96
- package/dist/cjs/experimental/types.js +1 -1
- package/dist/cjs/faucet/faucet.js +1 -99
- package/dist/cjs/faucet/index.js +1 -1
- package/dist/cjs/grpc/client.js +1 -42
- package/dist/cjs/grpc/core.js +1 -587
- package/dist/cjs/grpc/index.js +1 -2
- package/dist/cjs/grpc/proto/google/protobuf/any.js +1 -106
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +1 -58
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +1 -7
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +1 -47
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +1 -191
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +1 -91
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +1 -265
- package/dist/cjs/grpc/proto/google/rpc/status.js +1 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +1 -46
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +1 -29
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +1 -22
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +1 -54
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +1 -60
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +1 -144
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +1 -271
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +1 -64
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +1 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +1 -62
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +1 -64
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +1 -481
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +1 -40
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +1 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +1 -57
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +1 -39
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +1 -329
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +1 -447
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +1 -27
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +1 -206
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +1 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +1 -109
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +1 -90
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +1 -30
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +1 -39
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +1 -30
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +1 -501
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +1 -10
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +1 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +1 -62
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +1 -31
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +1 -504
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +1 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +1 -37
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +1 -709
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1 -950
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +1 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +1 -144
- package/dist/cjs/index.js +1 -22
- package/dist/cjs/jsonRpc/client.js +1 -516
- package/dist/cjs/jsonRpc/core.js +1 -587
- package/dist/cjs/jsonRpc/errors.js +1 -38
- package/dist/cjs/jsonRpc/http-transport.js +1 -70
- package/dist/cjs/jsonRpc/index.js +1 -3
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +1 -296
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +1 -155
- package/dist/cjs/jsonRpc/types/chain.js +1 -1
- package/dist/cjs/jsonRpc/types/changes.js +1 -1
- package/dist/cjs/jsonRpc/types/coins.js +1 -1
- package/dist/cjs/jsonRpc/types/common.js +1 -1
- package/dist/cjs/jsonRpc/types/generated.js +1 -1
- package/dist/cjs/jsonRpc/types/index.js +1 -1
- package/dist/cjs/jsonRpc/types/params.js +1 -1
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +1 -58
- package/dist/cjs/keypairs/ed25519/index.js +1 -2
- package/dist/cjs/keypairs/ed25519/keypair.js +1 -90
- package/dist/cjs/keypairs/ed25519/publickey.js +1 -50
- package/dist/cjs/keypairs/index.js +1 -4
- package/dist/cjs/keypairs/passkey/index.js +1 -2
- package/dist/cjs/keypairs/passkey/keypair.js +1 -155
- package/dist/cjs/keypairs/passkey/publickey.js +1 -117
- package/dist/cjs/keypairs/passkey/types.js +1 -1
- package/dist/cjs/keypairs/secp256k1/index.js +1 -2
- package/dist/cjs/keypairs/secp256k1/keypair.js +1 -82
- package/dist/cjs/keypairs/secp256k1/publickey.js +1 -51
- package/dist/cjs/keypairs/secp256r1/index.js +1 -2
- package/dist/cjs/keypairs/secp256r1/keypair.js +1 -78
- package/dist/cjs/keypairs/secp256r1/publickey.js +1 -52
- package/dist/cjs/multisig/index.js +1 -2
- package/dist/cjs/multisig/publickey.js +1 -201
- package/dist/cjs/multisig/signer.js +1 -58
- package/dist/cjs/transactions/Arguments.js +1 -9
- package/dist/cjs/transactions/Commands.js +1 -102
- package/dist/cjs/transactions/Inputs.js +1 -52
- package/dist/cjs/transactions/ObjectCache.js +1 -205
- package/dist/cjs/transactions/Transaction.js +1 -574
- package/dist/cjs/transactions/TransactionData.js +1 -409
- package/dist/cjs/transactions/__tests__/Transaction.test.js +1 -160
- package/dist/cjs/transactions/__tests__/bcs.test.js +1 -182
- package/dist/cjs/transactions/data/internal.js +1 -169
- package/dist/cjs/transactions/data/v1.js +1 -469
- package/dist/cjs/transactions/data/v2.js +1 -97
- package/dist/cjs/transactions/executor/caching.js +1 -65
- package/dist/cjs/transactions/executor/parallel.js +1 -347
- package/dist/cjs/transactions/executor/queue.js +1 -59
- package/dist/cjs/transactions/executor/serial.js +1 -99
- package/dist/cjs/transactions/hash.js +1 -8
- package/dist/cjs/transactions/index.js +1 -12
- package/dist/cjs/transactions/intents/CoinWithBalance.js +1 -145
- package/dist/cjs/transactions/object.js +1 -87
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +1 -11
- package/dist/cjs/transactions/pure.js +1 -36
- package/dist/cjs/transactions/resolve.js +1 -69
- package/dist/cjs/transactions/serializer.js +1 -167
- package/dist/cjs/transactions/utils.js +1 -121
- package/dist/cjs/utils/constants.js +1 -18
- package/dist/cjs/utils/derived-objects.js +1 -8
- package/dist/cjs/utils/dynamic-fields.js +1 -17
- package/dist/cjs/utils/format.js +1 -11
- package/dist/cjs/utils/index.js +1 -8
- package/dist/cjs/utils/move-registry.js +1 -24
- package/dist/cjs/utils/sui-types.js +1 -66
- package/dist/cjs/utils/suins.js +1 -33
- package/dist/cjs/verify/index.js +1 -1
- package/dist/cjs/verify/verify.js +1 -87
- package/dist/cjs/version.js +1 -2
- package/dist/cjs/w/call/allocation.js +1 -345
- package/dist/cjs/w/call/arb.js +1 -103
- package/dist/cjs/w/call/arbitration.js +1 -1192
- package/dist/cjs/w/call/base.js +1 -293
- package/dist/cjs/w/call/contact.js +1 -345
- package/dist/cjs/w/call/demand.js +1 -681
- package/dist/cjs/w/call/entity.js +1 -173
- package/dist/cjs/w/call/guard-ins.js +1 -4449
- package/dist/cjs/w/call/guard.d.ts +111 -0
- package/dist/cjs/w/call/guard.js +1 -1048
- package/dist/cjs/w/call/index.js +1 -22
- package/dist/cjs/w/call/machine.js +1 -1127
- package/dist/cjs/w/call/order.js +1 -337
- package/dist/cjs/w/call/passport.js +1 -220
- package/dist/cjs/w/call/payment.js +1 -178
- package/dist/cjs/w/call/permission.js +1 -1162
- package/dist/cjs/w/call/personal.js +1 -139
- package/dist/cjs/w/call/progress.js +1 -678
- package/dist/cjs/w/call/proof.js +1 -66
- package/dist/cjs/w/call/repository.js +1 -1024
- package/dist/cjs/w/call/resource.js +1 -108
- package/dist/cjs/w/call/reward.js +1 -675
- package/dist/cjs/w/call/service.js +1 -1960
- package/dist/cjs/w/call/treasury.js +1 -873
- package/dist/cjs/w/call/util.d.ts +1 -0
- package/dist/cjs/w/call/util.js +1 -566
- package/dist/cjs/w/common.js +1 -571
- package/dist/cjs/w/exception.js +1 -618
- package/dist/cjs/w/index.js +1 -8
- package/dist/cjs/w/local/account.js +1 -656
- package/dist/cjs/w/local/cache.js +1 -161
- package/dist/cjs/w/local/config.js +1 -43
- package/dist/cjs/w/local/index.js +1 -228
- package/dist/cjs/w/local/local.js +1 -574
- package/dist/cjs/w/local/storage.js +1 -185
- package/dist/cjs/w/local/token.js +1 -131
- package/dist/cjs/w/local/util.js +1 -26
- package/dist/cjs/w/local/wip.js +1 -864
- package/dist/cjs/w/messenger/crypto.js +1 -380
- package/dist/cjs/w/messenger/index.js +1 -4
- package/dist/cjs/w/messenger/messenger-api.js +1 -1154
- package/dist/cjs/w/messenger/messenger-manager.js +1 -1003
- package/dist/cjs/w/messenger/messenger.js +1 -1093
- package/dist/cjs/w/messenger/server.js +1 -343
- package/dist/cjs/w/messenger/session.js +1 -628
- package/dist/cjs/w/messenger/storage.js +1 -1023
- package/dist/cjs/w/messenger/templates/wts-html-template.js +1 -371
- package/dist/cjs/w/messenger/types.js +1 -76
- package/dist/cjs/w/messenger/utils.js +1 -12
- package/dist/cjs/w/query/bult-in.js +1 -95
- package/dist/cjs/w/query/event.js +1 -137
- package/dist/cjs/w/query/index.js +1 -5
- package/dist/cjs/w/query/object.js +1 -1550
- package/dist/cjs/w/query/received.js +1 -62
- package/dist/cjs/w/query/util.js +1 -49
- package/dist/cjs/w/util.js +1 -587
- package/dist/esm/bcs/bcs.js +1 -253
- package/dist/esm/bcs/effects.js +1 -199
- package/dist/esm/bcs/index.js +1 -51
- package/dist/esm/bcs/pure.js +1 -36
- package/dist/esm/bcs/type-tag-serializer.js +1 -104
- package/dist/esm/bcs/types.js +1 -3
- package/dist/esm/client/index.js +1 -4
- package/dist/esm/client/network.js +1 -15
- package/dist/esm/cryptography/index.js +1 -6
- package/dist/esm/cryptography/intent.js +1 -14
- package/dist/esm/cryptography/keypair.js +1 -74
- package/dist/esm/cryptography/mnemonics.js +1 -20
- package/dist/esm/cryptography/publickey.js +1 -80
- package/dist/esm/cryptography/signature-scheme.js +1 -22
- package/dist/esm/cryptography/signature.js +1 -41
- package/dist/esm/experimental/cache.js +1 -58
- package/dist/esm/experimental/client.js +1 -19
- package/dist/esm/experimental/core.js +1 -80
- package/dist/esm/experimental/errors.js +1 -24
- package/dist/esm/experimental/index.js +1 -5
- package/dist/esm/experimental/persistent-storage.js +1 -220
- package/dist/esm/experimental/persistent-storage.test.js +1 -144
- package/dist/esm/experimental/transports/utils.js +1 -96
- package/dist/esm/experimental/types.js +1 -1
- package/dist/esm/faucet/faucet.js +1 -99
- package/dist/esm/faucet/index.js +1 -1
- package/dist/esm/grpc/client.js +1 -42
- package/dist/esm/grpc/core.js +1 -587
- package/dist/esm/grpc/index.js +1 -2
- package/dist/esm/grpc/proto/google/protobuf/any.js +1 -106
- package/dist/esm/grpc/proto/google/protobuf/duration.js +1 -58
- package/dist/esm/grpc/proto/google/protobuf/empty.js +1 -7
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +1 -47
- package/dist/esm/grpc/proto/google/protobuf/struct.js +1 -191
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +1 -91
- package/dist/esm/grpc/proto/google/rpc/error_details.js +1 -265
- package/dist/esm/grpc/proto/google/rpc/status.js +1 -23
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +1 -46
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +1 -29
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +1 -22
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +1 -54
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +1 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +1 -144
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +1 -271
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +1 -64
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +1 -6
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +1 -62
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +1 -64
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +1 -481
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +1 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +1 -61
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +1 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +1 -39
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +1 -329
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +1 -447
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +1 -27
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +1 -206
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +1 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +1 -109
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +1 -90
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +1 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +1 -39
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +1 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +1 -501
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +1 -10
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +1 -15
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +1 -62
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +1 -31
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +1 -504
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +1 -15
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +1 -37
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +1 -709
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1 -950
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +1 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +1 -144
- package/dist/esm/index.js +1 -22
- package/dist/esm/jsonRpc/client.js +1 -516
- package/dist/esm/jsonRpc/core.js +1 -587
- package/dist/esm/jsonRpc/errors.js +1 -38
- package/dist/esm/jsonRpc/http-transport.js +1 -70
- package/dist/esm/jsonRpc/index.js +1 -3
- package/dist/esm/jsonRpc/json-rpc-resolver.js +1 -296
- package/dist/esm/jsonRpc/rpc-websocket-client.js +1 -155
- package/dist/esm/jsonRpc/types/chain.js +1 -1
- package/dist/esm/jsonRpc/types/changes.js +1 -1
- package/dist/esm/jsonRpc/types/coins.js +1 -1
- package/dist/esm/jsonRpc/types/common.js +1 -1
- package/dist/esm/jsonRpc/types/generated.js +1 -1
- package/dist/esm/jsonRpc/types/index.js +1 -1
- package/dist/esm/jsonRpc/types/params.js +1 -1
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +1 -58
- package/dist/esm/keypairs/ed25519/index.js +1 -2
- package/dist/esm/keypairs/ed25519/keypair.js +1 -90
- package/dist/esm/keypairs/ed25519/publickey.js +1 -50
- package/dist/esm/keypairs/index.js +1 -4
- package/dist/esm/keypairs/passkey/index.js +1 -2
- package/dist/esm/keypairs/passkey/keypair.js +1 -155
- package/dist/esm/keypairs/passkey/publickey.js +1 -117
- package/dist/esm/keypairs/passkey/types.js +1 -1
- package/dist/esm/keypairs/secp256k1/index.js +1 -2
- package/dist/esm/keypairs/secp256k1/keypair.js +1 -82
- package/dist/esm/keypairs/secp256k1/publickey.js +1 -51
- package/dist/esm/keypairs/secp256r1/index.js +1 -2
- package/dist/esm/keypairs/secp256r1/keypair.js +1 -78
- package/dist/esm/keypairs/secp256r1/publickey.js +1 -52
- package/dist/esm/multisig/index.js +1 -2
- package/dist/esm/multisig/publickey.js +1 -201
- package/dist/esm/multisig/signer.js +1 -58
- package/dist/esm/transactions/Arguments.js +1 -9
- package/dist/esm/transactions/Commands.js +1 -102
- package/dist/esm/transactions/Inputs.js +1 -52
- package/dist/esm/transactions/ObjectCache.js +1 -205
- package/dist/esm/transactions/Transaction.js +1 -574
- package/dist/esm/transactions/TransactionData.js +1 -409
- package/dist/esm/transactions/__tests__/Transaction.test.js +1 -160
- package/dist/esm/transactions/__tests__/bcs.test.js +1 -182
- package/dist/esm/transactions/data/internal.js +1 -169
- package/dist/esm/transactions/data/v1.js +1 -469
- package/dist/esm/transactions/data/v2.js +1 -97
- package/dist/esm/transactions/executor/caching.js +1 -65
- package/dist/esm/transactions/executor/parallel.js +1 -347
- package/dist/esm/transactions/executor/queue.js +1 -59
- package/dist/esm/transactions/executor/serial.js +1 -99
- package/dist/esm/transactions/hash.js +1 -8
- package/dist/esm/transactions/index.js +1 -12
- package/dist/esm/transactions/intents/CoinWithBalance.js +1 -145
- package/dist/esm/transactions/object.js +1 -87
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +1 -11
- package/dist/esm/transactions/pure.js +1 -36
- package/dist/esm/transactions/resolve.js +1 -69
- package/dist/esm/transactions/serializer.js +1 -167
- package/dist/esm/transactions/utils.js +1 -121
- package/dist/esm/utils/constants.js +1 -18
- package/dist/esm/utils/derived-objects.js +1 -8
- package/dist/esm/utils/dynamic-fields.js +1 -17
- package/dist/esm/utils/format.js +1 -11
- package/dist/esm/utils/index.js +1 -8
- package/dist/esm/utils/move-registry.js +1 -24
- package/dist/esm/utils/sui-types.js +1 -66
- package/dist/esm/utils/suins.js +1 -33
- package/dist/esm/verify/index.js +1 -1
- package/dist/esm/verify/verify.js +1 -87
- package/dist/esm/version.js +1 -2
- package/dist/esm/w/call/allocation.js +1 -345
- package/dist/esm/w/call/arb.js +1 -103
- package/dist/esm/w/call/arbitration.js +1 -1192
- package/dist/esm/w/call/base.js +1 -293
- package/dist/esm/w/call/contact.js +1 -345
- package/dist/esm/w/call/demand.js +1 -681
- package/dist/esm/w/call/entity.js +1 -173
- package/dist/esm/w/call/guard-ins.js +1 -4449
- package/dist/esm/w/call/guard.d.ts +111 -0
- package/dist/esm/w/call/guard.js +1 -1048
- package/dist/esm/w/call/index.js +1 -22
- package/dist/esm/w/call/machine.js +1 -1127
- package/dist/esm/w/call/order.js +1 -337
- package/dist/esm/w/call/passport.js +1 -220
- package/dist/esm/w/call/payment.js +1 -178
- package/dist/esm/w/call/permission.js +1 -1162
- package/dist/esm/w/call/personal.js +1 -139
- package/dist/esm/w/call/progress.js +1 -678
- package/dist/esm/w/call/proof.js +1 -66
- package/dist/esm/w/call/repository.js +1 -1024
- package/dist/esm/w/call/resource.js +1 -108
- package/dist/esm/w/call/reward.js +1 -675
- package/dist/esm/w/call/service.js +1 -1960
- package/dist/esm/w/call/treasury.js +1 -873
- package/dist/esm/w/call/util.d.ts +1 -0
- package/dist/esm/w/call/util.js +1 -566
- package/dist/esm/w/common.js +1 -571
- package/dist/esm/w/exception.js +1 -618
- package/dist/esm/w/index.js +1 -8
- package/dist/esm/w/local/account.js +1 -656
- package/dist/esm/w/local/cache.js +1 -161
- package/dist/esm/w/local/config.js +1 -43
- package/dist/esm/w/local/index.js +1 -228
- package/dist/esm/w/local/local.js +1 -574
- package/dist/esm/w/local/storage.js +1 -185
- package/dist/esm/w/local/token.js +1 -131
- package/dist/esm/w/local/util.js +1 -26
- package/dist/esm/w/local/wip.js +1 -864
- package/dist/esm/w/messenger/crypto.js +1 -380
- package/dist/esm/w/messenger/index.js +1 -4
- package/dist/esm/w/messenger/messenger-api.js +1 -1154
- package/dist/esm/w/messenger/messenger-manager.js +1 -1003
- package/dist/esm/w/messenger/messenger.js +1 -1093
- package/dist/esm/w/messenger/server.js +1 -343
- package/dist/esm/w/messenger/session.js +1 -628
- package/dist/esm/w/messenger/storage.js +1 -1023
- package/dist/esm/w/messenger/templates/wts-html-template.js +1 -371
- package/dist/esm/w/messenger/types.js +1 -76
- package/dist/esm/w/messenger/utils.js +1 -12
- package/dist/esm/w/query/bult-in.js +1 -95
- package/dist/esm/w/query/event.js +1 -137
- package/dist/esm/w/query/index.js +1 -5
- package/dist/esm/w/query/object.js +1 -1550
- package/dist/esm/w/query/received.js +1 -62
- package/dist/esm/w/query/util.js +1 -49
- package/dist/esm/w/util.js +1 -587
- package/package.json +5 -2
package/dist/cjs/w/call/base.js
CHANGED
|
@@ -1,293 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Transaction } from "../../transactions/index.js";
|
|
3
|
-
import { isValidWowAddress } from "../../utils/sui-types.js";
|
|
4
|
-
import { isValidU64, toTxObject } from "../common.js";
|
|
5
|
-
import { W_ERROR, WErrors } from "../exception.js";
|
|
6
|
-
import _ from "lodash";
|
|
7
|
-
import { Account } from "../local/account.js";
|
|
8
|
-
import { LocalMark } from "../local/local.js";
|
|
9
|
-
import { query_objects, queryTableItem_PermissionPerm, queryTableItem_EntityRegistrar, raw2type, } from "../query/object.js";
|
|
10
|
-
import { destroy, freeze, get_guardSubmissions, guardAdd, newPassport, verify, } from "./passport.js";
|
|
11
|
-
import { addObjectTags, TagName, create as createResource, } from "./resource.js";
|
|
12
|
-
import { register_with_resource_forced } from "./entity.js";
|
|
13
|
-
import { getCallEnvAccount, resolveCallEnv } from "./util.js";
|
|
14
|
-
import { Config } from "../local/config.js";
|
|
15
|
-
export function isCallResultSubmission(result) {
|
|
16
|
-
return (result?.submission && result?.submission?.length > 0);
|
|
17
|
-
}
|
|
18
|
-
export function ResponseData(response) {
|
|
19
|
-
if (response?.digest) {
|
|
20
|
-
const res = [];
|
|
21
|
-
response?.objectChanges?.forEach((v) => {
|
|
22
|
-
const type_raw = v?.objectType;
|
|
23
|
-
const type = raw2type(type_raw);
|
|
24
|
-
if (type) {
|
|
25
|
-
res.push({
|
|
26
|
-
type: type,
|
|
27
|
-
type_raw: type_raw,
|
|
28
|
-
object: v?.objectId,
|
|
29
|
-
version: v?.version,
|
|
30
|
-
owner: v?.owner,
|
|
31
|
-
change: v.type,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return res;
|
|
36
|
-
}
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
export class CallBase {
|
|
40
|
-
newResource;
|
|
41
|
-
traceMarkNew = new Map();
|
|
42
|
-
content = undefined;
|
|
43
|
-
env_ready = false;
|
|
44
|
-
async operate(_env, _tx, _passport, _submission) { }
|
|
45
|
-
async prepare(env) {
|
|
46
|
-
await this.env_prepare(env);
|
|
47
|
-
}
|
|
48
|
-
async call(_env) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
async env_prepare(env) {
|
|
52
|
-
if (this.env_ready) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
await resolveCallEnv(env);
|
|
56
|
-
this.env_ready = true;
|
|
57
|
-
}
|
|
58
|
-
async call_with_submission(env, info, freezePassport) {
|
|
59
|
-
if (info.guard.length > 0) {
|
|
60
|
-
await this.prepare(env);
|
|
61
|
-
await this.check_passport(env, info, freezePassport);
|
|
62
|
-
}
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
async check_guard_and_call(env, guards_needed) {
|
|
66
|
-
env.permission_guard?.forEach((guard) => {
|
|
67
|
-
if (!isValidWowAddress(guard)) {
|
|
68
|
-
W_ERROR(WErrors.IsValidAddress, `env permission_guard: ${guard}`);
|
|
69
|
-
}
|
|
70
|
-
guards_needed.push(guard);
|
|
71
|
-
});
|
|
72
|
-
if (guards_needed.length > 0) {
|
|
73
|
-
const param = await get_guardSubmissions(env, guards_needed);
|
|
74
|
-
if (param.submission.length > 0) {
|
|
75
|
-
return {
|
|
76
|
-
type: "submission",
|
|
77
|
-
guard: param.guard,
|
|
78
|
-
submission: param.submission,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return await this.check_passport(env, param);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
return await this.exec(env);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async check_permission_and_call(env, permission, permIndex, guards_needed, checkOwner, checkAdmin) {
|
|
88
|
-
let bAdmin = false;
|
|
89
|
-
const p = await query_objects({
|
|
90
|
-
objects: [permission],
|
|
91
|
-
no_cache: env.no_cache,
|
|
92
|
-
network: env.network,
|
|
93
|
-
});
|
|
94
|
-
if (!p.objects?.[0] || p.objects?.[0].type !== "Permission") {
|
|
95
|
-
W_ERROR(WErrors.NoPermission, "permission object not found");
|
|
96
|
-
}
|
|
97
|
-
const perm_object = p.objects?.[0];
|
|
98
|
-
const acc = await getCallEnvAccount(env);
|
|
99
|
-
bAdmin = perm_object.admin.includes(acc);
|
|
100
|
-
if (checkOwner && perm_object.builder !== acc)
|
|
101
|
-
W_ERROR(WErrors.NoPermission, `${acc} owner permission required`);
|
|
102
|
-
if (checkAdmin && !bAdmin)
|
|
103
|
-
W_ERROR(WErrors.NoPermission, `${acc} admin permission required`);
|
|
104
|
-
env.permission_guard?.forEach((guard) => {
|
|
105
|
-
if (!isValidWowAddress(guard)) {
|
|
106
|
-
W_ERROR(WErrors.IsValidAddress, `env permission_guard ${guard}`);
|
|
107
|
-
}
|
|
108
|
-
guards_needed.push(guard);
|
|
109
|
-
});
|
|
110
|
-
if (permIndex.length > 0 && !bAdmin) {
|
|
111
|
-
const addressesToCheck = [acc, ...(env.permission_guard ?? [])];
|
|
112
|
-
const permissionPromises = addressesToCheck.map(async (address) => {
|
|
113
|
-
const p = await queryTableItem_PermissionPerm({
|
|
114
|
-
parent: permission,
|
|
115
|
-
address: address,
|
|
116
|
-
no_cache: env.no_cache,
|
|
117
|
-
network: env.network,
|
|
118
|
-
});
|
|
119
|
-
if (p && p.type === "TableItem_PermissionPerm") {
|
|
120
|
-
const perm = p;
|
|
121
|
-
return { address, permissions: perm.perm };
|
|
122
|
-
}
|
|
123
|
-
return { address, permissions: [] };
|
|
124
|
-
});
|
|
125
|
-
const permissionResults = await Promise.all(permissionPromises);
|
|
126
|
-
const allAvailablePermissions = new Set();
|
|
127
|
-
permissionResults.forEach((result) => {
|
|
128
|
-
result.permissions.forEach((perm) => allAvailablePermissions.add(perm));
|
|
129
|
-
});
|
|
130
|
-
const missingPermissions = permIndex.filter((perm) => !allAvailablePermissions.has(perm));
|
|
131
|
-
if (missingPermissions.length > 0) {
|
|
132
|
-
W_ERROR(WErrors.NoPermission, `Missing permissions ${missingPermissions.join(", ")} in ${permission}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (guards_needed.length > 0) {
|
|
136
|
-
const param = await get_guardSubmissions(env, guards_needed);
|
|
137
|
-
if (param.submission.length > 0) {
|
|
138
|
-
return {
|
|
139
|
-
type: "submission",
|
|
140
|
-
guard: param.guard,
|
|
141
|
-
submission: param.submission,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return await this.check_passport(env, param);
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
return await this.exec(env);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
async check_passport(env, param, freezePassport) {
|
|
151
|
-
const tx = new Transaction();
|
|
152
|
-
const passport = newPassport(tx);
|
|
153
|
-
for (const v of param.guard) {
|
|
154
|
-
await guardAdd(tx, passport, v.object, param.submission.find((i) => i.guard === v.object)
|
|
155
|
-
?.submission ?? [], v.impack);
|
|
156
|
-
}
|
|
157
|
-
verify(tx, passport);
|
|
158
|
-
await this.operate(env, tx, passport, param.submission);
|
|
159
|
-
if (freezePassport) {
|
|
160
|
-
freeze(tx, passport);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
destroy(tx, passport);
|
|
164
|
-
}
|
|
165
|
-
return await this.sign_and_commit(env, tx);
|
|
166
|
-
}
|
|
167
|
-
async exec(env) {
|
|
168
|
-
const tx = new Transaction();
|
|
169
|
-
await this.operate(env, tx);
|
|
170
|
-
return await this.sign_and_commit(env, tx);
|
|
171
|
-
}
|
|
172
|
-
async new_with_mark(env, tx, type, object, named_new, innerTags = [TagName.Launch]) {
|
|
173
|
-
const tags = named_new?.tags
|
|
174
|
-
? _.uniq([...named_new.tags, ...innerTags])
|
|
175
|
-
: _.uniq([...innerTags]);
|
|
176
|
-
if (named_new) {
|
|
177
|
-
named_new.tags = tags;
|
|
178
|
-
this.traceMarkNew.set(type, named_new);
|
|
179
|
-
}
|
|
180
|
-
if (!named_new?.onChain)
|
|
181
|
-
return;
|
|
182
|
-
if (!this.newResource) {
|
|
183
|
-
let r;
|
|
184
|
-
try {
|
|
185
|
-
r = await queryTableItem_EntityRegistrar({
|
|
186
|
-
address: await getCallEnvAccount(env),
|
|
187
|
-
no_cache: env.no_cache,
|
|
188
|
-
network: env.network,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
catch (e) {
|
|
192
|
-
}
|
|
193
|
-
if (r && r.type !== "TableItem_EntityRegistrar") {
|
|
194
|
-
W_ERROR(WErrors.NoPermission, "no entity registrar found");
|
|
195
|
-
}
|
|
196
|
-
if (r?.mark_object) {
|
|
197
|
-
addObjectTags(tx, r.mark_object, {
|
|
198
|
-
address: object,
|
|
199
|
-
tags,
|
|
200
|
-
});
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
this.newResource = register_with_resource_forced(tx, typeof env.referrer === "string" ? env.referrer : null);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (this.newResource) {
|
|
208
|
-
addObjectTags(tx, this.newResource, {
|
|
209
|
-
address: object,
|
|
210
|
-
tags,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
async update_content(env, type, object) {
|
|
215
|
-
if (this.content || !object)
|
|
216
|
-
return;
|
|
217
|
-
const r = await query_objects({
|
|
218
|
-
objects: [object],
|
|
219
|
-
no_cache: env.no_cache,
|
|
220
|
-
network: env.network,
|
|
221
|
-
});
|
|
222
|
-
if (!r.objects ||
|
|
223
|
-
r?.objects?.length !== 1 ||
|
|
224
|
-
r?.objects[0]?.type !== type) {
|
|
225
|
-
W_ERROR(WErrors.Fail, `Fetch ${type} object ${object} failed`);
|
|
226
|
-
}
|
|
227
|
-
this.content = r?.objects[0];
|
|
228
|
-
}
|
|
229
|
-
async sign_and_commit(env, tx) {
|
|
230
|
-
if (this.newResource) {
|
|
231
|
-
createResource(tx, this.newResource);
|
|
232
|
-
this.newResource = undefined;
|
|
233
|
-
}
|
|
234
|
-
let r = await Account.Instance().sign_and_commit(tx, await getCallEnvAccount(env), env.network);
|
|
235
|
-
if (!r) {
|
|
236
|
-
W_ERROR(WErrors.Fail, "sign and commit failed");
|
|
237
|
-
}
|
|
238
|
-
if (r?.digest && !r?.objectChanges) {
|
|
239
|
-
const client = new SuiClient({
|
|
240
|
-
url: getFullnodeUrl(await Config.Instance().network_get(env.network)),
|
|
241
|
-
});
|
|
242
|
-
r = await client.getTransactionBlock({
|
|
243
|
-
digest: r?.digest,
|
|
244
|
-
options: { showObjectChanges: true },
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
const res = ResponseData(r);
|
|
248
|
-
for (let i = 0; i < res.length; ++i) {
|
|
249
|
-
const v = res[i];
|
|
250
|
-
if (v.type && v.change === "created") {
|
|
251
|
-
const namedNew = this.traceMarkNew.get(v.type);
|
|
252
|
-
if (namedNew) {
|
|
253
|
-
await LocalMark.Instance().put([
|
|
254
|
-
{
|
|
255
|
-
name: namedNew.name
|
|
256
|
-
? {
|
|
257
|
-
value: namedNew.name,
|
|
258
|
-
replaceExistName: namedNew.replaceExistName,
|
|
259
|
-
}
|
|
260
|
-
: undefined,
|
|
261
|
-
address: v.object,
|
|
262
|
-
tags: namedNew?.tags
|
|
263
|
-
? [...namedNew.tags, v.type]
|
|
264
|
-
: [v.type],
|
|
265
|
-
},
|
|
266
|
-
]);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return r;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
export async function getCoinParam(env, tx, coin, coinType) {
|
|
274
|
-
let coinParam;
|
|
275
|
-
if ("balance" in coin && coin.balance != null) {
|
|
276
|
-
if (!isValidU64(coin.balance)) {
|
|
277
|
-
W_ERROR(WErrors.IsValidU64, `Total pay balance ${coin.balance} is not valid`);
|
|
278
|
-
}
|
|
279
|
-
coinParam = await Account.Instance().get_coin_object(tx, coin.balance, coinType, await getCallEnvAccount(env), env.network);
|
|
280
|
-
}
|
|
281
|
-
else if ("coin" in coin && coin.coin != null) {
|
|
282
|
-
if (typeof coin.coin === "string") {
|
|
283
|
-
coinParam = await LocalMark.Instance().get_address(coin.coin);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
coinParam = coin.coin;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
if (!coinParam) {
|
|
290
|
-
W_ERROR(WErrors.InvalidParam, `Total pay ${JSON.stringify(coin)} is allocated failed`);
|
|
291
|
-
}
|
|
292
|
-
return toTxObject(tx, coinParam);
|
|
293
|
-
}
|
|
1
|
+
import{getFullnodeUrl,SuiClient}from'../../client/index.js';import{Transaction}from'../../transactions/index.js';import{isValidWowAddress}from'../../utils/sui-types.js';import{isValidU64,toTxObject}from'../common.js';import{W_ERROR,WErrors}from'../exception.js';import a146a from'lodash';import{Account}from'../local/account.js';import{LocalMark}from'../local/local.js';import{query_objects,queryTableItem_PermissionPerm,queryTableItem_EntityRegistrar,raw2type}from'../query/object.js';import{destroy,freeze,get_guardSubmissions,guardAdd,newPassport,verify}from'./passport.js';import{addObjectTags,TagName,create as a146b}from'./resource.js';import{register_with_resource_forced}from'./entity.js';import{getCallEnvAccount,resolveCallEnv}from'./util.js';import{Config}from'../local/config.js';export function isCallResultSubmission(a){return a?.['submission']&&a?.['submission']?.['length']>0x0;}export function ResponseData(a){if(a?.['digest']){const b=[];return a?.['objectChanges']?.['forEach'](c=>{const d=c?.['objectType'],e=raw2type(d);e&&b['push']({'type':e,'type_raw':d,'object':c?.['objectId'],'version':c?.['version'],'owner':c?.['owner'],'change':c['type']});}),b;}return[];}export class CallBase{['newResource'];['traceMarkNew']=new Map();['content']=undefined;['env_ready']=![];async['operate'](a,b,c,d){}async['prepare'](a){await this['env_prepare'](a);}async['call'](a){return undefined;}async['env_prepare'](a){if(this['env_ready'])return;await resolveCallEnv(a),this['env_ready']=!![];}async['call_with_submission'](a,b,c){return b['guard']['length']>0x0&&(await this['prepare'](a),await this['check_passport'](a,b,c)),undefined;}async['check_guard_and_call'](a,b){a['permission_guard']?.['forEach'](c=>{!isValidWowAddress(c)&&W_ERROR(WErrors['IsValidAddress'],'env\x20permission_guard:\x20'+c),b['push'](c);});if(b['length']>0x0){const c=await get_guardSubmissions(a,b);if(c['submission']['length']>0x0)return{'type':'submission','guard':c['guard'],'submission':c['submission']};return await this['check_passport'](a,c);}else return await this['exec'](a);}async['check_permission_and_call'](a,b,c,d,e,f){let g=![];const h=await query_objects({'objects':[b],'no_cache':a['no_cache'],'network':a['network']});(!h['objects']?.[0x0]||h['objects']?.[0x0]['type']!=='Permission')&&W_ERROR(WErrors['NoPermission'],'permission\x20object\x20not\x20found');const i=h['objects']?.[0x0],j=await getCallEnvAccount(a);g=i['admin']['includes'](j);if(e&&i['builder']!==j)W_ERROR(WErrors['NoPermission'],j+'\x20owner\x20permission\x20required');if(f&&!g)W_ERROR(WErrors['NoPermission'],j+'\x20admin\x20permission\x20required');a['permission_guard']?.['forEach'](k=>{!isValidWowAddress(k)&&W_ERROR(WErrors['IsValidAddress'],'env\x20permission_guard\x20'+k),d['push'](k);});if(c['length']>0x0&&!g){const k=[j,...a['permission_guard']??[]],l=k['map'](async q=>{const r=await queryTableItem_PermissionPerm({'parent':b,'address':q,'no_cache':a['no_cache'],'network':a['network']});if(r&&r['type']==='TableItem_PermissionPerm'){const s=r;return{'address':q,'permissions':s['perm']};}return{'address':q,'permissions':[]};}),m=await Promise['all'](l),n=new Set();m['forEach'](q=>{q['permissions']['forEach'](r=>n['add'](r));});const o=c['filter'](q=>!n['has'](q));o['length']>0x0&&W_ERROR(WErrors['NoPermission'],'Missing\x20permissions\x20'+o['join'](',\x20')+'\x20in\x20'+b);}if(d['length']>0x0){const q=await get_guardSubmissions(a,d);if(q['submission']['length']>0x0)return{'type':'submission','guard':q['guard'],'submission':q['submission']};return await this['check_passport'](a,q);}else return await this['exec'](a);}async['check_passport'](a,b,c){const d=new Transaction(),e=newPassport(d);for(const f of b['guard']){await guardAdd(d,e,f['object'],b['submission']['find'](g=>g['guard']===f['object'])?.['submission']??[],f['impack']);}return verify(d,e),await this['operate'](a,d,e,b['submission']),c?freeze(d,e):destroy(d,e),await this['sign_and_commit'](a,d);}async['exec'](a){const b=new Transaction();return await this['operate'](a,b),await this['sign_and_commit'](a,b);}async['new_with_mark'](a,b,c,d,f,g=[TagName['Launch']]){const h=f?.['tags']?a146a['uniq']([...f['tags'],...g]):a146a['uniq']([...g]);f&&(f['tags']=h,this['traceMarkNew']['set'](c,f));if(!f?.['onChain'])return;if(!this['newResource']){let i;try{i=await queryTableItem_EntityRegistrar({'address':await getCallEnvAccount(a),'no_cache':a['no_cache'],'network':a['network']});}catch(j){}i&&i['type']!=='TableItem_EntityRegistrar'&&W_ERROR(WErrors['NoPermission'],'no\x20entity\x20registrar\x20found');if(i?.['mark_object']){addObjectTags(b,i['mark_object'],{'address':d,'tags':h});return;}else this['newResource']=register_with_resource_forced(b,typeof a['referrer']==='string'?a['referrer']:null);}this['newResource']&&addObjectTags(b,this['newResource'],{'address':d,'tags':h});}async['update_content'](a,b,c){if(this['content']||!c)return;const d=await query_objects({'objects':[c],'no_cache':a['no_cache'],'network':a['network']});(!d['objects']||d?.['objects']?.['length']!==0x1||d?.['objects'][0x0]?.['type']!==b)&&W_ERROR(WErrors['Fail'],'Fetch\x20'+b+'\x20object\x20'+c+'\x20failed'),this['content']=d?.['objects'][0x0];}async['sign_and_commit'](a,b){this['newResource']&&(a146b(b,this['newResource']),this['newResource']=undefined);let c=await Account['Instance']()['sign_and_commit'](b,await getCallEnvAccount(a),a['network']);!c&&W_ERROR(WErrors['Fail'],'sign\x20and\x20commit\x20failed');if(c?.['digest']&&!c?.['objectChanges']){const e=new SuiClient({'url':getFullnodeUrl(await Config['Instance']()['network_get'](a['network']))});c=await e['getTransactionBlock']({'digest':c?.['digest'],'options':{'showObjectChanges':!![]}});}const d=ResponseData(c);for(let f=0x0;f<d['length'];++f){const g=d[f];if(g['type']&&g['change']==='created'){const h=this['traceMarkNew']['get'](g['type']);h&&await LocalMark['Instance']()['put']([{'name':h['name']?{'value':h['name'],'replaceExistName':h['replaceExistName']}:undefined,'address':g['object'],'tags':h?.['tags']?[...h['tags'],g['type']]:[g['type']]}]);}}return c;}}export async function getCoinParam(a,b,c,d){let e;if('balance'in c&&c['balance']!=null)!isValidU64(c['balance'])&&W_ERROR(WErrors['IsValidU64'],'Total\x20pay\x20balance\x20'+c['balance']+'\x20is\x20not\x20valid'),e=await Account['Instance']()['get_coin_object'](b,c['balance'],d,await getCallEnvAccount(a),a['network']);else'coin'in c&&c['coin']!=null&&(typeof c['coin']==='string'?e=await LocalMark['Instance']()['get_address'](c['coin']):e=c['coin']);return!e&&W_ERROR(WErrors['InvalidParam'],'Total\x20pay\x20'+JSON['stringify'](c)+'\x20is\x20allocated\x20failed'),toTxObject(b,e);}
|
|
@@ -1,345 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { W_ERROR, WErrors } from "../exception.js";
|
|
3
|
-
import { ObjectType } from "../query/object.js";
|
|
4
|
-
import { CallBase } from "./base.js";
|
|
5
|
-
import { BuiltinPermissionIndex, newPermission } from "./permission.js";
|
|
6
|
-
import { create as permission_create } from "./permission.js";
|
|
7
|
-
import { owner_receive, validObjects } from "../util.js";
|
|
8
|
-
import { Account } from "../local/index.js";
|
|
9
|
-
import { query_received } from "../query/received.js";
|
|
10
|
-
import { isValidWowAddress } from "../../utils/sui-types.js";
|
|
11
|
-
export const MAX_IM_COUNT = 200;
|
|
12
|
-
export class CallContact extends CallBase {
|
|
13
|
-
data;
|
|
14
|
-
object_address = undefined;
|
|
15
|
-
permission_address = undefined;
|
|
16
|
-
new_permission_description = undefined;
|
|
17
|
-
constructor(data) {
|
|
18
|
-
super();
|
|
19
|
-
this.data = data;
|
|
20
|
-
}
|
|
21
|
-
async prepare(env) {
|
|
22
|
-
await super.prepare(env);
|
|
23
|
-
if (!this.object_address) {
|
|
24
|
-
this.object_address = await GetObjectExisted(this.data?.object);
|
|
25
|
-
}
|
|
26
|
-
if (this.object_address) {
|
|
27
|
-
this.content = undefined;
|
|
28
|
-
await this.update_content(env, ObjectType.Contact, this.object_address);
|
|
29
|
-
if (!this.content)
|
|
30
|
-
W_ERROR(WErrors.InvalidParam, "CallContact_Data.data.object:" + this.object_address);
|
|
31
|
-
this.permission_address = this.content.permission;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
const n = GetObject(this.data.object);
|
|
35
|
-
this.permission_address = await GetObjectExisted(n?.permission);
|
|
36
|
-
this.new_permission_description = GetObjectDescription(n?.permission);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async call(env) {
|
|
40
|
-
await this.prepare(env);
|
|
41
|
-
const perms = [];
|
|
42
|
-
const guards = [];
|
|
43
|
-
const add_perm = (index) => {
|
|
44
|
-
if (this.permission_address && !perms.includes(index)) {
|
|
45
|
-
perms.push(index);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const content = this.content;
|
|
49
|
-
if (this.data?.my_status != null) {
|
|
50
|
-
if (!content || !content.ims.some((i) => i.at === env.account)) {
|
|
51
|
-
W_ERROR(WErrors.InvalidParam, "CallContact_Data.data.my_status: your account not in im list");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (this.permission_address && !this.object_address) {
|
|
55
|
-
add_perm(BuiltinPermissionIndex.MESSNGER_NEW);
|
|
56
|
-
}
|
|
57
|
-
if (this.permission_address &&
|
|
58
|
-
this.data?.description != null &&
|
|
59
|
-
this.object_address) {
|
|
60
|
-
add_perm(BuiltinPermissionIndex.MESSNGER_DESCRIPTION);
|
|
61
|
-
}
|
|
62
|
-
if (this.permission_address && this.data?.location !== undefined) {
|
|
63
|
-
add_perm(BuiltinPermissionIndex.MESSNGER_LOCATION);
|
|
64
|
-
}
|
|
65
|
-
if (this.permission_address && this.data.ims != null) {
|
|
66
|
-
add_perm(BuiltinPermissionIndex.MESSNGER_IM);
|
|
67
|
-
}
|
|
68
|
-
if (this.permission_address && this.data?.owner_receive) {
|
|
69
|
-
add_perm(BuiltinPermissionIndex.MESSNGER_OWNER_RECEIVE);
|
|
70
|
-
}
|
|
71
|
-
if (this.permission_address || guards.length > 0) {
|
|
72
|
-
return await this.check_permission_and_call(env, this.permission_address, perms, guards);
|
|
73
|
-
}
|
|
74
|
-
return await this.exec(env);
|
|
75
|
-
}
|
|
76
|
-
async operate(env, tx, passport, submission) {
|
|
77
|
-
let permission = this.permission_address;
|
|
78
|
-
let object = this.object_address;
|
|
79
|
-
const content = this.content;
|
|
80
|
-
if (!this.object_address) {
|
|
81
|
-
if (!permission) {
|
|
82
|
-
permission = newPermission(tx, this.new_permission_description ?? "");
|
|
83
|
-
}
|
|
84
|
-
if (permission) {
|
|
85
|
-
object = newContact(tx, permission, this.data?.description ?? "", passport);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (!object || !permission) {
|
|
89
|
-
W_ERROR(WErrors.InvalidParam, "CallContact_Data.data.object:" + this.object_address);
|
|
90
|
-
}
|
|
91
|
-
if (this.data?.my_status != null) {
|
|
92
|
-
change_status(tx, object, this.data.my_status);
|
|
93
|
-
}
|
|
94
|
-
if (this.data?.description != null && this.object_address) {
|
|
95
|
-
description_set(tx, object, permission, this.data.description, passport);
|
|
96
|
-
}
|
|
97
|
-
if (this.data?.location != null) {
|
|
98
|
-
location_set(tx, object, permission, this.data.location, passport);
|
|
99
|
-
}
|
|
100
|
-
if (this.data?.ims != null) {
|
|
101
|
-
switch (this.data.ims.op) {
|
|
102
|
-
case "add":
|
|
103
|
-
case "set": {
|
|
104
|
-
if (this.data.ims.im.length >
|
|
105
|
-
MAX_IM_COUNT - (content?.ims?.length ?? 0)) {
|
|
106
|
-
W_ERROR(WErrors.InvalidParam, `CallContact_Data.data.ims.im exceeds max count:${MAX_IM_COUNT}`);
|
|
107
|
-
}
|
|
108
|
-
if (this.data.ims.op === "set") {
|
|
109
|
-
im_clear(tx, object, permission, passport);
|
|
110
|
-
}
|
|
111
|
-
const r = await Account.Instance().get_many_address(this.data.ims.im.map((x) => x.at));
|
|
112
|
-
const notFound = this.data.ims.im
|
|
113
|
-
.filter((_, index) => r[index] === undefined)
|
|
114
|
-
.map((x) => x.at);
|
|
115
|
-
if (notFound.length > 0) {
|
|
116
|
-
W_ERROR(WErrors.AddressNotFound, `Address not found: ${notFound.join(", ")}`);
|
|
117
|
-
}
|
|
118
|
-
for (let i = 0; i < r.length; i++) {
|
|
119
|
-
const addr = r[i];
|
|
120
|
-
if (addr) {
|
|
121
|
-
const imParam = this.data.ims.im[i];
|
|
122
|
-
im_add(tx, object, permission, addr, imParam?.description, passport);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case "remove": {
|
|
128
|
-
const r = await Account.Instance().get_many_address(this.data.ims.im);
|
|
129
|
-
const notFound = this.data.ims.im.filter((_, index) => r[index] === undefined);
|
|
130
|
-
if (notFound.length > 0) {
|
|
131
|
-
W_ERROR(WErrors.AddressNotFound, `Address not found: ${notFound.join(", ")}`);
|
|
132
|
-
}
|
|
133
|
-
im_remove(tx, object, permission, r.filter((x) => x != null), passport);
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
case "clear":
|
|
137
|
-
im_clear(tx, object, permission, passport);
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (this.data.owner_receive != null && this.object_address) {
|
|
142
|
-
if (this.data.owner_receive === "recently") {
|
|
143
|
-
this.data.owner_receive = await query_received({
|
|
144
|
-
object: this.object_address,
|
|
145
|
-
all_type: true,
|
|
146
|
-
no_cache: env.no_cache,
|
|
147
|
-
network: env.network,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
await owner_receive(tx, object, permission, this.data.owner_receive, undefined, (name) => `${PackageAddress}::contact::${name}`, passport);
|
|
151
|
-
}
|
|
152
|
-
if (!this.permission_address) {
|
|
153
|
-
const p = GetObject(this.data?.object);
|
|
154
|
-
await this.new_with_mark(env, tx, ObjectType.Permission, permission_create(tx, permission), GetObject(p.permission));
|
|
155
|
-
}
|
|
156
|
-
if (!this.object_address) {
|
|
157
|
-
await this.new_with_mark(env, tx, ObjectType.Contact, create(tx, object), GetObject(this.data?.object));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
export function create(tx, contact) {
|
|
162
|
-
return tx.moveCall({
|
|
163
|
-
target: contactFn("create"),
|
|
164
|
-
arguments: [toTxObject(tx, contact)],
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
export function change_status(tx, contact, status) {
|
|
168
|
-
if (!isValidName(status)) {
|
|
169
|
-
W_ERROR(WErrors.InvalidParam, `Status name(${status}) exceeds the length limit(${MAX_NAME_LENGTH})`);
|
|
170
|
-
}
|
|
171
|
-
return tx.moveCall({
|
|
172
|
-
target: contactFn("change_status"),
|
|
173
|
-
arguments: [toTxObject(tx, contact), toTxString(tx, status)],
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
export function newContact(tx, permission, description, passport) {
|
|
177
|
-
validObjects([permission]);
|
|
178
|
-
if (!isValidDescription(description)) {
|
|
179
|
-
W_ERROR(WErrors.IsValidDescription, `Description exceeds maximum length(${MAX_DESCRIPTION_LENGTH})`);
|
|
180
|
-
}
|
|
181
|
-
if (passport) {
|
|
182
|
-
return tx.moveCall({
|
|
183
|
-
target: contactFn("new_with_passport"),
|
|
184
|
-
arguments: [
|
|
185
|
-
toTxObject(tx, permission),
|
|
186
|
-
toTxObject(tx, passport),
|
|
187
|
-
toTxString(tx, description),
|
|
188
|
-
tx.object.mutRegistrar(),
|
|
189
|
-
tx.object.clock(),
|
|
190
|
-
],
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
return tx.moveCall({
|
|
195
|
-
target: contactFn("new"),
|
|
196
|
-
arguments: [
|
|
197
|
-
toTxObject(tx, permission),
|
|
198
|
-
toTxString(tx, description),
|
|
199
|
-
tx.object.mutRegistrar(),
|
|
200
|
-
tx.object.clock(),
|
|
201
|
-
],
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
export function description_set(tx, contact, permission, description, passport) {
|
|
206
|
-
validObjects([contact, permission]);
|
|
207
|
-
if (!isValidDescription(description)) {
|
|
208
|
-
W_ERROR(WErrors.IsValidDescription, `Description exceeds maximum length(${MAX_DESCRIPTION_LENGTH})`);
|
|
209
|
-
}
|
|
210
|
-
if (passport) {
|
|
211
|
-
tx.moveCall({
|
|
212
|
-
target: contactFn("description_set_with_passport"),
|
|
213
|
-
arguments: [
|
|
214
|
-
toTxObject(tx, contact),
|
|
215
|
-
toTxObject(tx, permission),
|
|
216
|
-
toTxObject(tx, passport),
|
|
217
|
-
toTxString(tx, description),
|
|
218
|
-
],
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
tx.moveCall({
|
|
223
|
-
target: contactFn("description_set"),
|
|
224
|
-
arguments: [
|
|
225
|
-
toTxObject(tx, contact),
|
|
226
|
-
toTxObject(tx, permission),
|
|
227
|
-
toTxString(tx, description),
|
|
228
|
-
],
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
export function location_set(tx, contact, permission, location, passport) {
|
|
233
|
-
validObjects([contact, permission]);
|
|
234
|
-
if (!isValidLongName(location)) {
|
|
235
|
-
W_ERROR(WErrors.IsValidLocation, `Location exceeds maximum length(${MAX_LONG_NAME_LENGTH})`);
|
|
236
|
-
}
|
|
237
|
-
if (passport) {
|
|
238
|
-
tx.moveCall({
|
|
239
|
-
target: contactFn("location_set_with_passport"),
|
|
240
|
-
arguments: [
|
|
241
|
-
toTxObject(tx, contact),
|
|
242
|
-
toTxObject(tx, permission),
|
|
243
|
-
toTxObject(tx, passport),
|
|
244
|
-
toTxString(tx, location),
|
|
245
|
-
],
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
tx.moveCall({
|
|
250
|
-
target: contactFn("location_set"),
|
|
251
|
-
arguments: [
|
|
252
|
-
toTxObject(tx, contact),
|
|
253
|
-
toTxObject(tx, permission),
|
|
254
|
-
toTxString(tx, location),
|
|
255
|
-
],
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
export function im_add(tx, contact, permission, im, description, passport) {
|
|
260
|
-
validObjects([contact, permission]);
|
|
261
|
-
if (!isValidWowAddress(im)) {
|
|
262
|
-
W_ERROR(WErrors.InvalidParam, `IM address(${im}) is not a valid address`);
|
|
263
|
-
}
|
|
264
|
-
if (description && !isValidDescription(description)) {
|
|
265
|
-
W_ERROR(WErrors.IsValidDescription, `Description exceeds maximum length(${MAX_DESCRIPTION_LENGTH})`);
|
|
266
|
-
}
|
|
267
|
-
if (passport) {
|
|
268
|
-
tx.moveCall({
|
|
269
|
-
target: contactFn("im_add_with_passport"),
|
|
270
|
-
arguments: [
|
|
271
|
-
toTxObject(tx, contact),
|
|
272
|
-
toTxObject(tx, permission),
|
|
273
|
-
toTxObject(tx, passport),
|
|
274
|
-
toTxAddress(tx, im),
|
|
275
|
-
tx.pure.option("string", description),
|
|
276
|
-
tx.object.clock(),
|
|
277
|
-
],
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
tx.moveCall({
|
|
282
|
-
target: contactFn("im_add"),
|
|
283
|
-
arguments: [
|
|
284
|
-
toTxObject(tx, contact),
|
|
285
|
-
toTxObject(tx, permission),
|
|
286
|
-
toTxAddress(tx, im),
|
|
287
|
-
tx.pure.option("string", description),
|
|
288
|
-
tx.object.clock(),
|
|
289
|
-
],
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
export function im_remove(tx, contact, permission, im, passport) {
|
|
294
|
-
if (im.length === 0) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
validObjects([contact, permission]);
|
|
298
|
-
isValidArray(im, (item) => {
|
|
299
|
-
if (!isValidWowAddress(item)) {
|
|
300
|
-
W_ERROR(WErrors.InvalidParam, `IM address(${item}) is not a valid address`);
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
return true;
|
|
304
|
-
});
|
|
305
|
-
if (passport) {
|
|
306
|
-
tx.moveCall({
|
|
307
|
-
target: contactFn("im_remove_with_passport"),
|
|
308
|
-
arguments: [
|
|
309
|
-
toTxObject(tx, contact),
|
|
310
|
-
toTxObject(tx, permission),
|
|
311
|
-
toTxObject(tx, passport),
|
|
312
|
-
toTxAddressVec(tx, im, 1000),
|
|
313
|
-
],
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
tx.moveCall({
|
|
318
|
-
target: contactFn("im_remove"),
|
|
319
|
-
arguments: [
|
|
320
|
-
toTxObject(tx, contact),
|
|
321
|
-
toTxObject(tx, permission),
|
|
322
|
-
toTxAddressVec(tx, im, 1000),
|
|
323
|
-
],
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
export function im_clear(tx, contact, permission, passport) {
|
|
328
|
-
validObjects([contact, permission]);
|
|
329
|
-
if (passport) {
|
|
330
|
-
tx.moveCall({
|
|
331
|
-
target: contactFn("im_clear_with_passport"),
|
|
332
|
-
arguments: [
|
|
333
|
-
toTxObject(tx, contact),
|
|
334
|
-
toTxObject(tx, permission),
|
|
335
|
-
toTxObject(tx, passport),
|
|
336
|
-
],
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
tx.moveCall({
|
|
341
|
-
target: contactFn("im_clear"),
|
|
342
|
-
arguments: [toTxObject(tx, contact), toTxObject(tx, permission)],
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}
|
|
1
|
+
import{toTxObject,toTxString,toTxAddress,toTxAddressVec,isValidName,isValidDescription,PackageAddress,MAX_NAME_LENGTH,isValidArray,GetObjectExisted,GetObject,GetObjectDescription,contactFn,MAX_DESCRIPTION_LENGTH,isValidLongName,MAX_LONG_NAME_LENGTH}from'../common.js';import{W_ERROR,WErrors}from'../exception.js';import{ObjectType}from'../query/object.js';import{CallBase}from'./base.js';import{BuiltinPermissionIndex,newPermission}from'./permission.js';import{create as a147a}from'./permission.js';import{owner_receive,validObjects}from'../util.js';import{Account}from'../local/index.js';import{query_received}from'../query/received.js';import{isValidWowAddress}from'../../utils/sui-types.js';export const MAX_IM_COUNT=0xc8;export class CallContact extends CallBase{['data'];['object_address']=undefined;['permission_address']=undefined;['new_permission_description']=undefined;constructor(a){super(),this['data']=a;}async['prepare'](a){await super['prepare'](a);!this['object_address']&&(this['object_address']=await GetObjectExisted(this['data']?.['object']));if(this['object_address']){this['content']=undefined,await this['update_content'](a,ObjectType['Contact'],this['object_address']);if(!this['content'])W_ERROR(WErrors['InvalidParam'],'CallContact_Data.data.object:'+this['object_address']);this['permission_address']=this['content']['permission'];}else{const b=GetObject(this['data']['object']);this['permission_address']=await GetObjectExisted(b?.['permission']),this['new_permission_description']=GetObjectDescription(b?.['permission']);}}async['call'](a){await this['prepare'](a);const b=[],c=[],d=f=>{this['permission_address']&&!b['includes'](f)&&b['push'](f);},e=this['content'];this['data']?.['my_status']!=null&&((!e||!e['ims']['some'](f=>f['at']===a['account']))&&W_ERROR(WErrors['InvalidParam'],'CallContact_Data.data.my_status:\x20your\x20account\x20not\x20in\x20im\x20list'));this['permission_address']&&!this['object_address']&&d(BuiltinPermissionIndex['MESSNGER_NEW']);this['permission_address']&&this['data']?.['description']!=null&&this['object_address']&&d(BuiltinPermissionIndex['MESSNGER_DESCRIPTION']);this['permission_address']&&this['data']?.['location']!==undefined&&d(BuiltinPermissionIndex['MESSNGER_LOCATION']);this['permission_address']&&this['data']['ims']!=null&&d(BuiltinPermissionIndex['MESSNGER_IM']);this['permission_address']&&this['data']?.['owner_receive']&&d(BuiltinPermissionIndex['MESSNGER_OWNER_RECEIVE']);if(this['permission_address']||c['length']>0x0)return await this['check_permission_and_call'](a,this['permission_address'],b,c);return await this['exec'](a);}async['operate'](a,b,c,d){let e=this['permission_address'],f=this['object_address'];const g=this['content'];!this['object_address']&&(!e&&(e=newPermission(b,this['new_permission_description']??'')),e&&(f=newContact(b,e,this['data']?.['description']??'',c)));(!f||!e)&&W_ERROR(WErrors['InvalidParam'],'CallContact_Data.data.object:'+this['object_address']);this['data']?.['my_status']!=null&&change_status(b,f,this['data']['my_status']);this['data']?.['description']!=null&&this['object_address']&&description_set(b,f,e,this['data']['description'],c);this['data']?.['location']!=null&&location_set(b,f,e,this['data']['location'],c);if(this['data']?.['ims']!=null)switch(this['data']['ims']['op']){case'add':case'set':{this['data']['ims']['im']['length']>MAX_IM_COUNT-(g?.['ims']?.['length']??0x0)&&W_ERROR(WErrors['InvalidParam'],'CallContact_Data.data.ims.im\x20exceeds\x20max\x20count:'+MAX_IM_COUNT);this['data']['ims']['op']==='set'&&im_clear(b,f,e,c);const h=await Account['Instance']()['get_many_address'](this['data']['ims']['im']['map'](k=>k['at'])),j=this['data']['ims']['im']['filter']((k,l)=>h[l]===undefined)['map'](k=>k['at']);j['length']>0x0&&W_ERROR(WErrors['AddressNotFound'],'Address\x20not\x20found:\x20'+j['join'](',\x20'));for(let k=0x0;k<h['length'];k++){const l=h[k];if(l){const m=this['data']['ims']['im'][k];im_add(b,f,e,l,m?.['description'],c);}}break;}case'remove':{const n=await Account['Instance']()['get_many_address'](this['data']['ims']['im']),o=this['data']['ims']['im']['filter']((q,s)=>n[s]===undefined);o['length']>0x0&&W_ERROR(WErrors['AddressNotFound'],'Address\x20not\x20found:\x20'+o['join'](',\x20'));im_remove(b,f,e,n['filter'](q=>q!=null),c);break;}case'clear':im_clear(b,f,e,c);break;}this['data']['owner_receive']!=null&&this['object_address']&&(this['data']['owner_receive']==='recently'&&(this['data']['owner_receive']=await query_received({'object':this['object_address'],'all_type':!![],'no_cache':a['no_cache'],'network':a['network']})),await owner_receive(b,f,e,this['data']['owner_receive'],undefined,q=>PackageAddress+'::contact::'+q,c));if(!this['permission_address']){const q=GetObject(this['data']?.['object']);await this['new_with_mark'](a,b,ObjectType['Permission'],a147a(b,e),GetObject(q['permission']));}!this['object_address']&&await this['new_with_mark'](a,b,ObjectType['Contact'],create(b,f),GetObject(this['data']?.['object']));}}export function create(a,b){return a['moveCall']({'target':contactFn('create'),'arguments':[toTxObject(a,b)]});}export function change_status(a,b,c){return!isValidName(c)&&W_ERROR(WErrors['InvalidParam'],'Status\x20name('+c+')\x20exceeds\x20the\x20length\x20limit('+MAX_NAME_LENGTH+')'),a['moveCall']({'target':contactFn('change_status'),'arguments':[toTxObject(a,b),toTxString(a,c)]});}export function newContact(a,b,c,d){return validObjects([b]),!isValidDescription(c)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length('+MAX_DESCRIPTION_LENGTH+')'),d?a['moveCall']({'target':contactFn('new_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,c),a['object']['mutRegistrar'](),a['object']['clock']()]}):a['moveCall']({'target':contactFn('new'),'arguments':[toTxObject(a,b),toTxString(a,c),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function description_set(a,b,c,d,e){validObjects([b,c]),!isValidDescription(d)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length('+MAX_DESCRIPTION_LENGTH+')'),e?a['moveCall']({'target':contactFn('description_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxObject(a,e),toTxString(a,d)]}):a['moveCall']({'target':contactFn('description_set'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxString(a,d)]});}export function location_set(a,b,c,d,e){validObjects([b,c]),!isValidLongName(d)&&W_ERROR(WErrors['IsValidLocation'],'Location\x20exceeds\x20maximum\x20length('+MAX_LONG_NAME_LENGTH+')'),e?a['moveCall']({'target':contactFn('location_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxObject(a,e),toTxString(a,d)]}):a['moveCall']({'target':contactFn('location_set'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxString(a,d)]});}export function im_add(a,b,c,d,e,f){validObjects([b,c]),!isValidWowAddress(d)&&W_ERROR(WErrors['InvalidParam'],'IM\x20address('+d+')\x20is\x20not\x20a\x20valid\x20address'),e&&!isValidDescription(e)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length('+MAX_DESCRIPTION_LENGTH+')'),f?a['moveCall']({'target':contactFn('im_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxObject(a,f),toTxAddress(a,d),a['pure']['option']('string',e),a['object']['clock']()]}):a['moveCall']({'target':contactFn('im_add'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxAddress(a,d),a['pure']['option']('string',e),a['object']['clock']()]});}export function im_remove(a,b,c,d,e){if(d['length']===0x0)return;validObjects([b,c]),isValidArray(d,f=>{if(!isValidWowAddress(f))return W_ERROR(WErrors['InvalidParam'],'IM\x20address('+f+')\x20is\x20not\x20a\x20valid\x20address'),![];return!![];}),e?a['moveCall']({'target':contactFn('im_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxObject(a,e),toTxAddressVec(a,d,0x3e8)]}):a['moveCall']({'target':contactFn('im_remove'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxAddressVec(a,d,0x3e8)]});}export function im_clear(a,b,c,d){validObjects([b,c]),d?a['moveCall']({'target':contactFn('im_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxObject(a,d)]}):a['moveCall']({'target':contactFn('im_clear'),'arguments':[toTxObject(a,b),toTxObject(a,c)]});}
|