wowok 2.1.10 → 2.1.13
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.d.ts +199 -199
- package/dist/cjs/bcs/bcs.js +273 -318
- package/dist/cjs/bcs/bcs.js.map +1 -0
- package/dist/cjs/bcs/effects.d.ts +109 -109
- package/dist/cjs/bcs/effects.js +205 -230
- package/dist/cjs/bcs/effects.js.map +1 -0
- package/dist/cjs/bcs/index.d.ts +1 -2584
- package/dist/cjs/bcs/index.js +61 -76
- package/dist/cjs/bcs/index.js.map +1 -0
- package/dist/cjs/bcs/pure.js +38 -58
- package/dist/cjs/bcs/pure.js.map +1 -0
- package/dist/cjs/bcs/type-tag-serializer.js +102 -114
- package/dist/cjs/bcs/type-tag-serializer.js.map +1 -0
- package/dist/cjs/bcs/types.js +6 -23
- package/dist/cjs/bcs/types.js.map +1 -0
- package/dist/cjs/client/index.js +17 -33
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/client/network.js +25 -40
- package/dist/cjs/client/network.js.map +1 -0
- package/dist/cjs/cryptography/index.js +29 -45
- package/dist/cjs/cryptography/index.js.map +1 -0
- package/dist/cjs/cryptography/intent.d.ts +1 -1
- package/dist/cjs/cryptography/intent.js +20 -31
- package/dist/cjs/cryptography/intent.js.map +1 -0
- package/dist/cjs/cryptography/keypair.js +102 -116
- package/dist/cjs/cryptography/keypair.js.map +1 -0
- package/dist/cjs/cryptography/mnemonics.js +43 -41
- package/dist/cjs/cryptography/mnemonics.js.map +1 -0
- package/dist/cjs/cryptography/publickey.js +112 -134
- package/dist/cjs/cryptography/publickey.js.map +1 -0
- package/dist/cjs/cryptography/signature-scheme.js +24 -43
- package/dist/cjs/cryptography/signature-scheme.js.map +1 -0
- package/dist/cjs/cryptography/signature.d.ts +2 -24
- package/dist/cjs/cryptography/signature.js +50 -67
- package/dist/cjs/cryptography/signature.js.map +1 -0
- package/dist/cjs/experimental/cache.js +65 -0
- package/dist/cjs/experimental/cache.js.map +1 -0
- package/dist/cjs/experimental/client.js +27 -0
- package/dist/cjs/experimental/client.js.map +1 -0
- package/dist/cjs/experimental/core.js +89 -0
- package/dist/cjs/experimental/core.js.map +1 -0
- package/dist/cjs/experimental/errors.js +32 -0
- package/dist/cjs/experimental/errors.js.map +1 -0
- package/dist/cjs/experimental/index.js +15 -0
- package/dist/cjs/experimental/index.js.map +1 -0
- package/dist/cjs/experimental/persistent-storage.js +343 -0
- package/dist/cjs/experimental/persistent-storage.js.map +1 -0
- package/dist/cjs/experimental/persistent-storage.test.js +200 -0
- package/dist/cjs/experimental/persistent-storage.test.js.map +1 -0
- package/dist/cjs/experimental/transports/utils.js +104 -0
- package/dist/cjs/experimental/transports/utils.js.map +1 -0
- package/dist/cjs/experimental/types.js +6 -0
- package/dist/cjs/experimental/types.js.map +1 -0
- package/dist/cjs/faucet/faucet.js +106 -124
- package/dist/cjs/faucet/faucet.js.map +1 -0
- package/dist/cjs/faucet/index.js +12 -28
- package/dist/cjs/faucet/index.js.map +1 -0
- package/dist/cjs/grpc/client.js +47 -62
- package/dist/cjs/grpc/client.js.map +1 -0
- package/dist/cjs/grpc/core.js +580 -617
- package/dist/cjs/grpc/core.js.map +1 -0
- package/dist/cjs/grpc/index.js +9 -25
- package/dist/cjs/grpc/index.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.js +168 -135
- package/dist/cjs/grpc/proto/google/protobuf/any.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +105 -90
- package/dist/cjs/grpc/proto/google/protobuf/duration.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +50 -28
- package/dist/cjs/grpc/proto/google/protobuf/empty.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +96 -75
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +266 -215
- package/dist/cjs/grpc/proto/google/protobuf/struct.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +150 -131
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +331 -302
- package/dist/cjs/grpc/proto/google/rpc/error_details.js.map +1 -0
- package/dist/cjs/grpc/proto/google/rpc/status.js +50 -50
- package/dist/cjs/grpc/proto/google/rpc/status.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +84 -68
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +45 -50
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +38 -43
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +70 -75
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +79 -81
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +183 -166
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +369 -296
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +80 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +31 -28
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +81 -83
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +80 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +876 -506
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +56 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +103 -83
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +76 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +69 -119
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +392 -350
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +599 -473
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +46 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +242 -224
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +32 -52
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +139 -134
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +109 -111
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +46 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +76 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +46 -59
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +568 -522
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +54 -32
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +27 -47
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +83 -86
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +53 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +645 -529
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +37 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +58 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +749 -730
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1218 -975
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +32 -46
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +186 -167
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
- package/dist/cjs/index.js +96 -91
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/jsonRpc/client.js +654 -743
- package/dist/cjs/jsonRpc/client.js.map +1 -0
- package/dist/cjs/jsonRpc/core.d.ts +7 -7
- package/dist/cjs/jsonRpc/core.js +562 -606
- package/dist/cjs/jsonRpc/core.js.map +1 -0
- package/dist/cjs/jsonRpc/errors.js +38 -56
- package/dist/cjs/jsonRpc/errors.js.map +1 -0
- package/dist/cjs/jsonRpc/http-transport.js +70 -114
- package/dist/cjs/jsonRpc/http-transport.js.map +1 -0
- package/dist/cjs/jsonRpc/index.js +14 -30
- package/dist/cjs/jsonRpc/index.js.map +1 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +286 -290
- package/dist/cjs/jsonRpc/json-rpc-resolver.js.map +1 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +150 -207
- package/dist/cjs/jsonRpc/rpc-websocket-client.js.map +1 -0
- package/dist/cjs/jsonRpc/types/chain.js +4 -15
- package/dist/cjs/jsonRpc/types/chain.js.map +1 -0
- package/dist/cjs/jsonRpc/types/changes.js +4 -15
- package/dist/cjs/jsonRpc/types/changes.js.map +1 -0
- package/dist/cjs/jsonRpc/types/coins.js +4 -15
- package/dist/cjs/jsonRpc/types/coins.js.map +1 -0
- package/dist/cjs/jsonRpc/types/common.js +4 -15
- package/dist/cjs/jsonRpc/types/common.js.map +1 -0
- package/dist/cjs/jsonRpc/types/generated.d.ts +1 -1
- package/dist/cjs/jsonRpc/types/generated.js +4 -15
- package/dist/cjs/jsonRpc/types/generated.js.map +1 -0
- package/dist/cjs/jsonRpc/types/index.js +4 -15
- package/dist/cjs/jsonRpc/types/index.js.map +1 -0
- package/dist/cjs/jsonRpc/types/params.js +4 -15
- package/dist/cjs/jsonRpc/types/params.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +54 -69
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/index.js +10 -26
- package/dist/cjs/keypairs/ed25519/index.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/keypair.js +134 -159
- package/dist/cjs/keypairs/ed25519/keypair.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/publickey.js +70 -84
- package/dist/cjs/keypairs/ed25519/publickey.js.map +1 -0
- package/dist/cjs/keypairs/index.js +21 -19
- package/dist/cjs/keypairs/index.js.map +1 -0
- package/dist/cjs/keypairs/passkey/index.js +11 -27
- package/dist/cjs/keypairs/passkey/index.js.map +1 -0
- package/dist/cjs/keypairs/passkey/keypair.js +245 -256
- package/dist/cjs/keypairs/passkey/keypair.js.map +1 -0
- package/dist/cjs/keypairs/passkey/publickey.js +163 -162
- package/dist/cjs/keypairs/passkey/publickey.js.map +1 -0
- package/dist/cjs/keypairs/passkey/types.js +4 -15
- package/dist/cjs/keypairs/passkey/types.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/index.js +10 -26
- package/dist/cjs/keypairs/secp256k1/index.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/keypair.js +129 -151
- package/dist/cjs/keypairs/secp256k1/keypair.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/publickey.js +71 -89
- package/dist/cjs/keypairs/secp256k1/publickey.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/index.js +10 -26
- package/dist/cjs/keypairs/secp256r1/index.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/keypair.js +127 -148
- package/dist/cjs/keypairs/secp256r1/keypair.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/publickey.js +72 -90
- package/dist/cjs/keypairs/secp256r1/publickey.js.map +1 -0
- package/dist/cjs/multisig/index.js +10 -26
- package/dist/cjs/multisig/index.js.map +1 -0
- package/dist/cjs/multisig/publickey.d.ts +1 -1
- package/dist/cjs/multisig/publickey.js +228 -276
- package/dist/cjs/multisig/publickey.js.map +1 -0
- package/dist/cjs/multisig/signer.js +62 -110
- package/dist/cjs/multisig/signer.js.map +1 -0
- package/dist/cjs/transactions/Arguments.d.ts +4 -4
- package/dist/cjs/transactions/Arguments.js +13 -34
- package/dist/cjs/transactions/Arguments.js.map +1 -0
- package/dist/cjs/transactions/Commands.js +111 -141
- package/dist/cjs/transactions/Commands.js.map +1 -0
- package/dist/cjs/transactions/Inputs.js +53 -82
- package/dist/cjs/transactions/Inputs.js.map +1 -0
- package/dist/cjs/transactions/ObjectCache.d.ts +8 -8
- package/dist/cjs/transactions/ObjectCache.js +204 -241
- package/dist/cjs/transactions/ObjectCache.js.map +1 -0
- package/dist/cjs/transactions/Transaction.d.ts +31 -31
- package/dist/cjs/transactions/Transaction.js +628 -719
- package/dist/cjs/transactions/Transaction.js.map +1 -0
- package/dist/cjs/transactions/TransactionData.d.ts +9 -9
- package/dist/cjs/transactions/TransactionData.js +396 -440
- package/dist/cjs/transactions/TransactionData.js.map +1 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.js +169 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.js.map +1 -0
- package/dist/cjs/transactions/__tests__/bcs.test.js +202 -0
- package/dist/cjs/transactions/__tests__/bcs.test.js.map +1 -0
- package/dist/cjs/transactions/data/internal.js +166 -207
- package/dist/cjs/transactions/data/internal.js.map +1 -0
- package/dist/cjs/transactions/data/v1.js +436 -495
- package/dist/cjs/transactions/data/v1.js.map +1 -0
- package/dist/cjs/transactions/data/v2.d.ts +5 -5
- package/dist/cjs/transactions/data/v2.js +94 -107
- package/dist/cjs/transactions/data/v2.js.map +1 -0
- package/dist/cjs/transactions/executor/caching.js +71 -113
- package/dist/cjs/transactions/executor/caching.js.map +1 -0
- package/dist/cjs/transactions/executor/parallel.js +339 -378
- package/dist/cjs/transactions/executor/parallel.js.map +1 -0
- package/dist/cjs/transactions/executor/queue.js +60 -80
- package/dist/cjs/transactions/executor/queue.js.map +1 -0
- package/dist/cjs/transactions/executor/serial.d.ts +4 -4
- package/dist/cjs/transactions/executor/serial.js +102 -131
- package/dist/cjs/transactions/executor/serial.js.map +1 -0
- package/dist/cjs/transactions/hash.js +17 -28
- package/dist/cjs/transactions/hash.js.map +1 -0
- package/dist/cjs/transactions/index.js +33 -49
- package/dist/cjs/transactions/index.js.map +1 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.js +137 -191
- package/dist/cjs/transactions/intents/CoinWithBalance.js.map +1 -0
- package/dist/cjs/transactions/object.js +88 -111
- package/dist/cjs/transactions/object.js.map +1 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +20 -32
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
- package/dist/cjs/transactions/pure.js +38 -60
- package/dist/cjs/transactions/pure.js.map +1 -0
- package/dist/cjs/transactions/resolve.js +62 -88
- package/dist/cjs/transactions/resolve.js.map +1 -0
- package/dist/cjs/transactions/serializer.js +150 -163
- package/dist/cjs/transactions/serializer.js.map +1 -0
- package/dist/cjs/transactions/utils.d.ts +1 -1
- package/dist/cjs/transactions/utils.js +114 -125
- package/dist/cjs/transactions/utils.js.map +1 -0
- package/dist/cjs/utils/constants.js +29 -56
- package/dist/cjs/utils/constants.js.map +1 -0
- package/dist/cjs/utils/derived-objects.js +14 -30
- package/dist/cjs/utils/derived-objects.js.map +1 -0
- package/dist/cjs/utils/dynamic-fields.js +20 -37
- package/dist/cjs/utils/dynamic-fields.js.map +1 -0
- package/dist/cjs/utils/format.js +14 -30
- package/dist/cjs/utils/format.js.map +1 -0
- package/dist/cjs/utils/index.js +50 -64
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/move-registry.js +37 -35
- package/dist/cjs/utils/move-registry.js.map +1 -0
- package/dist/cjs/utils/sui-types.js +74 -68
- package/dist/cjs/utils/sui-types.js.map +1 -0
- package/dist/cjs/utils/suins.js +30 -46
- package/dist/cjs/utils/suins.js.map +1 -0
- package/dist/cjs/verify/index.js +12 -27
- package/dist/cjs/verify/index.js.map +1 -0
- package/dist/cjs/verify/verify.js +83 -110
- package/dist/cjs/verify/verify.js.map +1 -0
- package/dist/cjs/version.js +8 -25
- package/dist/cjs/version.js.map +1 -0
- package/dist/cjs/w/call/allocation.js +323 -413
- package/dist/cjs/w/call/allocation.js.map +1 -0
- package/dist/cjs/w/call/arb.js +105 -136
- package/dist/cjs/w/call/arb.js.map +1 -0
- package/dist/cjs/w/call/arbitration.js +1206 -1581
- package/dist/cjs/w/call/arbitration.js.map +1 -0
- package/dist/cjs/w/call/base.js +303 -333
- package/dist/cjs/w/call/base.js.map +1 -0
- package/dist/cjs/w/call/contact.js +335 -452
- package/dist/cjs/w/call/contact.js.map +1 -0
- package/dist/cjs/w/call/demand.js +690 -844
- package/dist/cjs/w/call/demand.js.map +1 -0
- package/dist/cjs/w/call/entity.js +167 -201
- package/dist/cjs/w/call/entity.js.map +1 -0
- package/dist/cjs/w/call/guard-ins.js +4376 -4389
- package/dist/cjs/w/call/guard-ins.js.map +1 -0
- package/dist/cjs/w/call/guard.js +1078 -1112
- package/dist/cjs/w/call/guard.js.map +1 -0
- package/dist/cjs/w/call/index.js +69 -70
- package/dist/cjs/w/call/index.js.map +1 -0
- package/dist/cjs/w/call/machine.js +1105 -1419
- package/dist/cjs/w/call/machine.js.map +1 -0
- package/dist/cjs/w/call/order.js +314 -454
- package/dist/cjs/w/call/order.js.map +1 -0
- package/dist/cjs/w/call/passport.js +214 -253
- package/dist/cjs/w/call/passport.js.map +1 -0
- package/dist/cjs/w/call/payment.js +187 -224
- package/dist/cjs/w/call/payment.js.map +1 -0
- package/dist/cjs/w/call/permission.js +1183 -1294
- package/dist/cjs/w/call/permission.js.map +1 -0
- package/dist/cjs/w/call/personal.js +132 -170
- package/dist/cjs/w/call/personal.js.map +1 -0
- package/dist/cjs/w/call/progress.js +634 -794
- package/dist/cjs/w/call/progress.js.map +1 -0
- package/dist/cjs/w/call/proof.js +67 -116
- package/dist/cjs/w/call/proof.js.map +1 -0
- package/dist/cjs/w/call/repository.js +1037 -1251
- package/dist/cjs/w/call/repository.js.map +1 -0
- package/dist/cjs/w/call/resource.js +111 -131
- package/dist/cjs/w/call/resource.js.map +1 -0
- package/dist/cjs/w/call/reward.js +675 -853
- package/dist/cjs/w/call/reward.js.map +1 -0
- package/dist/cjs/w/call/service.js +1879 -2385
- package/dist/cjs/w/call/service.js.map +1 -0
- package/dist/cjs/w/call/treasury.js +841 -1138
- package/dist/cjs/w/call/treasury.js.map +1 -0
- package/dist/cjs/w/call/util.js +593 -624
- package/dist/cjs/w/call/util.js.map +1 -0
- package/dist/cjs/w/common.d.ts +1 -1
- package/dist/cjs/w/common.js +548 -518
- package/dist/cjs/w/common.js.map +1 -0
- package/dist/cjs/w/exception.js +574 -584
- package/dist/cjs/w/exception.js.map +1 -0
- package/dist/cjs/w/index.js +26 -23
- package/dist/cjs/w/index.js.map +1 -0
- package/dist/cjs/w/local/account.js +664 -741
- package/dist/cjs/w/local/account.js.map +1 -0
- package/dist/cjs/w/local/cache.js +180 -166
- package/dist/cjs/w/local/cache.js.map +1 -0
- package/dist/cjs/w/local/config.js +51 -80
- package/dist/cjs/w/local/config.js.map +1 -0
- package/dist/cjs/w/local/index.js +225 -290
- package/dist/cjs/w/local/index.js.map +1 -0
- package/dist/cjs/w/local/local.d.ts +2 -2
- package/dist/cjs/w/local/local.js +638 -646
- package/dist/cjs/w/local/local.js.map +1 -0
- package/dist/cjs/w/local/storage.js +210 -164
- package/dist/cjs/w/local/storage.js.map +1 -0
- package/dist/cjs/w/local/token.js +158 -175
- package/dist/cjs/w/local/token.js.map +1 -0
- package/dist/cjs/w/local/util.js +80 -51
- package/dist/cjs/w/local/util.js.map +1 -0
- package/dist/cjs/w/local/wip.js +1078 -802
- package/dist/cjs/w/local/wip.js.map +1 -0
- package/dist/cjs/w/messenger/crypto.js +496 -389
- package/dist/cjs/w/messenger/crypto.js.map +1 -0
- package/dist/cjs/w/messenger/index.js +53 -35
- package/dist/cjs/w/messenger/index.js.map +1 -0
- package/dist/cjs/w/messenger/messenger-api.js +1159 -1035
- package/dist/cjs/w/messenger/messenger-api.js.map +1 -0
- package/dist/cjs/w/messenger/messenger-manager.js +954 -1083
- package/dist/cjs/w/messenger/messenger-manager.js.map +1 -0
- package/dist/cjs/w/messenger/messenger.d.ts +1 -1
- package/dist/cjs/w/messenger/messenger.js +1304 -1450
- package/dist/cjs/w/messenger/messenger.js.map +1 -0
- package/dist/cjs/w/messenger/server.js +390 -512
- package/dist/cjs/w/messenger/server.js.map +1 -0
- package/dist/cjs/w/messenger/session.js +399 -403
- package/dist/cjs/w/messenger/session.js.map +1 -0
- package/dist/cjs/w/messenger/storage.js +881 -777
- package/dist/cjs/w/messenger/storage.js.map +1 -0
- package/dist/cjs/w/messenger/types.d.ts +2 -2
- package/dist/cjs/w/messenger/types.js +83 -103
- package/dist/cjs/w/messenger/types.js.map +1 -0
- package/dist/cjs/w/messenger/utils.js +29 -34
- package/dist/cjs/w/messenger/utils.js.map +1 -0
- package/dist/cjs/w/query/bult-in.js +101 -110
- package/dist/cjs/w/query/bult-in.js.map +1 -0
- package/dist/cjs/w/query/event.js +134 -146
- package/dist/cjs/w/query/event.js.map +1 -0
- package/dist/cjs/w/query/index.js +22 -20
- package/dist/cjs/w/query/index.js.map +1 -0
- package/dist/cjs/w/query/object.js +1576 -1576
- package/dist/cjs/w/query/object.js.map +1 -0
- package/dist/cjs/w/query/received.js +66 -88
- package/dist/cjs/w/query/received.js.map +1 -0
- package/dist/cjs/w/query/util.js +53 -77
- package/dist/cjs/w/query/util.js.map +1 -0
- package/dist/cjs/w/util.js +589 -675
- package/dist/cjs/w/util.js.map +1 -0
- package/dist/esm/bcs/bcs.d.ts +199 -199
- package/dist/esm/bcs/bcs.js +269 -310
- package/dist/esm/bcs/bcs.js.map +1 -0
- package/dist/esm/bcs/effects.d.ts +109 -109
- package/dist/esm/bcs/effects.js +171 -179
- package/dist/esm/bcs/effects.js.map +1 -0
- package/dist/esm/bcs/index.d.ts +1 -2584
- package/dist/esm/bcs/index.js +51 -94
- package/dist/esm/bcs/index.js.map +1 -0
- package/dist/esm/bcs/pure.js +35 -38
- package/dist/esm/bcs/pure.js.map +1 -0
- package/dist/esm/bcs/type-tag-serializer.js +98 -95
- package/dist/esm/bcs/type-tag-serializer.js.map +1 -0
- package/dist/esm/bcs/types.js +5 -5
- package/dist/esm/bcs/types.js.map +1 -0
- package/dist/esm/client/index.js +7 -23
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/client/network.js +23 -22
- package/dist/esm/client/network.js.map +1 -0
- package/dist/esm/cryptography/index.js +9 -46
- package/dist/esm/cryptography/index.js.map +1 -0
- package/dist/esm/cryptography/intent.d.ts +1 -1
- package/dist/esm/cryptography/intent.js +18 -12
- package/dist/esm/cryptography/intent.js.map +1 -0
- package/dist/esm/cryptography/keypair.js +95 -99
- package/dist/esm/cryptography/keypair.js.map +1 -0
- package/dist/esm/cryptography/mnemonics.js +40 -24
- package/dist/esm/cryptography/mnemonics.js.map +1 -0
- package/dist/esm/cryptography/publickey.js +104 -115
- package/dist/esm/cryptography/publickey.js.map +1 -0
- package/dist/esm/cryptography/signature-scheme.js +22 -24
- package/dist/esm/cryptography/signature-scheme.js.map +1 -0
- package/dist/esm/cryptography/signature.d.ts +2 -24
- package/dist/esm/cryptography/signature.js +44 -48
- package/dist/esm/cryptography/signature.js.map +1 -0
- package/dist/esm/experimental/cache.js +61 -0
- package/dist/esm/experimental/cache.js.map +1 -0
- package/dist/esm/experimental/client.js +23 -0
- package/dist/esm/experimental/client.js.map +1 -0
- package/dist/esm/experimental/core.js +85 -0
- package/dist/esm/experimental/core.js.map +1 -0
- package/dist/esm/experimental/errors.js +27 -0
- package/dist/esm/experimental/errors.js.map +1 -0
- package/dist/esm/experimental/index.js +8 -0
- package/dist/esm/experimental/index.js.map +1 -0
- package/dist/esm/experimental/persistent-storage.js +337 -0
- package/dist/esm/experimental/persistent-storage.js.map +1 -0
- package/dist/esm/experimental/persistent-storage.test.js +198 -0
- package/dist/esm/experimental/persistent-storage.test.js.map +1 -0
- package/dist/esm/experimental/transports/utils.js +100 -0
- package/dist/esm/experimental/transports/utils.js.map +1 -0
- package/dist/esm/experimental/types.js +5 -0
- package/dist/esm/experimental/types.js.map +1 -0
- package/dist/esm/faucet/faucet.js +104 -111
- package/dist/esm/faucet/faucet.js.map +1 -0
- package/dist/esm/faucet/index.js +4 -16
- package/dist/esm/faucet/index.js.map +1 -0
- package/dist/esm/grpc/client.js +34 -34
- package/dist/esm/grpc/client.js.map +1 -0
- package/dist/esm/grpc/core.js +570 -601
- package/dist/esm/grpc/core.js.map +1 -0
- package/dist/esm/grpc/index.js +5 -6
- package/dist/esm/grpc/index.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/any.js +161 -111
- package/dist/esm/grpc/proto/google/protobuf/any.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.js +99 -67
- package/dist/esm/grpc/proto/google/protobuf/duration.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.js +46 -7
- package/dist/esm/grpc/proto/google/protobuf/empty.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +90 -52
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.js +258 -190
- package/dist/esm/grpc/proto/google/protobuf/struct.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +144 -108
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.js +313 -267
- package/dist/esm/grpc/proto/google/rpc/error_details.js.map +1 -0
- package/dist/esm/grpc/proto/google/rpc/status.js +45 -28
- package/dist/esm/grpc/proto/google/rpc/status.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +80 -47
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +41 -29
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +34 -22
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +61 -49
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +72 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +173 -139
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +358 -268
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +72 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +29 -9
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +74 -59
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +69 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +861 -474
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +52 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +98 -61
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +71 -56
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +65 -100
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +365 -306
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +585 -442
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +42 -59
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +226 -191
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +28 -33
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +129 -107
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +100 -85
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +42 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +72 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +42 -38
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +544 -481
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +52 -13
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +23 -28
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +74 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +49 -66
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +623 -490
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +33 -32
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +50 -36
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +737 -701
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1177 -917
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +28 -27
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +169 -133
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
- package/dist/esm/index.js +21 -107
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/jsonRpc/client.js +646 -727
- package/dist/esm/jsonRpc/client.js.map +1 -0
- package/dist/esm/jsonRpc/core.d.ts +7 -7
- package/dist/esm/jsonRpc/core.js +550 -581
- package/dist/esm/jsonRpc/core.js.map +1 -0
- package/dist/esm/jsonRpc/errors.js +36 -41
- package/dist/esm/jsonRpc/errors.js.map +1 -0
- package/dist/esm/jsonRpc/http-transport.js +65 -93
- package/dist/esm/jsonRpc/http-transport.js.map +1 -0
- package/dist/esm/jsonRpc/index.js +6 -20
- package/dist/esm/jsonRpc/index.js.map +1 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.js +281 -276
- package/dist/esm/jsonRpc/json-rpc-resolver.js.map +1 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.js +147 -189
- package/dist/esm/jsonRpc/rpc-websocket-client.js.map +1 -0
- package/dist/esm/jsonRpc/types/chain.js +4 -0
- package/dist/esm/jsonRpc/types/chain.js.map +1 -0
- package/dist/esm/jsonRpc/types/changes.js +4 -0
- package/dist/esm/jsonRpc/types/changes.js.map +1 -0
- package/dist/esm/jsonRpc/types/coins.js +4 -0
- package/dist/esm/jsonRpc/types/coins.js.map +1 -0
- package/dist/esm/jsonRpc/types/common.js +4 -0
- package/dist/esm/jsonRpc/types/common.js.map +1 -0
- package/dist/esm/jsonRpc/types/generated.d.ts +1 -1
- package/dist/esm/jsonRpc/types/generated.js +4 -0
- package/dist/esm/jsonRpc/types/generated.js.map +1 -0
- package/dist/esm/jsonRpc/types/index.js +4 -0
- package/dist/esm/jsonRpc/types/index.js.map +1 -0
- package/dist/esm/jsonRpc/types/params.js +4 -0
- package/dist/esm/jsonRpc/types/params.js.map +1 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +49 -48
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
- package/dist/esm/keypairs/ed25519/index.js +5 -10
- package/dist/esm/keypairs/ed25519/index.js.map +1 -0
- package/dist/esm/keypairs/ed25519/keypair.js +128 -146
- package/dist/esm/keypairs/ed25519/keypair.js.map +1 -0
- package/dist/esm/keypairs/ed25519/publickey.js +64 -67
- package/dist/esm/keypairs/ed25519/publickey.js.map +1 -0
- package/dist/esm/keypairs/index.js +3 -0
- package/dist/esm/keypairs/index.js.map +1 -0
- package/dist/esm/keypairs/passkey/index.js +5 -12
- package/dist/esm/keypairs/passkey/index.js.map +1 -0
- package/dist/esm/keypairs/passkey/keypair.js +236 -243
- package/dist/esm/keypairs/passkey/keypair.js.map +1 -0
- package/dist/esm/keypairs/passkey/publickey.js +154 -140
- package/dist/esm/keypairs/passkey/publickey.js.map +1 -0
- package/dist/esm/keypairs/passkey/types.js +4 -0
- package/dist/esm/keypairs/passkey/types.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/index.js +5 -10
- package/dist/esm/keypairs/secp256k1/index.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/keypair.js +120 -134
- package/dist/esm/keypairs/secp256k1/keypair.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/publickey.js +64 -71
- package/dist/esm/keypairs/secp256k1/publickey.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/index.js +5 -10
- package/dist/esm/keypairs/secp256r1/index.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/keypair.js +118 -131
- package/dist/esm/keypairs/secp256r1/keypair.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/publickey.js +63 -66
- package/dist/esm/keypairs/secp256r1/publickey.js.map +1 -0
- package/dist/esm/multisig/index.js +5 -10
- package/dist/esm/multisig/index.js.map +1 -0
- package/dist/esm/multisig/publickey.d.ts +1 -1
- package/dist/esm/multisig/publickey.js +216 -253
- package/dist/esm/multisig/publickey.js.map +1 -0
- package/dist/esm/multisig/signer.js +57 -89
- package/dist/esm/multisig/signer.js.map +1 -0
- package/dist/esm/transactions/Arguments.d.ts +4 -4
- package/dist/esm/transactions/Arguments.js +9 -13
- package/dist/esm/transactions/Arguments.js.map +1 -0
- package/dist/esm/transactions/Commands.js +105 -118
- package/dist/esm/transactions/Commands.js.map +1 -0
- package/dist/esm/transactions/Inputs.js +49 -61
- package/dist/esm/transactions/Inputs.js.map +1 -0
- package/dist/esm/transactions/ObjectCache.d.ts +8 -8
- package/dist/esm/transactions/ObjectCache.js +200 -223
- package/dist/esm/transactions/ObjectCache.js.map +1 -0
- package/dist/esm/transactions/Transaction.d.ts +32 -32
- package/dist/esm/transactions/Transaction.js +611 -696
- package/dist/esm/transactions/Transaction.js.map +1 -0
- package/dist/esm/transactions/TransactionData.d.ts +9 -9
- package/dist/esm/transactions/TransactionData.js +386 -415
- package/dist/esm/transactions/TransactionData.js.map +1 -0
- package/dist/esm/transactions/__tests__/Transaction.test.js +167 -0
- package/dist/esm/transactions/__tests__/Transaction.test.js.map +1 -0
- package/dist/esm/transactions/__tests__/bcs.test.js +200 -0
- package/dist/esm/transactions/__tests__/bcs.test.js.map +1 -0
- package/dist/esm/transactions/data/internal.js +158 -205
- package/dist/esm/transactions/data/internal.js.map +1 -0
- package/dist/esm/transactions/data/v1.js +419 -487
- package/dist/esm/transactions/data/v1.js.map +1 -0
- package/dist/esm/transactions/data/v2.d.ts +5 -5
- package/dist/esm/transactions/data/v2.js +89 -107
- package/dist/esm/transactions/data/v2.js.map +1 -0
- package/dist/esm/transactions/executor/caching.d.ts +2 -2
- package/dist/esm/transactions/executor/caching.js +66 -93
- package/dist/esm/transactions/executor/caching.js.map +1 -0
- package/dist/esm/transactions/executor/parallel.js +329 -352
- package/dist/esm/transactions/executor/parallel.js.map +1 -0
- package/dist/esm/transactions/executor/queue.js +58 -64
- package/dist/esm/transactions/executor/queue.js.map +1 -0
- package/dist/esm/transactions/executor/serial.d.ts +5 -5
- package/dist/esm/transactions/executor/serial.js +96 -110
- package/dist/esm/transactions/executor/serial.js.map +1 -0
- package/dist/esm/transactions/hash.js +15 -9
- package/dist/esm/transactions/hash.js.map +1 -0
- package/dist/esm/transactions/index.js +15 -41
- package/dist/esm/transactions/index.js.map +1 -0
- package/dist/esm/transactions/intents/CoinWithBalance.js +127 -165
- package/dist/esm/transactions/intents/CoinWithBalance.js.map +1 -0
- package/dist/esm/transactions/object.js +86 -92
- package/dist/esm/transactions/object.js.map +1 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +18 -15
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
- package/dist/esm/transactions/pure.js +34 -39
- package/dist/esm/transactions/pure.js.map +1 -0
- package/dist/esm/transactions/resolve.js +58 -69
- package/dist/esm/transactions/resolve.js.map +1 -0
- package/dist/esm/transactions/serializer.js +145 -144
- package/dist/esm/transactions/serializer.js.map +1 -0
- package/dist/esm/transactions/utils.d.ts +1 -1
- package/dist/esm/transactions/utils.js +110 -109
- package/dist/esm/transactions/utils.js.map +1 -0
- package/dist/esm/utils/constants.js +26 -36
- package/dist/esm/utils/constants.js.map +1 -0
- package/dist/esm/utils/derived-objects.js +11 -10
- package/dist/esm/utils/derived-objects.js.map +1 -0
- package/dist/esm/utils/dynamic-fields.js +16 -16
- package/dist/esm/utils/dynamic-fields.js.map +1 -0
- package/dist/esm/utils/format.js +13 -13
- package/dist/esm/utils/format.js.map +1 -0
- package/dist/esm/utils/index.js +15 -76
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/move-registry.js +34 -17
- package/dist/esm/utils/move-registry.js.map +1 -0
- package/dist/esm/utils/sui-types.js +70 -54
- package/dist/esm/utils/sui-types.js.map +1 -0
- package/dist/esm/utils/suins.js +29 -29
- package/dist/esm/utils/suins.js.map +1 -0
- package/dist/esm/verify/index.js +5 -14
- package/dist/esm/verify/index.js.map +1 -0
- package/dist/esm/verify/verify.js +76 -93
- package/dist/esm/verify/verify.js.map +1 -0
- package/dist/esm/version.js +6 -6
- package/dist/esm/version.js.map +1 -0
- package/dist/esm/w/call/allocation.js +307 -402
- package/dist/esm/w/call/allocation.js.map +1 -0
- package/dist/esm/w/call/arb.js +100 -129
- package/dist/esm/w/call/arb.js.map +1 -0
- package/dist/esm/w/call/arbitration.js +1170 -1568
- package/dist/esm/w/call/arbitration.js.map +1 -0
- package/dist/esm/w/call/base.js +288 -315
- package/dist/esm/w/call/base.js.map +1 -0
- package/dist/esm/w/call/contact.js +318 -442
- package/dist/esm/w/call/contact.js.map +1 -0
- package/dist/esm/w/call/demand.js +673 -841
- package/dist/esm/w/call/demand.js.map +1 -0
- package/dist/esm/w/call/entity.js +162 -203
- package/dist/esm/w/call/entity.js.map +1 -0
- package/dist/esm/w/call/guard-ins.js +4373 -4371
- package/dist/esm/w/call/guard-ins.js.map +1 -0
- package/dist/esm/w/call/guard.js +1061 -1108
- package/dist/esm/w/call/guard.js.map +1 -0
- package/dist/esm/w/call/index.js +24 -56
- package/dist/esm/w/call/index.js.map +1 -0
- package/dist/esm/w/call/machine.js +1086 -1433
- package/dist/esm/w/call/machine.js.map +1 -0
- package/dist/esm/w/call/order.js +301 -448
- package/dist/esm/w/call/order.js.map +1 -0
- package/dist/esm/w/call/passport.js +204 -240
- package/dist/esm/w/call/passport.js.map +1 -0
- package/dist/esm/w/call/payment.js +177 -215
- package/dist/esm/w/call/payment.js.map +1 -0
- package/dist/esm/w/call/permission.js +1172 -1320
- package/dist/esm/w/call/permission.js.map +1 -0
- package/dist/esm/w/call/personal.js +121 -156
- package/dist/esm/w/call/personal.js.map +1 -0
- package/dist/esm/w/call/progress.js +625 -797
- package/dist/esm/w/call/progress.js.map +1 -0
- package/dist/esm/w/call/proof.js +61 -103
- package/dist/esm/w/call/proof.js.map +1 -0
- package/dist/esm/w/call/repository.js +1017 -1251
- package/dist/esm/w/call/repository.js.map +1 -0
- package/dist/esm/w/call/resource.js +108 -124
- package/dist/esm/w/call/resource.js.map +1 -0
- package/dist/esm/w/call/reward.js +660 -847
- package/dist/esm/w/call/reward.js.map +1 -0
- package/dist/esm/w/call/service.js +1849 -2400
- package/dist/esm/w/call/service.js.map +1 -0
- package/dist/esm/w/call/treasury.js +815 -1125
- package/dist/esm/w/call/treasury.js.map +1 -0
- package/dist/esm/w/call/util.js +553 -576
- package/dist/esm/w/call/util.js.map +1 -0
- package/dist/esm/w/common.d.ts +1 -1
- package/dist/esm/w/common.js +579 -580
- package/dist/esm/w/common.js.map +1 -0
- package/dist/esm/w/exception.js +570 -573
- package/dist/esm/w/exception.js.map +1 -0
- package/dist/esm/w/index.js +4 -0
- package/dist/esm/w/index.js.map +1 -0
- package/dist/esm/w/local/account.js +652 -709
- package/dist/esm/w/local/account.js.map +1 -0
- package/dist/esm/w/local/cache.js +176 -147
- package/dist/esm/w/local/cache.js.map +1 -0
- package/dist/esm/w/local/config.js +46 -60
- package/dist/esm/w/local/config.js.map +1 -0
- package/dist/esm/w/local/index.js +196 -273
- package/dist/esm/w/local/index.js.map +1 -0
- package/dist/esm/w/local/local.d.ts +2 -2
- package/dist/esm/w/local/local.js +631 -626
- package/dist/esm/w/local/local.js.map +1 -0
- package/dist/esm/w/local/storage.js +168 -136
- package/dist/esm/w/local/storage.js.map +1 -0
- package/dist/esm/w/local/token.js +149 -151
- package/dist/esm/w/local/token.js.map +1 -0
- package/dist/esm/w/local/util.js +45 -22
- package/dist/esm/w/local/util.js.map +1 -0
- package/dist/esm/w/local/wip.js +1038 -781
- package/dist/esm/w/local/wip.js.map +1 -0
- package/dist/esm/w/messenger/crypto.js +491 -387
- package/dist/esm/w/messenger/crypto.js.map +1 -0
- package/dist/esm/w/messenger/index.js +27 -24
- package/dist/esm/w/messenger/index.js.map +1 -0
- package/dist/esm/w/messenger/messenger-api.js +1111 -1017
- package/dist/esm/w/messenger/messenger-api.js.map +1 -0
- package/dist/esm/w/messenger/messenger-manager.js +944 -1052
- package/dist/esm/w/messenger/messenger-manager.js.map +1 -0
- package/dist/esm/w/messenger/messenger.d.ts +1 -1
- package/dist/esm/w/messenger/messenger.js +1258 -1421
- package/dist/esm/w/messenger/messenger.js.map +1 -0
- package/dist/esm/w/messenger/server.js +388 -499
- package/dist/esm/w/messenger/server.js.map +1 -0
- package/dist/esm/w/messenger/session.js +394 -399
- package/dist/esm/w/messenger/session.js.map +1 -0
- package/dist/esm/w/messenger/storage.js +840 -751
- package/dist/esm/w/messenger/storage.js.map +1 -0
- package/dist/esm/w/messenger/types.d.ts +2 -2
- package/dist/esm/w/messenger/types.js +80 -85
- package/dist/esm/w/messenger/types.js.map +1 -0
- package/dist/esm/w/messenger/utils.js +28 -16
- package/dist/esm/w/messenger/utils.js.map +1 -0
- package/dist/esm/w/query/bult-in.js +95 -100
- package/dist/esm/w/query/bult-in.js.map +1 -0
- package/dist/esm/w/query/event.js +128 -125
- package/dist/esm/w/query/event.js.map +1 -0
- package/dist/esm/w/query/index.js +3 -0
- package/dist/esm/w/query/index.js.map +1 -0
- package/dist/esm/w/query/object.js +1560 -1574
- package/dist/esm/w/query/object.js.map +1 -0
- package/dist/esm/w/query/received.js +57 -63
- package/dist/esm/w/query/received.js.map +1 -0
- package/dist/esm/w/query/util.js +48 -56
- package/dist/esm/w/query/util.js.map +1 -0
- package/dist/esm/w/util.js +578 -673
- package/dist/esm/w/util.js.map +1 -0
- package/package.json +13 -7
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-x64.node +0 -0
- package/scripts/download-prebuilds.js +234 -0
- package/scripts/install-better-sqlite3.js +377 -0
- package/dist/cjs/graphql/client.js +0 -98
- package/dist/cjs/graphql/core.js +0 -506
- package/dist/cjs/graphql/generated/2024.1/tada-env.js +0 -13141
- package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/2024.4/tada-env.js +0 -13287
- package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/latest/tada-env.js +0 -12925
- package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/queries.js +0 -807
- package/dist/cjs/graphql/index.js +0 -25
- package/dist/cjs/graphql/schemas/2024.1/index.js +0 -28
- package/dist/cjs/graphql/schemas/2024.4/index.js +0 -28
- package/dist/cjs/graphql/schemas/latest/index.js +0 -28
- package/dist/cjs/graphql/types.js +0 -16
- package/dist/cjs/package.json +0 -5
- package/dist/cjs/w/local/.eslintrc.js +0 -15
- package/dist/cjs/w/messenger/.eslintrc.js +0 -15
- package/dist/cjs/zklogin/address.js +0 -93
- package/dist/cjs/zklogin/bcs.js +0 -41
- package/dist/cjs/zklogin/index.js +0 -45
- package/dist/cjs/zklogin/jwt-decode.js +0 -88
- package/dist/cjs/zklogin/jwt-utils.js +0 -128
- package/dist/cjs/zklogin/nonce.js +0 -60
- package/dist/cjs/zklogin/poseidon.js +0 -64
- package/dist/cjs/zklogin/publickey.js +0 -281
- package/dist/cjs/zklogin/signature.js +0 -57
- package/dist/cjs/zklogin/utils.js +0 -98
- package/dist/esm/graphql/client.js +0 -79
- package/dist/esm/graphql/core.js +0 -505
- package/dist/esm/graphql/generated/2024.1/tada-env.js +0 -13121
- package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/2024.4/tada-env.js +0 -13267
- package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/latest/tada-env.js +0 -12905
- package/dist/esm/graphql/generated/latest/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/queries.js +0 -788
- package/dist/esm/graphql/index.js +0 -8
- package/dist/esm/graphql/schemas/2024.1/index.js +0 -8
- package/dist/esm/graphql/schemas/2024.4/index.js +0 -8
- package/dist/esm/graphql/schemas/latest/index.js +0 -8
- package/dist/esm/graphql/types.js +0 -0
- package/dist/esm/package.json +0 -5
- package/dist/esm/w/local/.eslintrc.js +0 -23
- package/dist/esm/w/messenger/.eslintrc.js +0 -23
- package/dist/esm/zklogin/address.js +0 -78
- package/dist/esm/zklogin/bcs.js +0 -21
- package/dist/esm/zklogin/index.js +0 -38
- package/dist/esm/zklogin/jwt-decode.js +0 -68
- package/dist/esm/zklogin/jwt-utils.js +0 -108
- package/dist/esm/zklogin/nonce.js +0 -40
- package/dist/esm/zklogin/poseidon.js +0 -61
- package/dist/esm/zklogin/publickey.js +0 -265
- package/dist/esm/zklogin/signature.js +0 -37
- package/dist/esm/zklogin/utils.js +0 -78
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,1192 +1,895 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(treasury_exports);
|
|
43
|
-
var import_common = require("../common.js");
|
|
44
|
-
var import_exception = require("../exception.js");
|
|
45
|
-
var import_object = require("../query/object.js");
|
|
46
|
-
var import_util = require("../util.js");
|
|
47
|
-
var import_base = require("./base.js");
|
|
48
|
-
var import_permission = require("./permission.js");
|
|
49
|
-
var import_local = require("../local/index.js");
|
|
50
|
-
var import_local2 = require("../local/local.js");
|
|
51
|
-
var import_permission2 = require("./permission.js");
|
|
52
|
-
var import_payment = require("./payment.js");
|
|
53
|
-
var import_received = require("../query/received.js");
|
|
54
|
-
class CallTreasury extends import_base.CallBase {
|
|
55
|
-
constructor(data) {
|
|
56
|
-
super();
|
|
57
|
-
__publicField(this, "data");
|
|
58
|
-
__publicField(this, "object_address");
|
|
59
|
-
__publicField(this, "permission_address");
|
|
60
|
-
__publicField(this, "new_permission_description");
|
|
61
|
-
__publicField(this, "parameter_type");
|
|
62
|
-
this.data = data;
|
|
63
|
-
}
|
|
64
|
-
async prepare(env) {
|
|
65
|
-
await super.prepare(env);
|
|
66
|
-
if (!this.object_address) {
|
|
67
|
-
this.object_address = await (0, import_common.GetObjectExisted)(this.data?.object);
|
|
2
|
+
// Copyright (c) Wowok.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MAX_EXTERNAL_WITHDRAW_GUARD_COUNT = exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT = exports.CallTreasury = void 0;
|
|
6
|
+
exports.newTreasury = newTreasury;
|
|
7
|
+
exports.description_set = description_set;
|
|
8
|
+
exports.deposit = deposit;
|
|
9
|
+
exports.withdraw = withdraw;
|
|
10
|
+
exports.external_deposit_guard_add = external_deposit_guard_add;
|
|
11
|
+
exports.external_deposit_guard_remove = external_deposit_guard_remove;
|
|
12
|
+
exports.external_deposit_guard_clear = external_deposit_guard_clear;
|
|
13
|
+
exports.external_withdraw_guard_add = external_withdraw_guard_add;
|
|
14
|
+
exports.external_withdraw_guard_remove = external_withdraw_guard_remove;
|
|
15
|
+
exports.external_withdraw_guard_clear = external_withdraw_guard_clear;
|
|
16
|
+
exports.create = create;
|
|
17
|
+
exports.external_deposit = external_deposit;
|
|
18
|
+
exports.external_withdraw = external_withdraw;
|
|
19
|
+
exports.receive = receive;
|
|
20
|
+
exports.um_set = um_set;
|
|
21
|
+
const common_js_1 = require("../common.js");
|
|
22
|
+
const exception_js_1 = require("../exception.js");
|
|
23
|
+
const object_js_1 = require("../query/object.js");
|
|
24
|
+
const util_js_1 = require("../util.js");
|
|
25
|
+
const base_js_1 = require("./base.js");
|
|
26
|
+
const permission_js_1 = require("./permission.js");
|
|
27
|
+
const index_js_1 = require("../local/index.js");
|
|
28
|
+
const local_js_1 = require("../local/local.js");
|
|
29
|
+
const permission_js_2 = require("./permission.js");
|
|
30
|
+
const payment_js_1 = require("./payment.js");
|
|
31
|
+
const received_js_1 = require("../query/received.js");
|
|
32
|
+
class CallTreasury extends base_js_1.CallBase {
|
|
33
|
+
data;
|
|
34
|
+
object_address = undefined;
|
|
35
|
+
permission_address = undefined;
|
|
36
|
+
new_permission_description = undefined;
|
|
37
|
+
parameter_type = undefined;
|
|
38
|
+
constructor(data) {
|
|
39
|
+
super();
|
|
40
|
+
this.data = data;
|
|
68
41
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.object_address
|
|
74
|
-
);
|
|
75
|
-
if (!this.content)
|
|
76
|
-
(0, import_exception.W_ERROR)(
|
|
77
|
-
import_exception.WErrors.InvalidParam,
|
|
78
|
-
"CallTreasury_Data.data.object:" + this.object_address
|
|
79
|
-
);
|
|
80
|
-
this.permission_address = this.content.permission;
|
|
81
|
-
this.parameter_type = (0, import_util.parseObjectType)(
|
|
82
|
-
this.content.type_raw,
|
|
83
|
-
"treasury::Treasury"
|
|
84
|
-
);
|
|
85
|
-
if (!this.permission_address) {
|
|
86
|
-
(0, import_exception.W_ERROR)(
|
|
87
|
-
import_exception.WErrors.InvalidParam,
|
|
88
|
-
"CallTreasury_Data.data.object.permission is empty"
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
if (!(0, import_common.IsValidArgType)(this.parameter_type)) {
|
|
92
|
-
(0, import_exception.W_ERROR)(
|
|
93
|
-
import_exception.WErrors.IsValidArgType,
|
|
94
|
-
"CallTreasury_Data.data.object.type_parameter is empty"
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
const n = (0, import_common.GetObject)(
|
|
99
|
-
this.data.object
|
|
100
|
-
);
|
|
101
|
-
this.permission_address = await (0, import_common.GetObjectExisted)(n?.permission);
|
|
102
|
-
this.new_permission_description = (0, import_common.GetObjectDescription)(
|
|
103
|
-
n?.permission
|
|
104
|
-
);
|
|
105
|
-
this.parameter_type = n?.type_parameter;
|
|
106
|
-
if (!(0, import_common.IsValidArgType)(this.parameter_type)) {
|
|
107
|
-
(0, import_exception.W_ERROR)(
|
|
108
|
-
import_exception.WErrors.IsValidArgType,
|
|
109
|
-
"CallTreasury_Data.data.object.type_parameter invalid"
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
async call(env) {
|
|
115
|
-
await this.prepare(env);
|
|
116
|
-
const guards = [];
|
|
117
|
-
const perms = [];
|
|
118
|
-
const add_guard = (guard) => {
|
|
119
|
-
if (!guards.includes(guard)) {
|
|
120
|
-
guards.push(guard);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const add_perm = (index) => {
|
|
124
|
-
if (this.permission_address && !perms.includes(index)) {
|
|
125
|
-
perms.push(index);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
if (this.permission_address && !this.object_address) {
|
|
129
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_NEW);
|
|
130
|
-
}
|
|
131
|
-
if (this.permission_address && this.data?.description != null && this.object_address) {
|
|
132
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_DESCRIPTION);
|
|
133
|
-
}
|
|
134
|
-
if (this.permission_address && this.data?.receive != null) {
|
|
135
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_RECEIVE);
|
|
136
|
-
}
|
|
137
|
-
if (this.data?.deposit != null) {
|
|
138
|
-
if (this.data.deposit.by_external_deposit_guard) {
|
|
139
|
-
const guard = await import_local2.LocalMark.Instance().get_address(
|
|
140
|
-
this.data.deposit.by_external_deposit_guard
|
|
141
|
-
);
|
|
142
|
-
if (guard) {
|
|
143
|
-
add_guard(guard);
|
|
144
|
-
this.data.deposit.by_external_deposit_guard = guard;
|
|
145
|
-
} else {
|
|
146
|
-
(0, import_exception.W_ERROR)(
|
|
147
|
-
import_exception.WErrors.InvalidParam,
|
|
148
|
-
`external_deposit_guard ${this.data.deposit.by_external_deposit_guard} not found`
|
|
149
|
-
);
|
|
42
|
+
async prepare(env) {
|
|
43
|
+
await super.prepare(env);
|
|
44
|
+
if (!this.object_address) {
|
|
45
|
+
this.object_address = await (0, common_js_1.GetObjectExisted)(this.data?.object);
|
|
150
46
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
47
|
+
if (this.object_address) {
|
|
48
|
+
await this.update_content(env, object_js_1.ObjectType.Treasury, this.object_address);
|
|
49
|
+
if (!this.content)
|
|
50
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallTreasury_Data.data.object:" + this.object_address);
|
|
51
|
+
this.permission_address = this.content.permission;
|
|
52
|
+
this.parameter_type = (0, util_js_1.parseObjectType)(this.content.type_raw, "treasury::Treasury");
|
|
53
|
+
if (!this.permission_address) {
|
|
54
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallTreasury_Data.data.object.permission is empty");
|
|
55
|
+
}
|
|
56
|
+
if (!(0, common_js_1.IsValidArgType)(this.parameter_type)) {
|
|
57
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, "CallTreasury_Data.data.object.type_parameter is empty");
|
|
58
|
+
}
|
|
154
59
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
} else if ("by_external_withdraw_guard" in withdraw2.amount) {
|
|
165
|
-
const guard = await import_local2.LocalMark.Instance().get_address(
|
|
166
|
-
withdraw2.amount.by_external_withdraw_guard
|
|
167
|
-
);
|
|
168
|
-
if (guard) {
|
|
169
|
-
withdraw2.amount.by_external_withdraw_guard = guard;
|
|
170
|
-
add_guard(guard);
|
|
171
|
-
} else {
|
|
172
|
-
(0, import_exception.W_ERROR)(
|
|
173
|
-
import_exception.WErrors.InvalidParam,
|
|
174
|
-
`by_external_withdraw_guard ${withdraw2.amount.by_external_withdraw_guard} not found`
|
|
175
|
-
);
|
|
176
|
-
}
|
|
60
|
+
else {
|
|
61
|
+
const n = (0, common_js_1.GetObject)(this.data.object);
|
|
62
|
+
this.permission_address = await (0, common_js_1.GetObjectExisted)(n?.permission);
|
|
63
|
+
this.new_permission_description = (0, common_js_1.GetObjectDescription)(n?.permission);
|
|
64
|
+
this.parameter_type = n?.type_parameter;
|
|
65
|
+
if (!(0, common_js_1.IsValidArgType)(this.parameter_type)) {
|
|
66
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, "CallTreasury_Data.data.object.type_parameter invalid");
|
|
67
|
+
}
|
|
177
68
|
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (this.permission_address && this.data?.external_deposit_guard != null) {
|
|
181
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_EXTERNAL_DEPOSIT_GUARD);
|
|
182
|
-
}
|
|
183
|
-
if (this.permission_address && this.data?.external_withdraw_guard != null) {
|
|
184
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_EXTERNAL_WITHDRAW_GUARD);
|
|
185
|
-
}
|
|
186
|
-
if (this.permission_address && this.data?.owner_receive != null) {
|
|
187
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_OWNER_RECEIVE);
|
|
188
|
-
}
|
|
189
|
-
if (this.permission_address && this.data?.um !== void 0) {
|
|
190
|
-
add_perm(import_permission.BuiltinPermissionIndex.TREASURY_UM);
|
|
191
|
-
}
|
|
192
|
-
if (this.permission_address || guards.length > 0) {
|
|
193
|
-
return await this.check_permission_and_call(
|
|
194
|
-
env,
|
|
195
|
-
this.permission_address,
|
|
196
|
-
perms,
|
|
197
|
-
guards
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
return await this.exec(env);
|
|
201
|
-
}
|
|
202
|
-
async operate(env, tx, passport, submission) {
|
|
203
|
-
let permission = this.permission_address;
|
|
204
|
-
let object = this.object_address;
|
|
205
|
-
const content = this.content;
|
|
206
|
-
if (!this.object_address) {
|
|
207
|
-
if (!permission) {
|
|
208
|
-
permission = (0, import_permission.newPermission)(
|
|
209
|
-
tx,
|
|
210
|
-
this.new_permission_description ?? ""
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
if (permission && this.parameter_type) {
|
|
214
|
-
object = newTreasury(
|
|
215
|
-
tx,
|
|
216
|
-
this.parameter_type,
|
|
217
|
-
permission,
|
|
218
|
-
this.data?.description ?? "",
|
|
219
|
-
passport
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
69
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (this.data.receive != null && this.object_address) {
|
|
240
|
-
if (this.data.receive === "recently") {
|
|
241
|
-
const received = await (0, import_received.query_received)({
|
|
242
|
-
object: this.object_address,
|
|
243
|
-
network: env.network,
|
|
244
|
-
no_cache: env.no_cache
|
|
245
|
-
});
|
|
246
|
-
if (Array.isArray(received)) {
|
|
247
|
-
(0, import_exception.W_ERROR)(
|
|
248
|
-
import_exception.WErrors.InvalidParam,
|
|
249
|
-
"CallAllocation_Data.data.received_coins: received is ReceivedNormal[]"
|
|
250
|
-
);
|
|
251
|
-
} else {
|
|
252
|
-
this.data.receive = received;
|
|
70
|
+
async call(env) {
|
|
71
|
+
await this.prepare(env); // prepare first.
|
|
72
|
+
const guards = [];
|
|
73
|
+
const perms = [];
|
|
74
|
+
const add_guard = (guard) => {
|
|
75
|
+
if (!guards.includes(guard)) {
|
|
76
|
+
guards.push(guard);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const add_perm = (index) => {
|
|
80
|
+
if (this.permission_address && !perms.includes(index)) {
|
|
81
|
+
perms.push(index);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
if (this.permission_address && !this.object_address) {
|
|
85
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_NEW);
|
|
253
86
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
import_exception.WErrors.InvalidParam,
|
|
259
|
-
`token_type ${this.data.receive.token_type} is not equal to parameter_type ${this.parameter_type}`
|
|
260
|
-
);
|
|
87
|
+
if (this.permission_address &&
|
|
88
|
+
this.data?.description != null &&
|
|
89
|
+
this.object_address) {
|
|
90
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_DESCRIPTION);
|
|
261
91
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
[
|
|
265
|
-
import_local2.LocalMark.Instance().get_address(item.id),
|
|
266
|
-
import_local2.LocalMark.Instance().get_address(item.payment)
|
|
267
|
-
]
|
|
268
|
-
);
|
|
269
|
-
if (received_object && payment_object) {
|
|
270
|
-
receive(
|
|
271
|
-
tx,
|
|
272
|
-
object,
|
|
273
|
-
this.parameter_type,
|
|
274
|
-
permission,
|
|
275
|
-
received_object,
|
|
276
|
-
payment_object,
|
|
277
|
-
passport
|
|
278
|
-
);
|
|
279
|
-
} else {
|
|
280
|
-
(0, import_exception.W_ERROR)(
|
|
281
|
-
import_exception.WErrors.IsValidArgType,
|
|
282
|
-
`Receive object ${item.id} or payment object ${item.payment} not found`
|
|
283
|
-
);
|
|
284
|
-
}
|
|
92
|
+
if (this.permission_address && this.data?.receive != null) {
|
|
93
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_RECEIVE);
|
|
285
94
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
95
|
+
if (this.data?.deposit != null) {
|
|
96
|
+
if (this.data.deposit.by_external_deposit_guard) {
|
|
97
|
+
const guard = await local_js_1.LocalMark.Instance().get_address(this.data.deposit.by_external_deposit_guard);
|
|
98
|
+
if (guard) {
|
|
99
|
+
add_guard(guard);
|
|
100
|
+
this.data.deposit.by_external_deposit_guard = guard;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `external_deposit_guard ${this.data.deposit.by_external_deposit_guard} not found`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
if (this.permission_address) {
|
|
108
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_DEPOSIT);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
295
111
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
tx,
|
|
316
|
-
import_object.ObjectType.Payment,
|
|
317
|
-
await deposit(
|
|
318
|
-
env,
|
|
319
|
-
tx,
|
|
320
|
-
object,
|
|
321
|
-
this.parameter_type,
|
|
322
|
-
permission,
|
|
323
|
-
this.data.deposit.coin,
|
|
324
|
-
this.data.deposit.payment_info,
|
|
325
|
-
passport
|
|
326
|
-
),
|
|
327
|
-
this.data.deposit.namedNewPayment
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
if (this.data.withdraw != null && this.data.withdraw.amount) {
|
|
332
|
-
if ("fixed" in this.data.withdraw.amount) {
|
|
333
|
-
await this.new_with_mark(
|
|
334
|
-
env,
|
|
335
|
-
tx,
|
|
336
|
-
import_object.ObjectType.Payment,
|
|
337
|
-
await withdraw(
|
|
338
|
-
env,
|
|
339
|
-
tx,
|
|
340
|
-
object,
|
|
341
|
-
this.parameter_type,
|
|
342
|
-
permission,
|
|
343
|
-
this.data.withdraw.amount.fixed,
|
|
344
|
-
this.data.withdraw.recipient,
|
|
345
|
-
this.data.withdraw.payment_info,
|
|
346
|
-
passport
|
|
347
|
-
),
|
|
348
|
-
this.data.withdraw.namedNewPayment
|
|
349
|
-
);
|
|
350
|
-
} else if ("by_external_withdraw_guard" in this.data.withdraw.amount) {
|
|
351
|
-
if (!passport) {
|
|
352
|
-
(0, import_exception.W_ERROR)(
|
|
353
|
-
import_exception.WErrors.InvalidParam,
|
|
354
|
-
"Passport is required for external withdraw"
|
|
355
|
-
);
|
|
112
|
+
if (this.data?.withdraw != null) {
|
|
113
|
+
const withdraw = this.data.withdraw;
|
|
114
|
+
if (withdraw && withdraw.amount) {
|
|
115
|
+
if ("fixed" in withdraw.amount) {
|
|
116
|
+
if (this.permission_address) {
|
|
117
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_WITHDRAW);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if ("by_external_withdraw_guard" in withdraw.amount) {
|
|
121
|
+
const guard = await local_js_1.LocalMark.Instance().get_address(withdraw.amount.by_external_withdraw_guard);
|
|
122
|
+
if (guard) {
|
|
123
|
+
withdraw.amount.by_external_withdraw_guard = guard;
|
|
124
|
+
add_guard(guard);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `by_external_withdraw_guard ${withdraw.amount.by_external_withdraw_guard} not found`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
356
131
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
import_object.ObjectType.Payment,
|
|
361
|
-
await external_withdraw(
|
|
362
|
-
env,
|
|
363
|
-
tx,
|
|
364
|
-
object,
|
|
365
|
-
this.parameter_type,
|
|
366
|
-
passport,
|
|
367
|
-
this.data.withdraw.amount.by_external_withdraw_guard,
|
|
368
|
-
this.data.withdraw.recipient,
|
|
369
|
-
this.data.withdraw.payment_info
|
|
370
|
-
),
|
|
371
|
-
this.data.withdraw.namedNewPayment
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (this.data.external_deposit_guard != null) {
|
|
376
|
-
switch (this.data.external_deposit_guard.op) {
|
|
377
|
-
case "add":
|
|
378
|
-
case "set": {
|
|
379
|
-
if (this.data.external_deposit_guard.op === "set") {
|
|
380
|
-
external_deposit_guard_clear(
|
|
381
|
-
tx,
|
|
382
|
-
object,
|
|
383
|
-
this.parameter_type,
|
|
384
|
-
permission,
|
|
385
|
-
passport
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
await external_deposit_guard_add(
|
|
389
|
-
tx,
|
|
390
|
-
object,
|
|
391
|
-
this.parameter_type,
|
|
392
|
-
permission,
|
|
393
|
-
this.data.external_deposit_guard.guards,
|
|
394
|
-
MAX_EXTERNAL_DEPOSIT_GUARD_COUNT - (content?.external_deposit_guard?.length ?? 0),
|
|
395
|
-
passport
|
|
396
|
-
);
|
|
397
|
-
break;
|
|
132
|
+
if (this.permission_address &&
|
|
133
|
+
this.data?.external_deposit_guard != null) {
|
|
134
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_EXTERNAL_DEPOSIT_GUARD);
|
|
398
135
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
object,
|
|
403
|
-
this.parameter_type,
|
|
404
|
-
permission,
|
|
405
|
-
this.data.external_deposit_guard.guards,
|
|
406
|
-
content?.external_deposit_guard?.length ?? 0,
|
|
407
|
-
passport
|
|
408
|
-
);
|
|
409
|
-
break;
|
|
136
|
+
if (this.permission_address &&
|
|
137
|
+
this.data?.external_withdraw_guard != null) {
|
|
138
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_EXTERNAL_WITHDRAW_GUARD);
|
|
410
139
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
tx,
|
|
414
|
-
object,
|
|
415
|
-
this.parameter_type,
|
|
416
|
-
permission,
|
|
417
|
-
passport
|
|
418
|
-
);
|
|
419
|
-
break;
|
|
140
|
+
if (this.permission_address && this.data?.owner_receive != null) {
|
|
141
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_OWNER_RECEIVE);
|
|
420
142
|
}
|
|
421
|
-
|
|
143
|
+
if (this.permission_address && this.data?.um !== undefined) {
|
|
144
|
+
add_perm(permission_js_1.BuiltinPermissionIndex.TREASURY_UM);
|
|
145
|
+
}
|
|
146
|
+
if (this.permission_address || guards.length > 0) {
|
|
147
|
+
return await this.check_permission_and_call(env, this.permission_address, perms, guards);
|
|
148
|
+
}
|
|
149
|
+
return await this.exec(env);
|
|
422
150
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
this.parameter_type,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
151
|
+
async operate(env, tx, passport, submission) {
|
|
152
|
+
let permission = this.permission_address;
|
|
153
|
+
let object = this.object_address;
|
|
154
|
+
const content = this.content;
|
|
155
|
+
if (!this.object_address) {
|
|
156
|
+
if (!permission) {
|
|
157
|
+
permission = (0, permission_js_1.newPermission)(tx, this.new_permission_description ?? "");
|
|
158
|
+
}
|
|
159
|
+
if (permission && this.parameter_type) {
|
|
160
|
+
object = newTreasury(tx, this.parameter_type, permission, this.data?.description ?? "", passport);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!object || !permission) {
|
|
164
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallTreasury_Data.data.object:" + this.object_address);
|
|
165
|
+
}
|
|
166
|
+
if (this.data.description != null && !this.object_address) {
|
|
167
|
+
description_set(tx, object, this.parameter_type, permission, this.data.description, passport);
|
|
168
|
+
}
|
|
169
|
+
if (this.data.receive != null && this.object_address) {
|
|
170
|
+
if (this.data.receive === "recently") {
|
|
171
|
+
const received = await (0, received_js_1.query_received)({
|
|
172
|
+
object: this.object_address,
|
|
173
|
+
network: env.network,
|
|
174
|
+
no_cache: env.no_cache,
|
|
175
|
+
});
|
|
176
|
+
// 检查received的类型,如果是ReceivedNormal[],需要转换为ReceivedBalance
|
|
177
|
+
if (Array.isArray(received)) {
|
|
178
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallAllocation_Data.data.received_coins: received is ReceivedNormal[]");
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
// 如果是ReceivedBalance类型,直接赋值
|
|
182
|
+
this.data.receive = received;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (typeof this.data.receive === "object" &&
|
|
186
|
+
"received" in this.data.receive &&
|
|
187
|
+
this.data.receive.received?.length > 0) {
|
|
188
|
+
if (this.data.receive.token_type !== this.parameter_type) {
|
|
189
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `token_type ${this.data.receive.token_type} is not equal to parameter_type ${this.parameter_type}`);
|
|
190
|
+
}
|
|
191
|
+
for (const item of this.data.receive.received) {
|
|
192
|
+
const [received_object, payment_object] = await Promise.all([
|
|
193
|
+
local_js_1.LocalMark.Instance().get_address(item.id),
|
|
194
|
+
local_js_1.LocalMark.Instance().get_address(item.payment),
|
|
195
|
+
]);
|
|
196
|
+
if (received_object && payment_object) {
|
|
197
|
+
receive(tx, object, this.parameter_type, permission, received_object, payment_object, passport);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidArgType, `Receive object ${item.id} or payment object ${item.payment} not found`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
446
204
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
break;
|
|
205
|
+
if (this.data.deposit != null) {
|
|
206
|
+
if (this.data.deposit.by_external_deposit_guard) {
|
|
207
|
+
if (!passport) {
|
|
208
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "Passport is required for external deposit");
|
|
209
|
+
}
|
|
210
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Payment, await external_deposit(env, tx, object, this.parameter_type, passport, this.data.deposit.by_external_deposit_guard, this.data.deposit.coin, this.data.deposit.payment_info), this.data.deposit.namedNewPayment);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Payment, await deposit(env, tx, object, this.parameter_type, permission, this.data.deposit.coin, this.data.deposit.payment_info, passport), this.data.deposit.namedNewPayment);
|
|
214
|
+
}
|
|
458
215
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
this.
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
216
|
+
if (this.data.withdraw != null && this.data.withdraw.amount) {
|
|
217
|
+
if ("fixed" in this.data.withdraw.amount) {
|
|
218
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Payment, await withdraw(env, tx, object, this.parameter_type, permission, this.data.withdraw.amount.fixed, this.data.withdraw.recipient, this.data.withdraw.payment_info, passport), this.data.withdraw.namedNewPayment);
|
|
219
|
+
}
|
|
220
|
+
else if ("by_external_withdraw_guard" in this.data.withdraw.amount) {
|
|
221
|
+
if (!passport) {
|
|
222
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "Passport is required for external withdraw");
|
|
223
|
+
}
|
|
224
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Payment, await external_withdraw(env, tx, object, this.parameter_type, passport, this.data.withdraw.amount.by_external_withdraw_guard, this.data.withdraw.recipient, this.data.withdraw.payment_info), this.data.withdraw.namedNewPayment);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (this.data.external_deposit_guard != null) {
|
|
228
|
+
switch (this.data.external_deposit_guard.op) {
|
|
229
|
+
case "add":
|
|
230
|
+
case "set": {
|
|
231
|
+
if (this.data.external_deposit_guard.op === "set") {
|
|
232
|
+
external_deposit_guard_clear(tx, object, this.parameter_type, permission, passport);
|
|
233
|
+
}
|
|
234
|
+
await external_deposit_guard_add(tx, object, this.parameter_type, permission, this.data.external_deposit_guard.guards, exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT -
|
|
235
|
+
(content?.external_deposit_guard?.length ?? 0), passport);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case "remove": {
|
|
239
|
+
await external_deposit_guard_remove(tx, object, this.parameter_type, permission, this.data.external_deposit_guard.guards, content?.external_deposit_guard?.length ?? 0, passport);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
case "clear": {
|
|
243
|
+
external_deposit_guard_clear(tx, object, this.parameter_type, permission, passport);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (this.data.external_withdraw_guard != null) {
|
|
249
|
+
switch (this.data.external_withdraw_guard.op) {
|
|
250
|
+
case "add":
|
|
251
|
+
case "set": {
|
|
252
|
+
if (this.data.external_withdraw_guard.op === "set") {
|
|
253
|
+
external_withdraw_guard_clear(tx, object, this.parameter_type, permission, passport);
|
|
254
|
+
}
|
|
255
|
+
await external_withdraw_guard_add(tx, object, this.parameter_type, permission, this.data.external_withdraw_guard.guards, exports.MAX_EXTERNAL_WITHDRAW_GUARD_COUNT -
|
|
256
|
+
(content?.external_withdraw_guard?.length ?? 0), passport);
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
case "remove": {
|
|
260
|
+
await external_withdraw_guard_remove(tx, object, this.parameter_type, permission, this.data.external_withdraw_guard.guards, content?.external_withdraw_guard?.length ?? 0, passport);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "clear": {
|
|
264
|
+
external_withdraw_guard_clear(tx, object, this.parameter_type, permission, passport);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (this.data.owner_receive != null && this.object_address) {
|
|
270
|
+
if (this.data.owner_receive === "recently") {
|
|
271
|
+
this.data.owner_receive = await (0, received_js_1.query_received)({
|
|
272
|
+
object: this.object_address,
|
|
273
|
+
all_type: true,
|
|
274
|
+
network: env.network,
|
|
275
|
+
no_cache: env.no_cache,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
// owner_receive 中完成地址查询
|
|
279
|
+
await (0, util_js_1.owner_receive)(tx, object, permission, this.data.owner_receive, this.parameter_type, (name) => `${common_js_1.PackageAddress}::treasury::${name}`, passport);
|
|
280
|
+
}
|
|
281
|
+
// 处理 um
|
|
282
|
+
if (this.data.um !== undefined) {
|
|
283
|
+
let um_address = null;
|
|
284
|
+
if (this.data.um) {
|
|
285
|
+
um_address =
|
|
286
|
+
(await local_js_1.LocalMark.Instance().get_address(this.data.um)) ||
|
|
287
|
+
null;
|
|
288
|
+
if (!um_address) {
|
|
289
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, "CallTreasury_Data.data.um:" + this.data.um);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
um_set(tx, object, this.parameter_type, permission, um_address, passport);
|
|
293
|
+
}
|
|
294
|
+
if (!this.permission_address) {
|
|
295
|
+
const p = (0, common_js_1.GetObject)(this.data?.object);
|
|
296
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Permission, (0, permission_js_2.create)(tx, permission), (0, common_js_1.GetObject)(p.permission));
|
|
297
|
+
}
|
|
298
|
+
if (!this.object_address) {
|
|
299
|
+
await this.new_with_mark(env, tx, object_js_1.ObjectType.Treasury, create(tx, object, this.parameter_type), (0, common_js_1.GetObject)(this.data?.object));
|
|
468
300
|
}
|
|
469
|
-
}
|
|
470
301
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
permission,
|
|
484
|
-
this.data.owner_receive,
|
|
485
|
-
this.parameter_type,
|
|
486
|
-
(name) => `${import_common.PackageAddress}::treasury::${name}`,
|
|
487
|
-
passport
|
|
488
|
-
);
|
|
302
|
+
}
|
|
303
|
+
exports.CallTreasury = CallTreasury;
|
|
304
|
+
// ================================================
|
|
305
|
+
// 常量定义
|
|
306
|
+
exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT = 100;
|
|
307
|
+
exports.MAX_EXTERNAL_WITHDRAW_GUARD_COUNT = 200;
|
|
308
|
+
// ================================================
|
|
309
|
+
// 构造函数和设置函数
|
|
310
|
+
function newTreasury(tx, treasury_type, permission, description, passport) {
|
|
311
|
+
(0, util_js_1.validObjects)([permission, passport]);
|
|
312
|
+
if (typeof description === "string" && !(0, common_js_1.isValidDescription)(description)) {
|
|
313
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidDescription, `Description exceeds maximum length ${common_js_1.MAX_DESCRIPTION_LENGTH}`);
|
|
489
314
|
}
|
|
490
|
-
if (
|
|
491
|
-
|
|
492
|
-
if (this.data.um) {
|
|
493
|
-
um_address = await import_local2.LocalMark.Instance().get_address(this.data.um) || null;
|
|
494
|
-
if (!um_address) {
|
|
495
|
-
(0, import_exception.W_ERROR)(
|
|
496
|
-
import_exception.WErrors.InvalidParam,
|
|
497
|
-
"CallTreasury_Data.data.um:" + this.data.um
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
um_set(
|
|
502
|
-
tx,
|
|
503
|
-
object,
|
|
504
|
-
this.parameter_type,
|
|
505
|
-
permission,
|
|
506
|
-
um_address,
|
|
507
|
-
passport
|
|
508
|
-
);
|
|
315
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
316
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `New treasury type ${treasury_type} is not valid`);
|
|
509
317
|
}
|
|
510
|
-
if (
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
318
|
+
if (passport) {
|
|
319
|
+
return tx.moveCall({
|
|
320
|
+
target: (0, common_js_1.treasuryFn)("new_with_passport"),
|
|
321
|
+
arguments: [
|
|
322
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
323
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
324
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
325
|
+
tx.object.mutRegistrar(),
|
|
326
|
+
tx.object.clock(),
|
|
327
|
+
],
|
|
328
|
+
typeArguments: [treasury_type],
|
|
329
|
+
});
|
|
521
330
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
331
|
+
else {
|
|
332
|
+
return tx.moveCall({
|
|
333
|
+
target: (0, common_js_1.treasuryFn)("new"),
|
|
334
|
+
arguments: [
|
|
335
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
336
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
337
|
+
tx.object.mutRegistrar(),
|
|
338
|
+
tx.object.clock(),
|
|
339
|
+
],
|
|
340
|
+
typeArguments: [treasury_type],
|
|
341
|
+
});
|
|
530
342
|
}
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
const MAX_EXTERNAL_DEPOSIT_GUARD_COUNT = 100;
|
|
534
|
-
const MAX_EXTERNAL_WITHDRAW_GUARD_COUNT = 200;
|
|
535
|
-
function newTreasury(tx, treasury_type, permission, description, passport) {
|
|
536
|
-
(0, import_util.validObjects)([permission, passport]);
|
|
537
|
-
if (typeof description === "string" && !(0, import_common.isValidDescription)(description)) {
|
|
538
|
-
(0, import_exception.W_ERROR)(
|
|
539
|
-
import_exception.WErrors.IsValidDescription,
|
|
540
|
-
`Description exceeds maximum length ${import_common.MAX_DESCRIPTION_LENGTH}`
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
|
-
if (!(0, import_common.IsValidArgType)(treasury_type)) {
|
|
544
|
-
(0, import_exception.W_ERROR)(
|
|
545
|
-
import_exception.WErrors.InvalidParam,
|
|
546
|
-
`New treasury type ${treasury_type} is not valid`
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
if (passport) {
|
|
550
|
-
return tx.moveCall({
|
|
551
|
-
target: (0, import_common.treasuryFn)("new_with_passport"),
|
|
552
|
-
arguments: [
|
|
553
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
554
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
555
|
-
(0, import_common.toTxString)(tx, description),
|
|
556
|
-
tx.object.mutRegistrar(),
|
|
557
|
-
tx.object.clock()
|
|
558
|
-
],
|
|
559
|
-
typeArguments: [treasury_type]
|
|
560
|
-
});
|
|
561
|
-
} else {
|
|
562
|
-
return tx.moveCall({
|
|
563
|
-
target: (0, import_common.treasuryFn)("new"),
|
|
564
|
-
arguments: [
|
|
565
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
566
|
-
(0, import_common.toTxString)(tx, description),
|
|
567
|
-
tx.object.mutRegistrar(),
|
|
568
|
-
tx.object.clock()
|
|
569
|
-
],
|
|
570
|
-
typeArguments: [treasury_type]
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
343
|
}
|
|
574
344
|
function description_set(tx, treasury, treasury_type, permission, description, passport) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
(0, import_common.toTxString)(tx, description)
|
|
606
|
-
],
|
|
607
|
-
typeArguments: [treasury_type]
|
|
608
|
-
});
|
|
609
|
-
}
|
|
345
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
346
|
+
if (typeof description === "string" && !(0, common_js_1.isValidDescription)(description)) {
|
|
347
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidDescription, `Description exceeds maximum length ${common_js_1.MAX_DESCRIPTION_LENGTH}`);
|
|
348
|
+
}
|
|
349
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
350
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Description set treasury type ${treasury_type} is not valid`);
|
|
351
|
+
}
|
|
352
|
+
if (passport) {
|
|
353
|
+
tx.moveCall({
|
|
354
|
+
target: (0, common_js_1.treasuryFn)("description_set_with_passport"),
|
|
355
|
+
arguments: [
|
|
356
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
357
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
358
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
359
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
360
|
+
],
|
|
361
|
+
typeArguments: [treasury_type],
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
tx.moveCall({
|
|
366
|
+
target: (0, common_js_1.treasuryFn)("description_set"),
|
|
367
|
+
arguments: [
|
|
368
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
369
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
370
|
+
(0, common_js_1.toTxString)(tx, description),
|
|
371
|
+
],
|
|
372
|
+
typeArguments: [treasury_type],
|
|
373
|
+
});
|
|
374
|
+
}
|
|
610
375
|
}
|
|
611
376
|
async function deposit(env, tx, treasury, treasury_type, permission, coin, payment_info, passport) {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
);
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
});
|
|
648
|
-
}
|
|
377
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
378
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
379
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Deposit treasury type ${treasury_type} is not valid`);
|
|
380
|
+
}
|
|
381
|
+
const c = await (0, base_js_1.getCoinParam)(env, tx, coin, treasury_type);
|
|
382
|
+
const p = await (0, payment_js_1.paymentInfo)(env, tx, payment_info);
|
|
383
|
+
if (passport) {
|
|
384
|
+
return tx.moveCall({
|
|
385
|
+
target: (0, common_js_1.treasuryFn)("deposit_with_passport"),
|
|
386
|
+
arguments: [
|
|
387
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
388
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
389
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
390
|
+
c,
|
|
391
|
+
p,
|
|
392
|
+
tx.object.mutRegistrar(),
|
|
393
|
+
tx.object.clock(),
|
|
394
|
+
],
|
|
395
|
+
typeArguments: [treasury_type],
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
return tx.moveCall({
|
|
400
|
+
target: (0, common_js_1.treasuryFn)("deposit"),
|
|
401
|
+
arguments: [
|
|
402
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
403
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
404
|
+
c,
|
|
405
|
+
p,
|
|
406
|
+
tx.object.mutRegistrar(),
|
|
407
|
+
tx.object.clock(),
|
|
408
|
+
],
|
|
409
|
+
typeArguments: [treasury_type],
|
|
410
|
+
});
|
|
411
|
+
}
|
|
649
412
|
}
|
|
650
413
|
async function withdraw(env, tx, treasury, treasury_type, permission, amount, recipient, payment_info, passport) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
(
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
(0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, `Recipient ${recipient} is not valid`);
|
|
664
|
-
}
|
|
665
|
-
const p = await (0, import_payment.paymentInfo)(env, tx, payment_info);
|
|
666
|
-
if (passport) {
|
|
667
|
-
return tx.moveCall({
|
|
668
|
-
target: (0, import_common.treasuryFn)("withdraw_with_passport"),
|
|
669
|
-
arguments: [
|
|
670
|
-
(0, import_common.toTxObject)(tx, treasury),
|
|
671
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
672
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
673
|
-
tx.pure.u64(amount),
|
|
674
|
-
tx.pure.address(r),
|
|
675
|
-
p,
|
|
676
|
-
tx.object.mutRegistrar(),
|
|
677
|
-
tx.object.clock()
|
|
678
|
-
],
|
|
679
|
-
typeArguments: [treasury_type]
|
|
680
|
-
});
|
|
681
|
-
} else {
|
|
682
|
-
return tx.moveCall({
|
|
683
|
-
target: (0, import_common.treasuryFn)("withdraw"),
|
|
684
|
-
arguments: [
|
|
685
|
-
(0, import_common.toTxObject)(tx, treasury),
|
|
686
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
687
|
-
tx.pure.u64(amount),
|
|
688
|
-
tx.pure.address(r),
|
|
689
|
-
p,
|
|
690
|
-
tx.object.mutRegistrar(),
|
|
691
|
-
tx.object.clock()
|
|
692
|
-
],
|
|
693
|
-
typeArguments: [treasury_type]
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
async function external_deposit_guard_add(tx, treasury, treasury_type, permission, guards, counts = MAX_EXTERNAL_DEPOSIT_GUARD_COUNT, passport) {
|
|
698
|
-
if (guards.length === 0) {
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
if (guards.length > counts) {
|
|
702
|
-
(0, import_exception.W_ERROR)(
|
|
703
|
-
import_exception.WErrors.InvalidParam,
|
|
704
|
-
`External deposit guard add guards count ${guards.length} exceeds maximum ${counts}`
|
|
705
|
-
);
|
|
706
|
-
}
|
|
707
|
-
(0, import_util.validObjects)([treasury, permission, passport]);
|
|
708
|
-
if (!(0, import_common.IsValidArgType)(treasury_type)) {
|
|
709
|
-
(0, import_exception.W_ERROR)(
|
|
710
|
-
import_exception.WErrors.InvalidParam,
|
|
711
|
-
`External deposit guard add treasury type ${treasury_type} is not valid`
|
|
712
|
-
);
|
|
713
|
-
}
|
|
714
|
-
const g = await Promise.all(
|
|
715
|
-
guards.map(async (item) => {
|
|
716
|
-
const guard = await import_local2.LocalMark.Instance().get_address(item.guard);
|
|
717
|
-
if (!guard) {
|
|
718
|
-
(0, import_exception.W_ERROR)(
|
|
719
|
-
import_exception.WErrors.InvalidParam,
|
|
720
|
-
`External deposit guard add guard ${item.guard} is not valid`
|
|
721
|
-
);
|
|
722
|
-
}
|
|
723
|
-
if (item.identifier && !(0, import_common.isValidU8)(item.identifier)) {
|
|
724
|
-
(0, import_exception.W_ERROR)(
|
|
725
|
-
import_exception.WErrors.IsValidU8,
|
|
726
|
-
`External deposit guard add identifier ${item.identifier} is not optional u8`
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
|
-
return {
|
|
730
|
-
guard: item.guard,
|
|
731
|
-
identifier: item.identifier,
|
|
732
|
-
guard_addr: guard
|
|
733
|
-
};
|
|
734
|
-
})
|
|
735
|
-
);
|
|
736
|
-
const invalidGuards = g.filter((item) => !item.guard_addr);
|
|
737
|
-
if (invalidGuards.length > 0) {
|
|
738
|
-
(0, import_exception.W_ERROR)(
|
|
739
|
-
import_exception.WErrors.InvalidParam,
|
|
740
|
-
`External deposit guard add has invalid guards with empty guard_addr: ${JSON.stringify(invalidGuards)}`
|
|
741
|
-
);
|
|
742
|
-
}
|
|
743
|
-
g.filter((item) => item.guard_addr !== void 0).map((item) => ({
|
|
744
|
-
guard: item.guard_addr,
|
|
745
|
-
identifier: item.identifier !== void 0 ? item.identifier : null
|
|
746
|
-
})).forEach((item) => {
|
|
414
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
415
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
416
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Withdraw treasury type ${treasury_type} is not valid`);
|
|
417
|
+
}
|
|
418
|
+
if (!(0, common_js_1.isValidU64)(amount)) {
|
|
419
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU64, `Amount ${amount} is not valid`);
|
|
420
|
+
}
|
|
421
|
+
const r = await (0, index_js_1.GetAccountOrMark_Address)(recipient);
|
|
422
|
+
if (!r) {
|
|
423
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Recipient ${recipient} is not valid`);
|
|
424
|
+
}
|
|
425
|
+
const p = await (0, payment_js_1.paymentInfo)(env, tx, payment_info);
|
|
747
426
|
if (passport) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
427
|
+
return tx.moveCall({
|
|
428
|
+
target: (0, common_js_1.treasuryFn)("withdraw_with_passport"),
|
|
429
|
+
arguments: [
|
|
430
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
431
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
432
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
433
|
+
tx.pure.u64(amount),
|
|
434
|
+
tx.pure.address(r),
|
|
435
|
+
p,
|
|
436
|
+
tx.object.mutRegistrar(),
|
|
437
|
+
tx.object.clock(),
|
|
438
|
+
],
|
|
439
|
+
typeArguments: [treasury_type],
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
return tx.moveCall({
|
|
444
|
+
target: (0, common_js_1.treasuryFn)("withdraw"),
|
|
445
|
+
arguments: [
|
|
446
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
447
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
448
|
+
tx.pure.u64(amount),
|
|
449
|
+
tx.pure.address(r),
|
|
450
|
+
p,
|
|
451
|
+
tx.object.mutRegistrar(),
|
|
452
|
+
tx.object.clock(),
|
|
453
|
+
],
|
|
454
|
+
typeArguments: [treasury_type],
|
|
455
|
+
});
|
|
776
456
|
}
|
|
777
|
-
});
|
|
778
457
|
}
|
|
779
|
-
async function
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
458
|
+
async function external_deposit_guard_add(tx, treasury, treasury_type, permission, guards, counts = exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT, passport) {
|
|
459
|
+
if (guards.length === 0) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (guards.length > counts) {
|
|
463
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard add guards count ${guards.length} exceeds maximum ${counts}`);
|
|
464
|
+
}
|
|
465
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
466
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
467
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard add treasury type ${treasury_type} is not valid`);
|
|
468
|
+
}
|
|
469
|
+
const g = await Promise.all(guards.map(async (item) => {
|
|
470
|
+
const guard = await local_js_1.LocalMark.Instance().get_address(item.guard);
|
|
471
|
+
if (!guard) {
|
|
472
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard add guard ${item.guard} is not valid`);
|
|
473
|
+
}
|
|
474
|
+
if (item.identifier && !(0, common_js_1.isValidU8)(item.identifier)) {
|
|
475
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU8, `External deposit guard add identifier ${item.identifier} is not optional u8`);
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
guard: item.guard,
|
|
479
|
+
identifier: item.identifier,
|
|
480
|
+
guard_addr: guard,
|
|
481
|
+
};
|
|
482
|
+
}));
|
|
483
|
+
// Check if any guard_addr is empty
|
|
484
|
+
const invalidGuards = g.filter((item) => !item.guard_addr);
|
|
485
|
+
if (invalidGuards.length > 0) {
|
|
486
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard add has invalid guards with empty guard_addr: ${JSON.stringify(invalidGuards)}`);
|
|
487
|
+
}
|
|
488
|
+
// Convert to AmountFromDepositGuard if all guard_addr are valid
|
|
489
|
+
g.filter((item) => item.guard_addr !== undefined)
|
|
490
|
+
.map((item) => ({
|
|
491
|
+
guard: item.guard_addr,
|
|
492
|
+
identifier: item.identifier !== undefined ? item.identifier : null,
|
|
493
|
+
}))
|
|
494
|
+
.forEach((item) => {
|
|
495
|
+
if (passport) {
|
|
496
|
+
tx.moveCall({
|
|
497
|
+
target: (0, common_js_1.treasuryFn)("external_deposit_guard_add_with_passport"),
|
|
498
|
+
arguments: [
|
|
499
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
500
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
501
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
502
|
+
(0, common_js_1.toTxObject)(tx, item.guard),
|
|
503
|
+
tx.pure.option("u8", item.identifier),
|
|
504
|
+
tx.object.mutRegistrar(),
|
|
505
|
+
tx.object.clock(),
|
|
506
|
+
],
|
|
507
|
+
typeArguments: [treasury_type],
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
tx.moveCall({
|
|
512
|
+
target: (0, common_js_1.treasuryFn)("external_deposit_guard_add"),
|
|
513
|
+
arguments: [
|
|
514
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
515
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
516
|
+
(0, common_js_1.toTxObject)(tx, item.guard),
|
|
517
|
+
tx.pure.option("u8", item.identifier),
|
|
518
|
+
tx.object.mutRegistrar(),
|
|
519
|
+
tx.object.clock(),
|
|
520
|
+
],
|
|
521
|
+
typeArguments: [treasury_type],
|
|
522
|
+
});
|
|
523
|
+
}
|
|
819
524
|
});
|
|
820
|
-
}
|
|
821
525
|
}
|
|
822
|
-
function
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
526
|
+
async function external_deposit_guard_remove(tx, treasury, treasury_type, permission, guards, counts = exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT, passport) {
|
|
527
|
+
guards = await local_js_1.LocalMark.Instance().get_many_address_availables(guards);
|
|
528
|
+
if (guards.length === 0) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (guards.length > counts) {
|
|
532
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard remove guards count ${guards.length} exceeds maximum ${counts}`);
|
|
533
|
+
}
|
|
534
|
+
(0, util_js_1.validObjects)([treasury, permission, passport, ...guards]);
|
|
535
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
536
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard remove treasury type ${treasury_type} is not valid`);
|
|
537
|
+
}
|
|
538
|
+
if (passport) {
|
|
539
|
+
tx.moveCall({
|
|
540
|
+
target: (0, common_js_1.treasuryFn)("external_deposit_guard_remove_with_passport"),
|
|
541
|
+
arguments: [
|
|
542
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
543
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
544
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
545
|
+
tx.pure.vector("address", guards),
|
|
546
|
+
tx.object.mutRegistrar(),
|
|
547
|
+
],
|
|
548
|
+
typeArguments: [treasury_type],
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
tx.moveCall({
|
|
553
|
+
target: (0, common_js_1.treasuryFn)("external_deposit_guard_remove"),
|
|
554
|
+
arguments: [
|
|
555
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
556
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
557
|
+
tx.pure.vector("address", guards),
|
|
558
|
+
tx.object.mutRegistrar(),
|
|
559
|
+
],
|
|
560
|
+
typeArguments: [treasury_type],
|
|
561
|
+
});
|
|
562
|
+
}
|
|
852
563
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
(0, import_exception.W_ERROR)(
|
|
859
|
-
import_exception.WErrors.InvalidParam,
|
|
860
|
-
`External withdraw guard add guards count ${guards.length} exceeds maximum ${counts}`
|
|
861
|
-
);
|
|
862
|
-
}
|
|
863
|
-
(0, import_util.validObjects)([treasury, permission, passport]);
|
|
864
|
-
if (!(0, import_common.IsValidArgType)(treasury_type)) {
|
|
865
|
-
(0, import_exception.W_ERROR)(
|
|
866
|
-
import_exception.WErrors.InvalidParam,
|
|
867
|
-
`External withdraw guard add treasury type ${treasury_type} is not valid`
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
const g = await Promise.all(
|
|
871
|
-
guards.map(async (item) => {
|
|
872
|
-
const guard = await import_local2.LocalMark.Instance().get_address(item.guard);
|
|
873
|
-
if (!guard) {
|
|
874
|
-
(0, import_exception.W_ERROR)(
|
|
875
|
-
import_exception.WErrors.InvalidParam,
|
|
876
|
-
`External withdraw guard add guard ${item.guard} is not valid`
|
|
877
|
-
);
|
|
878
|
-
}
|
|
879
|
-
if (!(0, import_common.isValidU8)(item.identifier)) {
|
|
880
|
-
(0, import_exception.W_ERROR)(
|
|
881
|
-
import_exception.WErrors.IsValidU8,
|
|
882
|
-
`External withdraw guard add identifier ${item.identifier} is not optional u8`
|
|
883
|
-
);
|
|
884
|
-
}
|
|
885
|
-
return {
|
|
886
|
-
guard: item.guard,
|
|
887
|
-
identifier: item.identifier,
|
|
888
|
-
guard_addr: guard
|
|
889
|
-
};
|
|
890
|
-
})
|
|
891
|
-
);
|
|
892
|
-
const invalidGuards = g.filter((item) => !item.guard_addr);
|
|
893
|
-
if (invalidGuards.length > 0) {
|
|
894
|
-
(0, import_exception.W_ERROR)(
|
|
895
|
-
import_exception.WErrors.InvalidParam,
|
|
896
|
-
`External withdraw guard add has invalid guards with empty guard_addr: ${JSON.stringify(invalidGuards)}`
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
g.filter((item) => item.guard_addr !== void 0).map((item) => ({
|
|
900
|
-
guard: item.guard_addr,
|
|
901
|
-
identifier: item.identifier
|
|
902
|
-
})).forEach((item) => {
|
|
564
|
+
function external_deposit_guard_clear(tx, treasury, treasury_type, permission, passport) {
|
|
565
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
566
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
567
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard clear treasury type ${treasury_type} is not valid`);
|
|
568
|
+
}
|
|
903
569
|
if (passport) {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
(0, import_common.toTxObject)(tx, item.guard),
|
|
926
|
-
tx.pure.u8(item.identifier),
|
|
927
|
-
tx.object.mutRegistrar(),
|
|
928
|
-
tx.object.clock()
|
|
929
|
-
],
|
|
930
|
-
typeArguments: [treasury_type]
|
|
931
|
-
});
|
|
570
|
+
tx.moveCall({
|
|
571
|
+
target: (0, common_js_1.treasuryFn)("external_deposit_guard_clear_with_passport"),
|
|
572
|
+
arguments: [
|
|
573
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
574
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
575
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
576
|
+
tx.object.mutRegistrar(),
|
|
577
|
+
],
|
|
578
|
+
typeArguments: [treasury_type],
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
tx.moveCall({
|
|
583
|
+
target: (0, common_js_1.treasuryFn)("external_deposit_guard_clear"),
|
|
584
|
+
arguments: [
|
|
585
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
586
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
587
|
+
tx.object.mutRegistrar(),
|
|
588
|
+
],
|
|
589
|
+
typeArguments: [treasury_type],
|
|
590
|
+
});
|
|
932
591
|
}
|
|
933
|
-
});
|
|
934
592
|
}
|
|
935
|
-
async function
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
593
|
+
async function external_withdraw_guard_add(tx, treasury, treasury_type, permission, guards, counts = exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT, passport) {
|
|
594
|
+
if (guards.length === 0) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (guards.length > counts) {
|
|
598
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard add guards count ${guards.length} exceeds maximum ${counts}`);
|
|
599
|
+
}
|
|
600
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
601
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
602
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard add treasury type ${treasury_type} is not valid`);
|
|
603
|
+
}
|
|
604
|
+
const g = await Promise.all(guards.map(async (item) => {
|
|
605
|
+
const guard = await local_js_1.LocalMark.Instance().get_address(item.guard);
|
|
606
|
+
if (!guard) {
|
|
607
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard add guard ${item.guard} is not valid`);
|
|
608
|
+
}
|
|
609
|
+
if (!(0, common_js_1.isValidU8)(item.identifier)) {
|
|
610
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.IsValidU8, `External withdraw guard add identifier ${item.identifier} is not optional u8`);
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
guard: item.guard,
|
|
614
|
+
identifier: item.identifier,
|
|
615
|
+
guard_addr: guard,
|
|
616
|
+
};
|
|
617
|
+
}));
|
|
618
|
+
// Check if any guard_addr is empty
|
|
619
|
+
const invalidGuards = g.filter((item) => !item.guard_addr);
|
|
620
|
+
if (invalidGuards.length > 0) {
|
|
621
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard add has invalid guards with empty guard_addr: ${JSON.stringify(invalidGuards)}`);
|
|
622
|
+
}
|
|
623
|
+
// Convert to AmountFromWithdrawGuard if all guard_addr are valid
|
|
624
|
+
g.filter((item) => item.guard_addr !== undefined)
|
|
625
|
+
.map((item) => ({
|
|
626
|
+
guard: item.guard_addr,
|
|
627
|
+
identifier: item.identifier,
|
|
628
|
+
}))
|
|
629
|
+
.forEach((item) => {
|
|
630
|
+
if (passport) {
|
|
631
|
+
tx.moveCall({
|
|
632
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw_guard_add_with_passport"),
|
|
633
|
+
arguments: [
|
|
634
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
635
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
636
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
637
|
+
(0, common_js_1.toTxObject)(tx, item.guard),
|
|
638
|
+
tx.pure.u8(item.identifier),
|
|
639
|
+
tx.object.mutRegistrar(),
|
|
640
|
+
tx.object.clock(),
|
|
641
|
+
],
|
|
642
|
+
typeArguments: [treasury_type],
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
/*console.log(
|
|
647
|
+
`External withdraw guard add guard ${item.guard} identifier ${item.identifier}`,
|
|
648
|
+
);*/
|
|
649
|
+
tx.moveCall({
|
|
650
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw_guard_add"),
|
|
651
|
+
arguments: [
|
|
652
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
653
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
654
|
+
(0, common_js_1.toTxObject)(tx, item.guard),
|
|
655
|
+
tx.pure.u8(item.identifier),
|
|
656
|
+
tx.object.mutRegistrar(),
|
|
657
|
+
tx.object.clock(),
|
|
658
|
+
],
|
|
659
|
+
typeArguments: [treasury_type],
|
|
660
|
+
});
|
|
661
|
+
}
|
|
975
662
|
});
|
|
976
|
-
|
|
663
|
+
}
|
|
664
|
+
async function external_withdraw_guard_remove(tx, treasury, treasury_type, permission, guards, counts = exports.MAX_EXTERNAL_DEPOSIT_GUARD_COUNT, passport) {
|
|
665
|
+
guards = await local_js_1.LocalMark.Instance().get_many_address_availables(guards);
|
|
666
|
+
if (guards.length === 0) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (guards.length > counts) {
|
|
670
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard remove guards count ${guards.length} exceeds maximum ${counts}`);
|
|
671
|
+
}
|
|
672
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
673
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
674
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard remove treasury type ${treasury_type} is not valid`);
|
|
675
|
+
}
|
|
676
|
+
if (passport) {
|
|
677
|
+
tx.moveCall({
|
|
678
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw_guard_remove_with_passport"),
|
|
679
|
+
arguments: [
|
|
680
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
681
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
682
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
683
|
+
tx.pure.vector("address", guards),
|
|
684
|
+
tx.object.mutRegistrar(),
|
|
685
|
+
],
|
|
686
|
+
typeArguments: [treasury_type],
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
else {
|
|
690
|
+
tx.moveCall({
|
|
691
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw_guard_remove"),
|
|
692
|
+
arguments: [
|
|
693
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
694
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
695
|
+
tx.pure.vector("address", guards),
|
|
696
|
+
tx.object.mutRegistrar(),
|
|
697
|
+
],
|
|
698
|
+
typeArguments: [treasury_type],
|
|
699
|
+
});
|
|
700
|
+
}
|
|
977
701
|
}
|
|
978
702
|
function external_withdraw_guard_clear(tx, treasury, treasury_type, permission, passport) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
703
|
+
(0, util_js_1.validObjects)([treasury, permission, passport]);
|
|
704
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
705
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard clear treasury type ${treasury_type} is not valid`);
|
|
706
|
+
}
|
|
707
|
+
if (passport) {
|
|
708
|
+
tx.moveCall({
|
|
709
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw_guard_clear_with_passport"),
|
|
710
|
+
arguments: [
|
|
711
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
712
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
713
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
714
|
+
tx.object.mutRegistrar(),
|
|
715
|
+
],
|
|
716
|
+
typeArguments: [treasury_type],
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
tx.moveCall({
|
|
721
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw_guard_clear"),
|
|
722
|
+
arguments: [
|
|
723
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
724
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
725
|
+
tx.object.mutRegistrar(),
|
|
726
|
+
],
|
|
727
|
+
typeArguments: [treasury_type],
|
|
728
|
+
});
|
|
729
|
+
}
|
|
1008
730
|
}
|
|
1009
731
|
function create(tx, treasury, treasury_type) {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
arguments: [(0, import_common.toTxObject)(tx, treasury)],
|
|
1020
|
-
typeArguments: [treasury_type]
|
|
1021
|
-
});
|
|
732
|
+
(0, util_js_1.validObjects)([treasury]);
|
|
733
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
734
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Create treasury type ${treasury_type} is not valid`);
|
|
735
|
+
}
|
|
736
|
+
return tx.moveCall({
|
|
737
|
+
target: (0, common_js_1.treasuryFn)("create"),
|
|
738
|
+
arguments: [(0, common_js_1.toTxObject)(tx, treasury)],
|
|
739
|
+
typeArguments: [treasury_type],
|
|
740
|
+
});
|
|
1022
741
|
}
|
|
1023
742
|
async function external_deposit(env, tx, treasury, treasury_type, passport, external_deposit_guard, coin, payment_info) {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
(
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
p,
|
|
1050
|
-
tx.object.mutRegistrar(),
|
|
1051
|
-
tx.object.clock()
|
|
1052
|
-
],
|
|
1053
|
-
typeArguments: [treasury_type]
|
|
1054
|
-
});
|
|
743
|
+
(0, util_js_1.validObjects)([treasury, passport]);
|
|
744
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
745
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit treasury type ${treasury_type} is not valid`);
|
|
746
|
+
}
|
|
747
|
+
const [c, p, guard] = await Promise.all([
|
|
748
|
+
(0, base_js_1.getCoinParam)(env, tx, coin, treasury_type),
|
|
749
|
+
(0, payment_js_1.paymentInfo)(env, tx, payment_info),
|
|
750
|
+
local_js_1.LocalMark.Instance().get_address(external_deposit_guard),
|
|
751
|
+
]);
|
|
752
|
+
if (!guard) {
|
|
753
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External deposit guard ${external_deposit_guard} is not valid`);
|
|
754
|
+
}
|
|
755
|
+
return tx.moveCall({
|
|
756
|
+
target: (0, common_js_1.treasuryFn)("external_deposit"),
|
|
757
|
+
arguments: [
|
|
758
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
759
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
760
|
+
(0, common_js_1.toTxObject)(tx, guard),
|
|
761
|
+
c,
|
|
762
|
+
p,
|
|
763
|
+
tx.object.mutRegistrar(),
|
|
764
|
+
tx.object.clock(),
|
|
765
|
+
],
|
|
766
|
+
typeArguments: [treasury_type],
|
|
767
|
+
});
|
|
1055
768
|
}
|
|
1056
769
|
async function external_withdraw(env, tx, treasury, treasury_type, passport, external_withdraw_guard, recipient, payment_info) {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
(0, import_common.toTxObject)(tx, passport),
|
|
1086
|
-
(0, import_common.toTxObject)(tx, guard),
|
|
1087
|
-
tx.pure.address(recipient_addr),
|
|
1088
|
-
p,
|
|
1089
|
-
tx.object.mutRegistrar(),
|
|
1090
|
-
tx.object.clock()
|
|
1091
|
-
],
|
|
1092
|
-
typeArguments: [treasury_type]
|
|
1093
|
-
});
|
|
770
|
+
(0, util_js_1.validObjects)([treasury, passport]);
|
|
771
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
772
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw treasury type ${treasury_type} is not valid`);
|
|
773
|
+
}
|
|
774
|
+
const [p, guard, recipient_addr] = await Promise.all([
|
|
775
|
+
(0, payment_js_1.paymentInfo)(env, tx, payment_info),
|
|
776
|
+
local_js_1.LocalMark.Instance().get_address(external_withdraw_guard),
|
|
777
|
+
(0, index_js_1.GetAccountOrMark_Address)(recipient),
|
|
778
|
+
]);
|
|
779
|
+
if (!guard) {
|
|
780
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw guard ${external_withdraw_guard} is not valid`);
|
|
781
|
+
}
|
|
782
|
+
if (!recipient_addr) {
|
|
783
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `External withdraw recipient ${recipient} is not valid`);
|
|
784
|
+
}
|
|
785
|
+
return tx.moveCall({
|
|
786
|
+
target: (0, common_js_1.treasuryFn)("external_withdraw"),
|
|
787
|
+
arguments: [
|
|
788
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
789
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
790
|
+
(0, common_js_1.toTxObject)(tx, guard),
|
|
791
|
+
tx.pure.address(recipient_addr),
|
|
792
|
+
p,
|
|
793
|
+
tx.object.mutRegistrar(),
|
|
794
|
+
tx.object.clock(),
|
|
795
|
+
],
|
|
796
|
+
typeArguments: [treasury_type],
|
|
797
|
+
});
|
|
1094
798
|
}
|
|
1095
799
|
function receive(tx, treasury, treasury_type, permission, received, payment, passport) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
800
|
+
if (!payment) {
|
|
801
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Treasury receive payment is required`);
|
|
802
|
+
}
|
|
803
|
+
(0, util_js_1.validObjects)([treasury, permission, received, payment, passport]);
|
|
804
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
805
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Treasury receive treasury type ${treasury_type} is not valid`);
|
|
806
|
+
}
|
|
807
|
+
if (passport) {
|
|
808
|
+
tx.moveCall({
|
|
809
|
+
target: (0, common_js_1.treasuryFn)("receive_with_passport"),
|
|
810
|
+
arguments: [
|
|
811
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
812
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
813
|
+
(0, common_js_1.toTxObject)(tx, passport),
|
|
814
|
+
(0, common_js_1.toTxObject)(tx, received),
|
|
815
|
+
(0, common_js_1.toTxObject)(tx, payment),
|
|
816
|
+
tx.object.clock(),
|
|
817
|
+
],
|
|
818
|
+
typeArguments: [treasury_type],
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
tx.moveCall({
|
|
823
|
+
target: (0, common_js_1.treasuryFn)("receive"),
|
|
824
|
+
arguments: [
|
|
825
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
826
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
827
|
+
(0, common_js_1.toTxObject)(tx, received),
|
|
828
|
+
(0, common_js_1.toTxObject)(tx, payment),
|
|
829
|
+
tx.object.clock(),
|
|
830
|
+
],
|
|
831
|
+
typeArguments: [treasury_type],
|
|
832
|
+
});
|
|
833
|
+
}
|
|
1132
834
|
}
|
|
1133
835
|
function um_set(tx, treasury, treasury_type, permission, um, passport) {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
import_exception.WErrors.InvalidParam,
|
|
1138
|
-
`Treasury type ${treasury_type} is not valid`
|
|
1139
|
-
);
|
|
1140
|
-
}
|
|
1141
|
-
if (um) {
|
|
1142
|
-
if (passport) {
|
|
1143
|
-
tx.moveCall({
|
|
1144
|
-
target: (0, import_common.treasuryFn)(`um_set_with_passport`),
|
|
1145
|
-
arguments: [
|
|
1146
|
-
(0, import_common.toTxObject)(tx, treasury),
|
|
1147
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1148
|
-
passport,
|
|
1149
|
-
(0, import_common.toTxObject)(tx, um),
|
|
1150
|
-
tx.object.mutRegistrar(),
|
|
1151
|
-
tx.object.clock()
|
|
1152
|
-
],
|
|
1153
|
-
typeArguments: [treasury_type]
|
|
1154
|
-
});
|
|
1155
|
-
} else {
|
|
1156
|
-
tx.moveCall({
|
|
1157
|
-
target: (0, import_common.treasuryFn)(`um_set`),
|
|
1158
|
-
arguments: [
|
|
1159
|
-
(0, import_common.toTxObject)(tx, treasury),
|
|
1160
|
-
(0, import_common.toTxObject)(tx, permission),
|
|
1161
|
-
(0, import_common.toTxObject)(tx, um),
|
|
1162
|
-
tx.object.mutRegistrar(),
|
|
1163
|
-
tx.object.clock()
|
|
1164
|
-
],
|
|
1165
|
-
typeArguments: [treasury_type]
|
|
1166
|
-
});
|
|
836
|
+
(0, util_js_1.validObjects)([treasury, permission]);
|
|
837
|
+
if (!(0, common_js_1.IsValidArgType)(treasury_type)) {
|
|
838
|
+
(0, exception_js_1.W_ERROR)(exception_js_1.WErrors.InvalidParam, `Treasury type ${treasury_type} is not valid`);
|
|
1167
839
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
840
|
+
if (um) {
|
|
841
|
+
if (passport) {
|
|
842
|
+
tx.moveCall({
|
|
843
|
+
target: (0, common_js_1.treasuryFn)(`um_set_with_passport`),
|
|
844
|
+
arguments: [
|
|
845
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
846
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
847
|
+
passport,
|
|
848
|
+
(0, common_js_1.toTxObject)(tx, um),
|
|
849
|
+
tx.object.mutRegistrar(),
|
|
850
|
+
tx.object.clock(),
|
|
851
|
+
],
|
|
852
|
+
typeArguments: [treasury_type],
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
tx.moveCall({
|
|
857
|
+
target: (0, common_js_1.treasuryFn)(`um_set`),
|
|
858
|
+
arguments: [
|
|
859
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
860
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
861
|
+
(0, common_js_1.toTxObject)(tx, um),
|
|
862
|
+
tx.object.mutRegistrar(),
|
|
863
|
+
tx.object.clock(),
|
|
864
|
+
],
|
|
865
|
+
typeArguments: [treasury_type],
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
if (passport) {
|
|
871
|
+
tx.moveCall({
|
|
872
|
+
target: (0, common_js_1.treasuryFn)(`um_none_with_passport`),
|
|
873
|
+
arguments: [
|
|
874
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
875
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
876
|
+
passport,
|
|
877
|
+
tx.object.mutRegistrar(),
|
|
878
|
+
],
|
|
879
|
+
typeArguments: [treasury_type],
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
tx.moveCall({
|
|
884
|
+
target: (0, common_js_1.treasuryFn)(`um_none`),
|
|
885
|
+
arguments: [
|
|
886
|
+
(0, common_js_1.toTxObject)(tx, treasury),
|
|
887
|
+
(0, common_js_1.toTxObject)(tx, permission),
|
|
888
|
+
tx.object.mutRegistrar(),
|
|
889
|
+
],
|
|
890
|
+
typeArguments: [treasury_type],
|
|
891
|
+
});
|
|
892
|
+
}
|
|
1190
893
|
}
|
|
1191
|
-
}
|
|
1192
894
|
}
|
|
895
|
+
//# sourceMappingURL=treasury.js.map
|