Move.

Post

Share your knowledge.

mssoni.
Mar 11, 2025
Discussion

How do I fix a type mismatch error in a Move transaction?

I'm working on a transaction in Move language involving a purchase function for a kiosk, but I keep hitting an error indicating a type mismatch, specifically EFieldTypeMismatch: u64 = 2 from dynamic_field.move. I've tried using BUYER_KIOSK instead of BUYER, but with no success. The transaction script involves splitting coins, assigning to coin, making move-calls, and confirming requests, but it fails at remove_child_object. Could this error be due to the incorrect type for function arguments? How can I resolve this?

(\
PRICE="5000000000"; \
PACKAGE="0x4"; \
PURCHASE_COIN="0x5"; \
ITEM="0x6"; \
ITEM_TRANSFER_POLICY_TYPE="<0x2::transfer_policy::TransferPolicy<$PACKAGE::factory::Nft>>"; \
ITEM_TRANSFER_POLICY="0x7"; \
SELLER_KIOSK="0x8"; \
BUYER_KIOSK="0x9"; \
BUYER="0x10"; \
sui client ptb \
    --split-coins @$PURCHASE_COIN "[$PRICE]" \
    --assign coin \
    --move-call 0x2::kiosk::purchase "<0x2::kiosk::Kiosk>" @$SELLER_KIOSK @$ITEM coin.0 \
    --assign purchase_result \
    --move-call 0x2::transfer_policy::confirm_request $ITEM_TRANSFER_POLICY_TYPE @$ITEM_TRANSFER_POLICY purchase_result.1 \
    --move-call 0x2::transfer::public_transfer "<0x2::kiosk::Item>" purchase_result.0 @$BUYER \
    --gas-budget 1000000000 \
    --json\
)
  • Move CLI
  • Move
2
2
Share
Comments
.

Answers

2
Bahador.
Mar 11 2025, 11:05

As the error is mentioning, there could be a type mismatch. Please provide your code and show where is the problem.

2
Comments
.
mssoni.
Mar 11 2025, 15:04

Yeah, thanks mate, edited my question. Could you give it a look now?

jogador_1.
Mar 14 2025, 05:57

It seems like the misunderstanding stems from the expected type in your transaction. The <TYPE> in your move-call isn't necessarily the type of the first argument; instead, the function may be using generics. By ensuring that the type arguments match what's expected by the function, you may resolve the issue.

0
Comments
.

Do you know the answer?

Please log in and share it.

Move is an executable bytecode language used to implement custom transactions and smart contracts.

148Posts231Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignJune
We use cookies to ensure you get the best experience on our website.
More info