@haneullabs/haneul 2.5.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/README.md +36 -36
- package/dist/bcs/bcs.d.mts +6 -7
- package/dist/bcs/bcs.d.mts.map +1 -1
- package/dist/bcs/bcs.mjs.map +1 -1
- package/dist/bcs/effects.mjs.map +1 -1
- package/dist/bcs/index.d.mts +2 -2
- package/dist/bcs/index.d.mts.map +1 -1
- package/dist/bcs/index.mjs +2 -2
- package/dist/bcs/index.mjs.map +1 -1
- package/dist/bcs/pure.d.mts.map +1 -1
- package/dist/bcs/type-tag-serializer.d.mts.map +1 -1
- package/dist/bcs/types.d.mts +0 -1
- package/dist/bcs/types.d.mts.map +1 -1
- package/dist/client/cache.d.mts.map +1 -1
- package/dist/client/client.d.mts.map +1 -1
- package/dist/client/core-resolver.d.mts.map +1 -1
- package/dist/client/core-resolver.mjs +87 -68
- package/dist/client/core-resolver.mjs.map +1 -1
- package/dist/client/core.d.mts +9 -8
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs +29 -10
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/errors.d.mts.map +1 -1
- package/dist/client/mvr.d.mts +0 -1
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/types.d.mts +110 -24
- package/dist/client/types.d.mts.map +1 -1
- package/dist/client/utils.d.mts.map +1 -1
- package/dist/client/utils.mjs +7 -7
- package/dist/client/utils.mjs.map +1 -1
- package/dist/cryptography/index.d.mts +2 -2
- package/dist/cryptography/index.mjs +2 -2
- package/dist/cryptography/intent.d.mts +2 -2
- package/dist/cryptography/intent.d.mts.map +1 -1
- package/dist/cryptography/intent.mjs +2 -2
- package/dist/cryptography/intent.mjs.map +1 -1
- package/dist/cryptography/keypair.d.mts +3 -3
- package/dist/cryptography/keypair.d.mts.map +1 -1
- package/dist/cryptography/keypair.mjs +3 -3
- package/dist/cryptography/keypair.mjs.map +1 -1
- package/dist/cryptography/mnemonics.d.mts +5 -5
- package/dist/cryptography/mnemonics.d.mts.map +1 -1
- package/dist/cryptography/mnemonics.mjs +7 -7
- package/dist/cryptography/mnemonics.mjs.map +1 -1
- package/dist/cryptography/publickey.d.mts +2 -3
- package/dist/cryptography/publickey.d.mts.map +1 -1
- package/dist/cryptography/publickey.mjs +10 -10
- package/dist/cryptography/publickey.mjs.map +1 -1
- package/dist/cryptography/signature-scheme.d.mts.map +1 -1
- package/dist/cryptography/signature.d.mts +10 -13
- package/dist/cryptography/signature.d.mts.map +1 -1
- package/dist/cryptography/signature.mjs +2 -2
- package/dist/cryptography/signature.mjs.map +1 -1
- package/dist/faucet/faucet.d.mts +2 -2
- package/dist/faucet/faucet.d.mts.map +1 -1
- package/dist/faucet/faucet.mjs +2 -2
- package/dist/faucet/faucet.mjs.map +1 -1
- package/dist/faucet/index.d.mts +2 -2
- package/dist/faucet/index.mjs +2 -2
- package/dist/graphql/client.d.mts +20 -5
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs +55 -7
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts +6 -5
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +43 -47
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.d.mts +0 -1
- package/dist/graphql/generated/queries.d.mts.map +1 -1
- package/dist/graphql/generated/queries.mjs +46 -10
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/graphql/generated/tada-env.d.mts +706 -98
- package/dist/graphql/generated/tada-env.d.mts.map +1 -1
- package/dist/graphql/index.d.mts +2 -2
- package/dist/graphql/index.mjs +2 -2
- package/dist/graphql/schema/index.d.mts +0 -1
- package/dist/graphql/schema/index.d.mts.map +1 -1
- package/dist/graphql/types.d.mts.map +1 -1
- package/dist/grpc/client.d.mts +20 -5
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +47 -7
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +6 -5
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +35 -34
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/index.d.mts +2 -2
- package/dist/grpc/index.mjs +2 -2
- package/dist/grpc/proto/google/protobuf/any.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/any.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/duration.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/duration.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/field_mask.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/field_mask.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/struct.d.mts +1 -2
- package/dist/grpc/proto/google/protobuf/struct.d.mts.map +1 -1
- package/dist/grpc/proto/google/protobuf/timestamp.d.mts +0 -1
- package/dist/grpc/proto/google/protobuf/timestamp.d.mts.map +1 -1
- package/dist/grpc/proto/google/rpc/status.d.mts +0 -1
- package/dist/grpc/proto/google/rpc/status.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/argument.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/argument.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/balance_change.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/balance_change.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/bcs.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/bcs.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/bcs.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_contents.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_contents.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_summary.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/checkpoint_summary.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/effects.d.mts +5 -6
- package/dist/grpc/proto/haneul/rpc/v2/effects.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/epoch.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/epoch.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/error_reason.d.mts +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/error_reason.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/event.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/event.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/executed_transaction.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/executed_transaction.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.d.mts +8 -9
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.mjs +4 -4
- package/dist/grpc/proto/haneul/rpc/v2/execution_status.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/gas_cost_summary.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/gas_cost_summary.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/input.d.mts +3 -4
- package/dist/grpc/proto/haneul/rpc/v2/input.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/jwk.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/jwk.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/ledger_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package.d.mts +5 -6
- package/dist/grpc/proto/haneul/rpc/v2/move_package.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/move_package_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/name_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/name_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/object.d.mts +38 -2
- package/dist/grpc/proto/haneul/rpc/v2/object.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/object.mjs +26 -1
- package/dist/grpc/proto/haneul/rpc/v2/object.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/object_reference.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/object_reference.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/owner.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/owner.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/protocol_config.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/protocol_config.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature.d.mts +1 -2
- package/dist/grpc/proto/haneul/rpc/v2/signature.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.d.mts +2 -2
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.mjs +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/state_service.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/state_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/subscription_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts +3 -4
- package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts +4 -5
- package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts +0 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.d.mts +9 -2
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.d.mts.map +1 -1
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.mjs +23 -12
- package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.mjs.map +1 -1
- package/dist/grpc/proto/types.d.mts +2 -2
- package/dist/grpc/proto/types.d.mts.map +1 -1
- package/dist/grpc/proto/types.mjs +2 -1
- package/dist/jsonRpc/client.d.mts +4 -7
- package/dist/jsonRpc/client.d.mts.map +1 -1
- package/dist/jsonRpc/client.mjs +4 -33
- package/dist/jsonRpc/client.mjs.map +1 -1
- package/dist/jsonRpc/core.d.mts +8 -15
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +81 -34
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/jsonRpc/errors.d.mts.map +1 -1
- package/dist/jsonRpc/http-transport.d.mts +1 -17
- package/dist/jsonRpc/http-transport.d.mts.map +1 -1
- package/dist/jsonRpc/http-transport.mjs +0 -23
- package/dist/jsonRpc/http-transport.mjs.map +1 -1
- package/dist/jsonRpc/index.d.mts +3 -3
- package/dist/jsonRpc/network.d.mts.map +1 -1
- package/dist/jsonRpc/types/chain.d.mts.map +1 -1
- package/dist/jsonRpc/types/changes.d.mts.map +1 -1
- package/dist/jsonRpc/types/coins.d.mts.map +1 -1
- package/dist/jsonRpc/types/common.d.mts +1 -2
- package/dist/jsonRpc/types/common.d.mts.map +1 -1
- package/dist/jsonRpc/types/generated.d.mts +101 -129
- package/dist/jsonRpc/types/generated.d.mts.map +1 -1
- package/dist/jsonRpc/types/index.d.mts +1 -1
- package/dist/jsonRpc/types/params.d.mts +9 -14
- package/dist/jsonRpc/types/params.d.mts.map +1 -1
- package/dist/keypairs/ed25519/keypair.d.mts +8 -6
- package/dist/keypairs/ed25519/keypair.d.mts.map +1 -1
- package/dist/keypairs/ed25519/keypair.mjs +13 -9
- package/dist/keypairs/ed25519/keypair.mjs.map +1 -1
- package/dist/keypairs/ed25519/publickey.d.mts +0 -1
- package/dist/keypairs/ed25519/publickey.d.mts.map +1 -1
- package/dist/keypairs/passkey/keypair.d.mts +12 -5
- package/dist/keypairs/passkey/keypair.d.mts.map +1 -1
- package/dist/keypairs/passkey/keypair.mjs +20 -7
- package/dist/keypairs/passkey/keypair.mjs.map +1 -1
- package/dist/keypairs/passkey/publickey.d.mts +0 -1
- package/dist/keypairs/passkey/publickey.d.mts.map +1 -1
- package/dist/keypairs/passkey/types.d.mts.map +1 -1
- package/dist/keypairs/secp256k1/keypair.d.mts +3 -3
- package/dist/keypairs/secp256k1/keypair.d.mts.map +1 -1
- package/dist/keypairs/secp256k1/keypair.mjs +6 -6
- package/dist/keypairs/secp256k1/keypair.mjs.map +1 -1
- package/dist/keypairs/secp256k1/publickey.d.mts +0 -1
- package/dist/keypairs/secp256k1/publickey.d.mts.map +1 -1
- package/dist/keypairs/secp256r1/keypair.d.mts +3 -3
- package/dist/keypairs/secp256r1/keypair.d.mts.map +1 -1
- package/dist/keypairs/secp256r1/keypair.mjs +6 -6
- package/dist/keypairs/secp256r1/keypair.mjs.map +1 -1
- package/dist/keypairs/secp256r1/publickey.d.mts +0 -1
- package/dist/keypairs/secp256r1/publickey.d.mts.map +1 -1
- package/dist/multisig/publickey.d.mts +1 -0
- package/dist/multisig/publickey.d.mts.map +1 -1
- package/dist/multisig/publickey.mjs +8 -8
- package/dist/multisig/publickey.mjs.map +1 -1
- package/dist/multisig/signer.d.mts.map +1 -1
- package/dist/transactions/Arguments.d.mts.map +1 -1
- package/dist/transactions/Commands.d.mts +1 -1
- package/dist/transactions/Commands.d.mts.map +1 -1
- package/dist/transactions/Commands.mjs.map +1 -1
- package/dist/transactions/Inputs.d.mts.map +1 -1
- package/dist/transactions/ObjectCache.d.mts +3 -3
- package/dist/transactions/ObjectCache.d.mts.map +1 -1
- package/dist/transactions/Transaction.d.mts +32 -6
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/Transaction.mjs +23 -1
- package/dist/transactions/Transaction.mjs.map +1 -1
- package/dist/transactions/TransactionData.d.mts.map +1 -1
- package/dist/transactions/TransactionData.mjs +8 -8
- package/dist/transactions/TransactionData.mjs.map +1 -1
- package/dist/transactions/data/internal.d.mts +109 -109
- package/dist/transactions/data/internal.d.mts.map +1 -1
- package/dist/transactions/data/internal.mjs.map +1 -1
- package/dist/transactions/data/v1.d.mts +220 -221
- package/dist/transactions/data/v1.d.mts.map +1 -1
- package/dist/transactions/data/v2.d.mts +16 -16
- package/dist/transactions/data/v2.d.mts.map +1 -1
- package/dist/transactions/data/v2.mjs.map +1 -1
- package/dist/transactions/executor/caching.mjs +2 -2
- package/dist/transactions/executor/caching.mjs.map +1 -1
- package/dist/transactions/executor/parallel.d.mts +1 -1
- package/dist/transactions/executor/parallel.d.mts.map +1 -1
- package/dist/transactions/executor/parallel.mjs +1 -1
- package/dist/transactions/executor/parallel.mjs.map +1 -1
- package/dist/transactions/executor/serial.d.mts +3 -3
- package/dist/transactions/executor/serial.d.mts.map +1 -1
- package/dist/transactions/executor/serial.mjs.map +1 -1
- package/dist/transactions/intents/CoinWithBalance.d.mts.map +1 -1
- package/dist/transactions/intents/CoinWithBalance.mjs +174 -97
- package/dist/transactions/intents/CoinWithBalance.mjs.map +1 -1
- package/dist/transactions/object.d.mts.map +1 -1
- package/dist/transactions/pure.d.mts.map +1 -1
- package/dist/transactions/pure.mjs +12 -12
- package/dist/transactions/pure.mjs.map +1 -1
- package/dist/transactions/resolve.d.mts.map +1 -1
- package/dist/transactions/resolve.mjs +3 -3
- package/dist/transactions/resolve.mjs.map +1 -1
- package/dist/transactions/serializer.d.mts.map +1 -1
- package/dist/transactions/serializer.mjs +15 -15
- package/dist/transactions/serializer.mjs.map +1 -1
- package/dist/transactions/utils.d.mts +0 -1
- package/dist/transactions/utils.d.mts.map +1 -1
- package/dist/utils/coin-reservation.mjs +67 -0
- package/dist/utils/coin-reservation.mjs.map +1 -0
- package/dist/utils/constants.d.mts +2 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +2 -1
- package/dist/utils/constants.mjs.map +1 -1
- package/dist/utils/derived-objects.d.mts +0 -1
- package/dist/utils/derived-objects.d.mts.map +1 -1
- package/dist/utils/dynamic-fields.d.mts.map +1 -1
- package/dist/utils/dynamic-fields.mjs +4 -4
- package/dist/utils/dynamic-fields.mjs.map +1 -1
- package/dist/utils/format.d.mts.map +1 -1
- package/dist/utils/haneul-types.d.mts.map +1 -1
- package/dist/utils/haneul-types.mjs +8 -0
- package/dist/utils/haneul-types.mjs.map +1 -1
- package/dist/utils/haneulns.d.mts.map +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +2 -2
- package/dist/utils/move-registry.d.mts.map +1 -1
- package/dist/verify/index.d.mts +2 -2
- package/dist/verify/index.mjs +2 -2
- package/dist/verify/verify.d.mts +2 -2
- package/dist/verify/verify.d.mts.map +1 -1
- package/dist/verify/verify.mjs +2 -2
- package/dist/verify/verify.mjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/address.d.mts.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/bcs.d.mts.map +1 -1
- package/dist/zklogin/jwt-decode.d.mts +0 -1
- package/dist/zklogin/jwt-decode.d.mts.map +1 -1
- package/dist/zklogin/jwt-utils.d.mts +0 -1
- package/dist/zklogin/jwt-utils.d.mts.map +1 -1
- package/dist/zklogin/nonce.d.mts.map +1 -1
- package/dist/zklogin/nonce.mjs +1 -1
- package/dist/zklogin/nonce.mjs.map +1 -1
- package/dist/zklogin/poseidon.d.mts.map +1 -1
- package/dist/zklogin/publickey.d.mts +0 -1
- package/dist/zklogin/publickey.d.mts.map +1 -1
- package/dist/zklogin/signature.d.mts.map +1 -1
- package/dist/zklogin/utils.d.mts.map +1 -1
- package/dist/zklogin/utils.mjs +1 -1
- package/dist/zklogin/utils.mjs.map +1 -1
- package/docs/bcs.md +132 -0
- package/docs/clients/core.md +616 -0
- package/docs/clients/graphql.md +99 -0
- package/docs/clients/grpc.md +152 -0
- package/docs/clients/index.md +93 -0
- package/docs/clients/json-rpc.md +235 -0
- package/docs/cryptography/keypairs.md +259 -0
- package/docs/cryptography/multisig.md +192 -0
- package/docs/cryptography/passkey.md +111 -0
- package/docs/cryptography/webcrypto-signer.md +81 -0
- package/docs/executors.md +148 -0
- package/docs/faucet.md +26 -0
- package/docs/hello-haneul.md +115 -0
- package/docs/index.md +56 -0
- package/docs/install.md +61 -0
- package/docs/llm-docs.md +32 -0
- package/docs/llms-index.md +66 -0
- package/docs/migrations/0.38.md +57 -0
- package/docs/migrations/haneul-1.0.md +454 -0
- package/docs/migrations/haneul-2.0/agent-prompt.md +42 -0
- package/docs/migrations/haneul-2.0/dapp-kit.md +350 -0
- package/docs/migrations/haneul-2.0/deepbook-v3.md +33 -0
- package/docs/migrations/haneul-2.0/haneul.md +341 -0
- package/docs/migrations/haneul-2.0/haneulns.md +42 -0
- package/docs/migrations/haneul-2.0/index.md +161 -0
- package/docs/migrations/haneul-2.0/json-rpc-migration.md +399 -0
- package/docs/migrations/haneul-2.0/kiosk.md +120 -0
- package/docs/migrations/haneul-2.0/sdk-maintainers.md +91 -0
- package/docs/migrations/haneul-2.0/seal.md +14 -0
- package/docs/migrations/haneul-2.0/wallet-builders.md +66 -0
- package/docs/migrations/haneul-2.0/walrus.md +41 -0
- package/docs/migrations/haneul-2.0/zksend.md +94 -0
- package/docs/plugins.md +255 -0
- package/docs/sdk-building.md +341 -0
- package/docs/transaction-building/basics.md +297 -0
- package/docs/transaction-building/gas.md +62 -0
- package/docs/transaction-building/intents.md +61 -0
- package/docs/transaction-building/offline.md +71 -0
- package/docs/transaction-building/sponsored-transactions.md +22 -0
- package/docs/utils/derived_objects.md +80 -0
- package/docs/utils/index.md +53 -0
- package/docs/zklogin.md +78 -0
- package/package.json +199 -199
- package/src/bcs/bcs.ts +13 -13
- package/src/bcs/effects.ts +20 -20
- package/src/bcs/index.ts +2 -2
- package/src/client/core-resolver.ts +150 -100
- package/src/client/core.ts +62 -22
- package/src/client/types.ts +109 -24
- package/src/cryptography/index.ts +2 -2
- package/src/cryptography/keypair.ts +2 -2
- package/src/cryptography/mnemonics.ts +7 -7
- package/src/cryptography/publickey.ts +8 -8
- package/src/faucet/faucet.ts +1 -1
- package/src/faucet/index.ts +1 -1
- package/src/graphql/client.ts +100 -8
- package/src/graphql/core.ts +73 -80
- package/src/graphql/generated/queries.ts +301 -51
- package/src/graphql/generated/schema.graphql +407 -104
- package/src/graphql/generated/tada-env.ts +779 -58
- package/src/graphql/index.ts +1 -1
- package/src/graphql/queries/getAllBalances.graphql +1 -1
- package/src/graphql/queries/getBalance.graphql +1 -1
- package/src/graphql/queries/getCoins.graphql +2 -2
- package/src/graphql/queries/getDynamicFields.graphql +9 -1
- package/src/graphql/queries/getMoveFunction.graphql +1 -1
- package/src/graphql/queries/getProtocolConfig.graphql +18 -0
- package/src/graphql/queries/nameService.graphql +1 -1
- package/src/graphql/queries/objects.graphql +11 -1
- package/src/graphql/queries/transactions.graphql +1 -3
- package/src/graphql/queries/verifyZkLoginSignature.graphql +1 -2
- package/src/grpc/client.ts +66 -8
- package/src/grpc/core.ts +74 -35
- package/src/grpc/index.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/bcs.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/execution_status.ts +4 -4
- package/src/grpc/proto/haneul/rpc/v2/object.ts +44 -0
- package/src/grpc/proto/haneul/rpc/v2/signature.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/signature_scheme.ts +1 -1
- package/src/grpc/proto/haneul/rpc/v2/system_state.ts +4 -4
- package/src/grpc/proto/haneul/rpc/v2/transaction_execution_service.ts +16 -0
- package/src/jsonRpc/client.ts +5 -23
- package/src/jsonRpc/core.ts +114 -41
- package/src/jsonRpc/http-transport.ts +0 -52
- package/src/jsonRpc/index.ts +0 -1
- package/src/jsonRpc/types/common.ts +0 -1
- package/src/jsonRpc/types/generated.ts +2 -2
- package/src/jsonRpc/types/params.ts +6 -6
- package/src/keypairs/ed25519/keypair.ts +14 -10
- package/src/keypairs/passkey/keypair.ts +22 -8
- package/src/keypairs/secp256k1/keypair.ts +6 -6
- package/src/keypairs/secp256r1/keypair.ts +6 -6
- package/src/multisig/publickey.ts +1 -1
- package/src/transactions/Commands.ts +1 -1
- package/src/transactions/Transaction.ts +38 -1
- package/src/transactions/TransactionData.ts +3 -3
- package/src/transactions/__tests__/bcs.test.ts +3 -3
- package/src/transactions/data/internal.ts +12 -12
- package/src/transactions/data/v2.ts +6 -6
- package/src/transactions/executor/caching.ts +2 -2
- package/src/transactions/executor/parallel.ts +1 -2
- package/src/transactions/executor/serial.ts +1 -1
- package/src/transactions/intents/CoinWithBalance.ts +247 -121
- package/src/utils/coin-reservation.ts +84 -0
- package/src/utils/constants.ts +2 -0
- package/src/utils/haneul-types.ts +16 -1
- package/src/utils/index.ts +1 -0
- package/src/verify/index.ts +1 -1
- package/src/verify/verify.ts +1 -1
- package/src/version.ts +1 -1
- package/src/zklogin/nonce.ts +1 -1
- package/src/zklogin/utils.ts +1 -1
- package/dist/jsonRpc/rpc-websocket-client.d.mts +0 -26
- package/dist/jsonRpc/rpc-websocket-client.d.mts.map +0 -1
- package/dist/jsonRpc/rpc-websocket-client.mjs +0 -135
- package/dist/jsonRpc/rpc-websocket-client.mjs.map +0 -1
- package/src/jsonRpc/rpc-websocket-client.ts +0 -241
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publickey.d.mts","names":[],"sources":["../../src/multisig/publickey.ts"],"
|
|
1
|
+
{"version":3,"file":"publickey.d.mts","names":[],"sources":["../../src/multisig/publickey.ts"],"mappings":";;;;;;;KAsBK,mBAAA;EACA,OAAA,EAAS,UAAA;AAAA;EACT,SAAA,EAAW,UAAA;AAAA;EACX,SAAA,EAAW,UAAA;AAAA;EACX,OAAA,EAAS,UAAA;AAAA;EACT,OAAA,EAAS,UAAA;AAAA;AAAA,KAET,aAAA;EACA,OAAA,EAAS,UAAA;AAAA;EACT,SAAA,EAAW,UAAA;AAAA;EACX,SAAA,EAAW,UAAA;AAAA;EACX,OAAA,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|
|
1
1
|
import { normalizeHaneulAddress } from "../utils/haneul-types.mjs";
|
|
2
|
-
import { bcs as
|
|
2
|
+
import { bcs as haneulBcs } from "../bcs/index.mjs";
|
|
3
3
|
import { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_FLAG } from "../cryptography/signature-scheme.mjs";
|
|
4
4
|
import { PublicKey, bytesEqual } from "../cryptography/publickey.mjs";
|
|
5
5
|
import { toZkLoginPublicIdentifier } from "../zklogin/publickey.mjs";
|
|
@@ -24,13 +24,13 @@ var MultiSigPublicKey = class MultiSigPublicKey extends PublicKey {
|
|
|
24
24
|
super();
|
|
25
25
|
if (typeof value === "string") {
|
|
26
26
|
this.rawBytes = fromBase64(value);
|
|
27
|
-
this.multisigPublicKey =
|
|
27
|
+
this.multisigPublicKey = haneulBcs.MultiSigPublicKey.parse(this.rawBytes);
|
|
28
28
|
} else if (value instanceof Uint8Array) {
|
|
29
29
|
this.rawBytes = value;
|
|
30
|
-
this.multisigPublicKey =
|
|
30
|
+
this.multisigPublicKey = haneulBcs.MultiSigPublicKey.parse(this.rawBytes);
|
|
31
31
|
} else {
|
|
32
32
|
this.multisigPublicKey = value;
|
|
33
|
-
this.rawBytes =
|
|
33
|
+
this.rawBytes = haneulBcs.MultiSigPublicKey.serialize(value).toBytes();
|
|
34
34
|
}
|
|
35
35
|
if (this.multisigPublicKey.threshold < 1) throw new Error("Invalid threshold");
|
|
36
36
|
const seenPublicKeys = /* @__PURE__ */ new Set();
|
|
@@ -92,10 +92,10 @@ var MultiSigPublicKey = class MultiSigPublicKey extends PublicKey {
|
|
|
92
92
|
const maxLength = 1 + 65 * MAX_SIGNER_IN_MULTISIG + 2;
|
|
93
93
|
const tmp = new Uint8Array(maxLength);
|
|
94
94
|
tmp.set([SIGNATURE_SCHEME_TO_FLAG["MultiSig"]]);
|
|
95
|
-
tmp.set(
|
|
95
|
+
tmp.set(haneulBcs.u16().serialize(this.multisigPublicKey.threshold).toBytes(), 1);
|
|
96
96
|
let i = 3;
|
|
97
97
|
for (const { publicKey, weight } of this.publicKeys) {
|
|
98
|
-
const bytes = publicKey.
|
|
98
|
+
const bytes = publicKey.toHaneulBytes();
|
|
99
99
|
tmp.set(bytes, i);
|
|
100
100
|
i += bytes.length;
|
|
101
101
|
tmp.set([weight], i++);
|
|
@@ -116,7 +116,7 @@ var MultiSigPublicKey = class MultiSigPublicKey extends PublicKey {
|
|
|
116
116
|
if (parsed.signatureScheme !== "MultiSig") throw new Error("Invalid signature scheme");
|
|
117
117
|
const { multisig } = parsed;
|
|
118
118
|
let signatureWeight = 0;
|
|
119
|
-
if (!bytesEqual(
|
|
119
|
+
if (!bytesEqual(haneulBcs.MultiSigPublicKey.serialize(this.multisigPublicKey).toBytes(), haneulBcs.MultiSigPublicKey.serialize(multisig.multisig_pk).toBytes())) return false;
|
|
120
120
|
for (const { publicKey, weight, signature } of parsePartialSignatures(multisig)) {
|
|
121
121
|
if (!await publicKey.verify(message, signature)) return false;
|
|
122
122
|
signatureWeight += weight;
|
|
@@ -152,7 +152,7 @@ var MultiSigPublicKey = class MultiSigPublicKey extends PublicKey {
|
|
|
152
152
|
bitmap,
|
|
153
153
|
multisig_pk: this.multisigPublicKey
|
|
154
154
|
};
|
|
155
|
-
const bytes =
|
|
155
|
+
const bytes = haneulBcs.MultiSig.serialize(multisig, { maxSize: 8192 }).toBytes();
|
|
156
156
|
const tmp = new Uint8Array(bytes.length + 1);
|
|
157
157
|
tmp.set([SIGNATURE_SCHEME_TO_FLAG["MultiSig"]]);
|
|
158
158
|
tmp.set(bytes, 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publickey.mjs","names":["bcs"],"sources":["../../src/multisig/publickey.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase64, toBase64 } from '@haneullabs/bcs';\nimport { blake2b } from '@noble/hashes/blake2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\n\nimport { bcs } from '../bcs/index.js';\nimport type { Signer } from '../cryptography/keypair.js';\nimport { bytesEqual, PublicKey } from '../cryptography/publickey.js';\nimport {\n\tSIGNATURE_FLAG_TO_SCHEME,\n\tSIGNATURE_SCHEME_TO_FLAG,\n} from '../cryptography/signature-scheme.js';\nimport type { SignatureFlag, SignatureScheme } from '../cryptography/signature-scheme.js';\nimport { parseSerializedSignature } from '../cryptography/signature.js';\nimport { normalizeHaneulAddress } from '../utils/haneul-types.js';\nimport { publicKeyFromRawBytes } from '../verify/index.js';\nimport { toZkLoginPublicIdentifier } from '../zklogin/publickey.js';\nimport { MultiSigSigner } from './signer.js';\nimport type { ClientWithCoreApi } from '../client/core.js';\n\ntype CompressedSignature =\n\t| { ED25519: Uint8Array }\n\t| { Secp256k1: Uint8Array }\n\t| { Secp256r1: Uint8Array }\n\t| { ZkLogin: Uint8Array }\n\t| { Passkey: Uint8Array };\n\ntype PublicKeyEnum =\n\t| { ED25519: Uint8Array }\n\t| { Secp256k1: Uint8Array }\n\t| { Secp256r1: Uint8Array }\n\t| { ZkLogin: Uint8Array }\n\t| { Passkey: Uint8Array };\n\ntype PubkeyEnumWeightPair = {\n\tpubKey: PublicKeyEnum;\n\tweight: number;\n};\n\ntype MultiSigPublicKeyStruct = {\n\tpk_map: PubkeyEnumWeightPair[];\n\tthreshold: number;\n};\n\nexport type MultiSigStruct = {\n\tsigs: CompressedSignature[];\n\tbitmap: number;\n\tmultisig_pk: MultiSigPublicKeyStruct;\n};\n\ntype ParsedPartialMultiSigSignature = {\n\tsignatureScheme: SignatureScheme;\n\tsignature: Uint8Array;\n\tpublicKey: PublicKey;\n\tweight: number;\n};\n\nexport const MAX_SIGNER_IN_MULTISIG = 10;\nexport const MIN_SIGNER_IN_MULTISIG = 1;\n/**\n * A MultiSig public key\n */\nexport class MultiSigPublicKey extends PublicKey {\n\tprivate rawBytes: Uint8Array<ArrayBuffer>;\n\tprivate multisigPublicKey: MultiSigPublicKeyStruct;\n\tprivate publicKeys: {\n\t\tweight: number;\n\t\tpublicKey: PublicKey;\n\t}[];\n\t/**\n\t * Create a new MultiSigPublicKey object\n\t */\n\tconstructor(\n\t\t/**\n\t\t * MultiSig public key as buffer or base-64 encoded string\n\t\t */\n\t\tvalue: string | Uint8Array | MultiSigPublicKeyStruct,\n\t\toptions: { client?: ClientWithCoreApi } = {},\n\t) {\n\t\tsuper();\n\n\t\tif (typeof value === 'string') {\n\t\t\tthis.rawBytes = fromBase64(value);\n\n\t\t\tthis.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);\n\t\t} else if (value instanceof Uint8Array) {\n\t\t\tthis.rawBytes = value as Uint8Array<ArrayBuffer>;\n\t\t\tthis.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);\n\t\t} else {\n\t\t\tthis.multisigPublicKey = value;\n\t\t\tthis.rawBytes = bcs.MultiSigPublicKey.serialize(value).toBytes();\n\t\t}\n\t\tif (this.multisigPublicKey.threshold < 1) {\n\t\t\tthrow new Error('Invalid threshold');\n\t\t}\n\n\t\tconst seenPublicKeys = new Set<string>();\n\n\t\tthis.publicKeys = this.multisigPublicKey.pk_map.map(({ pubKey, weight }) => {\n\t\t\tconst [scheme, bytes] = Object.entries(pubKey).filter(([name]) => name !== '$kind')[0] as [\n\t\t\t\tSignatureScheme,\n\t\t\t\tUint8Array,\n\t\t\t];\n\t\t\tconst publicKeyStr = Uint8Array.from(bytes).toString();\n\n\t\t\tif (seenPublicKeys.has(publicKeyStr)) {\n\t\t\t\tthrow new Error(`Multisig does not support duplicate public keys`);\n\t\t\t}\n\t\t\tseenPublicKeys.add(publicKeyStr);\n\n\t\t\tif (weight < 1) {\n\t\t\t\tthrow new Error(`Invalid weight`);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tpublicKey: publicKeyFromRawBytes(scheme, Uint8Array.from(bytes), options),\n\t\t\t\tweight,\n\t\t\t};\n\t\t});\n\n\t\tconst totalWeight = this.publicKeys.reduce((sum, { weight }) => sum + weight, 0);\n\n\t\tif (this.multisigPublicKey.threshold > totalWeight) {\n\t\t\tthrow new Error(`Unreachable threshold`);\n\t\t}\n\n\t\tif (this.publicKeys.length > MAX_SIGNER_IN_MULTISIG) {\n\t\t\tthrow new Error(`Max number of signers in a multisig is ${MAX_SIGNER_IN_MULTISIG}`);\n\t\t}\n\n\t\tif (this.publicKeys.length < MIN_SIGNER_IN_MULTISIG) {\n\t\t\tthrow new Error(`Min number of signers in a multisig is ${MIN_SIGNER_IN_MULTISIG}`);\n\t\t}\n\t}\n\t/**\n\t * \tA static method to create a new MultiSig publickey instance from a set of public keys and their associated weights pairs and threshold.\n\t */\n\n\tstatic fromPublicKeys({\n\t\tthreshold,\n\t\tpublicKeys,\n\t}: {\n\t\tthreshold: number;\n\t\tpublicKeys: { publicKey: PublicKey; weight: number }[];\n\t}) {\n\t\treturn new MultiSigPublicKey({\n\t\t\tpk_map: publicKeys.map(({ publicKey, weight }) => {\n\t\t\t\tconst scheme = SIGNATURE_FLAG_TO_SCHEME[publicKey.flag() as SignatureFlag];\n\n\t\t\t\treturn {\n\t\t\t\t\tpubKey: { [scheme]: publicKey.toRawBytes() } as PublicKeyEnum,\n\t\t\t\t\tweight,\n\t\t\t\t};\n\t\t\t}),\n\t\t\tthreshold,\n\t\t});\n\t}\n\n\t/**\n\t * Checks if two MultiSig public keys are equal\n\t */\n\toverride equals(publicKey: MultiSigPublicKey): boolean {\n\t\treturn super.equals(publicKey);\n\t}\n\n\t/**\n\t * Return the byte array representation of the MultiSig public key\n\t */\n\ttoRawBytes(): Uint8Array<ArrayBuffer> {\n\t\treturn this.rawBytes;\n\t}\n\n\tgetPublicKeys() {\n\t\treturn this.publicKeys;\n\t}\n\n\tgetThreshold() {\n\t\treturn this.multisigPublicKey.threshold;\n\t}\n\n\tgetSigner(...signers: [signer: Signer]) {\n\t\treturn new MultiSigSigner(this, signers);\n\t}\n\n\t/**\n\t * Return the Haneul address associated with this MultiSig public key\n\t */\n\toverride toHaneulAddress(): string {\n\t\t// max length = 1 flag byte + (max pk size + max weight size (u8)) * max signer size + 2 threshold bytes (u16)\n\t\tconst maxLength = 1 + (64 + 1) * MAX_SIGNER_IN_MULTISIG + 2;\n\t\tconst tmp = new Uint8Array(maxLength);\n\t\ttmp.set([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]);\n\n\t\ttmp.set(bcs.u16().serialize(this.multisigPublicKey.threshold).toBytes(), 1);\n\t\t// The initial value 3 ensures that following data will be after the flag byte and threshold bytes\n\t\tlet i = 3;\n\t\tfor (const { publicKey, weight } of this.publicKeys) {\n\t\t\tconst bytes = publicKey.toSuiBytes();\n\t\t\ttmp.set(bytes, i);\n\t\t\ti += bytes.length;\n\t\t\ttmp.set([weight], i++);\n\t\t}\n\t\treturn normalizeHaneulAddress(bytesToHex(blake2b(tmp.slice(0, i), { dkLen: 32 })));\n\t}\n\n\t/**\n\t * Return the Haneul address associated with this MultiSig public key\n\t */\n\tflag(): number {\n\t\treturn SIGNATURE_SCHEME_TO_FLAG['MultiSig'];\n\t}\n\n\t/**\n\t * Verifies that the signature is valid for for the provided message\n\t */\n\tasync verify(message: Uint8Array, multisigSignature: string): Promise<boolean> {\n\t\t// Multisig verification only supports serialized signature\n\t\tconst parsed = parseSerializedSignature(multisigSignature);\n\n\t\tif (parsed.signatureScheme !== 'MultiSig') {\n\t\t\tthrow new Error('Invalid signature scheme');\n\t\t}\n\n\t\tconst { multisig } = parsed;\n\n\t\tlet signatureWeight = 0;\n\n\t\tif (\n\t\t\t!bytesEqual(\n\t\t\t\tbcs.MultiSigPublicKey.serialize(this.multisigPublicKey).toBytes(),\n\t\t\t\tbcs.MultiSigPublicKey.serialize(multisig.multisig_pk).toBytes(),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const { publicKey, weight, signature } of parsePartialSignatures(multisig)) {\n\t\t\tif (!(await publicKey.verify(message, signature))) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tsignatureWeight += weight;\n\t\t}\n\n\t\treturn signatureWeight >= this.multisigPublicKey.threshold;\n\t}\n\n\t/**\n\t * Combines multiple partial signatures into a single multisig, ensuring that each public key signs only once\n\t * and that all the public keys involved are known and valid, and then serializes multisig into the standard format\n\t */\n\tcombinePartialSignatures(signatures: string[]): string {\n\t\tif (signatures.length > MAX_SIGNER_IN_MULTISIG) {\n\t\t\tthrow new Error(`Max number of signatures in a multisig is ${MAX_SIGNER_IN_MULTISIG}`);\n\t\t}\n\n\t\tlet bitmap = 0;\n\t\tconst compressedSignatures: CompressedSignature[] = new Array(signatures.length);\n\n\t\tfor (let i = 0; i < signatures.length; i++) {\n\t\t\tconst parsed = parseSerializedSignature(signatures[i]);\n\t\t\tif (parsed.signatureScheme === 'MultiSig') {\n\t\t\t\tthrow new Error('MultiSig is not supported inside MultiSig');\n\t\t\t}\n\n\t\t\tlet publicKey;\n\t\t\tif (parsed.signatureScheme === 'ZkLogin') {\n\t\t\t\tpublicKey = toZkLoginPublicIdentifier(parsed.zkLogin?.addressSeed, parsed.zkLogin?.iss, {\n\t\t\t\t\tlegacyAddress: false,\n\t\t\t\t}).toRawBytes();\n\t\t\t} else {\n\t\t\t\tpublicKey = parsed.publicKey;\n\t\t\t}\n\n\t\t\tcompressedSignatures[i] = {\n\t\t\t\t[parsed.signatureScheme]: parsed.signature,\n\t\t\t} as CompressedSignature;\n\n\t\t\tlet publicKeyIndex;\n\t\t\tfor (let j = 0; j < this.publicKeys.length; j++) {\n\t\t\t\tif (bytesEqual(publicKey, this.publicKeys[j].publicKey.toRawBytes())) {\n\t\t\t\t\tif (bitmap & (1 << j)) {\n\t\t\t\t\t\tthrow new Error('Received multiple signatures from the same public key');\n\t\t\t\t\t}\n\n\t\t\t\t\tpublicKeyIndex = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (publicKeyIndex === undefined) {\n\t\t\t\tthrow new Error('Received signature from unknown public key');\n\t\t\t}\n\n\t\t\tbitmap |= 1 << publicKeyIndex;\n\t\t}\n\n\t\tconst multisig: MultiSigStruct = {\n\t\t\tsigs: compressedSignatures,\n\t\t\tbitmap,\n\t\t\tmultisig_pk: this.multisigPublicKey,\n\t\t};\n\t\tconst bytes = bcs.MultiSig.serialize(multisig, { maxSize: 8192 }).toBytes();\n\t\tconst tmp = new Uint8Array(bytes.length + 1);\n\t\ttmp.set([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]);\n\t\ttmp.set(bytes, 1);\n\t\treturn toBase64(tmp);\n\t}\n}\n\n/**\n * Parse multisig structure into an array of individual signatures: signature scheme, the actual individual signature, public key and its weight.\n */\nexport function parsePartialSignatures(\n\tmultisig: MultiSigStruct,\n\toptions: { client?: ClientWithCoreApi } = {},\n): ParsedPartialMultiSigSignature[] {\n\tconst res: ParsedPartialMultiSigSignature[] = new Array(multisig.sigs.length);\n\tfor (let i = 0; i < multisig.sigs.length; i++) {\n\t\tconst [signatureScheme, signature] = Object.entries(multisig.sigs[i]).filter(\n\t\t\t([name]) => name !== '$kind',\n\t\t)[0] as [SignatureScheme, Uint8Array];\n\t\tconst pkIndex = asIndices(multisig.bitmap).at(i)!;\n\t\tconst pair = multisig.multisig_pk.pk_map[pkIndex];\n\t\tconst pkBytes = Uint8Array.from(Object.values(pair.pubKey)[0]);\n\n\t\tif (signatureScheme === 'MultiSig') {\n\t\t\tthrow new Error('MultiSig is not supported inside MultiSig');\n\t\t}\n\n\t\tconst publicKey = publicKeyFromRawBytes(signatureScheme, pkBytes, options);\n\n\t\tres[i] = {\n\t\t\tsignatureScheme,\n\t\t\tsignature: Uint8Array.from(signature),\n\t\t\tpublicKey: publicKey,\n\t\t\tweight: pair.weight,\n\t\t};\n\t}\n\treturn res;\n}\n\nfunction asIndices(bitmap: number): Uint8Array {\n\tif (bitmap < 0 || bitmap > 1024) {\n\t\tthrow new Error('Invalid bitmap');\n\t}\n\tconst res: number[] = [];\n\tfor (let i = 0; i < 10; i++) {\n\t\tif ((bitmap & (1 << i)) !== 0) {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n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase64, toBase64 } from '@haneullabs/bcs';\nimport { blake2b } from '@noble/hashes/blake2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\n\nimport { bcs } from '../bcs/index.js';\nimport type { Signer } from '../cryptography/keypair.js';\nimport { bytesEqual, PublicKey } from '../cryptography/publickey.js';\nimport {\n\tSIGNATURE_FLAG_TO_SCHEME,\n\tSIGNATURE_SCHEME_TO_FLAG,\n} from '../cryptography/signature-scheme.js';\nimport type { SignatureFlag, SignatureScheme } from '../cryptography/signature-scheme.js';\nimport { parseSerializedSignature } from '../cryptography/signature.js';\nimport { normalizeHaneulAddress } from '../utils/haneul-types.js';\nimport { publicKeyFromRawBytes } from '../verify/index.js';\nimport { toZkLoginPublicIdentifier } from '../zklogin/publickey.js';\nimport { MultiSigSigner } from './signer.js';\nimport type { ClientWithCoreApi } from '../client/core.js';\n\ntype CompressedSignature =\n\t| { ED25519: Uint8Array }\n\t| { Secp256k1: Uint8Array }\n\t| { Secp256r1: Uint8Array }\n\t| { ZkLogin: Uint8Array }\n\t| { Passkey: Uint8Array };\n\ntype PublicKeyEnum =\n\t| { ED25519: Uint8Array }\n\t| { Secp256k1: Uint8Array }\n\t| { Secp256r1: Uint8Array }\n\t| { ZkLogin: Uint8Array }\n\t| { Passkey: Uint8Array };\n\ntype PubkeyEnumWeightPair = {\n\tpubKey: PublicKeyEnum;\n\tweight: number;\n};\n\ntype MultiSigPublicKeyStruct = {\n\tpk_map: PubkeyEnumWeightPair[];\n\tthreshold: number;\n};\n\nexport type MultiSigStruct = {\n\tsigs: CompressedSignature[];\n\tbitmap: number;\n\tmultisig_pk: MultiSigPublicKeyStruct;\n};\n\ntype ParsedPartialMultiSigSignature = {\n\tsignatureScheme: SignatureScheme;\n\tsignature: Uint8Array;\n\tpublicKey: PublicKey;\n\tweight: number;\n};\n\nexport const MAX_SIGNER_IN_MULTISIG = 10;\nexport const MIN_SIGNER_IN_MULTISIG = 1;\n/**\n * A MultiSig public key\n */\nexport class MultiSigPublicKey extends PublicKey {\n\tprivate rawBytes: Uint8Array<ArrayBuffer>;\n\tprivate multisigPublicKey: MultiSigPublicKeyStruct;\n\tprivate publicKeys: {\n\t\tweight: number;\n\t\tpublicKey: PublicKey;\n\t}[];\n\t/**\n\t * Create a new MultiSigPublicKey object\n\t */\n\tconstructor(\n\t\t/**\n\t\t * MultiSig public key as buffer or base-64 encoded string\n\t\t */\n\t\tvalue: string | Uint8Array | MultiSigPublicKeyStruct,\n\t\toptions: { client?: ClientWithCoreApi } = {},\n\t) {\n\t\tsuper();\n\n\t\tif (typeof value === 'string') {\n\t\t\tthis.rawBytes = fromBase64(value);\n\n\t\t\tthis.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);\n\t\t} else if (value instanceof Uint8Array) {\n\t\t\tthis.rawBytes = value as Uint8Array<ArrayBuffer>;\n\t\t\tthis.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);\n\t\t} else {\n\t\t\tthis.multisigPublicKey = value;\n\t\t\tthis.rawBytes = bcs.MultiSigPublicKey.serialize(value).toBytes();\n\t\t}\n\t\tif (this.multisigPublicKey.threshold < 1) {\n\t\t\tthrow new Error('Invalid threshold');\n\t\t}\n\n\t\tconst seenPublicKeys = new Set<string>();\n\n\t\tthis.publicKeys = this.multisigPublicKey.pk_map.map(({ pubKey, weight }) => {\n\t\t\tconst [scheme, bytes] = Object.entries(pubKey).filter(([name]) => name !== '$kind')[0] as [\n\t\t\t\tSignatureScheme,\n\t\t\t\tUint8Array,\n\t\t\t];\n\t\t\tconst publicKeyStr = Uint8Array.from(bytes).toString();\n\n\t\t\tif (seenPublicKeys.has(publicKeyStr)) {\n\t\t\t\tthrow new Error(`Multisig does not support duplicate public keys`);\n\t\t\t}\n\t\t\tseenPublicKeys.add(publicKeyStr);\n\n\t\t\tif (weight < 1) {\n\t\t\t\tthrow new Error(`Invalid weight`);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tpublicKey: publicKeyFromRawBytes(scheme, Uint8Array.from(bytes), options),\n\t\t\t\tweight,\n\t\t\t};\n\t\t});\n\n\t\tconst totalWeight = this.publicKeys.reduce((sum, { weight }) => sum + weight, 0);\n\n\t\tif (this.multisigPublicKey.threshold > totalWeight) {\n\t\t\tthrow new Error(`Unreachable threshold`);\n\t\t}\n\n\t\tif (this.publicKeys.length > MAX_SIGNER_IN_MULTISIG) {\n\t\t\tthrow new Error(`Max number of signers in a multisig is ${MAX_SIGNER_IN_MULTISIG}`);\n\t\t}\n\n\t\tif (this.publicKeys.length < MIN_SIGNER_IN_MULTISIG) {\n\t\t\tthrow new Error(`Min number of signers in a multisig is ${MIN_SIGNER_IN_MULTISIG}`);\n\t\t}\n\t}\n\t/**\n\t * \tA static method to create a new MultiSig publickey instance from a set of public keys and their associated weights pairs and threshold.\n\t */\n\n\tstatic fromPublicKeys({\n\t\tthreshold,\n\t\tpublicKeys,\n\t}: {\n\t\tthreshold: number;\n\t\tpublicKeys: { publicKey: PublicKey; weight: number }[];\n\t}) {\n\t\treturn new MultiSigPublicKey({\n\t\t\tpk_map: publicKeys.map(({ publicKey, weight }) => {\n\t\t\t\tconst scheme = SIGNATURE_FLAG_TO_SCHEME[publicKey.flag() as SignatureFlag];\n\n\t\t\t\treturn {\n\t\t\t\t\tpubKey: { [scheme]: publicKey.toRawBytes() } as PublicKeyEnum,\n\t\t\t\t\tweight,\n\t\t\t\t};\n\t\t\t}),\n\t\t\tthreshold,\n\t\t});\n\t}\n\n\t/**\n\t * Checks if two MultiSig public keys are equal\n\t */\n\toverride equals(publicKey: MultiSigPublicKey): boolean {\n\t\treturn super.equals(publicKey);\n\t}\n\n\t/**\n\t * Return the byte array representation of the MultiSig public key\n\t */\n\ttoRawBytes(): Uint8Array<ArrayBuffer> {\n\t\treturn this.rawBytes;\n\t}\n\n\tgetPublicKeys() {\n\t\treturn this.publicKeys;\n\t}\n\n\tgetThreshold() {\n\t\treturn this.multisigPublicKey.threshold;\n\t}\n\n\tgetSigner(...signers: [signer: Signer]) {\n\t\treturn new MultiSigSigner(this, signers);\n\t}\n\n\t/**\n\t * Return the Haneul address associated with this MultiSig public key\n\t */\n\toverride toHaneulAddress(): string {\n\t\t// max length = 1 flag byte + (max pk size + max weight size (u8)) * max signer size + 2 threshold bytes (u16)\n\t\tconst maxLength = 1 + (64 + 1) * MAX_SIGNER_IN_MULTISIG + 2;\n\t\tconst tmp = new Uint8Array(maxLength);\n\t\ttmp.set([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]);\n\n\t\ttmp.set(bcs.u16().serialize(this.multisigPublicKey.threshold).toBytes(), 1);\n\t\t// The initial value 3 ensures that following data will be after the flag byte and threshold bytes\n\t\tlet i = 3;\n\t\tfor (const { publicKey, weight } of this.publicKeys) {\n\t\t\tconst bytes = publicKey.toHaneulBytes();\n\t\t\ttmp.set(bytes, i);\n\t\t\ti += bytes.length;\n\t\t\ttmp.set([weight], i++);\n\t\t}\n\t\treturn normalizeHaneulAddress(bytesToHex(blake2b(tmp.slice(0, i), { dkLen: 32 })));\n\t}\n\n\t/**\n\t * Return the Haneul address associated with this MultiSig public key\n\t */\n\tflag(): number {\n\t\treturn SIGNATURE_SCHEME_TO_FLAG['MultiSig'];\n\t}\n\n\t/**\n\t * Verifies that the signature is valid for for the provided message\n\t */\n\tasync verify(message: Uint8Array, multisigSignature: string): Promise<boolean> {\n\t\t// Multisig verification only supports serialized signature\n\t\tconst parsed = parseSerializedSignature(multisigSignature);\n\n\t\tif (parsed.signatureScheme !== 'MultiSig') {\n\t\t\tthrow new Error('Invalid signature scheme');\n\t\t}\n\n\t\tconst { multisig } = parsed;\n\n\t\tlet signatureWeight = 0;\n\n\t\tif (\n\t\t\t!bytesEqual(\n\t\t\t\tbcs.MultiSigPublicKey.serialize(this.multisigPublicKey).toBytes(),\n\t\t\t\tbcs.MultiSigPublicKey.serialize(multisig.multisig_pk).toBytes(),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const { publicKey, weight, signature } of parsePartialSignatures(multisig)) {\n\t\t\tif (!(await publicKey.verify(message, signature))) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tsignatureWeight += weight;\n\t\t}\n\n\t\treturn signatureWeight >= this.multisigPublicKey.threshold;\n\t}\n\n\t/**\n\t * Combines multiple partial signatures into a single multisig, ensuring that each public key signs only once\n\t * and that all the public keys involved are known and valid, and then serializes multisig into the standard format\n\t */\n\tcombinePartialSignatures(signatures: string[]): string {\n\t\tif (signatures.length > MAX_SIGNER_IN_MULTISIG) {\n\t\t\tthrow new Error(`Max number of signatures in a multisig is ${MAX_SIGNER_IN_MULTISIG}`);\n\t\t}\n\n\t\tlet bitmap = 0;\n\t\tconst compressedSignatures: CompressedSignature[] = new Array(signatures.length);\n\n\t\tfor (let i = 0; i < signatures.length; i++) {\n\t\t\tconst parsed = parseSerializedSignature(signatures[i]);\n\t\t\tif (parsed.signatureScheme === 'MultiSig') {\n\t\t\t\tthrow new Error('MultiSig is not supported inside MultiSig');\n\t\t\t}\n\n\t\t\tlet publicKey;\n\t\t\tif (parsed.signatureScheme === 'ZkLogin') {\n\t\t\t\tpublicKey = toZkLoginPublicIdentifier(parsed.zkLogin?.addressSeed, parsed.zkLogin?.iss, {\n\t\t\t\t\tlegacyAddress: false,\n\t\t\t\t}).toRawBytes();\n\t\t\t} else {\n\t\t\t\tpublicKey = parsed.publicKey;\n\t\t\t}\n\n\t\t\tcompressedSignatures[i] = {\n\t\t\t\t[parsed.signatureScheme]: parsed.signature,\n\t\t\t} as CompressedSignature;\n\n\t\t\tlet publicKeyIndex;\n\t\t\tfor (let j = 0; j < this.publicKeys.length; j++) {\n\t\t\t\tif (bytesEqual(publicKey, this.publicKeys[j].publicKey.toRawBytes())) {\n\t\t\t\t\tif (bitmap & (1 << j)) {\n\t\t\t\t\t\tthrow new Error('Received multiple signatures from the same public key');\n\t\t\t\t\t}\n\n\t\t\t\t\tpublicKeyIndex = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (publicKeyIndex === undefined) {\n\t\t\t\tthrow new Error('Received signature from unknown public key');\n\t\t\t}\n\n\t\t\tbitmap |= 1 << publicKeyIndex;\n\t\t}\n\n\t\tconst multisig: MultiSigStruct = {\n\t\t\tsigs: compressedSignatures,\n\t\t\tbitmap,\n\t\t\tmultisig_pk: this.multisigPublicKey,\n\t\t};\n\t\tconst bytes = bcs.MultiSig.serialize(multisig, { maxSize: 8192 }).toBytes();\n\t\tconst tmp = new Uint8Array(bytes.length + 1);\n\t\ttmp.set([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]);\n\t\ttmp.set(bytes, 1);\n\t\treturn toBase64(tmp);\n\t}\n}\n\n/**\n * Parse multisig structure into an array of individual signatures: signature scheme, the actual individual signature, public key and its weight.\n */\nexport function parsePartialSignatures(\n\tmultisig: MultiSigStruct,\n\toptions: { client?: ClientWithCoreApi } = {},\n): ParsedPartialMultiSigSignature[] {\n\tconst res: ParsedPartialMultiSigSignature[] = new Array(multisig.sigs.length);\n\tfor (let i = 0; i < multisig.sigs.length; i++) {\n\t\tconst [signatureScheme, signature] = Object.entries(multisig.sigs[i]).filter(\n\t\t\t([name]) => name !== '$kind',\n\t\t)[0] as [SignatureScheme, Uint8Array];\n\t\tconst pkIndex = asIndices(multisig.bitmap).at(i)!;\n\t\tconst pair = multisig.multisig_pk.pk_map[pkIndex];\n\t\tconst pkBytes = Uint8Array.from(Object.values(pair.pubKey)[0]);\n\n\t\tif (signatureScheme === 'MultiSig') {\n\t\t\tthrow new Error('MultiSig is not supported inside MultiSig');\n\t\t}\n\n\t\tconst publicKey = publicKeyFromRawBytes(signatureScheme, pkBytes, options);\n\n\t\tres[i] = {\n\t\t\tsignatureScheme,\n\t\t\tsignature: Uint8Array.from(signature),\n\t\t\tpublicKey: publicKey,\n\t\t\tweight: pair.weight,\n\t\t};\n\t}\n\treturn res;\n}\n\nfunction asIndices(bitmap: number): Uint8Array {\n\tif (bitmap < 0 || bitmap > 1024) {\n\t\tthrow new Error('Invalid bitmap');\n\t}\n\tconst res: number[] = [];\n\tfor (let i = 0; i < 10; i++) {\n\t\tif ((bitmap & (1 << i)) !== 0) {\n\t\t\tres.push(i);\n\t\t}\n\t}\n\treturn Uint8Array.from(res);\n}\n"],"mappings":";;;;;;;;;;;;;AA2DA,MAAa,yBAAyB;AACtC,MAAa,yBAAyB;;;;AAItC,IAAa,oBAAb,MAAa,0BAA0B,UAAU;;;;CAUhD,YAIC,OACA,UAA0C,EAAE,EAC3C;AACD,SAAO;AAEP,MAAI,OAAO,UAAU,UAAU;AAC9B,QAAK,WAAW,WAAW,MAAM;AAEjC,QAAK,oBAAoBA,UAAI,kBAAkB,MAAM,KAAK,SAAS;aACzD,iBAAiB,YAAY;AACvC,QAAK,WAAW;AAChB,QAAK,oBAAoBA,UAAI,kBAAkB,MAAM,KAAK,SAAS;SAC7D;AACN,QAAK,oBAAoB;AACzB,QAAK,WAAWA,UAAI,kBAAkB,UAAU,MAAM,CAAC,SAAS;;AAEjE,MAAI,KAAK,kBAAkB,YAAY,EACtC,OAAM,IAAI,MAAM,oBAAoB;EAGrC,MAAM,iCAAiB,IAAI,KAAa;AAExC,OAAK,aAAa,KAAK,kBAAkB,OAAO,KAAK,EAAE,QAAQ,aAAa;GAC3E,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,OAAO,CAAC,QAAQ,CAAC,UAAU,SAAS,QAAQ,CAAC;GAIpF,MAAM,eAAe,WAAW,KAAK,MAAM,CAAC,UAAU;AAEtD,OAAI,eAAe,IAAI,aAAa,CACnC,OAAM,IAAI,MAAM,kDAAkD;AAEnE,kBAAe,IAAI,aAAa;AAEhC,OAAI,SAAS,EACZ,OAAM,IAAI,MAAM,iBAAiB;AAGlC,UAAO;IACN,WAAW,sBAAsB,QAAQ,WAAW,KAAK,MAAM,EAAE,QAAQ;IACzE;IACA;IACA;EAEF,MAAM,cAAc,KAAK,WAAW,QAAQ,KAAK,EA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b,QAAO,WAAW,KAAK,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.mts","names":[],"sources":["../../src/multisig/signer.ts"],"
|
|
1
|
+
{"version":3,"file":"signer.d.mts","names":[],"sources":["../../src/multisig/signer.ts"],"mappings":";;;;;;cAQa,cAAA,SAAuB,MAAA;EAAA;cAIvB,MAAA,EAAQ,iBAAA,EAAmB,OAAA,GAAS,MAAA;EAkChD,YAAA,CAAA,GAAgB,eAAA;EAIhB,YAAA,CAAA,GAAgB,iBAAA;EAIhB,IAAA,CAAK,KAAA,EAAO,UAAA;EAMN,eAAA,CAAgB,KAAA,EAAO,UAAA,GAAU,OAAA;;;;EAajC,mBAAA,CAAoB,KAAA,EAAO,UAAA,GAAU,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arguments.d.mts","names":[],"sources":["../../src/transactions/Arguments.ts"],"
|
|
1
|
+
{"version":3,"file":"Arguments.d.mts","names":[],"sources":["../../src/transactions/Arguments.ts"],"mappings":";;;;;cASa,SAAA;QAC0E,UAAA,QAC9E,UAAA,EAAY,EAAA,EAAI,WAAA,KAAgB,QAAA;;YADwD,sBAAA;;;;;;;;;;;;;;;SAiBggB,EAAA,EAAA,WAAA,KAAe,iBAAA;EAAA;;;;;SAX7mB,EAAA,EAAI,WAAA;;;;;;;;;SAIJ,EAAA,EAAI,WAAA;;;;;;;;;SAIJ,EAAA,EAAI,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Commands.d.mts","names":[],"sources":["../../src/transactions/Commands.ts"],"
|
|
1
|
+
{"version":3,"file":"Commands.d.mts","names":[],"sources":["../../src/transactions/Commands.ts"],"mappings":";;;;;KAYY,mBAAA,GACT,UAAA,QAAkB,cAAA,MAChB,EAAA,EAAI,WAAA,KAAgB,UAAA,QAAkB,cAAA,KACxC,qBAAA;AAAA,KACS,gBAAA,GAAmB,OAAA;AAAA,aAInB,aAAA;EACX,UAAA;EACA,QAAA;EACA,QAAA;AAAA;AAAA,KAGI,gBAAA,WAA2B,OAAA;EAAsB,KAAA,EAAO,CAAA;AAAA,YACtD,CAAA,GAAI,OAAA,CAAQ,OAAA,UAAiB,CAAA,UAAW,CAAA;;;;cAMlC,mBAAA;;IAIR,OAAA;IACA,MAAA;IACA,QAAA;IACA,SAAA,GAAY,QAAA;IACZ,aAAA;EAAA;IAGA,MAAA;IACA,SAAA,GAAY,QAAA;IACZ,aAAA;EAAA,IAED,gBAAA;2BAiBO,UAAA,QAAkB,cAAA,KAAiB,OAAA,EACnC,UAAA,QAAkB,cAAA,IACzB,gBAAA;mBAUI,UAAA,QAAkB,cAAA,GAAe,OAAA,EAC9B,UAAA,QAAkB,cAAA,MACzB,gBAAA;0BAUW,UAAA,QAAkB,cAAA,GAAe,OAAA,EACrC,UAAA,QAAkB,cAAA,MACzB,gBAAA;;;;;IAaF,OAAA;IACA,YAAA;EAAA,IACG,gBAAA;;;;;;;IAiBH,OAAA;IACA,YAAA;IACA,OAAA;IACA,MAAA,EAAQ,UAAA,QAAkB,cAAA;EAAA,IACvB,gBAAA;;;;;IAiBH,IAAA;IACA,QAAA,EAAU,UAAA,QAAkB,cAAA;EAAA,IACzB,gBAAA;;;;;;IAcH,IAAA;IACA,MAAA,GAAS,MAAA,SAER,UAAA,QAAkB,cAAA,IAAkB,UAAA,QAAkB,cAAA;IAEvD,IAAA,GAAO,MAAA;EAAA,IACJ,gBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Commands.mjs","names":[],"sources":["../../src/transactions/Commands.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toBase64 } from '@haneullabs/bcs';\nimport type { InferInput } from 'valibot';\nimport { parse } from 'valibot';\n\nimport { normalizeHaneulObjectId } from '../utils/haneul-types.js';\nimport type { Argument, CallArg, Command } from './data/internal.js';\nimport { ArgumentSchema } from './data/internal.js';\nimport type { AsyncTransactionThunk, Transaction } from './Transaction.js';\n\nexport type TransactionArgument =\n\t| InferInput<typeof ArgumentSchema>\n\t| ((tx: Transaction) => InferInput<typeof ArgumentSchema>)\n\t| AsyncTransactionThunk;\nexport type TransactionInput = CallArg;\n\n// Keep in sync with constants in\n//
|
|
1
|
+
{"version":3,"file":"Commands.mjs","names":[],"sources":["../../src/transactions/Commands.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toBase64 } from '@haneullabs/bcs';\nimport type { InferInput } from 'valibot';\nimport { parse } from 'valibot';\n\nimport { normalizeHaneulObjectId } from '../utils/haneul-types.js';\nimport type { Argument, CallArg, Command } from './data/internal.js';\nimport { ArgumentSchema } from './data/internal.js';\nimport type { AsyncTransactionThunk, Transaction } from './Transaction.js';\n\nexport type TransactionArgument =\n\t| InferInput<typeof ArgumentSchema>\n\t| ((tx: Transaction) => InferInput<typeof ArgumentSchema>)\n\t| AsyncTransactionThunk;\nexport type TransactionInput = CallArg;\n\n// Keep in sync with constants in\n// crates/haneul-framework/packages/haneul-framework/sources/package.move\nexport enum UpgradePolicy {\n\tCOMPATIBLE = 0,\n\tADDITIVE = 128,\n\tDEP_ONLY = 192,\n}\n\ntype TransactionShape<T extends Command['$kind']> = { $kind: T } & {\n\t[K in T]: Extract<Command, { [K in T]: any }>[T];\n};\n\n/**\n * Simple helpers used to construct transactions:\n */\nexport const TransactionCommands = {\n\tMoveCall(\n\t\tinput:\n\t\t\t| {\n\t\t\t\t\tpackage: string;\n\t\t\t\t\tmodule: string;\n\t\t\t\t\tfunction: string;\n\t\t\t\t\targuments?: Argument[];\n\t\t\t\t\ttypeArguments?: string[];\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\ttarget: string;\n\t\t\t\t\targuments?: Argument[];\n\t\t\t\t\ttypeArguments?: string[];\n\t\t\t },\n\t): TransactionShape<'MoveCall'> {\n\t\tconst [pkg, mod = '', fn = ''] =\n\t\t\t'target' in input ? input.target.split('::') : [input.package, input.module, input.function];\n\n\t\treturn {\n\t\t\t$kind: 'MoveCall',\n\t\t\tMoveCall: {\n\t\t\t\tpackage: pkg,\n\t\t\t\tmodule: mod,\n\t\t\t\tfunction: fn,\n\t\t\t\ttypeArguments: input.typeArguments ?? [],\n\t\t\t\targuments: input.arguments ?? [],\n\t\t\t},\n\t\t};\n\t},\n\n\tTransferObjects(\n\t\tobjects: InferInput<typeof ArgumentSchema>[],\n\t\taddress: InferInput<typeof ArgumentSchema>,\n\t): TransactionShape<'TransferObjects'> {\n\t\treturn {\n\t\t\t$kind: 'TransferObjects',\n\t\t\tTransferObjects: {\n\t\t\t\tobjects: objects.map((o) => parse(ArgumentSchema, o)),\n\t\t\t\taddress: parse(ArgumentSchema, address),\n\t\t\t},\n\t\t};\n\t},\n\tSplitCoins(\n\t\tcoin: InferInput<typeof ArgumentSchema>,\n\t\tamounts: InferInput<typeof ArgumentSchema>[],\n\t): TransactionShape<'SplitCoins'> {\n\t\treturn {\n\t\t\t$kind: 'SplitCoins',\n\t\t\tSplitCoins: {\n\t\t\t\tcoin: parse(ArgumentSchema, coin),\n\t\t\t\tamounts: amounts.map((o) => parse(ArgumentSchema, o)),\n\t\t\t},\n\t\t};\n\t},\n\tMergeCoins(\n\t\tdestination: InferInput<typeof ArgumentSchema>,\n\t\tsources: InferInput<typeof ArgumentSchema>[],\n\t): TransactionShape<'MergeCoins'> {\n\t\treturn {\n\t\t\t$kind: 'MergeCoins',\n\t\t\tMergeCoins: {\n\t\t\t\tdestination: parse(ArgumentSchema, destination),\n\t\t\t\tsources: sources.map((o) => parse(ArgumentSchema, o)),\n\t\t\t},\n\t\t};\n\t},\n\tPublish({\n\t\tmodules,\n\t\tdependencies,\n\t}: {\n\t\tmodules: number[][] | string[];\n\t\tdependencies: string[];\n\t}): TransactionShape<'Publish'> {\n\t\treturn {\n\t\t\t$kind: 'Publish',\n\t\t\tPublish: {\n\t\t\t\tmodules: modules.map((module) =>\n\t\t\t\t\ttypeof module === 'string' ? module : toBase64(new Uint8Array(module)),\n\t\t\t\t),\n\t\t\t\tdependencies: dependencies.map((dep) => normalizeHaneulObjectId(dep)),\n\t\t\t},\n\t\t};\n\t},\n\tUpgrade({\n\t\tmodules,\n\t\tdependencies,\n\t\tpackage: packageId,\n\t\tticket,\n\t}: {\n\t\tmodules: number[][] | string[];\n\t\tdependencies: string[];\n\t\tpackage: string;\n\t\tticket: InferInput<typeof ArgumentSchema>;\n\t}): TransactionShape<'Upgrade'> {\n\t\treturn {\n\t\t\t$kind: 'Upgrade',\n\t\t\tUpgrade: {\n\t\t\t\tmodules: modules.map((module) =>\n\t\t\t\t\ttypeof module === 'string' ? module : toBase64(new Uint8Array(module)),\n\t\t\t\t),\n\t\t\t\tdependencies: dependencies.map((dep) => normalizeHaneulObjectId(dep)),\n\t\t\t\tpackage: packageId,\n\t\t\t\tticket: parse(ArgumentSchema, ticket),\n\t\t\t},\n\t\t};\n\t},\n\tMakeMoveVec({\n\t\ttype,\n\t\telements,\n\t}: {\n\t\ttype?: string;\n\t\telements: InferInput<typeof ArgumentSchema>[];\n\t}): TransactionShape<'MakeMoveVec'> {\n\t\treturn {\n\t\t\t$kind: 'MakeMoveVec',\n\t\t\tMakeMoveVec: {\n\t\t\t\ttype: type ?? null,\n\t\t\t\telements: elements.map((o) => parse(ArgumentSchema, o)),\n\t\t\t},\n\t\t};\n\t},\n\tIntent({\n\t\tname,\n\t\tinputs = {},\n\t\tdata = {},\n\t}: {\n\t\tname: string;\n\t\tinputs?: Record<\n\t\t\tstring,\n\t\t\tInferInput<typeof ArgumentSchema> | InferInput<typeof ArgumentSchema>[]\n\t\t>;\n\t\tdata?: Record<string, unknown>;\n\t}): TransactionShape<'$Intent'> {\n\t\treturn {\n\t\t\t$kind: '$Intent',\n\t\t\t$Intent: {\n\t\t\t\tname,\n\t\t\t\tinputs: Object.fromEntries(\n\t\t\t\t\tObject.entries(inputs).map(([key, value]) => [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tArray.isArray(value)\n\t\t\t\t\t\t\t? value.map((o) => parse(ArgumentSchema, o))\n\t\t\t\t\t\t\t: parse(ArgumentSchema, value),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tdata,\n\t\t\t},\n\t\t};\n\t},\n};\n"],"mappings":";;;;;;AAoBA,IAAY,0DAAL;AACN;AACA;AACA;;;;;;AAUD,MAAa,sBAAsB;CAClC,SACC,OAa+B;EAC/B,MAAM,CAAC,KAAK,MAAM,IAAI,KAAK,MAC1B,YAAY,QAAQ,MAAM,OAAO,MAAM,KAAK,GAAG;GAAC,MAAM;GAAS,MAAM;GAAQ,MAAM;GAAS;AAE7F,SAAO;GACN,OAAO;GACP,UAAU;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,eAAe,MAAM,iBAAiB,EAAE;IACxC,WAAW,MAAM,aAAa,EAAE;IAChC;GACD;;CAGF,gBACC,SACA,SACsC;AACtC,SAAO;GACN,OAAO;GACP,iBAAiB;IAChB,SAAS,QAAQ,KAAK,MAAM,MAAM,gBAAgB,EAAE,CAAC;IACrD,SAAS,MAAM,gBAAgB,QAAQ;IACvC;GACD;;CAEF,WACC,MACA,SACiC;AACjC,SAAO;GACN,OAAO;GACP,YAAY;IACX,MAAM,MAAM,gBAAgB,KAAK;IACjC,SAAS,QAAQ,KAAK,MAAM,MAAM,gBAAgB,EAAE,CAAC;IACrD;GACD;;CAEF,WACC,aACA,SACiC;AACjC,SAAO;GACN,OAAO;GACP,YAAY;IACX,aAAa,MAAM,gBAAgB,YAAY;IAC/C,SAAS,QAAQ,KAAK,MAAM,MAAM,gBAAgB,EAAE,CAAC;IACrD;GACD;;CAEF,QAAQ,EACP,SACA,gBAI+B;AAC/B,SAAO;GACN,OAAO;GACP,SAAS;IACR,SAAS,QAAQ,KAAK,WACrB,OAAO,WAAW,WAAW,SAAS,SAAS,IAAI,WAAW,OAAO,CAAC,CACtE;IACD,cAAc,aAAa,KAAK,QAAQ,wBAAwB,IAAI,CAAC;IACrE;GACD;;CAEF,QAAQ,EACP,SACA,cACA,SAAS,WACT,UAM+B;AAC/B,SAAO;GACN,OAAO;GACP,SAAS;IACR,SAAS,QAAQ,KAAK,WACrB,OAAO,WAAW,WAAW,SAAS,SAAS,IAAI,WAAW,OAAO,CAAC,CACtE;IACD,cAAc,aAAa,KAAK,QAAQ,wBAAwB,IAAI,CAAC;IACrE,SAAS;IACT,QAAQ,MAAM,gBAAgB,OAAO;IACrC;GACD;;CAEF,YAAY,EACX,MACA,YAImC;AACnC,SAAO;GACN,OAAO;GACP,aAAa;IACZ,MAAM,QAAQ;IACd,UAAU,SAAS,KAAK,MAAM,MAAM,gBAAgB,EAAE,CAAC;IACvD;GACD;;CAEF,OAAO,EACN,MACA,SAAS,EAAE,EACX,OAAO,EAAE,IAQsB;AAC/B,SAAO;GACN,OAAO;GACP,SAAS;IACR;IACA,QAAQ,OAAO,YACd,OAAO,QAAQ,OAAO,CAAC,KAAK,CAAC,KAAK,WAAW,CAC5C,KACA,MAAM,QAAQ,MAAM,GACjB,MAAM,KAAK,MAAM,MAAM,gBAAgB,EAAE,CAAC,GAC1C,MAAM,gBAAgB,MAAM,CAC/B,CAAC,CACF;IACD;IACA;GACD;;CAEF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Inputs.d.mts","names":[],"sources":["../../src/transactions/Inputs.ts"],"
|
|
1
|
+
{"version":3,"file":"Inputs.d.mts","names":[],"sources":["../../src/transactions/Inputs.ts"],"mappings":";;;;iBAeS,IAAA,CAAK,IAAA,EAAM,UAAA,GAAa,aAAA,QAAqB,OAAA,CAAQ,OAAA;EAAW,IAAA;AAAA;AAAA,cAS5D,MAAA;;;;;;KAE6B,SAAA,GAAY,OAAA,CAAQ,OAAA;IAAW,MAAA;EAAA;;;;;;IAkBvE,QAAA;IACA,OAAA;IACA,oBAAA;EAAA,IACG,OAAA,CAAQ,OAAA;IAAW,MAAA;EAAA;;;;;KAaqB,SAAA,GAAY,OAAA,CAAQ,OAAA;IAAW,MAAA;EAAA;;;;;;IAkB1E,WAAA,EAAa,WAAA;IACb,OAAA,EAAS,iBAAA;IACT,YAAA,EAAc,YAAA;EAAA,IACX,OAAA,CAAQ,OAAA;IAAW,eAAA;EAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bcs as
|
|
1
|
+
import { bcs as haneulBcs } from "../bcs/index.mjs";
|
|
2
2
|
import { HaneulClientTypes } from "../client/types.mjs";
|
|
3
3
|
import { TransactionPlugin } from "./resolve.mjs";
|
|
4
4
|
|
|
@@ -55,7 +55,7 @@ declare abstract class AsyncCache {
|
|
|
55
55
|
}
|
|
56
56
|
interface ObjectCacheOptions {
|
|
57
57
|
cache?: AsyncCache;
|
|
58
|
-
onEffects?: (effects: typeof
|
|
58
|
+
onEffects?: (effects: typeof haneulBcs.TransactionEffects.$inferType) => Promise<void>;
|
|
59
59
|
}
|
|
60
60
|
declare class ObjectCache {
|
|
61
61
|
#private;
|
|
@@ -77,7 +77,7 @@ declare class ObjectCache {
|
|
|
77
77
|
getCustom<T>(key: string): Promise<T | null>;
|
|
78
78
|
setCustom<T>(key: string, value: T): Promise<void>;
|
|
79
79
|
deleteCustom(key: string): Promise<void>;
|
|
80
|
-
applyEffects(effects: typeof
|
|
80
|
+
applyEffects(effects: typeof haneulBcs.TransactionEffects.$inferType): Promise<void>;
|
|
81
81
|
}
|
|
82
82
|
//#endregion
|
|
83
83
|
export { AsyncCache, ObjectCache, ObjectCacheOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectCache.d.mts","names":[],"sources":["../../src/transactions/ObjectCache.ts"],"
|
|
1
|
+
{"version":3,"file":"ObjectCache.d.mts","names":[],"sources":["../../src/transactions/ObjectCache.ts"],"mappings":";;;;;UAQiB,gBAAA;EAChB,QAAA;EACA,OAAA;EACA,MAAA;EACA,KAAA;EACA,oBAAA;AAAA;AAAA,UAGgB,sBAAA;EAChB,OAA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A,GAAA,CAAa,GAAA,UAAa,KAAA,EAAO,CAAA,GAAC,OAAA;EAIlC,YAAA,CAAa,GAAA,WAAW,OAAA;AAAA;AAAA,UAwCd,kBAAA;EAChB,KAAA,GAAQ,UAAA;EACR,SAAA,IAAa,OAAA,SAAgB,SAAA,CAAI,kBAAA,CAAmB,UAAA,KAAe,OAAA;AAAA;AAAA,cAGvD,WAAA;EAAA;;IAIE,KAAA;IAA6B;EAAA,GAAa,kBAAA;EAKxD,QAAA,CAAA,GAAY,iBAAA;EAqEN,KAAA,CAAA,GAAK,OAAA;EAIL,yBAAA,CAA0B,GAAA;IAAO,OAAA;IAAiB,MAAA;IAAgB,QAAA;EAAA,IAAkB,OAAA,CAAA,sBAAA;EAIpF,UAAA,CAAW,GAAA,aAAa,OAAA,EAAA,gBAAA;EAIxB,aAAA,CAAc,GAAA,aAAa,OAAA;EAI3B,iBAAA,CAAA,GAAiB,OAAA;EAIjB,WAAA,CAAA,GAAW,OAAA;EAIX,SAAA,GAAA,CAAa,GAAA,WAAW,OAAA,CAAA,CAAA;EAIxB,SAAA,GAAA,CAAa,GAAA,UAAa,KAAA,EAAO,CAAA,GAAC,OAAA;EAIlC,YAAA,CAAa,GAAA,WAAW,OAAA;EAIxB,YAAA,CAAa,OAAA,SAAgB,SAAA,CAAI,kBAAA,CAAmB,UAAA,GAAU,OAAA;AAAA"}
|
|
@@ -8,7 +8,7 @@ import { createPure } from "./pure.mjs";
|
|
|
8
8
|
import { SignatureWithBytes, Signer } from "../cryptography/keypair.mjs";
|
|
9
9
|
import "../cryptography/index.mjs";
|
|
10
10
|
import { ClientWithCoreApi } from "../client/core.mjs";
|
|
11
|
-
import * as
|
|
11
|
+
import * as _haneullabs_bcs1124 from "@haneullabs/bcs";
|
|
12
12
|
import { SerializedBcs } from "@haneullabs/bcs";
|
|
13
13
|
import { InferInput } from "valibot";
|
|
14
14
|
|
|
@@ -77,7 +77,7 @@ declare class Transaction {
|
|
|
77
77
|
getData(): {
|
|
78
78
|
version: 2;
|
|
79
79
|
sender?: string | null | undefined;
|
|
80
|
-
expiration?:
|
|
80
|
+
expiration?: _haneullabs_bcs1124.EnumOutputShapeWithKeys<{
|
|
81
81
|
None: true;
|
|
82
82
|
Epoch: string | number;
|
|
83
83
|
ValidDuring: {
|
|
@@ -99,8 +99,8 @@ declare class Transaction {
|
|
|
99
99
|
digest: string;
|
|
100
100
|
}[] | null;
|
|
101
101
|
};
|
|
102
|
-
inputs:
|
|
103
|
-
Object:
|
|
102
|
+
inputs: _haneullabs_bcs1124.EnumOutputShapeWithKeys<{
|
|
103
|
+
Object: _haneullabs_bcs1124.EnumOutputShapeWithKeys<{
|
|
104
104
|
ImmOrOwnedObject: {
|
|
105
105
|
objectId: string;
|
|
106
106
|
version: string | number;
|
|
@@ -139,13 +139,13 @@ declare class Transaction {
|
|
|
139
139
|
Balance: string;
|
|
140
140
|
$kind: "Balance";
|
|
141
141
|
};
|
|
142
|
-
withdrawFrom:
|
|
142
|
+
withdrawFrom: _haneullabs_bcs1124.EnumOutputShapeWithKeys<{
|
|
143
143
|
Sender: true;
|
|
144
144
|
Sponsor: true;
|
|
145
145
|
}, "Sender" | "Sponsor">;
|
|
146
146
|
};
|
|
147
147
|
}, "Pure" | "Object" | "FundsWithdrawal" | "UnresolvedPure" | "UnresolvedObject">[];
|
|
148
|
-
commands:
|
|
148
|
+
commands: _haneullabs_bcs1124.EnumOutputShapeWithKeys<{
|
|
149
149
|
MoveCall: {
|
|
150
150
|
package: string;
|
|
151
151
|
module: string;
|
|
@@ -344,6 +344,32 @@ declare class Transaction {
|
|
|
344
344
|
$kind: "GasCoin";
|
|
345
345
|
GasCoin: true;
|
|
346
346
|
};
|
|
347
|
+
/**
|
|
348
|
+
* Creates a coin of the specified type and balance.
|
|
349
|
+
* Sourced from address balance when available, falling back to owned coins.
|
|
350
|
+
*/
|
|
351
|
+
coin({
|
|
352
|
+
type,
|
|
353
|
+
balance,
|
|
354
|
+
useGasCoin
|
|
355
|
+
}: {
|
|
356
|
+
balance: bigint | number;
|
|
357
|
+
type?: string;
|
|
358
|
+
useGasCoin?: boolean;
|
|
359
|
+
}): TransactionResult;
|
|
360
|
+
/**
|
|
361
|
+
* Creates a Balance object of the specified type and balance.
|
|
362
|
+
* Sourced from address balance when available, falling back to owned coins.
|
|
363
|
+
*/
|
|
364
|
+
balance({
|
|
365
|
+
type,
|
|
366
|
+
balance,
|
|
367
|
+
useGasCoin
|
|
368
|
+
}: {
|
|
369
|
+
balance: bigint | number;
|
|
370
|
+
type?: string;
|
|
371
|
+
useGasCoin?: boolean;
|
|
372
|
+
}): TransactionResult;
|
|
347
373
|
/**
|
|
348
374
|
* Add a new object input to the transaction.
|
|
349
375
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.d.mts","names":[],"sources":["../../src/transactions/Transaction.ts"],"
|
|
1
|
+
{"version":3,"file":"Transaction.d.mts","names":[],"sources":["../../src/transactions/Transaction.ts"],"mappings":";;;;;;;;;;;;;;;KAyCY,yBAAA,GACT,OAAA,CAAQ,UAAA,QAAkB,cAAA;EAAmB,KAAA;EAAgB,IAAA;AAAA,OAE7D,EAAA,EAAI,WAAA,KACC,OAAA,CAAQ,UAAA,QAAkB,cAAA;EAAmB,KAAA;EAAgB,IAAA;AAAA,MAClE,qBAAA,CAAsB,yBAAA;AAAA,KAEb,iBAAA,GAAoB,OAAA,CAAQ,QAAA;EAAY,MAAA;AAAA,KACnD,OAAA,CAAQ,QAAA;EAAY,YAAA;AAAA;AAAA,KAET,yBAAA,GACT,OAAA,CAAQ,QAAA;EAAY,MAAA;AAAA,cACX,OAAA,CAAQ,QAAA;EAAY,YAAA;AAAA;AAAA,KAEpB,qBAAA,WACD,yBAAA,UAAmC,yBAAA,YACzC,EAAA,EAAI,WAAA,KAAgB,OAAA,CAAQ,CAAA;AAAA,cAiE3B,iBAAA;AAAA,UAEI,WAAA,SAAoB,uBAAA;EAC7B,MAAA,EAAQ,MAAA;AAAA;AAAA,i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;EAAA,IACR,iBAAA;EAUD,QAAA,CAAA;IACC,SAAA,EAAW,IAAA;IAAA,GACR;EAAA;IAGD,OAAA;IACA,MAAA;IACA,QAAA;IACA,SAAA,IAAa,mBAAA,GAAsB,aAAA;IACnC,aAAA;EAAA;IAGA,MAAA;IACA,SAAA,IAAa,mBAAA,GAAsB,aAAA;IACnC,aAAA;EAAA,IACC,iBAAA;EAQJ,eAAA,CACC,OAAA,GAAU,yBAAA,cACV,OAAA,EAAS,mBAAA,GAAsB,aAAA,iBAA2B,iBAAA;EAW3D,WAAA,CAAA;IACC,IAAA;IACA;EAAA;IAEA,QAAA,GAAW,yBAAA;IACX,IAAA;EAAA,IACA,iBAAA;;;;;;;;EAgBD,UAAA,CAAA;IAAa,MAAA;IAAQ;EAAA;IAAU,MAAA;IAAkC,IAAA;EAAA;IAChE,KAAA;IACA,KAAA;IACA,IAAA;EAAA;;;;;EAuBD,SAAA,CAAA;EAIM,MAAA,CAAO,OAAA,GAAS,2BAAA,GAAmC,OAAA;;EAmBnD,IAAA,CAAK,OAAA,EAAS,WAAA,GAAc,OAAA,CAAQ,kBAAA;;;;;;;;;;EAe1C,0BAAA,CAA2B,OAAA;IAAW,gBAAA;EAAA;;;;;;;;;;;;EA2BtC,eAAA,CAAA;EArbI;EAscE,KAAA,CAAM,OAAA,GAAS,uBAAA,GAA+B,OAAA,CAAQ,UAAA,CAAW,WAAA;;EASjE,SAAA,CACL,OAAA;IACC,MAAA,GAAS,iBAAA;EAAA,IAER,OAAA;EAsJG,uBAAA,CAAwB,OAAA,EAAS,2BAAA,GAA2B,OAAA;AAAA"}
|
|
@@ -10,7 +10,7 @@ import { needsTransactionResolution, resolveTransactionPlugin } from "./resolve.
|
|
|
10
10
|
import { createObjectMethods } from "./object.mjs";
|
|
11
11
|
import { createPure } from "./pure.mjs";
|
|
12
12
|
import { namedPackagesPlugin } from "./plugins/NamedPackagesPlugin.mjs";
|
|
13
|
-
import { COIN_WITH_BALANCE, resolveCoinBalance } from "./intents/CoinWithBalance.mjs";
|
|
13
|
+
import { COIN_WITH_BALANCE, coinWithBalance, createBalance, resolveCoinBalance } from "./intents/CoinWithBalance.mjs";
|
|
14
14
|
import { fromBase64, isSerializedBcs } from "@haneullabs/bcs";
|
|
15
15
|
import { is, parse } from "valibot";
|
|
16
16
|
|
|
@@ -185,6 +185,28 @@ var Transaction = class Transaction {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
+
* Creates a coin of the specified type and balance.
|
|
189
|
+
* Sourced from address balance when available, falling back to owned coins.
|
|
190
|
+
*/
|
|
191
|
+
coin({ type, balance, useGasCoin }) {
|
|
192
|
+
return this.add(coinWithBalance({
|
|
193
|
+
type,
|
|
194
|
+
balance,
|
|
195
|
+
useGasCoin
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Creates a Balance object of the specified type and balance.
|
|
200
|
+
* Sourced from address balance when available, falling back to owned coins.
|
|
201
|
+
*/
|
|
202
|
+
balance({ type, balance, useGasCoin }) {
|
|
203
|
+
return this.add(createBalance({
|
|
204
|
+
type,
|
|
205
|
+
balance,
|
|
206
|
+
useGasCoin
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
188
210
|
* Add a new object input to the transaction using the fully-resolved object reference.
|
|
189
211
|
* If you only have an object ID, use `builder.object(id)` instead.
|
|
190
212
|
*/
|