wowok 1.8.3 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -33
- package/dist/cjs/bcs/bcs.d.ts +1973 -0
- package/dist/cjs/bcs/bcs.js +327 -0
- package/dist/cjs/bcs/effects.d.ts +579 -0
- package/dist/cjs/bcs/effects.js +231 -0
- package/dist/cjs/bcs/index.d.ts +2589 -0
- package/dist/cjs/bcs/index.js +79 -0
- package/dist/cjs/bcs/pure.d.ts +22 -0
- package/dist/cjs/bcs/pure.js +62 -0
- package/dist/cjs/bcs/type-tag-serializer.d.ts +7 -0
- package/dist/cjs/bcs/type-tag-serializer.js +124 -0
- package/dist/cjs/bcs/types.d.ts +114 -0
- package/dist/cjs/bcs/types.js +26 -0
- package/dist/cjs/client/index.d.ts +5 -0
- package/dist/cjs/client/index.js +34 -0
- package/dist/cjs/client/network.d.ts +5 -0
- package/dist/cjs/client/network.js +43 -0
- package/dist/cjs/cryptography/index.d.ts +7 -0
- package/dist/cjs/cryptography/index.js +46 -0
- package/dist/cjs/cryptography/intent.d.ts +6 -0
- package/dist/cjs/cryptography/intent.js +34 -0
- package/dist/cjs/cryptography/keypair.d.ts +73 -0
- package/dist/cjs/cryptography/keypair.js +125 -0
- package/dist/cjs/cryptography/mnemonics.d.ts +27 -0
- package/dist/cjs/cryptography/mnemonics.js +50 -0
- package/dist/cjs/cryptography/publickey.d.ts +67 -0
- package/dist/cjs/cryptography/publickey.js +142 -0
- package/dist/cjs/cryptography/signature-scheme.d.ts +24 -0
- package/dist/cjs/cryptography/signature-scheme.js +47 -0
- package/dist/cjs/cryptography/signature.d.ts +62 -0
- package/dist/cjs/cryptography/signature.js +71 -0
- package/dist/cjs/experimental/cache.d.ts +12 -0
- package/dist/cjs/experimental/client.d.ts +12 -0
- package/dist/cjs/experimental/core.d.ts +33 -0
- package/dist/cjs/experimental/errors.d.ts +8 -0
- package/dist/cjs/experimental/index.d.ts +7 -0
- package/dist/cjs/experimental/persistent-storage.d.ts +134 -0
- package/dist/cjs/experimental/persistent-storage.test.d.ts +5 -0
- package/dist/cjs/experimental/transports/utils.d.ts +3 -0
- package/dist/cjs/experimental/types.d.ts +367 -0
- package/dist/cjs/faucet/faucet.d.ts +66 -0
- package/dist/cjs/faucet/faucet.js +138 -0
- package/dist/cjs/faucet/index.d.ts +1 -0
- package/dist/cjs/faucet/index.js +29 -0
- package/dist/cjs/graphql/client.js +98 -0
- package/dist/cjs/graphql/core.js +506 -0
- package/dist/cjs/graphql/generated/2024.1/tada-env.js +13141 -0
- package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +11 -0
- package/dist/cjs/graphql/generated/2024.4/tada-env.js +13287 -0
- package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +11 -0
- package/dist/cjs/graphql/generated/latest/tada-env.js +12925 -0
- package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +11 -0
- package/dist/cjs/graphql/generated/queries.js +807 -0
- package/dist/cjs/graphql/index.js +25 -0
- package/dist/cjs/graphql/schemas/2024.1/index.js +28 -0
- package/dist/cjs/graphql/schemas/2024.4/index.js +28 -0
- package/dist/cjs/graphql/schemas/latest/index.js +28 -0
- package/dist/cjs/graphql/types.js +16 -0
- package/dist/cjs/grpc/client.d.ts +32 -0
- package/dist/cjs/grpc/client.js +64 -0
- package/dist/cjs/grpc/core.d.ts +28 -0
- package/dist/cjs/grpc/core.js +645 -0
- package/dist/cjs/grpc/index.d.ts +4 -0
- package/dist/cjs/grpc/index.js +26 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.d.ts +173 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.js +138 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.d.ts +104 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +94 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.d.ts +25 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +30 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +77 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.d.ts +169 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +224 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +134 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.d.ts +525 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +317 -0
- package/dist/cjs/grpc/proto/google/rpc/status.d.ts +46 -0
- package/dist/cjs/grpc/proto/google/rpc/status.js +52 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +70 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +52 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +45 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +77 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +84 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +170 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +300 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +87 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +29 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +86 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +87 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +519 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +63 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +85 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +81 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +122 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +368 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +485 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +81 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +241 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +55 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +141 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +114 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +53 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +63 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +61 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +541 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +33 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +50 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +90 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +88 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +546 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +54 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +65 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +740 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1005 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +49 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +177 -0
- package/dist/cjs/index.d.ts +25 -0
- package/dist/cjs/index.js +93 -0
- package/dist/cjs/jsonRpc/client.d.ts +261 -0
- package/dist/cjs/jsonRpc/client.js +747 -0
- package/dist/cjs/jsonRpc/core.d.ts +87 -0
- package/dist/cjs/jsonRpc/core.js +638 -0
- package/dist/cjs/jsonRpc/errors.d.ts +12 -0
- package/dist/cjs/jsonRpc/errors.js +65 -0
- package/dist/cjs/jsonRpc/http-transport.d.ts +42 -0
- package/dist/cjs/jsonRpc/http-transport.js +121 -0
- package/dist/cjs/jsonRpc/index.d.ts +4 -0
- package/dist/cjs/jsonRpc/index.js +31 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.d.ts +4 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +321 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.d.ts +43 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +220 -0
- package/dist/cjs/jsonRpc/types/chain.d.ts +99 -0
- package/dist/cjs/jsonRpc/types/chain.js +16 -0
- package/dist/cjs/jsonRpc/types/changes.d.ts +19 -0
- package/dist/cjs/jsonRpc/types/changes.js +16 -0
- package/dist/cjs/jsonRpc/types/coins.d.ts +6 -0
- package/dist/cjs/jsonRpc/types/coins.js +16 -0
- package/dist/cjs/jsonRpc/types/common.d.ts +2 -0
- package/dist/cjs/jsonRpc/types/common.js +16 -0
- package/dist/cjs/jsonRpc/types/generated.d.ts +1492 -0
- package/dist/cjs/jsonRpc/types/generated.js +16 -0
- package/dist/cjs/jsonRpc/types/index.d.ts +6 -0
- package/dist/cjs/jsonRpc/types/index.js +16 -0
- package/dist/cjs/jsonRpc/types/params.d.ts +656 -0
- package/dist/cjs/jsonRpc/types/params.js +16 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +82 -0
- package/dist/cjs/keypairs/ed25519/index.d.ts +2 -0
- package/dist/cjs/keypairs/ed25519/index.js +27 -0
- package/dist/cjs/keypairs/ed25519/keypair.d.ts +74 -0
- package/dist/cjs/keypairs/ed25519/keypair.js +169 -0
- package/dist/cjs/keypairs/ed25519/publickey.d.ts +30 -0
- package/dist/cjs/keypairs/ed25519/publickey.js +90 -0
- package/dist/cjs/keypairs/index.d.ts +4 -0
- package/dist/cjs/keypairs/index.js +21 -0
- package/dist/cjs/keypairs/passkey/index.d.ts +3 -0
- package/dist/cjs/keypairs/passkey/index.js +28 -0
- package/dist/cjs/keypairs/passkey/keypair.d.ts +113 -0
- package/dist/cjs/keypairs/passkey/keypair.js +268 -0
- package/dist/cjs/keypairs/passkey/publickey.d.ts +72 -0
- package/dist/cjs/keypairs/passkey/publickey.js +175 -0
- package/dist/cjs/keypairs/passkey/types.d.ts +12 -0
- package/dist/cjs/keypairs/passkey/types.js +16 -0
- package/dist/cjs/keypairs/secp256k1/index.d.ts +2 -0
- package/dist/cjs/keypairs/secp256k1/index.js +27 -0
- package/dist/cjs/keypairs/secp256k1/keypair.d.ts +73 -0
- package/dist/cjs/keypairs/secp256k1/keypair.js +159 -0
- package/dist/cjs/keypairs/secp256k1/publickey.d.ts +30 -0
- package/dist/cjs/keypairs/secp256k1/publickey.js +95 -0
- package/dist/cjs/keypairs/secp256r1/index.d.ts +2 -0
- package/dist/cjs/keypairs/secp256r1/index.js +27 -0
- package/dist/cjs/keypairs/secp256r1/keypair.d.ts +73 -0
- package/dist/cjs/keypairs/secp256r1/keypair.js +155 -0
- package/dist/cjs/keypairs/secp256r1/publickey.d.ts +30 -0
- package/dist/cjs/keypairs/secp256r1/publickey.js +96 -0
- package/dist/cjs/multisig/index.d.ts +2 -0
- package/dist/cjs/multisig/index.js +27 -0
- package/dist/cjs/multisig/publickey.d.ts +79 -0
- package/dist/cjs/multisig/publickey.js +296 -0
- package/dist/cjs/multisig/signer.d.ts +20 -0
- package/dist/cjs/multisig/signer.js +114 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/transactions/Arguments.d.ts +57 -0
- package/dist/cjs/transactions/Arguments.js +36 -0
- package/dist/cjs/transactions/Commands.d.ts +57 -0
- package/dist/cjs/transactions/Commands.js +143 -0
- package/dist/cjs/transactions/Inputs.d.ts +22 -0
- package/dist/cjs/transactions/Inputs.js +87 -0
- package/dist/cjs/transactions/ObjectCache.d.ts +83 -0
- package/dist/cjs/transactions/ObjectCache.js +251 -0
- package/dist/cjs/transactions/Transaction.d.ts +710 -0
- package/dist/cjs/transactions/Transaction.js +742 -0
- package/dist/cjs/transactions/TransactionData.d.ts +73 -0
- package/dist/cjs/transactions/TransactionData.js +472 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.d.ts +1 -0
- package/dist/cjs/transactions/__tests__/bcs.test.d.ts +1 -0
- package/dist/cjs/transactions/data/internal.d.ts +1010 -0
- package/dist/cjs/transactions/data/internal.js +230 -0
- package/dist/cjs/transactions/data/v1.d.ts +312 -0
- package/dist/cjs/transactions/data/v1.js +538 -0
- package/dist/cjs/transactions/data/v2.d.ts +153 -0
- package/dist/cjs/transactions/data/v2.js +124 -0
- package/dist/cjs/transactions/executor/caching.d.ts +31 -0
- package/dist/cjs/transactions/executor/caching.js +118 -0
- package/dist/cjs/transactions/executor/parallel.d.ts +37 -0
- package/dist/cjs/transactions/executor/parallel.js +395 -0
- package/dist/cjs/transactions/executor/queue.d.ts +11 -0
- package/dist/cjs/transactions/executor/queue.js +87 -0
- package/dist/cjs/transactions/executor/serial.d.ts +31 -0
- package/dist/cjs/transactions/executor/serial.js +136 -0
- package/dist/cjs/transactions/hash.d.ts +7 -0
- package/dist/cjs/transactions/hash.js +31 -0
- package/dist/cjs/transactions/index.d.ts +21 -0
- package/dist/cjs/transactions/index.js +50 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.d.ts +9 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.js +206 -0
- package/dist/cjs/transactions/object.d.ts +24 -0
- package/dist/cjs/transactions/object.js +116 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +37 -0
- package/dist/cjs/transactions/pure.d.ts +20 -0
- package/dist/cjs/transactions/pure.js +64 -0
- package/dist/cjs/transactions/resolve.d.ts +13 -0
- package/dist/cjs/transactions/resolve.js +103 -0
- package/dist/cjs/transactions/serializer.d.ts +7 -0
- package/dist/cjs/transactions/serializer.js +189 -0
- package/dist/cjs/transactions/utils.d.ts +10 -0
- package/dist/cjs/transactions/utils.js +143 -0
- package/dist/cjs/utils/constants.d.ts +17 -0
- package/dist/cjs/utils/constants.js +57 -0
- package/dist/cjs/utils/derived-objects.d.ts +5 -0
- package/dist/cjs/utils/derived-objects.js +33 -0
- package/dist/cjs/utils/dynamic-fields.d.ts +2 -0
- package/dist/cjs/utils/dynamic-fields.js +40 -0
- package/dist/cjs/utils/format.d.ts +2 -0
- package/dist/cjs/utils/format.js +35 -0
- package/dist/cjs/utils/index.d.ts +8 -0
- package/dist/cjs/utils/index.js +65 -0
- package/dist/cjs/utils/move-registry.d.ts +6 -0
- package/dist/cjs/utils/move-registry.js +44 -0
- package/dist/cjs/utils/sui-types.d.ts +26 -0
- package/dist/cjs/utils/sui-types.js +90 -0
- package/dist/cjs/utils/suins.d.ts +2 -0
- package/dist/cjs/utils/suins.js +56 -0
- package/dist/cjs/verify/index.d.ts +1 -0
- package/dist/cjs/verify/index.js +28 -0
- package/dist/cjs/verify/verify.d.ts +16 -0
- package/dist/cjs/verify/verify.js +125 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +26 -0
- package/dist/cjs/w/call/allocation.d.ts +35 -0
- package/dist/cjs/w/call/allocation.js +439 -0
- package/dist/cjs/w/call/arb.d.ts +17 -0
- package/dist/cjs/w/call/arb.js +149 -0
- package/dist/cjs/w/call/arbitration.d.ts +106 -0
- package/dist/cjs/w/call/arbitration.js +1623 -0
- package/dist/cjs/w/call/base.d.ts +42 -0
- package/dist/cjs/w/call/base.js +363 -0
- package/dist/cjs/w/call/contact.d.ts +45 -0
- package/dist/cjs/w/call/contact.js +479 -0
- package/dist/cjs/w/call/demand.d.ts +79 -0
- package/dist/cjs/w/call/demand.js +872 -0
- package/dist/cjs/w/call/entity.d.ts +33 -0
- package/dist/cjs/w/call/entity.js +230 -0
- package/dist/cjs/w/call/guard-ins.d.ts +31 -0
- package/dist/cjs/w/call/guard-ins.js +4391 -0
- package/dist/cjs/w/call/guard.d.ts +254 -0
- package/dist/cjs/w/call/guard.js +1210 -0
- package/dist/cjs/w/call/index.d.ts +37 -0
- package/dist/cjs/w/call/index.js +71 -0
- package/dist/cjs/w/call/machine.d.ts +124 -0
- package/dist/cjs/w/call/machine.js +1486 -0
- package/dist/cjs/w/call/order.d.ts +73 -0
- package/dist/cjs/w/call/order.js +485 -0
- package/dist/cjs/w/call/passport.d.ts +24 -0
- package/dist/cjs/w/call/passport.js +281 -0
- package/dist/cjs/w/call/payment.d.ts +27 -0
- package/dist/cjs/w/call/payment.js +241 -0
- package/dist/cjs/w/call/permission.d.ts +222 -0
- package/dist/cjs/w/call/permission.js +1368 -0
- package/dist/cjs/w/call/personal.d.ts +51 -0
- package/dist/cjs/w/call/personal.js +184 -0
- package/dist/cjs/w/call/progress.d.ts +94 -0
- package/dist/cjs/w/call/progress.js +833 -0
- package/dist/cjs/w/call/proof.d.ts +27 -0
- package/dist/cjs/w/call/proof.js +124 -0
- package/dist/cjs/w/call/repository.d.ts +97 -0
- package/dist/cjs/w/call/repository.js +1324 -0
- package/dist/cjs/w/call/resource.d.ts +27 -0
- package/dist/cjs/w/call/resource.js +149 -0
- package/dist/cjs/w/call/reward.d.ts +52 -0
- package/dist/cjs/w/call/reward.js +879 -0
- package/dist/cjs/w/call/service.d.ts +184 -0
- package/dist/cjs/w/call/service.js +2468 -0
- package/dist/cjs/w/call/treasury.d.ts +77 -0
- package/dist/cjs/w/call/treasury.js +1192 -0
- package/dist/cjs/w/call/util.d.ts +12 -0
- package/dist/cjs/w/call/util.js +661 -0
- package/dist/cjs/w/common.d.ts +359 -0
- package/dist/cjs/w/common.js +625 -0
- package/dist/cjs/w/exception.d.ts +82 -0
- package/dist/cjs/w/exception.js +604 -0
- package/dist/cjs/w/index.d.ts +8 -0
- package/dist/cjs/w/index.js +25 -0
- package/dist/cjs/w/local/.eslintrc.js +15 -0
- package/dist/cjs/w/local/account.d.ts +134 -0
- package/dist/cjs/w/local/account.js +770 -0
- package/dist/cjs/w/local/cache.d.ts +35 -0
- package/dist/cjs/w/local/cache.js +181 -0
- package/dist/cjs/w/local/config.d.ts +15 -0
- package/dist/cjs/w/local/config.js +83 -0
- package/dist/cjs/w/local/index.d.ts +193 -0
- package/dist/cjs/w/local/index.js +322 -0
- package/dist/cjs/w/local/local.d.ts +93 -0
- package/dist/cjs/w/local/local.js +673 -0
- package/dist/cjs/w/local/storage.d.ts +61 -0
- package/dist/cjs/w/local/storage.js +219 -0
- package/dist/cjs/w/local/token.d.ts +22 -0
- package/dist/cjs/w/local/token.js +182 -0
- package/dist/cjs/w/local/util.d.ts +5 -0
- package/dist/cjs/w/local/util.js +57 -0
- package/dist/cjs/w/local/wip.d.ts +218 -0
- package/dist/cjs/w/local/wip.js +911 -0
- package/dist/cjs/w/messenger/.eslintrc.js +15 -0
- package/dist/cjs/w/messenger/crypto.d.ts +269 -0
- package/dist/cjs/w/messenger/crypto.js +448 -0
- package/dist/cjs/w/messenger/index.d.ts +23 -0
- package/dist/cjs/w/messenger/index.js +37 -0
- package/dist/cjs/w/messenger/messenger-api.d.ts +225 -0
- package/dist/cjs/w/messenger/messenger-api.js +1247 -0
- package/dist/cjs/w/messenger/messenger-manager.d.ts +80 -0
- package/dist/cjs/w/messenger/messenger-manager.js +1143 -0
- package/dist/cjs/w/messenger/messenger.d.ts +231 -0
- package/dist/cjs/w/messenger/messenger.js +1512 -0
- package/dist/cjs/w/messenger/server.d.ts +134 -0
- package/dist/cjs/w/messenger/server.js +535 -0
- package/dist/cjs/w/messenger/session.d.ts +78 -0
- package/dist/cjs/w/messenger/session.js +418 -0
- package/dist/cjs/w/messenger/storage.d.ts +192 -0
- package/dist/cjs/w/messenger/storage.js +964 -0
- package/dist/cjs/w/messenger/types.d.ts +705 -0
- package/dist/cjs/w/messenger/types.js +107 -0
- package/dist/cjs/w/messenger/utils.d.ts +15 -0
- package/dist/cjs/w/messenger/utils.js +37 -0
- package/dist/cjs/w/query/bult-in.d.ts +73 -0
- package/dist/cjs/w/query/bult-in.js +121 -0
- package/dist/cjs/w/query/event.d.ts +82 -0
- package/dist/cjs/w/query/event.js +157 -0
- package/dist/cjs/w/query/index.d.ts +5 -0
- package/dist/cjs/w/query/index.js +22 -0
- package/dist/cjs/w/query/object.d.ts +658 -0
- package/dist/cjs/w/query/object.js +1671 -0
- package/dist/cjs/w/query/received.d.ts +34 -0
- package/dist/cjs/w/query/received.js +93 -0
- package/dist/cjs/w/query/util.d.ts +5 -0
- package/dist/cjs/w/query/util.js +82 -0
- package/dist/cjs/w/util.d.ts +19 -0
- package/dist/cjs/w/util.js +715 -0
- package/dist/cjs/zklogin/address.js +93 -0
- package/dist/cjs/zklogin/bcs.js +41 -0
- package/dist/cjs/zklogin/index.js +45 -0
- package/dist/cjs/zklogin/jwt-decode.js +88 -0
- package/dist/cjs/zklogin/jwt-utils.js +128 -0
- package/dist/cjs/zklogin/nonce.js +60 -0
- package/dist/cjs/zklogin/poseidon.js +64 -0
- package/dist/cjs/zklogin/publickey.js +281 -0
- package/dist/cjs/zklogin/signature.js +57 -0
- package/dist/cjs/zklogin/utils.js +98 -0
- package/dist/esm/bcs/bcs.d.ts +1973 -0
- package/dist/esm/bcs/bcs.js +319 -0
- package/dist/esm/bcs/effects.d.ts +579 -0
- package/dist/esm/bcs/effects.js +211 -0
- package/dist/esm/bcs/index.d.ts +2589 -0
- package/dist/esm/bcs/index.js +98 -0
- package/dist/esm/bcs/pure.d.ts +22 -0
- package/dist/esm/bcs/pure.js +42 -0
- package/dist/esm/bcs/type-tag-serializer.d.ts +7 -0
- package/dist/esm/bcs/type-tag-serializer.js +104 -0
- package/dist/esm/bcs/types.d.ts +114 -0
- package/dist/esm/bcs/types.js +6 -0
- package/dist/esm/client/index.d.ts +5 -0
- package/dist/esm/client/index.js +23 -0
- package/dist/esm/client/network.d.ts +5 -0
- package/dist/esm/client/network.js +23 -0
- package/dist/esm/cryptography/index.d.ts +7 -0
- package/dist/esm/cryptography/index.js +46 -0
- package/dist/esm/cryptography/intent.d.ts +6 -0
- package/dist/esm/cryptography/intent.js +14 -0
- package/dist/esm/cryptography/keypair.d.ts +73 -0
- package/dist/esm/cryptography/keypair.js +108 -0
- package/dist/esm/cryptography/mnemonics.d.ts +27 -0
- package/dist/esm/cryptography/mnemonics.js +30 -0
- package/dist/esm/cryptography/publickey.d.ts +67 -0
- package/dist/esm/cryptography/publickey.js +125 -0
- package/dist/esm/cryptography/signature-scheme.d.ts +24 -0
- package/dist/esm/cryptography/signature-scheme.js +27 -0
- package/dist/esm/cryptography/signature.d.ts +62 -0
- package/dist/esm/cryptography/signature.js +54 -0
- package/dist/esm/experimental/cache.d.ts +12 -0
- package/dist/esm/experimental/client.d.ts +12 -0
- package/dist/esm/experimental/core.d.ts +33 -0
- package/dist/esm/experimental/errors.d.ts +8 -0
- package/dist/esm/experimental/index.d.ts +7 -0
- package/dist/esm/experimental/persistent-storage.d.ts +134 -0
- package/dist/esm/experimental/persistent-storage.test.d.ts +5 -0
- package/dist/esm/experimental/transports/utils.d.ts +3 -0
- package/dist/esm/experimental/types.d.ts +367 -0
- package/dist/esm/faucet/faucet.d.ts +66 -0
- package/dist/esm/faucet/faucet.js +118 -0
- package/dist/esm/faucet/index.d.ts +1 -0
- package/dist/esm/faucet/index.js +16 -0
- package/dist/esm/graphql/client.js +79 -0
- package/dist/esm/graphql/core.js +505 -0
- package/dist/esm/graphql/generated/2024.1/tada-env.js +13121 -0
- package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +16 -0
- package/dist/esm/graphql/generated/2024.4/tada-env.js +13267 -0
- package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +16 -0
- package/dist/esm/graphql/generated/latest/tada-env.js +12905 -0
- package/dist/esm/graphql/generated/latest/tsconfig.tada.js +16 -0
- package/dist/esm/graphql/generated/queries.js +788 -0
- package/dist/esm/graphql/index.js +8 -0
- package/dist/esm/graphql/schemas/2024.1/index.js +8 -0
- package/dist/esm/graphql/schemas/2024.4/index.js +8 -0
- package/dist/esm/graphql/schemas/latest/index.js +8 -0
- package/dist/esm/graphql/types.js +0 -0
- package/dist/esm/grpc/client.d.ts +32 -0
- package/dist/esm/grpc/client.js +45 -0
- package/dist/esm/grpc/core.d.ts +28 -0
- package/dist/esm/grpc/core.js +634 -0
- package/dist/esm/grpc/index.d.ts +4 -0
- package/dist/esm/grpc/index.js +6 -0
- package/dist/esm/grpc/proto/google/protobuf/any.d.ts +173 -0
- package/dist/esm/grpc/proto/google/protobuf/any.js +118 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.d.ts +104 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.js +74 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.d.ts +25 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.js +10 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +57 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.d.ts +169 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.js +204 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +114 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.d.ts +525 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.js +297 -0
- package/dist/esm/grpc/proto/google/rpc/status.d.ts +46 -0
- package/dist/esm/grpc/proto/google/rpc/status.js +32 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +50 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +32 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +25 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +57 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +64 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +150 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +280 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +67 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +9 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +66 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +67 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +499 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +43 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +65 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +61 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +103 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +348 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +465 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +62 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +221 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +36 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +121 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +94 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +33 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +43 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +521 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +13 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +31 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +70 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +69 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +526 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +35 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +45 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +720 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +985 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +30 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +157 -0
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.js +119 -0
- package/dist/esm/jsonRpc/client.d.ts +261 -0
- package/dist/esm/jsonRpc/client.js +734 -0
- package/dist/esm/jsonRpc/core.d.ts +87 -0
- package/dist/esm/jsonRpc/core.js +621 -0
- package/dist/esm/jsonRpc/errors.d.ts +12 -0
- package/dist/esm/jsonRpc/errors.js +46 -0
- package/dist/esm/jsonRpc/http-transport.d.ts +42 -0
- package/dist/esm/jsonRpc/http-transport.js +101 -0
- package/dist/esm/jsonRpc/index.d.ts +4 -0
- package/dist/esm/jsonRpc/index.js +20 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.d.ts +4 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.js +309 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.d.ts +43 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.js +201 -0
- package/dist/esm/jsonRpc/types/chain.d.ts +99 -0
- package/dist/esm/jsonRpc/types/chain.js +0 -0
- package/dist/esm/jsonRpc/types/changes.d.ts +19 -0
- package/dist/esm/jsonRpc/types/changes.js +0 -0
- package/dist/esm/jsonRpc/types/coins.d.ts +6 -0
- package/dist/esm/jsonRpc/types/coins.js +0 -0
- package/dist/esm/jsonRpc/types/common.d.ts +2 -0
- package/dist/esm/jsonRpc/types/common.js +0 -0
- package/dist/esm/jsonRpc/types/generated.d.ts +1492 -0
- package/dist/esm/jsonRpc/types/generated.js +0 -0
- package/dist/esm/jsonRpc/types/index.d.ts +6 -0
- package/dist/esm/jsonRpc/types/index.js +0 -0
- package/dist/esm/jsonRpc/types/params.d.ts +656 -0
- package/dist/esm/jsonRpc/types/params.js +0 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +62 -0
- package/dist/esm/keypairs/ed25519/index.d.ts +2 -0
- package/dist/esm/keypairs/ed25519/index.js +10 -0
- package/dist/esm/keypairs/ed25519/keypair.d.ts +74 -0
- package/dist/esm/keypairs/ed25519/keypair.js +158 -0
- package/dist/esm/keypairs/ed25519/publickey.d.ts +30 -0
- package/dist/esm/keypairs/ed25519/publickey.js +75 -0
- package/dist/esm/keypairs/index.d.ts +4 -0
- package/dist/esm/keypairs/index.js +4 -0
- package/dist/esm/keypairs/passkey/index.d.ts +3 -0
- package/dist/esm/keypairs/passkey/index.js +12 -0
- package/dist/esm/keypairs/passkey/keypair.d.ts +113 -0
- package/dist/esm/keypairs/passkey/keypair.js +258 -0
- package/dist/esm/keypairs/passkey/publickey.d.ts +72 -0
- package/dist/esm/keypairs/passkey/publickey.js +156 -0
- package/dist/esm/keypairs/passkey/types.d.ts +12 -0
- package/dist/esm/keypairs/passkey/types.js +0 -0
- package/dist/esm/keypairs/secp256k1/index.d.ts +2 -0
- package/dist/esm/keypairs/secp256k1/index.js +10 -0
- package/dist/esm/keypairs/secp256k1/keypair.d.ts +73 -0
- package/dist/esm/keypairs/secp256k1/keypair.js +147 -0
- package/dist/esm/keypairs/secp256k1/publickey.d.ts +30 -0
- package/dist/esm/keypairs/secp256k1/publickey.js +80 -0
- package/dist/esm/keypairs/secp256r1/index.d.ts +2 -0
- package/dist/esm/keypairs/secp256r1/index.js +10 -0
- package/dist/esm/keypairs/secp256r1/keypair.d.ts +73 -0
- package/dist/esm/keypairs/secp256r1/keypair.js +143 -0
- package/dist/esm/keypairs/secp256r1/publickey.d.ts +30 -0
- package/dist/esm/keypairs/secp256r1/publickey.js +77 -0
- package/dist/esm/multisig/index.d.ts +2 -0
- package/dist/esm/multisig/index.js +10 -0
- package/dist/esm/multisig/publickey.d.ts +79 -0
- package/dist/esm/multisig/publickey.js +280 -0
- package/dist/esm/multisig/signer.d.ts +20 -0
- package/dist/esm/multisig/signer.js +94 -0
- package/dist/esm/package.json +5 -0
- package/dist/esm/transactions/Arguments.d.ts +57 -0
- package/dist/esm/transactions/Arguments.js +16 -0
- package/dist/esm/transactions/Commands.d.ts +57 -0
- package/dist/esm/transactions/Commands.js +123 -0
- package/dist/esm/transactions/Inputs.d.ts +22 -0
- package/dist/esm/transactions/Inputs.js +67 -0
- package/dist/esm/transactions/ObjectCache.d.ts +83 -0
- package/dist/esm/transactions/ObjectCache.js +231 -0
- package/dist/esm/transactions/Transaction.d.ts +710 -0
- package/dist/esm/transactions/Transaction.js +731 -0
- package/dist/esm/transactions/TransactionData.d.ts +73 -0
- package/dist/esm/transactions/TransactionData.js +453 -0
- package/dist/esm/transactions/__tests__/Transaction.test.d.ts +1 -0
- package/dist/esm/transactions/__tests__/bcs.test.d.ts +1 -0
- package/dist/esm/transactions/data/internal.d.ts +1010 -0
- package/dist/esm/transactions/data/internal.js +232 -0
- package/dist/esm/transactions/data/v1.d.ts +312 -0
- package/dist/esm/transactions/data/v1.js +542 -0
- package/dist/esm/transactions/data/v2.d.ts +153 -0
- package/dist/esm/transactions/data/v2.js +126 -0
- package/dist/esm/transactions/executor/caching.d.ts +31 -0
- package/dist/esm/transactions/executor/caching.js +99 -0
- package/dist/esm/transactions/executor/parallel.d.ts +37 -0
- package/dist/esm/transactions/executor/parallel.js +375 -0
- package/dist/esm/transactions/executor/queue.d.ts +11 -0
- package/dist/esm/transactions/executor/queue.js +68 -0
- package/dist/esm/transactions/executor/serial.d.ts +31 -0
- package/dist/esm/transactions/executor/serial.js +116 -0
- package/dist/esm/transactions/hash.d.ts +7 -0
- package/dist/esm/transactions/hash.js +11 -0
- package/dist/esm/transactions/index.d.ts +21 -0
- package/dist/esm/transactions/index.js +41 -0
- package/dist/esm/transactions/intents/CoinWithBalance.d.ts +9 -0
- package/dist/esm/transactions/intents/CoinWithBalance.js +186 -0
- package/dist/esm/transactions/object.d.ts +24 -0
- package/dist/esm/transactions/object.js +96 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +17 -0
- package/dist/esm/transactions/pure.d.ts +20 -0
- package/dist/esm/transactions/pure.js +44 -0
- package/dist/esm/transactions/resolve.d.ts +13 -0
- package/dist/esm/transactions/resolve.js +83 -0
- package/dist/esm/transactions/serializer.d.ts +7 -0
- package/dist/esm/transactions/serializer.js +169 -0
- package/dist/esm/transactions/utils.d.ts +10 -0
- package/dist/esm/transactions/utils.js +123 -0
- package/dist/esm/utils/constants.d.ts +17 -0
- package/dist/esm/utils/constants.js +37 -0
- package/dist/esm/utils/derived-objects.d.ts +5 -0
- package/dist/esm/utils/derived-objects.js +13 -0
- package/dist/esm/utils/dynamic-fields.d.ts +2 -0
- package/dist/esm/utils/dynamic-fields.js +20 -0
- package/dist/esm/utils/format.d.ts +2 -0
- package/dist/esm/utils/format.js +15 -0
- package/dist/esm/utils/index.d.ts +8 -0
- package/dist/esm/utils/index.js +76 -0
- package/dist/esm/utils/move-registry.d.ts +6 -0
- package/dist/esm/utils/move-registry.js +24 -0
- package/dist/esm/utils/sui-types.d.ts +26 -0
- package/dist/esm/utils/sui-types.js +70 -0
- package/dist/esm/utils/suins.d.ts +2 -0
- package/dist/esm/utils/suins.js +36 -0
- package/dist/esm/verify/index.d.ts +1 -0
- package/dist/esm/verify/index.js +14 -0
- package/dist/esm/verify/verify.d.ts +16 -0
- package/dist/esm/verify/verify.js +108 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +6 -0
- package/dist/esm/w/call/allocation.d.ts +35 -0
- package/dist/esm/w/call/allocation.js +433 -0
- package/dist/esm/w/call/arb.d.ts +17 -0
- package/dist/esm/w/call/arb.js +138 -0
- package/dist/esm/w/call/arbitration.d.ts +106 -0
- package/dist/esm/w/call/arbitration.js +1620 -0
- package/dist/esm/w/call/base.d.ts +42 -0
- package/dist/esm/w/call/base.js +350 -0
- package/dist/esm/w/call/contact.d.ts +45 -0
- package/dist/esm/w/call/contact.js +474 -0
- package/dist/esm/w/call/demand.d.ts +79 -0
- package/dist/esm/w/call/demand.js +869 -0
- package/dist/esm/w/call/entity.d.ts +33 -0
- package/dist/esm/w/call/entity.js +220 -0
- package/dist/esm/w/call/guard-ins.d.ts +31 -0
- package/dist/esm/w/call/guard-ins.js +4371 -0
- package/dist/esm/w/call/guard.d.ts +254 -0
- package/dist/esm/w/call/guard.js +1202 -0
- package/dist/esm/w/call/index.d.ts +37 -0
- package/dist/esm/w/call/index.js +57 -0
- package/dist/esm/w/call/machine.d.ts +124 -0
- package/dist/esm/w/call/machine.js +1492 -0
- package/dist/esm/w/call/order.d.ts +73 -0
- package/dist/esm/w/call/order.js +481 -0
- package/dist/esm/w/call/passport.d.ts +24 -0
- package/dist/esm/w/call/passport.js +266 -0
- package/dist/esm/w/call/payment.d.ts +27 -0
- package/dist/esm/w/call/payment.js +233 -0
- package/dist/esm/w/call/permission.d.ts +222 -0
- package/dist/esm/w/call/permission.js +1375 -0
- package/dist/esm/w/call/personal.d.ts +51 -0
- package/dist/esm/w/call/personal.js +177 -0
- package/dist/esm/w/call/progress.d.ts +94 -0
- package/dist/esm/w/call/progress.js +827 -0
- package/dist/esm/w/call/proof.d.ts +27 -0
- package/dist/esm/w/call/proof.js +110 -0
- package/dist/esm/w/call/repository.d.ts +97 -0
- package/dist/esm/w/call/repository.js +1325 -0
- package/dist/esm/w/call/resource.d.ts +27 -0
- package/dist/esm/w/call/resource.js +135 -0
- package/dist/esm/w/call/reward.d.ts +52 -0
- package/dist/esm/w/call/reward.js +874 -0
- package/dist/esm/w/call/service.d.ts +184 -0
- package/dist/esm/w/call/service.js +2472 -0
- package/dist/esm/w/call/treasury.d.ts +77 -0
- package/dist/esm/w/call/treasury.js +1186 -0
- package/dist/esm/w/call/util.d.ts +12 -0
- package/dist/esm/w/call/util.js +646 -0
- package/dist/esm/w/common.d.ts +359 -0
- package/dist/esm/w/common.js +605 -0
- package/dist/esm/w/exception.d.ts +82 -0
- package/dist/esm/w/exception.js +585 -0
- package/dist/esm/w/index.d.ts +8 -0
- package/dist/esm/w/index.js +8 -0
- package/dist/esm/w/local/.eslintrc.js +23 -0
- package/dist/esm/w/local/account.d.ts +134 -0
- package/dist/esm/w/local/account.js +746 -0
- package/dist/esm/w/local/cache.d.ts +35 -0
- package/dist/esm/w/local/cache.js +162 -0
- package/dist/esm/w/local/config.d.ts +15 -0
- package/dist/esm/w/local/config.js +64 -0
- package/dist/esm/w/local/index.d.ts +193 -0
- package/dist/esm/w/local/index.js +301 -0
- package/dist/esm/w/local/local.d.ts +93 -0
- package/dist/esm/w/local/local.js +654 -0
- package/dist/esm/w/local/storage.d.ts +61 -0
- package/dist/esm/w/local/storage.js +190 -0
- package/dist/esm/w/local/token.d.ts +22 -0
- package/dist/esm/w/local/token.js +163 -0
- package/dist/esm/w/local/util.d.ts +5 -0
- package/dist/esm/w/local/util.js +27 -0
- package/dist/esm/w/local/wip.d.ts +218 -0
- package/dist/esm/w/local/wip.js +882 -0
- package/dist/esm/w/messenger/.eslintrc.js +23 -0
- package/dist/esm/w/messenger/crypto.d.ts +269 -0
- package/dist/esm/w/messenger/crypto.js +428 -0
- package/dist/esm/w/messenger/index.d.ts +23 -0
- package/dist/esm/w/messenger/index.js +25 -0
- package/dist/esm/w/messenger/messenger-api.d.ts +225 -0
- package/dist/esm/w/messenger/messenger-api.js +1228 -0
- package/dist/esm/w/messenger/messenger-manager.d.ts +80 -0
- package/dist/esm/w/messenger/messenger-manager.js +1118 -0
- package/dist/esm/w/messenger/messenger.d.ts +231 -0
- package/dist/esm/w/messenger/messenger.js +1492 -0
- package/dist/esm/w/messenger/server.d.ts +134 -0
- package/dist/esm/w/messenger/server.js +520 -0
- package/dist/esm/w/messenger/session.d.ts +78 -0
- package/dist/esm/w/messenger/session.js +415 -0
- package/dist/esm/w/messenger/storage.d.ts +192 -0
- package/dist/esm/w/messenger/storage.js +935 -0
- package/dist/esm/w/messenger/types.d.ts +705 -0
- package/dist/esm/w/messenger/types.js +88 -0
- package/dist/esm/w/messenger/utils.d.ts +15 -0
- package/dist/esm/w/messenger/utils.js +17 -0
- package/dist/esm/w/query/bult-in.d.ts +73 -0
- package/dist/esm/w/query/bult-in.js +112 -0
- package/dist/esm/w/query/event.d.ts +82 -0
- package/dist/esm/w/query/event.js +137 -0
- package/dist/esm/w/query/index.d.ts +5 -0
- package/dist/esm/w/query/index.js +5 -0
- package/dist/esm/w/query/object.d.ts +658 -0
- package/dist/esm/w/query/object.js +1648 -0
- package/dist/esm/w/query/received.d.ts +34 -0
- package/dist/esm/w/query/received.js +73 -0
- package/dist/esm/w/query/util.d.ts +5 -0
- package/dist/esm/w/query/util.js +62 -0
- package/dist/esm/w/util.d.ts +19 -0
- package/dist/esm/w/util.js +710 -0
- package/dist/esm/zklogin/address.js +78 -0
- package/dist/esm/zklogin/bcs.js +21 -0
- package/dist/esm/zklogin/index.js +38 -0
- package/dist/esm/zklogin/jwt-decode.js +68 -0
- package/dist/esm/zklogin/jwt-utils.js +108 -0
- package/dist/esm/zklogin/nonce.js +40 -0
- package/dist/esm/zklogin/poseidon.js +61 -0
- package/dist/esm/zklogin/publickey.js +265 -0
- package/dist/esm/zklogin/signature.js +37 -0
- package/dist/esm/zklogin/utils.js +78 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +295 -61
- package/dist/arbitration.d.ts +0 -65
- package/dist/arbitration.d.ts.map +0 -1
- package/dist/arbitration.js +0 -517
- package/dist/arbitration.js.map +0 -1
- package/dist/demand.d.ts +0 -27
- package/dist/demand.d.ts.map +0 -1
- package/dist/demand.js +0 -266
- package/dist/demand.js.map +0 -1
- package/dist/entity.d.ts +0 -46
- package/dist/entity.d.ts.map +0 -1
- package/dist/entity.js +0 -146
- package/dist/entity.js.map +0 -1
- package/dist/exception.d.ts +0 -37
- package/dist/exception.d.ts.map +0 -1
- package/dist/exception.js +0 -41
- package/dist/exception.js.map +0 -1
- package/dist/guard.d.ts +0 -110
- package/dist/guard.d.ts.map +0 -1
- package/dist/guard.js +0 -936
- package/dist/guard.js.map +0 -1
- package/dist/index.d.ts +0 -40
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/machine.d.ts +0 -68
- package/dist/machine.d.ts.map +0 -1
- package/dist/machine.js +0 -520
- package/dist/machine.js.map +0 -1
- package/dist/passport.d.ts +0 -129
- package/dist/passport.d.ts.map +0 -1
- package/dist/passport.js +0 -1233
- package/dist/passport.js.map +0 -1
- package/dist/payment.d.ts +0 -28
- package/dist/payment.d.ts.map +0 -1
- package/dist/payment.js +0 -60
- package/dist/payment.js.map +0 -1
- package/dist/permission.d.ts +0 -155
- package/dist/permission.d.ts.map +0 -1
- package/dist/permission.js +0 -462
- package/dist/permission.js.map +0 -1
- package/dist/progress.d.ts +0 -66
- package/dist/progress.d.ts.map +0 -1
- package/dist/progress.js +0 -311
- package/dist/progress.js.map +0 -1
- package/dist/protocol.d.ts +0 -247
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -726
- package/dist/protocol.js.map +0 -1
- package/dist/repository.d.ts +0 -95
- package/dist/repository.d.ts.map +0 -1
- package/dist/repository.js +0 -793
- package/dist/repository.js.map +0 -1
- package/dist/resource.d.ts +0 -36
- package/dist/resource.d.ts.map +0 -1
- package/dist/resource.js +0 -129
- package/dist/resource.js.map +0 -1
- package/dist/service.d.ts +0 -144
- package/dist/service.d.ts.map +0 -1
- package/dist/service.js +0 -1303
- package/dist/service.js.map +0 -1
- package/dist/treasury.d.ts +0 -55
- package/dist/treasury.d.ts.map +0 -1
- package/dist/treasury.js +0 -393
- package/dist/treasury.js.map +0 -1
- package/dist/utils.d.ts +0 -94
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -582
- package/dist/utils.js.map +0 -1
- package/dist/wowok.d.ts +0 -15
- package/dist/wowok.d.ts.map +0 -1
- package/dist/wowok.js +0 -66
- package/dist/wowok.js.map +0 -1
package/dist/service.js
DELETED
|
@@ -1,1303 +0,0 @@
|
|
|
1
|
-
import { IsValidArray, IsValidRate, IsValidName_AllowEmpty, parseObjectType, array_unique, IsValidTokenType, IsValidDesription, IsValidAddress, IsValidEndpoint, IsValidU64, IsValidName, IsValidStringLength, IsValidLocation, IsValidU8 } from './utils.js';
|
|
2
|
-
import { Protocol } from './protocol.js';
|
|
3
|
-
import { ERROR, Errors } from './exception.js';
|
|
4
|
-
import { IsValidGuardIdentifier } from './index.js';
|
|
5
|
-
export var Service_Discount_Type;
|
|
6
|
-
(function (Service_Discount_Type) {
|
|
7
|
-
Service_Discount_Type[Service_Discount_Type["ratio"] = 0] = "ratio";
|
|
8
|
-
Service_Discount_Type[Service_Discount_Type["minus"] = 1] = "minus";
|
|
9
|
-
})(Service_Discount_Type || (Service_Discount_Type = {}));
|
|
10
|
-
export var BuyRequiredEnum;
|
|
11
|
-
(function (BuyRequiredEnum) {
|
|
12
|
-
BuyRequiredEnum["address"] = "address";
|
|
13
|
-
BuyRequiredEnum["phone"] = "phone";
|
|
14
|
-
BuyRequiredEnum["name"] = "name";
|
|
15
|
-
BuyRequiredEnum["postcode"] = "postcode";
|
|
16
|
-
})(BuyRequiredEnum || (BuyRequiredEnum = {}));
|
|
17
|
-
export class Service {
|
|
18
|
-
//static token2coin = (token:string) => { return '0x2::coin::Coin<' + token + '>'};
|
|
19
|
-
get_pay_type() { return this.pay_token_type; }
|
|
20
|
-
get_object() { return this.object; }
|
|
21
|
-
get_txb() { return this.txb; }
|
|
22
|
-
constructor(txb, pay_token_type, permission) {
|
|
23
|
-
this.pay_token_type = pay_token_type;
|
|
24
|
-
this.txb = txb;
|
|
25
|
-
this.permission = permission;
|
|
26
|
-
this.object = '';
|
|
27
|
-
}
|
|
28
|
-
static From(txb, token_type, permission, object) {
|
|
29
|
-
let s = new Service(txb, token_type, permission);
|
|
30
|
-
s.object = Protocol.TXB_OBJECT(txb, object);
|
|
31
|
-
return s;
|
|
32
|
-
}
|
|
33
|
-
static New(txb, token_type, permission, description, payee_treasury, passport) {
|
|
34
|
-
if (!Protocol.IsValidObjects([permission, payee_treasury])) {
|
|
35
|
-
ERROR(Errors.IsValidObjects);
|
|
36
|
-
}
|
|
37
|
-
if (!IsValidTokenType(token_type)) {
|
|
38
|
-
ERROR(Errors.IsValidTokenType, 'New: pay_token_type');
|
|
39
|
-
}
|
|
40
|
-
if (!IsValidDesription(description)) {
|
|
41
|
-
ERROR(Errors.IsValidDesription);
|
|
42
|
-
}
|
|
43
|
-
let pay_token_type = token_type;
|
|
44
|
-
let s = new Service(txb, pay_token_type, permission);
|
|
45
|
-
if (passport) {
|
|
46
|
-
s.object = txb.moveCall({
|
|
47
|
-
target: Protocol.Instance().serviceFn('new_with_passport'),
|
|
48
|
-
arguments: [passport, txb.pure.string(description), Protocol.TXB_OBJECT(txb, payee_treasury), Protocol.TXB_OBJECT(txb, permission)],
|
|
49
|
-
typeArguments: [pay_token_type],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
s.object = txb.moveCall({
|
|
54
|
-
target: Protocol.Instance().serviceFn('new'),
|
|
55
|
-
arguments: [txb.pure.string(description), Protocol.TXB_OBJECT(txb, payee_treasury), Protocol.TXB_OBJECT(txb, permission)],
|
|
56
|
-
typeArguments: [pay_token_type],
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return s;
|
|
60
|
-
}
|
|
61
|
-
launch() {
|
|
62
|
-
return this.txb.moveCall({
|
|
63
|
-
target: Protocol.Instance().serviceFn('create'),
|
|
64
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
65
|
-
typeArguments: [this.pay_token_type]
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
set_location(location, passport) {
|
|
69
|
-
if (!IsValidLocation(location)) {
|
|
70
|
-
ERROR(Errors.IsValidLocation, `Service.set_location.location ${location}`);
|
|
71
|
-
}
|
|
72
|
-
if (passport) {
|
|
73
|
-
this.txb.moveCall({
|
|
74
|
-
target: Protocol.Instance().serviceFn('location_set_with_passport'),
|
|
75
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(location), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
76
|
-
typeArguments: [this.pay_token_type]
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
this.txb.moveCall({
|
|
81
|
-
target: Protocol.Instance().serviceFn('location_set'),
|
|
82
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(location), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
83
|
-
typeArguments: [this.pay_token_type]
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
set_description(description, passport) {
|
|
88
|
-
if (!IsValidDesription(description)) {
|
|
89
|
-
ERROR(Errors.IsValidDesription);
|
|
90
|
-
}
|
|
91
|
-
if (passport) {
|
|
92
|
-
this.txb.moveCall({
|
|
93
|
-
target: Protocol.Instance().serviceFn('description_set_with_passport'),
|
|
94
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
95
|
-
typeArguments: [this.pay_token_type]
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
this.txb.moveCall({
|
|
100
|
-
target: Protocol.Instance().serviceFn('description_set'),
|
|
101
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
102
|
-
typeArguments: [this.pay_token_type]
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
set_price(item, price, bNotFoundAssert = true, passport) {
|
|
107
|
-
if (!IsValidU64(price)) {
|
|
108
|
-
ERROR(Errors.IsValidU64, 'set_price price');
|
|
109
|
-
}
|
|
110
|
-
if (!Service.IsValidItemName(item)) {
|
|
111
|
-
ERROR(Errors.IsValidServiceItemName, 'set_price item');
|
|
112
|
-
}
|
|
113
|
-
if (passport) {
|
|
114
|
-
this.txb.moveCall({
|
|
115
|
-
target: Protocol.Instance().serviceFn('price_set_with_passport'),
|
|
116
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
117
|
-
this.txb.pure.u64(price),
|
|
118
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
119
|
-
typeArguments: [this.pay_token_type]
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.txb.moveCall({
|
|
124
|
-
target: Protocol.Instance().serviceFn('price_set'),
|
|
125
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
126
|
-
this.txb.pure.u64(price),
|
|
127
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
128
|
-
typeArguments: [this.pay_token_type]
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
set_stock(item, stock, bNotFoundAssert = true, passport) {
|
|
133
|
-
if (!Service.IsValidItemName(item)) {
|
|
134
|
-
ERROR(Errors.IsValidServiceItemName, 'item');
|
|
135
|
-
}
|
|
136
|
-
if (!IsValidU64(stock)) {
|
|
137
|
-
ERROR(Errors.IsValidU64, 'stock');
|
|
138
|
-
}
|
|
139
|
-
if (passport) {
|
|
140
|
-
this.txb.moveCall({
|
|
141
|
-
target: Protocol.Instance().serviceFn('stock_set_with_passport'),
|
|
142
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
143
|
-
this.txb.pure.u64(stock),
|
|
144
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
145
|
-
typeArguments: [this.pay_token_type]
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
this.txb.moveCall({
|
|
150
|
-
target: Protocol.Instance().serviceFn('stock_set'),
|
|
151
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
152
|
-
this.txb.pure.u64(stock),
|
|
153
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
154
|
-
typeArguments: [this.pay_token_type]
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
add_stock(item, stock_add, bNotFoundAssert = true, passport) {
|
|
159
|
-
if (!Service.IsValidItemName(item)) {
|
|
160
|
-
ERROR(Errors.IsValidServiceItemName, 'add_stock item');
|
|
161
|
-
}
|
|
162
|
-
if (!IsValidU64(stock_add)) {
|
|
163
|
-
ERROR(Errors.IsValidUint, 'add_stock stock_add');
|
|
164
|
-
}
|
|
165
|
-
if (passport) {
|
|
166
|
-
this.txb.moveCall({
|
|
167
|
-
target: Protocol.Instance().serviceFn('stock_add_with_passport'),
|
|
168
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
169
|
-
this.txb.pure.u64(stock_add),
|
|
170
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
171
|
-
typeArguments: [this.pay_token_type]
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
this.txb.moveCall({
|
|
176
|
-
target: Protocol.Instance().serviceFn('stock_add'),
|
|
177
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
178
|
-
this.txb.pure.u64(stock_add),
|
|
179
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
180
|
-
typeArguments: [this.pay_token_type]
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
reduce_stock(item, stock_reduce, bNotFoundAssert = true, passport) {
|
|
185
|
-
if (!Service.IsValidItemName(item)) {
|
|
186
|
-
ERROR(Errors.IsValidServiceItemName, 'reduce_stock item');
|
|
187
|
-
}
|
|
188
|
-
if (!IsValidU64(stock_reduce)) {
|
|
189
|
-
ERROR(Errors.IsValidUint, 'reduce_stock stock_reduce');
|
|
190
|
-
}
|
|
191
|
-
if (passport) {
|
|
192
|
-
this.txb.moveCall({
|
|
193
|
-
target: Protocol.Instance().serviceFn('stock_reduce_with_passport'),
|
|
194
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
195
|
-
this.txb.pure.u64(stock_reduce),
|
|
196
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
197
|
-
typeArguments: [this.pay_token_type]
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
this.txb.moveCall({
|
|
202
|
-
target: Protocol.Instance().serviceFn('stock_reduce'),
|
|
203
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
204
|
-
this.txb.pure.u64(stock_reduce),
|
|
205
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
206
|
-
typeArguments: [this.pay_token_type]
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
set_sale_endpoint(item, endpoint, bNotFoundAssert = true, passport) {
|
|
211
|
-
if (!Service.IsValidItemName(item)) {
|
|
212
|
-
ERROR(Errors.IsValidServiceItemName, 'set_sale_endpoint item');
|
|
213
|
-
}
|
|
214
|
-
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
215
|
-
ERROR(Errors.IsValidEndpoint, 'set_sale_endpoint endpoint');
|
|
216
|
-
}
|
|
217
|
-
let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
218
|
-
if (passport) {
|
|
219
|
-
this.txb.moveCall({
|
|
220
|
-
target: Protocol.Instance().serviceFn('sale_endpoint_set_with_passport'),
|
|
221
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item), ep,
|
|
222
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
223
|
-
typeArguments: [this.pay_token_type]
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
this.txb.moveCall({
|
|
228
|
-
target: Protocol.Instance().serviceFn('sale_endpoint_set'),
|
|
229
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item), ep,
|
|
230
|
-
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
231
|
-
typeArguments: [this.pay_token_type]
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
set_payee(payee, passport) {
|
|
236
|
-
if (!Protocol.IsValidObjects([payee])) {
|
|
237
|
-
ERROR(Errors.IsValidObjects, 'set_payee');
|
|
238
|
-
}
|
|
239
|
-
if (passport) {
|
|
240
|
-
this.txb.moveCall({
|
|
241
|
-
target: Protocol.Instance().serviceFn('payee_set_with_passport'),
|
|
242
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, payee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
243
|
-
typeArguments: [this.pay_token_type]
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
this.txb.moveCall({
|
|
248
|
-
target: Protocol.Instance().serviceFn('payee_set'),
|
|
249
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, payee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
250
|
-
typeArguments: [this.pay_token_type]
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
add_repository(repository, passport) {
|
|
255
|
-
if (!Protocol.IsValidObjects([repository])) {
|
|
256
|
-
ERROR(Errors.IsValidObjects, 'repository_add');
|
|
257
|
-
}
|
|
258
|
-
if (passport) {
|
|
259
|
-
this.txb.moveCall({
|
|
260
|
-
target: Protocol.Instance().serviceFn('repository_add_with_passport'),
|
|
261
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
262
|
-
typeArguments: [this.pay_token_type]
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
this.txb.moveCall({
|
|
267
|
-
target: Protocol.Instance().serviceFn('repository_add'),
|
|
268
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
269
|
-
typeArguments: [this.pay_token_type]
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
remove_repository(repository_address, removeall, passport) {
|
|
274
|
-
if (!removeall && repository_address.length === 0)
|
|
275
|
-
return;
|
|
276
|
-
if (!IsValidArray(repository_address, IsValidAddress)) {
|
|
277
|
-
ERROR(Errors.IsValidArray, 'repository_address');
|
|
278
|
-
}
|
|
279
|
-
if (passport) {
|
|
280
|
-
if (removeall) {
|
|
281
|
-
this.txb.moveCall({
|
|
282
|
-
target: Protocol.Instance().serviceFn('repository_remove_all_with_passport'),
|
|
283
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
284
|
-
typeArguments: [this.pay_token_type]
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
this.txb.moveCall({
|
|
289
|
-
target: Protocol.Instance().serviceFn('repository_remove_with_passport'),
|
|
290
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repository_address)),
|
|
291
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
292
|
-
typeArguments: [this.pay_token_type]
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
if (removeall) {
|
|
298
|
-
this.txb.moveCall({
|
|
299
|
-
target: Protocol.Instance().serviceFn('repository_remove_all'),
|
|
300
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
301
|
-
typeArguments: [this.pay_token_type]
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
this.txb.moveCall({
|
|
306
|
-
target: Protocol.Instance().serviceFn('repository_remove'),
|
|
307
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repository_address)),
|
|
308
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
309
|
-
typeArguments: [this.pay_token_type]
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
add_arbitration(arbitraion, arbitraion_token_type, passport) {
|
|
315
|
-
if (!Protocol.IsValidObjects([arbitraion])) {
|
|
316
|
-
ERROR(Errors.IsValidObjects, 'add_arbitration.arbitraion');
|
|
317
|
-
}
|
|
318
|
-
if (!IsValidTokenType(arbitraion_token_type)) {
|
|
319
|
-
ERROR(Errors.IsValidTokenType, 'add_arbitration.arbitraion_token_type');
|
|
320
|
-
}
|
|
321
|
-
if (passport) {
|
|
322
|
-
this.txb.moveCall({
|
|
323
|
-
target: Protocol.Instance().serviceFn('arbitration_add_with_passport'),
|
|
324
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
325
|
-
typeArguments: [this.pay_token_type, arbitraion_token_type]
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
this.txb.moveCall({
|
|
330
|
-
target: Protocol.Instance().serviceFn('arbitration_add'),
|
|
331
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
332
|
-
typeArguments: [this.pay_token_type, arbitraion_token_type]
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
remove_arbitration(address, removeall, passport) {
|
|
337
|
-
if (!removeall && address.length === 0)
|
|
338
|
-
return;
|
|
339
|
-
if (!IsValidArray(address, IsValidAddress)) {
|
|
340
|
-
ERROR(Errors.IsValidArray, 'remove_arbitration.address');
|
|
341
|
-
}
|
|
342
|
-
if (passport) {
|
|
343
|
-
if (removeall) {
|
|
344
|
-
this.txb.moveCall({
|
|
345
|
-
target: Protocol.Instance().serviceFn('arbitration_remove_all_with_passport'),
|
|
346
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
347
|
-
typeArguments: [this.pay_token_type]
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
this.txb.moveCall({
|
|
352
|
-
target: Protocol.Instance().serviceFn('arbitration_remove_with_passport'),
|
|
353
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(address)),
|
|
354
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
355
|
-
typeArguments: [this.pay_token_type]
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
if (removeall) {
|
|
361
|
-
this.txb.moveCall({
|
|
362
|
-
target: Protocol.Instance().serviceFn('arbitration_remove_all'),
|
|
363
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
364
|
-
typeArguments: [this.pay_token_type]
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
this.txb.moveCall({
|
|
369
|
-
target: Protocol.Instance().serviceFn('arbitration_remove'),
|
|
370
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(address)),
|
|
371
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
372
|
-
typeArguments: [this.pay_token_type]
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
add_withdraw_guards(guards, passport) {
|
|
378
|
-
if (guards.length === 0)
|
|
379
|
-
return;
|
|
380
|
-
guards.forEach((v) => {
|
|
381
|
-
if (!Protocol.IsValidObjects([v.guard]))
|
|
382
|
-
ERROR(Errors.IsValidObjects, `add_withdraw_guards.guard ${v}`);
|
|
383
|
-
if (!IsValidRate(v.rate))
|
|
384
|
-
ERROR(Errors.IsValidRate, `add_withdraw_guards.rate ${v}`);
|
|
385
|
-
});
|
|
386
|
-
guards.forEach((guard) => {
|
|
387
|
-
if (passport) {
|
|
388
|
-
this.txb.moveCall({
|
|
389
|
-
target: Protocol.Instance().serviceFn('withdraw_guard_add_with_passport'),
|
|
390
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard),
|
|
391
|
-
this.txb.pure.u16(guard.rate), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
392
|
-
typeArguments: [this.pay_token_type]
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
this.txb.moveCall({
|
|
397
|
-
target: Protocol.Instance().serviceFn('withdraw_guard_add'),
|
|
398
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard), this.txb.pure.u16(guard.rate),
|
|
399
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
400
|
-
typeArguments: [this.pay_token_type]
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
remove_withdraw_guards(guard_address, removeall, passport) {
|
|
406
|
-
if (!removeall && guard_address.length === 0) {
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
if (!IsValidArray(guard_address, IsValidAddress)) {
|
|
410
|
-
ERROR(Errors.IsValidArray, 'guard_address');
|
|
411
|
-
}
|
|
412
|
-
if (passport) {
|
|
413
|
-
if (removeall) {
|
|
414
|
-
this.txb.moveCall({
|
|
415
|
-
target: Protocol.Instance().serviceFn('withdraw_guard_remove_all_with_passport'),
|
|
416
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
417
|
-
typeArguments: [this.pay_token_type]
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
this.txb.moveCall({
|
|
422
|
-
target: Protocol.Instance().serviceFn('withdraw_guard_remove_with_passport'),
|
|
423
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address)),
|
|
424
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
425
|
-
typeArguments: [this.pay_token_type]
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
else {
|
|
430
|
-
if (removeall) {
|
|
431
|
-
this.txb.moveCall({
|
|
432
|
-
target: Protocol.Instance().serviceFn('withdraw_guard_remove_all'),
|
|
433
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
434
|
-
typeArguments: [this.pay_token_type]
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
this.txb.moveCall({
|
|
439
|
-
target: Protocol.Instance().serviceFn('withdraw_guard_remove'),
|
|
440
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address)),
|
|
441
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
442
|
-
typeArguments: [this.pay_token_type]
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
add_refund_guards(guards, passport) {
|
|
448
|
-
if (guards.length === 0)
|
|
449
|
-
return;
|
|
450
|
-
guards.forEach((v) => {
|
|
451
|
-
if (!Protocol.IsValidObjects([v.guard]))
|
|
452
|
-
ERROR(Errors.IsValidObjects, `add_refund_guards.guard ${v}`);
|
|
453
|
-
if (!IsValidRate(v.rate))
|
|
454
|
-
ERROR(Errors.IsValidRate, `add_refund_guards.rate ${v}`);
|
|
455
|
-
});
|
|
456
|
-
guards.forEach((guard) => {
|
|
457
|
-
if (passport) {
|
|
458
|
-
this.txb.moveCall({
|
|
459
|
-
target: Protocol.Instance().serviceFn('refund_guard_add_with_passport'),
|
|
460
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard),
|
|
461
|
-
this.txb.pure.u16(guard.rate), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
462
|
-
typeArguments: [this.pay_token_type]
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
this.txb.moveCall({
|
|
467
|
-
target: Protocol.Instance().serviceFn('refund_guard_add'),
|
|
468
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard), this.txb.pure.u16(guard.rate),
|
|
469
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
470
|
-
typeArguments: [this.pay_token_type]
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
remove_refund_guards(guard_address, removeall, passport) {
|
|
476
|
-
if (guard_address.length === 0 && !removeall)
|
|
477
|
-
return;
|
|
478
|
-
if (!IsValidArray(guard_address, IsValidAddress)) {
|
|
479
|
-
ERROR(Errors.InvalidParam, 'guard_address');
|
|
480
|
-
}
|
|
481
|
-
if (passport) {
|
|
482
|
-
if (removeall) {
|
|
483
|
-
this.txb.moveCall({
|
|
484
|
-
target: Protocol.Instance().serviceFn('refund_guard_remove_all_with_passport'),
|
|
485
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
486
|
-
typeArguments: [this.pay_token_type]
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
this.txb.moveCall({
|
|
491
|
-
target: Protocol.Instance().serviceFn('refund_guard_remove_with_passport'),
|
|
492
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address)),
|
|
493
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
494
|
-
typeArguments: [this.pay_token_type]
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
else {
|
|
499
|
-
if (removeall) {
|
|
500
|
-
this.txb.moveCall({
|
|
501
|
-
target: Protocol.Instance().serviceFn('refund_guard_remove_all'),
|
|
502
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
503
|
-
typeArguments: [this.pay_token_type]
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
507
|
-
this.txb.moveCall({
|
|
508
|
-
target: Protocol.Instance().serviceFn('refund_guard_remove'),
|
|
509
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address)),
|
|
510
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
511
|
-
typeArguments: [this.pay_token_type]
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
check_valid_sale(sales) {
|
|
517
|
-
const names = [];
|
|
518
|
-
sales.forEach((v) => {
|
|
519
|
-
if (!Service.IsValidItemName(v.item))
|
|
520
|
-
ERROR(Errors.IsValidName, `check_valid_sale.sales.item ${v}`);
|
|
521
|
-
if (!IsValidU64(v.price))
|
|
522
|
-
ERROR(Errors.IsValidU64, `check_valid_sale.sales.price ${v}`);
|
|
523
|
-
if (!IsValidU64(v.stock))
|
|
524
|
-
ERROR(Errors.IsValidU64, `check_valid_sale.sales.stock ${v}`);
|
|
525
|
-
if (names.includes(v.item))
|
|
526
|
-
ERROR(Errors.IsValidName, `check_valid_sale.sales.item repeat ${v}`);
|
|
527
|
-
names.push(v.item);
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
add_sales(sales, bExistAssert = false, passport) {
|
|
531
|
-
if (sales.length === 0)
|
|
532
|
-
return;
|
|
533
|
-
this.check_valid_sale(sales);
|
|
534
|
-
let names = [];
|
|
535
|
-
let price = [];
|
|
536
|
-
let stock = [];
|
|
537
|
-
let endpoint = [];
|
|
538
|
-
sales.forEach((s) => {
|
|
539
|
-
if (s.endpoint && !IsValidEndpoint(s.endpoint)) {
|
|
540
|
-
ERROR(Errors.IsValidEndpoint, 'add_sales');
|
|
541
|
-
}
|
|
542
|
-
names.push(s.item);
|
|
543
|
-
price.push(s.price);
|
|
544
|
-
stock.push(s.stock);
|
|
545
|
-
endpoint.push(s.endpoint ?? '');
|
|
546
|
-
});
|
|
547
|
-
if (passport) {
|
|
548
|
-
this.txb.moveCall({
|
|
549
|
-
target: Protocol.Instance().serviceFn('sales_add_with_passport'),
|
|
550
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', names),
|
|
551
|
-
this.txb.pure.vector('string', endpoint),
|
|
552
|
-
this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
|
|
553
|
-
this.txb.pure.bool(bExistAssert),
|
|
554
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
555
|
-
typeArguments: [this.pay_token_type]
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
else {
|
|
559
|
-
this.txb.moveCall({
|
|
560
|
-
target: Protocol.Instance().serviceFn('sales_add'),
|
|
561
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', names),
|
|
562
|
-
this.txb.pure.vector('string', endpoint),
|
|
563
|
-
this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
|
|
564
|
-
this.txb.pure.bool(bExistAssert),
|
|
565
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
566
|
-
typeArguments: [this.pay_token_type]
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
remove_sales(sales, passport) {
|
|
571
|
-
if (sales.length === 0)
|
|
572
|
-
return;
|
|
573
|
-
if (!IsValidArray(sales, Service.IsValidItemName)) {
|
|
574
|
-
ERROR(Errors.IsValidArray, 'remove_sales');
|
|
575
|
-
}
|
|
576
|
-
if (passport) {
|
|
577
|
-
this.txb.moveCall({
|
|
578
|
-
target: Protocol.Instance().serviceFn('sales_remove_with_passport'),
|
|
579
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', array_unique(sales)),
|
|
580
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
581
|
-
typeArguments: [this.pay_token_type]
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
else {
|
|
585
|
-
this.txb.moveCall({
|
|
586
|
-
target: Protocol.Instance().serviceFn('sales_remove'),
|
|
587
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', array_unique(sales)),
|
|
588
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
589
|
-
typeArguments: [this.pay_token_type]
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
discount_transfer(discount_dispatch, passport) {
|
|
594
|
-
if (!discount_dispatch || discount_dispatch.length > Service.MAX_DISCOUNT_RECEIVER_COUNT) {
|
|
595
|
-
ERROR(Errors.InvalidParam, 'discount_dispatch');
|
|
596
|
-
}
|
|
597
|
-
discount_dispatch.forEach((v) => {
|
|
598
|
-
if (!IsValidAddress(v.receiver))
|
|
599
|
-
ERROR(Errors.IsValidAddress, `discount_transfer.discount_dispatch.receiver ${v}`);
|
|
600
|
-
if (!IsValidU64(v.count) || v.count > Service.MAX_DISCOUNT_COUNT_ONCE)
|
|
601
|
-
ERROR(Errors.IsValidU64, `discount_transfer.discount_dispatch.count ${v}`);
|
|
602
|
-
if (!IsValidName_AllowEmpty(v.discount.name))
|
|
603
|
-
ERROR(Errors.IsValidName, `discount_transfer.discount_dispatch.discount.name ${v}`);
|
|
604
|
-
if (v.discount.type == Service_Discount_Type.ratio && !IsValidRate(v.discount.off))
|
|
605
|
-
ERROR(Errors.IsValidRate, `discount_transfer.discount_dispatch.discount.off ${v}`);
|
|
606
|
-
if (!IsValidU64(v.discount.duration_minutes))
|
|
607
|
-
ERROR(Errors.IsValidU64, `discount_transfer.discount_dispatch.discount.duration_minutes ${v}`);
|
|
608
|
-
if (v.discount?.time_start && !IsValidU64(v.discount.time_start))
|
|
609
|
-
ERROR(Errors.IsValidU64, `discount_transfer.discount_dispatch.discount.time_start ${v}`);
|
|
610
|
-
if (v.discount?.price_greater && !IsValidU64(v.discount.price_greater))
|
|
611
|
-
ERROR(Errors.IsValidU64, `discount_transfer.discount_dispatch.discount.price_greater ${v}`);
|
|
612
|
-
});
|
|
613
|
-
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
614
|
-
discount_dispatch.forEach((discount) => {
|
|
615
|
-
let price_greater = this.txb.pure.option('u64', discount.discount?.price_greater ? discount.discount?.price_greater : undefined);
|
|
616
|
-
let time_start = this.txb.pure.option('u64', discount.discount?.time_start ? discount.discount?.time_start : undefined);
|
|
617
|
-
if (passport) {
|
|
618
|
-
this.txb.moveCall({
|
|
619
|
-
target: Protocol.Instance().serviceFn('dicscount_create_with_passport'),
|
|
620
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(discount.discount.name),
|
|
621
|
-
this.txb.pure.u8(discount.discount.type),
|
|
622
|
-
this.txb.pure.u64(discount.discount.off), price_greater, time_start,
|
|
623
|
-
this.txb.pure.u64(discount.discount.duration_minutes), this.txb.pure.u64(discount.count),
|
|
624
|
-
Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.pure.address(discount.receiver), this.txb.object(clock)],
|
|
625
|
-
typeArguments: [this.pay_token_type]
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
this.txb.moveCall({
|
|
630
|
-
target: Protocol.Instance().serviceFn('discount_create'),
|
|
631
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(discount.discount.name),
|
|
632
|
-
this.txb.pure.u8(discount.discount.type),
|
|
633
|
-
this.txb.pure.u64(discount.discount.off), price_greater, time_start,
|
|
634
|
-
this.txb.pure.u64(discount.discount.duration_minutes), this.txb.pure.u64(discount.count),
|
|
635
|
-
Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.pure.address(discount.receiver),
|
|
636
|
-
this.txb.object(clock)],
|
|
637
|
-
typeArguments: [this.pay_token_type]
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
// support both withdraw guard and permission guard
|
|
643
|
-
// withdraw_guard & passport must BOTH valid.
|
|
644
|
-
withdraw(order, param, passport) {
|
|
645
|
-
if (!Protocol.IsValidObjects([order, param.treasury, param.withdraw_guard, passport])) {
|
|
646
|
-
ERROR(Errors.IsValidObjects);
|
|
647
|
-
}
|
|
648
|
-
if (param?.for_guard && !Protocol.IsValidObjects([param.for_guard])) {
|
|
649
|
-
ERROR(Errors.IsValidObjects, 'withdraw.param.for_guard');
|
|
650
|
-
}
|
|
651
|
-
if (param?.for_object && !IsValidAddress(param.for_object)) {
|
|
652
|
-
ERROR(Errors.IsValidAddress, 'withdraw.param.for_object');
|
|
653
|
-
}
|
|
654
|
-
if (!IsValidU64(param.index)) {
|
|
655
|
-
ERROR(Errors.IsValidU64, 'withdraw.param.index');
|
|
656
|
-
}
|
|
657
|
-
if (!IsValidDesription(param.remark)) {
|
|
658
|
-
ERROR(Errors.IsValidDesription, 'withdraw.param.remark');
|
|
659
|
-
}
|
|
660
|
-
const for_obj = this.txb.pure.option('address', param.for_object ? param.for_object : undefined);
|
|
661
|
-
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
662
|
-
if (param.for_guard) {
|
|
663
|
-
return this.txb.moveCall({
|
|
664
|
-
target: Protocol.Instance().serviceFn('withdraw_forGuard_with_passport'),
|
|
665
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, param.withdraw_guard),
|
|
666
|
-
Protocol.TXB_OBJECT(this.txb, param.treasury), for_obj, Protocol.TXB_OBJECT(this.txb, param.for_guard), this.txb.pure.u64(param.index), this.txb.pure.string(param.remark),
|
|
667
|
-
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
668
|
-
typeArguments: [this.pay_token_type]
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
else {
|
|
672
|
-
return this.txb.moveCall({
|
|
673
|
-
target: Protocol.Instance().serviceFn('withdraw_with_passport'),
|
|
674
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, param.withdraw_guard),
|
|
675
|
-
Protocol.TXB_OBJECT(this.txb, param.treasury), for_obj, this.txb.pure.u64(param.index), this.txb.pure.string(param.remark),
|
|
676
|
-
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
677
|
-
typeArguments: [this.pay_token_type]
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
set_buy_guard(guard, passport) {
|
|
682
|
-
if (passport) {
|
|
683
|
-
if (guard) {
|
|
684
|
-
this.txb.moveCall({
|
|
685
|
-
target: Protocol.Instance().serviceFn('buy_guard_set_with_passport'),
|
|
686
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
687
|
-
typeArguments: [this.pay_token_type]
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
this.txb.moveCall({
|
|
692
|
-
target: Protocol.Instance().serviceFn('buy_guard_none_with_passport'),
|
|
693
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
694
|
-
typeArguments: [this.pay_token_type]
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
if (guard) {
|
|
700
|
-
this.txb.moveCall({
|
|
701
|
-
target: Protocol.Instance().serviceFn('buy_guard_set'),
|
|
702
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
703
|
-
typeArguments: [this.pay_token_type]
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
else {
|
|
707
|
-
this.txb.moveCall({
|
|
708
|
-
target: Protocol.Instance().serviceFn('buy_guard_none'),
|
|
709
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
710
|
-
typeArguments: [this.pay_token_type]
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
set_machine(machine, passport) {
|
|
716
|
-
if (passport) {
|
|
717
|
-
if (machine) {
|
|
718
|
-
this.txb.moveCall({
|
|
719
|
-
target: Protocol.Instance().serviceFn('machine_set_with_passport'),
|
|
720
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
721
|
-
typeArguments: [this.pay_token_type]
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
this.txb.moveCall({
|
|
726
|
-
target: Protocol.Instance().serviceFn('machine_none_with_passport'),
|
|
727
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
728
|
-
typeArguments: [this.pay_token_type]
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
else {
|
|
733
|
-
if (machine) {
|
|
734
|
-
this.txb.moveCall({
|
|
735
|
-
target: Protocol.Instance().serviceFn('machine_set'),
|
|
736
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
737
|
-
typeArguments: [this.pay_token_type]
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
this.txb.moveCall({
|
|
742
|
-
target: Protocol.Instance().serviceFn('machine_none'),
|
|
743
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
744
|
-
typeArguments: [this.pay_token_type]
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
set_endpoint(endpoint, passport) {
|
|
750
|
-
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
751
|
-
ERROR(Errors.IsValidEndpoint);
|
|
752
|
-
}
|
|
753
|
-
let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
754
|
-
if (passport) {
|
|
755
|
-
this.txb.moveCall({
|
|
756
|
-
target: Protocol.Instance().serviceFn('endpoint_set_with_passport'),
|
|
757
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
758
|
-
typeArguments: [this.pay_token_type]
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
this.txb.moveCall({
|
|
763
|
-
target: Protocol.Instance().serviceFn('endpoint_set'),
|
|
764
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
765
|
-
typeArguments: [this.pay_token_type]
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
publish(passport) {
|
|
770
|
-
if (passport) {
|
|
771
|
-
this.txb.moveCall({
|
|
772
|
-
target: Protocol.Instance().serviceFn('publish_with_passport'),
|
|
773
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
774
|
-
typeArguments: [this.pay_token_type]
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
else {
|
|
778
|
-
this.txb.moveCall({
|
|
779
|
-
target: Protocol.Instance().serviceFn('publish'),
|
|
780
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
781
|
-
typeArguments: [this.pay_token_type]
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
clone(new_token_type, bLaunch, passport) {
|
|
786
|
-
let ret;
|
|
787
|
-
if (passport) {
|
|
788
|
-
ret = this.txb.moveCall({
|
|
789
|
-
target: Protocol.Instance().serviceFn('clone_withpassport'),
|
|
790
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
791
|
-
typeArguments: [this.pay_token_type, new_token_type ? new_token_type : this.pay_token_type]
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
else {
|
|
795
|
-
ret = this.txb.moveCall({
|
|
796
|
-
target: Protocol.Instance().serviceFn('clone'),
|
|
797
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
798
|
-
typeArguments: [this.pay_token_type, new_token_type ? new_token_type : this.pay_token_type]
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
if (bLaunch) {
|
|
802
|
-
return this.txb.moveCall({
|
|
803
|
-
target: Protocol.Instance().serviceFn('create'),
|
|
804
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, ret)],
|
|
805
|
-
typeArguments: [new_token_type ? new_token_type : this.pay_token_type]
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
else {
|
|
809
|
-
return ret;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
set_customer_required(pubkey, customer_required, passport) {
|
|
813
|
-
if (customer_required.length > 0 && !pubkey) {
|
|
814
|
-
ERROR(Errors.InvalidParam, 'set_customer_required');
|
|
815
|
-
}
|
|
816
|
-
if (pubkey.length > Service.MAX_PUBKEY_SIZE) {
|
|
817
|
-
ERROR(Errors.InvalidParam, 'set_customer_required.pubkey');
|
|
818
|
-
}
|
|
819
|
-
if (customer_required.length > Service.MAX_REQUIRES_COUNT) {
|
|
820
|
-
ERROR(Errors.InvalidParam, 'set_customer_required.customer_required');
|
|
821
|
-
}
|
|
822
|
-
if (!IsValidArray(customer_required, IsValidName)) {
|
|
823
|
-
ERROR(Errors.IsValidArray, 'set_customer_required.customer_required');
|
|
824
|
-
}
|
|
825
|
-
const req = array_unique(customer_required);
|
|
826
|
-
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
827
|
-
if (passport) {
|
|
828
|
-
this.txb.moveCall({
|
|
829
|
-
target: Protocol.Instance().serviceFn('required_set_with_passport'),
|
|
830
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
831
|
-
this.txb.pure.vector('string', req),
|
|
832
|
-
this.txb.pure.string(pubkey),
|
|
833
|
-
this.txb.object(clock),
|
|
834
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
835
|
-
typeArguments: [this.pay_token_type]
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
else {
|
|
839
|
-
this.txb.moveCall({
|
|
840
|
-
target: Protocol.Instance().serviceFn('required_set'),
|
|
841
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object),
|
|
842
|
-
this.txb.pure.vector('string', req),
|
|
843
|
-
this.txb.pure.string(pubkey),
|
|
844
|
-
this.txb.object(clock),
|
|
845
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
846
|
-
typeArguments: [this.pay_token_type]
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
remove_customer_required(passport) {
|
|
851
|
-
if (passport) {
|
|
852
|
-
this.txb.moveCall({
|
|
853
|
-
target: Protocol.Instance().serviceFn('required_none_with_passport'),
|
|
854
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
855
|
-
typeArguments: [this.pay_token_type]
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
else {
|
|
859
|
-
this.txb.moveCall({
|
|
860
|
-
target: Protocol.Instance().serviceFn('required_none'),
|
|
861
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
862
|
-
typeArguments: [this.pay_token_type]
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
change_required_pubkey(pubkey, passport) {
|
|
867
|
-
if (!pubkey) {
|
|
868
|
-
ERROR(Errors.InvalidParam, 'pubkey');
|
|
869
|
-
}
|
|
870
|
-
if (passport) {
|
|
871
|
-
this.txb.moveCall({
|
|
872
|
-
target: Protocol.Instance().serviceFn('required_pubkey_set_with_passport'),
|
|
873
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(pubkey),
|
|
874
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
875
|
-
typeArguments: [this.pay_token_type]
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
879
|
-
this.txb.moveCall({
|
|
880
|
-
target: Protocol.Instance().serviceFn('required_pubkey_set'),
|
|
881
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(pubkey),
|
|
882
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
883
|
-
typeArguments: [this.pay_token_type]
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
/*
|
|
888
|
-
change_order_required_pubkey(order:OrderObject, pubkey:string, passport?:PassportObject) {
|
|
889
|
-
if (!Protocol.IsValidObjects([order])) {
|
|
890
|
-
ERROR(Errors.IsValidObjects, 'order')
|
|
891
|
-
}
|
|
892
|
-
if (!pubkey) {
|
|
893
|
-
ERROR(Errors.InvalidParam, 'pubkey')
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
if (passport) {
|
|
897
|
-
this.txb.moveCall({
|
|
898
|
-
target:Protocol.Instance().serviceFn('order_pubkey_update_with_passport') as FnCallType,
|
|
899
|
-
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.pure.string(pubkey),
|
|
900
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
901
|
-
typeArguments:[this.pay_token_type]
|
|
902
|
-
})
|
|
903
|
-
} else {
|
|
904
|
-
this.txb.moveCall({
|
|
905
|
-
target:Protocol.Instance().serviceFn('order_pubkey_update') as FnCallType,
|
|
906
|
-
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.pure.string(pubkey),
|
|
907
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
908
|
-
typeArguments:[this.pay_token_type]
|
|
909
|
-
})
|
|
910
|
-
}
|
|
911
|
-
} */
|
|
912
|
-
refund_by_service(order, passport) {
|
|
913
|
-
if (!Protocol.IsValidObjects([order])) {
|
|
914
|
-
ERROR(Errors.IsValidObjects, `refund_by_service.order ${order}`);
|
|
915
|
-
}
|
|
916
|
-
if (passport) {
|
|
917
|
-
this.txb.moveCall({
|
|
918
|
-
target: Protocol.Instance().serviceFn('refund_by_service_with_passport'),
|
|
919
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
920
|
-
typeArguments: [this.pay_token_type]
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
else {
|
|
924
|
-
this.txb.moveCall({
|
|
925
|
-
target: Protocol.Instance().serviceFn('refund_by_service'),
|
|
926
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
927
|
-
typeArguments: [this.pay_token_type]
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
pause(pause, passport) {
|
|
932
|
-
if (passport) {
|
|
933
|
-
this.txb.moveCall({
|
|
934
|
-
target: Protocol.Instance().serviceFn('pause_with_passport'),
|
|
935
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
936
|
-
typeArguments: [this.pay_token_type]
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
else {
|
|
940
|
-
this.txb.moveCall({
|
|
941
|
-
target: Protocol.Instance().serviceFn('pause'),
|
|
942
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
943
|
-
typeArguments: [this.pay_token_type]
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
refund_withArb(order, arb, arb_type) {
|
|
948
|
-
if (!Protocol.IsValidObjects([order, arb])) {
|
|
949
|
-
ERROR(Errors.IsValidObjects, 'refund_withArb.order or arb');
|
|
950
|
-
}
|
|
951
|
-
if (!IsValidTokenType(arb_type)) {
|
|
952
|
-
ERROR(Errors.IsValidTokenType, 'refund_withArb.arb_type');
|
|
953
|
-
}
|
|
954
|
-
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
955
|
-
this.txb.moveCall({
|
|
956
|
-
target: Protocol.Instance().serviceFn('refund_with_arb'),
|
|
957
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, arb), this.txb.object(clock)],
|
|
958
|
-
typeArguments: [this.pay_token_type, arb_type]
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
refund(order, refund_guard, passport) {
|
|
962
|
-
if (!Protocol.IsValidObjects([order])) {
|
|
963
|
-
ERROR(Errors.IsValidObjects, 'refund.order');
|
|
964
|
-
}
|
|
965
|
-
if (refund_guard && !Protocol.IsValidObjects([refund_guard])) {
|
|
966
|
-
ERROR(Errors.IsValidObjects, 'refund.refund_guard');
|
|
967
|
-
}
|
|
968
|
-
if (passport && !refund_guard) {
|
|
969
|
-
ERROR(Errors.InvalidParam, 'refund.passport need refund_guard');
|
|
970
|
-
}
|
|
971
|
-
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
972
|
-
if (passport && refund_guard) {
|
|
973
|
-
this.txb.moveCall({
|
|
974
|
-
target: Protocol.Instance().serviceFn('refund_with_passport'),
|
|
975
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, refund_guard),
|
|
976
|
-
passport, this.txb.object(clock)],
|
|
977
|
-
typeArguments: [this.pay_token_type]
|
|
978
|
-
});
|
|
979
|
-
}
|
|
980
|
-
else {
|
|
981
|
-
this.txb.moveCall({
|
|
982
|
-
target: Protocol.Instance().serviceFn('refund'),
|
|
983
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order)],
|
|
984
|
-
typeArguments: [this.pay_token_type]
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
update_order_required_info(order, customer_info_crypto) {
|
|
989
|
-
if (!customer_info_crypto || !customer_info_crypto.customer_pubkey) {
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
if (!Protocol.IsValidObjects([order])) {
|
|
993
|
-
ERROR(Errors.IsValidObjects, 'update_order_required_info.order');
|
|
994
|
-
}
|
|
995
|
-
this.txb.moveCall({
|
|
996
|
-
target: Protocol.Instance().serviceFn('order_required_info_update'),
|
|
997
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order),
|
|
998
|
-
this.txb.pure.string(customer_info_crypto.customer_pubkey),
|
|
999
|
-
this.txb.pure.string(customer_info_crypto.customer_info_crypt)],
|
|
1000
|
-
typeArguments: [this.pay_token_type]
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
order(buy_items, coin, discount, machine, customer_info_crypto, passport) {
|
|
1004
|
-
if (buy_items.length === 0)
|
|
1005
|
-
ERROR(Errors.InvalidParam, 'order.buy_items empty');
|
|
1006
|
-
const repeat = [];
|
|
1007
|
-
buy_items.forEach((v) => {
|
|
1008
|
-
if (!Service.IsValidItemName(v.item))
|
|
1009
|
-
ERROR(Errors.InvalidParam, `order.buy_items.item ${v}`);
|
|
1010
|
-
if (!IsValidU64(v.max_price))
|
|
1011
|
-
ERROR(Errors.IsValidU64, `order.buy_items.max_price ${v}`);
|
|
1012
|
-
if (!IsValidU64(v.count))
|
|
1013
|
-
ERROR(Errors.IsValidU64, `order.buy_items.count ${v}`);
|
|
1014
|
-
if (repeat.includes(v.item))
|
|
1015
|
-
ERROR(Errors.InvalidParam, `order.buy_items.item repeat ${v}`);
|
|
1016
|
-
repeat.push(v.item);
|
|
1017
|
-
});
|
|
1018
|
-
const name = [];
|
|
1019
|
-
const price = [];
|
|
1020
|
-
const stock = [];
|
|
1021
|
-
let order;
|
|
1022
|
-
buy_items.forEach((b) => { name.push(b.item); price.push(BigInt(b.max_price)); stock.push(BigInt(b.count)); });
|
|
1023
|
-
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
1024
|
-
if (passport) {
|
|
1025
|
-
if (discount) {
|
|
1026
|
-
order = this.txb.moveCall({
|
|
1027
|
-
target: Protocol.Instance().serviceFn('dicount_buy_with_passport'),
|
|
1028
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
|
|
1029
|
-
this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
|
|
1030
|
-
Protocol.TXB_OBJECT(this.txb, coin), Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
|
|
1031
|
-
typeArguments: [this.pay_token_type]
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
else {
|
|
1035
|
-
order = this.txb.moveCall({
|
|
1036
|
-
target: Protocol.Instance().serviceFn('buy_with_passport'),
|
|
1037
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
|
|
1038
|
-
this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
|
|
1039
|
-
Protocol.TXB_OBJECT(this.txb, coin), this.txb.object(clock)],
|
|
1040
|
-
typeArguments: [this.pay_token_type]
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
else {
|
|
1045
|
-
if (discount) {
|
|
1046
|
-
order = this.txb.moveCall({
|
|
1047
|
-
target: Protocol.Instance().serviceFn('discount_buy'),
|
|
1048
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
|
|
1049
|
-
this.txb.pure.vector('u64', price),
|
|
1050
|
-
this.txb.pure.vector('u64', stock),
|
|
1051
|
-
Protocol.TXB_OBJECT(this.txb, coin),
|
|
1052
|
-
Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
|
|
1053
|
-
typeArguments: [this.pay_token_type]
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
else {
|
|
1057
|
-
order = this.txb.moveCall({
|
|
1058
|
-
target: Protocol.Instance().serviceFn('buy'),
|
|
1059
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
|
|
1060
|
-
this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
|
|
1061
|
-
Protocol.TXB_OBJECT(this.txb, coin), this.txb.object(clock)],
|
|
1062
|
-
typeArguments: [this.pay_token_type]
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
if (customer_info_crypto) {
|
|
1067
|
-
this.update_order_required_info(order, customer_info_crypto);
|
|
1068
|
-
}
|
|
1069
|
-
var progress = undefined;
|
|
1070
|
-
if (machine) {
|
|
1071
|
-
progress = this.order_bind_machine(order, machine);
|
|
1072
|
-
}
|
|
1073
|
-
return { order: order, progress: progress };
|
|
1074
|
-
}
|
|
1075
|
-
order_launch(order) {
|
|
1076
|
-
var progress;
|
|
1077
|
-
if (order.progress) {
|
|
1078
|
-
progress = this.txb.moveCall({
|
|
1079
|
-
target: Protocol.Instance().progressFn('create'),
|
|
1080
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, order.progress)],
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
return { order: this.txb.moveCall({
|
|
1084
|
-
target: Protocol.Instance().serviceFn('order_create'),
|
|
1085
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order.order)],
|
|
1086
|
-
typeArguments: [this.pay_token_type]
|
|
1087
|
-
}), progress: progress };
|
|
1088
|
-
}
|
|
1089
|
-
buy(buy_items, coin, discount, machine, customer_info_crypto, passport) {
|
|
1090
|
-
const r = this.order(buy_items, coin, discount, machine, customer_info_crypto, passport);
|
|
1091
|
-
return this.order_launch(r);
|
|
1092
|
-
}
|
|
1093
|
-
order_bind_machine(order, machine) {
|
|
1094
|
-
if (!Protocol.IsValidObjects([order, machine])) {
|
|
1095
|
-
ERROR(Errors.IsValidObjects, 'order & machine');
|
|
1096
|
-
}
|
|
1097
|
-
return this.txb.moveCall({
|
|
1098
|
-
target: Protocol.Instance().serviceFn('order_bind_machine'),
|
|
1099
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, machine)],
|
|
1100
|
-
typeArguments: [this.pay_token_type]
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
add_treasury(treasury, treasury_token_type, passport) {
|
|
1104
|
-
if (!Protocol.IsValidObjects([treasury])) {
|
|
1105
|
-
ERROR(Errors.IsValidObjects, 'add_treasury.treasury');
|
|
1106
|
-
}
|
|
1107
|
-
if (!IsValidTokenType(treasury_token_type)) {
|
|
1108
|
-
ERROR(Errors.IsValidTokenType, 'add_treasury.treasury_token_type');
|
|
1109
|
-
}
|
|
1110
|
-
if (passport) {
|
|
1111
|
-
this.txb.moveCall({
|
|
1112
|
-
target: Protocol.Instance().serviceFn('treasury_add_with_passport'),
|
|
1113
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
1114
|
-
typeArguments: [this.pay_token_type, treasury_token_type]
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
else {
|
|
1118
|
-
this.txb.moveCall({
|
|
1119
|
-
target: Protocol.Instance().serviceFn('treasury_add'),
|
|
1120
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
1121
|
-
typeArguments: [this.pay_token_type, treasury_token_type]
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
remove_treasury(treasury, removeall, passport) {
|
|
1126
|
-
if (!removeall && treasury.length === 0)
|
|
1127
|
-
return;
|
|
1128
|
-
if (passport) {
|
|
1129
|
-
if (removeall) {
|
|
1130
|
-
this.txb.moveCall({
|
|
1131
|
-
target: Protocol.Instance().serviceFn('treasury_remove_all_with_passport'),
|
|
1132
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
1133
|
-
typeArguments: [this.pay_token_type]
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
else {
|
|
1137
|
-
this.txb.moveCall({
|
|
1138
|
-
target: Protocol.Instance().serviceFn('treasury_remove_with_passport'),
|
|
1139
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
1140
|
-
typeArguments: [this.pay_token_type]
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
else {
|
|
1145
|
-
if (removeall) {
|
|
1146
|
-
this.txb.moveCall({
|
|
1147
|
-
target: Protocol.Instance().serviceFn('treasury_remove_all'),
|
|
1148
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
1149
|
-
typeArguments: [this.pay_token_type]
|
|
1150
|
-
});
|
|
1151
|
-
}
|
|
1152
|
-
else {
|
|
1153
|
-
this.txb.moveCall({
|
|
1154
|
-
target: Protocol.Instance().serviceFn('treasury_remove'),
|
|
1155
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
1156
|
-
typeArguments: [this.pay_token_type]
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
change_permission(new_permission) {
|
|
1162
|
-
if (!Protocol.IsValidObjects([new_permission])) {
|
|
1163
|
-
ERROR(Errors.IsValidObjects);
|
|
1164
|
-
}
|
|
1165
|
-
this.txb.moveCall({
|
|
1166
|
-
target: Protocol.Instance().serviceFn('permission_set'),
|
|
1167
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
|
|
1168
|
-
typeArguments: [this.pay_token_type]
|
|
1169
|
-
});
|
|
1170
|
-
this.permission = new_permission;
|
|
1171
|
-
}
|
|
1172
|
-
set_order_agent(order, agent, orderProgress) {
|
|
1173
|
-
Service.SetOrderAgent(this.txb, this.pay_token_type, order, agent, orderProgress);
|
|
1174
|
-
}
|
|
1175
|
-
change_order_payer(order, new_addr, orderProgress) {
|
|
1176
|
-
Service.ChangeOrderPayer(this.txb, this.pay_token_type, order, new_addr, orderProgress);
|
|
1177
|
-
}
|
|
1178
|
-
static witness(txb, order, order_token_type, guard_index, identifier, type, passport) {
|
|
1179
|
-
if (type.length === 0 || identifier.length === 0)
|
|
1180
|
-
return;
|
|
1181
|
-
if (!Protocol.IsValidObjects([passport, order])) {
|
|
1182
|
-
ERROR(Errors.InvalidParam, `Service.witness.objects ${order} ${passport}`);
|
|
1183
|
-
}
|
|
1184
|
-
if (!IsValidTokenType(order_token_type)) {
|
|
1185
|
-
ERROR(Errors.IsValidTokenType, `Service.witness.order_type ${order_token_type}`);
|
|
1186
|
-
}
|
|
1187
|
-
if (!IsValidU8(guard_index)) {
|
|
1188
|
-
ERROR(Errors.InvalidParam, `Service.witness.guard ${guard_index}`);
|
|
1189
|
-
}
|
|
1190
|
-
identifier.forEach(v => {
|
|
1191
|
-
if (!IsValidGuardIdentifier(v)) {
|
|
1192
|
-
ERROR(Errors.IsValidIndentifier, `Service.witness.identifier ${v}`);
|
|
1193
|
-
}
|
|
1194
|
-
});
|
|
1195
|
-
return txb.moveCall({
|
|
1196
|
-
target: Protocol.Instance().orderFn('witness'), //@ order fn
|
|
1197
|
-
arguments: [passport, txb.pure.u8(guard_index), txb.pure.vector('u8', identifier), txb.pure.vector('u8', type),
|
|
1198
|
-
Protocol.TXB_OBJECT(txb, order)],
|
|
1199
|
-
typeArguments: [order_token_type]
|
|
1200
|
-
});
|
|
1201
|
-
}
|
|
1202
|
-
static IsValidItemName(name) {
|
|
1203
|
-
if (!name)
|
|
1204
|
-
return false;
|
|
1205
|
-
return IsValidStringLength(name, Service.MAX_ITEM_NAME_LENGTH);
|
|
1206
|
-
}
|
|
1207
|
-
// return current balance
|
|
1208
|
-
static OrderReceive(txb, order_token_type, order, payment, received, token_type) {
|
|
1209
|
-
if (!Protocol.IsValidObjects([payment, received])) {
|
|
1210
|
-
ERROR(Errors.IsValidArray, 'OrderReceive.payment&received');
|
|
1211
|
-
}
|
|
1212
|
-
return txb.moveCall({
|
|
1213
|
-
target: Protocol.Instance().orderFn('receive'),
|
|
1214
|
-
arguments: [Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, received), Protocol.TXB_OBJECT(txb, payment)],
|
|
1215
|
-
typeArguments: [order_token_type, token_type],
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
Service.MAX_DISCOUNT_COUNT_ONCE = 200;
|
|
1220
|
-
Service.MAX_DISCOUNT_RECEIVER_COUNT = 20;
|
|
1221
|
-
Service.MAX_GUARD_COUNT = 16;
|
|
1222
|
-
Service.MAX_REPOSITORY_COUNT = 32;
|
|
1223
|
-
Service.MAX_ITEM_NAME_LENGTH = 256;
|
|
1224
|
-
Service.MAX_TREASURY_COUNT = 8;
|
|
1225
|
-
Service.MAX_ORDER_AGENT_COUNT = 8;
|
|
1226
|
-
Service.MAX_ORDER_ARBS_COUNT = 8;
|
|
1227
|
-
Service.MAX_ARBITRATION_COUNT = 8;
|
|
1228
|
-
Service.MAX_REQUIRES_COUNT = 16;
|
|
1229
|
-
Service.MAX_PUBKEY_SIZE = 3000;
|
|
1230
|
-
Service.parseObjectType = (chain_type) => {
|
|
1231
|
-
return parseObjectType(chain_type, 'service::Service<');
|
|
1232
|
-
};
|
|
1233
|
-
Service.parseOrderObjectType = (chain_type) => {
|
|
1234
|
-
return parseObjectType(chain_type, 'order::Order<');
|
|
1235
|
-
};
|
|
1236
|
-
Service.Endpoint = (service_endpoint, item_endpoint, item_name, service_id) => {
|
|
1237
|
-
if (item_endpoint) {
|
|
1238
|
-
return item_endpoint;
|
|
1239
|
-
}
|
|
1240
|
-
else if (service_endpoint) {
|
|
1241
|
-
return service_endpoint + `?&service={service_id}&product=${encodeURI(item_name)}`;
|
|
1242
|
-
}
|
|
1243
|
-
};
|
|
1244
|
-
Service.DiscountObjects = (owner, handleDiscountObject, network) => {
|
|
1245
|
-
Protocol.Client(network).getOwnedObjects({ owner: owner,
|
|
1246
|
-
filter: { MoveModule: { module: 'order', package: Protocol.Instance().package('wowok') } },
|
|
1247
|
-
options: { showContent: true, showType: true } }).then((res) => {
|
|
1248
|
-
handleDiscountObject(owner, res.data.map((v) => v.data));
|
|
1249
|
-
}).catch((e) => {
|
|
1250
|
-
//console.log(e);
|
|
1251
|
-
});
|
|
1252
|
-
};
|
|
1253
|
-
// The agent has the same order operation power as the order payer; The agent can only be set by the order payer.
|
|
1254
|
-
Service.SetOrderAgent = (txb, order_token_type, order, agent, order_progress) => {
|
|
1255
|
-
if (!IsValidTokenType(order_token_type)) {
|
|
1256
|
-
ERROR(Errors.IsValidTokenType, 'SetOrderAgent.order_token_type');
|
|
1257
|
-
}
|
|
1258
|
-
if (!Protocol.IsValidObjects([order])) {
|
|
1259
|
-
ERROR(Errors.IsValidObjects, 'SetOrderAgent.order');
|
|
1260
|
-
}
|
|
1261
|
-
if (!IsValidArray(agent, IsValidAddress)) {
|
|
1262
|
-
ERROR(Errors.IsValidArray, 'SetOrderAgent.agent');
|
|
1263
|
-
}
|
|
1264
|
-
if (array_unique(agent).length > Service.MAX_ORDER_AGENT_COUNT) {
|
|
1265
|
-
ERROR(Errors.Fail, 'SetOrderAgent.agent count');
|
|
1266
|
-
}
|
|
1267
|
-
txb.moveCall({
|
|
1268
|
-
target: Protocol.Instance().orderFn('agent_set'),
|
|
1269
|
-
arguments: [Protocol.TXB_OBJECT(txb, order), txb.pure.vector('address', array_unique(agent))],
|
|
1270
|
-
typeArguments: [order_token_type]
|
|
1271
|
-
});
|
|
1272
|
-
if (order_progress) {
|
|
1273
|
-
txb.moveCall({
|
|
1274
|
-
target: Protocol.Instance().orderFn('order_ops_to_progress'),
|
|
1275
|
-
arguments: [Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, order_progress)],
|
|
1276
|
-
typeArguments: [order_token_type]
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
};
|
|
1280
|
-
Service.ChangeOrderPayer = (txb, order_token_type, order, new_addr, order_progress) => {
|
|
1281
|
-
if (!IsValidTokenType(order_token_type)) {
|
|
1282
|
-
ERROR(Errors.IsValidTokenType, 'ChangeOrderPayer.order_token_type');
|
|
1283
|
-
}
|
|
1284
|
-
if (!Protocol.IsValidObjects([order])) {
|
|
1285
|
-
ERROR(Errors.IsValidObjects, 'ChangeOrderPayer.order');
|
|
1286
|
-
}
|
|
1287
|
-
if (!IsValidAddress(new_addr)) {
|
|
1288
|
-
ERROR(Errors.IsValidAddress, 'ChangeOrderPayer.new_addr');
|
|
1289
|
-
}
|
|
1290
|
-
txb.moveCall({
|
|
1291
|
-
target: Protocol.Instance().orderFn('payer_change'),
|
|
1292
|
-
arguments: [Protocol.TXB_OBJECT(txb, order), txb.pure.address(new_addr)],
|
|
1293
|
-
typeArguments: [order_token_type]
|
|
1294
|
-
});
|
|
1295
|
-
if (order_progress) {
|
|
1296
|
-
txb.moveCall({
|
|
1297
|
-
target: Protocol.Instance().orderFn('order_ops_to_progress'),
|
|
1298
|
-
arguments: [Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, order_progress)],
|
|
1299
|
-
typeArguments: [order_token_type]
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
};
|
|
1303
|
-
//# sourceMappingURL=service.js.map
|