RE: Problem Receiving Objects

Hi Sui Team,

I need a bit of help,

I want to receive a “LiquidChannelV2” object and then be able to transfer it back to the sender. I have defined the relevant function in a Move module. The module gets invoked by the frontend client (which I have written in flutter). However I face an issue in the signing process and I can’t seem to click onto what is happening here.

The following is the code for the backend function and the frontend logic, with the signing issue highlighted at the end:

public fun receive_channel_v2(current:&mut LiquidChannelV2, receiving_channel:Receiving<LiquidChannelV2>, ctx: &mut TxContext)
    {
        let receivedChannel = transfer::receive(&mut current.id, receiving_channel);
        transfer::transfer(receivedChannel, tx_context::sender(ctx));
    }

Frontend Client:

// Fetch all owned objects by the particular object
var response = await devnetClient.getOwnedObjects(
  state.parentChannel.objectId,
);

// Use the module to receive the object in the wallet
final txb = TransactionBlock();
txb.moveCall(
  "$CHANNEL_CONNECT_PACKAGE_ID::channel_connect::receive_channel_v2",
  arguments: [
    txb.object(state.parentChannel.objectId),
    txb.object(object.channel.objectId)
  ]
);

final address = jwtToAddress(
  state.zkLoginBody!.jwt,
  BigInt.parse(state.zkLoginBody!.salt)
);
txb.setSenderIfNotSet(address);

// Sign the transaction
final sign = await txb.sign(SignOptions(
  signer: state.keypair!, 
  client: devnetClient
));

_____facing issue in the sign part_____

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Error checking transaction input objects: IncorrectUserSignature { error: \"Object 0xcefd88f166ef91bd28049644ae02cf415700f6cc30bc3a478e88ae2f38c5e45f is owned by account address 0xe26c8319fefe035bf5875da23aac86da4ade6daaa047088967b4548a005ba187, but given owner/signer address is 0x6e671eabe3922dce33c82a516de3db16030a17c4830f54907ef1a1ab950850d6\" }"
  },
  "id": 123
}

Now, if the parent object is owned by
0x6e671eabe3922dce33c82a516de3db16030a17c4830f54907ef1a1ab950850d6

Why I do I get the error “IncorrectUserSignature”?

What am I missing in this picture?

Thank you in advance for your help in this matter. We’re all on a learning curve here, we might be missing something, or is this a deeper issue?

I found the solution. The problem lay in the SUI Client Dart SDK. I was using the default for the receiving type, this led to the input parameters interpreting receiving objects as owned objects, hence the issue. The solution was to custom specify the receiving type.