@haneullabs/haneul 2.5.1 → 2.13.0
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/CHANGELOG.md +129 -0
- package/README.md +36 -36
- package/dist/bcs/bcs.d.mts +6 -7
- package/dist/bcs/bcs.d.mts.map +1 -1
- package/dist/bcs/bcs.mjs.map +1 -1
- package/dist/bcs/effects.mjs.map +1 -1
- package/dist/bcs/index.d.mts +2 -2
- package/dist/bcs/index.d.mts.map +1 -1
- package/dist/bcs/index.mjs +2 -2
- package/dist/bcs/index.mjs.map +1 -1
- package/dist/bcs/pure.d.mts.map +1 -1
- package/dist/bcs/type-tag-serializer.d.mts.map +1 -1
- package/dist/bcs/types.d.mts +0 -1
- package/dist/bcs/types.d.mts.map +1 -1
- package/dist/client/cache.d.mts.map +1 -1
- package/dist/client/client.d.mts.map +1 -1
- package/dist/client/core-resolver.d.mts.map +1 -1
- package/dist/client/core-resolver.mjs +87 -68
- package/dist/client/core-resolver.mjs.map +1 -1
- package/dist/client/core.d.mts +9 -8
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs +29 -10
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/errors.d.mts.map +1 -1
- package/dist/client/mvr.d.mts +0 -1
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/types.d.mts +110 -24
- package/dist/client/types.d.mts.map +1 -1
- package/dist/client/utils.d.mts.map +1 -1
- package/dist/client/utils.mjs +7 -7
- package/dist/client/utils.mjs.map +1 -1
- package/dist/cryptography/index.d.mts +2 -2
- package/dist/cryptography/index.mjs +2 -2
- package/dist/cryptography/intent.d.mts +2 -2
- package/dist/cryptography/intent.d.mts.map +1 -1
- package/dist/cryptography/intent.mjs +2 -2
- package/dist/cryptography/intent.mjs.map +1 -1
- package/dist/cryptography/keypair.d.mts +3 -3
- package/dist/cryptography/keypair.d.mts.map +1 -1
- package/dist/cryptography/keypair.mjs +3 -3
- package/dist/cryptography/keypair.mjs.map +1 -1
- package/dist/cryptography/mnemonics.d.mts +5 -5
- package/dist/cryptography/mnemonics.d.mts.map +1 -1
- package/dist/cryptography/mnemonics.mjs +7 -7
- package/dist/cryptography/mnemonics.mjs.map +1 -1
- package/dist/cryptography/publickey.d.mts +2 -3
- package/dist/cryptography/publickey.d.mts.map +1 -1
- package/dist/cryptography/publickey.mjs +10 -10
- package/dist/cryptography/publickey.mjs.map +1 -1
- package/dist/cryptography/signature-scheme.d.mts.map +1 -1
- package/dist/cryptography/signature.d.mts +10 -13
- package/dist/cryptography/signature.d.mts.map +1 -1
- package/dist/cryptography/signature.mjs +2 -2
- package/dist/cryptography/signature.mjs.map +1 -1
- package/dist/faucet/faucet.d.mts +2 -2
- package/dist/faucet/faucet.d.mts.map +1 -1
- package/dist/faucet/faucet.mjs +2 -2
- package/dist/faucet/faucet.mjs.map +1 -1
- package/dist/faucet/index.d.mts +2 -2
- package/dist/faucet/index.mjs +2 -2
- package/dist/graphql/client.d.mts +20 -5
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs +55 -7
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts +6 -5
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +43 -47
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.d.mts +0 -1
- package/dist/graphql/generated/queries.d.mts.map +1 -1
- package/dist/graphql/generated/queries.mjs +46 -10
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/graphql/generated/tada-env.d.mts +706 -98
- package/dist/graphql/generated/tada-env.d.mts.map +1 -1
- package/dist/graphql/index.d.mts +2 -2
- package/dist/graphql/index.mjs +2 -2
- package/dist/graphql/schema/index.d.mts +0 -1
- package/dist/graphql/schema/index.d.mts.map +1 -1
- package/dist/graphql/types.d.mts.map +1 -1
- package/dist/grpc/client.d.mts +20 -5
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +47 -7
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +6 -5
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +35 -34
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/index.d.mts +2 -2
- package/dist/grpc/index.mjs +2 -2
- package/dist/grpc/proto/google/protobuf/any.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/any.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/duration.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/duration.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/field_mask.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/field_mask.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/struct.d.mts +1 -2
- package/dist/grpc/proto/google/protobuf/struct.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/timestamp.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/timestamp.d.mts.map +1 -1
- package/dist/grpc/proto/google/rpc/status.d.mts +0 -1
- package/dist/grpc/proto/google/rpc/status.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/argument.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/argument.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/balance_change.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/balance_change.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/bcs.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/bcs.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/bcs.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_contents.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_contents.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_summary.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_summary.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/effects.d.mts +5 -6
- package/dist/grpc/proto/haneul/rpc/v2/effects.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/epoch.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/epoch.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/error_reason.d.mts +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/error_reason.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/event.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/event.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/executed_transaction.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/executed_transaction.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.d.mts +8 -9
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.mjs +4 -4
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/gas_cost_summary.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/gas_cost_summary.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/input.d.mts +3 -4
- package/dist/grpc/proto/haneul/rpc/v2/input.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/jwk.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/jwk.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package.d.mts +5 -6
- package/dist/grpc/proto/haneul/rpc/v2/move_package.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/name_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/name_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/object.d.mts +38 -2
- package/dist/grpc/proto/haneul/rpc/v2/object.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/object.mjs +26 -1
- package/dist/grpc/proto/haneul/rpc/v2/object.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/object_reference.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/object_reference.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/owner.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/owner.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/protocol_config.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/protocol_config.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/signature.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.d.mts +2 -2
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.mjs +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/state_service.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/state_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts +3 -4
- package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.d.mts +9 -2
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.mjs +23 -12
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.mjs.map +1 -1
- package/dist/grpc/proto/types.d.mts +2 -2
- package/dist/grpc/proto/types.d.mts.map +1 -1
- package/dist/grpc/proto/types.mjs +2 -1
- package/dist/jsonRpc/client.d.mts +4 -7
- package/dist/jsonRpc/client.d.mts.map +1 -1
- package/dist/jsonRpc/client.mjs +4 -33
- package/dist/jsonRpc/client.mjs.map +1 -1
- package/dist/jsonRpc/core.d.mts +8 -15
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +81 -34
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/jsonRpc/errors.d.mts.map +1 -1
- package/dist/jsonRpc/http-transport.d.mts +1 -17
- package/dist/jsonRpc/http-transport.d.mts.map +1 -1
- package/dist/jsonRpc/http-transport.mjs +0 -23
- package/dist/jsonRpc/http-transport.mjs.map +1 -1
- package/dist/jsonRpc/index.d.mts +3 -3
- package/dist/jsonRpc/network.d.mts.map +1 -1
- package/dist/jsonRpc/types/chain.d.mts.map +1 -1
- package/dist/jsonRpc/types/changes.d.mts.map +1 -1
- package/dist/jsonRpc/types/coins.d.mts.map +1 -1
- package/dist/jsonRpc/types/common.d.mts +1 -2
- package/dist/jsonRpc/types/common.d.mts.map +1 -1
- package/dist/jsonRpc/types/generated.d.mts +101 -129
- package/dist/jsonRpc/types/generated.d.mts.map +1 -1
- package/dist/jsonRpc/types/index.d.mts +1 -1
- package/dist/jsonRpc/types/params.d.mts +9 -14
- package/dist/jsonRpc/types/params.d.mts.map +1 -1
- package/dist/keypairs/ed25519/keypair.d.mts +8 -6
- package/dist/keypairs/ed25519/keypair.d.mts.map +1 -1
- package/dist/keypairs/ed25519/keypair.mjs +13 -9
- package/dist/keypairs/ed25519/keypair.mjs.map +1 -1
- package/dist/keypairs/ed25519/publickey.d.mts +0 -1
- package/dist/keypairs/ed25519/publickey.d.mts.map +1 -1
- package/dist/keypairs/passkey/keypair.d.mts +12 -5
- package/dist/keypairs/passkey/keypair.d.mts.map +1 -1
- package/dist/keypairs/passkey/keypair.mjs +20 -7
- package/dist/keypairs/passkey/keypair.mjs.map +1 -1
- package/dist/keypairs/passkey/publickey.d.mts +0 -1
- package/dist/keypairs/passkey/publickey.d.mts.map +1 -1
- package/dist/keypairs/passkey/types.d.mts.map +1 -1
- package/dist/keypairs/secp256k1/keypair.d.mts +3 -3
- package/dist/keypairs/secp256k1/keypair.d.mts.map +1 -1
- package/dist/keypairs/secp256k1/keypair.mjs +6 -6
- package/dist/keypairs/secp256k1/keypair.mjs.map +1 -1
- package/dist/keypairs/secp256k1/publickey.d.mts +0 -1
- package/dist/keypairs/secp256k1/publickey.d.mts.map +1 -1
- package/dist/keypairs/secp256r1/keypair.d.mts +3 -3
- package/dist/keypairs/secp256r1/keypair.d.mts.map +1 -1
- package/dist/keypairs/secp256r1/keypair.mjs +6 -6
- package/dist/keypairs/secp256r1/keypair.mjs.map +1 -1
- package/dist/keypairs/secp256r1/publickey.d.mts +0 -1
- package/dist/keypairs/secp256r1/publickey.d.mts.map +1 -1
- package/dist/multisig/publickey.d.mts +1 -0
- package/dist/multisig/publickey.d.mts.map +1 -1
- package/dist/multisig/publickey.mjs +8 -8
- package/dist/multisig/publickey.mjs.map +1 -1
- package/dist/multisig/signer.d.mts.map +1 -1
- package/dist/transactions/Arguments.d.mts.map +1 -1
- package/dist/transactions/Commands.d.mts +1 -1
- package/dist/transactions/Commands.d.mts.map +1 -1
- package/dist/transactions/Commands.mjs.map +1 -1
- package/dist/transactions/Inputs.d.mts.map +1 -1
- package/dist/transactions/ObjectCache.d.mts +3 -3
- package/dist/transactions/ObjectCache.d.mts.map +1 -1
- package/dist/transactions/Transaction.d.mts +32 -6
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/Transaction.mjs +23 -1
- package/dist/transactions/Transaction.mjs.map +1 -1
- package/dist/transactions/TransactionData.d.mts.map +1 -1
- package/dist/transactions/TransactionData.mjs +8 -8
- package/dist/transactions/TransactionData.mjs.map +1 -1
- package/dist/transactions/data/internal.d.mts +109 -109
- package/dist/transactions/data/internal.d.mts.map +1 -1
- package/dist/transactions/data/internal.mjs.map +1 -1
- package/dist/transactions/data/v1.d.mts +220 -221
- package/dist/transactions/data/v1.d.mts.map +1 -1
- package/dist/transactions/data/v2.d.mts +16 -16
- package/dist/transactions/data/v2.d.mts.map +1 -1
- package/dist/transactions/data/v2.mjs.map +1 -1
- package/dist/transactions/executor/caching.mjs +2 -2
- package/dist/transactions/executor/caching.mjs.map +1 -1
- package/dist/transactions/executor/parallel.d.mts +1 -1
- package/dist/transactions/executor/parallel.d.mts.map +1 -1
- package/dist/transactions/executor/parallel.mjs +1 -1
- package/dist/transactions/executor/parallel.mjs.map +1 -1
- package/dist/transactions/executor/serial.d.mts +3 -3
- package/dist/transactions/executor/serial.d.mts.map +1 -1
- package/dist/transactions/executor/serial.mjs.map +1 -1
- package/dist/transactions/intents/CoinWithBalance.d.mts.map +1 -1
- package/dist/transactions/intents/CoinWithBalance.mjs +174 -97
- package/dist/transactions/intents/CoinWithBalance.mjs.map +1 -1
- package/dist/transactions/object.d.mts.map +1 -1
- package/dist/transactions/pure.d.mts.map +1 -1
- package/dist/transactions/pure.mjs +12 -12
- package/dist/transactions/pure.mjs.map +1 -1
- package/dist/transactions/resolve.d.mts.map +1 -1
- package/dist/transactions/resolve.mjs +3 -3
- package/dist/transactions/resolve.mjs.map +1 -1
- package/dist/transactions/serializer.d.mts.map +1 -1
- package/dist/transactions/serializer.mjs +15 -15
- package/dist/transactions/serializer.mjs.map +1 -1
- package/dist/transactions/utils.d.mts +0 -1
- package/dist/transactions/utils.d.mts.map +1 -1
- package/dist/utils/coin-reservation.mjs +67 -0
- package/dist/utils/coin-reservation.mjs.map +1 -0
- package/dist/utils/constants.d.mts +2 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +2 -1
- package/dist/utils/constants.mjs.map +1 -1
- package/dist/utils/derived-objects.d.mts +0 -1
- package/dist/utils/derived-objects.d.mts.map +1 -1
- package/dist/utils/dynamic-fields.d.mts.map +1 -1
- package/dist/utils/dynamic-fields.mjs +4 -4
- package/dist/utils/dynamic-fields.mjs.map +1 -1
- package/dist/utils/format.d.mts.map +1 -1
- package/dist/utils/haneul-types.d.mts.map +1 -1
- package/dist/utils/haneul-types.mjs +8 -0
- package/dist/utils/haneul-types.mjs.map +1 -1
- package/dist/utils/haneulns.d.mts.map +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +2 -2
- package/dist/utils/move-registry.d.mts.map +1 -1
- package/dist/verify/index.d.mts +2 -2
- package/dist/verify/index.mjs +2 -2
- package/dist/verify/verify.d.mts +2 -2
- package/dist/verify/verify.d.mts.map +1 -1
- package/dist/verify/verify.mjs +2 -2
- package/dist/verify/verify.mjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/address.d.mts.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/bcs.d.mts.map +1 -1
- package/dist/zklogin/jwt-decode.d.mts +0 -1
- package/dist/zklogin/jwt-decode.d.mts.map +1 -1
- package/dist/zklogin/jwt-utils.d.mts +0 -1
- package/dist/zklogin/jwt-utils.d.mts.map +1 -1
- package/dist/zklogin/nonce.d.mts.map +1 -1
- package/dist/zklogin/nonce.mjs +1 -1
- package/dist/zklogin/nonce.mjs.map +1 -1
- package/dist/zklogin/poseidon.d.mts.map +1 -1
- package/dist/zklogin/publickey.d.mts +0 -1
- package/dist/zklogin/publickey.d.mts.map +1 -1
- package/dist/zklogin/signature.d.mts.map +1 -1
- package/dist/zklogin/utils.d.mts.map +1 -1
- package/dist/zklogin/utils.mjs +1 -1
- package/dist/zklogin/utils.mjs.map +1 -1
- package/docs/bcs.md +132 -0
- package/docs/clients/core.md +616 -0
- package/docs/clients/graphql.md +99 -0
- package/docs/clients/grpc.md +152 -0
- package/docs/clients/index.md +93 -0
- package/docs/clients/json-rpc.md +235 -0
- package/docs/cryptography/keypairs.md +259 -0
- package/docs/cryptography/multisig.md +192 -0
- package/docs/cryptography/passkey.md +111 -0
- package/docs/cryptography/webcrypto-signer.md +81 -0
- package/docs/executors.md +148 -0
- package/docs/faucet.md +26 -0
- package/docs/hello-haneul.md +115 -0
- package/docs/index.md +56 -0
- package/docs/install.md +61 -0
- package/docs/llm-docs.md +32 -0
- package/docs/llms-index.md +66 -0
- package/docs/migrations/0.38.md +57 -0
- package/docs/migrations/haneul-1.0.md +454 -0
- package/docs/migrations/haneul-2.0/agent-prompt.md +42 -0
- package/docs/migrations/haneul-2.0/dapp-kit.md +350 -0
- package/docs/migrations/haneul-2.0/deepbook-v3.md +33 -0
- package/docs/migrations/haneul-2.0/haneul.md +341 -0
- package/docs/migrations/haneul-2.0/haneulns.md +42 -0
- package/docs/migrations/haneul-2.0/index.md +161 -0
- package/docs/migrations/haneul-2.0/json-rpc-migration.md +399 -0
- package/docs/migrations/haneul-2.0/kiosk.md +120 -0
- package/docs/migrations/haneul-2.0/sdk-maintainers.md +91 -0
- package/docs/migrations/haneul-2.0/seal.md +14 -0
- package/docs/migrations/haneul-2.0/wallet-builders.md +66 -0
- package/docs/migrations/haneul-2.0/walrus.md +41 -0
- package/docs/migrations/haneul-2.0/zksend.md +94 -0
- package/docs/plugins.md +255 -0
- package/docs/sdk-building.md +341 -0
- package/docs/transaction-building/basics.md +297 -0
- package/docs/transaction-building/gas.md +62 -0
- package/docs/transaction-building/intents.md +61 -0
- package/docs/transaction-building/offline.md +71 -0
- package/docs/transaction-building/sponsored-transactions.md +22 -0
- package/docs/utils/derived_objects.md +80 -0
- package/docs/utils/index.md +53 -0
- package/docs/zklogin.md +78 -0
- package/package.json +199 -199
- package/src/bcs/bcs.ts +13 -13
- package/src/bcs/effects.ts +20 -20
- package/src/bcs/index.ts +2 -2
- package/src/client/core-resolver.ts +150 -100
- package/src/client/core.ts +62 -22
- package/src/client/types.ts +109 -24
- package/src/cryptography/index.ts +2 -2
- package/src/cryptography/keypair.ts +2 -2
- package/src/cryptography/mnemonics.ts +7 -7
- package/src/cryptography/publickey.ts +8 -8
- package/src/faucet/faucet.ts +1 -1
- package/src/faucet/index.ts +1 -1
- package/src/graphql/client.ts +100 -8
- package/src/graphql/core.ts +73 -80
- package/src/graphql/generated/queries.ts +301 -51
- package/src/graphql/generated/schema.graphql +407 -104
- package/src/graphql/generated/tada-env.ts +779 -58
- package/src/graphql/index.ts +1 -1
- package/src/graphql/queries/getAllBalances.graphql +1 -1
- package/src/graphql/queries/getBalance.graphql +1 -1
- package/src/graphql/queries/getCoins.graphql +2 -2
- package/src/graphql/queries/getDynamicFields.graphql +9 -1
- package/src/graphql/queries/getMoveFunction.graphql +1 -1
- package/src/graphql/queries/getProtocolConfig.graphql +18 -0
- package/src/graphql/queries/nameService.graphql +1 -1
- package/src/graphql/queries/objects.graphql +11 -1
- package/src/graphql/queries/transactions.graphql +1 -3
- package/src/graphql/queries/verifyZkLoginSignature.graphql +1 -2
- package/src/grpc/client.ts +66 -8
- package/src/grpc/core.ts +74 -35
- package/src/grpc/index.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/bcs.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/execution_status.ts +4 -4
- package/src/grpc/proto/haneul/rpc/v2/object.ts +44 -0
- package/src/grpc/proto/haneul/rpc/v2/signature.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/signature_scheme.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/system_state.ts +4 -4
- package/src/grpc/proto/haneul/rpc/v2/transaction_execution_service.ts +16 -0
- package/src/jsonRpc/client.ts +5 -23
- package/src/jsonRpc/core.ts +114 -41
- package/src/jsonRpc/http-transport.ts +0 -52
- package/src/jsonRpc/index.ts +0 -1
- package/src/jsonRpc/types/common.ts +0 -1
- package/src/jsonRpc/types/generated.ts +2 -2
- package/src/jsonRpc/types/params.ts +6 -6
- package/src/keypairs/ed25519/keypair.ts +14 -10
- package/src/keypairs/passkey/keypair.ts +22 -8
- package/src/keypairs/secp256k1/keypair.ts +6 -6
- package/src/keypairs/secp256r1/keypair.ts +6 -6
- package/src/multisig/publickey.ts +1 -1
- package/src/transactions/Commands.ts +1 -1
- package/src/transactions/Transaction.ts +38 -1
- package/src/transactions/TransactionData.ts +3 -3
- package/src/transactions/__tests__/bcs.test.ts +3 -3
- package/src/transactions/data/internal.ts +12 -12
- package/src/transactions/data/v2.ts +6 -6
- package/src/transactions/executor/caching.ts +2 -2
- package/src/transactions/executor/parallel.ts +1 -2
- package/src/transactions/executor/serial.ts +1 -1
- package/src/transactions/intents/CoinWithBalance.ts +247 -121
- package/src/utils/coin-reservation.ts +84 -0
- package/src/utils/constants.ts +2 -0
- package/src/utils/haneul-types.ts +16 -1
- package/src/utils/index.ts +1 -0
- package/src/verify/index.ts +1 -1
- package/src/verify/verify.ts +1 -1
- package/src/version.ts +1 -1
- package/src/zklogin/nonce.ts +1 -1
- package/src/zklogin/utils.ts +1 -1
- package/dist/jsonRpc/rpc-websocket-client.d.mts +0 -26
- package/dist/jsonRpc/rpc-websocket-client.d.mts.map +0 -1
- package/dist/jsonRpc/rpc-websocket-client.mjs +0 -135
- package/dist/jsonRpc/rpc-websocket-client.mjs.map +0 -1
- package/src/jsonRpc/rpc-websocket-client.ts +0 -241
package/src/bcs/effects.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { bcs } from '@haneullabs/bcs';
|
|
|
5
5
|
|
|
6
6
|
import { Address, ObjectDigest, Owner, HaneulObjectRef, TypeTag } from './bcs.js';
|
|
7
7
|
|
|
8
|
-
// Rust:
|
|
8
|
+
// Rust: crates/haneul-types/src/execution_status.rs (PackageUpgradeError enum)
|
|
9
9
|
const PackageUpgradeError = bcs.enum('PackageUpgradeError', {
|
|
10
10
|
UnableToFetchPackage: bcs.struct('UnableToFetchPackage', { packageId: Address }),
|
|
11
11
|
NotAPackage: bcs.struct('NotAPackage', { objectId: Address }),
|
|
@@ -23,7 +23,7 @@ const ModuleId = bcs.struct('ModuleId', {
|
|
|
23
23
|
address: Address,
|
|
24
24
|
name: bcs.string(),
|
|
25
25
|
});
|
|
26
|
-
// Rust:
|
|
26
|
+
// Rust: crates/haneul-types/src/execution_status.rs
|
|
27
27
|
const MoveLocation = bcs.struct('MoveLocation', {
|
|
28
28
|
module: ModuleId,
|
|
29
29
|
function: bcs.u16(),
|
|
@@ -31,7 +31,7 @@ const MoveLocation = bcs.struct('MoveLocation', {
|
|
|
31
31
|
functionName: bcs.option(bcs.string()),
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
// Rust:
|
|
34
|
+
// Rust: crates/haneul-types/src/execution_status.rs
|
|
35
35
|
const CommandArgumentError = bcs.enum('CommandArgumentError', {
|
|
36
36
|
TypeMismatch: null,
|
|
37
37
|
InvalidBCSBytes: null,
|
|
@@ -57,13 +57,13 @@ const CommandArgumentError = bcs.enum('CommandArgumentError', {
|
|
|
57
57
|
InvalidReferenceArgument: null,
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
// Rust:
|
|
60
|
+
// Rust: crates/haneul-types/src/execution_status.rs
|
|
61
61
|
const TypeArgumentError = bcs.enum('TypeArgumentError', {
|
|
62
62
|
TypeNotFound: null,
|
|
63
63
|
ConstraintNotSatisfied: null,
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
// Rust:
|
|
66
|
+
// Rust: crates/haneul-types/src/execution_status.rs
|
|
67
67
|
const ExecutionFailureStatus = bcs.enum('ExecutionFailureStatus', {
|
|
68
68
|
InsufficientGas: null,
|
|
69
69
|
InvalidGasObject: null,
|
|
@@ -145,7 +145,7 @@ const ExecutionFailureStatus = bcs.enum('ExecutionFailureStatus', {
|
|
|
145
145
|
}),
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
// Rust:
|
|
148
|
+
// Rust: crates/haneul-types/src/execution_status.rs
|
|
149
149
|
export const ExecutionStatus = bcs.enum('ExecutionStatus', {
|
|
150
150
|
Success: null,
|
|
151
151
|
Failure: bcs.struct('Failure', {
|
|
@@ -154,7 +154,7 @@ export const ExecutionStatus = bcs.enum('ExecutionStatus', {
|
|
|
154
154
|
}),
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
// Rust:
|
|
157
|
+
// Rust: crates/haneul-types/src/gas.rs
|
|
158
158
|
const GasCostSummary = bcs.struct('GasCostSummary', {
|
|
159
159
|
computationCost: bcs.u64(),
|
|
160
160
|
storageCost: bcs.u64(),
|
|
@@ -162,7 +162,7 @@ const GasCostSummary = bcs.struct('GasCostSummary', {
|
|
|
162
162
|
nonRefundableStorageFee: bcs.u64(),
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
// Rust:
|
|
165
|
+
// Rust: crates/haneul-types/src/effects/effects_v1.rs
|
|
166
166
|
const TransactionEffectsV1 = bcs.struct('TransactionEffectsV1', {
|
|
167
167
|
status: ExecutionStatus,
|
|
168
168
|
executedEpoch: bcs.u64(),
|
|
@@ -181,29 +181,29 @@ const TransactionEffectsV1 = bcs.struct('TransactionEffectsV1', {
|
|
|
181
181
|
dependencies: bcs.vector(ObjectDigest),
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
// Rust:
|
|
184
|
+
// Rust: crates/haneul-types/src/base_types.rs
|
|
185
185
|
const VersionDigest = bcs.tuple([bcs.u64(), ObjectDigest]);
|
|
186
186
|
|
|
187
|
-
// Rust:
|
|
187
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
188
188
|
const ObjectIn = bcs.enum('ObjectIn', {
|
|
189
189
|
NotExist: null,
|
|
190
190
|
Exist: bcs.tuple([VersionDigest, Owner]),
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
// Rust:
|
|
193
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
194
194
|
const AccumulatorAddress = bcs.struct('AccumulatorAddress', {
|
|
195
195
|
address: Address,
|
|
196
196
|
// TODO: ask why this is the name
|
|
197
197
|
ty: TypeTag,
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
// Rust:
|
|
200
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
201
201
|
const AccumulatorOperation = bcs.enum('AccumulatorOperation', {
|
|
202
202
|
Merge: null,
|
|
203
203
|
Split: null,
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
// Rust:
|
|
206
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
207
207
|
const AccumulatorValue = bcs.enum('AccumulatorValue', {
|
|
208
208
|
Integer: bcs.u64(),
|
|
209
209
|
IntegerTuple: bcs.tuple([bcs.u64(), bcs.u64()]),
|
|
@@ -211,14 +211,14 @@ const AccumulatorValue = bcs.enum('AccumulatorValue', {
|
|
|
211
211
|
EventDigest: bcs.vector(bcs.tuple([bcs.u64(), ObjectDigest])),
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
// Rust:
|
|
214
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
215
215
|
const AccumulatorWriteV1 = bcs.struct('AccumulatorWriteV1', {
|
|
216
216
|
address: AccumulatorAddress,
|
|
217
217
|
operation: AccumulatorOperation,
|
|
218
218
|
value: AccumulatorValue,
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
-
// Rust:
|
|
221
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
222
222
|
const ObjectOut = bcs.enum('ObjectOut', {
|
|
223
223
|
NotExist: null,
|
|
224
224
|
ObjectWrite: bcs.tuple([ObjectDigest, Owner]),
|
|
@@ -226,21 +226,21 @@ const ObjectOut = bcs.enum('ObjectOut', {
|
|
|
226
226
|
AccumulatorWriteV1: AccumulatorWriteV1,
|
|
227
227
|
});
|
|
228
228
|
|
|
229
|
-
// Rust:
|
|
229
|
+
// Rust: crates/haneul-types/src/effects/mod.rs
|
|
230
230
|
const IDOperation = bcs.enum('IDOperation', {
|
|
231
231
|
None: null,
|
|
232
232
|
Created: null,
|
|
233
233
|
Deleted: null,
|
|
234
234
|
});
|
|
235
235
|
|
|
236
|
-
// Rust:
|
|
236
|
+
// Rust: crates/haneul-types/src/effects/object_change.rs
|
|
237
237
|
const EffectsObjectChange = bcs.struct('EffectsObjectChange', {
|
|
238
238
|
inputState: ObjectIn,
|
|
239
239
|
outputState: ObjectOut,
|
|
240
240
|
idOperation: IDOperation,
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
// Rust:
|
|
243
|
+
// Rust: crates/haneul-types/src/effects/effects_v2.rs
|
|
244
244
|
const UnchangedConsensusKind = bcs.enum('UnchangedConsensusKind', {
|
|
245
245
|
ReadOnlyRoot: VersionDigest,
|
|
246
246
|
MutateConsensusStreamEnded: bcs.u64(),
|
|
@@ -249,7 +249,7 @@ const UnchangedConsensusKind = bcs.enum('UnchangedConsensusKind', {
|
|
|
249
249
|
PerEpochConfig: null,
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
// Rust:
|
|
252
|
+
// Rust: crates/haneul-types/src/effects/effects_v2.rs
|
|
253
253
|
const TransactionEffectsV2 = bcs.struct('TransactionEffectsV2', {
|
|
254
254
|
status: ExecutionStatus,
|
|
255
255
|
executedEpoch: bcs.u64(),
|
|
@@ -264,7 +264,7 @@ const TransactionEffectsV2 = bcs.struct('TransactionEffectsV2', {
|
|
|
264
264
|
auxDataDigest: bcs.option(ObjectDigest),
|
|
265
265
|
});
|
|
266
266
|
|
|
267
|
-
// Rust:
|
|
267
|
+
// Rust: crates/haneul-types/src/effects/mod.rs
|
|
268
268
|
export const TransactionEffects = bcs.enum('TransactionEffects', {
|
|
269
269
|
V1: TransactionEffectsV1,
|
|
270
270
|
V2: TransactionEffectsV2,
|
package/src/bcs/index.ts
CHANGED
|
@@ -57,7 +57,7 @@ export {
|
|
|
57
57
|
compareBcsBytes,
|
|
58
58
|
} from '@haneullabs/bcs';
|
|
59
59
|
|
|
60
|
-
const
|
|
60
|
+
const haneulBcs = {
|
|
61
61
|
...bcs,
|
|
62
62
|
U8: bcs.u8(),
|
|
63
63
|
U16: bcs.u16(),
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
type PureTypeName,
|
|
115
115
|
} from './pure.js';
|
|
116
116
|
|
|
117
|
-
export {
|
|
117
|
+
export { haneulBcs as bcs };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import {
|
|
5
|
+
normalizeHaneulAddress,
|
|
6
|
+
normalizeHaneulObjectId,
|
|
7
|
+
normalizeStructTag,
|
|
8
|
+
HANEUL_TYPE_ARG,
|
|
9
|
+
} from '../utils/index.js';
|
|
10
|
+
import { createCoinReservationRef } from '../utils/coin-reservation.js';
|
|
7
11
|
import type { ClientWithCoreApi } from './core.js';
|
|
8
|
-
import { ObjectRefSchema } from '../transactions/data/internal.js';
|
|
9
12
|
import type { CallArg, Command } from '../transactions/data/internal.js';
|
|
10
13
|
import type { HaneulClientTypes } from './types.js';
|
|
11
14
|
import { SimulationError } from './errors.js';
|
|
@@ -38,36 +41,89 @@ export async function coreClientResolveTransactionPlugin(
|
|
|
38
41
|
) {
|
|
39
42
|
const client = getClient(options);
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const needsGasPrice = !options.onlyTransactionKind && !transactionData.gasData.price;
|
|
45
|
+
const needsPayment = !options.onlyTransactionKind && !transactionData.gasData.payment;
|
|
46
|
+
const gasPayer = transactionData.gasData.owner ?? transactionData.sender;
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
let usesGasCoin = false;
|
|
49
|
+
let withdrawals = 0n;
|
|
50
|
+
|
|
51
|
+
transactionData.mapArguments((arg) => {
|
|
52
|
+
if (arg.$kind === 'GasCoin') usesGasCoin = true;
|
|
53
|
+
return arg;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const normalizedGasPayer = gasPayer ? normalizeHaneulAddress(gasPayer) : null;
|
|
57
|
+
for (const input of transactionData.inputs) {
|
|
58
|
+
if (input.$kind !== 'FundsWithdrawal' || !normalizedGasPayer) continue;
|
|
59
|
+
if (normalizeStructTag(input.FundsWithdrawal.typeArg.Balance) !== HANEUL_TYPE_ARG) continue;
|
|
60
|
+
|
|
61
|
+
const withdrawalOwner = input.FundsWithdrawal.withdrawFrom.Sender
|
|
62
|
+
? transactionData.sender
|
|
63
|
+
: gasPayer;
|
|
64
|
+
if (
|
|
65
|
+
withdrawalOwner &&
|
|
66
|
+
normalizeHaneulAddress(withdrawalOwner) === normalizedGasPayer &&
|
|
67
|
+
input.FundsWithdrawal.reservation.$kind === 'MaxAmountU64'
|
|
68
|
+
) {
|
|
69
|
+
withdrawals += BigInt(input.FundsWithdrawal.reservation.MaxAmountU64);
|
|
70
|
+
}
|
|
46
71
|
}
|
|
47
72
|
|
|
48
|
-
|
|
49
|
-
|
|
73
|
+
const needsSystemState = needsGasPrice || (needsPayment && usesGasCoin);
|
|
74
|
+
const [, systemStateResult, balanceResult, coinsResult, protocolConfigResult, chainIdResult] =
|
|
75
|
+
await Promise.all([
|
|
76
|
+
normalizeInputs(transactionData, client),
|
|
77
|
+
needsSystemState ? client.core.getCurrentSystemState() : null,
|
|
78
|
+
needsPayment && gasPayer ? client.core.getBalance({ owner: gasPayer }) : null,
|
|
79
|
+
needsPayment && gasPayer
|
|
80
|
+
? client.core.listCoins({ owner: gasPayer, coinType: HANEUL_TYPE_ARG })
|
|
81
|
+
: null,
|
|
82
|
+
needsPayment && usesGasCoin ? client.core.getProtocolConfig() : null,
|
|
83
|
+
needsPayment && usesGasCoin ? client.core.getChainIdentifier() : null,
|
|
84
|
+
]);
|
|
50
85
|
|
|
51
|
-
|
|
52
|
-
epoch: string;
|
|
53
|
-
referenceGasPrice: string;
|
|
54
|
-
}
|
|
86
|
+
await resolveObjectReferences(transactionData, client);
|
|
55
87
|
|
|
56
|
-
|
|
57
|
-
|
|
88
|
+
if (!options.onlyTransactionKind) {
|
|
89
|
+
const systemState = systemStateResult?.systemState ?? null;
|
|
58
90
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
91
|
+
if (systemState && !transactionData.gasData.price) {
|
|
92
|
+
transactionData.gasData.price = systemState.referenceGasPrice;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
await setGasBudget(transactionData, client);
|
|
64
96
|
|
|
65
|
-
|
|
66
|
-
|
|
97
|
+
if (needsPayment) {
|
|
98
|
+
if (!balanceResult || !coinsResult) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
'Could not resolve gas payment: a gas owner or sender must be set to fetch balance and coins.',
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
setGasPayment({
|
|
104
|
+
transactionData,
|
|
105
|
+
balance: balanceResult,
|
|
106
|
+
coins: coinsResult,
|
|
107
|
+
usesGasCoin,
|
|
108
|
+
withdrawals,
|
|
109
|
+
protocolConfig: protocolConfigResult?.protocolConfig,
|
|
110
|
+
gasPayer: gasPayer!,
|
|
111
|
+
chainIdentifier: chainIdResult?.chainIdentifier ?? null,
|
|
112
|
+
epoch: systemState?.epoch ?? null,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
67
115
|
|
|
68
|
-
|
|
69
|
-
|
|
116
|
+
if (!transactionData.expiration && transactionData.gasData.payment?.length === 0) {
|
|
117
|
+
await setExpiration(
|
|
118
|
+
transactionData,
|
|
119
|
+
client,
|
|
120
|
+
systemState,
|
|
121
|
+
chainIdResult?.chainIdentifier ?? null,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
70
124
|
}
|
|
125
|
+
|
|
126
|
+
return await next();
|
|
71
127
|
}
|
|
72
128
|
|
|
73
129
|
async function setGasBudget(transactionData: TransactionDataBuilder, client: ClientWithCoreApi) {
|
|
@@ -109,95 +165,89 @@ async function setGasBudget(transactionData: TransactionDataBuilder, client: Cli
|
|
|
109
165
|
);
|
|
110
166
|
}
|
|
111
167
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
168
|
+
function setGasPayment({
|
|
169
|
+
transactionData,
|
|
170
|
+
balance,
|
|
171
|
+
coins,
|
|
172
|
+
usesGasCoin,
|
|
173
|
+
withdrawals,
|
|
174
|
+
protocolConfig,
|
|
175
|
+
gasPayer,
|
|
176
|
+
chainIdentifier,
|
|
177
|
+
epoch,
|
|
178
|
+
}: {
|
|
179
|
+
transactionData: TransactionDataBuilder;
|
|
180
|
+
balance: HaneulClientTypes.GetBalanceResponse;
|
|
181
|
+
coins: HaneulClientTypes.ListCoinsResponse;
|
|
182
|
+
usesGasCoin: boolean;
|
|
183
|
+
withdrawals: bigint;
|
|
184
|
+
protocolConfig: HaneulClientTypes.ProtocolConfig | undefined;
|
|
185
|
+
gasPayer: string;
|
|
186
|
+
chainIdentifier: string | null;
|
|
187
|
+
epoch: string | null;
|
|
188
|
+
}) {
|
|
189
|
+
const budget = BigInt(transactionData.gasData.budget!);
|
|
190
|
+
const addressBalance = BigInt(balance.balance.addressBalance);
|
|
191
|
+
|
|
192
|
+
if (budget === 0n || (!usesGasCoin && addressBalance >= budget + withdrawals)) {
|
|
193
|
+
transactionData.gasData.payment = [];
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const filteredCoins = coins.objects.filter((coin) => {
|
|
198
|
+
const matchingInput = transactionData.inputs.find((input) => {
|
|
199
|
+
if (input.Object?.ImmOrOwnedObject) {
|
|
200
|
+
return coin.objectId === input.Object.ImmOrOwnedObject.objectId;
|
|
136
201
|
}
|
|
137
202
|
|
|
138
|
-
return
|
|
203
|
+
return false;
|
|
139
204
|
});
|
|
140
205
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
? null
|
|
144
|
-
: client.core.getBalance({
|
|
145
|
-
owner: transactionData.gasData.owner,
|
|
146
|
-
}),
|
|
147
|
-
client.core.listCoins({
|
|
148
|
-
owner: transactionData.gasData.owner || transactionData.sender!,
|
|
149
|
-
coinType: HANEUL_TYPE_ARG,
|
|
150
|
-
}),
|
|
151
|
-
]);
|
|
152
|
-
|
|
153
|
-
if (
|
|
154
|
-
suiBalance?.balance.addressBalance &&
|
|
155
|
-
BigInt(suiBalance.balance.addressBalance) >=
|
|
156
|
-
BigInt(transactionData.gasData.budget || '0') + withdrawals
|
|
157
|
-
) {
|
|
158
|
-
transactionData.gasData.payment = [];
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const paymentCoins = coins.objects
|
|
163
|
-
// Filter out coins that are also used as input:
|
|
164
|
-
.filter((coin) => {
|
|
165
|
-
const matchingInput = transactionData.inputs.find((input) => {
|
|
166
|
-
if (input.Object?.ImmOrOwnedObject) {
|
|
167
|
-
return coin.objectId === input.Object.ImmOrOwnedObject.objectId;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return false;
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
return !matchingInput;
|
|
174
|
-
})
|
|
175
|
-
.map((coin) =>
|
|
176
|
-
parse(ObjectRefSchema, {
|
|
177
|
-
objectId: coin.objectId,
|
|
178
|
-
digest: coin.digest,
|
|
179
|
-
version: coin.version,
|
|
180
|
-
}),
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
if (!paymentCoins.length) {
|
|
184
|
-
throw new Error('No valid gas coins found for the transaction.');
|
|
185
|
-
}
|
|
206
|
+
return !matchingInput;
|
|
207
|
+
});
|
|
186
208
|
|
|
209
|
+
const paymentCoins = filteredCoins.map((coin) => ({
|
|
210
|
+
objectId: coin.objectId,
|
|
211
|
+
digest: coin.digest,
|
|
212
|
+
version: coin.version,
|
|
213
|
+
}));
|
|
214
|
+
|
|
215
|
+
const reservationAmount = addressBalance - withdrawals;
|
|
216
|
+
|
|
217
|
+
if (
|
|
218
|
+
usesGasCoin &&
|
|
219
|
+
reservationAmount > 0n &&
|
|
220
|
+
protocolConfig?.featureFlags?.['enable_coin_reservation_obj_refs'] &&
|
|
221
|
+
chainIdentifier &&
|
|
222
|
+
epoch
|
|
223
|
+
) {
|
|
224
|
+
transactionData.gasData.payment = [
|
|
225
|
+
createCoinReservationRef(reservationAmount, gasPayer, chainIdentifier, epoch),
|
|
226
|
+
...paymentCoins,
|
|
227
|
+
];
|
|
228
|
+
} else if (!filteredCoins.length) {
|
|
229
|
+
throw new Error('No valid gas coins found for the transaction.');
|
|
230
|
+
} else {
|
|
187
231
|
transactionData.gasData.payment = paymentCoins;
|
|
188
232
|
}
|
|
189
233
|
}
|
|
190
234
|
|
|
235
|
+
interface SystemStateData {
|
|
236
|
+
epoch: string;
|
|
237
|
+
referenceGasPrice: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
191
240
|
async function setExpiration(
|
|
192
241
|
transactionData: TransactionDataBuilder,
|
|
193
242
|
client: ClientWithCoreApi,
|
|
194
|
-
|
|
243
|
+
systemState: SystemStateData | null,
|
|
244
|
+
existingChainIdentifier: string | null = null,
|
|
195
245
|
) {
|
|
196
|
-
const [
|
|
197
|
-
|
|
198
|
-
client.core.
|
|
246
|
+
const [chainIdentifier, resolvedSystemState] = await Promise.all([
|
|
247
|
+
existingChainIdentifier ?? client.core.getChainIdentifier().then((r) => r.chainIdentifier),
|
|
248
|
+
systemState ?? client.core.getCurrentSystemState().then((r) => r.systemState),
|
|
199
249
|
]);
|
|
200
|
-
const currentEpoch = BigInt(
|
|
250
|
+
const currentEpoch = BigInt(resolvedSystemState.epoch);
|
|
201
251
|
|
|
202
252
|
transactionData.expiration = {
|
|
203
253
|
$kind: 'ValidDuring',
|
package/src/client/core.ts
CHANGED
|
@@ -39,11 +39,11 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
abstract getObjects<Include extends HaneulClientTypes.ObjectInclude =
|
|
42
|
+
abstract getObjects<Include extends HaneulClientTypes.ObjectInclude = {}>(
|
|
43
43
|
options: HaneulClientTypes.GetObjectsOptions<Include>,
|
|
44
44
|
): Promise<HaneulClientTypes.GetObjectsResponse<Include>>;
|
|
45
45
|
|
|
46
|
-
async getObject<Include extends HaneulClientTypes.ObjectInclude =
|
|
46
|
+
async getObject<Include extends HaneulClientTypes.ObjectInclude = {}>(
|
|
47
47
|
options: HaneulClientTypes.GetObjectOptions<Include>,
|
|
48
48
|
): Promise<HaneulClientTypes.GetObjectResponse<Include>> {
|
|
49
49
|
const { objectId } = options;
|
|
@@ -64,7 +64,7 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
64
64
|
options: HaneulClientTypes.ListCoinsOptions,
|
|
65
65
|
): Promise<HaneulClientTypes.ListCoinsResponse>;
|
|
66
66
|
|
|
67
|
-
abstract listOwnedObjects<Include extends HaneulClientTypes.ObjectInclude =
|
|
67
|
+
abstract listOwnedObjects<Include extends HaneulClientTypes.ObjectInclude = {}>(
|
|
68
68
|
options: HaneulClientTypes.ListOwnedObjectsOptions<Include>,
|
|
69
69
|
): Promise<HaneulClientTypes.ListOwnedObjectsResponse<Include>>;
|
|
70
70
|
|
|
@@ -80,15 +80,15 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
80
80
|
options: HaneulClientTypes.GetCoinMetadataOptions,
|
|
81
81
|
): Promise<HaneulClientTypes.GetCoinMetadataResponse>;
|
|
82
82
|
|
|
83
|
-
abstract getTransaction<Include extends HaneulClientTypes.TransactionInclude =
|
|
83
|
+
abstract getTransaction<Include extends HaneulClientTypes.TransactionInclude = {}>(
|
|
84
84
|
options: HaneulClientTypes.GetTransactionOptions<Include>,
|
|
85
85
|
): Promise<HaneulClientTypes.TransactionResult<Include>>;
|
|
86
86
|
|
|
87
|
-
abstract executeTransaction<Include extends HaneulClientTypes.TransactionInclude =
|
|
87
|
+
abstract executeTransaction<Include extends HaneulClientTypes.TransactionInclude = {}>(
|
|
88
88
|
options: HaneulClientTypes.ExecuteTransactionOptions<Include>,
|
|
89
89
|
): Promise<HaneulClientTypes.TransactionResult<Include>>;
|
|
90
90
|
|
|
91
|
-
abstract simulateTransaction<Include extends HaneulClientTypes.SimulateTransactionInclude =
|
|
91
|
+
abstract simulateTransaction<Include extends HaneulClientTypes.SimulateTransactionInclude = {}>(
|
|
92
92
|
options: HaneulClientTypes.SimulateTransactionOptions<Include>,
|
|
93
93
|
): Promise<HaneulClientTypes.SimulateTransactionResult<Include>>;
|
|
94
94
|
|
|
@@ -100,6 +100,10 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
100
100
|
options?: HaneulClientTypes.GetCurrentSystemStateOptions,
|
|
101
101
|
): Promise<HaneulClientTypes.GetCurrentSystemStateResponse>;
|
|
102
102
|
|
|
103
|
+
abstract getProtocolConfig(
|
|
104
|
+
options?: HaneulClientTypes.GetProtocolConfigOptions,
|
|
105
|
+
): Promise<HaneulClientTypes.GetProtocolConfigResponse>;
|
|
106
|
+
|
|
103
107
|
abstract getChainIdentifier(
|
|
104
108
|
options?: HaneulClientTypes.GetChainIdentifierOptions,
|
|
105
109
|
): Promise<HaneulClientTypes.GetChainIdentifierResponse>;
|
|
@@ -151,8 +155,22 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
151
155
|
const fieldType = parseStructTag(fieldObject.type);
|
|
152
156
|
const content = await fieldObject.content;
|
|
153
157
|
|
|
158
|
+
const nameTypeParam = fieldType.typeParams[0];
|
|
159
|
+
const isDynamicObject =
|
|
160
|
+
typeof nameTypeParam !== 'string' &&
|
|
161
|
+
nameTypeParam.module === 'dynamic_object_field' &&
|
|
162
|
+
nameTypeParam.name === 'Wrapper';
|
|
163
|
+
|
|
164
|
+
const valueBcs = content.slice(HANEUL_ADDRESS_LENGTH + options.name.bcs.length);
|
|
165
|
+
|
|
166
|
+
const valueType =
|
|
167
|
+
typeof fieldType.typeParams[1] === 'string'
|
|
168
|
+
? fieldType.typeParams[1]
|
|
169
|
+
: normalizeStructTag(fieldType.typeParams[1]);
|
|
170
|
+
|
|
154
171
|
return {
|
|
155
172
|
dynamicField: {
|
|
173
|
+
$kind: isDynamicObject ? 'DynamicObject' : 'DynamicField',
|
|
156
174
|
fieldId: fieldObject.objectId,
|
|
157
175
|
digest: fieldObject.digest,
|
|
158
176
|
version: fieldObject.version,
|
|
@@ -160,23 +178,19 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
160
178
|
previousTransaction: fieldObject.previousTransaction,
|
|
161
179
|
name: {
|
|
162
180
|
type:
|
|
163
|
-
typeof
|
|
164
|
-
? fieldType.typeParams[0]
|
|
165
|
-
: normalizeStructTag(fieldType.typeParams[0]),
|
|
181
|
+
typeof nameTypeParam === 'string' ? nameTypeParam : normalizeStructTag(nameTypeParam),
|
|
166
182
|
bcs: options.name.bcs,
|
|
167
183
|
},
|
|
168
184
|
value: {
|
|
169
|
-
type:
|
|
170
|
-
|
|
171
|
-
? fieldType.typeParams[1]
|
|
172
|
-
: normalizeStructTag(fieldType.typeParams[1]),
|
|
173
|
-
bcs: content.slice(HANEUL_ADDRESS_LENGTH + options.name.bcs.length),
|
|
185
|
+
type: valueType,
|
|
186
|
+
bcs: valueBcs,
|
|
174
187
|
},
|
|
175
|
-
|
|
188
|
+
childId: isDynamicObject ? bcs.Address.parse(valueBcs) : undefined,
|
|
189
|
+
} as HaneulClientTypes.GetDynamicFieldResponse['dynamicField'],
|
|
176
190
|
};
|
|
177
191
|
}
|
|
178
192
|
|
|
179
|
-
async getDynamicObjectField<Include extends HaneulClientTypes.ObjectInclude =
|
|
193
|
+
async getDynamicObjectField<Include extends HaneulClientTypes.ObjectInclude = {}>(
|
|
180
194
|
options: HaneulClientTypes.GetDynamicObjectFieldOptions<Include>,
|
|
181
195
|
): Promise<HaneulClientTypes.GetDynamicObjectFieldResponse<Include>> {
|
|
182
196
|
const resolvedNameType = (
|
|
@@ -196,7 +210,7 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
196
210
|
});
|
|
197
211
|
|
|
198
212
|
const { object } = await this.getObject({
|
|
199
|
-
objectId:
|
|
213
|
+
objectId: dynamicField.childId!,
|
|
200
214
|
signal: options.signal,
|
|
201
215
|
include: options.include,
|
|
202
216
|
});
|
|
@@ -204,10 +218,10 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
204
218
|
return { object };
|
|
205
219
|
}
|
|
206
220
|
|
|
207
|
-
async waitForTransaction<Include extends HaneulClientTypes.TransactionInclude =
|
|
221
|
+
async waitForTransaction<Include extends HaneulClientTypes.TransactionInclude = {}>(
|
|
208
222
|
options: HaneulClientTypes.WaitForTransactionOptions<Include>,
|
|
209
223
|
): Promise<HaneulClientTypes.TransactionResult<Include>> {
|
|
210
|
-
const { signal, timeout = 60 * 1000, include } = options;
|
|
224
|
+
const { signal, timeout = 60 * 1000, pollSchedule, include } = options;
|
|
211
225
|
|
|
212
226
|
const digest =
|
|
213
227
|
'result' in options && options.result
|
|
@@ -226,7 +240,35 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
226
240
|
// Swallow unhandled rejections that might be thrown after early return
|
|
227
241
|
});
|
|
228
242
|
|
|
243
|
+
// Default schedule tuned to testnet measurements:
|
|
244
|
+
// - Fullnode (gRPC/JSON-RPC): p50=130ms, p95=330ms
|
|
245
|
+
// - GraphQL indexer: p50=1300ms, p95=1430ms
|
|
246
|
+
// After schedule exhausted, repeats the last interval.
|
|
247
|
+
const schedule = pollSchedule ?? [0, 300, 600, 1500, 3500];
|
|
248
|
+
const t0 = Date.now();
|
|
249
|
+
let scheduleIndex = 0;
|
|
250
|
+
const lastInterval =
|
|
251
|
+
schedule.length > 0
|
|
252
|
+
? schedule[schedule.length - 1] - (schedule[schedule.length - 2] ?? 0)
|
|
253
|
+
: 2_000;
|
|
254
|
+
|
|
229
255
|
while (true) {
|
|
256
|
+
if (scheduleIndex < schedule.length) {
|
|
257
|
+
const remaining = t0 + schedule[scheduleIndex] - Date.now();
|
|
258
|
+
scheduleIndex++;
|
|
259
|
+
if (remaining > 0) {
|
|
260
|
+
await Promise.race([
|
|
261
|
+
new Promise((resolve) => setTimeout(resolve, remaining)),
|
|
262
|
+
abortPromise,
|
|
263
|
+
]);
|
|
264
|
+
}
|
|
265
|
+
} else {
|
|
266
|
+
await Promise.race([
|
|
267
|
+
new Promise((resolve) => setTimeout(resolve, lastInterval)),
|
|
268
|
+
abortPromise,
|
|
269
|
+
]);
|
|
270
|
+
}
|
|
271
|
+
|
|
230
272
|
abortSignal.throwIfAborted();
|
|
231
273
|
try {
|
|
232
274
|
return await this.getTransaction({
|
|
@@ -234,9 +276,7 @@ export abstract class CoreClient extends BaseClient implements HaneulClientTypes
|
|
|
234
276
|
include,
|
|
235
277
|
signal: abortSignal,
|
|
236
278
|
});
|
|
237
|
-
} catch {
|
|
238
|
-
await Promise.race([new Promise((resolve) => setTimeout(resolve, 2_000)), abortPromise]);
|
|
239
|
-
}
|
|
279
|
+
} catch {}
|
|
240
280
|
}
|
|
241
281
|
}
|
|
242
282
|
|