@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
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# Building SDKs
|
|
2
|
+
|
|
3
|
+
> Build custom SDKs on top of the Haneul TypeScript SDK
|
|
4
|
+
|
|
5
|
+
This guide covers recommended patterns for building TypeScript SDKs that integrate with the Haneul
|
|
6
|
+
SDK. Following these patterns ensures your SDK integrates seamlessly with the ecosystem, works
|
|
7
|
+
across different transports (JSON-RPC, GraphQL, gRPC), and composes well with other SDKs.
|
|
8
|
+
|
|
9
|
+
**Key requirement:** All SDKs should depend on [`ClientWithCoreApi`](./clients/core), which is the
|
|
10
|
+
transport-agnostic interface implemented by all Haneul clients. This ensures your SDK works with any
|
|
11
|
+
client the user chooses.
|
|
12
|
+
|
|
13
|
+
## Package Setup
|
|
14
|
+
|
|
15
|
+
### Use Haneullabs Packages as Peer Dependencies
|
|
16
|
+
|
|
17
|
+
SDKs should declare all `@haneullabs/*` packages as **peer dependencies** rather than direct
|
|
18
|
+
dependencies. This ensures users get a single shared instance of each package, avoiding version
|
|
19
|
+
conflicts and duplicate code.
|
|
20
|
+
|
|
21
|
+
```json title="package.json"
|
|
22
|
+
{
|
|
23
|
+
"name": "@your-org/your-sdk",
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@haneullabs/haneul": "^2.0.0",
|
|
26
|
+
"@haneullabs/bcs": "^2.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@haneullabs/haneul": "^2.0.0",
|
|
30
|
+
"@haneullabs/bcs": "^2.0.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This approach:
|
|
36
|
+
|
|
37
|
+
- Prevents multiple versions of Haneullabs packages from being bundled
|
|
38
|
+
- Ensures compatibility with user's chosen package versions
|
|
39
|
+
- Reduces bundle size for end users
|
|
40
|
+
- Avoids subtle bugs from mismatched package instances
|
|
41
|
+
- Allows the SDK to work with any compatible client
|
|
42
|
+
|
|
43
|
+
## Client Extensions
|
|
44
|
+
|
|
45
|
+
The recommended way to build SDKs is using the **client extension pattern**. This allows your SDK to
|
|
46
|
+
extend the Haneul client with custom functionality. This makes it easier to use custom SDKs across
|
|
47
|
+
the ecosystem without having to build custom bindings (like react context providers) for each
|
|
48
|
+
individual SDK and client.
|
|
49
|
+
|
|
50
|
+
### Extension Pattern
|
|
51
|
+
|
|
52
|
+
Client extensions use the `$extend` method to add functionality to any Haneul client. Create a
|
|
53
|
+
factory function that returns a `name` and `register` function:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
|
|
57
|
+
name?: Name;
|
|
58
|
+
// Add SDK-specific configuration here
|
|
59
|
+
apiKey?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
name = 'mySDK' as Name,
|
|
63
|
+
...options
|
|
64
|
+
}: MySDKOptions<Name> = {}) {
|
|
65
|
+
return {
|
|
66
|
+
name,
|
|
67
|
+
register: (client: ClientWithCoreApi) => {
|
|
68
|
+
return new MySDKClient({ client, ...options });
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#client: ClientWithCoreApi;
|
|
74
|
+
#apiKey?: string;
|
|
75
|
+
|
|
76
|
+
constructor({ client, apiKey }: { client: ClientWithCoreApi; apiKey?: string }) {
|
|
77
|
+
this.#client = client;
|
|
78
|
+
this.#apiKey = apiKey;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async getResource(id: string) {
|
|
82
|
+
const result = await this.#client.core.getObject({ objectId: id });
|
|
83
|
+
// Process and return result
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Users can then extend their client:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const client = new HaneulGrpcClient({
|
|
93
|
+
network: 'testnet',
|
|
94
|
+
baseUrl: 'https://fullnode.testnet.haneul.io:443',
|
|
95
|
+
}).$extend(mySDK());
|
|
96
|
+
|
|
97
|
+
// Access your extension
|
|
98
|
+
await client.mySDK.getResource('0x...');
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Real-World Examples
|
|
102
|
+
|
|
103
|
+
Several official SDKs use this pattern:
|
|
104
|
+
|
|
105
|
+
- **[@haneullabs/walrus](https://www.npmjs.com/package/@haneullabs/walrus)** - Decentralized storage
|
|
106
|
+
- **[@haneullabs/seal](https://www.npmjs.com/package/@haneullabs/seal)** - Encryption and key
|
|
107
|
+
management
|
|
108
|
+
|
|
109
|
+
## SDK Organization
|
|
110
|
+
|
|
111
|
+
Most Haneullabs SDKs do not strictly follow these patterns yet, but we recommend scoping methods on
|
|
112
|
+
your client extension into the following categories for clarity and consistency:
|
|
113
|
+
|
|
114
|
+
| Property | Purpose | Example |
|
|
115
|
+
| -------- | --------------------------------------------------------- | ----------------------------------- |
|
|
116
|
+
| Methods | Top-level operations (execute actions or read/parse data) | `sdk.readBlob()`, `sdk.getConfig()` |
|
|
117
|
+
| `tx` | Methods that create transactions without executing | `sdk.tx.registerBlob()` |
|
|
118
|
+
| `bcs` | BCS type definitions for encoding/decoding | `sdk.bcs.MyStruct` |
|
|
119
|
+
| `call` | Methods returning Move calls that can be used with tx.add | `sdk.call.myFunction()` |
|
|
120
|
+
| `view` | Methods that use simulate API to read onchain state | `sdk.view.getState()` |
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
|
|
124
|
+
#client: ClientWithCoreApi;
|
|
125
|
+
|
|
126
|
+
constructor({ client }: { client: ClientWithCoreApi }) {
|
|
127
|
+
this.#client = client;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Top-level methods - execute actions or read/parse data
|
|
131
|
+
async executeAction(options: ActionOptions) {
|
|
132
|
+
const transaction = this.tx.createAction(options);
|
|
133
|
+
// Execute and return result
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async getResource(objectId: string) {
|
|
137
|
+
const { object } = await this.#client.core.getObject({
|
|
138
|
+
objectId,
|
|
139
|
+
include: { content: true },
|
|
140
|
+
});
|
|
141
|
+
return myModule.MyStruct.parse(object.content);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Transaction builders
|
|
145
|
+
tx = {
|
|
146
|
+
createAction: (options: ActionOptions) => {
|
|
147
|
+
const transaction = new Transaction();
|
|
148
|
+
transaction.add(this.call.action(options));
|
|
149
|
+
return transaction;
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Move call helpers - use generated functions with typed options
|
|
154
|
+
call = {
|
|
155
|
+
action: (options: ActionOptions) => {
|
|
156
|
+
return myModule.action({
|
|
157
|
+
arguments: {
|
|
158
|
+
obj: options.objectId,
|
|
159
|
+
amount: options.amount,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// View methods - use simulate API to read onchain state
|
|
166
|
+
view = {
|
|
167
|
+
getBalance: async (managerId: string) => {
|
|
168
|
+
const tx = new Transaction();
|
|
169
|
+
tx.add(myModule.getBalance({ arguments: { manager: managerId } }));
|
|
170
|
+
|
|
171
|
+
const res = await this.#client.core.simulateTransaction({
|
|
172
|
+
transaction: tx,
|
|
173
|
+
include: { commandResults: true },
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
return bcs.U64.parse(res.commandResults![0].returnValues[0].bcs);
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Transaction Building Patterns
|
|
183
|
+
|
|
184
|
+
### Transaction Thunks
|
|
185
|
+
|
|
186
|
+
Transaction thunks are functions that accept a `Transaction` and mutate it. This pattern enables
|
|
187
|
+
composition across multiple SDKs in a single transaction.
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
// Synchronous thunk for operations that don't need async work
|
|
191
|
+
function createResource(options: { name: string }) {
|
|
192
|
+
return (tx: Transaction): TransactionObjectArgument => {
|
|
193
|
+
const [resource] = tx.moveCall({
|
|
194
|
+
target: `${PACKAGE_ID}::module::create`,
|
|
195
|
+
arguments: [tx.pure.string(options.name)],
|
|
196
|
+
});
|
|
197
|
+
return resource;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Usage
|
|
202
|
+
const tx = new Transaction();
|
|
203
|
+
const resource = tx.add(createResource({ name: 'my-resource' }));
|
|
204
|
+
tx.transferObjects([resource], recipient);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Async Thunks
|
|
208
|
+
|
|
209
|
+
For operations requiring async work (like fetching package IDs or configuration), return async
|
|
210
|
+
thunks. These are used with `tx.add()` exactly like synchronous thunks - the async resolution
|
|
211
|
+
happens automatically before signing:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
function createResourceAsync(options: { name: string }) {
|
|
215
|
+
return async (tx: Transaction): Promise<TransactionObjectArgument> => {
|
|
216
|
+
// Async work happens here, before the transaction is signed
|
|
217
|
+
const packageId = await getLatestPackageId();
|
|
218
|
+
|
|
219
|
+
const [resource] = tx.moveCall({
|
|
220
|
+
target: `${packageId}::module::create`,
|
|
221
|
+
arguments: [tx.pure.string(options.name)],
|
|
222
|
+
});
|
|
223
|
+
return resource;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Usage is identical to synchronous thunks
|
|
228
|
+
const tx = new Transaction();
|
|
229
|
+
const resource = tx.add(createResourceAsync({ name: 'my-resource' }));
|
|
230
|
+
tx.transferObjects([resource], recipient);
|
|
231
|
+
|
|
232
|
+
// Async work resolves automatically when the transaction is built/signed
|
|
233
|
+
await signer.signAndExecuteTransaction({ transaction: tx, client });
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
This pattern is critical for web wallet compatibility - async work that happens during transaction
|
|
237
|
+
construction won't block the popup triggered by user interaction.
|
|
238
|
+
|
|
239
|
+
## Transaction Execution
|
|
240
|
+
|
|
241
|
+
### Accept a Signer Parameter
|
|
242
|
+
|
|
243
|
+
For methods that execute transactions, accept a `Signer` parameter and always use the signer to
|
|
244
|
+
execute the transaction. This enables:
|
|
245
|
+
|
|
246
|
+
- Wallet integration through dApp Kit
|
|
247
|
+
- Transaction sponsorship
|
|
248
|
+
- Custom signing flows
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
|
|
252
|
+
#client: ClientWithCoreApi;
|
|
253
|
+
|
|
254
|
+
async createAndExecute({ signer, ...options }: CreateOptions & { signer: Signer }) {
|
|
255
|
+
const transaction = this.tx.create(options);
|
|
256
|
+
|
|
257
|
+
// Use signAndExecuteTransaction for maximum flexibility
|
|
258
|
+
const result = await signer.signAndExecuteTransaction({
|
|
259
|
+
transaction,
|
|
260
|
+
client: this.#client,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Using `signAndExecuteTransaction` allows wallets and sponsors to customize execution behavior.
|
|
269
|
+
|
|
270
|
+
## Code Generation
|
|
271
|
+
|
|
272
|
+
For SDKs that interact with Move contracts, use **[@haneullabs/codegen](/codegen)** to generate
|
|
273
|
+
type-safe TypeScript bindings from your Move packages.
|
|
274
|
+
|
|
275
|
+
Benefits include type safety, BCS parsing, IDE support, and MoveRegistry support for human-readable
|
|
276
|
+
package names. See the [codegen documentation](/codegen) for setup instructions.
|
|
277
|
+
|
|
278
|
+
### Using Generated Code
|
|
279
|
+
|
|
280
|
+
The generated code provides both Move call functions and BCS struct definitions:
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
// Generated Move call functions return thunks with typed options
|
|
284
|
+
const tx = new Transaction();
|
|
285
|
+
tx.add(
|
|
286
|
+
myContract.doSomething({
|
|
287
|
+
arguments: {
|
|
288
|
+
obj: '0x123...',
|
|
289
|
+
amount: 100n,
|
|
290
|
+
},
|
|
291
|
+
}),
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
// Generated BCS types parse on-chain data
|
|
295
|
+
const { object } = await client.core.getObject({
|
|
296
|
+
objectId: '0x123...',
|
|
297
|
+
include: { content: true },
|
|
298
|
+
});
|
|
299
|
+
const parsed = myContract.MyStruct.parse(object.content);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
See the [codegen documentation](/codegen) for complete setup and configuration options.
|
|
303
|
+
|
|
304
|
+
## Reading Object Contents
|
|
305
|
+
|
|
306
|
+
SDKs often need to fetch objects and parse their BCS-encoded content. Use `getObject` with
|
|
307
|
+
`include: { content: true }` and generated BCS types:
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
async function getResource(objectId: string) {
|
|
311
|
+
const { object } = await this.#client.core.getObject({
|
|
312
|
+
objectId,
|
|
313
|
+
include: { content: true },
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
if (!object) {
|
|
317
|
+
throw new Error(`Object ${objectId} not found`);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Parse BCS content using generated type
|
|
321
|
+
return MyStruct.parse(object.content);
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
For batching multiple object fetches, use `getObjects`:
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
async function getResources(objectIds: string[]) {
|
|
329
|
+
const { objects } = await this.#client.core.getObjects({
|
|
330
|
+
objectIds,
|
|
331
|
+
include: { content: true },
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
return objects.map((obj) => {
|
|
335
|
+
if (obj instanceof Error) {
|
|
336
|
+
throw obj;
|
|
337
|
+
}
|
|
338
|
+
return MyStruct.parse(obj.content);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
```
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Haneul Programmable Transaction Basics
|
|
2
|
+
|
|
3
|
+
> Construct programmable transaction blocks with the Transaction API
|
|
4
|
+
|
|
5
|
+
This example starts by constructing a transaction to send HANEUL. To construct transactions, import
|
|
6
|
+
the `Transaction` class and construct it:
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
const tx = new Transaction();
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
You can then add commands to the transaction .
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
// create a new coin with balance 100, based on the coins used as gas payment
|
|
16
|
+
// you can define any balance here
|
|
17
|
+
const [coin] = tx.splitCoins(tx.gas, [100]);
|
|
18
|
+
|
|
19
|
+
// transfer the split coin to a specific address
|
|
20
|
+
tx.transferObjects([coin], '0xSomeHaneulAddress');
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You can attach multiple commands of the same type to a transaction, as well. For example, to get a
|
|
24
|
+
list of transfers and iterate over them to transfer coins to each of them:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
interface Transfer {
|
|
28
|
+
to: string;
|
|
29
|
+
amount: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// procure a list of some Haneul transfers to make
|
|
33
|
+
const transfers: Transfer[] = getTransfers();
|
|
34
|
+
|
|
35
|
+
const tx = new Transaction();
|
|
36
|
+
|
|
37
|
+
// first, split the gas coin into multiple coins
|
|
38
|
+
const coins = tx.splitCoins(
|
|
39
|
+
tx.gas,
|
|
40
|
+
transfers.map((transfer) => transfer.amount),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// next, create a transfer command for each coin
|
|
44
|
+
transfers.forEach((transfer, index) => {
|
|
45
|
+
tx.transferObjects([coins[index]], transfer.to);
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After you have the transaction defined, you can directly execute it with a signer using
|
|
50
|
+
`signAndExecuteTransaction`.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
const result = await client.signAndExecuteTransaction({ signer: keypair, transaction: tx });
|
|
54
|
+
|
|
55
|
+
// IMPORTANT: Always check the transaction status
|
|
56
|
+
// Transactions can execute but still fail (e.g., insufficient gas, move errors)
|
|
57
|
+
if (result.$kind === 'FailedTransaction') {
|
|
58
|
+
throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Observing the results of a transaction
|
|
63
|
+
|
|
64
|
+
When you use `client.signAndExecuteTransaction` or `client.executeTransactionBlock`, the transaction
|
|
65
|
+
will be finalized on the blockchain before the function resolves, but the effects of the transaction
|
|
66
|
+
may not be immediately observable.
|
|
67
|
+
|
|
68
|
+
There are 2 ways to observe the results of a transaction. Methods like
|
|
69
|
+
`client.signAndExecuteTransaction` accept an `options` object with options like `showObjectChanges`
|
|
70
|
+
and `showBalanceChanges` (see
|
|
71
|
+
[the HaneulJsonRpcClient docs for more details](/haneul/clients/json-rpc#arguments)). These options
|
|
72
|
+
will cause the request to contain additional details about the effects of the transaction that can
|
|
73
|
+
be immediately displayed to the user, or used for further processing in your application.
|
|
74
|
+
|
|
75
|
+
The other way effects of transactions can be observed is by querying other RPC methods like
|
|
76
|
+
`client.getBalances` that return objects or balances owned by a specific address. These RPC calls
|
|
77
|
+
depend on the RPC node having indexed the effects of the transaction, which may not have happened
|
|
78
|
+
immediately after a transaction has been executed. To ensure that effects of a transaction are
|
|
79
|
+
represented in future RPC calls, you can use the `waitForTransaction` method on the client:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const result = await client.signAndExecuteTransaction({ signer: keypair, transaction: tx });
|
|
83
|
+
|
|
84
|
+
// Check transaction status
|
|
85
|
+
if (result.$kind === 'FailedTransaction') {
|
|
86
|
+
throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
await client.waitForTransaction({ result });
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Once `waitForTransaction` resolves, any future RPC calls will be guaranteed to reflect the effects
|
|
93
|
+
of the transaction.
|
|
94
|
+
|
|
95
|
+
## Transactions
|
|
96
|
+
|
|
97
|
+
Programmable Transactions have two key concepts: inputs and commands.
|
|
98
|
+
|
|
99
|
+
Commands are steps of execution in the transaction. Each command in a Transaction takes a set of
|
|
100
|
+
inputs, and produces results. The inputs for a transaction depend on the kind of command. Haneul
|
|
101
|
+
supports following commands:
|
|
102
|
+
|
|
103
|
+
- `tx.splitCoins(coin, amounts)` - Creates new coins with the defined amounts, split from the
|
|
104
|
+
provided coin. Returns the coins so that it can be used in subsequent transactions.
|
|
105
|
+
- Example: `tx.splitCoins(tx.gas, [100, 200])`
|
|
106
|
+
- `tx.mergeCoins(destinationCoin, sourceCoins)` - Merges the sourceCoins into the destinationCoin.
|
|
107
|
+
- Example: `tx.mergeCoins(tx.object(coin1), [tx.object(coin2), tx.object(coin3)])`
|
|
108
|
+
- `tx.transferObjects(objects, address)` - Transfers a list of objects to the specified address.
|
|
109
|
+
- Example: `tx.transferObjects([tx.object(thing1), tx.object(thing2)], myAddress)`
|
|
110
|
+
- `tx.moveCall({ target, arguments, typeArguments })` - Executes a Move call. Returns whatever the
|
|
111
|
+
Haneul Move call returns.
|
|
112
|
+
- Example:
|
|
113
|
+
`tx.moveCall({ target: '0x2::devnet_nft::mint', arguments: [tx.pure.string(name), tx.pure.string(description), tx.pure.string(image)] })`
|
|
114
|
+
- `tx.makeMoveVec({ type, elements })` - Constructs a vector of objects that can be passed into a
|
|
115
|
+
`moveCall`. This is required as there’s no way to define a vector as an input.
|
|
116
|
+
- Example: `tx.makeMoveVec({ elements: [tx.object(id1), tx.object(id2)] })`
|
|
117
|
+
- `tx.publish(modules, dependencies)` - Publishes a Move package. Returns the upgrade capability
|
|
118
|
+
object.
|
|
119
|
+
|
|
120
|
+
## Passing inputs to a command
|
|
121
|
+
|
|
122
|
+
Command inputs can be provided in a number of different ways, depending on the command, and the type
|
|
123
|
+
of value being provided.
|
|
124
|
+
|
|
125
|
+
#### JavaScript values
|
|
126
|
+
|
|
127
|
+
For specific command arguments (`amounts` in `splitCoins`, and `address` in `transferObjects`) the
|
|
128
|
+
expected type is known ahead of time, and you can directly pass raw javascript values when calling
|
|
129
|
+
the command method. appropriate Move type automatically.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
// the amount to split off the gas coin is provided as a pure javascript number
|
|
133
|
+
const [coin] = tx.splitCoins(tx.gas, [100]);
|
|
134
|
+
// the address for the transfer is provided as a pure javascript string
|
|
135
|
+
tx.transferObjects([coin], '0xSomeHaneulAddress');
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Pure values
|
|
139
|
+
|
|
140
|
+
When providing inputs that are not on chain objects, the values must be serialized as
|
|
141
|
+
|
|
142
|
+
[BCS](https://sdk.haneul-labs.com/bcs), which can be done using `tx.pure` eg,
|
|
143
|
+
`tx.pure.address(address)` or `tx.pure(bcs.vector(bcs.U8).serialize(bytes))`.
|
|
144
|
+
|
|
145
|
+
`tx.pure` can be called as a function that accepts a SerializedBcs object, or as a namespace that
|
|
146
|
+
contains functions for each of the supported types.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
const [coin] = tx.splitCoins(tx.gas, [tx.pure.u64(100)]);
|
|
150
|
+
const [coin] = tx.splitCoins(tx.gas, [tx.pure(bcs.U64.serialize(100))]);
|
|
151
|
+
tx.transferObjects([coin], tx.pure.address('0xSomeHaneulAddress'));
|
|
152
|
+
tx.transferObjects([coin], tx.pure(bcs.Address.serialize('0xSomeHaneulAddress')));
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
To pass `vector` or `option` types, you can pass use the corresponding methods on `tx.pure`, use
|
|
156
|
+
tx.pure as a function with a type argument, or serialize the value before passing it to tx.pure
|
|
157
|
+
using the bcs sdk:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
tx.moveCall({
|
|
161
|
+
target: '0x2::foo::bar',
|
|
162
|
+
arguments: [
|
|
163
|
+
// using vector and option methods
|
|
164
|
+
tx.pure.vector('u8', [1, 2, 3]),
|
|
165
|
+
tx.pure.option('u8', 1),
|
|
166
|
+
tx.pure.option('u8', null),
|
|
167
|
+
|
|
168
|
+
// Using pure with type arguments
|
|
169
|
+
tx.pure('vector<u8>', [1, 2, 3]),
|
|
170
|
+
tx.pure('option<u8>', 1),
|
|
171
|
+
tx.pure('option<u8>', null),
|
|
172
|
+
tx.pure('vector<option<u8>>', [1, null, 2]),
|
|
173
|
+
|
|
174
|
+
// Using bcs.serialize
|
|
175
|
+
tx.pure(bcs.vector(bcs.U8).serialize([1, 2, 3])),
|
|
176
|
+
tx.pure(bcs.option(bcs.U8).serialize(1)),
|
|
177
|
+
tx.pure(bcs.option(bcs.U8).serialize(null)),
|
|
178
|
+
tx.pure(bcs.vector(bcs.option(bcs.U8)).serialize([1, null, 2])),
|
|
179
|
+
],
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Object references
|
|
184
|
+
|
|
185
|
+
To use an on chain object as a transaction input, you must pass a reference to that object. This can
|
|
186
|
+
be done by calling `tx.object` with the object id. Transaction arguments that only accept objects
|
|
187
|
+
(like `objects` in `transferObjects`) will automatically treat any provided strings as objects ids.
|
|
188
|
+
For methods like `moveCall` that accept both objects and other types, you must explicitly call
|
|
189
|
+
`tx.object` to convert the id to an object reference.
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
// Object IDs can be passed to some methods like (transferObjects) directly
|
|
193
|
+
tx.transferObjects(['0xSomeObject'], 'OxSomeAddress');
|
|
194
|
+
// tx.object can be used anywhere an object is accepted
|
|
195
|
+
tx.transferObjects([tx.object('0xSomeObject')], 'OxSomeAddress');
|
|
196
|
+
|
|
197
|
+
tx.moveCall({
|
|
198
|
+
target: '0x2::nft::mint',
|
|
199
|
+
// object IDs must be wrapped in moveCall arguments
|
|
200
|
+
arguments: [tx.object('0xSomeObject')],
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// tx.object automatically converts the object ID to receiving transaction arguments if the moveCall expects it
|
|
204
|
+
tx.moveCall({
|
|
205
|
+
target: '0xSomeAddress::example::receive_object',
|
|
206
|
+
// 0xSomeAddress::example::receive_object expects a receiving argument and has a Move definition that looks like this:
|
|
207
|
+
// public fun receive_object<T: key>(parent_object: &mut ParentObjectType, receiving_object: Receiving<ChildObjectType>) { ... }
|
|
208
|
+
arguments: [tx.object('0xParentObjectID'), tx.object('0xReceivingObjectID')],
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
When building a transaction, Haneul expects all objects to be fully resolved, including the object
|
|
213
|
+
version. The SDK automatically looks up the current version of objects for any provided object
|
|
214
|
+
reference when building a transaction. If the object reference is used as a receiving argument to a
|
|
215
|
+
`moveCall`, the object reference is automatically converted to a receiving transaction argument.
|
|
216
|
+
This greatly simplifies building transactions, but requires additional RPC calls. You can optimize
|
|
217
|
+
this process by providing a fully resolved object reference instead:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
// for owned or immutable objects
|
|
221
|
+
tx.object(Inputs.ObjectRef({ digest, objectId, version }));
|
|
222
|
+
|
|
223
|
+
// for shared objects
|
|
224
|
+
tx.object(Inputs.SharedObjectRef({ objectId, initialSharedVersion, mutable }));
|
|
225
|
+
|
|
226
|
+
// for receiving objects
|
|
227
|
+
tx.object(Inputs.ReceivingRef({ digest, objectId, version }));
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
##### Object helpers
|
|
231
|
+
|
|
232
|
+
There are a handful of specific object types that can be referenced through helper methods on
|
|
233
|
+
tx.object:
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
tx.object.system(),
|
|
237
|
+
tx.object.clock(),
|
|
238
|
+
tx.object.random(),
|
|
239
|
+
tx.object.denyList(),
|
|
240
|
+
|
|
241
|
+
tx.object.option({
|
|
242
|
+
type: '0x123::example::Thing',
|
|
243
|
+
// value can be an Object ID, or any other object reference, or null for `none`
|
|
244
|
+
value: '0x456',
|
|
245
|
+
}),
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### Transaction results
|
|
249
|
+
|
|
250
|
+
You can also use the result of a command as an argument in a subsequent commands. Each method on the
|
|
251
|
+
transaction builder returns a reference to the transaction result.
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
// split a coin object off of the gas object
|
|
255
|
+
const [coin] = tx.splitCoins(tx.gas, [100]);
|
|
256
|
+
// transfer the resulting coin object
|
|
257
|
+
tx.transferObjects([coin], address);
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
When a command returns multiple results, you can access the result at a specific index either using
|
|
261
|
+
destructuring, or array indexes.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
// destructuring (preferred, as it gives you logical local names)
|
|
265
|
+
const [nft1, nft2] = tx.moveCall({ target: '0x2::nft::mint_many' });
|
|
266
|
+
tx.transferObjects([nft1, nft2], address);
|
|
267
|
+
|
|
268
|
+
// array indexes
|
|
269
|
+
const mintMany = tx.moveCall({ target: '0x2::nft::mint_many' });
|
|
270
|
+
tx.transferObjects([mintMany[0], mintMany[1]], address);
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Get transaction bytes
|
|
274
|
+
|
|
275
|
+
If you need the transaction bytes, instead of signing or executing the transaction, you can use the
|
|
276
|
+
`build` method on the transaction builder itself.
|
|
277
|
+
|
|
278
|
+
**Important:** You might need to explicitly call `setSender()` on the transaction to ensure that the
|
|
279
|
+
`sender` field is populated. This is normally done by the signer before signing the transaction, but
|
|
280
|
+
will not be done automatically if you’re building the transaction bytes yourself.
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
const tx = new Transaction();
|
|
284
|
+
|
|
285
|
+
// ... add some transactions...
|
|
286
|
+
|
|
287
|
+
await tx.build({ client });
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
In most cases, building requires your HaneulJsonRpcClient to fully resolve input values.
|
|
291
|
+
|
|
292
|
+
If you have transaction bytes, you can also convert them back into a `Transaction` class:
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
const bytes = getTransactionBytesFromSomewhere();
|
|
296
|
+
const tx = Transaction.from(bytes);
|
|
297
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Paying for Haneul Transactions with Gas Coins
|
|
2
|
+
|
|
3
|
+
> Configure gas budget, price, and coin selection for transactions
|
|
4
|
+
|
|
5
|
+
With Programmable Transactions, you can use the gas payment coin to construct coins with a set
|
|
6
|
+
balance using `splitCoin`. This is useful for Haneul payments, and avoids the need for up-front coin
|
|
7
|
+
selection. You can use `tx.gas` to access the gas coin in a transaction, and it is valid as input
|
|
8
|
+
for any arguments, as long as it is used
|
|
9
|
+
[by-reference](https://docs.haneul.io/guides/developer/haneul-101/simulating-refs). Practically
|
|
10
|
+
speaking, this means you can also add to the gas coin with `mergeCoins` and borrow it for Move
|
|
11
|
+
functions with `moveCall`.
|
|
12
|
+
|
|
13
|
+
You can also transfer the gas coin using `transferObjects`, in the event that you want to transfer
|
|
14
|
+
all of your coin balance to another address.
|
|
15
|
+
|
|
16
|
+
## Gas configuration
|
|
17
|
+
|
|
18
|
+
The new transaction builder comes with default behavior for all gas logic, including automatically
|
|
19
|
+
setting the gas price, budget, and selecting coins to be used as gas. This behavior can be
|
|
20
|
+
customized.
|
|
21
|
+
|
|
22
|
+
### Gas price
|
|
23
|
+
|
|
24
|
+
By default, the gas price is set to the reference gas price of the network. You can also explicitly
|
|
25
|
+
set the gas price of the transaction by calling `setGasPrice` on the transaction builder.
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
tx.setGasPrice(gasPrice);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Budget
|
|
32
|
+
|
|
33
|
+
By default, the gas budget is automatically derived by executing a dry-run of the transaction
|
|
34
|
+
beforehand. The dry run gas consumption is then used to determine a balance for the transaction. You
|
|
35
|
+
can override this behavior by explicitly setting a gas budget for the transaction, by calling
|
|
36
|
+
`setGasBudget` on the transaction builder.
|
|
37
|
+
|
|
38
|
+
**Note:** The gas budget is represented in Haneul, and should take the gas price of the transaction
|
|
39
|
+
into account.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
tx.setGasBudget(gasBudgetAmount);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Gas payment
|
|
46
|
+
|
|
47
|
+
By default, the gas payment is automatically determined by the SDK. The SDK selects all of the users
|
|
48
|
+
coins that are not used as inputs in the transaction.
|
|
49
|
+
|
|
50
|
+
The list of coins used as gas payment will be merged down into a single gas coin before executing
|
|
51
|
+
the transaction, and all but one of the gas objects will be deleted. The gas coin at the 0-index
|
|
52
|
+
will be the coin that all others are merged into.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
// you need to ensure that the coins do not overlap with any
|
|
56
|
+
// of the input objects for the transaction
|
|
57
|
+
tx.setGasPayment([coin1, coin2]);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Gas coins should be objects containing the coins objectId, version, and digest.
|
|
61
|
+
|
|
62
|
+
<auto-type-table type="{ objectId: string, version: string | number, digest: string }" />
|