{"record":{"id":"f9adbf8589ac25a5","repo":"unionlabs/union","slug":"no-return-value-from-compute-salt","errorCode":null,"errorMessage":"No return value from compute_salt","messagePattern":"No return value from compute_salt","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts-sdk/src/sui/quote-token.ts","lineNumber":50,"sourceCode":"    const function_arguments = [\n      tx.pure.u256(0),\n      tx.pure.u32(config.channelId),\n      tx.pure(\"vector<u8>\", hexToBytes(converted_base_token)),\n    ]\n\n    const result = yield* readContract(\n      client,\n      \"0x835e6a7d0e415c0f1791ae61241f59e1dd9d669d59369cd056f02b3275f68779\",\n      contract_address,\n      module_id,\n      function_name,\n      [],\n      function_arguments,\n      tx,\n    )\n\n    if (!result || result.length === 0 || !result[0].returnValues || !result[0].returnValues[0]) {\n      throw new Error(\"No return value from compute_salt\")\n    }\n    const [rawBytes /*, _typeTag*/] = result[0].returnValues[0] as [number[], string]\n\n    return bytesToHex(rawBytes.slice(1))\n  })\n","sourceCodeStart":32,"sourceCodeEnd":56,"githubUrl":"https://github.com/unionlabs/union/blob/031785bb6dc6b957c624e62bc64c184409c97d7b/ts-sdk/src/sui/quote-token.ts#L32-L56","documentation":"compute_salt reads a Move function via the same dev-inspect wrapper (moveCall on package 0x835e…779 executed with devInspectTransactionBlock) and requires result[0].returnValues[0] to hold the returned vector<u8>; the caller then strips the BCS length prefix (slice(1)) and hex-encodes it. An aborted simulation or unexpected result shape leaves returnValues empty and triggers this throw.","triggerScenarios":"Wrong or mis-ordered function_arguments (the salt inputs, e.g. chain/counterparty addresses) causing the Move entry to abort; module_id/function_name drift after a contract upgrade; network mismatch between client and the hardcoded package address.","commonSituations":"Contract upgrades changing the compute_salt signature while the SDK pins the old one; testnet addresses used against mainnet.","solutions":["Confirm the module/function still exist with the expected signature on package 0x835e…779 for your network","Check the argument encoding and order against the Move source before calling","Handle the defect explicitly (Effect.catchDefect) and surface the dev-inspect status/error for diagnosis"],"exampleFix":"// before\nif (!result || result.length === 0 || !result[0].returnValues || !result[0].returnValues[0]) {\n  throw new Error(\"No return value from compute_salt\")\n}\n\n// after\nconst r = result?.[0]\nconst status = (r as { status?: { status?: string; error?: string } })?.status\nif (status?.status === \"failure\") {\n  throw new Error(`compute_salt aborted: ${status.error ?? \"unknown Move abort\"}`)\n}\nif (!r?.returnValues?.[0]) {\n  throw new Error(\"No return value from compute_salt\")\n}","handlingStrategy":"try-catch","validationCode":"// confirm the target module/function exist on the package before the read\nconst pkg = await client.getObject({ id: packageId })\nif (pkg.data?.content?.dataType !== \"package\") {\n  throw new Error(`Package ${packageId} not found on this network`)\n}","typeGuard":"const hasReturnValue = (\n  r: { returnValues?: unknown[][] } | undefined,\n): r is { returnValues: [unknown[], ...unknown[][]] } =>\n  Array.isArray(r?.returnValues) && r.returnValues.length > 0 && Array.isArray(r.returnValues[0])","tryCatchPattern":"import { Effect, Exit } from \"effect\"\n\nconst exit = await Effect.runPromiseExit(\n  program.pipe(Effect.catchDefect(e => Effect.fail(e))),\n)\nif (Exit.isFailure(exit)) {\n  // check argument order/encoding and the current compute_salt signature\n}","preventionTips":["After contract upgrades, re-verify compute_salt's signature matches the SDK's call","Keep function_arguments construction next to the Move function's definition","Log dev-inspect status/error when returnValues is empty to get the real abort code"],"tags":["sui","dev-inspect","move","salt"],"backgroundTag":null,"analyzedSha":"031785bb6dc6b957c624e62bc64c184409c97d7b","analyzedAt":"2026-08-16T06:24:09.996Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}