surf icon indicating copy to clipboard operation
surf copied to clipboard

Type mismatch for argument 0, type '&signer'

Open banool opened this issue 3 months ago • 2 comments

With code like this:

export const USER_ONE_ACCOUNT = Account.generate();

// fund account

  const payload = createEntryPayload(GLOBAL_METADATA_ABI, {
    function: 'register_blob',
    functionArguments: [
      blobNameSuffix,
      expirationMicros,
      blobCommitment,
      chunksetCount,
      blobSize,
      paymentTierId,
      encodingId,
    ],
    typeArguments: [],
  });

  const transaction = await aptos.transaction.build.simple({
    sender: USER_ONE_ACCOUNT.accountAddress,
    data: payload,
  });

  const signedTransaction = await aptos.signAndSubmitTransaction({
    signer: USER_ONE_ACCOUNT,
    transaction,
  });

With corresponding Move code like this:

    #[randomness]
    entry fun register_blob(
        writer: &signer,
        blob_name_suffix: String,
        expiration_micros: u64,
        blob_commitment: vector<u8>,
        chunkset_count: u32,
        blob_size: u64,
        payment_tier_id: u8,
        encoding_u8: u8, 
    ) acquires Blobs, PaymentTiers, Slices {
        register_blob_internal(writer, blob_name_suffix, expiration_micros, blob_commitment, chunkset_count, blob_size, payment_tier_id, encoding_u8, object::address_to_object<Metadata>(@shelby_usd_token_metadata));
    }

The typechecker is happy, but then I get an error from the node:

Error: Error: Type mismatch for argument 0, type '&signer'
    at parseArg (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/transactions/transactionBuilder/remoteAbi.ts:555:9)
    at checkOrConvertArgument (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/transactions/transactionBuilder/remoteAbi.ts:326:10)
    at convertArgument (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/transactions/transactionBuilder/remoteAbi.ts:276:10)
    at <anonymous> (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/transactions/transactionBuilder/transactionBuilder.ts:219:5)
    at Array.map (<anonymous>)
    at generateTransactionPayloadWithABI (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/transactions/transactionBuilder/transactionBuilder.ts:204:87)
    at ur (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/transactions/transactionBuilder/transactionBuilder.ts:159:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Ya (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/internal/transactionSubmission.ts:141:15)
    at async A (/Users/dport/a/shelby/rust/apps/sp-processor/e2e-tests/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aptos-labs/ts-sdk/src/internal/transactionSubmission.ts:97:19)

I wonder if there's some incompatibility between Surf and the TS SDK? My versions:

  • Surf: 1.9.7
  • TS SDK: 5.1.1

banool avatar Oct 31 '25 18:10 banool

Relevant section of the ABI looks like this btw:

{
  name: 'register_blob',
  visibility: 'private',
  is_entry: true,
  is_view: false,
  generic_type_params: [],
  params: ['&signer', '0x1::string::String', 'u64', 'vector<u8>', 'u32', 'u64', 'u8', 'u8'],
  return: [],
}

banool avatar Oct 31 '25 18:10 banool

With version 1.9.1 of Surf I get this error instead:

Error: TypeError: Cannot read properties of undefined (reading 'length')

From 1.9.2 onwards I get the error in the original report.

banool avatar Oct 31 '25 19:10 banool