@haneullabs/haneul 2.5.2 → 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 +1 -2
- package/dist/cryptography/publickey.d.mts.map +1 -1
- package/dist/cryptography/publickey.mjs +7 -7
- 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 +0 -1
- 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 +7 -7
- 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 +26 -0
- 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.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/verify.d.mts.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/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 +5 -5
- 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/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/version.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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import type { InferInput } from 'valibot';
|
|
5
|
-
import { bigint, object, parse, string } from 'valibot';
|
|
5
|
+
import { bigint, object, optional, parse, picklist, string } from 'valibot';
|
|
6
6
|
|
|
7
7
|
import { bcs } from '../../bcs/index.js';
|
|
8
8
|
import { normalizeStructTag } from '../../utils/haneul-types.js';
|
|
@@ -15,10 +15,10 @@ import type { TransactionDataBuilder } from '../TransactionData.js';
|
|
|
15
15
|
import type { ClientWithCoreApi, HaneulClientTypes } from '../../client/index.js';
|
|
16
16
|
|
|
17
17
|
export const COIN_WITH_BALANCE = 'CoinWithBalance';
|
|
18
|
-
const
|
|
18
|
+
const HANEUL_TYPE = normalizeStructTag('0x2::haneul::HANEUL');
|
|
19
19
|
|
|
20
20
|
export function coinWithBalance({
|
|
21
|
-
type =
|
|
21
|
+
type = HANEUL_TYPE,
|
|
22
22
|
balance,
|
|
23
23
|
useGasCoin = true,
|
|
24
24
|
}: {
|
|
@@ -41,8 +41,9 @@ export function coinWithBalance({
|
|
|
41
41
|
name: COIN_WITH_BALANCE,
|
|
42
42
|
inputs: {},
|
|
43
43
|
data: {
|
|
44
|
-
type: coinType ===
|
|
44
|
+
type: coinType === HANEUL_TYPE && useGasCoin ? 'gas' : coinType,
|
|
45
45
|
balance: BigInt(balance),
|
|
46
|
+
outputKind: 'coin',
|
|
46
47
|
} satisfies InferInput<typeof CoinWithBalanceData>,
|
|
47
48
|
}),
|
|
48
49
|
);
|
|
@@ -51,9 +52,45 @@ export function coinWithBalance({
|
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
export function createBalance({
|
|
56
|
+
type = HANEUL_TYPE,
|
|
57
|
+
balance,
|
|
58
|
+
useGasCoin = true,
|
|
59
|
+
}: {
|
|
60
|
+
balance: bigint | number;
|
|
61
|
+
type?: string;
|
|
62
|
+
useGasCoin?: boolean;
|
|
63
|
+
}): (tx: Transaction) => TransactionResult {
|
|
64
|
+
let balanceResult: TransactionResult | null = null;
|
|
65
|
+
|
|
66
|
+
return (tx: Transaction) => {
|
|
67
|
+
if (balanceResult) {
|
|
68
|
+
return balanceResult;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
tx.addIntentResolver(COIN_WITH_BALANCE, resolveCoinBalance);
|
|
72
|
+
const coinType = type === 'gas' ? type : normalizeStructTag(type);
|
|
73
|
+
|
|
74
|
+
balanceResult = tx.add(
|
|
75
|
+
TransactionCommands.Intent({
|
|
76
|
+
name: COIN_WITH_BALANCE,
|
|
77
|
+
inputs: {},
|
|
78
|
+
data: {
|
|
79
|
+
type: coinType === HANEUL_TYPE && useGasCoin ? 'gas' : coinType,
|
|
80
|
+
balance: BigInt(balance),
|
|
81
|
+
outputKind: 'balance',
|
|
82
|
+
} satisfies InferInput<typeof CoinWithBalanceData>,
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return balanceResult;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
54
90
|
const CoinWithBalanceData = object({
|
|
55
91
|
type: string(),
|
|
56
92
|
balance: bigint(),
|
|
93
|
+
outputKind: optional(picklist(['coin', 'balance'])),
|
|
57
94
|
});
|
|
58
95
|
|
|
59
96
|
export async function resolveCoinBalance(
|
|
@@ -61,24 +98,48 @@ export async function resolveCoinBalance(
|
|
|
61
98
|
buildOptions: BuildTransactionOptions,
|
|
62
99
|
next: () => Promise<void>,
|
|
63
100
|
) {
|
|
101
|
+
type IntentInfo = { balance: bigint; outputKind: 'coin' | 'balance' };
|
|
102
|
+
|
|
64
103
|
const coinTypes = new Set<string>();
|
|
65
104
|
const totalByType = new Map<string, bigint>();
|
|
105
|
+
const intentsByType = new Map<string, IntentInfo[]>();
|
|
66
106
|
|
|
67
107
|
if (!transactionData.sender) {
|
|
68
108
|
throw new Error('Sender must be set to resolve CoinWithBalance');
|
|
69
109
|
}
|
|
70
110
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
111
|
+
// First pass: scan intents, collect per-type data, and resolve zero-balance intents in place.
|
|
112
|
+
for (const [i, command] of transactionData.commands.entries()) {
|
|
113
|
+
if (command.$kind !== '$Intent' || command.$Intent.name !== COIN_WITH_BALANCE) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
74
116
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
117
|
+
const { type, balance, outputKind } = parse(CoinWithBalanceData, command.$Intent.data);
|
|
118
|
+
|
|
119
|
+
// Zero-balance intents are resolved immediately — no coins or AB needed.
|
|
120
|
+
// This is a 1:1 replacement so indices don't shift.
|
|
121
|
+
if (balance === 0n) {
|
|
122
|
+
const coinType = type === 'gas' ? HANEUL_TYPE : type;
|
|
123
|
+
transactionData.replaceCommand(
|
|
124
|
+
i,
|
|
125
|
+
TransactionCommands.MoveCall({
|
|
126
|
+
target: (outputKind ?? 'coin') === 'balance' ? '0x2::balance::zero' : '0x2::coin::zero',
|
|
127
|
+
typeArguments: [coinType],
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
78
132
|
|
|
79
|
-
|
|
133
|
+
if (type !== 'gas') {
|
|
134
|
+
coinTypes.add(type);
|
|
80
135
|
}
|
|
136
|
+
|
|
137
|
+
totalByType.set(type, (totalByType.get(type) ?? 0n) + balance);
|
|
138
|
+
|
|
139
|
+
if (!intentsByType.has(type)) intentsByType.set(type, []);
|
|
140
|
+
intentsByType.get(type)!.push({ balance, outputKind: outputKind ?? 'coin' });
|
|
81
141
|
}
|
|
142
|
+
|
|
82
143
|
const usedIds = new Set<string>();
|
|
83
144
|
|
|
84
145
|
for (const input of transactionData.inputs) {
|
|
@@ -117,7 +178,7 @@ export async function resolveCoinBalance(
|
|
|
117
178
|
? await client.core
|
|
118
179
|
.getBalance({
|
|
119
180
|
owner: transactionData.sender!,
|
|
120
|
-
coinType:
|
|
181
|
+
coinType: HANEUL_TYPE,
|
|
121
182
|
})
|
|
122
183
|
.then(({ balance }) => {
|
|
123
184
|
addressBalanceByType.set('gas', BigInt(balance.addressBalance));
|
|
@@ -126,9 +187,17 @@ export async function resolveCoinBalance(
|
|
|
126
187
|
]);
|
|
127
188
|
|
|
128
189
|
const mergedCoins = new Map<string, Argument>();
|
|
190
|
+
const exactBalanceByType = new Map<string, boolean>();
|
|
191
|
+
|
|
192
|
+
// Per-type state for Path 2 combined splits
|
|
193
|
+
type TypeState = { results: Argument[]; nextIntent: number };
|
|
194
|
+
const typeState = new Map<string, TypeState>();
|
|
129
195
|
|
|
130
|
-
|
|
196
|
+
let index = 0;
|
|
197
|
+
while (index < transactionData.commands.length) {
|
|
198
|
+
const transaction = transactionData.commands[index];
|
|
131
199
|
if (transaction.$kind !== '$Intent' || transaction.$Intent.name !== COIN_WITH_BALANCE) {
|
|
200
|
+
index++;
|
|
132
201
|
continue;
|
|
133
202
|
}
|
|
134
203
|
|
|
@@ -136,25 +205,23 @@ export async function resolveCoinBalance(
|
|
|
136
205
|
type: string;
|
|
137
206
|
balance: bigint;
|
|
138
207
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
index,
|
|
143
|
-
TransactionCommands.MoveCall({
|
|
144
|
-
target: '0x2::coin::zero',
|
|
145
|
-
typeArguments: [type === 'gas' ? SUI_TYPE : type],
|
|
146
|
-
}),
|
|
147
|
-
);
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
208
|
+
const coinType = type === 'gas' ? HANEUL_TYPE : type;
|
|
209
|
+
const totalRequired = totalByType.get(type)!;
|
|
210
|
+
const addressBalance = addressBalanceByType.get(type) ?? 0n;
|
|
150
211
|
|
|
151
212
|
const commands = [];
|
|
213
|
+
let intentResult: Argument;
|
|
214
|
+
|
|
215
|
+
const intentsForType = intentsByType.get(type) ?? [];
|
|
216
|
+
const allBalance = intentsForType.every((i) => i.outputKind === 'balance');
|
|
152
217
|
|
|
153
|
-
if (
|
|
218
|
+
if (allBalance && addressBalance >= totalRequired) {
|
|
219
|
+
// Path 1: All balance intents and AB sufficient — direct per-intent withdrawal.
|
|
220
|
+
// No coins touched, enables parallel execution.
|
|
154
221
|
commands.push(
|
|
155
222
|
TransactionCommands.MoveCall({
|
|
156
|
-
target: '0x2::
|
|
157
|
-
typeArguments: [
|
|
223
|
+
target: '0x2::balance::redeem_funds',
|
|
224
|
+
typeArguments: [coinType],
|
|
158
225
|
arguments: [
|
|
159
226
|
transactionData.addInput(
|
|
160
227
|
'withdrawal',
|
|
@@ -163,106 +230,170 @@ export async function resolveCoinBalance(
|
|
|
163
230
|
$kind: 'MaxAmountU64',
|
|
164
231
|
MaxAmountU64: String(balance),
|
|
165
232
|
},
|
|
166
|
-
typeArg: {
|
|
167
|
-
|
|
168
|
-
Balance: type === 'gas' ? SUI_TYPE : type,
|
|
169
|
-
},
|
|
170
|
-
withdrawFrom: {
|
|
171
|
-
$kind: 'Sender',
|
|
172
|
-
Sender: true,
|
|
173
|
-
},
|
|
233
|
+
typeArg: { $kind: 'Balance', Balance: coinType },
|
|
234
|
+
withdrawFrom: { $kind: 'Sender', Sender: true },
|
|
174
235
|
}),
|
|
175
236
|
),
|
|
176
237
|
],
|
|
177
238
|
}),
|
|
178
239
|
);
|
|
240
|
+
|
|
241
|
+
intentResult = {
|
|
242
|
+
$kind: 'NestedResult',
|
|
243
|
+
NestedResult: [index + commands.length - 1, 0],
|
|
244
|
+
};
|
|
179
245
|
} else {
|
|
180
|
-
|
|
181
|
-
const addressBalance = addressBalanceByType.get(type) ?? 0n;
|
|
182
|
-
const coinType = type === 'gas' ? SUI_TYPE : type;
|
|
246
|
+
// Path 2: Merge and Split — build a merged coin, split all intents at once.
|
|
183
247
|
|
|
184
|
-
|
|
185
|
-
|
|
248
|
+
if (!typeState.has(type)) {
|
|
249
|
+
const intents = intentsForType;
|
|
250
|
+
|
|
251
|
+
// Step 1: Build sources and merge
|
|
252
|
+
const sources: Argument[] = [];
|
|
186
253
|
|
|
187
254
|
if (type === 'gas') {
|
|
188
|
-
|
|
189
|
-
restCoins = [];
|
|
255
|
+
sources.push({ $kind: 'GasCoin', GasCoin: true });
|
|
190
256
|
} else {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
257
|
+
const coins = coinsByType.get(type)!;
|
|
258
|
+
const loadedCoinBalance = coins.reduce((sum, c) => sum + BigInt(c.balance), 0n);
|
|
259
|
+
const abNeeded =
|
|
260
|
+
totalRequired > loadedCoinBalance ? totalRequired - loadedCoinBalance : 0n;
|
|
261
|
+
|
|
262
|
+
exactBalanceByType.set(type, loadedCoinBalance + abNeeded === totalRequired);
|
|
263
|
+
|
|
264
|
+
for (const coin of coins) {
|
|
265
|
+
sources.push(
|
|
266
|
+
transactionData.addInput(
|
|
267
|
+
'object',
|
|
268
|
+
Inputs.ObjectRef({
|
|
269
|
+
objectId: coin.objectId,
|
|
270
|
+
digest: coin.digest,
|
|
271
|
+
version: coin.version,
|
|
272
|
+
}),
|
|
273
|
+
),
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (abNeeded > 0n) {
|
|
278
|
+
commands.push(
|
|
279
|
+
TransactionCommands.MoveCall({
|
|
280
|
+
target: '0x2::coin::redeem_funds',
|
|
281
|
+
typeArguments: [coinType],
|
|
282
|
+
arguments: [
|
|
283
|
+
transactionData.addInput(
|
|
284
|
+
'withdrawal',
|
|
285
|
+
Inputs.FundsWithdrawal({
|
|
286
|
+
reservation: {
|
|
287
|
+
$kind: 'MaxAmountU64',
|
|
288
|
+
MaxAmountU64: String(abNeeded),
|
|
289
|
+
},
|
|
290
|
+
typeArg: { $kind: 'Balance', Balance: coinType },
|
|
291
|
+
withdrawFrom: { $kind: 'Sender', Sender: true },
|
|
292
|
+
}),
|
|
293
|
+
),
|
|
294
|
+
],
|
|
198
295
|
}),
|
|
199
|
-
)
|
|
200
|
-
|
|
296
|
+
);
|
|
297
|
+
sources.push({ $kind: 'Result', Result: index + commands.length - 1 });
|
|
298
|
+
}
|
|
201
299
|
}
|
|
202
300
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
typeArguments: [coinType],
|
|
208
|
-
arguments: [
|
|
209
|
-
transactionData.addInput(
|
|
210
|
-
'withdrawal',
|
|
211
|
-
Inputs.FundsWithdrawal({
|
|
212
|
-
reservation: {
|
|
213
|
-
$kind: 'MaxAmountU64',
|
|
214
|
-
MaxAmountU64: String(addressBalance),
|
|
215
|
-
},
|
|
216
|
-
typeArg: {
|
|
217
|
-
$kind: 'Balance',
|
|
218
|
-
Balance: coinType,
|
|
219
|
-
},
|
|
220
|
-
withdrawFrom: {
|
|
221
|
-
$kind: 'Sender',
|
|
222
|
-
Sender: true,
|
|
223
|
-
},
|
|
224
|
-
}),
|
|
225
|
-
),
|
|
226
|
-
],
|
|
227
|
-
}),
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
commands.push(
|
|
231
|
-
TransactionCommands.MergeCoins(baseCoin, [
|
|
232
|
-
{ $kind: 'Result', Result: index + commands.length - 1 },
|
|
233
|
-
...restCoins,
|
|
234
|
-
]),
|
|
235
|
-
);
|
|
236
|
-
} else if (restCoins.length > 0) {
|
|
237
|
-
commands.push(TransactionCommands.MergeCoins(baseCoin, restCoins));
|
|
301
|
+
const baseCoin = sources[0];
|
|
302
|
+
const rest = sources.slice(1);
|
|
303
|
+
for (let i = 0; i < rest.length; i += 500) {
|
|
304
|
+
commands.push(TransactionCommands.MergeCoins(baseCoin, rest.slice(i, i + 500)));
|
|
238
305
|
}
|
|
239
306
|
|
|
240
307
|
mergedCoins.set(type, baseCoin);
|
|
308
|
+
|
|
309
|
+
// Step 2: Combined SplitCoins for all intents of this type
|
|
310
|
+
const splitCmdIndex = index + commands.length;
|
|
311
|
+
commands.push(
|
|
312
|
+
TransactionCommands.SplitCoins(
|
|
313
|
+
baseCoin,
|
|
314
|
+
intents.map((i) =>
|
|
315
|
+
transactionData.addInput('pure', Inputs.Pure(bcs.u64().serialize(i.balance))),
|
|
316
|
+
),
|
|
317
|
+
),
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
// Build per-intent results, adding into_balance conversions for balance intents
|
|
321
|
+
const results: Argument[] = [];
|
|
322
|
+
for (let i = 0; i < intents.length; i++) {
|
|
323
|
+
const splitResult: Argument = {
|
|
324
|
+
$kind: 'NestedResult',
|
|
325
|
+
NestedResult: [splitCmdIndex, i],
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
if (intents[i].outputKind === 'balance') {
|
|
329
|
+
commands.push(
|
|
330
|
+
TransactionCommands.MoveCall({
|
|
331
|
+
target: '0x2::coin::into_balance',
|
|
332
|
+
typeArguments: [coinType],
|
|
333
|
+
arguments: [splitResult],
|
|
334
|
+
}),
|
|
335
|
+
);
|
|
336
|
+
results.push({
|
|
337
|
+
$kind: 'NestedResult',
|
|
338
|
+
NestedResult: [index + commands.length - 1, 0],
|
|
339
|
+
});
|
|
340
|
+
} else {
|
|
341
|
+
results.push(splitResult);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
typeState.set(type, { results, nextIntent: 0 });
|
|
241
346
|
}
|
|
242
347
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
transactionData.addInput('pure', Inputs.Pure(bcs.u64().serialize(balance))),
|
|
246
|
-
]),
|
|
247
|
-
);
|
|
348
|
+
const state = typeState.get(type)!;
|
|
349
|
+
intentResult = state.results[state.nextIntent++];
|
|
248
350
|
}
|
|
249
351
|
|
|
250
|
-
transactionData.replaceCommand(
|
|
352
|
+
transactionData.replaceCommand(
|
|
353
|
+
index,
|
|
354
|
+
commands,
|
|
355
|
+
intentResult as { NestedResult: [number, number] },
|
|
356
|
+
);
|
|
251
357
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
358
|
+
// Advance past the replacement. When commands is empty (subsequent intents
|
|
359
|
+
// of a combined split), the command was removed and the next command shifted
|
|
360
|
+
// into this position — so we stay at the same index.
|
|
361
|
+
index += commands.length;
|
|
362
|
+
}
|
|
256
363
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
NestedResult: [index + commands.length - 1, 0],
|
|
261
|
-
};
|
|
262
|
-
}
|
|
364
|
+
// Step 3: Remainder handling
|
|
365
|
+
for (const [type, mergedCoin] of mergedCoins) {
|
|
366
|
+
if (type === 'gas') continue;
|
|
263
367
|
|
|
264
|
-
|
|
265
|
-
|
|
368
|
+
const hasBalanceIntent = intentsByType.get(type)?.some((i) => i.outputKind === 'balance');
|
|
369
|
+
|
|
370
|
+
if (hasBalanceIntent) {
|
|
371
|
+
// Balance intents exist: send remainder coin back to sender's address balance.
|
|
372
|
+
// coin::send_funds is gasless-eligible and handles zero amounts.
|
|
373
|
+
transactionData.commands.push(
|
|
374
|
+
TransactionCommands.MoveCall({
|
|
375
|
+
target: '0x2::coin::send_funds',
|
|
376
|
+
typeArguments: [type],
|
|
377
|
+
arguments: [
|
|
378
|
+
mergedCoin,
|
|
379
|
+
transactionData.addInput(
|
|
380
|
+
'pure',
|
|
381
|
+
Inputs.Pure(bcs.Address.serialize(transactionData.sender!)),
|
|
382
|
+
),
|
|
383
|
+
],
|
|
384
|
+
}),
|
|
385
|
+
);
|
|
386
|
+
} else if (exactBalanceByType.get(type)) {
|
|
387
|
+
// Coin-only with exact match: destroy the zero-value dust coin.
|
|
388
|
+
transactionData.commands.push(
|
|
389
|
+
TransactionCommands.MoveCall({
|
|
390
|
+
target: '0x2::coin::destroy_zero',
|
|
391
|
+
typeArguments: [type],
|
|
392
|
+
arguments: [mergedCoin],
|
|
393
|
+
}),
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
// Coin-only with surplus: merged coin stays with sender as an owned object
|
|
266
397
|
}
|
|
267
398
|
|
|
268
399
|
return next();
|
|
@@ -324,25 +455,20 @@ async function getCoinsAndBalanceOfType({
|
|
|
324
455
|
|
|
325
456
|
await balanceRequest;
|
|
326
457
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const coinBalance = BigInt(coin.balance);
|
|
334
|
-
|
|
335
|
-
coins.push(coin);
|
|
336
|
-
remainingBalance -= coinBalance;
|
|
337
|
-
|
|
338
|
-
if (remainingBalance <= 0) {
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
458
|
+
// Always load all coins from the page (except already-used ones).
|
|
459
|
+
// This merges all available coins rather than leaving dust.
|
|
460
|
+
for (const coin of objects) {
|
|
461
|
+
if (usedIds.has(coin.objectId)) {
|
|
462
|
+
continue;
|
|
341
463
|
}
|
|
342
464
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
465
|
+
coins.push(coin);
|
|
466
|
+
remainingBalance -= BigInt(coin.balance);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Only paginate if loaded coins + AB are still insufficient
|
|
470
|
+
if (remainingBalance > 0n && hasNextPage) {
|
|
471
|
+
return loadMoreCoins(nextCursor);
|
|
346
472
|
}
|
|
347
473
|
|
|
348
474
|
return coins;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { fromBase58, fromHex, toBase58, toHex } from '@haneullabs/bcs';
|
|
5
|
+
import { parse } from 'valibot';
|
|
6
|
+
|
|
7
|
+
import { bcs, TypeTagSerializer } from '../bcs/index.js';
|
|
8
|
+
import { ObjectRefSchema } from '../transactions/data/internal.js';
|
|
9
|
+
import { deriveDynamicFieldID } from './dynamic-fields.js';
|
|
10
|
+
import { normalizeHaneulAddress } from './index.js';
|
|
11
|
+
|
|
12
|
+
const HANEUL_ACCUMULATOR_ROOT_OBJECT_ID = normalizeHaneulAddress('0xacc');
|
|
13
|
+
const ACCUMULATOR_KEY_TYPE_TAG = TypeTagSerializer.parseFromStr(
|
|
14
|
+
'0x2::accumulator::Key<0x2::balance::Balance<0x2::haneul::HANEUL>>',
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const COIN_RESERVATION_MAGIC = new Uint8Array([
|
|
18
|
+
0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
|
|
19
|
+
0xac, 0xac, 0xac, 0xac,
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export function isCoinReservationDigest(digestBase58: string): boolean {
|
|
23
|
+
const digestBytes = fromBase58(digestBase58);
|
|
24
|
+
const last20Bytes = digestBytes.slice(12, 32);
|
|
25
|
+
return last20Bytes.every((byte, i) => byte === COIN_RESERVATION_MAGIC[i]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function parseCoinReservationBalance(digestBase58: string): bigint {
|
|
29
|
+
const digestBytes = fromBase58(digestBase58);
|
|
30
|
+
const view = new DataView(digestBytes.buffer, digestBytes.byteOffset, digestBytes.byteLength);
|
|
31
|
+
return view.getBigUint64(0, true);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Derives the accumulator dynamic field object ID for the given owner,
|
|
36
|
+
* then XORs it with the chain identifier bytes to produce the objectId
|
|
37
|
+
* for the coin reservation ref.
|
|
38
|
+
*/
|
|
39
|
+
function deriveReservationObjectId(owner: string, chainIdentifier: string): string {
|
|
40
|
+
const keyBcs = bcs.Address.serialize(owner).toBytes();
|
|
41
|
+
const accumulatorId = deriveDynamicFieldID(
|
|
42
|
+
HANEUL_ACCUMULATOR_ROOT_OBJECT_ID,
|
|
43
|
+
ACCUMULATOR_KEY_TYPE_TAG,
|
|
44
|
+
keyBcs,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// XOR the accumulator object ID bytes with the chain identifier bytes
|
|
48
|
+
const accBytes = fromHex(accumulatorId.slice(2));
|
|
49
|
+
const chainBytes = fromBase58(chainIdentifier);
|
|
50
|
+
if (chainBytes.length !== 32) {
|
|
51
|
+
throw new Error(`Invalid chain identifier length: expected 32 bytes, got ${chainBytes.length}`);
|
|
52
|
+
}
|
|
53
|
+
const xored = new Uint8Array(32);
|
|
54
|
+
for (let i = 0; i < 32; i++) {
|
|
55
|
+
xored[i] = accBytes[i] ^ chainBytes[i];
|
|
56
|
+
}
|
|
57
|
+
return `0x${toHex(xored)}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function createCoinReservationRef(
|
|
61
|
+
reservedBalance: bigint,
|
|
62
|
+
owner: string,
|
|
63
|
+
chainIdentifier: string,
|
|
64
|
+
epoch: string,
|
|
65
|
+
) {
|
|
66
|
+
const digestBytes = new Uint8Array(32);
|
|
67
|
+
const view = new DataView(digestBytes.buffer);
|
|
68
|
+
// Bytes 0-7: reserved balance as LE u64
|
|
69
|
+
view.setBigUint64(0, reservedBalance, true);
|
|
70
|
+
// Bytes 8-11: epoch_id as LE u32
|
|
71
|
+
const epochNum = Number(epoch);
|
|
72
|
+
if (!Number.isSafeInteger(epochNum) || epochNum < 0 || epochNum > 0xffffffff) {
|
|
73
|
+
throw new Error(`Epoch ${epoch} out of u32 range for coin reservation digest`);
|
|
74
|
+
}
|
|
75
|
+
view.setUint32(8, epochNum, true);
|
|
76
|
+
// Bytes 12-31: magic bytes
|
|
77
|
+
digestBytes.set(COIN_RESERVATION_MAGIC, 12);
|
|
78
|
+
|
|
79
|
+
return parse(ObjectRefSchema, {
|
|
80
|
+
objectId: deriveReservationObjectId(owner, chainIdentifier),
|
|
81
|
+
version: '0',
|
|
82
|
+
digest: toBase58(digestBytes),
|
|
83
|
+
});
|
|
84
|
+
}
|
package/src/utils/constants.ts
CHANGED
|
@@ -18,5 +18,7 @@ export const HANEUL_SYSTEM_STATE_OBJECT_ID =
|
|
|
18
18
|
'0x0000000000000000000000000000000000000000000000000000000000000005';
|
|
19
19
|
export const HANEUL_RANDOM_OBJECT_ID =
|
|
20
20
|
'0x0000000000000000000000000000000000000000000000000000000000000008';
|
|
21
|
+
export const HANEUL_COIN_REGISTRY_OBJECT_ID =
|
|
22
|
+
'0x000000000000000000000000000000000000000000000000000000000000000c';
|
|
21
23
|
export const HANEUL_DENY_LIST_OBJECT_ID =
|
|
22
24
|
'0x0000000000000000000000000000000000000000000000000000000000000403';
|
|
@@ -19,7 +19,7 @@ export function isValidTransactionDigest(value: string): value is string {
|
|
|
19
19
|
|
|
20
20
|
// TODO - can we automatically sync this with rust length definition?
|
|
21
21
|
// Source of truth is
|
|
22
|
-
// https://github.com/GeunhwaJeong/haneul/blob/acb2b97ae21f47600e05b0d28127d88d0725561d/
|
|
22
|
+
// https://github.com/GeunhwaJeong/haneul/blob/acb2b97ae21f47600e05b0d28127d88d0725561d/crates/haneul-types/src/base_types.rs#L67
|
|
23
23
|
// which uses the Move account address length
|
|
24
24
|
// https://github.com/move-language/move/blob/67ec40dc50c66c34fd73512fcc412f3b68d67235/language/move-core/types/src/account_address.rs#L23 .
|
|
25
25
|
|
|
@@ -97,6 +97,21 @@ export type StructTag = {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
function parseTypeTag(type: string): string | StructTag {
|
|
100
|
+
if (type.startsWith('vector<')) {
|
|
101
|
+
if (!type.endsWith('>')) {
|
|
102
|
+
throw new Error(`Invalid type tag: ${type}`);
|
|
103
|
+
}
|
|
104
|
+
const inner = type.slice(7, -1);
|
|
105
|
+
if (!inner) {
|
|
106
|
+
throw new Error(`Invalid type tag: ${type}`);
|
|
107
|
+
}
|
|
108
|
+
const parsed = parseTypeTag(inner);
|
|
109
|
+
if (typeof parsed === 'string') {
|
|
110
|
+
return `vector<${parsed}>`;
|
|
111
|
+
}
|
|
112
|
+
return `vector<${normalizeStructTag(parsed)}>`;
|
|
113
|
+
}
|
|
114
|
+
|
|
100
115
|
if (!type.includes('::')) return type;
|
|
101
116
|
|
|
102
117
|
return parseStructTag(type);
|
package/src/utils/index.ts
CHANGED
package/src/version.ts
CHANGED
package/src/zklogin/utils.ts
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region src/jsonRpc/rpc-websocket-client.d.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Configuration options for the websocket connection
|
|
5
|
-
*/
|
|
6
|
-
type WebsocketClientOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* Custom WebSocket class to use. Defaults to the global WebSocket class, if available.
|
|
9
|
-
*/
|
|
10
|
-
WebSocketConstructor?: typeof WebSocket;
|
|
11
|
-
/**
|
|
12
|
-
* Milliseconds before timing out while calling an RPC method
|
|
13
|
-
*/
|
|
14
|
-
callTimeout?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Milliseconds between attempts to connect
|
|
17
|
-
*/
|
|
18
|
-
reconnectTimeout?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Maximum number of times to try connecting before giving up
|
|
21
|
-
*/
|
|
22
|
-
maxReconnects?: number;
|
|
23
|
-
};
|
|
24
|
-
//#endregion
|
|
25
|
-
export { WebsocketClientOptions };
|
|
26
|
-
//# sourceMappingURL=rpc-websocket-client.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-websocket-client.d.mts","names":[],"sources":["../../src/jsonRpc/rpc-websocket-client.ts"],"sourcesContent":[],"mappings":";;;;;KA8CY,sBAAA;;;;gCAImB"}
|